System.register([],(function(t,e){"use strict";return{execute:function(){function i(t){var e,i;return e=(t>65535)<<4,e|=i=((t>>>=e)>255)<<3,e|=i=((t>>>=i)>15)<<2,(e|=i=((t>>>=i)>3)<<1)|(t>>>=i)>>1}function n(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24}function r(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 s(t){return--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}t({AntiAliasing:void 0,BitMask:ce,CCClass:hi,CacheMode:void 0,DebugMode:void 0,DeviceType:void 0,Enum:_e,Eventify:Da,ExtrapolationMode:void 0,HorizontalTextAlignment:void 0,InstanceMaterialType:void 0,KeyCode:void 0,NodeEventType:void 0,NodeSpace:void 0,Overflow:void 0,PipelineEventType:void 0,QuatInterpolationMode:void 0,RealInterpolationMode:void 0,SystemEventType:void 0,TangentWeightMode:void 0,TransformBit:void 0,VerticalTextAlignment:void 0,WorldNode3DToLocalNodeUI:ux,WorldNode3DToWorldNodeUI:hx,XrKeyboardEventType:void 0,XrUIPressEventType:void 0,__checkObsoleteInNamespace__:function(t){return ct||(ct="undefined"==typeof Proxy?{}:new Proxy(t,{get:function(t,e,i){return dt(e),Reflect.get(t,e,i)}})),ct},__checkObsolete__:function(t){for(var e,i=y(t);!(e=i()).done;)dt(e.value)},absMax:Ni,absMaxComponent:Bi,approx:gi,assert:U,assertID:Z,bezier:qf,bezierByTime:fd,buildShadowPass:uF,buildShadowPasses:lF,ccenum:pe,clamp:vi,clamp01:yi,color:ki,computeRatioByType:QJ,createDefaultPipeline:_L,debug:G,deprecateModuleExportedName:ft,deserialize:e_,earcut:OY,enumerableProps:Mi,equals:mi,error:F,errorID:K,find:qw,fragmentText:KU,getBaselineOffset:function(){return 0},getCameraUniqueID:fF,getEnglishWordPartAtFirst:jU,getEnglishWordPartAtLast:YU,getError:J,getLoadOpOfClearFlag:dF,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)},getRenderArea:oF,getSerializationMetadata:function(t){return t[yh]},getWorldTransformUntilRoot:function(t,e,i){for(un.identity(i);t!==e;)un.fromRTS(L1,t.rotation,t.position,t.scale),un.multiply(i,L1,i),t=t.parent;return i},instantiate:v_,inverseLerp:Di,isDisplayStats:$,isEnglishWordPartAtFirst:function(t){return zU.test(t)},isEnglishWordPartAtLast:function(t){return kU.test(t)},isUnicodeCJK:HU,isUnicodeSpace:VU,isValid:Ra,lerp:Ei,log:M,logID:W,markAsWarning:void 0,mat4:cn,murmurhash2_32_gc:Vs,nextPow2:Oi,pingPong:Pi,pseudoRandom:Ci,pseudoRandomRange:wi,pseudoRandomRangeInt:Ii,quat:an,randomRange:Ri,randomRangeInt:bi,rect:En,removeProperty:void 0,repeat:xi,replaceProperty:void 0,safeMeasureText:WU,sampleAnimationCurve:qJ,setDefaultLogTimes:function(t){t>0&&(ut=t)},setDisplayStats:tt,size:vn,toDegree:Si,toRadian:Ti,tween:p8,tweenUtil:m8,v2:pn,v3:qi,v4:Fi,validPunctualLightsCulling:mF,warn:L,warnID:j});var a=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:n,countTrailingZeros:r,nextPow2:s,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 a[255&t]<<24|a[t>>>8&255]<<16|a[t>>>16&255]<<8|a[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>>>r(t)+1}});function u(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.")}return(i=t[Symbol.iterator]()).next.bind(i)}function E(t,e,i,n){i&&Object.defineProperty(t,e,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(n):void 0})}function T(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 S(t,e){const i="undefined"==typeof window?global:window;return void 0===i[t]?i[t]=e:i[t]}t("bits",o),S("CC_WECHAT",!1),S("CC_BAIDU",!1),S("CC_XIAOMI",!1),S("CC_ALIPAY",!1),S("CC_BYTEDANCE",!1),S("CC_OPPO",!1),S("CC_VIVO",!1),S("CC_HUAWEI",!1),S("CC_COCOSPLAY",!1),S("CC_QTT",!1),S("CC_LINKSURE",!1);const A=!1;S("CC_EDITOR",!1),S("CC_PREVIEW",!1),S("CC_BUILD",!0),S("CC_TEST",!1),S("CC_DEBUG",!1),S("CC_DEV",!1),S("CC_MINIGAME",!1),S("CC_RUNTIME_BASED",!1),S("CC_SUPPORT_JIT",!0),S("CC_JSB",!1);var R="undefined"==typeof window?global:window,b=t("cclegacy",{_global:R});b.internal={};var C=t("VERSION","3.6.2");R.CocosEngine=b.ENGINE_VERSION=C,R.cc=b;var w="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",I=null,O=console.log.bind(console),x=O,P=O,D=function(t,e){if(!t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r1?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;rq.ERROR){var e=function(t){if(b.game.canvas){if(!I){var e=document.createElement("Div");e.setAttribute("id","logInfoDiv"),e.setAttribute("width","200"),e.setAttribute("height",b.game.canvas.height);var i=e.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(I=document.createElement("textarea")).setAttribute("rows","20"),I.setAttribute("cols","30"),I.setAttribute("disabled","true");var n=I.style;n.backgroundColor="transparent",n.borderBottom="1px solid #cccccc",n.borderTopWidth=n.borderLeftWidth=n.borderRightWidth="0px",n.borderTopStyle=n.borderLeftStyle=n.borderRightStyle="none",n.padding="0px",n.margin="0px",e.appendChild(I),b.game.canvas.parentNode.appendChild(e)}I.value=I.value+t+"\r\n",I.scrollTop=I.scrollHeight}};P=function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r2?n-2:0),s=2;s1?i-1:0),r=1;r1?i-1:0),r=1;r1?e-1:0),n=1;n2?i-2:0),r=2;r1?e-1:0),n=1;n1?e-1:0),n=1;n1?n-1:0),s=1;s1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n2?i-2:0),r=2;r1?e-1:0),n=1;no.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,t+"."+e,i+"."+n),o.count++)},et=t("replaceProperty",(function(t,e,i){null!=t&&i.forEach((function(i){var n=ht++;lt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ut});var r=null!=i.target?i.target:t,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:e,o=r===t,u=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)t[i.name]=function(){var t;return rt(e,i.name,a,s,L,n,u),(t=i.customFunction).call.apply(t,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var h=null!=i.customSetter,l=null!=i.customGetter;h&&l?Object.defineProperty(t,i.name,{get:function(){return rt(e,i.name,a,s,L,n,u),i.customGetter.call(this)},set:function(t){rt(e,i.name,a,s,L,n,u),i.customSetter.call(this,t)},enumerable:!1}):h?Object.defineProperty(t,i.name,{set:function(t){rt(e,i.name,a,s,L,n,u),i.customSetter.call(this,t)},enumerable:!1}):l&&Object.defineProperty(t,i.name,{get:function(){return rt(e,i.name,a,s,L,n,u),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(t,i.name,{get:function(){return rt(e,i.name,a,s,L,n,u),o?this[s]:r[s]},set:function(t){rt(e,i.name,a,s,L,n,u),o?this[s]=t:r[s]=t},enumerable:!1})}))})),at=function(t,e,i,n,r){var s=lt.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,t+"."+e),s.count++)},it=t("removeProperty",(function(t,e,i){null!=t&&i.forEach((function(i){var n=ht++;lt.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ut});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(t,i.name,{get:function(){return at(e,i.name,F,n,r)},set:function(){at(e,i.name,F,n,r)},enumerable:!1})}))})),st=function(t,e,i,n,r){var s=lt.get(n);s&&s.logTimes>s.count&&(i("'%s' is deprecated. "+r,t+"."+e),s.count++)},nt=t("markAsWarning",(function(t,e,i){null!=t&&i.forEach((function(i){var n=i.name,r=Object.getOwnPropertyDescriptor(t,n);if(r&&r.configurable){var s=ht++;lt.set(s,{id:s,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ut});var a=i.suggest?"("+i.suggest+")":"";if(void 0!==r.value)if("function"==typeof r.value){var o=r.value;t[n]=function(){return st(e,n,L,s,a),o.call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}}else{var u=r.value;Object.defineProperty(t,n,{configurable:!0,get:function(){return st(e,n,L,s,a),u}}),r.writable&&Object.defineProperty(t,n,{set:function(t){st(e,n,L,s,a),u=t}})}else!function(e,i,n,r,s,a){if(e.get){var o=e.get;e.get=function(){return st(i,n,r,s,a),o.call(this)}}if(e.set){var u=e.set;e.set=function(t){st(i,n,r,s,a),u.call(this,t)}}Object.defineProperty(t,n,e)}(r,e,n,L,s,a);Object.defineProperty(t,n,{enumerable:!1})}}))}));var ct,_t={};function ft(t){for(var e in t){var i=t[e];_t[e]=i}}function dt(t){var e=_t[t];if(e){var i=e.newName,n=e.since;e.removed?i?K(16003,t,n,i):K(16002,t,n):i?j(16001,t,n,i):j(16e3,t,n)}}var pt=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)},h(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 mt(t,e){t.splice(e,1)}function gt(t,e){var i=t.length;e<0||e>=i||(t[e]=t[i-1],t.length=i-1)}function vt(t,e){var i=t.indexOf(e);return i>=0&&(mt(t,i),!0)}function yt(t,e){return t.indexOf(e)>=0}var Et=Object.freeze({__proto__:null,removeAt:mt,fastRemoveAt:gt,remove:vt,fastRemove:function(t,e){var i=t.indexOf(e);i>=0&&(t[i]=t[t.length-1],--t.length)},removeIf:function(t,e){var i=t.findIndex(e);if(i>=0){var n=t[i];return mt(t,i),n}},verifyType:function(t,e){if(t&&t.length>0)for(var i,n=y(t);!(i=n()).done;)if(!(i.value instanceof e))return W(1300),!1;return!0},removeArray:function(t,e){for(var i=0,n=e.length;i1?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}(),he=Et,le={IDGenerator:Tt,Pool:ue,array:Et,isNumber:bt,isString:Ct,isEmptyObject:wt,getPropertyDescriptor:zt,addon:Vt,mixin:Wt,extend:Xt,getSuper:jt,isChildClassOf:Yt,clear:Kt,value:Ot,getset:xt,get:Pt,set:Dt,unregisterClass:ie,getClassName:Nt,setClassName:te,setClassAlias:ee,getClassByName:se,getClassById:re,get _registeredClassNames(){return l({},Qt)},set _registeredClassNames(t){Kt(Qt),Object.assign(Qt,t)},get _registeredClassIds(){return l({},qt)},set _registeredClassIds(t){Kt(qt),Object.assign(qt,t)},_getClassId:ae,getClassId:oe,_setClassId:Jt,_getClassById:ne,obsolete:Mt,obsoletes:Lt,formatStr:Gt,shiftArguments:kt,createMap:Bt};function ce(t){if("__bitmask__"in t)return t;Ot(t,"__bitmask__",null,!0);for(var e=-1,i=Object.keys(t),n=0;ni){var n=e;e=i,i=n}return t=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||Le(r,(e=i[n+1])&&e.__attrs__)}return Le(t,(e=i[0])&&e.__attrs__),t.__attrs__}function Ue(t,e){var i=Ge(t),n=e+Me,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function Ge(t){return t.hasOwnProperty("__attrs__")&&t.__attrs__||Fe(t)}function ke(t,e,i,n){Ge(t)[e+Me+i]=n}var ze=function(){function t(t,e){this.name=void 0,this.default=void 0,this.name=t,this.default=e}return t.prototype.toString=function(){return this.name},t}(),He=t("CCInteger",new ze("Integer",0));b.Integer=He,b.CCInteger=He;var Ve=t("CCFloat",new ze("Float",0));b.Float=Ve,b.CCFloat=Ve;var We=t("CCBoolean",new ze("Boolean",!1));b.Boolean=We,b.CCBoolean=We;var Xe=t("CCString",new ze("String",""));function je(t,e){return function(i,n){var r='"'+Nt(i)+"."+n+'"',s=Ue(i,n),a=s.type;if(a===He||a===Ve?a="Number":a!==Xe&&a!==We||(a=""+a),a===t){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Pe(o)){var u=typeof o,h=t.toLowerCase();if(u===h)if("object"===h){if(!o||o instanceof s.ctor)return;j(3605,r,Nt(s.ctor))}else"Number"!==t&&j(3606,e,r,t);else{if("function"===u)return;t===Xe.default&&null==o?j(3607,r):j(3611,e,r,u)}delete s.type}}}else j(3604,r)}}b.String=Xe,b.CCString=Xe;var Ye=Object.freeze({__proto__:null,DELIMETER:Me,createAttrsSingle:Le,createAttrs:Fe,attr:Ue,getClassAttrs:Ge,setClassAttr:ke,PrimitiveType:ze,CCInteger:He,CCFloat:Ve,CCBoolean:We,CCString:Xe,getTypeChecker_ET:je,getObjTypeChecker_ET:function(t){return function(e,i){je("Object","type")(e,i);var n=Ge(e)[i+Me+"default"],r=b.Class.getDefault(n);if(!Array.isArray(r)&&Yt(t,b.ValueType)){var s=Nt(t),a=Gt('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Nt(e),i,s);n?M(a):j(3612,a,s,Nt(e),i,s)}}}}),Ke={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function qe(t,e,i,n){if(!t.get&&!t.set&&t.hasOwnProperty("default")){var r="_N$"+e;t.get=function(){return this[r]},t.set=function(t){var e=this[r];this[r]=t,i.call(this,e)};var s={};for(var a in n[r]=s,Ke){var o=Ke[a];t.hasOwnProperty(a)&&(s[a]=t[a],o.canUsedInGet||delete t[a])}}}function Qe(t,e,i,n){if(Array.isArray(e)){if(!(e.length>0))return K(5508,i,n);t.type=e=e[0]}"function"==typeof e&&(e===String?t.type=b.String:e===Boolean?t.type=b.Boolean:e===Number&&(t.type=b.Float))}function Ze(t,e,i){var n=t?{_short:!0}:{_short:!0,default:e};return i&&(n.type=i),n}function Je(t,e){if(!t||t.constructor!==Object){if(Array.isArray(t)&&t.length>0)return Ze(e,[],t);if("function"==typeof t){var i=t;return Ze(e,Yt(i,b.ValueType)?new i:null,i)}return Ze(e,t instanceof ze?t.default:t)}return null}var $e,ti=[];function ei(){return ti[ti.length-1]}b._RF={push:function(t,e,i,n){void 0===i&&(i=e,e=""),ti.push({uuid:e,script:i,module:t,exports:t.exports,beh:null,importMeta:n})},pop:function(){var t=ti.pop(),e=t.module,i=e.exports;if(i===t.exports){for(var n in i)return;e.exports=i=t.cls}},peek:ei},function(t){t[t.STANDALONE=1]="STANDALONE",t[t.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",t[t.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}($e||($e={}));var ii=Me,ni="__ctors__",ri="Enum",si="BitMask";function ai(t,e,i,n){!function(t,e){!function(t,e){t.indexOf(e)<0&&t.push(e)}(t.__props__,e)}(t,i),_i(t,n,e,i)}function oi(t,e,i,n){var r=n.get;n.set,r&&(_i(t,n,e,i),ke(t,i,"serializable",!1))}function ui(t){return"function"==typeof t?t():t}function hi(t){var e=t.name,i=t.extends,n=function(t,e,i){var n=b.Component,r=ei();if(r&&Yt(e,n)){if(Yt(r.cls,n))return K(3615),null;t=t||r.script}var s=function(t,e,i){var n=i.ctor;return Ot(n,ni,!0,!0),n.prototype,e&&(n.$super=e),te(t,n),n}(t,e,i);if(r)if(Yt(e,n)){var a=r.uuid;a&&Jt(a,s),r.cls=s}else Yt(r.cls,n)||(r.cls=s);return s}(e,i,t);e||(e=b.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=Je(n,!1);if(r&&(n=t[i]=r),n){var s=n.notify;s&&qe(n,i,s,t),"type"in n&&Qe(n,n.type,e,i)}}}(i,e),i){var s=i[r];s.get||s.set?oi(t,e,r,s):ai(t,e,r,s)}var a=Ge(t);t.__values__=t.__props__.filter((function(t){return!1!==a[t+ii+"serializable"]}))}(n,e,t.properties,i);var r=t.editor;return r&&Yt(i,b.Component)&&b.Component._registerEditorProps(n,r),n}function li(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,"__values__")}hi._isCCClass=function(t){var e;return null==t||null===(e=t.hasOwnProperty)||void 0===e?void 0:e.call(t,ni)},hi.fastDefine=function(t,e,i){te(t,e);for(var n=e.__props__=e.__values__=Object.keys(i),r=Ge(e),s=0;s=2&&((r||a())[s+"min"]=l[0],r[s+"max"]=l[1],l.length>2&&(r[s+"step"]=l[2])),h("min","number"),h("max","number"),h("step","number")}hi.isArray=function(t){return t=ui(t),Array.isArray(t)},hi.getDefault=ui,hi.escapeForJS=function(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},hi.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,hi.getNewValueTypeCode=function(t){for(var e=Nt(t),i=t.constructor,n="new "+e+"(",r=0;ri){var n=e;e=i,i=n}return ti?i:t}function yi(t){return t<0?0:t>1?1:t}function Ei(t,e,i){return t+(e-t)*i}function Ti(t){return t*fi}function Si(t){return t*di}var Ai=t("random",Math.random);function Ri(t,e){return Math.random()*(e-t)+t}function bi(t,e){return Math.floor(Ri(t,e))}function Ci(t){return(t=(9301*t+49297)%233280)/233280}function wi(t,e,i){return Ci(t)*(i-e)+e}function Ii(t,e,i){return Math.floor(wi(t,e,i))}function Oi(t){return--t,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t}function xi(t,e){return t-Math.floor(t/e)*e}function Pi(t,e){return t=xi(t,2*e),e-Math.abs(t-e)}function Di(t,e,i){return(i-t)/(e-t)}function Bi(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 Ni(t,e){return Math.abs(t)>Math.abs(e)?t:e}function Mi(t,e){e.forEach((function(e){Object.defineProperty(t,e,{enumerable:!0})}))}var Li=t("Vec4",function(t){function e(e,i,n,r){var s;return s=t.call(this)||this,e&&"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}c(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.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t.z=e.z+i.z,t.w=e.w+i.w,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t.z=e.z-i.z,t.w=e.w-i.w,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t.z=e.z*i.z,t.w=e.w*i.w,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t.z=e.z/i.z,t.w=e.w/i.w,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t.z=Math.ceil(e.z),t.w=Math.ceil(e.w),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t.w=Math.floor(e.w),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t.z=Math.min(e.z,i.z),t.w=Math.min(e.w,i.w),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t.z=Math.max(e.z,i.z),t.w=Math.max(e.w,i.w),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t.z=Math.round(e.z),t.w=Math.round(e.w),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return Math.sqrt(i*i+n*n+r*r+s*s)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=e.z-t.z,s=e.w-t.w;return i*i+n*n+r*r+s*s},e.len=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return Math.sqrt(e*e+i*i+n*n+r*r)},e.lengthSqr=function(t){var e=t.x,i=t.y,n=t.z,r=t.w;return e*e+i*i+n*n+r*r},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=-e.w,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t.z=1/e.z,t.w=1/e.w,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w;return Math.abs(i)0&&(a=1/Math.sqrt(a),t.x=i*a,t.y=n*a,t.z=r*a,t.w=s*a),t},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.random=function(t,e){e=e||1;var i=2*Ai()*Math.PI,n=2*Ai()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t.w=0,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=i.m03*n+i.m07*r+i.m11*s+i.m15*a,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,t.w=e.w,t},e.transformQuat=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,u=i.z,h=i.w,l=h*n+o*s-u*r,c=h*r+u*n-a*s,_=h*s+a*r-o*n,f=-a*n-o*r-u*s;return t.x=l*h+f*-a+c*-u-_*-o,t.y=c*h+f*-o+_*-a-l*-u,t.z=_*h+f*-u+l*-o-c*-a,t.w=e.w,t},e.toArray=function(t,e,i){return void 0===i&&(i=0),t[i+0]=e.x,t[i+1]=e.y,t[i+2]=e.z,t[i+3]=e.w,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),t.x=e[i+0],t.y=e[i+1],t.z=e[i+2],t.w=e[i+3],t},e.strictEquals=function(t,e){return t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w},e.equals=function(t,e,i){return void 0===i&&(i=pi),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 t&&"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=pi),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=pi),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=vi(this.x,t.x,e.x),this.y=vi(this.y,t.y,e.y),this.z=vi(this.z,t.z,e.z),this.w=vi(this.w,t.w,e.w),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this},i.add4f=function(t,e,i,n){return this.x+=t,this.y+=e,this.z+=i,this.w+=n,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this},i.subtract4f=function(t,e,i,n){return this.x-=t,this.y-=e,this.z-=i,this.w-=n,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec4.multiply for vector * vector operation"),this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec4.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this},i.multiply4f=function(t,e,i,n){return this.x*=t,this.y*=e,this.z*=i,this.w*=n,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this},i.divide4f=function(t,e,i,n){return this.x/=t,this.y/=e,this.z/=i,this.w/=n,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*s-i*r,this},i.length=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return Math.sqrt(t*t+e*e+i*i+n*n)},i.lengthSqr=function(){var t=this.x,e=this.y,i=this.z,n=this.w;return t*t+e*e+i*i+n*n},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=this.w,r=t*t+e*e+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=t*r,this.y=e*r,this.z=i*r,this.w=n*r),this},i.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}(ge));function Fi(t,e,i,n){return new Li(t,e,i,n)}Li.ZERO=Object.freeze(new Li(0,0,0,0)),Li.ONE=Object.freeze(new Li(1,1,1,1)),Li.NEG_ONE=Object.freeze(new Li(-1,-1,-1,-1)),hi.fastDefine("cc.Vec4",Li,{x:0,y:0,z:0,w:0}),b.Vec4=Li,b.v4=Fi;var Ui=1/255,Gi=t("Color",function(t){function e(e,i,n,r){var s;return(s=t.call(this)||this)._val=0,"string"==typeof e?s.fromHEX(e):void 0!==i?s.set(e,i,n,r):s.set(e),s}c(e,t),e.clone=function(t){var i=new e;return t._val?i._val=t._val:i._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,i},e.copy=function(t,e){return t.r=e.r,t.g=e.g,t.b=e.b,t.a=e.a,t},e.set=function(t,e,i,n,r){return t.r=e,t.g=i,t.b=n,t.a=r,t},e.toVec4=function(t,e){return(e=void 0!==e?e:new Li).x=zi(t.r),e.y=zi(t.g),e.z=zi(t.b),e.w=zi(t.a),e},e.fromVec4=function(t,i){return(i=void 0===i?new e:i).r=Hi(t.x),i.g=Hi(t.y),i.b=Hi(t.z),i.a=Hi(t.w),i},e.fromHEX=function(t,e){e=0===e.indexOf("#")?e.substring(1):e,t.r=parseInt(e.substr(0,2),16)||0,t.g=parseInt(e.substr(2,2),16)||0,t.b=parseInt(e.substr(4,2),16)||0;var i=parseInt(e.substr(6,2),16);return t.a=Number.isNaN(i)?255:i,t._val=(t.a<<24>>>0)+(t.b<<16)+(t.g<<8)+t.r,t},e.add=function(t,e,i){return t.r=e.r+i.r,t.g=e.g+i.g,t.b=e.b+i.b,t.a=e.a+i.a,t},e.subtract=function(t,e,i){return t.r=e.r-i.r,t.g=e.g-i.g,t.b=e.b-i.b,t.a=e.a-i.a,t},e.multiply=function(t,e,i){return t.r=e.r*i.r,t.g=e.g*i.g,t.b=e.b*i.b,t.a=e.a*i.a,t},e.divide=function(t,e,i){return t.r=e.r/i.r,t.g=e.g/i.g,t.b=e.b/i.b,t.a=e.a/i.a,t},e.scale=function(t,e,i){return t.r=e.r*i,t.g=e.g*i,t.b=e.b*i,t.a=e.a*i,t},e.lerp=function(t,e,i,n){var r=e.r,s=e.g,a=e.b,o=e.a;return r+=(i.r-r)*n,s+=(i.g-s)*n,a+=(i.b-a)*n,o+=(i.a-o)*n,t._val=Math.floor((o<<24>>>0)+(a<<16)+(s<<8)+r),t},e.toArray=function(t,i,n){void 0===n&&(n=0);var r=i instanceof e||i.a>1?1/255:1;return t[n+0]=i.r*r,t[n+1]=i.g*r,t[n+2]=i.b*r,t[n+3]=i.a*r,t},e.fromArray=function(t,e,i){return void 0===i&&(i=0),e.r=255*t[i+0],e.g=255*t[i+1],e.b=255*t[i+2],e.a=255*t[i+3],e},e.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=pi),Math.abs(t.r-e.r)<=i*Math.max(1,Math.abs(t.r),Math.abs(e.r))&&Math.abs(t.g-e.g)<=i*Math.max(1,Math.abs(t.g),Math.abs(e.g))&&Math.abs(t.b-e.b)<=i*Math.max(1,Math.abs(t.b),Math.abs(e.b))&&Math.abs(t.a-e.a)<=i*Math.max(1,Math.abs(t.a),Math.abs(e.a))},e.hex=function(t){return(255*t.r<<24|255*t.g<<16|255*t.b<<8|255*t.a)>>>0};var i=e.prototype;return i.clone=function(){var t=new e;return t._val=this._val,t},i.equals=function(t){return t&&this._val===t._val},i.lerp=function(t,e){var i=this.r,n=this.g,r=this.b,s=this.a;return i+=(t.r-i)*e,n+=(t.g-n)*e,r+=(t.b-r)*e,s+=(t.a-s)*e,this._val=Math.floor((s<<24>>>0)+(r<<16)+(n<<8)+i),this},i.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},i.toCSS=function(t){return void 0===t&&(t="rgba"),"rgba"===t?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*Ui).toFixed(2)+")":"rgb"===t?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(t)},i.fromHEX=function(t){t=0===t.indexOf("#")?t.substring(1):t;var e=parseInt(t.substr(0,2),16)||0,i=parseInt(t.substr(2,2),16)||0,n=parseInt(t.substr(4,2),16)||0,r=parseInt(t.substr(6,2),16);return r=Number.isNaN(r)?255:r,this._val=(r<<24>>>0)+(n<<16)+(i<<8)+(0|e),this},i.toHEX=function(t){void 0===t&&(t="#rrggbb");var e="0",i=[(this.r<16?e:"")+this.r.toString(16),(this.g<16?e:"")+this.g.toString(16),(this.b<16?e:"")+this.b.toString(16)];return"#rgb"===t?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===t&&i.push((this.a<16?e:"")+this.a.toString(16)),i.join("")},i.toRGBValue=function(){return 16777215&this._val},i.fromHSV=function(t,e,i){var n=0,r=0,s=0;if(0===e)n=r=s=i;else if(0===i)n=r=s=0;else{1===t&&(t=0),t*=6;var a=Math.floor(t),o=t-a,u=i*(1-e),h=i*(1-e*o),l=i*(1-e*(1-o));switch(a){default:case 0:n=i,r=l,s=u;break;case 1:n=h,r=i,s=u;break;case 2:n=u,r=i,s=l;break;case 3:n=u,r=h,s=i;break;case 4:n=l,r=u,s=i;break;case 5:n=i,r=u,s=h}}return n*=255,r*=255,s*=255,this._val=(this.a<<24>>>0)+(s<<16)+(r<<8)+(0|n),this},i.toHSV=function(){var t=this.r*Ui,e=this.g*Ui,i=this.b*Ui,n={h:0,s:0,v:0},r=Math.max(t,e,i),s=Math.min(t,e,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=t===r?(e-i)/a:e===r?2+(i-t)/a:4+(t-e)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(t,e,i,n){return"object"==typeof t?null!=t._val?this._val=t._val:(e=t.g||0,i=t.b||0,n="number"==typeof t.a?t.a:255,t=t.r||0,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)):(t=t||0,e=e||0,i=i||0,n="number"==typeof n?n:255,this._val=(n<<24>>>0)+(i<<16)+(e<<8)+(0|t)),this},i.multiply=function(t){var e=(255&this._val)*t.r>>8,i=(65280&this._val)*t.g>>8,n=(16711680&this._val)*t.b>>8,r=((4278190080&this._val)>>>8)*t.a;return this._val=4278190080&r|16711680&n|65280&i|255&e,this},i._set_r_unsafe=function(t){return this._val=(4294967040&this._val|t)>>>0,this},i._set_g_unsafe=function(t){return this._val=(4294902015&this._val|t<<8)>>>0,this},i._set_b_unsafe=function(t){return this._val=(4278255615&this._val|t<<16)>>>0,this},i._set_a_unsafe=function(t){return this._val=(16777215&this._val|t<<24)>>>0,this},h(e,[{key:"r",get:function(){return 255&this._val},set:function(t){t=~~vi(t,0,255),this._val=(4294967040&this._val|t)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(t){t=~~vi(t,0,255),this._val=(4294902015&this._val|t<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(t){t=~~vi(t,0,255),this._val=(4278255615&this._val|t<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(t){t=~~vi(t,0,255),this._val=(16777215&this._val|t<<24)>>>0}},{key:"x",get:function(){return this.r*Ui},set:function(t){this.r=255*t}},{key:"y",get:function(){return this.g*Ui},set:function(t){this.g=255*t}},{key:"z",get:function(){return this.b*Ui},set:function(t){this.b=255*t}},{key:"w",get:function(){return this.a*Ui},set:function(t){this.a=255*t}}]),e}(ge));function ki(t,e,i,n){return new Gi(t,e,i,n)}function zi(t){if((0|t)!==t||t>>>8!=0)throw new RangeError("Value out of 8-bit range");return Wi[t]}function Hi(t){if(t<=0)return 0;var e=Wi;if(t>=1)return e.length-1;for(var i=0,n=e.length>>>1;0!==n;n>>>=1)e[i|n]<=t&&(i|=n);return t-e[i]<=e[i+1]-t?i:i+1}Gi.WHITE=Object.freeze(new Gi(255,255,255,255)),Gi.GRAY=Object.freeze(new Gi(127,127,127,255)),Gi.BLACK=Object.freeze(new Gi(0,0,0,255)),Gi.TRANSPARENT=Object.freeze(new Gi(0,0,0,0)),Gi.RED=Object.freeze(new Gi(255,0,0,255)),Gi.GREEN=Object.freeze(new Gi(0,255,0,255)),Gi.BLUE=Object.freeze(new Gi(0,0,255,255)),Gi.CYAN=Object.freeze(new Gi(0,255,255,255)),Gi.MAGENTA=Object.freeze(new Gi(255,0,255,255)),Gi.YELLOW=Object.freeze(new Gi(255,255,0,255)),hi.fastDefine("cc.Color",Gi,{r:0,g:0,b:0,a:255}),b.Color=Gi,b.color=ki;for(var Vi,Wi=[],Xi=0;Xi<256;Xi++)Wi.push((Vi=Xi/255)<=0?0:Vi>=1?1:Vi<.04045?Vi/12.92:Math.pow((Vi+.055)/1.055,2.4));var ji=t("Vec3",function(t){function e(e,i,n){var r;return r=t.call(this)||this,e&&"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}c(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},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z},e.cross=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.x,o=i.y,u=i.z;return t.x=r*u-s*o,t.y=s*a-n*u,t.z=n*o-r*a,t},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t},e.random=function(t,e){e=e||1;var i=2*Ai()*Math.PI,n=2*Ai()-1,r=Math.sqrt(1-n*n);return t.x=r*Math.cos(i)*e,t.y=r*Math.sin(i)*e,t.z=n*e,t},e.transformMat4=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s+i.m15;return a=a?Math.abs(1/a):1,t.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*a,t.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*a,t.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*a,t},e.transformMat4Normal=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=i.m03*n+i.m07*r+i.m11*s;return a=a?Math.abs(1/a):1,t.x=(i.m00*n+i.m04*r+i.m08*s)*a,t.y=(i.m01*n+i.m05*r+i.m09*s)*a,t.z=(i.m02*n+i.m06*r+i.m10*s)*a,t},e.transformMat3=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=n*i.m00+r*i.m03+s*i.m06,t.y=n*i.m01+r*i.m04+s*i.m07,t.z=n*i.m02+r*i.m05+s*i.m08,t},e.transformAffine=function(t,e,i){var n=e.x,r=e.y,s=e.z;return t.x=i.m00*n+i.m04*r+i.m08*s+i.m12,t.y=i.m01*n+i.m05*r+i.m09*s+i.m13,t.z=i.m02*n+i.m06*r+i.m10*s+i.m14,t},e.transformQuat=function(t,e,i){var n=i.w*e.x+i.y*e.z-i.z*e.y,r=i.w*e.y+i.z*e.x-i.x*e.z,s=i.w*e.z+i.x*e.y-i.y*e.x,a=-i.x*e.x-i.y*e.y-i.z*e.z;return t.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,t.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,t.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,t},e.transformRTS=function(t,e,i,n,r){var s=e.x*r.x,a=e.y*r.y,o=e.z*r.z,u=i.w*s+i.y*o-i.z*a,h=i.w*a+i.z*s-i.x*o,l=i.w*o+i.x*a-i.y*s,c=-i.x*s-i.y*a-i.z*o;return t.x=u*i.w+c*-i.x+h*-i.z-l*-i.y+n.x,t.y=h*i.w+c*-i.y+l*-i.x-u*-i.z+n.y,t.z=l*i.w+c*-i.z+u*-i.y-h*-i.x+n.z,t},e.transformInverseRTS=function(t,e,i,n,r){var s=e.x-n.x,a=e.y-n.y,o=e.z-n.z,u=i.w*s-i.y*o+i.z*a,h=i.w*a-i.z*s+i.x*o,l=i.w*o-i.x*a+i.y*s,c=i.x*s+i.y*a+i.z*o;return t.x=(u*i.w+c*i.x+h*i.z-l*i.y)/r.x,t.y=(h*i.w+c*i.y+l*i.x-u*i.z)/r.y,t.z=(l*i.w+c*i.z+u*i.y-h*i.x)/r.z,t},e.rotateX=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),u=Math.sin(n),h=r,l=s*o-a*u,c=s*u+a*o;return t.x=h+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateY=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),u=Math.sin(n),h=a*u+r*o,l=s,c=a*o-r*u;return t.x=h+i.x,t.y=l+i.y,t.z=c+i.z,t},e.rotateZ=function(t,e,i,n){var r=e.x-i.x,s=e.y-i.y,a=e.z-i.z,o=Math.cos(n),u=Math.sin(n),h=r*o-s*u,l=r*u+s*o,c=a;return t.x=h+i.x,t.y=l+i.y,t.z=c+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=pi);var n=t.x,r=t.y,s=t.z,a=e.x,o=e.y,u=e.z;return Math.abs(n-a)<=i*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-o)<=i*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-u)<=i*Math.max(1,Math.abs(s),Math.abs(u))},e.angle=function(t,i){e.normalize(Yi,t),e.normalize(Ki,i);var n=e.dot(Yi,Ki);return n>1?0:n<-1?Math.PI:Math.acos(n)},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)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.z)},i.set=function(t,e,i){return t&&"object"==typeof t?(this.x=t.x,this.y=t.y,this.z=t.z):(this.x=t||0,this.y=e||0,this.z=i||0),this},i.equals=function(t,e){return void 0===e&&(e=pi),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))},i.equals3f=function(t,e,i,n){return void 0===n&&(n=pi),Math.abs(this.x-t)<=n*Math.max(1,Math.abs(this.x),Math.abs(t))&&Math.abs(this.y-e)<=n*Math.max(1,Math.abs(this.y),Math.abs(e))&&Math.abs(this.z-i)<=n*Math.max(1,Math.abs(this.z),Math.abs(i))},i.strictEquals=function(t){return this.x===t.x&&this.y===t.y&&this.z===t.z},i.strictEquals3f=function(t,e,i){return this.x===t&&this.y===e&&this.z===i},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+")"},i.lerp=function(t,e){return this.x+=e*(t.x-this.x),this.y+=e*(t.y-this.y),this.z+=e*(t.z-this.z),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this},i.add3f=function(t,e,i){return this.x+=t,this.y+=e,this.z+=i,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this},i.subtract3f=function(t,e,i){return this.x-=t,this.y-=e,this.z-=i,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec3.multiply for vector * vector operation"),this.x*=t,this.y*=t,this.z*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec3.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this.z*=t.z,this},i.multiply3f=function(t,e,i){return this.x*=t,this.y*=e,this.z*=i,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},i.divide3f=function(t,e,i){return this.x/=t,this.y/=e,this.z/=i,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},i.clampf=function(t,e){return this.x=vi(this.x,t.x,e.x),this.y=vi(this.y,t.y,e.y),this.z=vi(this.z,t.z,e.z),this},i.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},i.cross=function(t){var e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z;return this.x=i*a-n*s,this.y=n*r-e*a,this.z=e*s-i*r,this},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z},i.normalize=function(){var t=this.x,e=this.y,i=this.z,n=t*t+e*e+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=t*n,this.y=e*n,this.z=i*n),this},i.transformMat4=function(t){var e=this.x,i=this.y,n=this.z,r=t.m03*e+t.m07*i+t.m11*n+t.m15;return r=r?1/r:1,this.x=(t.m00*e+t.m04*i+t.m08*n+t.m12)*r,this.y=(t.m01*e+t.m05*i+t.m09*n+t.m13)*r,this.z=(t.m02*e+t.m06*i+t.m10*n+t.m14)*r,this},e}(ge));ji.UNIT_X=Object.freeze(new ji(1,0,0)),ji.UNIT_Y=Object.freeze(new ji(0,1,0)),ji.UNIT_Z=Object.freeze(new ji(0,0,1)),ji.RIGHT=Object.freeze(new ji(1,0,0)),ji.UP=Object.freeze(new ji(0,1,0)),ji.FORWARD=Object.freeze(new ji(0,0,-1)),ji.ZERO=Object.freeze(new ji(0,0,0)),ji.ONE=Object.freeze(new ji(1,1,1)),ji.NEG_ONE=Object.freeze(new ji(-1,-1,-1));var Yi=new ji,Ki=new ji;function qi(t,e,i){return new ji(t,e,i)}hi.fastDefine("cc.Vec3",ji,{x:0,y:0,z:0}),b.Vec3=ji,b.v3=qi;var Qi=t("Mat3",function(t){function e(e,i,n,r,s,a,o,u,h){var l;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=1),l=t.call(this)||this,"object"==typeof e?(l.m00=e.m00,l.m01=e.m01,l.m02=e.m02,l.m03=e.m03,l.m04=e.m04,l.m05=e.m05,l.m06=e.m06,l.m07=e.m07,l.m08=e.m08):(l.m00=e,l.m01=i,l.m02=n,l.m03=r,l.m04=s,l.m05=a,l.m06=o,l.m07=u,l.m08=h),l}c(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.set=function(t,e,i,n,r,s,a,o,u,h){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=u,t.m08=h,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=1,t.m05=0,t.m06=0,t.m07=0,t.m08=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m05;t.m01=e.m03,t.m02=e.m06,t.m03=i,t.m05=e.m07,t.m06=n,t.m07=r}else t.m00=e.m00,t.m01=e.m03,t.m02=e.m06,t.m03=e.m01,t.m04=e.m04,t.m05=e.m07,t.m06=e.m02,t.m07=e.m05,t.m08=e.m08;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,u=e.m06,h=e.m07,l=e.m08,c=l*a-o*h,_=-l*s+o*u,f=h*s-a*u,d=i*c+n*_+r*f;return 0===d?(t.m00=0,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=0,t.m06=0,t.m07=0,t.m08=0,t):(d=1/d,t.m00=c*d,t.m01=(-l*n+r*h)*d,t.m02=(o*n-r*a)*d,t.m03=_*d,t.m04=(l*i-r*u)*d,t.m05=(-o*i+r*s)*d,t.m06=f*d,t.m07=(-h*i+n*u)*d,t.m08=(a*i-n*s)*d,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,u=t.m07,h=t.m08;return e*(h*s-a*u)+i*(-h*r+a*o)+n*(u*r-s*o)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=i.m00,f=i.m01,d=i.m02,p=i.m03,m=i.m04,g=i.m05,v=i.m06,y=i.m07,E=i.m08;return t.m00=_*n+f*a+d*h,t.m01=_*r+f*o+d*l,t.m02=_*s+f*u+d*c,t.m03=p*n+m*a+g*h,t.m04=p*r+m*o+g*l,t.m05=p*s+m*u+g*c,t.m06=v*n+y*a+E*h,t.m07=v*r+y*o+E*l,t.m08=v*s+y*u+E*c,t},e.multiplyMat4=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=i.m00,f=i.m01,d=i.m02,p=i.m04,m=i.m05,g=i.m06,v=i.m08,y=i.m09,E=i.m10;return t.m00=_*n+f*a+d*h,t.m01=_*r+f*o+d*l,t.m02=_*s+f*u+d*c,t.m03=p*n+m*a+g*h,t.m04=p*r+m*o+g*l,t.m05=p*s+m*u+g*c,t.m06=v*n+y*a+E*h,t.m07=v*r+y*o+E*l,t.m08=v*s+y*u+E*c,t},e.transform=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=i.x,f=i.y;return t.m00=n,t.m01=r,t.m02=s,t.m03=a,t.m04=o,t.m05=u,t.m06=_*n+f*a+h,t.m07=_*r+f*o+l,t.m08=_*s+f*u+c,t},e.scale=function(t,e,i){var n=i.x,r=i.y;return t.m00=n*e.m00,t.m01=n*e.m01,t.m02=n*e.m02,t.m03=r*e.m03,t.m04=r*e.m04,t.m05=r*e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t},e.rotate=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=Math.sin(i),f=Math.cos(i);return t.m00=f*n+_*a,t.m01=f*r+_*o,t.m02=f*s+_*u,t.m03=f*a-_*n,t.m04=f*o-_*r,t.m05=f*u-_*s,t.m06=h,t.m07=l,t.m08=c,t},e.fromMat4=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m04,t.m04=e.m05,t.m05=e.m06,t.m06=e.m08,t.m07=e.m09,t.m08=e.m10,t},e.fromViewUp=function(t,i,n){return ji.lengthSqr(i).999999?(t.x=0,t.y=0,t.z=0,t.w=1,t):(ji.cross(nn,i,n),t.x=nn.x,t.y=nn.y,t.z=nn.z,t.w=1+r,e.normalize(t,t))},e.getAxisAngle=function(t,e){var i=2*Math.acos(e.w),n=Math.sin(i/2);return 0!==n?(t.x=e.x/n,t.y=e.y/n,t.z=e.z/n):(t.x=1,t.y=0,t.z=0),i},e.multiply=function(t,e,i){var n=e.x*i.w+e.w*i.x+e.y*i.z-e.z*i.y,r=e.y*i.w+e.w*i.y+e.z*i.x-e.x*i.z,s=e.z*i.w+e.w*i.z+e.x*i.y-e.y*i.x,a=e.w*i.w-e.x*i.x-e.y*i.y-e.z*i.z;return t.x=n,t.y=r,t.z=s,t.w=a,t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t.z=e.z+i.z*n,t.w=e.w+i.w*n,t},e.rotateX=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,u=e.w;return t.x=s*r+u*n,t.y=a*r+o*n,t.z=o*r-a*n,t.w=u*r-s*n,t},e.rotateY=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,u=e.w;return t.x=s*r-o*n,t.y=a*r+u*n,t.z=o*r+s*n,t.w=u*r-a*n,t},e.rotateZ=function(t,e,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=e.x,a=e.y,o=e.z,u=e.w;return t.x=s*r+a*n,t.y=a*r-s*n,t.z=o*r+u*n,t.w=u*r-o*n,t},e.rotateAround=function(t,i,n,r){return e.invert(tn,i),ji.transformQuat(nn,n,tn),e.fromAxisAngle(tn,nn,r),e.multiply(t,i,tn),t},e.rotateAroundLocal=function(t,i,n,r){return e.fromAxisAngle(tn,n,r),e.multiply(t,i,tn),t},e.calculateW=function(t,e){return t.x=e.x,t.y=e.y,t.z=e.z,t.w=Math.sqrt(Math.abs(1-e.x*e.x-e.y*e.y-e.z*e.z)),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z*e.z+t.w*e.w},e.lerp=function(t,e,i,n){return t.x=e.x+n*(i.x-e.x),t.y=e.y+n*(i.y-e.y),t.z=e.z+n*(i.z-e.z),t.w=e.w+n*(i.w-e.w),t},e.slerp=function(t,e,i,n){var r=0,s=0,a=i.x,o=i.y,u=i.z,h=i.w,l=e.x*i.x+e.y*i.y+e.z*i.z+e.w*i.w;if(l<0&&(l=-l,a=-a,o=-o,u=-u,h=-h),1-l>1e-6){var c=Math.acos(l),_=Math.sin(c);r=Math.sin((1-n)*c)/_,s=Math.sin(n*c)/_}else r=1-n,s=n;return t.x=r*e.x+s*a,t.y=r*e.y+s*o,t.z=r*e.z+s*u,t.w=r*e.w+s*h,t},e.sqlerp=function(t,i,n,r,s,a){return e.slerp(tn,i,s,a),e.slerp(en,n,r,a),e.slerp(t,tn,en,2*a*(1-a)),t},e.invert=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w,n=i?1/i:0;return t.x=-e.x*n,t.y=-e.y*n,t.z=-e.z*n,t.w=e.w*n,t},e.conjugate=function(t,e){return t.x=-e.x,t.y=-e.y,t.z=-e.z,t.w=e.w,t},e.len=function(t){return Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w)},e.lengthSqr=function(t){return t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w},e.normalize=function(t,e){var i=e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w;return i>0&&(i=1/Math.sqrt(i),t.x=e.x*i,t.y=e.y*i,t.z=e.z*i,t.w=e.w*i),t},e.fromAxes=function(t,i,n,r){return Qi.set(rn,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),e.normalize(t,e.fromMat3(t,rn))},e.fromViewUp=function(t,i,n){return Qi.fromViewUp(rn,i,n),e.normalize(t,e.fromMat3(t,rn))},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.m03,r=e.m06,s=e.m01,a=e.m04,o=e.m07,u=e.m02,h=e.m05,l=e.m08,c=i+a+l;if(c>0){var _=.5/Math.sqrt(c+1);t.w=.25/_,t.x=(h-o)*_,t.y=(r-u)*_,t.z=(s-n)*_}else if(i>a&&i>l){var f=2*Math.sqrt(1+i-a-l);t.w=(h-o)/f,t.x=.25*f,t.y=(n+s)/f,t.z=(r+u)/f}else if(a>l){var d=2*Math.sqrt(1+a-i-l);t.w=(r-u)/d,t.x=(n+s)/d,t.y=.25*d,t.z=(o+h)/d}else{var p=2*Math.sqrt(1+l-i-a);t.w=(s-n)/p,t.x=(r+u)/p,t.y=(o+h)/p,t.z=.25*p}return t},e.fromEuler=function(t,e,i,n){e*=sn,i*=sn,n*=sn;var r=Math.sin(e),s=Math.cos(e),a=Math.sin(i),o=Math.cos(i),u=Math.sin(n),h=Math.cos(n);return t.x=r*o*h+s*a*u,t.y=s*a*h+r*o*u,t.z=s*o*u-r*a*h,t.w=s*o*h-r*a*u,t},e.fromAngleZ=function(t,e){return e*=sn,t.x=t.y=0,t.z=Math.sin(e),t.w=Math.cos(e),t},e.toAxisX=function(t,e){var i=2*e.y,n=2*e.z;return t.x=1-i*e.y-n*e.z,t.y=i*e.x+n*e.w,t.z=n*e.x+i*e.w,t},e.toAxisY=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=n*e.x-r*e.w,t.y=1-i*e.x-r*e.z,t.z=r*e.y+i*e.w,t},e.toAxisZ=function(t,e){var i=2*e.x,n=2*e.y,r=2*e.z;return t.x=r*e.x-n*e.w,t.y=r*e.y-i*e.w,t.z=1-i*e.x-n*e.y,t},e.toEuler=function(t,e,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=0,u=0,h=0,l=n*r+s*a;if(l>.499999)o=0,u=Si(2*Math.atan2(n,a)),h=90;else if(l<-.499999)o=0,u=-Si(2*Math.atan2(n,a)),h=-90;else{var c=n*n,_=r*r,f=s*s;o=Si(Math.atan2(2*n*a-2*r*s,1-2*c-2*f)),u=Si(Math.atan2(2*r*a-2*n*s,1-2*_-2*f)),h=Si(Math.asin(2*l)),i&&(o=-180*Math.sign(o+1e-6)+o,u=-180*Math.sign(u+1e-6)+u,h=180*Math.sign(h+1e-6)-h)}return t.x=o,t.y=u,t.z=h,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=pi),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 t&&"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=pi),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}(ge));$i.IDENTITY=Object.freeze(new $i);var tn=new $i,en=new $i,nn=new ji,rn=new Qi,sn=.5*Math.PI/180;function an(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 $i(t,e,i,n)}hi.fastDefine("cc.Quat",$i,{x:0,y:0,z:0,w:1}),b.Quat=$i,b.quat=an;var on=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])]),un=t("Mat4",function(t){function e(e,i,n,r,s,a,o,u,h,l,c,_,f,d,p,m){var g;return void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=0),void 0===c&&(c=1),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),(g=t.call(this)||this).m00=void 0,g.m01=void 0,g.m02=void 0,g.m03=void 0,g.m04=void 0,g.m05=void 0,g.m06=void 0,g.m07=void 0,g.m08=void 0,g.m09=void 0,g.m10=void 0,g.m11=void 0,g.m12=void 0,g.m13=void 0,g.m14=void 0,g.m15=void 0,"object"==typeof e?(g.m00=e.m00,g.m01=e.m01,g.m02=e.m02,g.m03=e.m03,g.m04=e.m04,g.m05=e.m05,g.m06=e.m06,g.m07=e.m07,g.m08=e.m08,g.m09=e.m09,g.m10=e.m10,g.m11=e.m11,g.m12=e.m12,g.m13=e.m13,g.m14=e.m14,g.m15=e.m15):(g.m00=e,g.m01=i,g.m02=n,g.m03=r,g.m04=s,g.m05=a,g.m06=o,g.m07=u,g.m08=h,g.m09=l,g.m10=c,g.m11=_,g.m12=f,g.m13=d,g.m14=p,g.m15=m),g}c(e,t),e.clone=function(t){return new e(t.m00,t.m01,t.m02,t.m03,t.m04,t.m05,t.m06,t.m07,t.m08,t.m09,t.m10,t.m11,t.m12,t.m13,t.m14,t.m15)},e.copy=function(t,e){return t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.set=function(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p,m){return t.m00=e,t.m01=i,t.m02=n,t.m03=r,t.m04=s,t.m05=a,t.m06=o,t.m07=u,t.m08=h,t.m09=l,t.m10=c,t.m11=_,t.m12=f,t.m13=d,t.m14=p,t.m15=m,t},e.identity=function(t){return t.m00=1,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=1,t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=1,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.transpose=function(t,e){if(t===e){var i=e.m01,n=e.m02,r=e.m03,s=e.m06,a=e.m07,o=e.m11;t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=i,t.m06=e.m09,t.m07=e.m13,t.m08=n,t.m09=s,t.m11=e.m14,t.m12=r,t.m13=a,t.m14=o}else t.m00=e.m00,t.m01=e.m04,t.m02=e.m08,t.m03=e.m12,t.m04=e.m01,t.m05=e.m05,t.m06=e.m09,t.m07=e.m13,t.m08=e.m02,t.m09=e.m06,t.m10=e.m10,t.m11=e.m14,t.m12=e.m03,t.m13=e.m07,t.m14=e.m11,t.m15=e.m15;return t},e.invert=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,u=e.m06,h=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,S=n*h-s*o,A=r*h-s*u,R=l*p-c*d,b=l*m-_*d,C=l*g-f*d,w=c*m-_*p,I=c*g-f*p,O=_*g-f*m,x=v*O-y*I+E*w+T*C-S*b+A*R;return 0===x?(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):(x=1/x,t.m00=(o*O-u*I+h*w)*x,t.m01=(r*I-n*O-s*w)*x,t.m02=(p*A-m*S+g*T)*x,t.m03=(_*S-c*A-f*T)*x,t.m04=(u*C-a*O-h*b)*x,t.m05=(i*O-r*C+s*b)*x,t.m06=(m*E-d*A-g*y)*x,t.m07=(l*A-_*E+f*y)*x,t.m08=(a*I-o*C+h*R)*x,t.m09=(n*C-i*I-s*R)*x,t.m10=(d*S-p*E+g*v)*x,t.m11=(c*E-l*S-f*v)*x,t.m12=(o*b-a*w-u*R)*x,t.m13=(i*w-n*b+r*R)*x,t.m14=(p*y-d*T-m*v)*x,t.m15=(l*T-c*y+_*v)*x,t)},e.determinant=function(t){var e=t.m00,i=t.m01,n=t.m02,r=t.m03,s=t.m04,a=t.m05,o=t.m06,u=t.m07,h=t.m08,l=t.m09,c=t.m10,_=t.m11,f=t.m12,d=t.m13,p=t.m14,m=t.m15;return(e*a-i*s)*(c*m-_*p)-(e*o-n*s)*(l*m-_*d)+(e*u-r*s)*(l*p-c*d)+(i*o-n*a)*(h*m-_*f)-(i*u-r*a)*(h*p-c*f)+(n*u-r*o)*(h*d-l*f)},e.multiply=function(t,e,i){var n=e.m00,r=e.m01,s=e.m02,a=e.m03,o=e.m04,u=e.m05,h=e.m06,l=e.m07,c=e.m08,_=e.m09,f=e.m10,d=e.m11,p=e.m12,m=e.m13,g=e.m14,v=e.m15,y=i.m00,E=i.m01,T=i.m02,S=i.m03;return t.m00=y*n+E*o+T*c+S*p,t.m01=y*r+E*u+T*_+S*m,t.m02=y*s+E*h+T*f+S*g,t.m03=y*a+E*l+T*d+S*v,y=i.m04,E=i.m05,T=i.m06,S=i.m07,t.m04=y*n+E*o+T*c+S*p,t.m05=y*r+E*u+T*_+S*m,t.m06=y*s+E*h+T*f+S*g,t.m07=y*a+E*l+T*d+S*v,y=i.m08,E=i.m09,T=i.m10,S=i.m11,t.m08=y*n+E*o+T*c+S*p,t.m09=y*r+E*u+T*_+S*m,t.m10=y*s+E*h+T*f+S*g,t.m11=y*a+E*l+T*d+S*v,y=i.m12,E=i.m13,T=i.m14,S=i.m15,t.m12=y*n+E*o+T*c+S*p,t.m13=y*r+E*u+T*_+S*m,t.m14=y*s+E*h+T*f+S*g,t.m15=y*a+E*l+T*d+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 a=e.m00,o=e.m01,u=e.m02,h=e.m03,l=e.m04,c=e.m05,_=e.m06,f=e.m07,d=e.m08,p=e.m09,m=e.m10,g=e.m11;e.m12,e.m13,e.m14,e.m15,t.m00=a,t.m01=o,t.m02=u,t.m03=h,t.m04=l,t.m05=c,t.m06=_,t.m07=f,t.m08=d,t.m09=p,t.m10=m,t.m11=g,t.m12=a*n+l*r+d*s+e.m12,t.m13=o*n+c*r+p*s+e.m13,t.m14=u*n+_*r+m*s+e.m14,t.m15=h*n+f*r+g*s+e.m15}return t},e.translate=function(t,e,i){return e===t?(t.m12+=i.x,t.m13+=i.y,t.m14+=i.z):(t.m00=e.m00,t.m01=e.m01,t.m02=e.m02,t.m03=e.m03,t.m04=e.m04,t.m05=e.m05,t.m06=e.m06,t.m07=e.m07,t.m08=e.m08,t.m09=e.m09,t.m10=e.m10,t.m11=e.m11,t.m12+=i.x,t.m13+=i.y,t.m14+=i.z,t.m15=e.m15),t},e.scale=function(t,e,i){var n=i.x,r=i.y,s=i.z;return t.m00=e.m00*n,t.m01=e.m01*n,t.m02=e.m02*n,t.m03=e.m03*n,t.m04=e.m04*r,t.m05=e.m05*r,t.m06=e.m06*r,t.m07=e.m07*r,t.m08=e.m08*s,t.m09=e.m09*s,t.m10=e.m10*s,t.m11=e.m11*s,t.m12=e.m12,t.m13=e.m13,t.m14=e.m14,t.m15=e.m15,t},e.rotate=function(t,e,i,n){var r=n.x,s=n.y,a=n.z,o=Math.sqrt(r*r+s*s+a*a);if(Math.abs(o)0?(n=2*Math.sqrt(i+1),t.w=.25*n,t.x=(e.m06-e.m09)/n,t.y=(e.m08-e.m02)/n,t.z=(e.m01-e.m04)/n):e.m00>e.m05&&e.m00>e.m10?(n=2*Math.sqrt(1+e.m00-e.m05-e.m10),t.w=(e.m06-e.m09)/n,t.x=.25*n,t.y=(e.m01+e.m04)/n,t.z=(e.m08+e.m02)/n):e.m05>e.m10?(n=2*Math.sqrt(1+e.m05-e.m00-e.m10),t.w=(e.m08-e.m02)/n,t.x=(e.m01+e.m04)/n,t.y=.25*n,t.z=(e.m06+e.m09)/n):(n=2*Math.sqrt(1+e.m10-e.m00-e.m05),t.w=(e.m01-e.m04)/n,t.x=(e.m08+e.m02)/n,t.y=(e.m06+e.m09)/n,t.z=.25*n),t},e.toRTS=function(t,e,i,n){n.x=ji.set(hn,t.m00,t.m01,t.m02).length(),ln.m00=t.m00/n.x,ln.m01=t.m01/n.x,ln.m02=t.m02/n.x,n.y=ji.set(hn,t.m04,t.m05,t.m06).length(),ln.m03=t.m04/n.y,ln.m04=t.m05/n.y,ln.m05=t.m06/n.y,n.z=ji.set(hn,t.m08,t.m09,t.m10).length(),ln.m06=t.m08/n.z,ln.m07=t.m09/n.z,ln.m08=t.m10/n.z,Qi.determinant(ln)<0&&(n.x*=-1,ln.m00*=-1,ln.m01*=-1,ln.m02*=-1),$i.fromMat3(e,ln),ji.set(i,t.m12,t.m13,t.m14)},e.fromRTS=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=e.w,u=r+r,h=s+s,l=a+a,c=r*u,_=r*h,f=r*l,d=s*h,p=s*l,m=a*l,g=o*u,v=o*h,y=o*l,E=n.x,T=n.y,S=n.z;return t.m00=(1-(d+m))*E,t.m01=(_+y)*E,t.m02=(f-v)*E,t.m03=0,t.m04=(_-y)*T,t.m05=(1-(c+m))*T,t.m06=(p+g)*T,t.m07=0,t.m08=(f+v)*S,t.m09=(p-g)*S,t.m10=(1-(c+d))*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,a=e.y,o=e.z,u=e.w,h=s+s,l=a+a,c=o+o,_=s*h,f=s*l,d=s*c,p=a*l,m=a*c,g=o*c,v=u*h,y=u*l,E=u*c,T=n.x,S=n.y,A=n.z,R=r.x,b=r.y,C=r.z;return t.m00=(1-(p+g))*T,t.m01=(f+E)*T,t.m02=(d-y)*T,t.m03=0,t.m04=(f-E)*S,t.m05=(1-(_+g))*S,t.m06=(m+v)*S,t.m07=0,t.m08=(d+y)*A,t.m09=(m-v)*A,t.m10=(1-(_+p))*A,t.m11=0,t.m12=i.x+R-(t.m00*R+t.m04*b+t.m08*C),t.m13=i.y+b-(t.m01*R+t.m05*b+t.m09*C),t.m14=i.z+C-(t.m02*R+t.m06*b+t.m10*C),t.m15=1,t},e.fromQuat=function(t,e){var i=e.x,n=e.y,r=e.z,s=e.w,a=i+i,o=n+n,u=r+r,h=i*a,l=n*a,c=n*o,_=r*a,f=r*o,d=r*u,p=s*a,m=s*o,g=s*u;return t.m00=1-c-d,t.m01=l+g,t.m02=_-m,t.m03=0,t.m04=l-g,t.m05=1-h-d,t.m06=f+p,t.m07=0,t.m08=_+m,t.m09=f-p,t.m10=1-h-c,t.m11=0,t.m12=0,t.m13=0,t.m14=0,t.m15=1,t},e.frustum=function(t,e,i,n,r,s,a){var o=1/(i-e),u=1/(r-n),h=1/(s-a);return t.m00=2*s*o,t.m01=0,t.m02=0,t.m03=0,t.m04=0,t.m05=2*s*u,t.m06=0,t.m07=0,t.m08=(i+e)*o,t.m09=(r+n)*u,t.m10=(a+s)*h,t.m11=-1,t.m12=0,t.m13=0,t.m14=a*s*2*h,t.m15=0,t},e.perspective=function(t,e,i,n,r,s,a,o,u){void 0===s&&(s=!0),void 0===a&&(a=-1),void 0===o&&(o=1),void 0===u&&(u=0);var h=1/Math.tan(e/2),l=1/(n-r),c=s?h/i:h,_=(s?h:h*i)*o,f=on[u];return t.m00=c*f[0],t.m01=c*f[1],t.m02=0,t.m03=0,t.m04=_*f[2],t.m05=_*f[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=(r-a*n)*l,t.m11=-1,t.m12=0,t.m13=0,t.m14=r*n*l*(1-a),t.m15=0,t},e.ortho=function(t,e,i,n,r,s,a,o,u,h){void 0===o&&(o=-1),void 0===u&&(u=1),void 0===h&&(h=0);var l=1/(e-i),c=1/(n-r)*u,_=1/(s-a),f=-2*l,d=-2*c,p=(e+i)*l,m=(r+n)*c,g=on[h];return t.m00=f*g[0],t.m01=f*g[1],t.m02=0,t.m03=0,t.m04=d*g[2],t.m05=d*g[3],t.m06=0,t.m07=0,t.m08=0,t.m09=0,t.m10=_*(1-o),t.m11=0,t.m12=p*g[0]+m*g[2],t.m13=p*g[1]+m*g[3],t.m14=(s-o*a)*_,t.m15=1,t},e.lookAt=function(t,e,i,n){var r=e.x,s=e.y,a=e.z,o=n.x,u=n.y,h=n.z,l=r-i.x,c=s-i.y,_=a-i.z,f=1/Math.sqrt(l*l+c*c+_*_),d=u*(_*=f)-h*(c*=f),p=h*(l*=f)-o*_,m=o*c-u*l,g=c*(m*=f=1/Math.sqrt(d*d+p*p+m*m))-_*(p*=f),v=_*(d*=f)-l*m,y=l*p-c*d;return t.m00=d,t.m01=g,t.m02=l,t.m03=0,t.m04=p,t.m05=v,t.m06=c,t.m07=0,t.m08=m,t.m09=y,t.m10=_,t.m11=0,t.m12=-(d*r+p*s+m*a),t.m13=-(g*r+v*s+y*a),t.m14=-(l*r+c*s+_*a),t.m15=1,t},e.inverseTranspose=function(t,e){var i=e.m00,n=e.m01,r=e.m02,s=e.m03,a=e.m04,o=e.m05,u=e.m06,h=e.m07,l=e.m08,c=e.m09,_=e.m10,f=e.m11,d=e.m12,p=e.m13,m=e.m14,g=e.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,S=n*h-s*o,A=r*h-s*u,R=l*p-c*d,b=l*m-_*d,C=l*g-f*d,w=c*m-_*p,I=c*g-f*p,O=_*g-f*m,x=v*O-y*I+E*w+T*C-S*b+A*R;return x?(x=1/x,t.m00=(o*O-u*I+h*w)*x,t.m01=(u*C-a*O-h*b)*x,t.m02=(a*I-o*C+h*R)*x,t.m03=0,t.m04=(r*I-n*O-s*w)*x,t.m05=(i*O-r*C+s*b)*x,t.m06=(n*C-i*I-s*R)*x,t.m07=0,t.m08=(p*A-m*S+g*T)*x,t.m09=(m*E-d*A-g*y)*x,t.m10=(d*S-p*E+g*v)*x,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=pi),Math.abs(t.m00-e.m00)<=i*Math.max(1,Math.abs(t.m00),Math.abs(e.m00))&&Math.abs(t.m01-e.m01)<=i*Math.max(1,Math.abs(t.m01),Math.abs(e.m01))&&Math.abs(t.m02-e.m02)<=i*Math.max(1,Math.abs(t.m02),Math.abs(e.m02))&&Math.abs(t.m03-e.m03)<=i*Math.max(1,Math.abs(t.m03),Math.abs(e.m03))&&Math.abs(t.m04-e.m04)<=i*Math.max(1,Math.abs(t.m04),Math.abs(e.m04))&&Math.abs(t.m05-e.m05)<=i*Math.max(1,Math.abs(t.m05),Math.abs(e.m05))&&Math.abs(t.m06-e.m06)<=i*Math.max(1,Math.abs(t.m06),Math.abs(e.m06))&&Math.abs(t.m07-e.m07)<=i*Math.max(1,Math.abs(t.m07),Math.abs(e.m07))&&Math.abs(t.m08-e.m08)<=i*Math.max(1,Math.abs(t.m08),Math.abs(e.m08))&&Math.abs(t.m09-e.m09)<=i*Math.max(1,Math.abs(t.m09),Math.abs(e.m09))&&Math.abs(t.m10-e.m10)<=i*Math.max(1,Math.abs(t.m10),Math.abs(e.m10))&&Math.abs(t.m11-e.m11)<=i*Math.max(1,Math.abs(t.m11),Math.abs(e.m11))&&Math.abs(t.m12-e.m12)<=i*Math.max(1,Math.abs(t.m12),Math.abs(e.m12))&&Math.abs(t.m13-e.m13)<=i*Math.max(1,Math.abs(t.m13),Math.abs(e.m13))&&Math.abs(t.m14-e.m14)<=i*Math.max(1,Math.abs(t.m14),Math.abs(e.m14))&&Math.abs(t.m15-e.m15)<=i*Math.max(1,Math.abs(t.m15),Math.abs(e.m15))};var i=e.prototype;return i.clone=function(){return new e(this.m00,this.m01,this.m02,this.m03,this.m04,this.m05,this.m06,this.m07,this.m08,this.m09,this.m10,this.m11,this.m12,this.m13,this.m14,this.m15)},i.set=function(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p){return void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===_&&(_=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=1),"object"==typeof t?(this.m01=t.m01,this.m02=t.m02,this.m03=t.m03,this.m04=t.m04,this.m05=t.m05,this.m06=t.m06,this.m07=t.m07,this.m08=t.m08,this.m09=t.m09,this.m10=t.m10,this.m11=t.m11,this.m12=t.m12,this.m13=t.m13,this.m14=t.m14,this.m15=t.m15,this.m00=t.m00):(this.m01=e,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=u,this.m09=h,this.m10=l,this.m11=c,this.m12=_,this.m13=f,this.m14=d,this.m15=p,this.m00=t),this},i.equals=function(t,e){return void 0===e&&(e=pi),Math.abs(this.m00-t.m00)<=e*Math.max(1,Math.abs(this.m00),Math.abs(t.m00))&&Math.abs(this.m01-t.m01)<=e*Math.max(1,Math.abs(this.m01),Math.abs(t.m01))&&Math.abs(this.m02-t.m02)<=e*Math.max(1,Math.abs(this.m02),Math.abs(t.m02))&&Math.abs(this.m03-t.m03)<=e*Math.max(1,Math.abs(this.m03),Math.abs(t.m03))&&Math.abs(this.m04-t.m04)<=e*Math.max(1,Math.abs(this.m04),Math.abs(t.m04))&&Math.abs(this.m05-t.m05)<=e*Math.max(1,Math.abs(this.m05),Math.abs(t.m05))&&Math.abs(this.m06-t.m06)<=e*Math.max(1,Math.abs(this.m06),Math.abs(t.m06))&&Math.abs(this.m07-t.m07)<=e*Math.max(1,Math.abs(this.m07),Math.abs(t.m07))&&Math.abs(this.m08-t.m08)<=e*Math.max(1,Math.abs(this.m08),Math.abs(t.m08))&&Math.abs(this.m09-t.m09)<=e*Math.max(1,Math.abs(this.m09),Math.abs(t.m09))&&Math.abs(this.m10-t.m10)<=e*Math.max(1,Math.abs(this.m10),Math.abs(t.m10))&&Math.abs(this.m11-t.m11)<=e*Math.max(1,Math.abs(this.m11),Math.abs(t.m11))&&Math.abs(this.m12-t.m12)<=e*Math.max(1,Math.abs(this.m12),Math.abs(t.m12))&&Math.abs(this.m13-t.m13)<=e*Math.max(1,Math.abs(this.m13),Math.abs(t.m13))&&Math.abs(this.m14-t.m14)<=e*Math.max(1,Math.abs(this.m14),Math.abs(t.m14))&&Math.abs(this.m15-t.m15)<=e*Math.max(1,Math.abs(this.m15),Math.abs(t.m15))},i.strictEquals=function(t){return this.m00===t.m00&&this.m01===t.m01&&this.m02===t.m02&&this.m03===t.m03&&this.m04===t.m04&&this.m05===t.m05&&this.m06===t.m06&&this.m07===t.m07&&this.m08===t.m08&&this.m09===t.m09&&this.m10===t.m10&&this.m11===t.m11&&this.m12===t.m12&&this.m13===t.m13&&this.m14===t.m14&&this.m15===t.m15},i.toString=function(){return"[\n"+this.m00+", "+this.m01+", "+this.m02+", "+this.m03+",\n"+this.m04+", "+this.m05+", "+this.m06+", "+this.m07+",\n"+this.m08+", "+this.m09+", "+this.m10+", "+this.m11+",\n"+this.m12+", "+this.m13+", "+this.m14+", "+this.m15+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=1,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=1,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},i.zero=function(){return this.m00=0,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=0,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=0,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=0,this},i.transpose=function(){var t=this.m01,e=this.m02,i=this.m03,n=this.m06,r=this.m07,s=this.m11;return this.m01=this.m04,this.m02=this.m08,this.m03=this.m12,this.m04=t,this.m06=this.m09,this.m07=this.m13,this.m08=e,this.m09=n,this.m11=this.m14,this.m12=i,this.m13=r,this.m14=s,this},i.invert=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08,h=this.m09,l=this.m10,c=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15,m=t*s-e*r,g=t*a-i*r,v=t*o-n*r,y=e*a-i*s,E=e*o-n*s,T=i*o-n*a,S=u*f-h*_,A=u*d-l*_,R=u*p-c*_,b=h*d-l*f,C=h*p-c*f,w=l*p-c*d,I=m*w-g*C+v*b+y*R-E*A+T*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-a*C+o*b)*I,this.m01=(i*C-e*w-n*b)*I,this.m02=(f*T-d*E+p*y)*I,this.m03=(l*E-h*T-c*y)*I,this.m04=(a*R-r*w-o*A)*I,this.m05=(t*w-i*R+n*A)*I,this.m06=(d*v-_*T-p*g)*I,this.m07=(u*T-l*v+c*g)*I,this.m08=(r*C-s*R+o*S)*I,this.m09=(e*R-t*C-n*S)*I,this.m10=(_*E-f*v+p*m)*I,this.m11=(h*v-u*E-c*m)*I,this.m12=(s*A-r*b-a*S)*I,this.m13=(t*b-e*A+i*S)*I,this.m14=(f*g-_*y-d*m)*I,this.m15=(u*y-h*g+l*m)*I,this)},i.determinant=function(){var t=this.m00,e=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08,h=this.m09,l=this.m10,c=this.m11,_=this.m12,f=this.m13,d=this.m14,p=this.m15;return(t*s-e*r)*(l*p-c*d)-(t*a-i*r)*(h*p-c*f)+(t*o-n*r)*(h*d-l*f)+(e*a-i*s)*(u*p-c*_)-(e*o-n*s)*(u*d-l*_)+(i*o-n*a)*(u*f-h*_)},i.add=function(t){return this.m00+=t.m00,this.m01+=t.m01,this.m02+=t.m02,this.m03+=t.m03,this.m04+=t.m04,this.m05+=t.m05,this.m06+=t.m06,this.m07+=t.m07,this.m08+=t.m08,this.m09+=t.m09,this.m10+=t.m10,this.m11+=t.m11,this.m12+=t.m12,this.m13+=t.m13,this.m14+=t.m14,this.m15+=t.m15,this},i.subtract=function(t){return this.m00-=t.m00,this.m01-=t.m01,this.m02-=t.m02,this.m03-=t.m03,this.m04-=t.m04,this.m05-=t.m05,this.m06-=t.m06,this.m07-=t.m07,this.m08-=t.m08,this.m09-=t.m09,this.m10-=t.m10,this.m11-=t.m11,this.m12-=t.m12,this.m13-=t.m13,this.m14-=t.m14,this.m15-=t.m15,this},i.multiply=function(t){var e=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,u=this.m07,h=this.m08,l=this.m09,c=this.m10,_=this.m11,f=this.m12,d=this.m13,p=this.m14,m=this.m15,g=t.m00,v=t.m01,y=t.m02,E=t.m03;return this.m00=g*e+v*s+y*h+E*f,this.m01=g*i+v*a+y*l+E*d,this.m02=g*n+v*o+y*c+E*p,this.m03=g*r+v*u+y*_+E*m,g=t.m04,v=t.m05,y=t.m06,E=t.m07,this.m04=g*e+v*s+y*h+E*f,this.m05=g*i+v*a+y*l+E*d,this.m06=g*n+v*o+y*c+E*p,this.m07=g*r+v*u+y*_+E*m,g=t.m08,v=t.m09,y=t.m10,E=t.m11,this.m08=g*e+v*s+y*h+E*f,this.m09=g*i+v*a+y*l+E*d,this.m10=g*n+v*o+y*c+E*p,this.m11=g*r+v*u+y*_+E*m,g=t.m12,v=t.m13,y=t.m14,E=t.m15,this.m12=g*e+v*s+y*h+E*f,this.m13=g*i+v*a+y*l+E*d,this.m14=g*n+v*o+y*c+E*p,this.m15=g*r+v*u+y*_+E*m,this},i.multiplyScalar=function(t){return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=t,this.m05*=t,this.m06*=t,this.m07*=t,this.m08*=t,this.m09*=t,this.m10*=t,this.m11*=t,this.m12*=t,this.m13*=t,this.m14*=t,this.m15*=t,this},i.translate=function(t){return this.m12+=t.x,this.m13+=t.y,this.m14+=t.z,this},i.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?(i=2*Math.sqrt(e+1),t.w=.25*i,t.x=(this.m06-this.m09)/i,t.y=(this.m08-this.m02)/i,t.z=(this.m01-this.m04)/i):this.m00>this.m05&&this.m00>this.m10?(i=2*Math.sqrt(1+this.m00-this.m05-this.m10),t.w=(this.m06-this.m09)/i,t.x=.25*i,t.y=(this.m01+this.m04)/i,t.z=(this.m08+this.m02)/i):this.m05>this.m10?(i=2*Math.sqrt(1+this.m05-this.m00-this.m10),t.w=(this.m08-this.m02)/i,t.x=(this.m01+this.m04)/i,t.y=.25*i,t.z=(this.m06+this.m09)/i):(i=2*Math.sqrt(1+this.m10-this.m00-this.m05),t.w=(this.m01-this.m04)/i,t.x=(this.m08+this.m02)/i,t.y=(this.m06+this.m09)/i,t.z=.25*i),t},i.fromRTS=function(t,e,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=n+n,u=r+r,h=s+s,l=n*o,c=n*u,_=n*h,f=r*u,d=r*h,p=s*h,m=a*o,g=a*u,v=a*h,y=i.x,E=i.y,T=i.z;return this.m00=(1-(f+p))*y,this.m01=(c+v)*y,this.m02=(_-g)*y,this.m03=0,this.m04=(c-v)*E,this.m05=(1-(l+p))*E,this.m06=(d+m)*E,this.m07=0,this.m08=(_+g)*T,this.m09=(d-m)*T,this.m10=(1-(l+f))*T,this.m11=0,this.m12=e.x,this.m13=e.y,this.m14=e.z,this.m15=1,this},i.fromQuat=function(t){var e=t.x,i=t.y,n=t.z,r=t.w,s=e+e,a=i+i,o=n+n,u=e*s,h=i*s,l=i*a,c=n*s,_=n*a,f=n*o,d=r*s,p=r*a,m=r*o;return this.m00=1-l-f,this.m01=h+m,this.m02=c-p,this.m03=0,this.m04=h-m,this.m05=1-u-f,this.m06=_+d,this.m07=0,this.m08=c+p,this.m09=_-d,this.m10=1-u-l,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},e}(ge));un.IDENTITY=Object.freeze(new un);var hn=new ji,ln=new Qi;function cn(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p){return new un(t,e,i,n,r,s,a,o,u,h,l,c,_,f,d,p)}hi.fastDefine("cc.Mat4",un,{m00:1,m01:0,m02:0,m03:0,m04:0,m05:1,m06:0,m07:0,m08:0,m09:0,m10:1,m11:0,m12:0,m13:0,m14:0,m15:1}),b.Mat4=un,b.mat4=cn;var _n=t("Vec2",function(t){function e(e,i){var n;return n=t.call(this)||this,e&&"object"==typeof e?(n.x=e.x,n.y=e.y):(n.x=e||0,n.y=i||0),n}c(e,t),e.clone=function(t){return new e(t.x,t.y)},e.copy=function(t,e){return t.x=e.x,t.y=e.y,t},e.set=function(t,e,i){return t.x=e,t.y=i,t},e.add=function(t,e,i){return t.x=e.x+i.x,t.y=e.y+i.y,t},e.subtract=function(t,e,i){return t.x=e.x-i.x,t.y=e.y-i.y,t},e.multiply=function(t,e,i){return t.x=e.x*i.x,t.y=e.y*i.y,t},e.divide=function(t,e,i){return t.x=e.x/i.x,t.y=e.y/i.y,t},e.ceil=function(t,e){return t.x=Math.ceil(e.x),t.y=Math.ceil(e.y),t},e.floor=function(t,e){return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t},e.min=function(t,e,i){return t.x=Math.min(e.x,i.x),t.y=Math.min(e.y,i.y),t},e.max=function(t,e,i){return t.x=Math.max(e.x,i.x),t.y=Math.max(e.y,i.y),t},e.round=function(t,e){return t.x=Math.round(e.x),t.y=Math.round(e.y),t},e.multiplyScalar=function(t,e,i){return t.x=e.x*i,t.y=e.y*i,t},e.scaleAndAdd=function(t,e,i,n){return t.x=e.x+i.x*n,t.y=e.y+i.y*n,t},e.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return Math.sqrt(i*i+n*n)},e.squaredDistance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},e.len=function(t){var e=t.x,i=t.y;return Math.sqrt(e*e+i*i)},e.lengthSqr=function(t){var e=t.x,i=t.y;return e*e+i*i},e.negate=function(t,e){return t.x=-e.x,t.y=-e.y,t},e.inverse=function(t,e){return t.x=1/e.x,t.y=1/e.y,t},e.inverseSafe=function(t,e){var i=e.x,n=e.y;return Math.abs(i)0&&(r=1/Math.sqrt(r),t.x=i*r,t.y=n*r),t},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.cross=function(t,e,i){return t instanceof ji?(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*Ai()*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=pi),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,i){e.normalize(fn,t),e.normalize(dn,i);var n=e.dot(fn,dn);return n>1?0:n<-1?Math.PI:Math.acos(n)};var i=e.prototype;return i.clone=function(){return new e(this.x,this.y)},i.set=function(t,e){return t&&"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=pi),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=pi),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=vi(this.x,t.x,e.x),this.y=vi(this.y,t.y,e.y),this},i.add=function(t){return this.x+=t.x,this.y+=t.y,this},i.add2f=function(t,e){return this.x+=t,this.y+=e,this},i.subtract=function(t){return this.x-=t.x,this.y-=t.y,this},i.subtract2f=function(t,e){return this.x-=t,this.y-=e,this},i.multiplyScalar=function(t){return"object"==typeof t&&console.warn("should use Vec2.multiply for vector * vector operation"),this.x*=t,this.y*=t,this},i.multiply=function(t){return"object"!=typeof t&&console.warn("should use Vec2.scale for vector * scalar operation"),this.x*=t.x,this.y*=t.y,this},i.multiply2f=function(t,e){return this.x*=t,this.y*=e,this},i.divide=function(t){return this.x/=t.x,this.y/=t.y,this},i.divide2f=function(t,e){return this.x/=t,this.y/=e,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(t){return this.x*t.x+this.y*t.y},i.cross=function(t){return this.x*t.y-this.y*t.x},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y},i.normalize=function(){var t=this.x,e=this.y,i=t*t+e*e;return i>0&&(i=1/Math.sqrt(i),this.x*=i,this.y*=i),this},i.angle=function(t){var e=this.lengthSqr(),i=t.lengthSqr();if(0===e||0===i)return console.warn("Can't get angle between zero vector"),0;var n=this.dot(t)/Math.sqrt(e*i);return n=vi(n,-1,1),Math.acos(n)},i.signAngle=function(t){var e=this.angle(t);return this.cross(t)<0?-e:e},i.rotate=function(t){var e=this.x,i=this.y,n=Math.sin(t),r=Math.cos(t);return this.x=r*e-n*i,this.y=n*e+r*i,this},i.project=function(t){var e=this.dot(t)/t.dot(t);return this.x=t.x*e,this.y=t.y*e,this},i.transformMat4=function(t){var e=this.x,i=this.y;return this.x=t.m00*e+t.m04*i+t.m12,this.y=t.m01*e+t.m05*i+t.m13,this},e}(ge));_n.ZERO=Object.freeze(new _n(0,0)),_n.ONE=Object.freeze(new _n(1,1)),_n.NEG_ONE=Object.freeze(new _n(-1,-1)),_n.UNIT_X=Object.freeze(new _n(1,0)),_n.UNIT_Y=Object.freeze(new _n(0,1));var fn=new _n,dn=new _n;function pn(t,e){return new _n(t,e)}hi.fastDefine("cc.Vec2",_n,{x:0,y:0}),b.Vec2=_n,b.v2=pn,et(_n,"Vec2",[{name:"sub",newName:"subtract",target:_n,targetName:"Vec2"},{name:"mul",newName:"multiply",target:_n,targetName:"Vec2"},{name:"div",newName:"divide",target:_n,targetName:"Vec2"},{name:"dist",newName:"distance",target:_n,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:_n,targetName:"Vec2"},{name:"mag",newName:"len",target:_n,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:_n,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:_n,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:_n,targetName:"Vec2"}]),et(_n.prototype,"Vec2",[{name:"mag",newName:"length",target:_n.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:_n.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:_n.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:_n.prototype,targetName:"Vec2"}]),et(ji,"Vec3",[{name:"sub",newName:"subtract",target:ji,targetName:"Vec3"},{name:"mul",newName:"multiply",target:ji,targetName:"Vec3"},{name:"div",newName:"divide",target:ji,targetName:"Vec3"},{name:"dist",newName:"distance",target:ji,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:ji,targetName:"Vec3"},{name:"mag",newName:"len",target:ji,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:ji,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:ji,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:ji,targetName:"Vec3"}]),et(ji.prototype,"Vec3",[{name:"mag",newName:"length",target:ji.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:ji.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:ji.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:ji.prototype,targetName:"Vec3"}]),et(Li,"Vec4",[{name:"sub",newName:"subtract",target:Li,targetName:"Vec4"},{name:"mul",newName:"multiply",target:Li,targetName:"Vec4"},{name:"div",newName:"divide",target:Li,targetName:"Vec4"},{name:"dist",newName:"distance",target:Li,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:Li,targetName:"Vec4"},{name:"mag",newName:"len",target:Li,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:Li,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:Li,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:Li,targetName:"Vec4"}]),et(Li.prototype,"Vec4",[{name:"mag",newName:"length",target:Li.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:Li.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:Li.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:Li.prototype,targetName:"Vec4"}]),et($i,"Quat",[{name:"mag",newName:"len",target:$i,targetName:"Quat"},{name:"mul",newName:"multiply",target:$i,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:$i,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:$i,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:$i,targetName:"Quat"}]),et($i.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:$i.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:$i.prototype,targetName:"Quat"}]),et(Gi,"Color",[{name:"sub",newName:"subtract",target:Gi,targetName:"Color"},{name:"mul",newName:"multiply",target:Gi,targetName:"Color"},{name:"div",newName:"divide",target:Gi,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:Gi,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var t=arguments.length,e=new Array(t),i=0;i=t.x&&this.y<=t.y&&this.y+this.height>=t.y},i.containsRect=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height},i.transformMat4=function(t){var e=this.x,i=this.y,n=e+this.width,r=i+this.height,s=t.m00*e+t.m04*i+t.m12,a=t.m01*e+t.m05*i+t.m13,o=t.m00*n+t.m04*i+t.m12,u=t.m01*n+t.m05*i+t.m13,h=t.m00*e+t.m04*r+t.m12,l=t.m01*e+t.m05*r+t.m13,c=t.m00*n+t.m04*r+t.m12,_=t.m01*n+t.m05*r+t.m13,f=Math.min(s,o,h,c),d=Math.max(s,o,h,c),p=Math.min(a,u,l,_),m=Math.max(a,u,l,_);return this.x=f,this.y=p,this.width=d-f,this.height=m-p,this},i.transformMat4ToPoints=function(t,e,i,n,r){var s=this.x,a=this.y,o=s+this.width,u=a+this.height;e.x=t.m00*s+t.m04*a+t.m12,e.y=t.m01*s+t.m05*a+t.m13,r.x=t.m00*o+t.m04*a+t.m12,r.y=t.m01*o+t.m05*a+t.m13,i.x=t.m00*s+t.m04*u+t.m12,i.y=t.m01*s+t.m05*u+t.m13,n.x=t.m00*o+t.m04*u+t.m12,n.y=t.m01*o+t.m05*u+t.m13},h(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 _n(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 _n(this.x,this.y)},set:function(t){this.x=t.x,this.y=t.y}},{key:"size",get:function(){return new gn(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}(ge));function En(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)}hi.fastDefine("cc.Rect",yn,{x:0,y:0,width:0,height:0}),b.Rect=yn,b.rect=En;var Tn=t("MATH_FLOAT_ARRAY",Float64Array),Sn=t("MathBase",function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.createFloatArray=function(t){return new Tn(t)},h(e,[{key:"array",get:function(){return this._array}}]),e}(ge)),An=Object.freeze({__proto__:null,bits:o,Vec2:_n,v2:pn,Vec3:ji,v3:qi,Vec4:Li,v4:Fi,Quat:$i,quat:an,Mat3:Qi,Mat4:un,mat4:cn,AffineTransform:mn,Size:gn,size:vn,Rect:yn,rect:En,Color:Gi,color:ki,EPSILON:pi,equals:mi,approx:gi,clamp:vi,clamp01:yi,lerp:Ei,toRadian:Ti,toDegree:Si,random:Ai,randomRange:Ri,randomRangeInt:bi,pseudoRandom:Ci,pseudoRandomRange:wi,pseudoRandomRangeInt:Ii,nextPow2:Oi,repeat:xi,pingPong:Pi,inverseLerp:Di,absMaxComponent:Bi,absMax:Ni,enumerableProps:Mi,MATH_FLOAT_ARRAY:Tn,MathBase:Sn});t("math",An);var Rn,bn,Cn,wn,In,On,xn,Pn,Dn,Bn,Nn,Mn,Ln,Fn,Un,Gn,kn,zn,Hn,Vn,Wn,Xn,jn,Yn,Kn,qn,Qn,Zn,Jn,$n,tr,er,ir,nr,rr,sr,ar,or,ur,hr,lr,cr,_r,fr,dr=new(function(){function t(){this._finalizationRegistry=null,this._gcObjects=new WeakMap}var e=t.prototype;return e.registerGCObject=function(t){return t},e.init=function(){},e.finalizationRegistryCallback=function(t){var e=this._gcObjects.get(t);e&&(this._gcObjects.delete(t),e.destroy()),this._finalizationRegistry.unregister(t)},e.destroy=function(){},t}()),pr=function(){function t(){return dr.registerGCObject(this)}return t.prototype.destroy=function(){},t}(),mr=function(t,e,i){for(var n=0;n0&&0==(t&t-1)}function Is(t,e,i,n){if(!As[t].isCompressed)return e*i*n*As[t].size;switch(t){case On.BC1:case On.BC1_ALPHA:case On.BC1_SRGB:case On.BC1_SRGB_ALPHA:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case On.BC2:case On.BC2_SRGB:case On.BC3:case On.BC3_SRGB:case On.BC4:case On.BC4_SNORM:case On.BC6H_SF16:case On.BC6H_UF16:case On.BC7:case On.BC7_SRGB:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case On.BC5:case On.BC5_SNORM:return Math.ceil(e/4)*Math.ceil(i/4)*32*n;case On.ETC_RGB8:case On.ETC2_RGB8:case On.ETC2_SRGB8:case On.ETC2_RGB8_A1:case On.EAC_R11:case On.EAC_R11SN:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case On.ETC2_RGBA8:case On.ETC2_SRGB8_A1:case On.EAC_RG11:case On.EAC_RG11SN:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case On.PVRTC_RGB2:case On.PVRTC_RGBA2:case On.PVRTC2_2BPP:return Math.ceil(e/8)*Math.ceil(i/4)*8*n;case On.PVRTC_RGB4:case On.PVRTC_RGBA4:case On.PVRTC2_4BPP:return Math.ceil(e/4)*Math.ceil(i/4)*8*n;case On.ASTC_RGBA_4X4:case On.ASTC_SRGBA_4X4:return Math.ceil(e/4)*Math.ceil(i/4)*16*n;case On.ASTC_RGBA_5X4:case On.ASTC_SRGBA_5X4:return Math.ceil(e/5)*Math.ceil(i/4)*16*n;case On.ASTC_RGBA_5X5:case On.ASTC_SRGBA_5X5:return Math.ceil(e/5)*Math.ceil(i/5)*16*n;case On.ASTC_RGBA_6X5:case On.ASTC_SRGBA_6X5:return Math.ceil(e/6)*Math.ceil(i/5)*16*n;case On.ASTC_RGBA_6X6:case On.ASTC_SRGBA_6X6:return Math.ceil(e/6)*Math.ceil(i/6)*16*n;case On.ASTC_RGBA_8X5:case On.ASTC_SRGBA_8X5:return Math.ceil(e/8)*Math.ceil(i/5)*16*n;case On.ASTC_RGBA_8X6:case On.ASTC_SRGBA_8X6:return Math.ceil(e/8)*Math.ceil(i/6)*16*n;case On.ASTC_RGBA_8X8:case On.ASTC_SRGBA_8X8:return Math.ceil(e/8)*Math.ceil(i/8)*16*n;case On.ASTC_RGBA_10X5:case On.ASTC_SRGBA_10X5:return Math.ceil(e/10)*Math.ceil(i/5)*16*n;case On.ASTC_RGBA_10X6:case On.ASTC_SRGBA_10X6:return Math.ceil(e/10)*Math.ceil(i/6)*16*n;case On.ASTC_RGBA_10X8:case On.ASTC_SRGBA_10X8:return Math.ceil(e/10)*Math.ceil(i/8)*16*n;case On.ASTC_RGBA_10X10:case On.ASTC_SRGBA_10X10:return Math.ceil(e/10)*Math.ceil(i/10)*16*n;case On.ASTC_RGBA_12X10:case On.ASTC_SRGBA_12X10:return Math.ceil(e/12)*Math.ceil(i/10)*16*n;case On.ASTC_RGBA_12X12:case On.ASTC_SRGBA_12X12:return Math.ceil(e/12)*Math.ceil(i/12)*16*n;default:return 0}}function Os(t,e,i,n,r){for(var s=0,a=0;a>1,1),i=Math.max(i>>1,1);return s}var xs=[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 Ps(t){return xs[t]||0}function Ds(t){if(t.isCompressed)return Uint8Array;var e=t.size/t.count;switch(t.type){case xn.UNORM:case xn.UINT:switch(e){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case xn.SNORM:case xn.INT:switch(e){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case xn.FLOAT:return Float32Array}return Float32Array}function Bs(t){switch(t){case On.BC1:case On.BC1_ALPHA:case On.BC1_SRGB:case On.BC1_SRGB_ALPHA:case On.BC2:case On.BC2_SRGB:case On.BC3:case On.BC3_SRGB:case On.BC4:case On.BC4_SNORM:case On.BC6H_SF16:case On.BC6H_UF16:case On.BC7:case On.BC7_SRGB:case On.BC5:case On.BC5_SNORM:case On.ETC_RGB8:case On.ETC2_RGB8:case On.ETC2_SRGB8:case On.ETC2_RGB8_A1:case On.EAC_R11:case On.EAC_R11SN:case On.ETC2_RGBA8:case On.ETC2_SRGB8_A1:case On.EAC_RG11:case On.EAC_RG11SN:return{width:4,height:4};case On.PVRTC_RGB2:case On.PVRTC_RGBA2:case On.PVRTC2_2BPP:return{width:8,height:4};case On.PVRTC_RGB4:case On.PVRTC_RGBA4:case On.PVRTC2_4BPP:return{width:4,height:4};case On.ASTC_RGBA_4X4:case On.ASTC_SRGBA_4X4:return{width:4,height:4};case On.ASTC_RGBA_5X4:case On.ASTC_SRGBA_5X4:return{width:5,height:4};case On.ASTC_RGBA_5X5:case On.ASTC_SRGBA_5X5:return{width:5,height:5};case On.ASTC_RGBA_6X5:case On.ASTC_SRGBA_6X5:return{width:6,height:5};case On.ASTC_RGBA_6X6:case On.ASTC_SRGBA_6X6:return{width:6,height:6};case On.ASTC_RGBA_8X5:case On.ASTC_SRGBA_8X5:return{width:8,height:5};case On.ASTC_RGBA_8X6:case On.ASTC_SRGBA_8X6:return{width:8,height:6};case On.ASTC_RGBA_8X8:case On.ASTC_SRGBA_8X8:return{width:8,height:8};case On.ASTC_RGBA_10X5:case On.ASTC_SRGBA_10X5:return{width:10,height:5};case On.ASTC_RGBA_10X6:case On.ASTC_SRGBA_10X6:return{width:10,height:6};case On.ASTC_RGBA_10X8:case On.ASTC_SRGBA_10X8:return{width:10,height:8};case On.ASTC_RGBA_10X10:case On.ASTC_SRGBA_10X10:return{width:10,height:10};case On.ASTC_RGBA_12X10:case On.ASTC_SRGBA_12X10:return{width:12,height:10};case On.ASTC_RGBA_12X12:case On.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function Ns(t,e){return Math.ceil(t/e)*e}var Ms=Object.freeze({__proto__:null,get ObjectType(){return Rn},get Status(){return bn},get API(){return Cn},get SurfaceTransform(){return wn},get Feature(){return In},get Format(){return On},get FormatType(){return xn},get Type(){return Pn},get BufferUsageBit(){return Dn},get BufferFlagBit(){return Bn},get MemoryAccessBit(){return Nn},get MemoryUsageBit(){return Mn},get TextureType(){return Ln},get TextureUsageBit(){return Fn},get TextureFlagBit(){return Un},get FormatFeatureBit(){return Gn},get SampleCount(){return kn},get VsyncMode(){return zn},get Filter(){return Hn},get Address(){return Vn},get ComparisonFunc(){return Wn},get StencilOp(){return Xn},get BlendFactor(){return jn},get BlendOp(){return Yn},get ColorMask(){return Kn},get ShaderStageFlagBit(){return qn},get LoadOp(){return Qn},get StoreOp(){return Zn},get AccessFlagBit(){return Jn},get ResolveMode(){return $n},get PipelineBindPoint(){return tr},get PrimitiveMode(){return er},get PolygonMode(){return ir},get ShadeModel(){return nr},get CullMode(){return rr},get DynamicStateFlagBit(){return sr},get StencilFace(){return ar},get DescriptorType(){return or},get QueueType(){return ur},get QueryType(){return hr},get CommandBufferType(){return lr},get ClearFlagBit(){return cr},get BarrierType(){return _r},get PassType(){return fr},Size:vr,DeviceCaps:yr,DeviceOptions:Er,Offset:Tr,Rect:Sr,Extent:Ar,TextureSubresLayers:Rr,TextureSubresRange:br,TextureCopy:Cr,TextureBlit:wr,BufferTextureCopy:Ir,Viewport:Or,Color:Pr,BindingMappingInfo:Dr,SwapchainInfo:Br,DeviceInfo:Nr,BufferInfo:Mr,BufferViewInfo:Lr,DrawInfo:Fr,DispatchInfo:Ur,IndirectBuffer:Gr,TextureInfo:kr,TextureViewInfo:zr,SamplerInfo:Hr,Uniform:Vr,UniformBlock:Wr,UniformSamplerTexture:Xr,UniformSampler:jr,UniformTexture:Yr,UniformStorageImage:Kr,UniformStorageBuffer:qr,UniformInputAttachment:Qr,ShaderStage:Zr,Attribute:Jr,ShaderInfo:$r,InputAssemblerInfo:ts,ColorAttachment:es,DepthStencilAttachment:is,SubpassInfo:ns,SubpassDependency:rs,RenderPassInfo:ss,GeneralBarrierInfo:as,TextureBarrierInfo:os,BufferBarrierInfo:us,FramebufferInfo:hs,DescriptorSetLayoutBinding:ls,DescriptorSetLayoutInfo:cs,DescriptorSetInfo:_s,PipelineLayoutInfo:fs,InputState:ds,CommandBufferInfo:ps,QueueInfo:ms,QueryPoolInfo:gs,FormatInfo:vs,MemoryStatus:ys,DynamicStencilStates:Es,DynamicStates:Ts,GFXObject:Ss,get AttributeName(){return gr},FormatInfos:As,DESCRIPTOR_BUFFER_TYPE:Rs,DESCRIPTOR_SAMPLER_TYPE:bs,DESCRIPTOR_DYNAMIC_TYPE:Cs,DRAW_INFO_SIZE:28,IsPowerOf2:ws,FormatSize:Is,FormatSurfaceSize:Os,GetTypeSize:Ps,getTypedArrayConstructor:Ds,formatAlignment:Bs,alignTo:Ns}),Ls=function(t){function e(){var e;return(e=t.call(this,Rn.BUFFER)||this)._usage=Dn.NONE,e._memUsage=Mn.NONE,e._size=0,e._stride=1,e._count=0,e._flags=Bn.NONE,e._isBufferView=!1,e}return c(e,t),h(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}(Ss),Fs=function(t){function e(){var e;return(e=t.call(this,Rn.COMMAND_BUFFER)||this)._queue=null,e._type=lr.PRIMARY,e._numDrawCalls=0,e._numInstances=0,e._numTris=0,e}return c(e,t),h(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}(Ss),Us=function(){function t(){this._gfxAPI=Cn.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(In.COUNT),this._formatFeatures=new Array(On.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new ys,this._caps=new yr,this._bindingMappingInfo=new Dr,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map}var e=t.prototype;return e.hasFeature=function(t){return this._features[t]},e.getFormatFeatures=function(t){return this._formatFeatures[t]},h(t,[{key:"gfxAPI",get:function(){return this._gfxAPI}},{key:"queue",get:function(){return this._queue}},{key:"commandBuffer",get:function(){return this._cmdBuff}},{key:"renderer",get:function(){return this._renderer}},{key:"vendor",get:function(){return this._vendor}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}},{key:"memoryStatus",get:function(){return this._memoryStatus}},{key:"capabilities",get:function(){return this._caps}},{key:"bindingMappingInfo",get:function(){return this._bindingMappingInfo}}]),t}();Us.canvas=void 0;var Gs=function(t){function e(){var e;return(e=t.call(this,Rn.SWAPCHAIN)||this)._transform=wn.IDENTITY,e._colorTexture=null,e._depthStencilTexture=null,e}return c(e,t),h(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}(Ss),ks=function(t){function e(){var e;return(e=t.call(this,Rn.FRAMEBUFFER)||this)._renderPass=null,e._colorTextures=[],e._depthStencilTexture=null,e}return c(e,t),h(e,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}}]),e}(Ss),zs=String.prototype.charCodeAt;function Hs(t){return this[t]}function Vs(t,e){for(var i=t.length,n=e^i,r=0,s="string"==typeof t?zs:Hs;i>=4;){var a=255&s.call(t,r)|(255&s.call(t,++r))<<8|(255&s.call(t,++r))<<16|(255&s.call(t,++r))<<24;a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),i-=4,++r}switch(i){case 3:n^=(255&s.call(t,r+2))<<16;case 2:n^=(255&s.call(t,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(t,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}var Ws=function(t){function e(){var e;return(e=t.call(this,Rn.INPUT_ASSEMBLER)||this)._attributes=[],e._attributesHash=0,e._vertexBuffers=[],e._indexBuffer=null,e._indirectBuffer=null,e._drawInfo=new Fr,e}c(e,t);var i=e.prototype;return i.getVertexBuffer=function(t){return void 0===t&&(t=0),t=0){var o=this._colorInfos[i.depthStencil];t+="ds,"+o.format+","+o.sampleCount}}else{t+="ca";for(var u=0;u>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},h(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(Ss),na=function(t){function e(){var e;return(e=t.call(this,Rn.SHADER)||this)._name="",e._stages=[],e._attributes=[],e._blocks=[],e._samplers=[],e}return c(e,t),h(e,[{key:"name",get:function(){return this._name}},{key:"attributes",get:function(){return this._attributes}},{key:"blocks",get:function(){return this._blocks}},{key:"samplers",get:function(){return this._samplers}}]),e}(Ss),ra=function(t){function e(){var e;return(e=t.call(this,Rn.TEXTURE)||this)._info=new kr,e._viewInfo=new zr,e._isPowerOf2=!1,e._isTextureView=!1,e._size=0,e}return c(e,t),e.getLevelCount=function(t,e){return Math.floor(Math.log2(Math.max(t,e)))},h(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}(Ss),sa=function(t){function e(e,i){var n;return(n=t.call(this,Rn.GLOBAL_BARRIER)||this)._info=new as,n._hash=0,n._info.copy(e),n._hash=i,n}return c(e,t),e.computeHash=function(t){return Vs(t.prevAccesses+" "+t.nextAccesses+" "+t.type,666)},h(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(Ss),aa=function(t){function e(e,i){var n;return(n=t.call(this,Rn.TEXTURE_BARRIER)||this)._info=new os,n._hash=0,n._info.copy(e),n._hash=i,n}return c(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,Vs(e+=t.dstQueue?t.dstQueue.type:0,666)},h(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(Ss),oa=function(t){function e(e,i){var n;return(n=t.call(this,Rn.BUFFER_BARRIER)||this)._info=new us,n._hash=0,n._info.copy(e),n._hash=i,n}return c(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,Vs(e+=t.dstQueue?t.dstQueue.type:0,666)},h(e,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),e}(Ss),ua={Device:Us,Swapchain:Gs,Buffer:Ls,Texture:ra,Sampler:ia,Shader:na,InputAssembler:Ws,RenderPass:ea,Framebuffer:ks,DescriptorSet:Xs,DescriptorSetLayout:js,PipelineLayout:Ys,PipelineState:$s,CommandBuffer:Fs,Queue:ta,GeneralBarrier:sa,TextureBarrier:aa,BufferBarrier:oa,RasterizerState:Ks,BlendState:Zs,BlendTarget:Qs,DepthStencilState:qs,PipelineStateInfo:Js};Object.assign(ua,Ms),b.gfx=ua;var ha={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 la in ha){var ca=ha[la];!0===ca?ca=la.slice(3):!1===ca&&(ca=la),et(b,"cc",[{name:la,newName:ca,target:b.gfx,targetName:"cc.gfx"}])}it(b,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),it(In,"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;"}]),it(es.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),it(is.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),et(Us.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]);var _a=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,gt(this._pools,t._poolHandle),t._poolHandle=-1)},e.tryShrink=function(){for(var t=0;tthis.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},t}()),fa=function(){function t(){this._poolHandle=-1,_a.addContainer(this)}return t.prototype.destroy=function(){_a.removeContainer(this)},t}(),da=t("Pool",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._ctor=void 0,r._elementsPerBatch=void 0,r._nextAvail=void 0,r._freepool=[],r._dtor=void 0,r._ctor=e,r._dtor=n||null,r._elementsPerBatch=Math.max(i,1),r._nextAvail=r._elementsPerBatch-1;for(var s=0;s>1>this._elementsPerBatch){if(this._dtor)for(var t=this._nextAvail>>1;t<=this._nextAvail;t++)this._dtor(this._freepool[t]);this._freepool.length=this._nextAvail>>1,this._nextAvail=this._freepool.length-1}},i.destroy=function(){var e=arguments.length>0?arguments[0]:null;e&&j(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}(fa)),pa=t("RecyclePool",function(t){function e(e,i,n){var r;(r=t.call(this)||this)._fn=void 0,r._dtor=null,r._count=0,r._data=void 0,r._initSize=0,r._fn=e,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;sthis._data.length)for(var e=this._data.length;e=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var e=0;e>2>this._count){var t=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var e=t;e=this._count)){var e=this._count-1,i=this._data[t];this._data[t]=this._data[e],this._data[e]=i,this._count-=1}},h(e,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),e}(fa)),ma=t("CachedArray",function(t){function e(e,i){var n;return(n=t.call(this)||this).array=void 0,n.length=0,n._compareFn=void 0,n._initSize=0,n.array=new Array(e),n._initSize=e,n.length=0,n._compareFn=i,n}c(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]||ba(this.callbackInfos,t);this.containCanceled=!1},e.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},t}(),xa=new da((function(){return new Oa}),16),Pa=function(){function t(){this._callbackTable=Bt(!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]=xa.alloc());var s=Ia.alloc();s.set(e,i,n),r.callbackInfos.push(s)}return e},e.hasEventListener=function(t,e,i){var n=this._callbackTable&&this._callbackTable[t];if(!n)return!1;var r=n.callbackInfos;if(!e){if(n.isInvoking){for(var s=0;s0}for(var a=0;a1)&&(h=!0,l="",c=0);var f=Fa.UNKNOWN;-1!==s.appVersion.indexOf("Win")?f=Fa.WINDOWS:h?f=Fa.IOS:-1!==s.appVersion.indexOf("Mac")?f=Fa.OSX:-1!==s.appVersion.indexOf("X11")&&-1===s.appVersion.indexOf("Linux")?f=Fa.LINUX:u?f=Fa.ANDROID:-1===s.appVersion.indexOf("Linux")&&-1===a.indexOf("ubuntu")||(f=Fa.LINUX),n.os=f,n.osVersion=l,n.osMainVersion=c,n.browserType=Na.UNKNOWN;var d=/wechat|weixin|micromessenger/i.exec(a)||/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(a)||/qq|qqbrowser|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(a)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(a),p=d?d[0].toLowerCase():Fa.UNKNOWN;("safari"===p&&u||"qq"===p&&/android.*applewebkit/i.test(a))&&(p=Na.ANDROID);var m={micromessenger:Na.WECHAT,wechat:Na.WECHAT,weixin:Na.WECHAT,trident:Na.IE,edge:Na.EDGE,"360 aphone":Na.BROWSER_360,mxbrowser:Na.MAXTHON,"opr/":Na.OPERA,ubrowser:Na.UC,huaweibrowser:Na.HUAWEI};n.browserType=m[p]||p,n.browserVersion="";var g=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(a);g||(g=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(a)),n.browserVersion=g?g[4]:"",n.isXR=!1;var v,y=document.createElement("canvas");y.getContext("2d");try{v=y.toDataURL("image/webp").startsWith("data:image/webp")}catch(t){v=!1}if(n.browserType===Na.SAFARI){var E,T=null===(E=/ version\/(\d+)/.exec(a))||void 0===E?void 0:E[1];"string"==typeof T&&Number.parseInt(T)>=14&&(v=!0)}var S=!1;"undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob&&(y.width=y.height=2,createImageBitmap(y,{}).then((function(t){S=!0,null==t||t.close()})).catch((function(){})));var R=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||A,b=void 0!==document.documentElement.onmouseup||A;return n._featureMap=((i={})[Ga.WEBP]=v,i[Ga.IMAGE_BITMAP]=S,i[Ga.WEB_VIEW]=!0,i[Ga.VIDEO_PLAYER]=!0,i[Ga.SAFE_AREA]=!1,i[Ga.INPUT_TOUCH]=R,i[Ga.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||A,i[Ga.EVENT_MOUSE]=b,i[Ga.EVENT_TOUCH]=R||b,i[Ga.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,i[Ga.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads,i[Ga.EVENT_HANDLE]=n.isXR,i[Ga.EVENT_HMD]=n.isXR,i),n._registerEvent(),n}c(e,t);var i=e.prototype;return i._registerEvent=function(){var t,e=this;t=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":"hidden";var i=!1,n=function(){i||(i=!0,e.emit("hide"))},r=function(t,n,r,s,a){i&&(i=!1,e.emit("show",t,n,r,s,a))};if(t)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",n),window.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r))},i.hasFeature=function(t){return this._featureMap[t]},i.getBatteryLevel=function(){return this._battery?this._battery.level:1},i.triggerGC=function(){},i.openURL=function(t){window.open(t)},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.close=function(){this.emit("close"),window.close()},e}(Ba));!function(t){t[t.PORTRAIT=1]="PORTRAIT",t[t.PORTRAIT_UPSIDE_DOWN=2]="PORTRAIT_UPSIDE_DOWN",t[t.LANDSCAPE_LEFT=4]="LANDSCAPE_LEFT",t[t.LANDSCAPE_RIGHT=8]="LANDSCAPE_RIGHT",t[t.LANDSCAPE=12]="LANDSCAPE",t[t.AUTO=13]="AUTO"}(za||(za={}));var Va,Wa={auto:za.AUTO,landscape:za.LANDSCAPE,portrait:za.PORTRAIT};!function(t){t[t.Unknown=0]="Unknown",t[t.SubFrame=1]="SubFrame",t[t.BrowserWindow=2]="BrowserWindow",t[t.Fullscreen=3]="Fullscreen"}(Va||(Va={}));var Xa=new(function(t){function e(){var e,i,n,r,s,a;(e=t.call(this)||this).isFrameRotated=!1,e.handleResizeEvent=!0,e._gameFrame=void 0,e._gameContainer=void 0,e._gameCanvas=void 0,e._isProportionalToFrame=!1,e._cachedFrameStyle={width:"0px",height:"0px"},e._cachedContainerStyle={width:"0px",height:"0px"},e._cbToUpdateFrameBuffer=void 0,e._supportFullScreen=!1,e._touchEventName=void 0,e._onFullscreenChange=void 0,e._onFullscreenError=void 0,e._orientationChangeTimeoutId=-1,e._cachedFrameSize=new gn(0,0),e._exactFitScreen=!1,e._fn={},e._fnGroup=[["requestFullscreen","exitFullscreen","fullscreenchange","fullscreenEnabled","fullscreenElement","fullscreenerror"],["requestFullScreen","exitFullScreen","fullScreenchange","fullScreenEnabled","fullScreenElement","fullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange","webkitIsFullScreen","webkitCurrentFullScreenElement","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozFullScreen","mozFullScreenElement","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","MSFullscreenChange","msFullscreenEnabled","msFullscreenElement","msfullscreenerror"]],e._resolutionScale=1,e._orientation=za.AUTO,e._gameFrame=document.getElementById("GameDiv"),e._gameContainer=document.getElementById("Cocos3dGameContainer"),e._gameCanvas=document.getElementById("GameCanvas"),e._gameFrame||(e._gameFrame=document.createElement("div"),e._gameFrame.setAttribute("id","GameDiv"),null===(i=e._gameCanvas)||void 0===i||null===(n=i.parentNode)||void 0===n||n.insertBefore(e._gameFrame,e._gameCanvas),e._gameFrame.appendChild(e._gameCanvas)),e._gameContainer||(e._gameContainer=document.createElement("div"),e._gameContainer.setAttribute("id","Cocos3dGameContainer"),null===(r=e._gameCanvas)||void 0===r||null===(s=r.parentNode)||void 0===s||s.insertBefore(e._gameContainer,e._gameCanvas),e._gameContainer.appendChild(e._gameCanvas));for(var o=e._fnGroup,u=0;uwindow.innerHeight;this.isFrameRotated=Ha.isMobile&&(e&&t===za.PORTRAIT||!e&&t===za.LANDSCAPE)},i._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void j(9201);var t,e,i=b.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,u=r/a,h=s/o,l=this._gameContainer.style;u0&&j(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),Xa.requestFullScreen().then((function(){null==e||e()})).catch((function(t){console.error(t),null==i||i()}))},e.exitFullScreen=function(){return Xa.exitFullScreen()},e.autoFullScreen=function(t,e){var i;null===(i=this.requestFullScreen(t,e))||void 0===i||i.catch((function(){}))},e.disableAutoFullScreen=function(){},h(t,[{key:"devicePixelRatio",get:function(){return Xa.devicePixelRatio}},{key:"windowSize",get:function(){return Xa.windowSize},set:function(t){Xa.windowSize=t}},{key:"resolution",get:function(){return Xa.resolution}},{key:"supportsFullScreen",get:function(){return Xa.supportFullScreen}}]),t}(),Ya=t("screen",new ja);b.screen=Ya;var Ka,qa,Qa=t("sys",{Feature:Ga,hasFeature:function(t){return Ha.hasFeature(t)},NetworkType:La,Language:Ma,OS:Fa,Platform:Ua,BrowserType:Na,isNative:Ha.isNative,isBrowser:Ha.isBrowser,isMobile:Ha.isMobile,isLittleEndian:Ha.isLittleEndian,platform:Ha.platform,language:Ha.language,languageCode:Ha.nativeLanguage,os:Ha.os,osVersion:Ha.osVersion,osMainVersion:Ha.osMainVersion,browserType:Ha.browserType,browserVersion:Ha.browserVersion,isXR:Ha.isXR,windowPixelResolution:Ya.windowSize,capabilities:{canvas:!0,opengl:!0,webp:Ha.hasFeature(Ga.WEBP),imageBitmap:Ha.hasFeature(Ga.IMAGE_BITMAP),touches:Ha.hasFeature(Ga.INPUT_TOUCH),mouse:Ha.hasFeature(Ga.EVENT_MOUSE),keyboard:Ha.hasFeature(Ga.EVENT_KEYBOARD),accelerometer:Ha.hasFeature(Ga.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return Ha.networkType},getBatteryLevel:function(){return Ha.getBatteryLevel()},garbageCollect:function(){Ha.triggerGC()},isObjectValid:function(t){return null!=t},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+="capabilities : "+JSON.stringify(this.capabilities)+"\r\n",t+="os : "+this.os+"\r\n",t+="osVersion : "+this.osVersion+"\r\n",t+="platform : "+this.platform+"\r\n",M(t+="Using "+(b.game.renderType===b.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(t){Ha.openURL(t)},init:function(){try{var t=Qa.localStorage=window.localStorage;t.setItem("storage",""),t.removeItem("storage"),t=null}catch(t){var e=function(){j(5200)};this.localStorage={getItem:e,setItem:e,clear:e,removeItem:e}}this.__isWebIOS14OrIPadOS14Env=(Qa.os===Fa.IOS||Qa.os===Fa.OSX)&&Ha.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)},now:function(){return Ha.now()},restartVM:function(){Ha.restartJSVM()},getSafeAreaRect:function(){var t=b.view,e=Xa.safeAreaEdge,i=Xa.windowSize,n=new _n(e.left,e.bottom),r=new _n(i.width-e.right,i.height-e.top);t._convertToUISpace(n),t._convertToUISpace(r);var s=n.x,a=n.y,o=r.x-n.x,u=r.y-n.y;return new yn(s,a,o,u)}});b.sys=Qa,function(t){t[t.AUTO=0]="AUTO",t[t.CANVAS=1]="CANVAS",t[t.WEBGL=2]="WEBGL",t[t.HEADLESS=3]="HEADLESS"}(Ka||(Ka={})),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.CANVAS=0]="CANVAS",t[t.WEBGL=1]="WEBGL",t[t.OPENGL=2]="OPENGL",t[t.HEADLESS=3]="HEADLESS"}(qa||(qa={}));var Za=function(){function t(){this.initialized=!1,this._canvas=null,this._renderType=qa.UNKNOWN}var e=t.prototype;return e.init=function(t,e){if(!this.initialized){var i=ye.querySettings(ve.Category.RENDERING,"renderMode");if(this._canvas=t,this._renderType=this._determineRenderType(i),this._renderType===qa.WEBGL){var n=new Nr(e),r=!!window.WebGL2RenderingContext,s=window.navigator.userAgent.toLowerCase();(-1!==s.indexOf("safari")&&-1===s.indexOf("chrome")||Qa.browserType===Na.UC)&&(r=!1);var a=[];r&&b.WebGL2Device&&a.push(b.WebGL2Device),b.WebGLDevice&&a.push(b.WebGLDevice),b.EmptyDevice&&a.push(b.EmptyDevice),Us.canvas=t;for(var o=0;oqa.HEADLESS||tro.x?ro.x:t.x,t.y=t.y>ro.y?ro.y:t.y,t.z=t.z>ro.z?ro.z:t.z,t}function ho(t,e,i){ji.set($a,i.orientation.m00,i.orientation.m01,i.orientation.m02),ji.set(to,i.orientation.m03,i.orientation.m04,i.orientation.m05),ji.set(eo,i.orientation.m06,i.orientation.m07,i.orientation.m08),so[0]=$a,so[1]=to,so[2]=eo,ao[0]=i.halfExtents.x,ao[1]=i.halfExtents.y,ao[2]=i.halfExtents.z,ji.subtract(io,e,i.center),ji.set(t,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=ji.dot(io,so[n]);r>ao[n]&&(r=ao[n]),r<-ao[n]&&(r=-ao[n]),t.x+=r*so[n].x,t.y+=r*so[n].y,t.z+=r*so[n].z}return t}var lo=Object.freeze({__proto__:null,point_plane:oo,pt_point_plane:function(t,e,i){var n=oo(e,i);return ji.subtract(t,e,ji.multiplyScalar(t,i.n,n))},pt_point_aabb:uo,pt_point_obb:ho,pt_point_line:function(t,e,i,n){ji.subtract($a,i,n);var r=$a,s=ji.lengthSqr(r);if(0==s)ji.copy(t,i);else{ji.subtract($a,e,i);var a=ji.dot($a,r)/s;a<0?ji.copy(t,i):a>1?ji.copy(t,n):ji.scaleAndAdd(t,i,r,a)}}}),co={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},_o=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=co.SHAPE_LINE,this.s=new ji(t,e,i),this.e=new ji(n,r,s)}return t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.s.x,e.s.y,e.s.z,e.e.x,e.e.y,e.e.z)},t.copy=function(t,e){return ji.copy(t.s,e.s),ji.copy(t.e,e.e),t},t.fromPoints=function(t,e,i){return ji.copy(t.s,e),ji.copy(t.e,i),t},t.set=function(t,e,i,n,r,s,a){return t.s.x=e,t.s.y=i,t.s.z=n,t.e.x=r,t.e.y=s,t.e.z=a,t},t.len=function(t){return ji.distance(t.s,t.e)},t.prototype.length=function(){return ji.distance(this.s,this.e)},h(t,[{key:"type",get:function(){return this._type}}]),t}(),fo=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.o=void 0,this.d=void 0,this._type=void 0,this._type=co.SHAPE_RAY,this.o=new ji(t,e,i),this.d=new ji(n,r,s)}return t.create=function(e,i,n,r,s,a){return void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.o.x,e.o.y,e.o.z,e.d.x,e.d.y,e.d.z)},t.copy=function(t,e){return ji.copy(t.o,e.o),ji.copy(t.d,e.d),t},t.fromPoints=function(t,e,i){return ji.copy(t.o,e),ji.normalize(t.d,ji.subtract(t.d,i,e)),t},t.set=function(t,e,i,n,r,s,a){return t.o.x=e,t.o.y=i,t.o.z=n,t.d.x=r,t.d.y=s,t.d.z=a,t},t.prototype.computeHit=function(t,e){ji.normalize(t,this.d),ji.scaleAndAdd(t,this.o,t,e)},h(t,[{key:"type",get:function(){return this._type}}]),t}(),po=new ji,mo=new ji,go=new ji,vo=new ji;function yo(t){return Math.max(Math.max(t.x,t.y),t.z)}var Eo,To=function(){function t(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this._center=new ji(0,0,0),this._radius=0,this._type=void 0,this._type=co.SHAPE_SPHERE,this._center=new ji(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 ji.copy(t.center,e.center),t.radius=e.radius,t},t.fromPoints=function(t,e,i){return ji.multiplyScalar(t.center,ji.add(po,e,i),.5),t.radius=.5*ji.subtract(po,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){ji.set(t,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),ji.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){ji.transformMat4(r.center,this.center,t),r.radius=this.radius*yo(n)},e.translateAndRotate=function(t,e,i){ji.transformMat4(i.center,this.center,t)},e.setScale=function(t,e){e.radius=this.radius*yo(t)},e.mergePoint=function(t){this.radius<0&&(this.center.set(t),this.radius=0),ji.subtract(mo,t,this.center);var e=mo.length();if(e>this.radius){var i=.5*(e-this.radius);this.radius+=i,ji.multiplyScalar(mo,mo,i/e),ji.add(this.center,this.center,mo)}},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;ji.subtract(wo,t.o,e.a);var s=ji.dot(wo,Co)*r;if(s<0||s>1)return 0;ji.cross(Io,wo,Ro);var a=ji.dot(t.d,Io)*r;if(a<0||s+a>1)return 0;var o=ji.dot(bo,Io)*r;return o<0?0:o}),Bo=function(){var t=new ji(0,0,0);return function(e,i){var n=i.radius,r=i.center,s=e.o,a=e.d,o=n*n;ji.subtract(t,r,s);var u=t.lengthSqr(),h=ji.dot(t,a),l=o-(u-h*h);if(l<0)return 0;var c=Math.sqrt(l),_=up?0:d>0?d:p}var Lo,Fo,Uo,Go,ko=function(){var t=new ji,e=new ji,i=new ji,n=new ji,r=new ji,s=new ji,a=new ji,o=new Array(3),u=new Array(3),h=new Array(3),l=new Array(6);return function(c,_){o[0]=_.halfExtents.x,o[1]=_.halfExtents.y,o[2]=_.halfExtents.z,t=_.center,e=c.o,i=c.d,ji.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),ji.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),ji.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),ji.subtract(a,t,e),u[0]=ji.dot(n,i),u[1]=ji.dot(r,i),u[2]=ji.dot(s,i),h[0]=ji.dot(n,a),h[1]=ji.dot(r,a),h[2]=ji.dot(s,a);for(var f=0;f<3;++f){if(0===u[f]){if(-h[f]-o[f]>0||-h[f]+o[f]<0)return 0;u[f]=1e-7}l[2*f+0]=(h[f]+o[f])/u[f],l[2*f+1]=(h[f]-o[f])/u[f]}var d=Math.max(Math.max(Math.min(l[0],l[1]),Math.min(l[2],l[3])),Math.min(l[4],l[5])),p=Math.min(Math.min(Math.max(l[0],l[1]),Math.max(l[2],l[3])),Math.max(l[4],l[5]));return p<0||d>p?0:d>0?d:p}}(),zo=function(){var t=new ji,e=new ji,i=new ji,n=new ji,r=new ji,s=new ji,a=new ji,o=new To;return function(u,h){var l=h.radius*h.radius,c=ji.normalize(t,u.d),_=h.ellipseCenter0,f=h.ellipseCenter1,d=ji.subtract(e,f,_);if(d.equals(ji.ZERO))return o.radius=h.radius,o.center.set(h.ellipseCenter0),bu.raySphere(u,o);var p=u.o,m=ji.subtract(i,p,_),g=ji.cross(n,c,d),v=g.lengthSqr();if(0===v){o.radius=h.radius;var y=ji.subtract(r,f,p);return m.lengthSqr()=0&&I<=1?R:I<0?(o.radius=h.radius,o.center.set(h.ellipseCenter0),bu.raySphere(u,o)):I>1?(o.radius=h.radius,o.center.set(h.ellipseCenter1),bu.raySphere(u,o)):0}}(),Ho=(Lo=So.create(),Fo={distance:1/0,doubleSided:!1,mode:Eo.ANY},Uo=0,Go=function(t,e,i,n,r,s){t===Eo.CLOSEST?(Uo>e||0===Uo)&&(Uo=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))):(Uo=e,s&&s.push({distance:e,vertexIndex0:i/3,vertexIndex1:n/3,vertexIndex2:r/3}))},function(t,e,i){if(Uo=0,0===e.geometricInfo.positions.length)return Uo;var n=void 0===i?Fo:i;if(Mo(t,e.geometricInfo.boundingBox.min,e.geometricInfo.boundingBox.max)){var r=e.primitiveMode,s=e.geometricInfo;!function(t,e,i,n,r){if(i===er.TRIANGLE_LIST)for(var s=e.length,a=0;ar.distance)&&(Go(r.mode,l,o,u,h,r.result),r.mode===Eo.ANY))return l}else if(i===er.TRIANGLE_STRIP)for(var c=e.length-2,_=0,f=0;fr.distance)&&(Go(r.mode,g,d,p,m,r.result),r.mode===Eo.ANY))return g}else if(i===er.TRIANGLE_FAN){var v=e.length-1,y=3*e[0];ji.set(Lo.a,t[y],t[y+1],t[y+2]);for(var E=1;Er.distance)&&(Go(r.mode,A,y,T,S,r.result),r.mode===Eo.ANY))return A}}}(s.positions,s.indices,r,t,n)}return Uo}),Vo=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Eo.ANY};return function(i,n,r){t=0;var s=void 0===r?e:r,a=n.renderingSubMeshes.length,o=n.struct.minPosition,u=n.struct.maxPosition;if(o&&u&&!Mo(i,o,u))return t;for(var h=0;hc)&&(t=c,s.subIndices&&(s.subIndices[0]=h));else if(t=c,s.subIndices&&s.subIndices.push(h),s.mode===Eo.ANY)return c}return t&&s.mode===Eo.CLOSEST&&(s.result&&(s.result[0].distance=t,s.result.length=1),s.subIndices&&(s.subIndices.length=1)),t}}(),Wo=function(){var t=0,e={distance:1/0,doubleSided:!1,mode:Eo.ANY},i=new fo,n=new un;return function(r,s,a){t=0;var o=void 0===a?e:a,u=s.worldBounds;if(u&&!No(r,u))return t;fo.copy(i,r),s.node&&(un.invert(n,s.node.getWorldMatrix(n)),ji.transformMat4(i.o,r.o,n),ji.transformMat4Normal(i.d,r.d,n));for(var h=s.subModels,l=0;l_)&&(t=_,o.subIndices&&(o.subIndices[0]=l));else if(t=_,o.subIndices&&o.subIndices.push(l),o.mode===Eo.ANY)return _}return t&&o.mode===Eo.CLOSEST&&(o.result&&(o.result[0].distance=t,o.result.length=1),o.subIndices&&(o.subIndices.length=1)),t}}(),Xo=function(){var t=new ji(0,0,0);return function(e,i){ji.subtract(t,e.e,e.s);var n=(i.d-ji.dot(e.s,i.n))/ji.dot(t,i.n);return n<0||n>1?0:n}}(),jo=function(){var t=new ji(0,0,0),e=new ji(0,0,0),i=new ji(0,0,0),n=new ji(0,0,0),r=new ji(0,0,0),s=new ji(0,0,0);return function(a,o,u){ji.subtract(t,o.b,o.a),ji.subtract(e,o.c,o.a),ji.subtract(i,a.s,a.e),ji.cross(r,t,e);var h=ji.dot(i,r);if(h<=0)return 0;ji.subtract(n,a.s,o.a);var l=ji.dot(n,r);if(l<0||l>h)return 0;ji.cross(s,i,n);var c=ji.dot(e,s);if(c<0||c>h)return 0;var _=-ji.dot(t,s);if(_<0||c+_>h)return 0;if(u){var f=1/h,d=1-(c*=f)-(_*=f);ji.set(u,o.a.x*d+o.b.x*c+o.c.x*_,o.a.y*d+o.b.y*c+o.c.y*_,o.a.z*d+o.b.z*c+o.c.z*_)}return 1}}(),Yo=new fo;function Ko(t,e){Yo.o.set(t.s),ji.subtract(Yo.d,t.e,t.s),Yo.d.normalize();var i=No(Yo,e);return i<=t.length()?i:0}function qo(t,e){Yo.o.set(t.s),ji.subtract(Yo.d,t.e,t.s),Yo.d.normalize();var i=ko(Yo,e);return i<=t.length()?i:0}function Qo(t,e){Yo.o.set(t.s),ji.subtract(Yo.d,t.e,t.s),Yo.d.normalize();var i=Bo(Yo,e);return i<=t.length()?i:0}var Zo,Jo,$o,tu,eu=(Zo=new ji,Jo=new ji,$o=new ji,tu=new ji,function(t,e){return ji.subtract(Zo,t.center,t.halfExtents),ji.add(Jo,t.center,t.halfExtents),ji.subtract($o,e.center,e.halfExtents),ji.add(tu,e.center,e.halfExtents),Zo.x<=tu.x&&Jo.x>=$o.x&&Zo.y<=tu.y&&Jo.y>=$o.y&&Zo.z<=tu.z&&Jo.z>=$o.z});function iu(t,e,i,n,r,s){ji.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),ji.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),ji.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),ji.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),ji.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),ji.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),ji.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),ji.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 nu(t,e){for(var i=ji.dot(e,t[0]),n=i,r=1;r<8;++r){var s=ji.dot(e,t[r]);i=sn?s:n}return[i,n]}var ru,su,au,ou=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new ji(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new ji(0,0,0),n[r]=new ji(0,0,0);var s=new ji,a=new ji;return function(e,r){ji.set(t[0],1,0,0),ji.set(t[1],0,1,0),ji.set(t[2],0,0,1),ji.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),ji.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),ji.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)ji.cross(t[6+3*o],t[o],t[3]),ji.cross(t[7+3*o],t[o],t[4]),ji.cross(t[7+3*o],t[o],t[5]);ji.subtract(s,e.center,e.halfExtents),ji.add(a,e.center,e.halfExtents),function(t,e,i){ji.set(i[0],t.x,e.y,e.z),ji.set(i[1],t.x,e.y,t.z),ji.set(i[2],t.x,t.y,e.z),ji.set(i[3],t.x,t.y,t.z),ji.set(i[4],e.x,e.y,e.z),ji.set(i[5],e.x,e.y,t.z),ji.set(i[6],e.x,t.y,e.z),ji.set(i[7],e.x,t.y,t.z)}(s,a,i),iu(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var u=0;u<15;++u){var h=nu(i,t[u]),l=nu(n,t[u]);if(l[0]>h[1]||h[0]>l[1])return 0}return 1}}(),uu=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=ji.dot(e.n,t.center);return n+ie.d?0:1},hu=function(t,e){for(var i=0;in.halfExtents.x?e++:t[h].x<-n.halfExtents.x&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var l=0;ln.halfExtents.y?e++:t[l].y<-n.halfExtents.y&&i++;if(e===r.vertices.length||i===r.vertices.length)return 0;e=0,i=0;for(var c=0;cn.halfExtents.z?e++:t[c].z<-n.halfExtents.z&&i++;return e===r.vertices.length||i===r.vertices.length?0:1}}(),cu=(ru=new ji(0,0,0),su=new Qi,function(t,e){return ji.subtract(ru,e,t.center),ji.transformMat3(ru,ru,Qi.transpose(su,t.orientation)),i=ru,n=t.halfExtents,Math.abs(i.x)e.d?0:1}),fu=function(t,e){for(var i=0;ir.halfExtents.x?i++:e<-r.halfExtents.x&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var _=0;_r.halfExtents.y?i++:e<-r.halfExtents.y&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var f=0;fr.halfExtents.z?i++:e<-r.halfExtents.z&&n++;return i===a.vertices.length||n===a.vertices.length?0:1}}(),pu=function(){for(var t=new Array(15),e=0;e<15;e++)t[e]=new ji(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new ji(0,0,0),n[r]=new ji(0,0,0);return function(e,r){ji.set(t[0],e.orientation.m00,e.orientation.m01,e.orientation.m02),ji.set(t[1],e.orientation.m03,e.orientation.m04,e.orientation.m05),ji.set(t[2],e.orientation.m06,e.orientation.m07,e.orientation.m08),ji.set(t[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),ji.set(t[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),ji.set(t[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)ji.cross(t[6+3*s],t[s],t[3]),ji.cross(t[7+3*s],t[s],t[4]),ji.cross(t[8+3*s],t[s],t[5]);iu(e.center,e.halfExtents,t[0],t[1],t[2],i),iu(r.center,r.halfExtents,t[3],t[4],t[5],n);for(var a=0;a<15;++a){var o=nu(i,t[a]),u=nu(n,t[a]);if(u[0]>o[1]||o[0]>u[1])return 0}return 1}}(),mu=function(){for(var t=new To,e=new ji,i=new ji,n=new ji,r=new Array(8),s=0;s<8;s++)r[s]=new ji;for(var a=new Array(8),o=0;o<8;o++)a[o]=new ji;return function(s,o){if(0===ji.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return t.radius=o.radius,t.center.set(o.ellipseCenter0),bu.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,iu(s.center,s.halfExtents,e,i,n,r);var u=a,h=ji.copy(u[0],e),l=ji.copy(u[1],i),c=ji.copy(u[2],n);ji.subtract(u[3],o.center,s.center).normalize();var _=ji.subtract(u[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),ji.cross(u[5],h,_),ji.cross(u[6],l,_),ji.cross(u[7],c,_);for(var f=0;f<8;++f){var d=nu(r,u[f]),p=ji.dot(u[f],o.ellipseCenter0),m=ji.dot(u[f],o.ellipseCenter1),g=Math.max(p,m),v=Math.min(p,m)-o.radius,y=g+o.radius;if(v>d[1]||d[0]>y)return 0}return 1}}(),gu=function(t,e){var i=ji.dot(e.n,t.center),n=t.radius*e.n.length();return i+ne.d?0:1},vu=function(t,e){for(var i=0;ih)){ji.add(t,o,ji.multiplyScalar(t,u,a));for(var c=0;c<6;c++)if(c!==r&&c!==r+e[r]){var _=n.planes[c];if(ji.dot(_.n,t)<_.d)return 0}}}return 1}}(),Eu=function(t,e){var i=t.radius+e.radius;return ji.squaredDistance(t.center,e.center)1?ji.squaredDistance(i.center,n.ellipseCenter1)y&&(u=y,h=g+d,E=p)),h<0?(h=0,-m<0?u=0:-m>f?u=y:(u=-m,y=f)):h>E&&(h=E,-m+d<0?u=0:-m+d>f?u=y:(u=-m+d,y=f));var T=Math.abs(u)0&&(t.d=e.d/i),t},t.prototype.transform=function(t){un.invert(Iu,t),un.transpose(Iu,Iu),Li.set(Ou,this.n.x,this.n.y,this.n.z,this.d),Li.transformMat4(Ou,Ou,Iu),ji.set(this.n,Ou.x,Ou.y,Ou.z),this.d=Ou.w},h(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}(),Pu=new ji,Du=new ji,Bu=new ji,Nu=new ji,Mu=new Qi,Lu=function(t,e,i){Mu.m00=Math.abs(i.m00),Mu.m01=Math.abs(i.m01),Mu.m02=Math.abs(i.m02),Mu.m03=Math.abs(i.m04),Mu.m04=Math.abs(i.m05),Mu.m05=Math.abs(i.m06),Mu.m06=Math.abs(i.m08),Mu.m07=Math.abs(i.m09),Mu.m08=Math.abs(i.m10),ji.transformMat3(t,e,Mu)},Fu=function(){function t(t,e,i,n,r,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===s&&(s=1),this.center=void 0,this.halfExtents=void 0,this._type=void 0,this._type=co.SHAPE_AABB,this.center=new ji(t,e,i),this.halfExtents=new ji(n,r,s)}t.create=function(e,i,n,r,s,a){return new t(e,i,n,r,s,a)},t.clone=function(e){return new t(e.center.x,e.center.y,e.center.z,e.halfExtents.x,e.halfExtents.y,e.halfExtents.z)},t.copy=function(t,e){return ji.copy(t.center,e.center),ji.copy(t.halfExtents,e.halfExtents),t},t.fromPoints=function(t,e,i){return ji.add(Pu,i,e),ji.subtract(Du,i,e),ji.multiplyScalar(t.center,Pu,.5),ji.multiplyScalar(t.halfExtents,Du,.5),t},t.set=function(t,e,i,n,r,s,a){return t.center.set(e,i,n),t.halfExtents.set(r,s,a),t},t.merge=function(e,i,n){return ji.subtract(Pu,i.center,i.halfExtents),ji.subtract(Du,n.center,n.halfExtents),ji.add(Bu,i.center,i.halfExtents),ji.add(Nu,n.center,n.halfExtents),ji.max(Nu,Bu,Nu),ji.min(Bu,Pu,Du),t.fromPoints(e,Bu,Nu)},t.toBoundingSphere=function(t,e){return t.center.set(e.center),t.radius=e.halfExtents.length(),t},t.transform=function(t,e,i){return ji.transformMat4(t.center,e.center,i),Lu(t.halfExtents,e.halfExtents,i),t};var e=t.prototype;return e.getBoundary=function(t,e){ji.subtract(t,this.center,this.halfExtents),ji.add(e,this.center,this.halfExtents)},e.transform=function(t,e,i,n,r){ji.transformMat4(r.center,this.center,t),Lu(r.halfExtents,this.halfExtents,t)},e.clone=function(){return t.clone(this)},e.copy=function(e){return t.copy(this,e)},e.mergePoint=function(t){this.getBoundary(Pu,Du),t.xDu.x&&(Du.x=t.x),t.y>Du.y&&(Du.y=t.y),t.z>Du.z&&(Du.z=t.z),ji.add(Bu,Pu,Du),this.center.set(ji.multiplyScalar(Bu,Bu,.5)),this.halfExtents.set(Du.x-Bu.x,Du.y-Bu.y,Du.z-Bu.z)},e.mergePoints=function(t){if(!(t.length<1))for(var e=0;e>>1;n<=r;s=n+r>>>1){var a=t[s];if(a>e+i)r=s-1;else{if(!(a=t._times.length)return{done:!0,value:void 0};var i=[t._times[e],t._values[e]];return++e,{done:!1,value:i}}}},e.keyframes=function(){return this},e.times=function(){return this._times},e.values=function(){return this._values},e.getKeyframeTime=function(t){return this._times[t]},e.getKeyframeValue=function(t){return this._values[t]},e.addKeyFrame=function(t,e){return this._insertNewKeyframe(t,e)},e.removeKeyframe=function(t){this._times.splice(t,1),this._values.splice(t,1)},e.indexOfKeyframe=function(t){return Ju(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 Ju(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]||gi(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=Ju(i,t);if(s>=0)return s;var a=~s;return 0===a?(i.unshift(t),n.unshift(e)):a===r?(i.push(t),n.push(e)):(i.splice(a-1,0,t),n.splice(a-1,0,e)),a},h(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 nh(t){return t>-1e-9&&t<1e-9}hi.fastDefine("cc.KeyframeCurve",ih,{_times:[],_values:[]}),function(t){t[t.LINEAR=0]="LINEAR",t[t.CONSTANT=1]="CONSTANT",t[t.CUBIC=2]="CUBIC"}($u||($u=t("RealInterpolationMode",{}))),function(t){t[t.LINEAR=0]="LINEAR",t[t.CLAMP=1]="CLAMP",t[t.LOOP=2]="LOOP",t[t.PING_PONG=3]="PING_PONG"}(th||(th=t("ExtrapolationMode",{}))),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.BOTH=3]="BOTH"}(eh||(eh=t("TangentWeightMode",{})));var rh=function(){},sh=function(){return rh},ah=oh((function(){}));function oh(t){return function(e){return"function"==typeof e?t(e):function(i){return t(i,e)}}}function uh(t){return function(e){return function(i){!function(t,e,i){var n=lh(t);if(n){var r=ch(n,"proto");ch(r,"editor")[e]=i}}(i,t,e)}}}var hh="__ccclassCache__";function lh(t){return ch(t,hh)}function ch(t,e){return t[e]||(t[e]={})}var _h=oh((function(t,e){var i=le.getSuper(t);i===Object&&(i=null);var n={name:e,extends:i,ctor:t},r=t[hh];if(r){var s=r.proto;s&&le.mixin(n,s),t[hh]=void 0}return hi(n)})),fh=uh("requireComponent"),dh=uh("executionOrder"),ph=ah;function mh(t,e,i){var n=null;function r(t,e,i){!function(t,e,i,n,r,s){var a,o=s&&(s.get||s.set);r&&(a=Je(r,o));var u=le.mixin(e,a||r||{});o?(s.get&&(u.get=s.get),s.set&&(u.set=s.set)):vh(t,u,i,n,s)}(function(t){return lh(t.constructor)}(t),function(t,e){var i,n,r=ch(lh(t.constructor),"proto"),s=ch(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?mh({type:void 0}):void 0===e?(n=t,r):void r(t,e,i)}function gh(t,e,i){var n,r,s=lh(t.constructor),a=ch(s,"proto"),o=ch(a,"properties"),u=null!==(r=o[n=e])&&void 0!==r?r:o[n]={};return u.__internalFlags|=$e.STANDALONE,i&&(i.get||i.set)?(i.get&&(u.get=i.get),i.set&&(u.set=i.set)):vh(s,u,t.constructor,e,i),u}function vh(t,e,i,n,r){if(r)r.initializer&&(e.default=function(t){var e;try{e=t()}catch(e){return t}return"object"!=typeof e||null===e?e:t}(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 yh=Symbol("cc:SerializationMetadata"),Eh=function(t,e,i){Ah(gh(t,e,i))};function Th(t){return function(e,i,n){var r=gh(e,i,n);r.formerlySerializedAs=t,Ah(r)}}var Sh=function(t,e,i){var n=gh(t,e,i);n.editorOnly=!0,Ah(n)};function Ah(t){t.__internalFlags|=$e.IMPLICIT_SERIALIZABLE}var Rh=rh,bh=ah,Ch=sh,wh=ah,Ih=sh,Oh=sh,xh=sh,Ph=rh,Dh=sh,Bh=rh,Nh=sh,Mh=sh,Lh=sh,Fh=sh,Uh=sh,Gh=sh,kh=rh,zh=sh,Hh=rh,Vh=rh,Wh=Kh(He),Xh=Kh(Ve),jh=Kh(We),Yh=Kh(Xe);function Kh(t){return mh({type:t})}var qh=function(t,e,i){gh(t,e,i).override=!0},Qh=function(){},Zh=Object.freeze({__proto__:null,uniquelyReferenced:Rh,ccclass:_h,property:mh,requireComponent:fh,executionOrder:dh,disallowMultiple:ph,allowReplicated:function(t){hi.Attr.setClassAttr(t,"replicated","visible",!0)},executeInEditMode:bh,menu:Ch,playOnFocus:wh,inspector:Ih,icon:Oh,help:xh,type:Kh,integer:Wh,float:Xh,boolean:jh,string:Yh});t("_decorator",Zh);var Jh=function(){function t(t){this._map=null,this._count=0,t?(this._map=t,this._count=Object.keys(t).length):(this._map=le.createMap(!0),this._count=0)}var e=t.prototype;return e.add=function(t,e){return t in this._map||this._count++,this._map[t]=e},e.get=function(t){return this._map[t]},e.has=function(t){return t in this._map},e.remove=function(t){var e=this._map[t];return t in this._map&&(delete this._map[t],this._count--),e},e.clear=function(){0!==this._count&&(this._map=le.createMap(!0),this._count=0)},e.forEach=function(t){for(var e in this._map)t(this._map[e],e)},e.find=function(t){for(var e in this._map)if(t(this._map[e],e))return this._map[e];return null},e.destroy=function(){this._map=null},h(t,[{key:"count",get:function(){return this._count}}]),t}(),$h=function(){function t(e,i){this.id=t._pipelineId++,this.name="",this.pipes=[],this.name=e;for(var n=0,r=i.length;nthis.pipes.length?(j(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.isFinish=!1;for(var i=0,n=e.length;i>2],dl[pl[n++]]=_l[(3&r)<<2|s>>4],dl[pl[n++]]=_l[15&s]}return t.replace(e,dl.join(""))}var gl=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function vl(t){var e=gl.exec(t);return e?e[1]:""}function yl(t,e){(e=e||Object.create(null)).__isNative__=e.isNative,e.nativeExt&&(e.ext=e.nativeExt);var i=rl.find((function(e){return!!e.getAssetInfo(t)}));return i&&(e.bundle=i.name),Sl(t,e)}function El(t){return!!t&&(t instanceof b.SceneAsset||t instanceof b.Scene)}function Tl(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 Sl(t,e){var i=cl.create({input:t,options:e}),n=[];try{for(var r,s=y(ol.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(t){for(var u,h=y(i.output);!(u=h()).done;)u.value.recycle();F(t.message,t.stack)}return i.recycle(),n.length>1?n:n[0]}var Al,Rl,bl,Cl,wl=Object.freeze({__proto__:null,getUuidFromURL:vl,getUrlWithUuid:yl,isScene:El,normalize:Tl,transform:Sl,decodeUuid:ml}),Il=/(\.[^\.\/\?\\]*)(\?.*)?$/,Ol=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,xl=/[^\.\/]+\/\.\.\//;function Pl(){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 Ml(t){var e=Ol.exec(t);return e?e[2]:""}function Ll(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 Fl(t,e,i){if(0===e.indexOf("."))return Ll(t,e);var n=t.indexOf("?"),r="",s=i?Dl(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 Ul(t){var e=t=String(t);do{e=t,t=t.replace(xl,"")}while(e.length!==t.length);return t}function Gl(t){return t.replace(/[\/\\]$/,"")}function kl(){return Ha.os===Fa.WINDOWS?"\\":"/"}t("path",Object.freeze({__proto__:null,join:Pl,extname:Dl,mainFileName:Bl,basename:Nl,dirname:Ml,changeExtname:Ll,changeBasename:Fl,_normalize:Ul,stripSep:Gl,getSeperator:kl}));var zl,Hl,Vl,Wl=t("Asset",_h("cc.Asset")((Cl=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&this._ref--,t&&b.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(J(12101,this._uuid)),t.prototype.destroy.call(this)},h(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=yl(this._uuid,{nativeExt:t,isNative:!0}):this._nativeUrl=yl(this._uuid,{__nativeName__:t,nativeExt:Dl(t),isNative:!0})}return this._nativeUrl}},{key:"_nativeAsset",get:function(){return this._file},set:function(t){this._file=t}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),e}(Da(Ta)),bl=T((Rl=Cl).prototype,"_native",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),T(Rl.prototype,"_nativeAsset",[mh],Object.getOwnPropertyDescriptor(Rl.prototype,"_nativeAsset"),Rl.prototype),Al=Rl))||Al);Wl.prototype.createNode=null,b.Asset=Wl;var Xl=t("Script",_h("cc.Script")(zl=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Wl))||zl);b._Script=Xl;var jl=t("JavaScript",_h("cc.JavaScript")(Hl=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Xl))||Hl);b._JavaScript=jl;var Yl,Kl,ql,Ql,Zl,Jl,$l,tc,ec,ic,nc,rc,sc,ac=t("TypeScript",_h("cc.TypeScript")(Vl=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(Xl))||Vl);b._TypeScript=ac;var oc,uc,hc,lc,cc,_c,fc,dc,pc,mc,gc,vc,yc,Ec,Tc,Sc=t("EventHandler",(Yl=_h("cc.ClickEvent"),Kl=Mh(),ql=Mh(),Ql=Mh(),Zl=Mh(),Yl((sc=function(){function t(){E(this,"target",tc,this),E(this,"component",ec,this),E(this,"_componentId",ic,this),E(this,"handler",nc,this),E(this,"customEventData",rc,this)}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)?b.macro.REPEAT_FOREVER:i,n=n||0;var r=b.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&&b.director.getScheduler().unschedule(t,this)},i.unscheduleAllCallbacks=function(){b.director.getScheduler().unscheduleAllForTarget(this)},h(e,[{key:"name",get:function(){if(this._name)return this._name;var t=Nt(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=b.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&Rc}}]),e}(Ta),mc.EventHandler=Sc,mc.system=null,T((_c=gc).prototype,"__scriptAsset",[uc,hc,lc,Vh],Object.getOwnPropertyDescriptor(_c.prototype,"__scriptAsset"),_c.prototype),fc=T(_c.prototype,"node",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),dc=T(_c.prototype,"_enabled",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),pc=T(_c.prototype,"__prefab",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),cc=_c))||cc)),Cc=bc.prototype;Cc.update=null,Cc.lateUpdate=null,Cc.__preload=null,Cc.onLoad=null,Cc.start=null,Cc.onEnable=null,Cc.onDisable=null,Cc.onDestroy=null,Cc.onFocusInEditor=null,Cc.onLostFocusInEditor=null,Cc.resetInEditor=null,Cc._getLocalBounds=null,Cc.onRestore=null,bc._requireComponent=null,bc._executionOrder=0,Ot(bc,"_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)})),b.Component=bc;var wc=t("MissingScript",_h("cc.MissingScript")(vc=Ih()((Tc=function(t){function e(){var e;return E(e=t.call(this)||this,"_$erialized",Ec,g(e)),e}return c(e,t),e.safeFindClass=function(t){var e=re(t);if(e)return e;b.deserialize.reportMissingClass(t)},e.prototype.onLoad=function(){j(4600,this.node.name)},e}(bc),Ec=T((yc=Tc).prototype,"_$erialized",[Eh,Sh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),vc=yc))||vc)||vc);b._MissingScript=wc;try{var Ic=wc.__values__;0!==Ic.length&&"_$erialized"===Ic[Ic.length-1]||(F("The '_$erialized' prop in MissingScript is missing. Please contact jare."),F(" Error props: ['"+Ic+"']"))}catch(ao){F("Error when checking MissingScript 5, "+ao)}var Oc=t("serializeTag",Symbol("[[Serialize]]")),xc=t("deserializeTag",Symbol("[[Deserialize]]")),Pc=function(){function t(t,e){this._document=void 0,this._chunks=void 0,this._document=t,this._chunks=e}return h(t,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),t}();function Dc(t){var e=t;return{chunks:e.chunks,document:e.document}}function Bc(t){if(t.length<16)throw new Nc(J(13102));var e=new DataView(t.buffer,t.byteOffset,t.byteLength);if(1313817411!==e.getUint32(0,!0))throw new Nc(J(13100));var i=e.getUint32(4,!0);if(1!==i)throw new Nc(J(13101,i));if(e.getUint32(8,!0)!==e.byteLength)throw new Nc(J(13102));var n=12,r=e.getUint32(n,!0);n+=4;var s=new Uint8Array(e.buffer,n+e.byteOffset,r);n+=r;var a,o=function(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);if("Buffer"in globalThis)return globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString();throw new Error(J(13104))}(s);try{a=JSON.parse(o)}catch(t){throw new Nc(t)}for(var u=[];n0&&(t.chunks.length,this._mainBinChunk=t.chunks[0])):e=t,this._serializedData=e,this._context={fromCCON:i};var n=Array.isArray(e)?e[0]:e;return this.deserializedData=this._deserializeObject(n,0),this._serializedData=void 0,this._mainBinChunk=void 0,this._context=void 0,this.deserializedData},e._deserializeObject=function(t,e,i,n){switch(t.__type__){case"TypedArray":return this._deserializeTypedArrayView(t);case"TypedArrayRef":return this._deserializeTypedArrayViewRef(t);default:return t.__type__?this._deserializeTypeTaggedObject(t,e,i,n):Array.isArray(t)?this._deserializeArray(t):this._deserializePlainObject(t)}},e._deserializeTypedArrayView=function(t){return globalThis[t.ctor].from(t.array)},e._deserializeTypedArrayViewRef=function(t){var e=t.offset,i=t.length,n=t.ctor;return new globalThis[n](this._mainBinChunk.buffer,this._mainBinChunk.byteOffset+e,i)},e._deserializeArray=function(t){for(var e,i=new Array(t.length),n=0;n=0&&(r.deserializedList[e]=i),i}(a);return this._deserializeInto(t,o,a),o},e._deserializeInto=function(t,e,i,n){void 0===n&&(n=!1),n||!e[xc]?e._deserialize?e._deserialize(t.content,this):b.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=jt(i);r&&n._deserializeInto(t,e,r)}};e[xc](r,this._context)},e._deserializeFireClass=function(t,e,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(t,e){for(var i=Ge(e),n=e.__values__,r=["var prop;"],s=Te.test(oe(e)),a=0;a=0?e[i]=t[5][n]:t[7][3*~n]=e}function Yc(t){return function(e,i,n,r){i[n]=r;for(var s=0;s=0){var c=o[h];e[a]=Xc(t,c,l)}else(0,Qc[h=~h])(t,e,a,l)}return r}(t);b.game._isCloning=!1,t[7]&&function(t,e,i){for(var n=t.length-1,r=0,s=3*t[n];r=0?a[i[u]]=o:a[~u]=o}for(;r=0?h[i[c]]=l:h[~c]=l}}(t[7],u,t[2]),function(t){for(var e=t[5],i=t[2],n=t[1],r=t[8],s=t[9],a=t[10],o=0;o=0?i[h]:~h,s[o]=h);var l=a[o];"number"==typeof l&&(a[o]=n[l])}}(t),n=u[h]}else n=function(t,e,i){var n,r=(i=i||{}).classFinder||re,s=i.createAssetRefs||Qa.platform===Ua.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,u=null!==(n=i.reportMissingClass)&&void 0!==n?n:b.deserialize.reportMissingClass;e.init();var h=Gc.pool.get(e,r,u,a,o);b.game._isCloning=!0;var l=h.deserialize(t);return b.game._isCloning=!1,Gc.pool.put(h),s&&e.assignAssetsBy((function(t,e){return EditorExtends.serialize.asAsset(t,e.type)})),l}(t,e,i);return r&&Vc.pool.put(e),n}Qc[0]=function(t,e,i,n){e[i]=n},Qc[1]=jc,Qc[2]=Yc(jc),Qc[3]=Yc(Kc),Qc[4]=qc,Qc[5]=function(t,e,i,n){Hc[n[0]](e[i],n)},Qc[6]=Kc,Qc[7]=function(t,e,i,n){e[i].set(n)},Qc[8]=function(t,e,i,n){var r=new kc[n[0]];Hc[n[0]](r,n),e[i]=r},Qc[9]=Yc(qc),Qc[10]=function(t,e,i,n){var r=t[3][n[0]];e[i]=Xc(t,r,n[1])},Qc[11]=function(t,e,i,n){var r=n[0];e[i]=r;for(var s=1;s>3},n=i.storageUnit,r=A_(i.elementType),s=new(R_(n))(t,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o=1?1:t*t*(3-2*t)}function af(t){return t<=0?0:t>=1?1:t*t*t*(t*(6*t-15)+10)}b._decorator=Zh;var of=gf(I_,O_),uf=gf(P_,D_),hf=gf(N_,M_),lf=gf(F_,U_),cf=gf(k_,z_),_f=gf(V_,W_),ff=gf(j_,Y_),df=gf(q_,Q_),pf=gf(J_,$_),mf=gf(ef,nf);function gf(t,e){return function(i){return i<.5?e(2*i)/2:t(2*i-1)/2+.5}}var vf,yf,Ef=Object.freeze({__proto__:null,constant:C_,linear:w_,quadIn:I_,quadOut:O_,quadInOut:x_,cubicIn:P_,cubicOut:D_,cubicInOut:B_,quartIn:N_,quartOut:M_,quartInOut:L_,quintIn:F_,quintOut:U_,quintInOut:G_,sineIn:k_,sineOut:z_,sineInOut:H_,expoIn:V_,expoOut:W_,expoInOut:X_,circIn:j_,circOut:Y_,circInOut:K_,elasticIn:q_,elasticOut:Q_,elasticInOut:Z_,backIn:J_,backOut:$_,backInOut:tf,bounceIn:ef,bounceOut:nf,bounceInOut:rf,smooth:sf,fade:af,quadOutIn:of,cubicOutIn:uf,quartOutIn:hf,quintOutIn:lf,sineOutIn:cf,expoOutIn:_f,circOutIn:ff,elasticOutIn:df,backOutIn:pf,bounceOutIn:mf});t("easing",Ef),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"}(yf||(yf={}));var Tf,Sf=((vf={})[yf.CONSTANT]=C_,vf[yf.LINEAR]=w_,vf[yf.QUAD_IN]=I_,vf[yf.QUAD_OUT]=O_,vf[yf.QUAD_IN_OUT]=x_,vf[yf.QUAD_OUT_IN]=of,vf[yf.CUBIC_IN]=P_,vf[yf.CUBIC_OUT]=D_,vf[yf.CUBIC_IN_OUT]=B_,vf[yf.CUBIC_OUT_IN]=uf,vf[yf.QUART_IN]=N_,vf[yf.QUART_OUT]=M_,vf[yf.QUART_IN_OUT]=L_,vf[yf.QUART_OUT_IN]=hf,vf[yf.QUINT_IN]=F_,vf[yf.QUINT_OUT]=U_,vf[yf.QUINT_IN_OUT]=G_,vf[yf.QUINT_OUT_IN]=lf,vf[yf.SINE_IN]=k_,vf[yf.SINE_OUT]=z_,vf[yf.SINE_IN_OUT]=H_,vf[yf.SINE_OUT_IN]=cf,vf[yf.EXPO_IN]=V_,vf[yf.EXPO_OUT]=W_,vf[yf.EXPO_IN_OUT]=X_,vf[yf.EXPO_OUT_IN]=_f,vf[yf.CIRC_IN]=j_,vf[yf.CIRC_OUT]=Y_,vf[yf.CIRC_IN_OUT]=K_,vf[yf.CIRC_OUT_IN]=ff,vf[yf.ELASTIC_IN]=q_,vf[yf.ELASTIC_OUT]=Q_,vf[yf.ELASTIC_IN_OUT]=Z_,vf[yf.ELASTIC_OUT_IN]=df,vf[yf.BACK_IN]=J_,vf[yf.BACK_OUT]=$_,vf[yf.BACK_IN_OUT]=tf,vf[yf.BACK_OUT_IN]=pf,vf[yf.BOUNCE_IN]=ef,vf[yf.BOUNCE_OUT]=nf,vf[yf.BOUNCE_IN_OUT]=rf,vf[yf.BOUNCE_OUT_IN]=mf,vf[yf.SMOOTH]=sf,vf[yf.FADE]=af,vf);function Af(t){return Sf[t]}n(255),n(65280);var Rf,bf,Cf,wf=$u.LINEAR<<0|eh.NONE<<8|yf.LINEAR<<16,If=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r>0},set:function(t){this._flags&=-256,this._flags|=t<<0}},{key:"tangentWeightMode",get:function(){return(65280&this._flags)>>8},set:function(t){this._flags&=-65281,this._flags|=t<<8}},{key:"easingMethod",get:function(){return(16711680&this._flags)>>16},set:function(t){this._flags&=-16711681,this._flags|=t<<16}}]),e}(Qh);function Of(t){var e=new If;if("number"==typeof t)e.value=t;else{var i=t.interpolationMode,n=t.tangentWeightMode,r=t.value,s=t.rightTangent,a=t.rightTangentWeight,o=t.leftTangent,u=t.leftTangentWeight,h=t.easingMethod,l=t[va];e.value=null!=r?r:e.value,e.rightTangent=null!=s?s:e.rightTangent,e.rightTangentWeight=null!=a?a:e.rightTangentWeight,e.leftTangent=null!=o?o:e.leftTangent,e.leftTangentWeight=null!=u?u:e.leftTangentWeight,e.interpolationMode=null!=i?i:e.interpolationMode,e.tangentWeightMode=null!=n?n:e.tangentWeightMode,e.easingMethod=null!=h?h:e.easingMethod,l&&(e[va]=l)}return e}hi.fastDefine("cc.RealKeyframeValue",If,((Tf={interpolationMode:$u.LINEAR,tangentWeightMode:eh.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:yf.LINEAR})[va]=void 0,Tf)),hi.Attr.setClassAttr(If,va,"editorOnly",!0),(Rf=If,null!==(Cf=(bf=Rf)[yh])&&void 0!==Cf?Cf:bf[yh]={}).uniquelyReferenced=!0;var xf,Pf=t("RealCurve",function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rs){var u=this.postExtrapolation,h=i[n-1];if(u===th.CLAMP||n<2)return h.value;switch(u){case th.LINEAR:return Yf(s,h.value,e[n-2],i[n-2].value,t);case th.LOOP:t=Xf(t,r,s);break;case th.PING_PONG:t=jf(t,r,s);break;default:return h.value}}var l=Ju(e,t);if(l>=0)return i[l].value;var c=~l,_=c-1,f=e[_],d=i[_],p=e[c];return function(t,e,i,n,r){var s=i-t;switch(e.interpolationMode){default:case $u.CONSTANT:return e.value;case $u.LINEAR:var a=e.easingMethod===yf.LINEAR?r:Af(e.easingMethod)(r);return Ei(e.value,n.value,a);case $u.CUBIC:var o=1/3,u=e.rightTangent,h=e.rightTangentWeight,l=0!=(e.tangentWeightMode&eh.RIGHT),c=n.leftTangent,_=n.leftTangentWeight,f=0!=(n.tangentWeightMode&eh.LEFT);if(l||f){var d=0;if(l)d=h;else{var p=s,m=s*u;d=Math.sqrt(p*p+m*m)*o}var g=Math.atan(u),v=Math.cos(g)*d+t,y=Math.sin(g)*d+e.value,E=0;if(f)E=_;else{var T=s,S=s*c;E=Math.sqrt(T*T+S*S)*o}var A=Math.atan(c),R=(v-t)/s,b=(-Math.cos(A)*E+i-t)/s,C=y,w=-Math.sin(A)*E+n.value,I=[0,0,0],O=function(t,e,i,n,r){var s=i/n,a=e/n,o=s*s,u=1/3*(-1/3*o+a),h=.5*(2/27*s*o-1/3*s*a+t/n),l=u*u*u,c=h*h+l,_=0;if(nh(c)){if(nh(h))return r[0]=0,1;var f=Math.cbrt(-h);return r[0]=2*f,r[1]=-f,2}if(c<0){var d=1/3*Math.acos(-h/Math.sqrt(-l)),p=2*Math.sqrt(-u);r[0]=p*Math.cos(d),r[1]=-p*Math.cos(d+Math.PI/3),r[2]=-p*Math.cos(d-Math.PI/3),_=3}else{var m=Math.sqrt(c),g=Math.cbrt(m-h),v=-Math.cbrt(m+h);r[0]=g+v,_=1}for(var y=1/3*s,E=0;E<_;++E)r[E]-=y;return _}(0-r,3*R,3*b-6*R,3*(R-b)+1,I),x=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,O,r);return Kf(e.value,C,w,n.value,x)}var P=e.value+o*u*s,D=n.value-o*c*s;return Kf(e.value,P,D,n.value,r)}}(f,d,p,i[c],(t-f)/(p-f))},i.addKeyFrame=function(e,i){return t.prototype.addKeyFrame.call(this,e,Of(i))},i.assignSorted=function(t,e){if(void 0!==e)this.setKeyframes(t.slice(),e.map((function(t){return Of(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return Of(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 gi(i.value,e,t)}))},i[Oc]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+Df+Df+Bf+Nf*r+Hf*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=Df,s.setUint8(a,this.postExtrapolation),a+=Df,s.setUint32(a,r,!0),a+=Bf,i.forEach((function(t,e){return s.setFloat32(a+Nf*e,t,!0)})),a+=Nf*r;for(var o,u=y(n);!(o=u()).done;){var h=o.value;a=Vf(s,h,a)}var l=new Uint8Array(s.buffer,0,a);t.writeProperty("bytes",l);var c=n.map((function(t){return t[va]}));c.some((function(t){return void 0!==t}))&&t.writeProperty("keyframeValueEditorExtras",c)}else t.writeThis()},i[xc]=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+=Df,this.postExtrapolation=n.getUint8(r),r+=Df;var s=n.getUint32(r,!0);r+=Bf;var a=Array.from({length:s},(function(t,e){return n.getFloat32(r+Nf*e,!0)}));r+=Nf*s;for(var o=new Array(s),u=0;u>8;return e.easingMethod=s,n}function Xf(t,e,i){return e+xi(t-e,i-e)}function jf(t,e,i){return e+Pi(t-e,i-e)}function Yf(t,e,i,n,r){return e+(n-e)/(i-t)*(r-t)}function Kf(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 qf(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}b.bezier=qf;var Qf,Zf,Jf,$f,td,ed,id,nd,rd,sd,ad,od=Math.cos,ud=Math.acos,hd=Math.max,ld=2*Math.PI,cd=Math.sqrt;function _d(t){return t<0?-Math.pow(-t,1/3):Math.pow(t,1/3)}function fd(t,e){var i=function(t,e){var i,n,r,s,a=e-0,o=e-t[0],u=3*a,h=3*o,l=3*(e-t[2]),c=1/(-a+h-l+(e-1)),_=1/3,f=(u-6*o+l)*c,d=f*_,p=(-u+h)*c,m=(3*p-f*f)*_,g=m*_,v=(2*f*f*f-9*f*p+a*c*27)/27,y=v/2,E=y*y+g*g*g;if(E<0){var T=-m*_,S=cd(T*T*T),A=-v/(2*S),R=ud(A<-1?-1:A>1?1:A),b=2*_d(S);return n=b*od(R*_)-d,r=b*od((R+ld)*_)-d,s=b*od((R+2*ld)*_)-d,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?hd(n,r,s):hd(n,r):s>=0&&s<=1?hd(n,s):n:r>=0&&r<=1?s>=0&&s<=1?hd(r,s):r:s}if(0===E)return r=-(i=y<0?_d(-y):-_d(y))-d,(n=2*i-d)>=0&&n<=1?r>=0&&r<=1?hd(n,r):n:r;var C=cd(E);return(i=_d(-y+C))-_d(y+C)-d}(t,e),n=t[1];return((1-i)*(n+(t[3]-n)*i)*3+i*i)*i}b.bezierByTime=fd,function(t){t[t.SLERP=0]="SLERP",t[t.CONSTANT=1]="CONSTANT"}(ad||(ad=t("QuatInterpolationMode",{})));var dd=_h("cc.QuatKeyframeValue")(Qf=Rh((Jf=T((Zf=function(t){var e=void 0===t?{}:t,i=e.value,n=e.interpolationMode,r=e.easingMethod;E(this,"interpolationMode",Jf,this),E(this,"value",$f,this),E(this,"easingMethod",td,this),this.value=i?$i.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod}).prototype,"interpolationMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ad.SLERP}}),$f=T(Zf.prototype,"value",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return $i.clone($i.IDENTITY)}}),td=T(Zf.prototype,"easingMethod",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return yf.LINEAR}}),Qf=Zf))||Qf)||Qf;function pd(t){return new dd(t)}var md,gd=t("QuatCurve",_h("cc.QuatCurve")((sd=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rh){var c=r[o-1];switch(s){case th.LOOP:t=u+xi(t-u,h-u);break;case th.PING_PONG:t=u+Pi(t-u,h-u);break;case th.CLAMP:default:return $i.copy(e,c.value)}}var _=Ju(n,t);if(_>=0)return $i.copy(e,r[_].value);var f=~_,d=f-1,p=n[d],m=r[d],g=n[f],v=r[f],y=(t-p)/(g-p);switch(m.interpolationMode){default:case ad.CONSTANT:return $i.copy(e,m.value);case ad.SLERP:var E=m.easingMethod,T=E===yf.LINEAR?y:Array.isArray(E)?fd(E,y):Af(E)(y);return $i.slerp(e,m.value,v.value,T)}},i.addKeyFrame=function(e,i){var n=new dd(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 pd(t)})));else{var i=Array.from(t);this.setKeyframes(i.map((function(t){return t[0]})),i.map((function(t){return pd(t[1])})))}},i[Oc]=function(t,e){if(e.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(t,e,i){var n=i[0];r&&t.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,a=Ad*(r?1:s),o=n.reduce((function(t,e){var i=e.easingMethod;return t+(Array.isArray(i)?Rd+4*Cd:Rd)}),0),u=0,h=new DataView(new ArrayBuffer(u+=yd+Ed+Td*s+4*Sd*s+o+a+0)),l=0,c=0;r&&(c|=md.INTERPOLATION_MODE),h.setUint32(l,c,!0),l+=yd,h.setUint32(l,s,!0),l+=Ed,i.forEach((function(t,e){return h.setFloat32(l+Td*e,t,!0)})),l+=Td*s,n.forEach((function(t,e){var i=t.value,n=i.x,r=i.y,s=i.z,a=i.w,o=l+4*Sd*e;h.setFloat32(o+0*Sd,n,!0),h.setFloat32(o+1*Sd,r,!0),h.setFloat32(o+2*Sd,s,!0),h.setFloat32(o+3*Sd,a,!0)})),l+=4*Sd*s,n.forEach((function(t){var e=t.easingMethod;Array.isArray(e)?(h.setUint8(l,bd),++l,h.setFloat32(l+0*Cd,e[0],!0),h.setFloat32(l+1*Cd,e[1],!0),h.setFloat32(l+2*Cd,e[2],!0),h.setFloat32(l+3*Cd,e[3],!0),l+=4*Cd):(h.setUint8(l,e),++l)}));var _=l;l+=a;var f=_;n.forEach((function(t){var e=t.interpolationMode;h.setUint8(f,e),r||(f+=Ad)}));var d=new Uint8Array(h.buffer);t.writeProperty("bytes",d)}else t.writeThis()},i[xc]=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+=yd;var a=s&md.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=Ed;var u=Array.from({length:o},(function(t,e){return n.getFloat32(r+Td*e,!0)})),h=r+=Td*o;r+=4*Sd*o;var l=Array.from({length:o},(function(t,e){var i=h+4*Sd*e,s=n.getFloat32(i+0*Sd,!0),a=n.getFloat32(i+1*Sd,!0),o=n.getFloat32(i+2*Sd,!0),u=n.getFloat32(i+3*Sd,!0),l=n.getUint8(r);++r;var c=pd({value:{x:s,y:a,z:o,w:u}});return l!==bd?c.easingMethod=l:(c.easingMethod=[n.getFloat32(r+0*Cd,!0),n.getFloat32(r+1*Cd,!0),n.getFloat32(r+2*Cd,!0),n.getFloat32(r+3*Cd,!0)],r+=4*Cd),c}));if(a){var c=n.getUint8(r);++r;for(var _=0;_=0)return this._values[e];var i=vi(~e-1,0,this._values.length-1);return this._values[i]},e}(ih))||vd),Id=function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0};hi.fastDefine("cc.Keyframe",Id,{time:0,value:0,inTangent:0,outTangent:0});var Od,xd=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 e=t-this.time,i=this.coefficient,e*(e*(e*i[0]+i[1])+i[2])+i[3];var e,i},t}(),Pd=function(){function t(t){if(void 0===t&&(t=null),this.cachedKey=void 0,t instanceof Pf)this._curve=t;else{var e=new Pf;this._curve=e,e.preExtrapolation=th.LOOP,e.postExtrapolation=th.CLAMP,t?e.assignSorted(t.map((function(t){return[t.time,{interpolationMode:$u.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]}))):e.assignSorted([[0,{interpolationMode:$u.CUBIC,value:1}],[1,{interpolationMode:$u.CUBIC,value:1}]])}this.cachedKey=new xd}var e=t.prototype;return e.addKey=function(t){t?this._curve.addKeyFrame(t.time,{interpolationMode:$u.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}):this._curve.clear()},e.evaluate_slow=function(t){return this._curve.evaluate(t)},e.evaluate=function(t){var e=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=t,s=t<0?i.preExtrapolation:i.postExtrapolation,a=i.getKeyframeTime(0),o=i.getKeyframeTime(n);switch(s){case th.LOOP:r=xi(t-a,o-a)+a;break;case th.PING_PONG:r=Pi(t-a,o-a)+a;break;case th.CLAMP:default:r=vi(t,a,o)}if(r>=e.time&&ri.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1e)return a}else for(var o=0;o<3;o++){var u=r-o;if(u>=0&&i.getKeyframeTime(u-1)<=e)return u-1}for(var h,l=0,c=n;c-l>1;)h=Math.floor((l+c)/2),i.getKeyframeTime(h)>=e?c=h:l=h;return l},h(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 Id;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:$u.CUBIC,value:t.value,leftTangent:t.inTangent,rightTangent:t.outTangent}]})))}},{key:"preWrapMode",get:function(){return Bd(this._curve.preExtrapolation)},set:function(t){this._curve.preExtrapolation=Dd(t)}},{key:"postWrapMode",get:function(){return Bd(this._curve.postExtrapolation)},set:function(t){this._curve.postExtrapolation=Dd(t)}}]),t}();function Dd(t){switch(t){default:case Wu.Default:case Wu.Normal:case Wu.Clamp:return th.CLAMP;case Wu.PingPong:return th.PING_PONG;case Wu.Loop:return th.LOOP}}function Bd(t){switch(t){default:case th.LINEAR:case th.CLAMP:return Wu.Clamp;case th.PING_PONG:return Wu.PingPong;case th.LOOP:return Wu.Loop}}Pd.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],hi.fastDefine("cc.AnimationCurve",Pd,{_curve:null}),function(t){t[t.LINEAR=0]="LINEAR",t[t.BEZIER=1]="BEZIER",t[t.CATMULL_ROM=2]="CATMULL_ROM"}(Od||(Od={}));var Nd=4294967295,Md=new ji,Ld=new ji,Fd=new ji,Ud=new ji,Gd=function(){function t(t,e){void 0===t&&(t=Od.CATMULL_ROM),void 0===e&&(e=[]),this._type=void 0,this._mode=Od.CATMULL_ROM,this._knots=[],this._type=co.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=Nd),e=vi(e,0,1);var n=this.getSegments();if(0==n)return new ji(0,0,0);if(i==Nd){var r=1/n;i=Math.floor(e/r),e=e%r/r}if(i>=n)return new ji(this._knots[this._knots.length-1]);switch(this._mode){case Od.LINEAR:return t.calcLinear(this._knots[i],this._knots[i+1],e);case Od.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 Od.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],a=i+219||i<0)console.warn("maximum layers reached.");else{var n=1<19||e<0)console.warn("do not change buildin layers.");else{var i=1<31||e<0?(console.warn("Unable to access unknown layer."),""):t.Enum[1<>>26},wm=function(t){return(t&Am)>>>20},Im=function(t){return(t&Rm)>>>12},Om=function(t){return 4095&t},xm=function(t,e){return 67108863&t|e<<26&Sm},Pm=((mm={})[Pn.UNKNOWN]=function(){return console.warn("illegal uniform handle")},mm[Pn.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]},mm[Pn.INT2]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},mm[Pn.INT3]=function(t,e,i){return void 0===i&&(i=0),ji.fromArray(e,t,i)},mm[Pn.INT4]=function(t,e,i){return void 0===i&&(i=0),Li.fromArray(e,t,i)},mm[Pn.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]},mm[Pn.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),_n.fromArray(e,t,i)},mm[Pn.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),ji.fromArray(e,t,i)},mm[Pn.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),Li.fromArray(e,t,i)},mm[Pn.MAT3]=function(t,e,i){return void 0===i&&(i=0),Qi.fromArray(e,t,i)},mm[Pn.MAT4]=function(t,e,i){return void 0===i&&(i=0),un.fromArray(e,t,i)},mm),Dm=((gm={})[Pn.UNKNOWN]=function(){return console.warn("illegal uniform handle")},gm[Pn.INT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},gm[Pn.INT2]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},gm[Pn.INT3]=function(t,e,i){return void 0===i&&(i=0),ji.toArray(t,e,i)},gm[Pn.INT4]=function(t,e,i){return void 0===i&&(i=0),Li.toArray(t,e,i)},gm[Pn.FLOAT]=function(t,e,i){return void 0===i&&(i=0),t[i]=e},gm[Pn.FLOAT2]=function(t,e,i){return void 0===i&&(i=0),_n.toArray(t,e,i)},gm[Pn.FLOAT3]=function(t,e,i){return void 0===i&&(i=0),ji.toArray(t,e,i)},gm[Pn.FLOAT4]=function(t,e,i){return void 0===i&&(i=0),Li.toArray(t,e,i)},gm[Pn.MAT3]=function(t,e,i){return void 0===i&&(i=0),Qi.toArray(t,e,i)},gm[Pn.MAT4]=function(t,e,i){return void 0===i&&(i=0),un.toArray(t,e,i)},gm),Bm=[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 Nm(t){switch(t){case Pn.BOOL:case Pn.INT:case Pn.UINT:case Pn.FLOAT:return Bm[0];case Pn.BOOL2:case Pn.INT2:case Pn.UINT2:case Pn.FLOAT2:return Bm[1];case Pn.BOOL4:case Pn.INT4:case Pn.UINT4:case Pn.FLOAT4:return Bm[2];case Pn.MAT4:return Bm[3];case Pn.SAMPLER2D:return"default-texture";case Pn.SAMPLER_CUBE:return"default-cube-texture";case Pn.SAMPLER2D_ARRAY:return"default-array-texture";case Pn.SAMPLER3D:return"default-3d-texture"}return Bm[0]}function Mm(t){switch(t){case Pn.SAMPLER2D:return"-texture";case Pn.SAMPLER_CUBE:return"-cube-texture";case Pn.SAMPLER2D_ARRAY:return"-array-texture";case Pn.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function Lm(t,e){for(var i=Object.entries(e),n=!1,r=0;r31&&(i.uber=!0),i.constantMacros="",i.builtins.statistics)i.constantMacros+="#define "+a+" "+i.builtins.statistics[a]+"\n";if(this._templates[t.name]=i,!this._templateInfos[i.hash]){var o={};o.samplerStartBinding=i.blocks.length,o.shaderInfo=new $r,o.blockSizes=[],o.bindings=[];for(var u=0;u>2)*o.count}for(var u=0;u0&&this.shaders.length>0},e}(Wl),Qm._effects={},Qm._layoutValid=!0,jm=T((Xm=Zm).prototype,"techniques",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Ym=T(Xm.prototype,"shaders",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Km=T(Xm.prototype,"combinations",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),qm=T(Xm.prototype,"hideInEditor",[Eh,Sh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),Wm=Xm))||Wm);b.EffectAsset=tg;var eg,ig,ng,rg,sg,ag,og,ug,hg,lg,cg,_g,fg,dg,pg;!function(t){t[t.RGB565=On.R5G6B5]="RGB565",t[t.RGB5A1=On.RGB5A1]="RGB5A1",t[t.RGBA4444=On.RGBA4]="RGBA4444",t[t.RGB888=On.RGB8]="RGB888",t[t.RGB32F=On.RGB32F]="RGB32F",t[t.RGBA8888=On.RGBA8]="RGBA8888",t[t.RGBA32F=On.RGBA32F]="RGBA32F",t[t.A8=On.A8]="A8",t[t.I8=On.L8]="I8",t[t.AI8=On.LA8]="AI8",t[t.RGB_PVRTC_2BPPV1=On.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",t[t.RGBA_PVRTC_2BPPV1=On.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",t[t.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",t[t.RGB_PVRTC_4BPPV1=On.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",t[t.RGBA_PVRTC_4BPPV1=On.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",t[t.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",t[t.RGB_ETC1=On.ETC_RGB8]="RGB_ETC1",t[t.RGBA_ETC1=1026]="RGBA_ETC1",t[t.RGB_ETC2=On.ETC2_RGB8]="RGB_ETC2",t[t.RGBA_ETC2=On.ETC2_RGBA8]="RGBA_ETC2",t[t.RGBA_ASTC_4x4=On.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",t[t.RGBA_ASTC_5x4=On.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",t[t.RGBA_ASTC_5x5=On.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",t[t.RGBA_ASTC_6x5=On.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",t[t.RGBA_ASTC_6x6=On.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",t[t.RGBA_ASTC_8x5=On.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",t[t.RGBA_ASTC_8x6=On.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",t[t.RGBA_ASTC_8x8=On.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",t[t.RGBA_ASTC_10x5=On.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",t[t.RGBA_ASTC_10x6=On.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",t[t.RGBA_ASTC_10x8=On.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",t[t.RGBA_ASTC_10x10=On.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",t[t.RGBA_ASTC_12x10=On.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",t[t.RGBA_ASTC_12x12=On.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(eg||(eg={})),function(t){t[t.REPEAT=Vn.WRAP]="REPEAT",t[t.CLAMP_TO_EDGE=Vn.CLAMP]="CLAMP_TO_EDGE",t[t.MIRRORED_REPEAT=Vn.MIRROR]="MIRRORED_REPEAT",t[t.CLAMP_TO_BORDER=Vn.BORDER]="CLAMP_TO_BORDER"}(ig||(ig={})),function(t){t[t.NONE=Hn.NONE]="NONE",t[t.LINEAR=Hn.LINEAR]="LINEAR",t[t.NEAREST=Hn.POINT]="NEAREST"}(ng||(ng={})),pe(On);var mg,gg,vg,yg,Eg=new Tt("Tex"),Tg=_h("cc.TextureBase")((pg=dg=function(t){function e(){var e;return E(e=t.call(this)||this,"_format",ag,g(e)),E(e,"_minFilter",og,g(e)),E(e,"_magFilter",ug,g(e)),E(e,"_mipFilter",hg,g(e)),E(e,"_wrapS",lg,g(e)),E(e,"_wrapT",cg,g(e)),E(e,"_wrapR",_g,g(e)),E(e,"_anisotropy",fg,g(e)),e._width=1,e._height=1,e._id=void 0,e._samplerInfo=new Hr,e._gfxSampler=null,e._gfxDevice=null,e._textureHash=0,e._id=Eg.getNewId(),e._gfxDevice=e._getGFXDevice(),e._textureHash=Vs(e._id,666),e}c(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=b.director.root)||void 0===e?void 0:e.batcher2D)&&b.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):K(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 Ja.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(t){this._format=void 0===t?eg.RGBA8888:t},i._getGFXPixelFormat=function(t){return t===eg.RGBA_ETC1?t=eg.RGB_ETC1:t===eg.RGB_A_PVRTC_4BPPV1?t=eg.RGB_PVRTC_4BPPV1:t===eg.RGB_A_PVRTC_2BPPV1&&(t=eg.RGB_PVRTC_2BPPV1),t},h(e,[{key:"isCompressed",get:function(){return this._format>=eg.RGB_ETC1&&this._format<=eg.RGBA_ASTC_12x12||this._format>=eg.RGB_A_PVRTC_2BPPV1&&this._format<=eg.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),e}(Wl),dg.PixelFormat=eg,dg.WrapMode=ig,dg.Filter=ng,ag=T((sg=pg).prototype,"_format",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return eg.RGBA8888}}),og=T(sg.prototype,"_minFilter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ng.LINEAR}}),ug=T(sg.prototype,"_magFilter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ng.LINEAR}}),hg=T(sg.prototype,"_mipFilter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ng.NONE}}),lg=T(sg.prototype,"_wrapS",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ig.REPEAT}}),cg=T(sg.prototype,"_wrapT",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ig.REPEAT}}),_g=T(sg.prototype,"_wrapR",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return ig.REPEAT}}),fg=T(sg.prototype,"_anisotropy",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),rg=sg))||rg;function Sg(t){return!!(Qa.hasFeature(Qa.Feature.IMAGE_BITMAP)&&t instanceof ImageBitmap)}b.TextureBase=Tg;var Ag=t("ImageAsset",_h("cc.ImageAsset")((yg=vg=function(t){function e(e){var i;return(i=t.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=eg.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1},void 0!==e&&i.reset(e),i}c(e,t);var i=e.prototype;return i.reset=function(t){Sg(t)||t instanceof HTMLElement?this._nativeData=t:(this._nativeData=t,this._format=t.format)},i.destroy=function(){return this.data&&this.data instanceof HTMLImageElement?(this.data.src="",this._setRawAsset("")):Sg(this.data)&&this.data.close&&this.data.close(),t.prototype.destroy.call(this)},i._serialize=function(){},i._deserialize=function(t){var i="";"string"==typeof t?i=t:(this._width=t.w,this._height=t.h,i=t.fmt);for(var n,r=Ja.gfxDevice,s=i.split("_"),a=Number.MAX_VALUE,o=this._format,u="",h=Ee.SUPPORT_TEXTURE_FORMATS,l=y(s);!(n=l()).done;){var c=n.value.split("@"),_=parseInt(c[0],void 0),f=e.extnames[_]||c[0],d=h.indexOf(f);if(-1!==d&&d=eg.RGB_ETC1&&this._format<=eg.RGBA_ASTC_12x12||this._format>=eg.RGB_A_PVRTC_2BPPV1&&this._format<=eg.RGBA_ETC1}},{key:"url",get:function(){return this.nativeUrl}}]),e}(Wl),vg.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],vg._sharedPlaceHolderCanvas=null,T((gg=yg).prototype,"_nativeAsset",[qh],Object.getOwnPropertyDescriptor(gg.prototype,"_nativeAsset"),gg.prototype),mg=gg))||mg);b.ImageAsset=Ag;var Rg=new WeakMap,bg=new WeakSet,Cg=new WeakSet;function wg(t,e){var i;i=wc.safeFindClass;var n,r=Vc.pool.get();try{n=e_(t,r,{classFinder:i,customEnv:e})}catch(t){throw F(t),Vc.pool.put(r),t}n._uuid=e.__uuid__||"";for(var s=r.uuidList,a=r.uuidObjList,o=r.uuidPropList,u=r.uuidTypeList||[],h=[],l=0;l>e,r.texExtent.height=this._textureHeight>>e,r.texSubres.mipLevel=e,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(t)?n.copyBuffersToTexture([t],this._gfxTexture,xg):n.copyTexImagesToTexture([t],this._gfxTexture,xg)}}},i._assignImage=function(t,e,i){var n=t.data;if(n&&(this.uploadData(n,e,i),this._checkTextureLoaded(),Ee.CLEANUP_IMAGE_CACHE)){var r=Og.getDeps(this._uuid),s=r.indexOf(t._uuid);-1!==s&&(gt(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){Z(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=Un.NONE;this._mipFilter!==ng.NONE&&function(t,e,i){return!(t.gfxAPI===Cn.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()||(e=Un.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Fn.SAMPLED|Fn.TRANSFER_DST,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:e});if(i){var n=t.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(t){if(!this._gfxTexture)return null;var e=this._maxLevel=this._mipmaps.length))for(var i=Math.min(void 0===e?this._mipmaps.length:e,this._mipmaps.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;r0){var i=this._mipmaps[0];this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._mipmaps.forEach((function(t,i){e._assignImage(t,i)}))}else this.reset({width:0,height:0,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(t){this.mipmaps=t?[t]:[]}}]),e}(Ug),Lg=T((Mg=Fg).prototype,"_mipmaps",[Bg],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Ng=Mg))||Ng));b.Texture2D=qg,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"}(Yg||(Yg={})),function(t){t[t.NONE=0]="NONE",t[t.AUTO=1]="AUTO",t[t.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(Kg||(Kg={}));var Qg=t("TextureCube",_h("cc.TextureCube")((jg=Xg=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._mipmaps.length))for(var n=Math.min(void 0===e?this._mipmaps.length:e,this._mipmaps.length-t),r=function(e){var n=t+e;Zg(i._mipmaps[n],(function(t,e){i._assignImage(t,n,e)}))},s=0;s0){var i=this._mipmaps[0].front;this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._mipmaps.forEach((function(t,i){Zg(t,(function(t,n){e._assignImage(t,i,n)}))}))}else this.reset({width:0,height:0,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})}},{key:"mipmapAtlas",get:function(){return this._mipmapAtlas},set:function(t){var e=this;if(this._mipmapAtlas=t,this._mipmapAtlas){var i=this._mipmapAtlas.atlas.front;if(i.data){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],a=Object.assign(document.createElement("canvas"),{width:i.width,height:i.height}).getContext("2d");this.reset({width:s.width,height:s.height,format:i.format,mipmapLevel:r.length});for(var o=function(t){var s=r[t];Zg(n,(function(t,n){a.clearRect(0,0,i.width,i.height);var r=t.data;a.drawImage(r,0,0);var o=a.getImageData(s.left,s.top,s.width,s.height),u=new Ag({_data:o.data,_compressed:t.isCompressed,width:o.width,height:o.height,format:t.format});e._assignImage(u,s.level,n)}))},u=0;ue.length)||47===t.charCodeAt(e.length)}(r,t)||!t)for(var s=0,a=i.length;s0&&function(t){var e=Object.create(null);if(e[t._uuid]=t.refCount,iv(t,e,nv,-1),nv.length=0,0!==e[t._uuid])return e[t._uuid];for(var i in e)0!==e[i]&&iv(el.get(i),e,nv,1);return nv.length=0,e[t._uuid]}(t)>0)){el.remove(i);for(var n=Og.getDeps(i),r=0,s=n.length;rthis._maxInterval?this._maxInterval:e;t-this._lastDate>1e3*i&&(this._totalNumThisPeriod=0,this._lastDate=t)},e._handleQueue=function(t,e){for(this._checkNextPeriod=!1,this._updateTime();this._queue.length>0&&this._totalNum0&&(xe(this._handleQueue.bind(this),t,e),this._checkNextPeriod=!0)},h(t,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}]),t}()),kv=t("JsonAsset",_h("cc.JsonAsset")((bv=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0){var a=cl.create({input:s,progress:r,options:n,onProgress:t.onProgress,onError:cl.prototype.recycle,onComplete:function(n){var r;n||((r=t.output).push.apply(r,a.output),a.recycle()),i&&ty(t),e(n)}});al.async(a)}else i&&ty(t),e()}))}function ty(t){for(var e=t.output,i=0,n=e.length;i6||u<3||u>6||h<3||h>6)&&(o<4||7===o||9===o||11===o||o>12||u<4||7===u||9===u||11===u||u>12||1!==h))throw new Error("Invalid block number in ASTC header");var l=function(t,e){return 4===t?eg.RGBA_ASTC_4x4:5===t?4===e?eg.RGBA_ASTC_5x4:eg.RGBA_ASTC_5x5:6===t?5===e?eg.RGBA_ASTC_6x5:eg.RGBA_ASTC_6x6:8===t?5===e?eg.RGBA_ASTC_8x5:6===e?eg.RGBA_ASTC_8x6:eg.RGBA_ASTC_8x8:10===t?5===e?eg.RGBA_ASTC_10x5:6===e?eg.RGBA_ASTC_10x6:8===e?eg.RGBA_ASTC_10x8:eg.RGBA_ASTC_10x10:10===e?eg.RGBA_ASTC_12x10:eg.RGBA_ASTC_12x12}(o,u),c=a[7]+(a[8]<<8)+(a[9]<<16),_=a[10]+(a[11]<<8)+(a[12]<<16);a[13],a[14],a[15],r={_data:new Uint8Array(s,16),_compressed:!0,width:c,height:_,format:l}}catch(t){n=t}i(n,r)},e.parsePlist=function(t,e,i){var n=null,r=ey.parse(t);r||(n=new Error("parse failed")),i(n,r)},e.parseImport=function(t,e,i){if(t){var n=null,r=null;try{n=wg(t,e)}catch(t){r=t}i(r,n)}else i(new Error("The json file of asset "+e.__uuid__+" is empty or missing"))},e.init=function(){this._parsing.clear()},e.register=function(t,e){"object"==typeof t?le.mixin(this._parsers,t):this._parsers[t]=e},e.parse=function(t,e,i,n,r){var s=this,a=nl.get(t);if(a)r(null,a);else{var o=this._parsing.get(t);if(o)o.push(r);else{var u=this._parsers[i];u?(this._parsing.add(t,[r]),u(e,n,(function(e,i){e?il.remove(t):El(i)||nl.add(t,i);for(var n=s._parsing.remove(t),r=0,a=n.length;r=1024)&&_.lightingMap.objectID===a.objectID&&_.stride===r){if(_.count>=_.capacity){_.capacity<<=1;var f=_.stride*_.capacity,d=_.data;_.data=new Uint8Array(f),_.data.set(d),_.vb.resize(f)}return _.shader=o,_.descriptorSet=u,_.data.set(n.buffer,_.stride*_.count++),void(this.hasPendingModels=!0)}}for(var p=this._device.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,32*r,r)),m=new Uint8Array(32*r),g=s.vertexBuffers.slice(),v=s.attributes.slice(),y=s.indexBuffer,E=0;Em.size&&(m.resize(r),_.vbDatas[d]=new Uint8Array(r),_.vbDatas[d].set(g)),_.vbDatas[d].set(p.buffer,_.vbCount*p.stride)}var v=_.vbIdxData;(s=4*(a+_.vbCount))>_.vbIdx.size&&(_.vbIdx.resize(s),_.vbIdxData=new Float32Array(s/Float32Array.BYTES_PER_ELEMENT),_.vbIdxData.set(v),v=_.vbIdxData);var y=_.vbCount,E=y+a,T=_.mergeCount;if(v[y]!==T||v[E-1]!==T)for(var S=y;S>2,a=this._getBlockView(r,n),o=t.getOffsetFromHandle(e),u=0;u>2)*a,c=0;c+h.length<=l;c+=h.length)o.set(h,s+c);this._rootBufferDirty=!0}},e.resetTexture=function(e,i){var n=this.getHandle(e);if(n){var r=t.getTypeFromHandle(n),s=t.getBindingFromHandle(n),a=this._properties[e],o=a&&a.value,u=o?""+o+Mm(r):Nm(r),h=vy.get(u),l=h&&h.getGFXTexture(),c=a&&void 0!==a.samplerHash?ia.unpackFromHash(a.samplerHash):h&&h.getSamplerInfo(),_=this._device.getSampler(c);this._descriptorSet.bindSampler(s,_,i||0),this._descriptorSet.bindTexture(s,l,i||0)}},e.resetUBOs=function(){for(var t=0;t>2)*r.count,h=0;h+o.length<=u;h+=o.length)s.set(o,i+h);i+=u}this._rootBufferDirty=!0},e.resetTextures=function(){for(var t=0;t=this._passes.length)return void console.warn("illegal pass index: "+i+".");var u=this._passes[i];this._uploadProperty(u,t,e)&&(this._props[u.propertyIndex][t]=e,n=!0)}n||console.warn("illegal property name: "+t+".")},i.getProperty=function(t,e){if(void 0===e)for(var i=this._props,n=i.length,r=0;r=this._props.length)return console.warn("illegal pass index: "+e+"."),null;var a=this._props[this._passes[e].propertyIndex];if(t in a)return a[t]}return null},i.copy=function(t,e){this._techIdx=t._techIdx,this._props.length=t._props.length;for(var i=0;i0},h(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}(Wl),Ny=T((By=Gy).prototype,"_effectAsset",[Py],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),My=T(By.prototype,"_techIdx",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Ly=T(By.prototype,"_defines",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Fy=T(By.prototype,"_states",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Uy=T(By.prototype,"_props",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Dy=By))||Dy));function Wy(t,e){for(var i,n=y(e);!(i=n()).done;){var r=i.value;Array.isArray(r)?Wy(t,r):t.push(r)}}function Xy(t){var e=[];return Wy(e,t),e.join("")}b.Material=Vy,ft({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 jy=Ta.Flags.Destroyed,Yy=Ta.Flags.PersistentMask,Ky=hi.IDENTIFIER_RE,qy="var ",Qy="o",Zy={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},Jy=hi.escapeForJS,$y=function(){function t(t,e){this.varName=void 0,this.expression=void 0,this.varName=t,this.expression=e}return t.prototype.toString=function(){return qy+this.varName+"="+this.expression+";"},t}();function tE(t,e){return e instanceof $y?new $y(e.varName,t+e.expression):t+e}function eE(t,e,i){Array.isArray(i)?(i[0]=tE(e,i[0]),t.push(i)):t.push(tE(e,i)+";")}var iE=function(){function t(t){this._exps=void 0,this._targetExp=void 0,this._exps=[],this._targetExp=t}var e=t.prototype;return e.append=function(t,e){this._exps.push([t,e])},e.writeCode=function(t){var e;if(this._exps.length>1)t.push("t="+this._targetExp+";"),e="t";else{if(1!==this._exps.length)return;e=this._targetExp}for(var i=0;i0&&(i=qy+this.globalVariables.join(",")+";");var n=Xy(["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;r0&&(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)}};var e=i.prototype;function i(e){var i;return E(i=t.call(this,e)||this,"_parent",hE,g(i)),E(i,"_children",lE,g(i)),E(i,"_active",cE,g(i)),E(i,"_components",_E,g(i)),E(i,"_prefab",fE,g(i)),i._scene=null,i._activeInHierarchy=!1,i._id=EE.getNewId(),i._name=void 0,i._eventProcessor=new b.NodeEventProcessor(g(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._name=void 0!==e?e:"New Node",i}return e._updateScene=function(){null==this._parent?F("Node %s(%s) has not attached to a scene.",this.name,this.uuid):this._scene=this._parent._scene},e.attr=function(t){Wt(this,t)},e.getParent=function(){return this._parent},e.setParent=function(t,e){if(void 0===e&&(e=!1),this._parent!==t){var i=this._parent,n=t;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,e),this.emit&&this.emit(aE.PARENT_CHANGED,i),i&&!(i._objFlags&gE)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(aE.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(aE.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},e.getChildByUuid=function(t){if(!t)return M("Invalid uuid"),null;for(var e=this._children,i=0,n=e.length;i0?(u=s,r=s._children,a=0,o[n]=r[a],n++):(o[n]=s,n++,h=!0);o.length=0,i._stackId--},e.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},e.removeChild=function(t){this._children.indexOf(t)>-1&&(t.parent=null)},e.removeAllChildren=function(){for(var t=this._children,e=t.length-1;e>=0;e--){var i=t[e];i&&(i.parent=null)}this._children.length=0},e.isChildOf=function(t){var e=this;do{if(e===t)return!0;e=e._parent}while(e);return!1},e.getComponent=function(t){var e=TE(t);return e?i._findComponent(this,e):null},e.getComponents=function(t){var e=TE(t),n=[];return e&&i._findComponents(this,e,n),n},e.getComponentInChildren=function(t){var e=TE(t);return e?i._findChildComponent(this._children,e):null},e.getComponentsInChildren=function(t){var e=TE(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=se(t)))throw b._RF.peek()&&K(3808,t),TypeError(J(3807,t))}else{if(!t)throw TypeError(J(3804));e=t}if("function"!=typeof e)throw TypeError(J(3809));if(!Yt(e,b.Component))throw TypeError(J(3810));var i=e._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n0},set:function(t){t?this._objFlags|=vE:this._objFlags&=~vE}},{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&&b.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}}]),i}(Ta),dE.idGenerator=EE,dE._stacks=[[]],dE._stackId=0,T((uE=pE).prototype,"_persistNode",[mh],Object.getOwnPropertyDescriptor(uE.prototype,"_persistNode"),uE.prototype),T(uE.prototype,"name",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"name"),uE.prototype),T(uE.prototype,"children",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"children"),uE.prototype),T(uE.prototype,"active",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"active"),uE.prototype),T(uE.prototype,"activeInHierarchy",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"activeInHierarchy"),uE.prototype),T(uE.prototype,"parent",[Ph],Object.getOwnPropertyDescriptor(uE.prototype,"parent"),uE.prototype),hE=T(uE.prototype,"_parent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),lE=T(uE.prototype,"_children",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),cE=T(uE.prototype,"_active",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),_E=T(uE.prototype,"_components",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),fE=T(uE.prototype,"_prefab",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),oE=uE))||oE);b._BaseNode=ME,function(t){t[t.LOCAL=0]="LOCAL",t[t.WORLD=1]="WORLD"}(SE||(SE=t("NodeSpace",{}))),function(t){t[t.NONE=0]="NONE",t[t.POSITION=1]="POSITION",t[t.ROTATION=2]="ROTATION",t[t.SCALE=4]="SCALE",t[t.RS=t.ROTATION|t.SCALE]="RS",t[t.TRS=t.POSITION|t.ROTATION|t.SCALE]="TRS",t[t.TRS_MASK=~t.TRS]="TRS_MASK"}(AE||(AE=t("TransformBit",{}))),b.internal.TransformBit=AE;var LE=new ji,FE=new $i,UE=new $i,GE=new $i,kE=new Qi,zE=new Qi,HE=new un,VE=[],WE=Symbol("ReserveContentsForAllSyncablePrefab"),XE=0,jE=t("Node",(RE=_h("cc.Node"),bE=Kh(ji),RE((NE=BE=function(t){function e(e){var i;return(i=t.call(this,e)||this)._uiProps=new mE(g(i)),i._static=!1,E(i,"_lpos",IE,g(i)),E(i,"_lrot",OE,g(i)),E(i,"_lscale",xE,g(i)),E(i,"_layer",PE,g(i)),E(i,"_euler",DE,g(i)),i._dirtyFlags=AE.NONE,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._pos=new ji,i._rot=new $i,i._scale=new ji(1,1,1),i._mat=new un,i}c(e,t),e.isNode=function(t){return t instanceof e&&(t.constructor===e||!(t instanceof b.Scene))};var i=e.prototype;return i._onPreDestroy=function(){return this._onPreDestroyBase()},i[Oc]=function(t){t.writeThis()},i.setParent=function(e,i){void 0===i&&(i=!1),i&&this.updateWorldTransform(),t.prototype.setParent.call(this,e,i)},i._onSetParent=function(e,i){if(t.prototype._onSetParent.call(this,e,i),i){var n=this._parent;n?(n.updateWorldTransform(),gi(un.determinant(n._mat),0,pi)?(j(14300),this._dirtyFlags|=AE.TRS,this.updateWorldTransform()):(un.multiply(HE,un.invert(HE,n._mat),this._mat),un.toRTS(HE,this._lrot,this._lpos,this._lscale))):(ji.copy(this._lpos,this._pos),$i.copy(this._lrot,this._rot),ji.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(AE.TRS)},i._onHierarchyChanged=function(e){this.eventProcessor.reattach(),t.prototype._onHierarchyChangedBase.call(this,e)},i._onBatchCreated=function(t){this.hasChangedFlags=AE.TRS,this._dirtyFlags|=AE.TRS;for(var e=this._children.length,i=0;i=0;){if(a=(e=VE[n--]).hasChangedFlags,e.isValid&&(e._dirtyFlags&a&t)!==t)for(e._dirtyFlags|=t,e.hasChangedFlags=a|t,s=(i=e._children).length,r=0;r=0;)ji.transformInverseRTS(t,t,i._lrot,i._lpos,i._lscale),i=VE[--n];return t},i.setWorldPosition=function(t,e,i){void 0===e||void 0===i?ji.copy(this._pos,t):ji.set(this._pos,t,e,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),ji.transformMat4(r,this._pos,un.invert(HE,n._mat))):ji.copy(r,this._pos),this.invalidateChildren(AE.POSITION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.POSITION)},i.getWorldPosition=function(t){return this.updateWorldTransform(),t?ji.copy(t,this._pos):ji.copy(new ji,this._pos)},i.setWorldRotation=function(t,e,i,n){void 0===e||void 0===i||void 0===n?$i.copy(this._rot,t):$i.set(this._rot,t,e,i,n),this._parent?(this._parent.updateWorldTransform(),$i.multiply(this._lrot,$i.conjugate(this._lrot,this._parent._rot),this._rot)):$i.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(AE.ROTATION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.ROTATION)},i.setWorldRotationFromEuler=function(t,e,i){$i.fromEuler(this._rot,t,e,i),this._parent?(this._parent.updateWorldTransform(),$i.multiply(this._lrot,$i.conjugate(this._lrot,this._parent._rot),this._rot)):$i.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(AE.ROTATION),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.ROTATION)},i.getWorldRotation=function(t){return this.updateWorldTransform(),t?$i.copy(t,this._rot):$i.copy(new $i,this._rot)},i.setWorldScale=function(t,e,i){void 0===e||void 0===i?ji.copy(this._scale,t):ji.set(this._scale,t,e,i);var n=this._parent;n?(n.updateWorldTransform(),Qi.fromQuat(kE,$i.conjugate(GE,n._rot)),Qi.multiplyMat4(kE,kE,n._mat),zE.m00=this._scale.x,zE.m04=this._scale.y,zE.m08=this._scale.z,Qi.multiply(kE,zE,Qi.invert(kE,kE)),this._lscale.x=ji.set(LE,kE.m00,kE.m01,kE.m02).length(),this._lscale.y=ji.set(LE,kE.m03,kE.m04,kE.m05).length(),this._lscale.z=ji.set(LE,kE.m06,kE.m07,kE.m08).length()):ji.copy(this._lscale,this._scale),this.invalidateChildren(AE.SCALE),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,AE.SCALE)},i.getWorldScale=function(t){return this.updateWorldTransform(),t?ji.copy(t,this._scale):ji.copy(new ji,this._scale)},i.getWorldMatrix=function(t){this.updateWorldTransform();var e=t||new un;return un.copy(e,this._mat)},i.getWorldRS=function(t){this.updateWorldTransform();var e=t||new un;return un.copy(e,this._mat),e.m12=0,e.m13=0,e.m14=0,e},i.getWorldRT=function(t){this.updateWorldTransform();var e=t||new un;return un.fromRT(e,this._rot,this._pos)},i.setRTS=function(t,e,i){var n=0;t&&(n|=AE.ROTATION,void 0!==t.w?($i.copy(this._lrot,t),this._eulerDirty=!0):(ji.copy(this._euler,t),$i.fromEuler(this._lrot,t.x,t.y,t.z),this._eulerDirty=!1)),e&&(ji.copy(this._lpos,e),n|=AE.POSITION),i&&(ji.copy(this._lscale,i),n|=AE.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(aE.TRANSFORM_CHANGED,n))},i.pauseSystemEvents=function(t){this._eventProcessor.setEnabled(!1,t)},i.resumeSystemEvents=function(t){this._eventProcessor.setEnabled(!0,t)},e.resetHasChangedFlags=function(){XE+=1},e.clearNodeArray=function(){e.ClearFramee.priority?-1:0};var e=t.prototype;return e.init=function(){},e.update=function(){},e.postUpdate=function(){},e.destroy=function(){},h(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}());KE.Priority=_e({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var qE=new es;qE.format=On.RGBA8;var QE=new is;QE.format=On.DEPTH_STENCIL;var ZE,JE,$E,tT,eT,iT,nT,rT=new ss([qE],QE),sT={width:1,height:1,renderPassInfo:rT},aT=t("RenderTexture",_h("cc.RenderTexture")(YE=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=1&&this.width<=2048&&this.height>=1&&this.height<=2048},i.readPixels=function(t,e,i,n,r){void 0===t&&(t=0),void 0===e&&(e=0),i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return K(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length=this._materials.length?null:this._materials[t]},i.setMaterial=function(t,e){t&&t instanceof iA&&console.error("Can't set a material instance to a sharedMaterial slot"),this._materials[e]=t;var i=this._materialInstances[e];i&&(i.destroy(),this._materialInstances[e]=null),this._onMaterialModified(e,this._materials[e])},i.getMaterialInstance=function(t){if(!this._materials[t])return null;if(!this._materialInstances[t]){nA.parent=this._materials[t],nA.owner=this,nA.subModelIdx=t;var e=new iA(nA);nA.parent=null,nA.owner=null,nA.subModelIdx=0,this.setMaterialInstance(e,t)}return this._materialInstances[t]},i.setMaterialInstance=function(t,e){if("number"==typeof t){j(12007);var i=t;t=e,e=i}var n=this._materialInstances[e];t&&t.parent?t!==n&&(this._materialInstances[e]=t,this._onMaterialModified(e,t)):(t!==this._materials[e]||n)&&this.setMaterial(t,e)},i.getRenderMaterial=function(t){return this._materialInstances[t]||this._materials[t]},i._onMaterialModified=function(){},i._onRebuildPSO=function(){},i._clearMaterials=function(){},h(e,[{key:"sharedMaterial",get:function(){return this.getMaterial(0)}},{key:"sharedMaterials",get:function(){return this._materials},set:function(t){for(var e=0;e0)for(var t=0;t0)for(var r=0;r=0;--n)if((e=TA[n]).eventProcessor.capturingTarget&&(t.currentTarget=e,e.eventProcessor.capturingTarget.emit(t.type,t,TA),t.propagationStopped))return void(TA.length=0);if(TA.length=0,t.eventPhase=2,t.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(t.type,t),!t.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(t.type,t),!t.propagationStopped&&t.bubbles)for(this.getBubblingTargets(t.type,TA),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!==RA.indexOf(t)},e._isMouseEvent=function(t){return-1!==bA.indexOf(t)},e._hasTouchListeners=function(){for(var t=0;t0?e[0].getShaderVariant(t):null},e.getPlanarInstanceShader=function(t){this._instancingMaterial||(this._instancingMaterial=new Vy,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var e=this._instancingMaterial.passes;return e.length>0?e[0].getShaderVariant(t):null},e.initialize=function(t){this._enabled=t.enabled,this._type=this.enabled?t.type:BA,this.normal=t.planeDirection,this.distance=t.planeHeight,this.shadowColor=t.shadowColor,this.maxReceived=t.maxReceived,t.shadowMapSize!==this._size.x&&(this.size.set(t.shadowMapSize,t.shadowMapSize),this._shadowMapDirty=!0)},e.activate=function(){if(this._enabled)if(this.type===OA.Planar)this._updatePlanarInfo();else{var t=b.director.root;t.pipeline.macros.CC_SHADOW_TYPE=2,t.onGlobalPipelineStateChanged()}else{var e=b.director.root;e.pipeline.macros.CC_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()}},e._updatePlanarInfo=function(){this._material||(this._material=new Vy,this._material.initialize({effectName:"pipeline/planar-shadow"})),this._instancingMaterial||(this._instancingMaterial=new Vy,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var t=b.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()},h(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:BA,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(t){ji.copy(this._normal,t)}},{key:"distance",get:function(){return this._distance},set:function(t){this._distance=t}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(t){this._shadowColor=t}},{key:"size",get:function(){return this._size},set:function(t){this._size.set(t)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(t){this._shadowMapDirty=t}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),t}();NA.MAX_FAR=2e3,NA.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),b.Shadows=NA;var MA=null,LA=null,FA=_e({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2}),UA=function(){function t(){this._envmapLDR=null,this._envmapHDR=null,this._diffuseMapLDR=null,this._diffuseMapHDR=null,this._globalDSManager=null,this._model=null,this._default=null,this._enabled=!1,this._useIBL=!1,this._useHDR=!0,this._useDiffuseMap=!1,this._editableMaterial=null,this._activated=!1,this._reflectionHDR=null,this._reflectionLDR=null,this._rotationAngle=0}var e=t.prototype;return e.initialize=function(t){this._activated=!1,this._enabled=t.enabled,this._useIBL=t.useIBL,this._useDiffuseMap=t.applyDiffuseMap,this._useHDR=t.useHDR},e.setEnvMaps=function(t,e){this._envmapHDR=t,this._envmapLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setDiffuseMaps=function(t,e){this._diffuseMapHDR=t,this._diffuseMapLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setSkyboxMaterial=function(t){t?(this._editableMaterial=new iA({parent:t}),this._editableMaterial.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})):this._editableMaterial=null,this._updatePipeline()},e.setReflectionMaps=function(t,e){this._reflectionHDR=t,this._reflectionLDR=e,this._updateGlobalBinding(),this._updatePipeline()},e.setRotationAngle=function(t){this._rotationAngle=t},e.getRotationAngle=function(){return this._rotationAngle},e.updateMaterialRenderInfo=function(){this._updateGlobalBinding(),this._updatePipeline()},e.activate=function(){var t=b.director.root.pipeline;this._globalDSManager=t.globalDSManager,this._default=vy.get("default-cube-texture"),this._model||(this._model=b.director.root.createModel(b.renderer.scene.Model));var e=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(e=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!LA){var i=new Vy;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:e}}),LA=new iA({parent:i})}this.enabled&&(MA||(MA=b.utils.createMesh(b.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,MA.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,MA.renderingSubMeshes[0],LA)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},e._updatePipeline=function(){var t=b.director.root,e=t.pipeline,i=this.useIBL?this.isRGBE?2:1:0,n=this.useIBL&&this.useDiffuseMap&&this.diffuseMap?this.isRGBE?2:1:0,r=this.useHDR,s=this.useConvolutionMap;if(e.macros.CC_USE_IBL===i&&e.macros.CC_USE_DIFFUSEMAP===n&&e.macros.CC_USE_HDR===r&&e.macros.CC_IBL_CONVOLUTED===s||(e.macros.CC_USE_IBL=i,e.macros.CC_USE_DIFFUSEMAP=n,e.macros.CC_USE_HDR=r,e.macros.CC_IBL_CONVOLUTED=s,this._activated&&t.onGlobalPipelineStateChanged()),this.enabled){var a=this.envmap?this.envmap:this._default,o=this._editableMaterial?this._editableMaterial:LA;o&&(o.setProperty("environmentMap",a),o.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})),this._model&&(this._model.setSubModelMaterial(0,o),this._updateSubModes())}},e._updateGlobalBinding=function(){if(this._globalDSManager){var t=Ja.gfxDevice;if(this.reflectionMap){var e=this.reflectionMap.getGFXTexture(),i=t.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(Sp,i),this._globalDSManager.bindTexture(Sp,e)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=t.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(Sp,s),this._globalDSManager.bindTexture(Sp,r)}}var a=this.diffuseMap?this.diffuseMap:this._default;if(a){var o=a.getGFXTexture(),u=t.getSampler(a.getSamplerInfo());this._globalDSManager.bindSampler(bp,u),this._globalDSManager.bindTexture(bp,o)}this._globalDSManager.update()}},e._updateSubModes=function(){if(this._model)for(var t=this._model.subModels,e=0;eMath.abs(e)?t:-e},e}(iw),ow=function(t){function e(e){var i;return(i=t.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.xAxis=void 0,i.yAxis=void 0,i.up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.xAxis=new aw({positive:i.right,negative:i.left}),i.yAxis=new aw({positive:i.up,negative:i.down}),i}return c(e,t),e.prototype.getValue=function(){return new _n(this.xAxis.getValue(),this.yAxis.getValue())},e}(nw),uw=(function(t){function e(e){var i;return(i=t.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.forward=void 0,i.backward=void 0,i.xAxis=void 0,i.yAxis=void 0,i.zAxis=void 0,i.up=e.up,i.down=e.down,i.left=e.left,i.right=e.right,i.forward=e.forward,i.backward=e.backward,i.xAxis=new aw({positive:i.right,negative:i.left}),i.yAxis=new aw({positive:i.up,negative:i.down}),i.zAxis=new aw({positive:i.forward,negative:i.backward}),i}c(e,t),e.prototype.getValue=function(){return new ji(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(rw),function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(iw)),hw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(ow),lw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(ow),cw=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(sw),_w=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.getValue=function(){return t.prototype.getValue.call(this)},e}(rw),fw=function(){function t(t){this._deviceId=-1,this._connected=!1,this._deviceId=t,this._initInputSource()}t._init=function(){Ha.hasFeature(Ga.EVENT_GAMEPAD)&&t._registerEvent()},t._on=function(e,i,n){t._eventTarget.on(e,i,n)},t._removeInputDevice=function(e){var i=t.all.findIndex((function(t){return t.deviceId===e}));-1!==i&>(t.all,i)},t._getOrCreateInputDevice=function(e,i){var n=t.all.find((function(t){return t.deviceId===e}));return n||(n=new t(e),t.all.push(n)),n._connected=i,n},t._ensureDirectorDefined=function(){return new Promise((function(e){t._intervalId=setInterval((function(){b.director&&b.Director&&(clearInterval(t._intervalId),t._intervalId=-1,e())}),50)}))},t._registerEvent=function(){t._ensureDirectorDefined().then((function(){b.director.on(b.Director.EVENT_BEGIN_FRAME,t._scanGamepads)})).catch((function(){})),window.addEventListener("gamepadconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=e.gamepad;var i=t._getOrCreateInputDevice(e.gamepad.index,!0);t._eventTarget.emit(oA.GAMEPAD_CHANGE,new pA(oA.GAMEPAD_CHANGE,i))})),window.addEventListener("gamepaddisconnected",(function(e){t._cachedWebGamepads[e.gamepad.index]=null;var i=t._getOrCreateInputDevice(e.gamepad.index,!1);t._removeInputDevice(e.gamepad.index),t._eventTarget.emit(oA.GAMEPAD_CHANGE,new pA(oA.GAMEPAD_CHANGE,i))}))},t._scanGamepads=function(){var e=t._getWebGamePads();if(e){for(var i=[],n=0;n.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}for(var c=s.axes,_=0;_.01){a=t._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}}}}t._cachedWebGamepads=e;for(var p=0;p0?{negative:0,positive:e}:t<0?{negative:e,positive:0}:{negative:0,positive:0}},e._initInputSource=function(){var e=this;this._buttonNorth=new uw,this._buttonNorth.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[3].value:0},this._buttonEast=new uw,this._buttonEast.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[1].value:0},this._buttonWest=new uw,this._buttonWest.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[2].value:0},this._buttonSouth=new uw,this._buttonSouth.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[0].value:0},this._buttonL1=new uw,this._buttonL1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new uw,this._buttonL2.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[6].value:0},this._buttonL3=new uw,this._buttonL3.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[10].value:0},this._buttonR1=new uw,this._buttonR1.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new uw,this._buttonR2.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[7].value:0},this._buttonR3=new uw,this._buttonR3.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[11].value:0},this._buttonShare=new uw,this._buttonShare.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new uw,this._buttonOptions.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[9].value:0};var i=new uw;i.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[12].value:0};var n=new uw;n.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[13].value:0};var r=new uw;r.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[14].value:0};var s=new uw;s.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?i.buttons[15].value:0},this._dpad=new hw({up:i,down:n,left:r,right:s});var a=new uw;a.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[1]).negative:0};var o=new uw;o.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[1]).positive:0};var u=new uw;u.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[0]).negative:0};var h=new uw;h.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[0]).positive:0},this._leftStick=new lw({up:a,down:o,left:u,right:h});var l=new uw;l.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[3]).negative:0};var c=new uw;c.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[3]).positive:0};var _=new uw;_.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[2]).negative:0};var f=new uw;f.getValue=function(){var i=t._getWebGamepad(e.deviceId);return i?e._axisToButtons(i.axes[2]).positive:0},this._rightStick=new lw({up:l,down:c,left:_,right:f}),this._buttonStart=new uw,this._buttonStart.getValue=function(){return 0}},h(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:"deviceId",get:function(){return this._deviceId}},{key:"connected",get:function(){return this._connected}}]),t}();fw.all=[],fw._eventTarget=new Ba,fw._cachedWebGamepads=[],fw._intervalId=-1;var dw,pw,mw=function(){function t(){this._eventTarget=new Ba,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 uw,this._buttonNorth.getValue=function(){return 0},this._buttonEast=new uw,this._buttonEast.getValue=function(){return 0},this._buttonWest=new uw,this._buttonWest.getValue=function(){return 0},this._buttonSouth=new uw,this._buttonSouth.getValue=function(){return 0},this._buttonTriggerLeft=new uw,this._buttonTriggerLeft.getValue=function(){return 0},this._buttonTriggerRight=new uw,this._buttonTriggerRight.getValue=function(){return 0},this._triggerLeft=new uw,this._triggerLeft.getValue=function(){return 0},this._triggerRight=new uw,this._triggerRight.getValue=function(){return 0},this._gripLeft=new uw,this._gripLeft.getValue=function(){return 0},this._gripRight=new uw,this._gripRight.getValue=function(){return 0},this._buttonLeftStick=new uw,this._buttonLeftStick.getValue=function(){return 0};var t=new uw;t.getValue=function(){return 0};var e=new uw;e.getValue=function(){return 0};var i=new uw;i.getValue=function(){return 0};var n=new uw;n.getValue=function(){return 0},this._leftStick=new lw({up:t,down:e,left:i,right:n}),this._buttonRightStick=new uw,this._buttonRightStick.getValue=function(){return 0};var r=new uw;r.getValue=function(){return 0};var s=new uw;s.getValue=function(){return 0};var a=new uw;a.getValue=function(){return 0};var o=new uw;o.getValue=function(){return 0},this._rightStick=new lw({up:r,down:s,left:a,right:o}),this._handLeftPosition=new _w,this._handLeftPosition.getValue=function(){return ji.ZERO},this._handLeftOrientation=new cw,this._handLeftOrientation.getValue=function(){return $i.IDENTITY},this._handRightPosition=new _w,this._handRightPosition.getValue=function(){return ji.ZERO},this._handRightOrientation=new cw,this._handRightOrientation.getValue=function(){return $i.IDENTITY},this._aimLeftPosition=new _w,this._aimLeftPosition.getValue=function(){return ji.ZERO},this._aimLeftOrientation=new cw,this._aimLeftOrientation.getValue=function(){return $i.IDENTITY},this._aimRightPosition=new _w,this._aimRightPosition.getValue=function(){return ji.ZERO},this._aimRightOrientation=new cw,this._aimRightOrientation.getValue=function(){return $i.IDENTITY}},h(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:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}}]),t}(),gw=function(){function t(){this._eventTarget=new Ba,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 _w,this._viewLeftPosition.getValue=function(){return ji.ZERO},this._viewLeftOrientation=new cw,this._viewLeftOrientation.getValue=function(){return $i.IDENTITY},this._viewRightPosition=new _w,this._viewRightPosition.getValue=function(){return ji.ZERO},this._viewRightOrientation=new cw,this._viewRightOrientation.getValue=function(){return $i.IDENTITY},this._headMiddlePosition=new _w,this._headMiddlePosition.getValue=function(){return ji.ZERO},this._headMiddleOrientation=new cw,this._headMiddleOrientation.getValue=function(){return $i.IDENTITY}},h(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}(),vw={Backspace:dA.BACKSPACE,Tab:dA.TAB,Enter:dA.ENTER,ShiftLeft:dA.SHIFT_LEFT,ControlLeft:dA.CTRL_LEFT,AltLeft:dA.ALT_LEFT,ShiftRight:dA.SHIFT_RIGHT,ControlRight:dA.CTRL_RIGHT,AltRight:dA.ALT_RIGHT,Pause:dA.PAUSE,CapsLock:dA.CAPS_LOCK,Escape:dA.ESCAPE,Space:dA.SPACE,PageUp:dA.PAGE_UP,PageDown:dA.PAGE_DOWN,End:dA.END,Home:dA.HOME,ArrowLeft:dA.ARROW_LEFT,ArrowUp:dA.ARROW_UP,ArrowRight:dA.ARROW_RIGHT,ArrowDown:dA.ARROW_DOWN,Insert:dA.INSERT,Delete:dA.DELETE,Digit0:dA.DIGIT_0,Digit1:dA.DIGIT_1,Digit2:dA.DIGIT_2,Digit3:dA.DIGIT_3,Digit4:dA.DIGIT_4,Digit5:dA.DIGIT_5,Digit6:dA.DIGIT_6,Digit7:dA.DIGIT_7,Digit8:dA.DIGIT_8,Digit9:dA.DIGIT_9,KeyA:dA.KEY_A,KeyB:dA.KEY_B,KeyC:dA.KEY_C,KeyD:dA.KEY_D,KeyE:dA.KEY_E,KeyF:dA.KEY_F,KeyG:dA.KEY_G,KeyH:dA.KEY_H,KeyI:dA.KEY_I,KeyJ:dA.KEY_J,KeyK:dA.KEY_K,KeyL:dA.KEY_L,KeyM:dA.KEY_M,KeyN:dA.KEY_N,KeyO:dA.KEY_O,KeyP:dA.KEY_P,KeyQ:dA.KEY_Q,KeyR:dA.KEY_R,KeyS:dA.KEY_S,KeyT:dA.KEY_T,KeyU:dA.KEY_U,KeyV:dA.KEY_V,KeyW:dA.KEY_W,KeyX:dA.KEY_X,KeyY:dA.KEY_Y,KeyZ:dA.KEY_Z,Numpad0:dA.NUM_0,Numpad1:dA.NUM_1,Numpad2:dA.NUM_2,Numpad3:dA.NUM_3,Numpad4:dA.NUM_4,Numpad5:dA.NUM_5,Numpad6:dA.NUM_6,Numpad7:dA.NUM_7,Numpad8:dA.NUM_8,Numpad9:dA.NUM_9,NumpadMultiply:dA.NUM_MULTIPLY,NumpadAdd:dA.NUM_PLUS,NumpadSubtract:dA.NUM_SUBTRACT,NumpadDecimal:dA.NUM_DECIMAL,NumpadDivide:dA.NUM_DIVIDE,NumpadEnter:dA.NUM_ENTER,F1:dA.F1,F2:dA.F2,F3:dA.F3,F4:dA.F4,F5:dA.F5,F6:dA.F6,F7:dA.F7,F8:dA.F8,F9:dA.F9,F10:dA.F10,F11:dA.F11,F12:dA.F12,NumLock:dA.NUM_LOCK,ScrollLock:dA.SCROLL_LOCK,Semicolon:dA.SEMICOLON,Equal:dA.EQUAL,Comma:dA.COMMA,Minus:dA.DASH,Period:dA.PERIOD,Slash:dA.SLASH,Backquote:dA.BACK_QUOTE,BracketLeft:dA.BRACKET_LEFT,Backslash:dA.BACKSLASH,BracketRight:dA.BRACKET_RIGHT,Quote:dA.QUOTE},yw=function(){function t(){this._eventTarget=new Ba,this._registerEvent()}var e=t.prototype;return e.dispatchKeyboardDownEvent=function(t){this._handleKeyboardDown(t)},e.dispatchKeyboardUpEvent=function(t){this._handleKeyboardUp(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._registerEvent=function(){var t=document.getElementById("GameCanvas");null==t||t.addEventListener("keydown",this._handleKeyboardDown.bind(this)),null==t||t.addEventListener("keyup",this._handleKeyboardUp.bind(this))},e._getInputEvent=function(t,e){var i,n=(i=t.code,vw[i]||dA.NONE);return new lA(n,e)},e._handleKeyboardDown=function(t){if(t.stopPropagation(),t.preventDefault(),t.repeat){var e=this._getInputEvent(t,oA.KEY_PRESSING);this._eventTarget.emit(oA.KEY_PRESSING,e)}else{var i=this._getInputEvent(t,oA.KEY_DOWN);this._eventTarget.emit(oA.KEY_DOWN,i)}},e._handleKeyboardUp=function(t){var e=this._getInputEvent(t,oA.KEY_UP);t.stopPropagation(),t.preventDefault(),this._eventTarget.emit(oA.KEY_UP,e)},t}(),Ew=function(){function t(){this._canvas=void 0,this._eventTarget=new Ba,this._pointLocked=!1,this._isPressed=!1,this._preMousePos=new _n,this._handleMouseDown=void 0,this._handleMouseMove=void 0,this._handleMouseUp=void 0,Ha.hasFeature(Ga.EVENT_MOUSE)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||console.warn("failed to access canvas"),this._handleMouseDown=this._createCallback(oA.MOUSE_DOWN),this._handleMouseMove=this._createCallback(oA.MOUSE_MOVE),this._handleMouseUp=this._createCallback(oA.MOUSE_UP),this._registerEvent())}var e=t.prototype;return e.dispatchMouseDownEvent=function(t){this._handleMouseDown(t)},e.dispatchMouseMoveEvent=function(t){this._handleMouseMove(t)},e.dispatchMouseUpEvent=function(t){this._handleMouseUp(t)},e.dispatchScrollEvent=function(t){this._handleMouseWheel(t)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new yn(e.x,e.y,e.width,e.height):new yn(0,0,0,0)},e._getLocation=function(t){var e=this._getCanvasRect(),i=Xa.devicePixelRatio,n=this._pointLocked?this._preMousePos.x/i+t.movementX:t.clientX-e.x,r=this._pointLocked?this._preMousePos.y/i-t.movementY:e.y+e.height-t.clientY;return new _n(n*=i,r*=i)},e._registerEvent=function(){var t,e,i,n,r=this;window.addEventListener("mousedown",(function(){r._isPressed=!0})),null===(t=this._canvas)||void 0===t||t.addEventListener("mousedown",this._handleMouseDown),null===(e=this._canvas)||void 0===e||e.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp),null===(i=this._canvas)||void 0===i||i.addEventListener("mouseup",this._handleMouseUp),null===(n=this._canvas)||void 0===n||n.addEventListener("wheel",this._handleMouseWheel.bind(this)),this._registerPointerLockEvent()},e._registerPointerLockEvent=function(){var t=this,e=function(){var e=t._canvas;document.pointerLockElement===e||document.mozPointerLockElement===e?t._pointLocked=!0:t._pointLocked=!1};"onpointerlockchange"in document?document.addEventListener("pointerlockchange",e,!1):"onmozpointerlockchange"in document&&document.addEventListener("mozpointerlockchange",e,!1)},e._createCallback=function(t){var e=this;return function(i){var n,r=e._getLocation(i),s=i.button,a=i.buttons,o=s;switch(t){case oA.MOUSE_DOWN:null===(n=e._canvas)||void 0===n||n.focus(),e._isPressed=!0;break;case oA.MOUSE_UP:e._isPressed=!1;break;case oA.MOUSE_MOVE:o=1&a?cA.BUTTON_LEFT:2&a?cA.BUTTON_RIGHT:4&a?cA.BUTTON_MIDDLE:cA.BUTTON_MISSING}var u=new cA(t,!1,e._preMousePos);u.setLocation(r.x,r.y),u.setButton(o),u.movementX=i.movementX,u.movementY=i.movementY,e._preMousePos.set(r.x,r.y),i.stopPropagation(),i.target===e._canvas&&i.preventDefault(),e._eventTarget.emit(t,u)}},e._handleMouseWheel=function(t){var e=oA.MOUSE_WHEEL,i=this._getLocation(t),n=t.button,r=new cA(e,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=t.movementX,r.movementY=t.movementY,r.setScrollData(5*t.deltaX,5*-t.deltaY),this._preMousePos.set(i.x,i.y),t.stopPropagation(),t.target===this._canvas&&t.preventDefault(),this._eventTarget.emit(e,r)},t}(),Tw=new _n,Sw=new(function(){function t(){this._touchMap=void 0,this._maxTouches=8,this._touchMap=new Map}var e=t.prototype;return e._cloneTouch=function(t){var e=t.getID();t.getStartLocation(Tw);var i=new yA(Tw.x,Tw.y,e);return t.getLocation(Tw),i.setPoint(Tw.x,Tw.y),t.getPreviousLocation(Tw),i.setPrevPoint(Tw),i},e._createTouch=function(t,e,i){if(this._touchMap.has(t))console.log("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(t)){var n=new yA(e,i,t);return this._touchMap.set(t,n),this._updateTouch(n,e,i),this._cloneTouch(n)}console.log("The touches is more than MAX_TOUCHES.")}},e.releaseTouch=function(t){this._touchMap.has(t)&&this._touchMap.delete(t)},e.getTouch=function(t,e,i){var n=this._touchMap.get(t);return n?this._updateTouch(n,e,i):n=this._createTouch(t,e,i),n?this._cloneTouch(n):void 0},e.getAllTouches=function(){var t=this,e=[];return this._touchMap.forEach((function(i){if(i){var n=t._cloneTouch(i);e.push(n)}})),e},e._updateTouch=function(t,e,i){t.getLocation(Tw),t.setPrevPoint(Tw),t.setPoint(e,i)},e._checkTouchMapSizeMoreThanMax=function(t){var e=this;if(this._touchMap.has(t))return!1;var i=Ee.ENABLE_MULTI_TOUCH?this._maxTouches:1;if(this._touchMap.sizeEe.TOUCH_TIMEOUT&&(console.log("The touches is more than MAX_TOUCHES, release touch id "+t.getID()+"."),e.releaseTouch(t.getID()))})),i>=this._touchMap.size},t}()),Aw=function(){function t(){this._canvas=void 0,this._eventTarget=new Ba,Ha.hasFeature(Ga.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||console.warn("failed to access canvas"),this._registerEvent())}var e=t.prototype;return e._registerEvent=function(){var t,e,i,n;null===(t=this._canvas)||void 0===t||t.addEventListener("touchstart",this._createCallback(oA.TOUCH_START)),null===(e=this._canvas)||void 0===e||e.addEventListener("touchmove",this._createCallback(oA.TOUCH_MOVE)),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback(oA.TOUCH_END)),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback(oA.TOUCH_CANCEL))},e._createCallback=function(t){var e=this;return function(i){for(var n,r=e._getCanvasRect(),s=[],a=i.changedTouches.length,o=0;o0){var _=new fA(s,!1,t,Ee.ENABLE_MULTI_TOUCH?Sw.getAllTouches():s);e._eventTarget.emit(t,_)}}},e._getCanvasRect=function(){var t=this._canvas,e=null==t?void 0:t.getBoundingClientRect();return e?new yn(e.x,e.y,e.width,e.height):new yn(0,0,0,0)},e._getLocation=function(t,e){var i=t.clientX-e.x,n=e.y+e.height-t.clientY;if(Xa.isFrameRotated){var r=i;i=e.height-n,n=r}var s=Xa.devicePixelRatio;return new _n(i*=s,n*=s)},e.on=function(t,e,i){this._eventTarget.on(t,e,i)},t}();!function(t){t[t.GLOBAL=0]="GLOBAL",t[t.UI=1]="UI"}(pw||(pw={}));var Rw=function(){function t(t){this.priority=pw.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=t}return t.prototype.dispatchEvent=function(t){return this._inputEventTarget.emit(t.type,t),!0},t}(),bw=((dw={})[oA.MOUSE_DOWN]=oA.TOUCH_START,dw[oA.MOUSE_MOVE]=oA.TOUCH_MOVE,dw[oA.MOUSE_UP]=oA.TOUCH_END,dw),Cw=t("Input",function(){function t(){this._dispatchImmediately=!0,this._eventTarget=new Ba,this._touchInput=new Aw,this._mouseInput=new Ew,this._keyboardInput=new yw,this._accelerometerInput=new tw,this._handleInput=new mw,this._hmdInput=new gw,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._needSimulateTouchMoveEvent=!1,this._inputEventDispatcher=void 0,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new Rw(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),fw._init()}var e=t.prototype;return e._dispatchMouseDownEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===e||e.call(i,t)},e._dispatchMouseMoveEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===e||e.call(i,t)},e._dispatchMouseUpEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===e||e.call(i,t)},e._dispatchMouseScrollEvent=function(t){var e,i;null===(e=(i=this._mouseInput).dispatchScrollEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardDownEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===e||e.call(i,t)},e._dispatchKeyboardUpEvent=function(t){var e,i;null===(e=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===e||e.call(i,t)},e.on=function(t,e,i){return this._eventTarget.on(t,e,i),e},e.once=function(t,e,i){return this._eventTarget.once(t,e,i),e},e.off=function(t,e,i){this._eventTarget.off(t,e,i)},e.setAccelerometerEnabled=function(t){t?this._accelerometerInput.start():this._accelerometerInput.stop()},e.setAccelerometerInterval=function(t){this._accelerometerInput.setInterval(t)},e._simulateEventTouch=function(t){var e=bw[t.type],i=Sw.getTouch(0,t.getLocationX(),t.getLocationY());if(i){var n=[i],r=new fA(n,!1,e,e===oA.TOUCH_END?[]:n);e===oA.TOUCH_END&&Sw.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},e._registerEventDispatcher=function(t){this._eventDispatcherList.push(t),this._eventDispatcherList.sort((function(t,e){return e.priority-t.priority}))},e._emitEvent=function(t){for(var e=this._eventDispatcherList.length,i=0;i0)for(var u=0;u=0&&s.node._components.splice(a,1)}}}function Ww(t,e,i){if(!(e.length<=0))for(var n=null,r=0;r0){var u=o.pop();if(!u)continue;for(var h=0;h0){var g=p.pop();if(!g)return;for(var v=0;v>>1;r<=s;a=r+s>>>1){var o=t[a],u=o.constructor._executionOrder;if(u>i)s=a-1;else if(un)s=a-1;else{if(!(h0&&(t.array.sort(iI),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(iI),this._invoke(e),e.array.length=0)},e}(eI),rI=function(t){function e(){return t.apply(this,arguments)||this}c(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=$w(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=$w(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}(eI);function sI(t,e,i){var n="var a=it.array;for(it.i=0;it.i=0?Qw(this._deferredComps,e):(!t.start||t._objFlags&Zw||this.startInvoker.remove(t),t.update&&this.updateInvoker.remove(t),t.lateUpdate&&this.lateUpdateInvoker.remove(t))},e.enableComp=function(t,e){if(!(t._objFlags&Jw)){if(t.onEnable){if(e)return void e.add(t);if(t.onEnable(),!t.node._activeInHierarchy)return}this._onEnabled(t)}},e.disableComp=function(t){t._objFlags&Jw&&(t.onDisable&&t.onDisable(),this._onDisabled(t))},e.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},e.updatePhase=function(t){this.updateInvoker.invoke(t)},e.lateUpdatePhase=function(t){this.lateUpdateInvoker.invoke(t),this._updating=!1,this._startForNewComps()},e._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},e._scheduleImmediate=function(t){"function"!=typeof t.start||t._objFlags&Zw||this.startInvoker.add(t),"function"==typeof t.update&&this.updateInvoker.add(t),"function"==typeof t.lateUpdate&&this.lateUpdateInvoker.add(t)},e._deferredSchedule=function(){for(var t=this._deferredComps,e=0,i=t.length;e=e.OptimizationPolicyThreshold)?(t=this._doInstantiate(),this.data._instantiate(t)):t=this.data._instantiate(),++this._instantiatedTimes,t},i.initDefault=function(e){t.prototype.initDefault.call(this,e),this.data=new jE,this.data.name="(Missing Node)";var i=new b._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var t=this.data;Yw(t),Xw(t)},e}(Wl),qO.OptimizationPolicy=sx,qO.OptimizationPolicyThreshold=3,jO=T((XO=QO).prototype,"data",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),YO=T(XO.prototype,"optimizationPolicy",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return sx.AUTO}}),KO=T(XO.prototype,"persistent",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),WO=XO))||WO);le.value(ax,"_utils",rx),b.Prefab=ax,Mt(b,"cc._Prefab","Prefab"),t("PrefabLink",(ZO=_h("cc.PrefabLink"),JO=Kh(ax),$O=Dh(),ZO((nx=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r15e3&&(e=15e3);var i=e*e,n=(.860117757+.000154118254*e+1.28641212e-7*i)/(1+.000842420235*e+7.08145163e-7*i),r=(.317398726+422806245e-13*e+4.20481691e-8*i)/(1-289741816e-13*e+1.61456053e-7*i),s=2*n-8*r+4,a=3*n/s,o=2*r/s,u=1/o*a,h=1/o*(1-a-o);t.x=3.2404542*u-1.5371385+-.4985314*h,t.y=-.969266*u+1.8760108+.041556*h,t.z=.0556434*u-.2040259+1.0572252*h}!function(t){t[t.DIRECTIONAL=0]="DIRECTIONAL",t[t.SPHERE=1]="SPHERE",t[t.SPOT=2]="SPOT",t[t.UNKNOWN=3]="UNKNOWN"}(gx||(gx={}));var Sx,Ax,Rx,bx,Cx,wx,Ix,Ox,xx,Px,Dx=function(t){return 4*Math.PI*Math.PI*t*t},Bx=function(){function t(){this._baked=!1,this._color=new ji(1,1,1),this._colorTemp=6550,this._colorTempRGB=new ji(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=gx.UNKNOWN}var e=t.prototype;return e.initialize=function(){this.color=new ji(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(){},h(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)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(t){this._useColorTemperature=t}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(t){this._colorTemp=t,Tx(this._colorTempRGB,this._colorTemp)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"node",get:function(){return this._node},set:function(t){this._node=t,this._node&&(this._node.hasChangedFlags|=AE.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}(),Nx=t("DebugView",function(){function t(){this._singleMode=0,this._compositeModeValue=0,this._lightingWithAlbedo=!0,this._csmLayerColoration=!1,this._nativeConfig=null,this._activate()}var e=t.prototype;return e.isCompositeModeEnabled=function(t){return 0!=(this._compositeModeValue&1<=0;--e){var i=t[e];if(i.window.swapchain)return void(ky=i)}ky=null}(t);for(var e=0;e0){var o=a;a=s,s=o}var u=0;switch(t){case wn.IDENTITY:u=0,i[u++]=-1,i[u++]=-1,i[u++]=n,i[u++]=a,i[u++]=1,i[u++]=-1,i[u++]=r,i[u++]=a,i[u++]=-1,i[u++]=1,i[u++]=n,i[u++]=s,i[u++]=1,i[u++]=1,i[u++]=r,i[u++]=s;break;case wn.ROTATE_90:u=0,i[u++]=-1,i[u++]=-1,i[u++]=r,i[u++]=a,i[u++]=1,i[u++]=-1,i[u++]=r,i[u++]=s,i[u++]=-1,i[u++]=1,i[u++]=n,i[u++]=a,i[u++]=1,i[u++]=1,i[u++]=n,i[u++]=s;break;case wn.ROTATE_180:u=0,i[u++]=-1,i[u++]=-1,i[u++]=n,i[u++]=s,i[u++]=1,i[u++]=-1,i[u++]=r,i[u++]=s,i[u++]=-1,i[u++]=1,i[u++]=n,i[u++]=a,i[u++]=1,i[u++]=1,i[u++]=r,i[u++]=a;break;case wn.ROTATE_270:u=0,i[u++]=-1,i[u++]=-1,i[u++]=n,i[u++]=s,i[u++]=1,i[u++]=-1,i[u++]=n,i[u++]=a,i[u++]=-1,i[u++]=1,i[u++]=r,i[u++]=s,i[u++]=1,i[u++]=1,i[u++]=r,i[u++]=a}return i},i._createQuadInputAssembler=function(){var t=new YD,e=4*Float32Array.BYTES_PER_ELEMENT,i=4*e,n=this._device.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE|Mn.HOST,i,e));if(!n)return t;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,s,r));if(!a)return t;var o=new Uint8Array(6);o[0]=0,o[1]=1,o[2]=2,o[3]=1,o[4]=3,o[5]=2,a.update(o);var u=new Array(2);u[0]=new Jr("a_position",On.RG32F),u[1]=new Jr("a_texCoord",On.RG32F);var h=this._device.createInputAssembler(new ts(u,[n],a));return t.quadIB=a,t.quadVB=n,t.quadIA=h,t},i.updateQuadVertexData=function(t,e){var i=this._lastUsedRenderArea;if(i.x!==t.x||i.y!==t.y||i.width!==t.width||i.height!==t.height){var n=this._genQuadVertexData(wn.IDENTITY,t);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(e.swapchain&&e.swapchain.surfaceTransform||wn.IDENTITY,t);this._quadVBOnscreen.update(r),i.copy(t)}},i.destroy=function(){for(var e,i,n=0;n>1,r>>1)),t.prefilterFramebuffer=e.createFramebuffer(new hs(t.renderPass,[t.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)t.downsampleTexs.push(e.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,On.RGBA8,n>>1,r>>1))),t.downsampleFramebuffers[s]=e.createFramebuffer(new hs(t.renderPass,[t.downsampleTexs[s]])),t.upsampleTexs.push(e.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,On.RGBA8,n,r))),t.upsampleFramebuffers[s]=e.createFramebuffer(new hs(t.renderPass,[t.upsampleTexs[s]])),n>>=1,r>>=1;t.combineTex=e.createTexture(new kr(Ln.TEX2D,Fn.COLOR_ATTACHMENT|Fn.SAMPLED,On.RGBA8,this._width,this._height)),t.combineFramebuffer=e.createFramebuffer(new hs(t.renderPass,[t.combineTex])),t.sampler=this.globalDSManager.linearSampler}},i.on=function(t,e,i,n){return this._eventProcessor.on(t,e,i,n)},i.once=function(t,e,i){return this._eventProcessor.once(t,e,i)},i.off=function(t,e,i){this._eventProcessor.off(t,e,i)},i.emit=function(t,e,i,n,r,s){this._eventProcessor.emit(t,e,i,n,r,s)},i.targetOff=function(t){this._eventProcessor.targetOff(t)},i.removeAll=function(t){this._eventProcessor.removeAll(t)},i.hasEventListener=function(t,e,i){return this._eventProcessor.hasEventListener(t,e,i)},h(e,[{key:"tag",get:function(){return this._tag}},{key:"flows",get:function(){return this._flows}},{key:"quadIAOnscreen",get:function(){return this._quadIAOnscreen}},{key:"quadIAOffscreen",get:function(){return this._quadIAOffscreen}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"macros",get:function(){return this._macros}},{key:"device",get:function(){return this._device}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"commandBuffers",get:function(){return this._commandBuffers}},{key:"pipelineUBO",get:function(){return this._pipelineUBO}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"profiler",get:function(){return this._profiler},set:function(t){this._profiler=t}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"clusterEnabled",get:function(){return this._clusterEnabled},set:function(t){this._clusterEnabled=t}},{key:"bloomEnabled",get:function(){return this._bloomEnabled},set:function(t){this._bloomEnabled=t}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(t){this._pipelineSceneData.shadingScale!==t&&(this._pipelineSceneData.shadingScale=t,this.emit(iP.ATTACHMENT_SCALE_CAHNGED,t))}}]),e}(Wl),lP=T((hP=_P).prototype,"_tag",[sP,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),cP=T(hP.prototype,"_flows",[aP,oP,Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),uP=hP))||uP));b.RenderPipeline=KD,nt(KD.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]),function(t){t[t.BLOOM=18]="BLOOM",t[t.POST_PROCESS=19]="POST_PROCESS",t[t.UI=20]="UI"}(fP||(fP={})),function(t){t[t.FORWARD=10]="FORWARD"}(dP||(dP={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.FORWARD=1]="FORWARD",t[t.UI=10]="UI"}(pP||(pP={})),function(t){t[t.GBUFFER=10]="GBUFFER",t[t.LIGHTING=15]="LIGHTING",t[t.TRANSPARENT=18]="TRANSPARENT"}(mP||(mP={})),function(t){t[t.SHADOW=0]="SHADOW",t[t.MAIN=1]="MAIN",t[t.UI=10]="UI"}(gP||(gP={})),pe(Ln),pe(Fn),pe(Zn),pe(Qn),pe(Jn),pe(On),function(t){t[t.SCENE=0]="SCENE",t[t.POSTPROCESS=1]="POSTPROCESS",t[t.UI=2]="UI"}(HD||(HD={})),pe(HD),vP=_h("RenderTextureDesc"),yP=Kh(Ln),EP=Kh(Fn),TP=Kh(On),vP((AP=T((SP=function(){E(this,"name",AP,this),E(this,"type",RP,this),E(this,"usage",bP,this),E(this,"format",CP,this),E(this,"width",wP,this),E(this,"height",IP,this)}).prototype,"name",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),RP=T(SP.prototype,"type",[yP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Ln.TEX2D}}),bP=T(SP.prototype,"usage",[EP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Fn.COLOR_ATTACHMENT}}),CP=T(SP.prototype,"format",[TP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return On.UNKNOWN}}),wP=T(SP.prototype,"width",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),IP=T(SP.prototype,"height",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),SP));var qD,QD=(OP=_h("RenderTextureConfig"),xP=Kh(aT),OP((BP=T((DP=function(){E(this,"name",BP,this),E(this,"texture",NP,this)}).prototype,"name",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),NP=T(DP.prototype,"texture",[xP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),PP=DP))||PP),ZD=(MP=_h("MaterialConfig"),LP=Kh(Vy),MP((UP=T((FP=function(){E(this,"name",UP,this),E(this,"material",GP,this)}).prototype,"name",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),GP=T(FP.prototype,"material",[LP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),FP)),kP=_h("FrameBufferDesc"),zP=Kh([Xe]),HP=Kh(aT),kP((WP=T((VP=function(){E(this,"name",WP,this),E(this,"renderPass",XP,this),E(this,"colorTextures",jP,this),E(this,"depthStencilTexture",YP,this),E(this,"texture",KP,this)}).prototype,"name",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),XP=T(VP.prototype,"renderPass",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),jP=T(VP.prototype,"colorTextures",[zP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),YP=T(VP.prototype,"depthStencilTexture",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),KP=T(VP.prototype,"texture",[HP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),VP)),qP=_h("ColorDesc"),QP=Kh(On),ZP=Kh(Qn),JP=Kh(Zn),$P=Kh([Jn]),tD=Kh([Jn]),qP((nD=T((iD=function(){E(this,"format",nD,this),E(this,"loadOp",rD,this),E(this,"storeOp",sD,this),E(this,"sampleCount",aD,this),E(this,"beginAccesses",oD,this),E(this,"endAccesses",uD,this)}).prototype,"format",[QP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return On.UNKNOWN}}),rD=T(iD.prototype,"loadOp",[ZP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.CLEAR}}),sD=T(iD.prototype,"storeOp",[JP],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zn.STORE}}),aD=T(iD.prototype,"sampleCount",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),oD=T(iD.prototype,"beginAccesses",[$P],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.NONE}}),uD=T(iD.prototype,"endAccesses",[tD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.COLOR_ATTACHMENT_WRITE}}),eD=iD))||eD),JD=(hD=_h("DepthStencilDesc"),lD=Kh(On),cD=Kh(Qn),_D=Kh(Zn),fD=Kh(Qn),dD=Kh(Zn),pD=Kh(Jn),mD=Kh(Jn),hD((yD=T((vD=function(){E(this,"format",yD,this),E(this,"depthLoadOp",ED,this),E(this,"depthStoreOp",TD,this),E(this,"stencilLoadOp",SD,this),E(this,"stencilStoreOp",AD,this),E(this,"sampleCount",RD,this),E(this,"beginAccesses",bD,this),E(this,"endAccesses",CD,this)}).prototype,"format",[lD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return On.UNKNOWN}}),ED=T(vD.prototype,"depthLoadOp",[cD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.CLEAR}}),TD=T(vD.prototype,"depthStoreOp",[_D],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zn.STORE}}),SD=T(vD.prototype,"stencilLoadOp",[fD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qn.CLEAR}}),AD=T(vD.prototype,"stencilStoreOp",[dD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Zn.STORE}}),RD=T(vD.prototype,"sampleCount",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),bD=T(vD.prototype,"beginAccesses",[pD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.NONE}}),CD=T(vD.prototype,"endAccesses",[mD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Jn.DEPTH_STENCIL_ATTACHMENT_WRITE}}),gD=vD))||gD);wD=_h("RenderPassDesc"),ID=Kh([ZD]),OD=Kh(JD),wD((PD=T((xD=function(){E(this,"index",PD,this),E(this,"colorAttachments",DD,this),E(this,"depthStencilAttachment",BD,this)}).prototype,"index",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return-1}}),DD=T(xD.prototype,"colorAttachments",[ID],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),BD=T(xD.prototype,"depthStencilAttachment",[OD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new JD}}),xD)),function(t){t[t.FRONT_TO_BACK=0]="FRONT_TO_BACK",t[t.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(qD||(qD={})),pe(qD);var $D=(ND=_h("RenderQueueDesc"),MD=Kh(qD),LD=Kh([Xe]),ND((GD=T((UD=function(){E(this,"isTransparent",GD,this),E(this,"sortMode",kD,this),E(this,"stages",zD,this)}).prototype,"isTransparent",[Eh,Ph],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),kD=T(UD.prototype,"sortMode",[MD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return qD.FRONT_TO_BACK}}),zD=T(UD.prototype,"stages",[LD],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),FD=UD))||FD);function tB(t,e){return t.hash-e.hash||t.depth-e.depth||t.shaderId-e.shaderId}function eB(t,e){return t.priority-e.priority||t.hash-e.hash||e.depth-t.depth||t.shaderId-e.shaderId}var iB=function(){function t(t){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=t,this._passPool=new pa((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new ma(64,this._passDesc.sortFunc)}var e=t.prototype;return e.clear=function(){this.queue.clear(),this._passPool.reset()},e.insertRenderPass=function(t,e,i){var n=t.model.subModels[e],r=n.passes[i],s=n.shaders[i];if(r.blendState.targets[0].blend!==this._passDesc.isTransparent||!(r.phase&this._passDesc.phases))return!1;var a=0|r.priority<<16|n.priority<<8|i,o=this._passPool.add();return o.priority=t.model.priority,o.hash=a,o.depth=t.depth||0,o.shaderId=s.typedID,o.subModel=n,o.passIdx=i,this.queue.push(o),!0},e.sort=function(){this.queue.sort()},e.recordCommandBuffer=function(t,e,i){for(var n=0;n8?K(12004,8):(this._passes=t,this._flushPassInfo(),this._passes[0].batchingScheme===my.VB_MERGING&&this.subMesh.genFlatBuffers(),this._descriptorSet&&(this._descriptorSet.destroy(),hB.layout=t[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(hB)))}},{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._passes[0].batchingScheme===my.VB_MERGING&&this.subMesh.genFlatBuffers(),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:"planarInstanceShader",get:function(){return this._planarInstanceShader}},{key:"planarShader",get:function(){return this._planarShader}},{key:"instancedAttributeBlock",get:function(){return this._instancedAttributeBlock}},{key:"instancedWorldMatrixIndex",get:function(){return this._instancedWorldMatrixIndex},set:function(t){this._instancedWorldMatrixIndex=t}}]),t}(),cB=new un,_B=[{name:"CC_RECEIVE_SHADOW",value:!0}],fB=[{name:"CC_USE_LIGHTMAP",value:!0}];!function(t){t[t.DEFAULT=0]="DEFAULT",t[t.SKINNING=1]="SKINNING",t[t.BAKED_SKINNING=2]="BAKED_SKINNING",t[t.BATCH_2D=3]="BATCH_2D",t[t.PARTICLE_BATCH=4]="PARTICLE_BATCH",t[t.LINE=5]="LINE"}(aB||(aB={}));var dB=new Hr(Hn.LINEAR,Hn.LINEAR,Hn.NONE,Vn.CLAMP,Vn.CLAMP,Vn.CLAMP),pB=new Hr(Hn.LINEAR,Hn.LINEAR,Hn.LINEAR,Vn.CLAMP,Vn.CLAMP,Vn.CLAMP),mB=function(){function t(){this.type=aB.DEFAULT,this.scene=null,this.isDynamicBatching=!1,this._worldBounds=null,this._modelBounds=null,this._subModels=[],this._node=null,this._transform=null,this._device=void 0,this._inited=!1,this._descriptorSetCount=1,this._updateStamp=-1,this._localDataUpdated=!0,this._localData=new Float32Array(Pp.COUNT),this._localBuffer=null,this._lightmap=null,this._lightmapUVParam=new Li,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._shadowBias=0,this._shadowNormalBias=0,this._enabled=!0,this._visFlags=Jd.Enum.NONE,this._priority=0,this._device=Ja.gfxDevice}var e=t.prototype;return e.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Jd.Enum.NONE,this._inited=!0)},e.destroy=function(){for(var t=this._subModels,e=0;e=0?a.updateInstancedWorldMatrix(n,o):r=!0}r&&this._localBuffer&&(un.toArray(this._localData,n,Pp.MAT_WORLD_OFFSET),un.inverseTranspose(cB,n),un.toArray(this._localData,cB,Pp.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},e.createBoundingShape=function(t,e){t&&e&&(this._modelBounds=Fu.fromPoints(Fu.create(),t,e),this._worldBounds=Fu.clone(this._modelBounds))},e._createSubModel=function(){return new lB},e.initSubModel=function(t,e,i){this.initialize(),null==this._subModels[t]?this._subModels[t]=this._createSubModel():this._subModels[t].destroy(),this._subModels[t].initialize(e,i.passes,this.getMacroPatches(t)),this._subModels[t].initPlanarShadowShader(),this._subModels[t].initPlanarShadowInstanceShader(),this._updateAttributesAndBinding(t)},e.setSubModelMesh=function(t,e){this._subModels[t]&&(this._subModels[t].subMesh=e)},e.setSubModelMaterial=function(t,e){this._subModels[t]&&(this._subModels[t].passes=e.passes,this._updateAttributesAndBinding(t))},e.onGlobalPipelineStateChanged=function(){for(var t=this._subModels,e=0;e1?pB:dB),r=this._subModels,s=0;s1?2:1,e.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()},h(e,[{key:"direction",get:function(){return this._dir},set:function(t){ji.normalize(this._dir,t)}},{key:"illuminance",get:function(){return b.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(t){b.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,NA.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(t){this._shadowInvisibleOcclusionRange=Math.min(t,NA.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,NA.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(t){this._shadowOrthoSize=t}}]),e}(Bx),TB=function(t){function e(){var e;return(e=t.call(this)||this)._needUpdate=!1,e._size=.15,e._range=1,e._luminanceHDR=0,e._luminanceLDR=0,e._pos=void 0,e._aabb=void 0,e._aabb=Fu.create(),e._pos=new ji,e._type=gx.SPHERE,e}c(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/Dx(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var t=this._range;Fu.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,t,t,t),this._needUpdate=!1}},h(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 b.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",set:function(t){this._luminanceLDR=t}},{key:"aabb",get:function(){return this._aabb}}]),e}(Bx),SB=new ji(0,0,-1),AB=new $i,RB=new un,bB=new un,CB=new un,wB=new un,IB=function(t){function e(){var e;return(e=t.call(this)||this)._dir=new ji(1,-1,-1),e._range=5,e._spotAngle=Math.cos(Math.PI/6),e._pos=void 0,e._aabb=void 0,e._frustum=void 0,e._angle=0,e._needUpdate=!1,e._size=.15,e._luminanceHDR=0,e._luminanceLDR=0,e._shadowEnabled=!1,e._shadowPcf=xA.HARD,e._shadowBias=1e-5,e._shadowNormalBias=0,e._aabb=Fu.create(),e._frustum=qu.create(),e._pos=new ji,e._type=gx.SPOT,e}c(e,t);var i=e.prototype;return i.initialize=function(){t.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/Dx(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new ji(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),ji.transformQuat(this._dir,SB,this._node.getWorldRotation(AB)),ji.normalize(this._dir,this._dir),Fu.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(RB),un.invert(RB,RB),un.perspective(bB,this._angle,1,.001,this._range),un.multiply(CB,bB,RB),this._frustum.update(CB,wB),this._needUpdate=!1)},h(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 b.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(t){b.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=t:this.luminanceLDR=t}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(t){this._luminanceHDR=t}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(t){this._luminanceLDR=t}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(t){this._angle=t,this._spotAngle=Math.cos(.5*t),this._needUpdate=!0}},{key:"angle",get:function(){return this._angle}},{key:"aabb",get:function(){return this._aabb}},{key:"frustum",get:function(){return this._frustum}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(t){this._shadowEnabled=t}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(t){this._shadowPcf=t}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(t){this._shadowBias=t}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(t){this._shadowNormalBias=t}}]),e}(Bx),OB=Object.freeze({__proto__:null,get CameraFOVAxis(){return ZE},get CameraProjection(){return JE},get CameraAperture(){return $E},get CameraISO(){return tT},get CameraShutter(){return eT},get CameraType(){return iT},get TrackingType(){return nT},SKYBOX_FLAG:DS,Camera:NS,get ModelType(){return aB},Model:mB,SubModel:lB,Ambient:wA,EnvironmentLightingType:FA,Skybox:UA,ShadowSize:IA,ShadowType:OA,PCFType:xA,CSMLevel:PA,CSMOptimizationMode:DA,Shadows:NA,FogType:LC,Fog:UC,Octree:gB,ColorTemperatureToRGB:Tx,get LightType(){return gx},nt2lm:Dx,Light:Bx,DirectionalLight:EB,SphereLight:TB,SpotLight:IB}),xB=new da((function(){return{subModel:null,passIdx:-1,dynamicOffsets:[],lights:[]}}),16),PB=new Float32Array(4),DB=[],BB=[],NB=new un,MB=new un;function LB(t,e){return!(!e.worldBounds||bu.aabbWithAABB(e.worldBounds,t.aabb))}function FB(t,e){return!(!e.worldBounds||bu.aabbWithAABB(e.worldBounds,t.aabb)&&bu.aabbFrustum(e.worldBounds,t.frustum))}var UB=yy("forward-add"),GB=[];function kB(t,e){e.length=0;for(var i=!1,n=0;nthis._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=Oi(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView.initialize(new Lr(this._lightBuffer,0,Mp.SIZE)));for(var o=0,u=0;o-1&&this.additiveInstanceQueues.splice(e,1)},i.initialize=function(e){return t.prototype.initialize.call(this,e),e.renderQueues&&(this.renderQueues=e.renderQueues),!0},i.activate=function(e,i){t.prototype.activate.call(this,e,i);for(var n=0;n=0;u--){var h=r.array[u];if(h){var l=h.model;l.enabled&&l.node&&(o&l.node.layer)===l.node.layer&&null!=a&&l.castShadow&&l.worldBounds&&bu.aabbFrustum(l.worldBounds,s)&&(a.push(h),i.level0?.5*(1-Math.floor(a/2))*u.y:.5*Math.floor(a/2)*u.y,this._renderArea.width=.5*u.x,this._renderArea.height=.5*u.y}break;case gx.SPOT:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=u.x,this._renderArea.height=u.y}var c=this._shadowFrameBuffer.renderPass;s.beginRenderPass(c,this._shadowFrameBuffer,this._renderArea,pN,t.clearDepth,t.clearStencil),s.bindDescriptorSet(lp.GLOBAL,r),this._additiveShadowQueue.recordCommandBuffer(o,c,s),s.endRenderPass()}},i.activate=function(e,i){t.prototype.activate.call(this,e,i),this._additiveShadowQueue=new dN(e)},e}(eP),uN.initInfo={name:"ShadowStage",priority:dP.FORWARD,tag:0},oN=hN))||oN),gN=[],vN=t("ShadowFlow",_h("ShadowFlow")((_N=cN=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=(pp.COUNT+mp.COUNT+gp.COUNT+vp.COUNT)/4,e.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=e.pipelineSceneData.csmSupported,e.macros.CC_SHADOW_TYPE=0,e.macros.CC_DIR_SHADOW_PCF_TYPE=xA.HARD,e.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()},i.render=function(t){var e=this._pipeline,i=e.pipelineSceneData.shadows,n=e.pipelineSceneData.csmLayers,r=e.pipelineSceneData.shadowFrameBufferMap,s=n.castShadowObjects,a=this._pipeline.pipelineSceneData.validPunctualLights;if(i.enabled&&i.type===OA.ShadowMap){for(var o=0,u=0;or.x?i[u]:r.x,r.y=i[u+1]>r.y?i[u+1]:r.y,s.x=i[u]r.x?i[u]:r.x,r.y=i[u+1]>r.y?i[u+1]:r.y,r.z=i[u+2]>r.z?i[u+2]:r.z,s.x=i[u]1&&t.csmOptimizationMode===DA.RemoveDuplicates)if(this._level>=u-1)OM=this._castLightViewBoundingBox.halfExtents.z,IM=this._castLightViewBoundingBox.center.z;else{var h=Math.abs(this._castLightViewBoundingBox.center.z-IM)+OM;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,h)}var l=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*l+r;var c=this._castLightViewBoundingBox.center;if(wM.set(c.x,c.y,c.z+l+r),ji.transformMat4(wM,wM,dM),un.fromRT(dM,t.node.rotation,wM),un.invert(pM,dM),!i){var _=.5*s,f=.5*a;un.ortho(mM,-_,_,-f,f,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),un.multiply(vM,mM,o),ji.transformMat4(TM,wM,vM);var d=2/e;SM.set(d,d);var p=TM.x%SM.x,m=TM.y%SM.y;AM.set(TM.x-p,TM.y-m,TM.z),un.invert(yM,vM),ji.transformMat4(RM,AM,yM),un.fromRT(dM,t.node.rotation,RM),un.invert(pM,dM),un.multiply(gM,mM,pM),un.copy(this._matShadowView,pM),un.copy(this._matShadowProj,mM),un.copy(this._matShadowViewProj,gM)}qu.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,dM)},h(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}(),PM=function(t){function e(e){var i;return(i=t.call(this,e)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new Li,i._calculateAtlas(e),i}c(e,t);var i=e.prototype;return i.destroy=function(){t.prototype.destroy.call(this)},i._calculateAtlas=function(t){var e=b.director.root.device.capabilities.clipSpaceSignY,i=t%2-.5,n=(.5-Math.floor(t/2))*e;this._csmAtlas.set(.5,.5,i,n)},h(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}(xM),DM=function(){function t(){this._castShadowObjects=[],this._layerObjects=new ma(64),this._layers=[],this._levelCount=0,this._specialLayer=new xM(1),this._shadowDistance=0;for(var t=0;t1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(fM,t);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,u=a.splitCameraFar;a.calculateSplitFrustum(t,fM,o,u),a.createMatrix(e,r,!1)}n===PA.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,un.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),un.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),un.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(t,fM,.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();un.fromRT(t,r,n),t.m08*=-1,t.m09*=-1,t.m10*=-1}},h(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}(),BM=t("PipelineSceneData",function(){function t(){this.fog=new UC,this.ambient=new wA,this.skybox=new UA,this.shadows=new NA,this.csmLayers=new DM,this.octree=new gB,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._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 Vy,this._geometryRendererMaterials[e]._uuid="geometry-renderer-material-"+e,this._geometryRendererMaterials[e].initialize({effectName:"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},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 Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,n,i)),this._occlusionQueryVertexBuffer.update(e);var r=new Uint16Array([0,2,1,1,2,3,4,5,6,5,7,6,1,3,7,1,7,5,0,4,6,0,6,2,0,1,5,0,5,4,2,6,7,2,7,3]),s=Uint16Array.BYTES_PER_ELEMENT,a=36*s;this._occlusionQueryIndicesBuffer=t.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new Jr("a_position",On.RGB32F)],u=new ts(o,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return t.createInputAssembler(u)},h(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:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),t}()),NM=t("ForwardPipeline",(ON=_h("ForwardPipeline"),xN=Kh([QD]),PN=zh(),ON((MN=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0){this._renderQueues.forEach(sB);for(var S=0;S0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new _s(h.localSetLayout)),this._localUBO=i.createBuffer(new Mr(Dn.UNIFORM|Dn.TRANSFER_DST,Mn.DEVICE,Pp.SIZE,Pp.SIZE)),this._stageDesc.bindBuffer(Pp.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(lp.MATERIAL,h.descriptorSet),r.bindDescriptorSet(lp.LOCAL,this._stageDesc),r.bindInputAssembler(c),r.draw(c)),this._uiPhase.render(t,u),zy(i,u,r,e.profiler,t),r.endRenderPass()},e}(eP),lM.initInfo={name:"PostProcessStage",priority:fP.POST_PROCESS,tag:0},uM=T((oM=cM).prototype,"_postProcessMaterial",[iM,Eh,nM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),hM=T(oM.prototype,"renderQueues",[rM,Eh,sM],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),aM=oM))||aM));!function(t){t[t.NONE=0]="NONE",t[t.FXAA=1]="FXAA"}(_M||(_M={}));var zM,HM,VM,WM,XM,jM,YM,KM,qM=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r>=1,this._renderArea.height>>=1;var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial.passes[0],r=e.getPipelineRenderData(),s=r.bloom,a=new Float32Array(ZM.COUNT);a[ZM.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,QM,0,0),i.bindDescriptorSet(lp.GLOBAL,e.descriptorSet),n.descriptorSet.bindBuffer(0,this._bloomUBO[0]),n.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),n.descriptorSet.bindSampler(1,s.sampler),n.descriptorSet.update(),i.bindDescriptorSet(lp.MATERIAL,n.descriptorSet);var o=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,u=null,h=n.getShaderVariant();null!=n&&null!=h&&null!=o&&(u=Cy.getOrCreatePipelineState(e.device,n,h,s.renderPass,o)),null!=u&&(i.bindPipelineState(u),i.bindInputAssembler(o),i.draw(o)),i.endRenderPass()},i._downsamplePass=function(t,e){e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;for(var i=e.commandBuffers[0],n=e.pipelineSceneData.bloomMaterial,r=e.getPipelineRenderData().bloom,s=new Float32Array(ZM.COUNT),a=0;a>=1,this._renderArea.height>>=1,i.beginRenderPass(r.renderPass,r.downsampleFramebuffers[a],this._renderArea,QM,0,0);var o=n.passes[1+a],u=o.getShaderVariant();o.descriptorSet.bindBuffer(0,this._bloomUBO[a+1]),0===a?o.descriptorSet.bindTexture(1,r.prefiterTex):o.descriptorSet.bindTexture(1,r.downsampleTexs[a-1]),o.descriptorSet.bindSampler(1,r.sampler),o.descriptorSet.update(),i.bindDescriptorSet(lp.MATERIAL,o.descriptorSet);var h=t.window.swapchain?e.quadIAOffscreen:e.quadIAOnscreen,l=null;null!=o&&null!=u&&null!=h&&(l=Cy.getOrCreatePipelineState(e.device,o,u,r.renderPass,h)),null!=l&&(i.bindPipelineState(l),i.bindInputAssembler(h),i.draw(h)),i.endRenderPass()}},i._upsamplePass=function(t,e){var i=e.getPipelineRenderData().bloom;e.generateRenderArea(t,this._renderArea),this._renderArea.width>>=this.iterations+1,this._renderArea.height>>=this.iterations+1;for(var n=e.commandBuffers[0],r=e.pipelineSceneData.bloomMaterial,s=new Float32Array(ZM.COUNT),a=0;a=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(t){this._curTime=t}}],[{key:"instance",get:function(){return e._ins||(e._ins=new e),e._ins}}]),e}();dL._ins=void 0,b.internal.SplashScreen=dL;var pL=new Tt("Scheduler"),mL=function(t,e,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=t,this.priority=e,this.paused=i,this.markedForDeletion=n};mL.get=function(t,e,i,n){var r=mL._listEntries.pop();return r?(r.target=t,r.priority=e,r.paused=i,r.markedForDeletion=n):r=new mL(t,e,i,n),r},mL.put=function(t){mL._listEntries.length<20&&(t.target=null,mL._listEntries.push(t))},mL._listEntries=[];var gL=function(t,e,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=t,this.entry=e,this.target=i,this.callback=n};gL.get=function(t,e,i,n){var r=gL._hashUpdateEntries.pop();return r?(r.list=t,r.entry=e,r.target=i,r.callback=n):r=new gL(t,e,i,n),r},gL.put=function(t){gL._hashUpdateEntries.length<20&&(t.list=t.entry=t.target=t.callback=null,gL._hashUpdateEntries.push(t))},gL._hashUpdateEntries=[];var vL=function(t,e,i,n,r,s){this.timers=void 0,this.target=void 0,this.timerIndex=void 0,this.currentTimer=void 0,this.currentTimerSalvaged=void 0,this.paused=void 0,this.timers=t,this.target=e,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s};vL.get=function(t,e,i,n,r,s){var a=vL._hashTimerEntries.pop();return a?(a.timers=t,a.target=e,a.timerIndex=i,a.currentTimer=n,a.currentTimerSalvaged=r,a.paused=s):a=new vL(t,e,i,n,r,s),a},vL.put=function(t){vL._hashTimerEntries.length<20&&(t.timers=t.target=t.currentTimer=null,vL._hashTimerEntries.push(t))},vL._hashTimerEntries=[];var yL=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,this._callback=null}var e=t.prototype;return e.initWithCallback=function(t,e,i,n,r,s){return this._lock=!1,this._scheduler=t,this._target=i,this._callback=e,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===b.macro.REPEAT_FOREVER,!0},e.getInterval=function(){return this._interval},e.setInterval=function(t){this._interval=t},e.update=function(t){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=t,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},e.getCallback=function(){return this._callback},e.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},e.cancel=function(){this._scheduler.unschedule(this._callback,this._target)},t}();yL._timers=[],yL.get=function(){return yL._timers.pop()||new yL},yL.put=function(t){yL._timers.length<20&&!t._lock&&(t._scheduler=t._target=t._callback=null,yL._timers.push(t))};var EL=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=Bt(!0),e._hashForTimers=Bt(!0),e._currentTarget=null,e._currentTargetSalvaged=!1,e._updateHashLocked=!1,e._arrayForTimers=[],e}c(e,t),e.enableForTarget=function(t){var e=!1;(t.uuid||t.id)&&(e=!0),e||(t.__instanceId?j(1513):t.id=pL.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 K(1510)}},i.unscheduleUpdate=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForUpdates[e];i&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else K(1510)}},i.unscheduleAllForTarget=function(t){if(t){var e=t.uuid||t.id;if(e){var i=this._hashForTimers[e];if(i){var n=i.timers;n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r=0;e--)i=r[e],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){Z(t,1508),Z(e,1509);var i=e.uuid||e.id;if(!i)return K(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;e1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0);for(var e=0;e0){this._device.acquire([Ja.swapchain]);var s=this._scenes,a=b.director.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var o=0;o0?(this._fixedFPS=t,this._fixedFPSFrameTime=1e3/t):this._fixedFPSFrameTime=0}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}}]),t}());b.Root=bL;var CL=function(){function t(){this._rafHandle=0,this._stHandle=0,this._onTick=null,this._targetFrameRate=60,this._frameTime=0,this._startTime=0,this._isPlaying=!1,this._rAF=void 0,this._cAF=void 0,this._rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||this._stTime.bind(this),this._cAF=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.ocancelAnimationFrame||this._ctTime.bind(this)}var e=t.prototype;return e.start=function(){var t=this;this._isPlaying||(60===this._targetFrameRate?this._rafHandle=this._rAF.call(window,(function e(){t._isPlaying&&(t._rafHandle=t._rAF.call(window,e)),t._onTick&&t._onTick()})):(this._startTime=performance.now(),this._stHandle=this._stTime((function e(){t._startTime=performance.now(),t._isPlaying&&(t._stHandle=t._stTime(e)),t._onTick&&t._onTick()}))),this._isPlaying=!0)},e.stop=function(){this._isPlaying&&(this._cAF.call(window,this._rafHandle),this._ctTime(this._stHandle),this._rafHandle=this._stHandle=0,this._isPlaying=!1)},e._stTime=function(t){var e=performance.now(),i=Math.max(0,e-this._startTime),n=Math.max(0,this._frameTime-i);return setTimeout(t,n)},e._ctTime=function(t){clearTimeout(t)},h(t,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(t){this._targetFrameRate!==t&&(this._targetFrameRate=t,this._frameTime=1e3/this._targetFrameRate,this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(t){this._onTick=t}}]),t}(),wL=new(function(){function t(){this._allRenderers=[],this._dirtyRenderers=[],this._dirtyVersion=0}var e=t.prototype;return e.addRenderer=function(t){-1===t._internalId&&(t._internalId=this._allRenderers.length,this._allRenderers.push(t))},e.removeRenderer=function(t){if(-1!==t._internalId){var e=t._internalId;this._allRenderers[this._allRenderers.length-1]._internalId=e,le.array.fastRemoveAt(this._allRenderers,e),t._internalId=-1,t._dirtyVersion===this._dirtyVersion&&(le.array.fastRemove(this._dirtyRenderers,t),t._dirtyVersion=-1)}},e.markDirtyRenderer=function(t){t._dirtyVersion!==this._dirtyVersion&&-1!==t._internalId&&(this._dirtyRenderers.push(t),t._dirtyVersion=this._dirtyVersion)},e.updateAllDirtyRenderers=function(){for(var t=this._dirtyRenderers.length,e=this._dirtyRenderers,i=0;ithis._startTime?(t-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=t,this._deltaTime},n._updateCallback=function(){var t=this;if(this._inited)if(dL.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var e,i=ye.querySettings(ve.Category.LAUNCH,"launchScene");i?OL.loadScene(i,(function(){var e;console.log("Success to load scene: "+i),t._initTime=performance.now(),OL.startAnimation(),null===(e=t.onStart)||void 0===e||e.call(t)})):(this._initTime=performance.now(),OL.startAnimation(),null===(e=this.onStart)||void 0===e||e.call(this))}else OL.tick(this._calculateDT());else dL.instance.update(this._calculateDT())},n.initPacer=function(){var t,e=null!==(t=ye.querySettings(ve.Category.SCREEN,"frameRate"))&&void 0!==t?t:60;U("number"==typeof e),this._pacer=new CL,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=e},n._initEvents=function(){Ha.on("show",this._onShow,this),Ha.on("hide",this._onHide,this)},n._onHide=function(){this.emit(i.EVENT_HIDE),this.pause()},n._onShow=function(){this.emit(i.EVENT_SHOW),this.resume()},n.addPersistRootNode=function(t){OL.addPersistRootNode(t)},n.removePersistRootNode=function(t){OL.removePersistRootNode(t)},n.isPersistRootNode=function(t){return OL.isPersistRootNode(t)},n._setupRenderPipeline=function(){var t=this,e=ye.querySettings(ve.Category.RENDERING,"renderPipeline");return e?new Promise((function(t,i){fy.loadAny(e,(function(e,n){return!e&&n instanceof KD?t(n):i(e)}))})).then((function(e){t._setRenderPipeline(e)})).catch((function(i){L(i),L("Failed load render pipeline: "+e+", engine failed to initialize, will fallback to default pipeline"),t._setRenderPipeline()})):this._setRenderPipeline()},n._setRenderPipeline=function(t){OL.root.setRenderPipeline(t)||this._setRenderPipeline(),this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)},n._safeEmit=function(t){this.emit(t)},h(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._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),i}(Ba));xL.EVENT_HIDE="game_on_hide",xL.EVENT_SHOW="game_on_show",xL.EVENT_LOW_MEMORY="game_on_low_memory",xL.EVENT_GAME_INITED="game_inited",xL.EVENT_ENGINE_INITED="engine_inited",xL.EVENT_RENDERER_INITED="renderer_inited",xL.EVENT_PRE_BASE_INIT="pre_base_init",xL.EVENT_POST_BASE_INIT="post_base_init",xL.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",xL.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",xL.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",xL.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",xL.EVENT_PRE_PROJECT_INIT="pre_project_init",xL.EVENT_POST_PROJECT_INIT="post_project_init",xL.EVENT_RESTART="game_on_restart",xL.RENDER_TYPE_CANVAS=0,xL.RENDER_TYPE_WEBGL=1,xL.RENDER_TYPE_OPENGL=2,xL.RENDER_TYPE_HEADLESS=3,xL.DEBUG_DT_THRESHOLD=1,b.Game=xL;var PL=t("game",b.game=new xL),DL={};et(DL,"vmath",[{name:"vec2",newName:"Vec2",target:An,targetName:"math"},{name:"vec3",newName:"Vec3",target:An,targetName:"math"},{name:"vec4",newName:"Vec4",target:An,targetName:"math"},{name:"quat",newName:"Quat",target:An,targetName:"math"},{name:"mat3",newName:"Mat3",target:An,targetName:"math"},{name:"mat4",newName:"Mat4",target:An,targetName:"math"},{name:"color4",newName:"Color",target:An,targetName:"math"},{name:"rect",newName:"Rect",target:An,targetName:"math"},{name:"approx",newName:"approx",target:An,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:An,targetName:"math"},{name:"equals",newName:"equals",target:An,targetName:"math"},{name:"clamp",newName:"clamp",target:An,targetName:"math"},{name:"clamp01",newName:"clamp01",target:An,targetName:"math"},{name:"lerp",newName:"lerp",target:An,targetName:"math"},{name:"toRadian",newName:"toRadian",target:An,targetName:"math"},{name:"toDegree",newName:"toDegree",target:An,targetName:"math"},{name:"random",newName:"random",target:An,targetName:"math"},{name:"randomRange",newName:"randomRange",target:An,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:An,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:An,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:An,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:An,targetName:"math"},{name:"repeat",newName:"repeat",target:An,targetName:"math"},{name:"pingPong",newName:"pingPong",target:An,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:An,targetName:"math"}]),b.vmath=DL,et(EL.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:EL,targetName:"Scheduler"}]),et(EL,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return KE.Priority.SCHEDULER}}]),it(EL,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),et(lB.prototype,"SubModel.prototype",[{name:"subMeshData",newName:"subMesh"}]),it(lB.prototype,"SubModel.prototype",[{name:"getSubModel",suggest:"Use `subModels[i]` instead"},{name:"subModelNum",suggest:"Use `subModels.length` instead"}]),et(bL.prototype,"Root.prototype",[{name:"ui",newName:"batcher2D"}]),nt(PL,"game",[{name:"collisionMatrix"},{name:"groupList"}]),nt(IL.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"}]),it(IL.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"}]);var BL,NL={topLeft:b.v2(0,0),topRight:b.v2(0,0),top:b.v2(0,0),bottomLeft:b.v2(0,0),bottomRight:b.v2(0,0),bottom:b.v2(0,0),center:b.v2(0,0),left:b.v2(0,0),right:b.v2(0,0),width:0,height:0,init:function(t){var e=this.width=t.width,i=this.height=t.height,n=t.x,r=t.y,s=r+i,a=n+e;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=a,this.topRight.y=s,this.top.x=n+e/2,this.top.y=s,this.bottomLeft.x=n,this.bottomLeft.y=r,this.bottomRight.x=a,this.bottomRight.y=r,this.bottom.x=n+e/2,this.bottom.y=r,this.center.x=n+e/2,this.center.y=r+i/2,this.left.x=n,this.left.y=r+i/2,this.right.x=a,this.right.y=r+i/2}};b.visibleRect=NL;var ML=new gn,LL=((BL={})[Ee.ORIENTATION_AUTO]=za.AUTO,BL[Ee.ORIENTATION_LANDSCAPE]=za.LANDSCAPE,BL[Ee.ORIENTATION_PORTRAIT]=za.PORTRAIT,BL),FL=t("View",function(t){function e(){var e;(e=t.call(this)||this)._designResolutionSize=void 0,e._scaleX=void 0,e._scaleY=void 0,e._viewportRect=void 0,e._visibleRect=void 0,e._autoFullScreen=void 0,e._retinaEnabled=void 0,e._resizeCallback=void 0,e._resolutionPolicy=void 0,e._rpExactFit=void 0,e._rpShowAll=void 0,e._rpNoBorder=void 0,e._rpFixedHeight=void 0,e._rpFixedWidth=void 0;var i=UL,n=GL;return e._designResolutionSize=new gn(0,0),e._scaleX=1,e._scaleY=1,e._viewportRect=new yn(0,0,0,0),e._visibleRect=new yn(0,0,0,0),e._autoFullScreen=!1,e._retinaEnabled=!1,e._resizeCallback=null,e._rpExactFit=new kL(i.EQUAL_TO_FRAME,n.EXACT_FIT),e._rpShowAll=new kL(i.EQUAL_TO_FRAME,n.SHOW_ALL),e._rpNoBorder=new kL(i.EQUAL_TO_FRAME,n.NO_BORDER),e._rpFixedHeight=new kL(i.EQUAL_TO_FRAME,n.FIXED_HEIGHT),e._rpFixedWidth=new kL(i.EQUAL_TO_FRAME,n.FIXED_WIDTH),e._resolutionPolicy=e._rpShowAll,e}c(e,t);var i=e.prototype;return i.init=function(){var t=Ya.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,ML.width=this._visibleRect.width,ML.height=this._visibleRect.height,NL&&NL.init(this._visibleRect),this.resizeWithBrowserSize(!0);var n=ye.querySettings(ve.Category.SCREEN,"designResolution");n&&this.setDesignResolutionSize(Number(n.width),Number(n.height),n.policy||kL.FIXED_HEIGHT),Xa.on("window-resize",this._updateAdaptResult,this),Xa.on("orientation-change",this._updateAdaptResult,this),Xa.on("fullscreen-change",this._updateAdaptResult,this)},i.resizeWithBrowserSize=function(t){Xa.handleResizeEvent=t},i.setResizeCallback=function(t){"function"!=typeof t&&null!=t||(this._resizeCallback=t)},i.setOrientation=function(t){Xa.orientation=LL[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&&Ya.requestFullScreen().catch((function(){})))},i.isAutoFullScreenEnabled=function(){return this._autoFullScreen},i.setCanvasSize=function(t,e){Xa.resolutionScale=1;var i=Xa.devicePixelRatio,n=new gn(t*i,e*i);Ya.windowSize=n},i.getCanvasSize=function(){return Ya.windowSize},i.getFrameSize=function(){var t=Xa.devicePixelRatio,e=Ya.windowSize;return e.width/=t,e.height/=t,e},i.setFrameSize=function(t,e){var i=Xa.devicePixelRatio;Ya.windowSize=new gn(t*i,e*i)},i.getVisibleSize=function(){return new gn(this._visibleRect.width,this._visibleRect.height)},i.getVisibleSizeInPixel=function(){return new gn(this._visibleRect.width*this._scaleX,this._visibleRect.height*this._scaleY)},i.getVisibleOrigin=function(){return new _n(this._visibleRect.x,this._visibleRect.y)},i.getVisibleOriginInPixel=function(){return new _n(this._visibleRect.x*this._scaleX,this._visibleRect.y*this._scaleY)},i.getResolutionPolicy=function(){return this._resolutionPolicy},i._updateResolutionPolicy=function(t){if(t instanceof kL)this._resolutionPolicy=t;else{var e=kL;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=zL.getDesignResolutionSize();zL.setDesignResolutionSize(e.width,e.height,t)},i.setDesignResolutionSize=function(t,e,i){if(t>0&&e>0){this._updateResolutionPolicy(i);var n=this._resolutionPolicy;n&&n.preApply(this),this._designResolutionSize.width=t,this._designResolutionSize.height=e;var r=n.apply(this,this._designResolutionSize);if(r.scale&&2===r.scale.length&&(this._scaleX=r.scale[0],this._scaleY=r.scale[1]),r.viewport){var s=this._viewportRect,a=this._visibleRect,o=r.viewport;s.x=o.x,s.y=o.y,s.width=o.width,s.height=o.height,a.x=0,a.y=0,a.width=o.width/this._scaleX,a.height=o.height/this._scaleY}n.postApply(this),ML.width=this._visibleRect.width,ML.height=this._visibleRect.height,NL&&NL.init(this._visibleRect),this.emit("design-resolution-changed")}else K(2200)},i.getDesignResolutionSize=function(){return new gn(this._designResolutionSize.width,this._designResolutionSize.height)},i.setRealPixelResolution=function(t,e,i){document.documentElement.style.width=t+"px",document.body.style.width=t+"px",document.body.style.left="0px",document.body.style.top="0px",this.setDesignResolutionSize(t,e,i)},i.getViewportRect=function(){return this._viewportRect},i.getScaleX=function(){return this._scaleX},i.getScaleY=function(){return this._scaleY},i.getDevicePixelRatio=function(){return Xa.devicePixelRatio},i.convertToLocationInView=function(t,e,i,n){void 0===n&&(n=new _n);var r=Xa.devicePixelRatio*(t-i.left),s=Xa.devicePixelRatio*(i.top+i.height-e);return Xa.isFrameRotated?(n.x=Ya.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(){var t;b.director.root.resize(Ya.windowSize.width,Ya.windowSize.height);var e=this._designResolutionSize.width,i=this._designResolutionSize.height;e>0&&this.setDesignResolutionSize(e,i,this._resolutionPolicy),this.emit("canvas-resize"),null===(t=this._resizeCallback)||void 0===t||t.call(this)},e}(Da(KE)));FL.instance=void 0;var UL=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=b.game.canvas;if(t){var e=Ya.windowSize;t.width=e.width,t.height=e.height}},t}();UL.EQUAL_TO_FRAME=void 0,UL.PROPORTION_TO_FRAME=void 0;var GL=function(){function t(){this.name="ContentStrategy",this._result=void 0,this._result={scale:[1,1],viewport:null}}var e=t.prototype;return e.preApply=function(){},e.apply=function(){return{scale:[1,1]}},e.postApply=function(){},e._buildResult=function(t,e,i,n,r,s){Math.abs(t-i)<2&&(i=t),Math.abs(e-n)<2&&(n=e);var a=new yn(Math.round((t-i)/2),Math.round((e-n)/2),i,n);return this._result.scale=[r,s],this._result.viewport=a,this._result},t}();GL.EXACT_FIT=void 0,GL.SHOW_ALL=void 0,GL.NO_BORDER=void 0,GL.FIXED_HEIGHT=void 0,GL.FIXED_WIDTH=void 0,function(){var t=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r1){var h=Object.create(null);e.forEach((function(t){h[t._uuid]=t})),r={isCompleted:WL,_map:h}}else r=e[0]}i&&i(t,r)}))},e.getXMLHttpRequest=function(){return new XMLHttpRequest},e.getItem=function(t){return fy.assets.has(t)?{content:fy.assets.get(t)}:null},e.loadRes=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete,u=Dl(t);u&&!gv.getInfoWithPath(t,s)&&(t=t.slice(0,-u.length)),gv.load(t,s,a,o)},e.loadResArray=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;t.forEach((function(e,i){var n=Dl(e);n&&!gv.getInfoWithPath(e,s)&&(t[i]=e.slice(0,-n.length))})),gv.load(t,s,a,o)},e.loadResDir=function(t,e,i,n){var r=this._parseLoadResArgs(e,i,n),s=r.type,a=r.onProgress,o=r.onComplete;gv.loadDir(t,s,a,(function(e,i){var n=[];e||(n=gv.getDirWithPath(t,s).map((function(t){return t.path}))),o&&o(e,i,n)}))},e.getRes=function(t,e){return el.has(t)?el.get(t):gv.get(t,e)},e.getResCount=function(){return el.count},e.getDependsRecursively=function(t){if(!t)return[];var e="string"==typeof t?t:t._uuid;return Og.getDepsRecursively(e).concat([e])},e.addDownloadHandlers=function(t){var e=Object.create(null),i=function(i){var n=t[i];e["."+i]=function(t,e,i){n({url:t},i)}};for(var n in t)i(n);Gv.register(e)},e.addLoadHandlers=function(t){var e=Object.create(null),i=function(i){var n=t[i];e["."+i]=function(t,e,i){n({content:t},i)}};for(var n in t)i(n);ny.register(e)},e.release=function(t){if(Array.isArray(t))for(var e=0;ethis._width&&(this._x=2,this._y=this._nexty),this._y+o+2>this._nexty&&(this._nexty=this._y+o+2),this._nexty>this._height)return null;b.internal.dynamicAtlasManager.textureBleeding&&((a<=8||o<=8)&&(this._texture.drawTextureAt(i.image,this._x-1,this._y-1),this._texture.drawTextureAt(i.image,this._x-1,this._y+1),this._texture.drawTextureAt(i.image,this._x+1,this._y-1),this._texture.drawTextureAt(i.image,this._x+1,this._y+1)),this._texture.drawTextureAt(i.image,this._x-1,this._y),this._texture.drawTextureAt(i.image,this._x+1,this._y),this._texture.drawTextureAt(i.image,this._x,this._y-1),this._texture.drawTextureAt(i.image,this._x,this._y+1)),this._texture.drawTextureAt(i.image,this._x,this._y),this._innerTextureInfos[i.getId()]={x:this._x,y:this._y,texture:i},this._count++,r+=this._x,s+=this._y,this._x+=a+2}var u={x:r,y:s,texture:this._texture};return this._innerSpriteFrames.push(t),u},e.deleteInnerTexture=function(t){t&&this._innerTextureInfos[t.getId()]&&(delete this._innerTextureInfos[t.getId()],this._count--)},e.isEmpty=function(){return this._count<=0},e.reset=function(){this._x=2,this._y=2,this._nexty=2;for(var t=this._innerSpriteFrames,e=0,i=t.length;e=0;i--)e=this._atlases[i],le.array.fastRemove(e._innerSpriteFrames,t);var n=t._original._texture;this.deleteAtlasTexture(n)}},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)}},h(e,[{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled!==t&&(t?(this.reset(),b.director.on(b.Director.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)):(this.reset(),b.director.off(b.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}(KE);SF.instance=void 0;var AF,RF=t("dynamicAtlasManager",SF.instance=new SF);OL.registerSystem("dynamicAtlasManager",RF,0),b.internal.dynamicAtlasManager=RF,function(t){t[t.positions=gr.ATTR_POSITION]="positions",t[t.normals=gr.ATTR_NORMAL]="normals",t[t.uvs=gr.ATTR_TEX_COORD]="uvs",t[t.colors=gr.ATTR_COLOR]="colors"}(AF||(AF={}));var bF,CF,wF,IF,OF,xF,PF=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}(),DF=function(){function t(t,e){if(this._mesh=void 0,this._subMeshRenderings=[],this._mesh=t,this._mesh.struct.morph){var i=this._mesh.struct.primitives.length;this._subMeshRenderings=new Array(i).fill(null);for(var n=0;nzp.MAX_MORPH_TARGET_COUNT?this._subMeshRenderings[n]=new NF(this._mesh,n,this._mesh.struct.morph,e):this._subMeshRenderings[n]=new BF(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?n+1:n),height:1<=65536){j(10001,_,65536);continue}l>>=1,c>>=1}o=i.createBuffer(new Mr(Dn.INDEX,Mn.DEVICE,c,l)),u=new(GF(h.stride))(e,h.offset,h.count),h.stride!==l&&(u=GF(l).from(u)),o.update(u)}var f=a.vertexBundelIndices.map((function(t){return n[t]})),d=[];if(a.vertexBundelIndices.length>0)for(var p=a.vertexBundelIndices[0],m=t._struct.vertexBundles[p].attributes,g=0;g=this._struct.primitives.length)j(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&&(p.set(m),g.update(m,d)),c.view.count=f,u.vertexCount=f}if(a.indexView){var v=a.indexView,E=v.stride,T=2===E?e.indices16.length:e.indices32.length,S=T*E,A=new Uint8Array(this._data.buffer,v.offset,S),R=2===E?new Uint8Array(e.indices16.buffer,e.indices16.byteOffset,S):new Uint8Array(e.indices32.buffer,e.indices32.byteOffset,S),b=o.indexBuffer;s.maxSubMeshIndices,S>0&&(A.set(R),b.update(R,S)),v.count=T,u.indexCount=T}if(e.minPos&&e.maxPos){var C=new ji(e.minPos.x,e.minPos.y,e.minPos.z),w=new ji(e.maxPos.x,e.maxPos.y,e.maxPos.z);r.bounds[t]||(r.bounds[t]=new Fu),Fu.fromPoints(r.bounds[t],C,w);for(var I,O=new ji,x=new ji,P=y(r.bounds);!(I=P()).done;){var D=I.value;D&&(D.getBoundary(O,x),ji.min(C,O,C),ji.max(w,x,w))}this._struct.minPosition=new ji(C.x,C.y,C.z),this._struct.maxPosition=new ji(w.x,w.y,w.z)}o.invalidateGeometricInfo()}else j(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)){ji.transformMat4(zF,kF,n[d]),i[d]=!0;var p=e[d];ji.min(p.center,p.center,zF),ji.max(p.halfExtents,p.halfExtents,zF)}}}}for(var m=0;m=this._struct.primitives.length)return null;var e=this._struct.primitives[t];if(!e.indexView)return null;var i=e.indexView.stride;return new(1===i?Uint8Array:2===i?Uint16Array:Uint32Array)(this._data.buffer,e.indexView.offset,e.indexView.count)},i.copyIndices=function(t,e){if(t>=this._struct.primitives.length)return!1;var i=this._struct.primitives[t];if(!i.indexView)return!1;for(var n=i.indexView.count,r=1===i.indexView.stride?On.R8UI:2===i.indexView.stride?On.R16UI:On.R32UI,s=YF(new DataView(this._data.buffer),r),a=0;a=this._struct.primitives.length))for(var n,r=y(this._struct.primitives[t].vertexBundelIndices);!(n=r()).done;){var s=n.value,a=this._struct.vertexBundles[s],o=a.attributes.findIndex((function(t){return t.name===e}));if(!(o<0)){i(a,o);break}}},i._createVertexBuffers=function(t,e){return this._struct.vertexBundles.map((function(i){var n=t.createBuffer(new Mr(Dn.VERTEX,Mn.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:HF})},i.releaseData=function(){this._data=HF},h(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=Vs(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}(Wl),wF=T((CF=xF).prototype,"_struct",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return{vertexBundles:[],primitives:[]}}}),IF=T(CF.prototype,"_hash",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),OF=T(CF.prototype,"_allowDataAccess",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),bF=CF))||bF;function WF(t,e){for(var i=0,n=0;n0){if(n=null,t.attributes)for(var h,l=y(t.attributes);!(h=l()).done;){var c=h.value;if(c.name===gr.ATTR_POSITION){n=c;break}}n||(n=JF[0]),r.push(n);var _=As[n.format];o=Math.max(o,Math.floor(u.length/_.count)),a.push({offset:s,data:u,attribute:n}),s+=_.size}if(t.normals&&t.normals.length>0){if(n=null,t.attributes)for(var f,d=y(t.attributes);!(f=d()).done;){var p=f.value;if(p.name===gr.ATTR_NORMAL){n=p;break}}n||(n=JF[1]);var m=As[n.format];r.push(n),o=Math.max(o,Math.floor(t.normals.length/m.count)),a.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 g,v=y(t.attributes);!(g=v()).done;){var E=g.value;if(E.name===gr.ATTR_TEX_COORD){n=E;break}}n||(n=JF[2]);var T=As[n.format];r.push(n),o=Math.max(o,Math.floor(t.uvs.length/T.count)),a.push({offset:s,data:t.uvs,attribute:n}),s+=T.size}if(t.tangents&&t.tangents.length>0){if(n=null,t.attributes)for(var S,A=y(t.attributes);!(S=A()).done;){var R=S.value;if(R.name===gr.ATTR_TANGENT){n=R;break}}n||(n=JF[3]);var b=As[n.format];r.push(n),o=Math.max(o,Math.floor(t.tangents.length/b.count)),a.push({offset:s,data:t.tangents,attribute:n}),s+=b.size}if(t.colors&&t.colors.length>0){if(n=null,t.attributes)for(var C,w=y(t.attributes);!(C=w()).done;){var I=C.value;if(I.name===gr.ATTR_COLOR){n=I;break}}n||(n=JF[4]);var O=As[n.format];r.push(n),o=Math.max(o,Math.floor(t.colors.length/O.count)),a.push({offset:s,data:t.colors,attribute:n}),s+=O.size}if(t.customAttributes)for(var x=0;xt.width?(K(3300,this.name+"/"+t.name,i,t.width),!1):!(n>t.height&&(K(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&&RF&&RF.deleteAtlasSpriteFrame(this),t.prototype.destroy.call(this)},i._calculateSlicedUV=function(){var t=this._rect,i=this.texture,n=i.width,r=i.height,s=this._capInsets[0],a=this._capInsets[2],o=t.width-s-a,u=this._capInsets[1],h=this._capInsets[3],l=t.height-u-h,c=this.uvSliced;if(c.length=0,this._rotated){uU[0].u=t.x/n,uU[1].u=(t.x+h)/n,uU[2].u=(t.x+h+l)/n,uU[3].u=(t.x+t.height)/n,uU[3].v=t.y/r,uU[2].v=(t.y+s)/r,uU[1].v=(t.y+s+o)/r,uU[0].v=(t.y+t.width)/r;for(var _=0;_<4;++_)for(var f=uU[_],d=0;d<4;++d){var p=uU[3-d];c.push({u:f.u,v:p.v})}}else{uU[0].u=t.x/n,uU[1].u=(t.x+s)/n,uU[2].u=(t.x+s+o)/n,uU[3].u=(t.x+t.width)/n,uU[3].v=t.y/r,uU[2].v=(t.y+u)/r,uU[1].v=(t.y+u+l)/r,uU[0].v=(t.y+t.height)/r;for(var m=0;m<4;++m)for(var g=uU[m],v=0;v<4;++v){var y=uU[v];c.push({u:y.u,v:g.v})}}this.emit(e.EVENT_UV_UPDATED,this)},i._calculateUV=function(){var t=this._rect,e=this.uv,i=this.unbiasUV,n=this.texture,r=n.width,s=n.height;if(this._rotated){var a=0===r?0:t.x/r,o=0===r?1:(t.x+t.height)/r,u=0===s?0:t.y/s,h=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=o,e[1]=h,e[2]=o,e[3]=u,e[4]=a,e[5]=h,e[6]=a,e[7]=u):this._isFlipUVX?(e[0]=o,e[1]=u,e[2]=o,e[3]=h,e[4]=a,e[5]=u,e[6]=a,e[7]=h):this._isFlipUVY?(e[0]=a,e[1]=h,e[2]=a,e[3]=u,e[4]=o,e[5]=h,e[6]=o,e[7]=u):(e[0]=a,e[1]=u,e[2]=a,e[3]=h,e[4]=o,e[5]=u,e[6]=o,e[7]=h);var l=0===r?0:t.x/r,c=0===r?1:(t.x+t.height)/r,_=0===s?0:t.y/s,f=0===s?1:(t.y+t.width)/s;this._isFlipUVX&&this._isFlipUVY?(i[0]=c,i[1]=f,i[2]=c,i[3]=_,i[4]=l,i[5]=f,i[6]=l,i[7]=_):this._isFlipUVX?(i[0]=c,i[1]=_,i[2]=c,i[3]=f,i[4]=l,i[5]=_,i[6]=l,i[7]=f):this._isFlipUVY?(i[0]=l,i[1]=f,i[2]=l,i[3]=_,i[4]=c,i[5]=f,i[6]=c,i[7]=_):(i[0]=l,i[1]=_,i[2]=l,i[3]=f,i[4]=c,i[5]=_,i[6]=c,i[7]=f)}else{var d=0===r?0:t.x/r,p=0===r?1:(t.x+t.width)/r,m=0===s?1:(t.y+t.height)/s,g=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(e[0]=p,e[1]=g,e[2]=d,e[3]=g,e[4]=p,e[5]=m,e[6]=d,e[7]=m):this._isFlipUVX?(e[0]=p,e[1]=m,e[2]=d,e[3]=m,e[4]=p,e[5]=g,e[6]=d,e[7]=g):this._isFlipUVY?(e[0]=d,e[1]=g,e[2]=p,e[3]=g,e[4]=d,e[5]=m,e[6]=p,e[7]=m):(e[0]=d,e[1]=m,e[2]=p,e[3]=m,e[4]=d,e[5]=g,e[6]=p,e[7]=g);var v=0===r?0:t.x/r,y=0===r?1:(t.x+t.width)/r,E=0===s?1:(t.y+t.height)/s,T=0===s?0:t.y/s;this._isFlipUVX&&this._isFlipUVY?(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._isFlipUVX?(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._isFlipUVY?(i[0]=v,i[1]=T,i[2]=y,i[3]=T,i[4]=v,i[5]=E,i[6]=y,i[7]=E):(i[0]=v,i[1]=E,i[2]=y,i[3]=E,i[4]=v,i[5]=T,i[6]=y,i[7]=T)}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=RF;if(t){var e=this._texture;if(e instanceof qg&&!e.isCompressed){var i=this.width,n=this.height;!e.image||i>t.maxFrameSize||n>t.maxFrameSize?this._packable=!1:e.image&&e.image instanceof HTMLCanvasElement&&(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=new _n(n.x,n.y));var r=e.originalSize;e.originalSize&&(this._originalSize=new gn(r.width,r.height)),this._rotated=!!e.rotated,this._name=e.name,this._packable=!!e.packable,this._pixelsToUnit=e.pixelsToUnit;var s=e.pivot;s&&(this._pivot=new _n(s.x,s.y)),this._meshType=e.meshType;var a=e.capInsets;a&&(this._capInsets[0]=a[0],this._capInsets[1]=a[1],this._capInsets[2]=a[2],this._capInsets[3]=a[3]);var o=e.vertices;if(o){this.vertices||(this.vertices={rawPosition:[],positions:[],indexes:o.indexes,uv:o.uv,nuv:o.nuv,minPos:new ji(o.minPos.x,o.minPos.y,o.minPos.z),maxPos:new ji(o.maxPos.x,o.maxPos.y,o.maxPos.z)}),this.vertices.rawPosition.length=0;for(var u=o.rawPosition,h=0;h0){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,NU.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),FU=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûа-яА-ЯЁё]+|\S)/,UU=/^[!,.:;'}\]%\?>、‘“》?。,!]/,GU=/([a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+|\S)$/,kU=/[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]+$/,zU=/^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôûаíìÍÌïÁÀáàÉÈÒÓòóŐőÙÚŰúűñÑæÆœŒÃÂãÔõěščřžýáíéóúůťďňĚŠČŘŽÁÍÉÓÚŤżźśóńłęćąŻŹŚÓŃŁĘĆĄ-яА-ЯЁёáàảạãăắằẳẵặâấầẩẫậéèẻẽẹêếềểễệiíìỉĩịóòỏõọôốồổỗộơớờởỡợúùủũụưứừửữựýỳỷỹỵđÁÀẢẠÃĂẮẰẲẴẶÂẤẦẨẪẬÉÈẺẼẸÊẾỀỂỄỆIÍÌỈĨỊÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢÚÙỦŨỤƯỨỪỬỮỰÝỲỶỸỴĐ]/;function HU(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 VU(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 WU(t,e,i){var n=(i||t.font)+"🎮"+e,r=LU.get(n);if(null!==r)return r;var s=t.measureText(e),a=s&&s.width||0;return LU.put(n,a),a}function XU(t,e,i){var n=e,r=i,s=t[e];if(s>="\udc00"&&s<="\udfff"&&n--,void 0!==i)if(i-1!==e){var a=t[i-1];a>="\ud800"&&a<="\udbff"&&r--}else s>="\ud800"&&s<="\udbff"&&r++;return t.substring(n,r)}function jU(t){return zU.exec(t)}function YU(t){return kU.exec(t)}function KU(t,e,i,n){var r=[];if(0===t.length||i<0)return r.push(""),r;for(var s=t;e>i&&s.length>1;){for(var a=s.length*(i/e)|0,o=XU(s,a),u=e-n(o),h=o,l=0,c=0;u>i&&c++<100;)a*=i/u,u=e-n(o=XU(s,a|=0));for(c=0;o&&u<=i&&c++<100;){var _=FU.exec(o);h=o,u=e-n(o=XU(s,a+=l=_?_[0].length:1))}0==(a-=l)?(a=1,h=XU(s,1)):1===a&&s[0]>="\ud800"&&s[0]<="\udbff"&&(a=2,h=XU(s,2));var f=XU(s,0,a),d=void 0;UU.test(h||o)&&(0==(a-=(d=GU.exec(f))?d[0].length:0)&&(a=1),h=XU(s,a),f=XU(s,0,a)),zU.test(h)&&(d=kU.exec(f))&&f!==d[0]&&(h=XU(s,a-=d[0].length),f=XU(s,0,a)),(0===r.length||(f=f.trim()).length>0)&&r.push(f),e=n(s=h||o)}return(0===r.length||(s=s.trim()).length>0)&&r.push(s),r}var qU,QU=t("CanvasPool",function(){function t(){this.pool=[]}t.getInstance=function(){return MU||(MU=new t),MU};var e=t.prototype;return e.get=function(){var t=this.pool.pop();if(!t){var e=document.createElement("canvas"),i=e.getContext("2d");t={canvas:e,context:i}}return t},e.put=function(t){this.pool.length>=Ee.MAX_LABEL_CANVAS_POOL_SIZE||this.pool.push(t)},t}()),ZU=Gi.WHITE.clone(),JU=function(){this.u=0,this.v=0,this.w=0,this.h=0,this.texture=null,this.offsetX=0,this.offsetY=0,this.valid=!1,this.xAdvance=0},$U="rgba(255, 255, 255, "+(1/255).toFixed(3)+")",tG=function(){function t(t,e){this.image=null,this.labelInfo=void 0,this.char=void 0,this.data=null,this.canvas=null,this.context=null,this.width=0,this.height=0,this.offsetY=0,this.hash=void 0,this.char=t,this.labelInfo=e,this.hash=t.charCodeAt(0)+e.hash}var e=t.prototype;return e.updateRenderData=function(){this._updateProperties(),this._updateTexture()},e.destroy=function(){this.image=null,QU.getInstance().put(this.data)},e._updateProperties=function(){if(this.data=QU.getInstance().get(),this.canvas=this.data.canvas,this.context=this.data.context,this.context){this.context.font=this.labelInfo.fontDesc;var t=WU(this.context,this.char,this.labelInfo.fontDesc),e=2*this.labelInfo.margin+2;this.width=parseFloat(t.toFixed(2))+e,this.height=(1+DU)*this.labelInfo.fontSize+e,this.offsetY=-this.labelInfo.fontSize*DU/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 Ag),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;t.textAlign="center",t.textBaseline="alphabetic",t.clearRect(0,0,i,n),t.fillStyle=$U,t.fillRect(0,0,i,n),t.font=e.fontDesc;var r=e.fontSize,s=i/2,a=n/2+r*BU+0*r,o=e.color;if(t.lineJoin="round",t.fillStyle="rgba("+o.r+", "+o.g+", "+o.b+", 1)",e.isOutlined){var u=e.out||ZU;t.strokeStyle="rgba("+u.r+", "+u.g+", "+u.b+", "+u.a/255+")",t.lineWidth=2*e.margin,t.strokeText(this.char,s,a)}t.fillText(this.char,s,a)}},t}(),eG=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.initWithSize=function(t,e,i){void 0===i&&(i=eg.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 Ir;s.texOffset.x=e,s.texOffset.y=i,s.texExtent.width=t.width,s.texExtent.height=t.height,r.copyTexImagesToTexture([t.data],n,[s])}else console.warn("Unable to get device")}},e}(qg),iG=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 eG;i.initWithSize(t,e),this.fontDefDictionary=new OU(i),this._halfBleed=1,this._width=t,this._height=e,OL.on(IL.EVENT_BEFORE_SCENE_LAUNCH,this.beforeSceneLoad,this)}var e=t.prototype;return e.insertLetterTexture=function(t){var e=t.image,i=OL.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 j(12100),null;this.fontDefDictionary.texture.drawTextureAt(e,this._x,this._y),this._dirty=!0;var s=new JU;return s.u=this._x+this._halfBleed,s.v=this._y+this._halfBleed,s.texture=this.fontDefDictionary.texture,s.valid=!0,s.w=t.width-2,s.h=t.height-2,s.xAdvance=s.w,s.offsetY=t.offsetY,this._x+=n+0,this.fontDefDictionary.addLetterDefinitions(t.hash,s),s},e.update=function(){this._dirty&&(this._dirty=!1)},e.reset=function(){this._x=0,this._y=0,this._nextY=0,this.fontDefDictionary.clear()},e.destroy=function(){this.reset(),this.fontDefDictionary&&(this.fontDefDictionary.texture.destroy(),this.fontDefDictionary.texture=null)},e.getTexture=function(){return this.fontDefDictionary.getTexture()},e.beforeSceneLoad=function(){this.clearAllCache()},e.clearAllCache=function(){this.destroy();var t=new eG;t.initWithSize(this._width,this._height),this.fontDefDictionary.texture=t},e.getLetter=function(t){return this.fontDefDictionary.letterDefinitions[t]},e.getLetterDefinitionForChar=function(t,e){var i=t.charCodeAt(0)+e.hash,n=this.fontDefDictionary.letterDefinitions[i];if(!n){var r=new tG(t,e);r.updateRenderData(),n=this.insertLetterTexture(r),r.destroy()}return n},h(t,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(),nG={fontAtlas:null,fontSize:0,lineHeight:0,hAlign:0,vAlign:0,hash:"",fontFamily:"",fontDesc:"Arial",color:Gi.WHITE.clone(),isOutlined:!1,out:Gi.WHITE.clone(),margin:0},rG=[new Jr(gr.ATTR_POSITION,On.RGB32F)],sG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_COLOR,On.RGBA32F)],aG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F),new Jr(gr.ATTR_COLOR,On.RGBA32F)],oG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F),new Jr(gr.ATTR_COLOR,On.RGBA8,!0)],uG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F),new Jr(gr.ATTR_COLOR,On.RGBA32F),new Jr(gr.ATTR_COLOR2,On.RGBA32F)],hG=[new Jr(gr.ATTR_POSITION,On.RGB32F),new Jr(gr.ATTR_TEX_COORD,On.RG32F),new Jr(gr.ATTR_COLOR,On.RGBA8,!0),new Jr(gr.ATTR_COLOR2,On.RGBA8,!0)];function lG(t){for(var e=0,i=0;i>2,this._initVDataCount,this._floatsPerVertex,J(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){for(var t=Qa.__isWebIOS14OrIPadOS14Env?this._nextFreeIAHandle:1,e=this.byteOffset,i=this.indexOffset,n=0;n>2),a=new Uint16Array(this.iData.buffer,0,i),o=r.vertexBuffers[0];e>o.size&&o.resize(e),o.update(s),2*i>r.indexBuffer.size&&r.indexBuffer.resize(2*i),r.indexBuffer.update(a)}this.dirty=!1}},t.createNewIA=function(t){var e,i,n;if(Qa.__isWebIOS14OrIPadOS14Env||!this._iaPool[0]){var r=this._vertexFormatBytes=this._floatsPerVertex*Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT,a=t.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,r,r));n=t.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.HOST|Mn.DEVICE,s,s)),i=[a],this._iaInfo=new ts(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}},h(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}()),yG=function(){function t(t,e){this._device=null,this._attributes=null,this._vertexFormatBytes=void 0,this._floatsPerVertex=void 0,this._buffers=[],this._device=t,this._attributes=e,this._floatsPerVertex=cG(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},h(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexFormatBytes",get:function(){return this._vertexFormatBytes}},{key:"floatsPerVertex",get:function(){return this._floatsPerVertex}}]),t}(),EG=new da((function(){return{offset:0,length:0}}),32),TG=function(){function t(t,e,i,n,r,s){this._ib=void 0,this.vertexAccessor=t,this.bufferId=e,this.meshBuffer=i,this.vertexOffset=n,this.vb=r,this.indexCount=s,this._ib=new Uint16Array(s),t.getMeshBuffer(e)}return t.prototype.setIndexBuffer=function(){},h(t,[{key:"ib",get:function(){return this._ib}}]),t}(),SG=function(t){function e(i,n,r,s){var a;return(a=t.call(this,i,n)||this)._freeLists=[],a._vCount=0,a._iCount=0,a._id=0,a._vCount=r||Math.floor(1024*Ee.BATCHER2D_MEM_INCREMENT/a._vertexFormatBytes),a._iCount=s||a._vCount*e.IB_SCALE,a._id=e.generateID(),a._allocateBuffer(),a}c(e,t);var i=e.prototype;return i.destroy=function(){for(var e=0;e=n){o=i[h],s=u,a=h;break}if(o)break}if(o||(s=this._allocateBuffer(),(r=this._buffers[s])&&r.checkCapacity(t,e)&&(a=0,o=this._freeLists[s][a])),o){var l=o.offset/this.vertexFormatBytes,c=new Float32Array(r.vData.buffer,o.offset,n>>2).fill(0);return this._allocateChunkFromEntry(s,a,o,n),new TG(this,s,r,l,c,e)}return K(9004,n),null},i.recycleChunk=function(t){var e=this._freeLists[t.bufferId],i=this._buffers[t.bufferId],n=t.vertexOffset*this.vertexFormatBytes,r=t.vb.byteLength;if(0!==r){for(var s=!1,a=0,o=null,u=e[a];u&&u.offset=0,9004,t,i.offset,i.length),0===r?(this._freeLists[t].splice(e,1),EG.free(i)):(i.offset+=n,i.length=r)},i._allocateBuffer=function(){Z(this._buffers.length===this._freeLists.length,9003);var t=new vG,e=this._vCount*this._floatsPerVertex;t.initialize(this._device,this._attributes,e,this._iCount),this._buffers.push(t);var i=EG.alloc();i.offset=0,i.length=t.vData.byteLength;var n=[i];return this._freeLists.push(n),OL.root.batcher2D.syncMeshBuffersToNative(this.id,this._buffers),this._buffers.length-1},e.generateID=function(){return e.ID_COUNT++},h(e,[{key:"id",get:function(){return this._id}}]),e}(yG);SG.IB_SCALE=4,SG.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"}(_G||(_G={})),function(t){t[t.BufferID=0]="BufferID",t[t.AccessorID=1]="AccessorID",t[t.Count=2]="Count"}(fG||(fG={})),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"}(dG||(dG={})),function(t){t[t.COMP=0]="COMP",t[t.MODEL=1]="MODEL",t[t.MIDDLEWARE=2]="MIDDLEWARE",t[t.SUB_NODE=3]="SUB_NODE"}(pG||(pG={})),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=pG.COMP,this._subNode=null,this._uint8SharedBuffer=void 0,this._uint16SharedBuffer=void 0,this._uint32SharedBuffer=void 0,this.init(t);var e=this._nativeObj.getAttrSharedBufferForJS(),i=0;this._uint8SharedBuffer=new Uint8Array(e,i,_G.Count),i+=_G.Count*Uint8Array.BYTES_PER_ELEMENT,this._uint16SharedBuffer=new Uint16Array(e,i,fG.Count),i+=fG.Count*Uint16Array.BYTES_PER_ELEMENT,this._uint32SharedBuffer=new Uint32Array(e,i,dG.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(){},h(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"}(mG||(mG={})),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"}(gG||(gG={}));var AG,RG,bG,CG,wG,IG=t("StencilManager",function(){function t(){this._maskStack=[],this._stencilPattern={stencilTest:!0,func:Wn.ALWAYS,stencilMask:65535,writeMask:65535,failOp:Xn.KEEP,zFailOp:Xn.KEEP,passOp:Xn.KEEP,ref:1},this._stage=mG.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!==mG.ENTER_LEVEL?mG.CLEAR_INVERTED:mG.CLEAR},e.enableMask=function(){this.stage=mG.ENABLED},e.exitMask=function(){0!==this._maskStack.length&&(this._maskStack.pop(),0===this._maskStack.length?this.stage=mG.DISABLED:this.stage=mG.ENABLED)},e.getWriteMask=function(){return 1<>2,ck=new da((function(){return{x:0,y:0,z:0,u:0,v:0,color:Gi.WHITE.clone()}}),128),_k=t("BaseRenderData",function(){function t(t){void 0===t&&(t=aG),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=aG,this._drawInfoType=pG.COMP,this._multiOwner=!1,this._batcher=null,this._floatStride=t===aG?lk:cG(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=pG.COMP)},e.removeRenderDrawInfo=function(){},e.setRenderDrawInfoAttributes=function(){},h(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=OL.root.batcher2D),this._batcher}}]),t}()),fk=t("RenderData",function(t){function e(e,i){var n;return void 0===e&&(e=aG),(n=t.call(this,e)||this)._vertDirty=!0,n._textureHash=0,n.indices=null,n.layer=0,n.nodeDirty=!0,n.passDirty=!0,n.textureDirty=!0,n.hashDirty=!0,n._data=[],n._pivotX=0,n._pivotY=0,n._width=0,n._height=0,n._frame=null,n._accessor=null,n.vertexRow=1,n.vertexCol=1,i||(i=n.batcher.switchBufferAccessor(n._vertexFormat)),n._accessor=i,n}c(e,t),e.add=function(t,i){void 0===t&&(t=aG);var n=new e(t,i);return i||(i=OL.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=Vs(t,666),this.hashDirty=!1},i.updateRenderData=function(t,e){if(this.passDirty&&(this.material=t.getRenderMaterial(0),this.passDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&this._renderDrawInfo.setMaterial(this.material)),this.nodeDirty){var i=t.node.scene?t._getRenderScene():null;this.layer=t.node.layer,null!==i&&(this.nodeDirty=!1),this.hashDirty=!0}this.textureDirty&&(this.frame=e,this.textureHash=e.getHash(),this.textureDirty=!1,this.hashDirty=!0,this._renderDrawInfo&&(this._renderDrawInfo.setTexture(this.frame?this.frame.getGFXTexture():null),this._renderDrawInfo.setSampler(this.frame?this.frame.getGFXSampler():null))),this.hashDirty&&(this.updateHash(),this._renderDrawInfo&&this._renderDrawInfo.setDataHash(this.dataHash))},i.updateSizeNPivot=function(t,e,i,n){t===this._width&&e===this._height&&i===this._pivotX&&n===this._pivotY||(this._width=t,this._height=e,this._pivotX=i,this._pivotY=n,this.vertDirty=!0)},i.clear=function(){this.resize(0,0),this._data.length=0,this._pivotX=0,this._pivotY=0,this._width=0,this._height=0,this.indices=null,this.vertDirty=!0,this.material=null,this.nodeDirty=!0,this.passDirty=!0,this.textureDirty=!0,this.hashDirty=!0,this.layer=0,this.frame=null,this.textureHash=0,this.dataHash=0},e.createStaticVBAccessor=function(t,e,i){var n=OL.root.device;return new SG(n,t,e,i)},h(e,[{key:"dataLength",get:function(){return this._data.length},set:function(t){var e=this._data;if(e.length!==t){var i=e.length,n=0;for(n=t;n>2,i._vertexFormat=t,i},e.remove=function(t){t.clear()};var i=e.prototype;return i.request=function(t,e){var i=this._byteLength+t*this.stride;return!!this.reserve(t,e)&&(this._vc+=t,this._ic+=e,this._byteLength=i,this.vertexRange=this._vc,this.indexRange=this._ic,!0)},i.reserve=function(t,e){var i=this._byteLength+t*this.stride,n=this.indexCount+e;if(t+this.vertexCount>65535)return!1;var r=this.vData.byteLength,s=this.iData.length,a=this.vData.length,o=this.iData.length;if(i>r||n>s){for(;r=0&&e>=0&&i<=this.vData.byteLength&&this.iData.length,this._vc=t,this._ic=e,this._byteLength=i,this.updateRange(0,t,0,e)},i.updateRange=function(t,e,i,n){e>=0&&n>=0&&e<=this._vc&&this._ic,this.vertexStart=t,this.indexStart=i,this.vertexRange=e,this.indexRange=n},i.requestIA=function(t){this._initIAInfo(t);var e=this._iaPool.add();return e.firstIndex=this.indexStart,e.indexCount=this.indexRange,e},i.uploadBuffers=function(){if(0!==this._byteLength&&this._vertexBuffers[0]&&this._indexBuffer){var t=this._ic,e=new Float32Array(this.vData.buffer,0,this._byteLength>>2),i=new Uint16Array(this.iData.buffer,0,t),n=this._vertexBuffers[0];this._byteLength>n.size&&n.resize(this._byteLength),n.update(e);var r=t<<1;r>this._indexBuffer.size&&this._indexBuffer.resize(r),this._indexBuffer.update(i)}},i.freeIAPool=function(){this._iaPool&&this._iaPool.reset()},i.reset=function(){this._vc=0,this._ic=0,this._byteLength=0,this.vertexStart=0,this.vertexRange=0,this.indexStart=0,this.indexRange=0,this.lastFilledIndex=0,this.lastFilledVertex=0,this.material=null,this.freeIAPool()},i.clear=function(){this.reset(),this._iaPool&&this._iaPool.destroy(),this._vertexBuffers[0]&&(this._vertexBuffers[0].destroy(),this._vertexBuffers=[]),this._iaInfo=null,this.vData=new Float32Array(256*this.stride),this.iData=new Uint16Array(1536)},i._initIAInfo=function(t){var e=this;if(!this._iaInfo){var i=this.stride,n=this._vertexBuffers;n.length||n.push(t.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.DEVICE,i,i)));var r=Uint16Array.BYTES_PER_ELEMENT;this._indexBuffer||(this._indexBuffer=t.createBuffer(new Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.DEVICE,r,r))),this._iaInfo=new ts(this._vertexFormat,n,this._indexBuffer),this._iaPool=new pa((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(){},h(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}(_k)),pk=(new pa((function(){return new dk}),32),new _n),mk=new _n,gk=new ji,vk=new un,yk=new un,Ek=new un,Tk=new un(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Sk=new yn,Ak=function(e){return t({UITransform:e,UITransformComponent:e}),e}((OG=_h("cc.UITransform"),xG=xh(),PG=dh(110),DG=Ch(),BG=zh(),NG=Mh(),MG=zh(),LG=Mh(),OG(FG=xG(FG=PG(FG=DG(FG=ph(FG=bh((HG=zG=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&r.y>=0&&r.x<=e&&r.y<=i&&(c=this._maskTest(n)),c)return!0}}}return!1},i.hitTest=function(t){for(var e=this._contentSize.width,i=this._contentSize.height,n=gk,r=pk,s=mk,a=this._getRenderScene().cameras,o=0;o=0&&s.y>=0&&s.x<=e&&s.y<=i&&(h=this._maskTest(r)),h)return!0}}return!1},i._maskTest=function(t){var e,i,n=null===(e=this.node)||void 0===e||null===(i=e.eventProcessor)||void 0===i?void 0:i.maskList;if(n)for(var r=this.node,s=n.length,a=0,o=0;r&&ou.index){n.length=o;break}}return!0},i.convertToNodeSpaceAR=function(t,e){return this.node.getWorldMatrix(Ek),un.invert(vk,Ek),e||(e=new ji),ji.transformMat4(e,t,vk)},i.convertToWorldSpaceAR=function(t,e){return this.node.getWorldMatrix(Ek),e||(e=new ji),ji.transformMat4(e,t,Ek)},i.getBoundingBox=function(){un.fromRTS(yk,this.node.getRotation(),this.node.getPosition(),this.node.getScale());var t=this._contentSize.width,e=this._contentSize.height,i=new yn(-this._anchorPoint.x*t,-this._anchorPoint.y*e,t,e);return i.transformMat4(yk),i},i.getBoundingBoxToWorld=function(){return this.node.parent?(this.node.parent.getWorldMatrix(Ek),this.getBoundingBoxTo(Ek)):this.getBoundingBox()},i.getBoundingBoxTo=function(t){un.fromRTS(yk,this.node.getRotation(),this.node.getPosition(),this.node.getScale());var i=this._contentSize.width,n=this._contentSize.height,r=new yn(-this._anchorPoint.x*i,-this._anchorPoint.y*n,i,n);if(un.multiply(Ek,t,yk),r.transformMat4(Ek),!this.node.children)return r;for(var s,a=y(this.node.children);!(s=a()).done;){var o=s.value;if(o&&o.active){var u=o.getComponent(e);if(u){var h=u.getBoundingBoxTo(t);h&&yn.union(r,r,h)}}}return r},i.getComputeAABB=function(t){var e=this._contentSize.width,i=this._contentSize.height;Sk.set(-this._anchorPoint.x*e,-this._anchorPoint.y*i,e,i),Sk.transformMat4(this.node.worldMatrix);var n=Sk.x+.5*Sk.width,r=Sk.y+.5*Sk.height,s=this.node.worldPosition.z,a=Sk.width/2,o=Sk.height/2;return null!=t?(Fu.set(t,n,r,s,a,o,.001),t):new Fu(n,r,s,a,o,.001)},i._parentChanged=function(){this.node.getComponent("cc.RenderRoot2D")||this.node.parent&&e.insertChangeMap(this.node.parent)},i._markRenderDataDirty=function(){var t=this.node._uiProps.uiComp;t&&t.markForUpdateRenderData()},e.insertChangeMap=function(t){var i=t.uuid;e.priorityChangeNodeMap.has(i)||e.priorityChangeNodeMap.set(i,t)},e._sortChildrenSibling=function(t){var e=t.children;e&&e.sort((function(t,e){var i=t._uiProps.uiTransformComp,n=e._uiProps.uiTransformComp,r=(i?i._priority:0)-(n?n._priority:0);return 0===r?t.getSiblingIndex()-e.getSiblingIndex():r}))},e._sortSiblings=function(){e.priorityChangeNodeMap.forEach((function(t){e._sortChildrenSibling(t),t._updateSiblingIndex(),t.emit("childrenSiblingOrderChanged")})),e.priorityChangeNodeMap.clear()},e._cleanChangeMap=function(){e.priorityChangeNodeMap.clear()},h(e,[{key:"contentSize",get:function(){return this._contentSize},set:function(t){this._contentSize.equals(t)||(this._contentSize.set(t),this.node.emit(aE.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"width",get:function(){return this._contentSize.width},set:function(t){this._contentSize.width!==t&&(this._contentSize.width=t,this.node.emit(aE.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"height",get:function(){return this._contentSize.height},set:function(t){this.contentSize.height!==t&&(this._contentSize.height=t,this.node.emit(aE.SIZE_CHANGED),this._markRenderDataDirty())}},{key:"anchorPoint",get:function(){return this._anchorPoint},set:function(t){this._anchorPoint.equals(t)||(this._anchorPoint.set(t),this.node.emit(aE.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorX",get:function(){return this._anchorPoint.x},set:function(t){this._anchorPoint.x!==t&&(this._anchorPoint.x=t,this.node.emit(aE.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"anchorY",get:function(){return this._anchorPoint.y},set:function(t){this._anchorPoint.y!==t&&(this._anchorPoint.y=t,this.node.emit(aE.ANCHOR_CHANGED,this._anchorPoint),this._markRenderDataDirty())}},{key:"priority",get:function(){return this._priority},set:function(t){this._priority!==t&&(this.node.getComponent("cc.RenderRoot2D")?j(6706):(this._priority=t,this.node.parent&&e.insertChangeMap(this.node.parent)))}},{key:"visibility",get:function(){var t=OL.root.batcher2D.getFirstRenderCamera(this.node);return t?t.visibility:0}},{key:"cameraPriority",get:function(){var t=OL.root.batcher2D.getFirstRenderCamera(this.node);return t?t.priority:0}}]),e}(bc),zG.EventType=aE,zG.priorityChangeNodeMap=new Map,T((UG=HG).prototype,"contentSize",[BG,NG],Object.getOwnPropertyDescriptor(UG.prototype,"contentSize"),UG.prototype),T(UG.prototype,"anchorPoint",[MG,LG],Object.getOwnPropertyDescriptor(UG.prototype,"anchorPoint"),UG.prototype),GG=T(UG.prototype,"_contentSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(100,100)}}),kG=T(UG.prototype,"_anchorPoint",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new _n(.5,.5)}}),FG=UG))||FG)||FG)||FG)||FG)||FG)||FG));OL.on(IL.EVENT_AFTER_UPDATE,Ak._sortSiblings),OL.on(IL.EVENT_BEFORE_SCENE_LAUNCH,Ak._cleanChangeMap),pe(jn),function(t){t[t.ADD_COLOR=0]="ADD_COLOR",t[t.ADD_COLOR_AND_TEXTURE=1]="ADD_COLOR_AND_TEXTURE",t[t.GRAYSCALE=2]="GRAYSCALE",t[t.USE_ALPHA_SEPARATED=3]="USE_ALPHA_SEPARATED",t[t.USE_ALPHA_SEPARATED_AND_GRAY=4]="USE_ALPHA_SEPARATED_AND_GRAY"}(uk||(uk=t("InstanceMaterialType",{})));var Rk,bk,Ck,wk,Ik,Ok,xk,Pk,Dk,Bk,Nk,Mk,Lk,Fk,Uk,Gk,kk,zk,Hk,Vk,Wk,Xk,jk,Yk,Kk,qk,Qk,Zk,Jk,$k,tz,ez,iz,nz,rz,sz,az,oz,uz,hz,lz,cz,_z,fz,dz,pz,mz,gz,vz,yz,Ez,Tz,Sz,Az,Rz,bz,Cz,wz,Iz,Oz,xz,Pz,Dz,Bz,Nz,Mz,Lz,Fz,Uz,Gz,kz=function(e){return t({UIRenderer:e,RenderComponent:e,UIRenderable:e,Renderable2D:e}),e}((VG=_h("cc.UIRenderer"),WG=fh(Ak),XG=Dh(),jG=Kh(Vy),YG=zh(),KG=Mh(),qG=Nh(),QG=zh(),ZG=Mh(),JG=Kh(Vy),VG($G=WG($G=bh((ok=ak=function(t){function e(){var e;return(e=t.call(this)||this)._renderData=null,E(e,"_materials",ek,g(e)),E(e,"_customMaterial",ik,g(e)),E(e,"_srcBlendFactor",nk,g(e)),E(e,"_dstBlendFactor",rk,g(e)),E(e,"_color",sk,g(e)),e._stencilStage=mG.DISABLED,e._assembler=null,e._postAssembler=null,e._renderDataFlag=!0,e._renderFlag=!0,e._renderEntity=void 0,e._instanceMaterialType=-1,e._srcBlendFactorCache=jn.SRC_ALPHA,e._dstBlendFactorCache=jn.ONE_MINUS_SRC_ALPHA,e._dirtyVersion=-1,e._internalId=-1,e._useVertexOpacity=!1,e._lastParent=null,e._renderEntity=e.createRenderEntity(),e}c(e,t);var i=e.prototype;return i.onLoad=function(){this._renderEntity.setNode(this.node)},i.__preload=function(){this.node._uiProps.uiComp=this,this._flushAssembler&&this._flushAssembler()},i.onEnable=function(){this.node.on(aE.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.on(aE.SIZE_CHANGED,this._nodeStateChange,this),this.node.on(aE.PARENT_CHANGED,this._colorDirty,this),this.updateMaterial(),this._colorDirty(),wL.addRenderer(this),this.markForUpdateRenderData()},i.onRestore=function(){this.updateMaterial(),this.markForUpdateRenderData()},i.onDisable=function(){this.node.off(aE.ANCHOR_CHANGED,this._nodeStateChange,this),this.node.off(aE.SIZE_CHANGED,this._nodeStateChange,this),this.node.off(aE.PARENT_CHANGED,this._colorDirty,this),wL.removeRenderer(this),this._renderFlag=!1,this._renderEntity.enabled=!1},i.onDestroy=function(){if(this._renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this.destroyRenderData(),this._materialInstances)for(var t=0;t0},i._postCanRender=function(){},i.updateMaterial=function(){if(this._customMaterial)this.setMaterial(this._customMaterial,0);else{var t=this._updateBuiltinMaterial();this.setMaterial(t,0),this.stencilStage!==mG.ENTER_LEVEL&&this.stencilStage!==mG.ENTER_LEVEL_INVERTED||this.getMaterialInstance(0).recompileShaders({USE_ALPHA_TEST:!0}),this._updateBlendFunc()}},i._updateColor=function(){this.node._uiProps.colorDirty=!0,this.setEntityColorDirty(!0),this.setEntityColor(this._color),this.setEntityOpacity(this.node._uiProps.localOpacity),this._assembler&&(this._assembler.updateColor(this),this._renderFlag=this._canRender(),this.setEntityEnabled(this._renderFlag))},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 Yz(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"}(Hz||(Hz={})),function(t){t[t.DEFAULT=1]="DEFAULT",t[t.FORWARD=2]="FORWARD",t[t.SHADOWCAST=4]="SHADOWCAST"}(Vz||(Vz={}));var Kz,qz,Qz,Zz,Jz,$z,tH,eH,iH,nH=function(){function t(t){this._device=void 0,this._format=On.UNKNOWN,this._formatSize=0,this._chunks=[],this._chunkCount=0,this._handles=[],this._region0=new Ir,this._region1=new Ir,this._region2=new Ir,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=As[t.format];this._format=t.format,this._formatSize=e.size,this._channels=e.count,this._bufferViewCtor=Ds(e),this._roundUpFn=t.roundUpFn||null,this._alignment=t.alignment||1,t.inOrderFree&&(this.alloc=this._McDonaldAlloc)},e.destroy=function(){for(var t=0;t=0));++r);if(n>=0){var s=this._chunks[i];s.start+=t;var a={chunkIdx:i,start:n,end:n+t,texture:s.texture};return this._handles.push(a),a}var o=Math.sqrt(t/this._formatSize),u=this._roundUpFn&&this._roundUpFn(o,this._formatSize)||Math.max(1024,jz(o)),h=this._chunks[this.createChunk(u)];h.start+=t;var l={chunkIdx:this._chunkCount-1,start:0,end:t,texture:h.texture};return this._handles.push(l),l},e.free=function(t){for(var e=0;e0&&(this._region0.texOffset.x=a,this._region0.texOffset.y=o,this._region0.texExtent.width=u,this._region0.texExtent.height=1,i.push(new this._bufferViewCtor(e,h*this._formatSize,u*this._channels)),n.push(this._region0),a=0,o+=1,s-=u,h+=u),s>0&&(this._region1.texOffset.x=a,this._region1.texOffset.y=o,s>t.texture.width?(this._region1.texExtent.width=t.texture.width,this._region1.texExtent.height=Math.floor(s/t.texture.width),u=this._region1.texExtent.width*this._region1.texExtent.height):(u=s,this._region1.texExtent.width=u,this._region1.texExtent.height=1),i.push(new this._bufferViewCtor(e,h*this._formatSize,u*this._channels)),n.push(this._region1),a=0,o+=this._region1.texExtent.height,s-=u,h+=u),s>0&&(this._region2.texOffset.x=a,this._region2.texOffset.y=o,this._region2.texExtent.width=s,this._region2.texExtent.height=1,i.push(new this._bufferViewCtor(e,h*this._formatSize,s*this._channels)),n.push(this._region2)),this._device.copyBuffersToTexture(i,t.texture,n)},e._findAvailableSpace=function(t,e){var i=this._chunks[e],n=!1,r=i.start;if(r+t<=i.size)n=!0;else{r=0;for(var s=this._handles.filter((function(t){return t.chunkIdx===e})).sort((function(t,e){return t.start-e.start})),a=0;ai.end?r+t<=i.size?n=!0:t<=i.end&&(i.start=r=0,n=!0):r===i.end&&(i.start=r=0,i.end=i.size,t<=i.end&&(n=!0)),n){i.start+=t;var s={chunkIdx:e,start:r,end:r+t,texture:i.texture};return this._handles.push(s),s}}var a=Math.sqrt(t/this._formatSize),o=this._roundUpFn&&this._roundUpFn(a,this._formatSize)||Math.max(1024,jz(a)),u=this._chunks[this.createChunk(o)];u.start+=t;var h={chunkIdx:this._chunkCount,start:0,end:t,texture:u.texture};return this._handles.push(h),h},t}(),rH=function(){function t(t,e,i){this._arrayBuffers=[],this._chunkSize=void 0,this._chunkSize=i*(1<>this._entryBits,i=this._entryMask&t;return(this._hasFloat32?this._float32BufferViews:this._uint32BufferViews)[e][i]},e.getTypedArray=function(t,e){var i=(this._chunkMask&t)>>this._entryBits,n=this._entryMask&t,r=e,s=(this._dataType[e]===iH.UINT32?this._uint32BufferViews:this._float32BufferViews)[i][n],a=this._dataMembers[e];return s.subarray(r,r+a)},e.free=function(t){var e=(this._chunkMask&t)>>this._entryBits,i=this._entryMask&t;(this._hasUint32?this._uint32BufferViews:this._float32BufferViews)[e][i].fill(0),this._freeLists[e].push(i)},t}();!function(t){t[t.NODE=0]="NODE",t[t.PASS=1]="PASS",t[t.AABB=2]="AABB",t[t.RENDER2D=3]="RENDER2D"}(sH||(sH={})),function(t){t[t.POSITION=0]="POSITION",t[t.UV=3]="UV",t[t.COLOR=5]="COLOR",t[t.COUNT=9]="COUNT"}(aH||(aH={}));var uH,hH=((Kz={})[aH.POSITION]=iH.FLOAT32,Kz[aH.UV]=iH.FLOAT32,Kz[aH.COLOR]=iH.UINT32,Kz[aH.COUNT]=iH.NEVER,Kz),lH=((qz={})[aH.POSITION]=aH.UV-aH.POSITION,qz[aH.UV]=aH.COLOR-aH.UV,qz[aH.COLOR]=aH.COUNT-aH.COLOR,qz[aH.COUNT]=1,qz),cH=new oH(sH.RENDER2D,hH,lH,aH);!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"}(uH||(uH={}));var _H,fH=((Qz={})[uH.DIRTY_FLAG]=iH.UINT32,Qz[uH.LAYER]=iH.UINT32,Qz[uH.WORLD_SCALE]=iH.FLOAT32,Qz[uH.WORLD_POSITION]=iH.FLOAT32,Qz[uH.WORLD_ROTATION]=iH.FLOAT32,Qz[uH.WORLD_MATRIX]=iH.FLOAT32,Qz[uH.LOCAL_SCALE]=iH.FLOAT32,Qz[uH.LOCAL_POSITION]=iH.FLOAT32,Qz[uH.LOCAL_ROTATION]=iH.FLOAT32,Qz[uH.COUNT]=iH.NEVER,Qz),dH=((Zz={})[uH.DIRTY_FLAG]=uH.LAYER-uH.DIRTY_FLAG,Zz[uH.LAYER]=uH.WORLD_SCALE-uH.LAYER,Zz[uH.WORLD_SCALE]=uH.WORLD_POSITION-uH.WORLD_SCALE,Zz[uH.WORLD_POSITION]=uH.WORLD_ROTATION-uH.WORLD_POSITION,Zz[uH.WORLD_ROTATION]=uH.WORLD_MATRIX-uH.WORLD_ROTATION,Zz[uH.WORLD_MATRIX]=uH.LOCAL_SCALE-uH.WORLD_MATRIX,Zz[uH.LOCAL_SCALE]=uH.LOCAL_POSITION-uH.LOCAL_SCALE,Zz[uH.LOCAL_POSITION]=uH.LOCAL_ROTATION-uH.LOCAL_POSITION,Zz[uH.LOCAL_ROTATION]=uH.COUNT-uH.LOCAL_ROTATION,Zz[uH.COUNT]=1,Zz),pH=new oH(sH.NODE,fH,dH,uH);!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"}(_H||(_H={}));var mH,gH=((Jz={})[_H.PRIORITY]=iH.UINT32,Jz[_H.STAGE]=iH.UINT32,Jz[_H.PHASE]=iH.UINT32,Jz[_H.PRIMITIVE]=iH.UINT32,Jz[_H.BATCHING_SCHEME]=iH.UINT32,Jz[_H.DYNAMIC_STATE]=iH.UINT32,Jz[_H.HASH]=iH.UINT32,Jz[_H.COUNT]=iH.NEVER,Jz),vH=(($z={})[_H.PRIORITY]=_H.STAGE-_H.PRIORITY,$z[_H.STAGE]=_H.PHASE-_H.STAGE,$z[_H.PHASE]=_H.PRIMITIVE-_H.PHASE,$z[_H.PRIMITIVE]=_H.BATCHING_SCHEME-_H.PRIMITIVE,$z[_H.BATCHING_SCHEME]=_H.DYNAMIC_STATE-_H.BATCHING_SCHEME,$z[_H.DYNAMIC_STATE]=_H.HASH-_H.DYNAMIC_STATE,$z[_H.HASH]=_H.COUNT-_H.HASH,$z[_H.COUNT]=1,$z),yH=new oH(sH.PASS,gH,vH,_H);!function(t){t[t.CENTER=0]="CENTER",t[t.HALFEXTENTS=3]="HALFEXTENTS",t[t.COUNT=6]="COUNT"}(mH||(mH={}));var EH=((tH={})[mH.CENTER]=iH.FLOAT32,tH[mH.HALFEXTENTS]=iH.FLOAT32,tH[mH.COUNT]=iH.NEVER,tH),TH=((eH={})[mH.CENTER]=mH.HALFEXTENTS-mH.CENTER,eH[mH.HALFEXTENTS]=mH.COUNT-mH.HALFEXTENTS,eH[mH.COUNT]=1,eH),SH=new oH(sH.AABB,EH,TH,mH);it(SL.prototype,"RenderScene.prototype",[{name:"raycastUI2DNode"},{name:"raycastUINode"}]),it(SL.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"}]),it(mB.prototype,"Model.prototype",[{name:"isInstancingEnabled"},{name:"instancedAttributes"}]);var AH={};it(AH,"CameraVisFlags",[{name:"GENERAL"}]),et(AH,"CameraVisFlags",[{name:"PROFILER",newName:"PROFILER",target:Jd.BitMask,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Jd.BitMask,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Jd.BitMask,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Jd.BitMask,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Jd.BitMask,targetName:"UI_2D"}]),b.CameraVisFlags=AH;var RH={};it(RH,"VisibilityFlags",[{name:"GENERAL"}]),et(RH,"VisibilityFlags",[{name:"ALWALS",newName:"ALWALS",target:Jd.Enum,targetName:"ALWALS"},{name:"PROFILER",newName:"PROFILER",target:Jd.Enum,targetName:"PROFILER"},{name:"GIZMOS",newName:"GIZMOS",target:Jd.Enum,targetName:"GIZMOS"},{name:"EDITOR",newName:"EDITOR",target:Jd.Enum,targetName:"EDITOR"},{name:"UI",newName:"UI",target:Jd.Enum,targetName:"UI_3D"},{name:"UI2D",newName:"UI2D",target:Jd.Enum,targetName:"UI_2D"}]),b.VisibilityFlags=RH,et(by.prototype,"Pass.prototype",[{name:"getBindingTypeFromHandle",newName:"getDescriptorTypeFromHandle"}]),it(NS.prototype,"Camera.prototype",[{name:"getSplitFrustum"},{name:"setMatView"},{name:"setMatViewInv"},{name:"setMatProjInv"},{name:"setMatViewProjInv"},{name:"setMatProj"},{name:"setMatViewProj"},{name:"getMatViewInv"}]),it(NA.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"}]),it(IB.prototype,"SpotLight.prototype",[{name:"aspect"}]);var bH,CH,wH,IH=function(t){if(void 0===Xz[t]){var e=1<10||(p=.5*(s+o),m=.5*(a+u),g=.5*((c=.5*(e+n))+(f=.5*(n+s))),v=.5*((_=.5*(i+r))+(d=.5*(r+a))),((b=MH((n-o)*(R=u-i)-(r-u)*(A=o-e)))+(C=MH((s-o)*R-(a-u)*A)))*(b+C)=2*xH)l=2*xH;else for(;l<0;)l+=2*xH;else if(MH(l)>=2*xH)l=2*-xH;else for(;l>0;)l-=2*xH;for(u=0|DH(1,PH(MH(l)/(.5*xH)+.5,5)),c=MH(4/3*(1-BH(o=l/u/2))/NH(o)),a||(c=-c),S=0;S<=u;S++)d=e+(_=BH(h=r+l*(S/u)))*n,p=i+(f=NH(h))*n,m=-f*n*c,g=_*n*c,0===S?t.moveTo(d,p):t.bezierCurveTo(v+E,y+T,d-m,p-g,d,p),v=d,y=p,E=m,T=g}(this,t,e,i,n,r,s)},e.ellipse=function(t,e,i,n){UH(this,t,e,i,n),this._curPath.complex=!1},e.circle=function(t,e,i){UH(this,t,e,i,i),this._curPath.complex=!1},e.rect=function(t,e,i,n){this.moveTo(t,e),this.lineTo(t+i,e),this.lineTo(t+i,e+n),this.lineTo(t,e+n),this.close(),this._curPath.complex=!1},e.roundRect=function(t,e,i,n,r){!function(t,e,i,n,r,s){if(s<.1)t.rect(e,i,n,r);else{var a=PH(s,.5*MH(n))*LH(n),o=PH(s,.5*MH(r))*LH(r);t.moveTo(e,i+o),t.lineTo(e,i+r-o),t.bezierCurveTo(e,i+r-o*(1-FH),e+a*(1-FH),i+r,e+a,i+r),t.lineTo(e+n-a,i+r),t.bezierCurveTo(e+n-a*(1-FH),i+r,e+n,i+r-o*(1-FH),e+n,i+r-o),t.lineTo(e+n,i+o),t.bezierCurveTo(e+n,i+o*(1-FH),e+n-a*(1-FH),i,e+n-a,i),t.lineTo(e+a,i),t.bezierCurveTo(e+a*(1-FH),i,e,i+o*(1-FH),e,i+o),t.close()}}(this,t,e,i,n,r),this._curPath.complex=!1},e.clear=function(){this.pathLength=0,this.pathOffset=0,this.pointsOffset=0,this.dataOffset=0,this._curPath=null,this.paths.length=0,this._points.length=0;for(var t=this._renderDataList,e=0,i=t.length;e0){for(var i=0;ii)for(var n=i;n=0&&s.y>=0&&s.x<=n&&s.y<=r;else if(this.type===DW.GRAPHICS_ELLIPSE){var u=n/2,h=r/2,l=s.x-.5*n,c=s.y-.5*r;o=l*l/(u*u)+c*c/(h*h)<1}return this._inverted&&(o=!o),o},i._nodeStateChange=function(){this._updateGraphics()},i._changeRenderType=function(){this._type!==DW.SPRITE_STENCIL?this._createGraphics():this._createSprite()},i._createSprite=function(){if(!this._sprite){var t=this._sprite=this.node.getComponent(PW);if(!t){var e=this.node;t=this._sprite=e.addComponent(PW)}t.color=Gi.WHITE.clone(),t.sizeMode=0}this._sprite.stencilStage=this.inverted?mG.ENTER_LEVEL_INVERTED:mG.ENTER_LEVEL,this._sprite.updateMaterial()},i._createGraphics=function(){if(!this._graphics){var t=this._graphics=this.node.getComponent(cW);if(!t){var e=this.node;t=this._graphics=e.addComponent(cW)}t.lineWidth=1;var i=Gi.WHITE.clone();i.a=0,t.fillColor=i}this._graphics.stencilStage=this.inverted?mG.ENTER_LEVEL_INVERTED:mG.ENTER_LEVEL},i._updateGraphics=function(){if(this._graphics&&(this._type===DW.GRAPHICS_RECT||this._type===DW.GRAPHICS_ELLIPSE)){var t=this.node._uiProps.uiTransformComp,e=this._graphics;e.clear();var i=t.contentSize,n=i.width,r=i.height,s=t.anchorPoint,a=-n*s.x,o=-r*s.y;if(this._type===DW.GRAPHICS_RECT)e.rect(a,o,n,r);else if(this._type===DW.GRAPHICS_ELLIPSE){for(var u=function(t,e,i){LW.length=0;for(var n=2*Math.PI/i,r=0;r"]),this._specialSymbolArray.push([/&/g,"&"]),this._specialSymbolArray.push([/"/g,'"']),this._specialSymbolArray.push([/'/g,"'"])}var e=t.prototype;return e.parse=function(t){this._resultObjectArray.length=0,this._stack.length=0;for(var e=0,i=t.length;e",e),r=-1;if(n>=0&&(r=t.lastIndexOf("<",n))",r+1)),r<0)this._stack.pop(),this._processResult(t.substring(e)),e=i;else{var s=t.substring(e,r),a=t.substring(r+1,n);""===a&&(s=t.substring(e,n+1)),this._processResult(s),-1===n?n=r:"/"===t.charAt(r+1)?this._stack.pop():this._addToStack(a),e=n+1}}return this._resultObjectArray},e._attributeToObject=function(t){t=t.trim();var e={},i=/^(color|size)(\s)*=/.exec(t),n="",r=0,s="";if(i){if(n=i[0],""===(t=t.substring(n.length).trim()))return e;switch(r=t.indexOf(" "),n[0]){case"c":e.color=r>-1?t.substring(0,r).trim():t;break;case"s":e.size=parseInt(t)}return r>-1&&(s=t.substring(r+1).trim(),e.event=this._processEventHandler(s)),e}if((i=/^(br(\s)*\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("br")&&"/"===n[n.length-1])return e.isNewLine=!0,this._resultObjectArray.push({text:"",style:{isNewLine:!0}}),e;var a="",o=-1;if((i=/^(img(\s)*src(\s)*=[^>]+\/)/.exec(t))&&i[0].length>0&&(n=i[0].trim()).startsWith("img")&&"/"===n[n.length-1]){var u;i=JW.exec(t);for(var h=!1;i;){var l=(n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length)).length;if(n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),a=t.substring(l).trim(),o="src"===n?this.getRightQuotationIndex(a):-1,u=(r=a.indexOf(" ",o+1>=a.length?-1:o+1))>-1?a.substr(0,r):a,t=a.substring(r).trim(),u.endsWith("/")&&(u=u.slice(0,-1)),"src"===n){switch(u.charCodeAt(0)){case 34:case 39:h=!0,u=u.slice(1,-1)}e.isImage=!0,e.src=u}else if("height"===n)e.imageHeight=parseInt(u);else if("width"===n)e.imageWidth=parseInt(u);else if("align"===n){switch(u.charCodeAt(0)){case 34:case 39:u=u.slice(1,-1)}e.imageAlign=u.toLowerCase()}else"offset"===n?e.imageOffset=u:"click"===n&&(e.event=this._processEventHandler(n+"="+u));e.event&&"param"===n&&(e.event[n]=u.replace(/^"|"$/g,"")),i=JW.exec(t)}return h&&e.isImage&&this._resultObjectArray.push({text:"",style:e}),{}}if(i=/^(outline(\s)*[^>]*)/.exec(t)){var c={color:"#ffffff",width:1};if(t=i[0].substring("outline".length).trim()){var _,f=/(\s)*color(\s)*=|(\s)*width(\s)*=|(\s)*click(\s)*=|(\s)*param(\s)*=/;for(i=f.exec(t);i;)n=(t=t.substring(t.indexOf(i[0]))).substr(0,i[0].length),_=(r=(a=t.substring(n.length).trim()).indexOf(" "))>-1?a.substr(0,r):a,n=(n=n.replace(/[^a-zA-Z]/g,"").trim()).toLowerCase(),t=a.substring(r).trim(),"click"===n?e.event=this._processEventHandler(n+"="+_):"color"===n?c.color=_:"width"===n&&(c.width=parseInt(_)),e.event&&"param"===n&&(e.event[n]=_.replace(/^"|"$/g,"")),i=f.exec(t)}e.outline=c}if((i=/^(on|u|b|i)(\s)*/.exec(t))&&i[0].length>0){switch(n=i[0],t=t.substring(n.length).trim(),n[0]){case"u":e.underline=!0;break;case"i":e.italic=!0;break;case"b":e.bold=!0}if(""===t)return e;e.event=this._processEventHandler(t)}return e},e.getRightQuotationIndex=function(t){var e=-1,i=-1,n=t.indexOf("'"),r=t.indexOf('"'),s=r>-1&&(r-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=ZW.exec(t);r;){var s=r[0],a="";if(n=!1,'"'===(t=t.substring(s.length).trim()).charAt(0))(i=t.indexOf('"',1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else if("'"===t.charAt(0))(i=t.indexOf("'",1))>-1&&(a=t.substring(1,i).trim(),n=!0),i++;else{var o=/(\S)+/.exec(t);i=(a=o?o[0]:"").length}n&&(e[s=s.substring(0,s.length-1).trim()]=a),t=t.substring(i).trim(),r=ZW.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=y(this._specialSymbolArray);!(e=i()).done;){var n=e.value,r=n[0],s=n[1];t=t.replace(r,s)}return t},t}()),tX=function(e){return t({LabelOutline:e,LabelOutlineComponent:e}),e}((UW=_h("cc.LabelOutline"),GW=xh(),kW=dh(110),zW=Ch(),HW=fh(zz),VW=Mh(),WW=Mh(),UW(XW=GW(XW=kW(XW=zW(XW=HW(XW=bh((qW=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;rh;){if((s/=2)<1){s*=2;break}a=a.substring(r,s),o=n.substring(s),u=this._calculateSize(e,a)}for(var l=1e3,c=1;l&&r0&&(c=_[0].length),s+=c,a=n.substring(r,s),o=n.substring(s),u=this._calculateSize(e,a),l--}for(;l&&a.length>=2&&u.x>h;)s-=c,a=n.substring(r,s),u=this._calculateSize(e,a),c=1,l--;if(a.length>=2){var f=YU(a);f&&f.length>0&&a!==f[0]&&(s-=f[0].length,a=n.substring(r,s))}if(i.push(a),r=s,s+=a.length,a=n.substring(r,s),o=n.substring(s),l--,this._calculateSize(e,o).x<2048){r=t.length,s=t.length,a=o,i.push(a);break}u=this._calculateSize(e,a)}return i},i._measureText=function(t,e){var i=this,n=function(e){return i._calculateSize(t,e).width};return e?n(e):n},i._calculateSize=function(t,e){var i;return 0===this._labelSegmentsCache.length?(i=this._createFontLabel(e),this._labelSegmentsCache.push(i)):(i=this._labelSegmentsCache[0]).node.getComponent(zz).string=e,i.styleIndex=t,this._applyTextAttribute(i),i.node._uiProps.uiTransformComp.contentSize},i._onTouchEnded=function(t){for(var e,i=this,n=this.node.getComponents(bc),r=function(){var r=e.value,s=r.clickHandler,a=r.clickParam;s&&i._containsTouchLocation(r,t.touch.getUILocation())&&(n.forEach((function(e){var i=e[s];e.enabledInHierarchy&&i&&i.call(e,t,a)})),t.propagationStopped=!0)},s=y(this._segments);!(e=s()).done;)r()},i._containsTouchLocation=function(t,e){var i=t.node.getComponent(Ak);return!!i&&i.getBoundingBoxToWorld().contains(e)},i._resetState=function(){for(var t=this.node.children,e=t.length-1;e>=0;e--){var i=t[e];if(i.name===yj||i.name===Ej){i.parent=null;var n=Aj(i.name);n.node=i,i.name===yj?(n.comp=i.getComponent(zz),Tj.put(n)):(n.comp=i.getComponent(PW),Sj.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!==yj&&i.name!==Ej||(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(zz);n&&(n.string=t)}var r=i.comp;return r.verticalAlign!==this._verticalAlign&&(r.verticalAlign=this._verticalAlign),i.styleIndex=e,i.lineCount=this._lineCount,i.node._uiProps.uiTransformComp.setAnchorPoint(0,0),i.node.layer=this.node.layer,this.node.insertChild(i.node,this._labelChildrenNum++),this._applyTextAttribute(i),this._segments.push(i),i},i._updateRichTextWithMaxWidth=function(t,e,i){var n=e;if(this._lineOffsetX>0&&n+this._lineOffsetX>this._maxWidth)for(var r=0;this._lineOffsetX<=this._maxWidth;){var s=this._getFirstWordLen(t,r,t.length),a=t.substr(r,s),o=this._measureText(i,a);if(!(this._lineOffsetX+o<=this._maxWidth)){if(r>0){var u=t.substr(0,r);this._addLabelSegment(u,i),t=t.substr(r,t.length),n=this._measureText(i,t)}this._updateLineInfo();break}this._lineOffsetX+=o,r+=s}if(n>this._maxWidth)for(var h=KU(t,n,this._maxWidth,this._measureText(i)),l=0;l1&&l0?(o*=a=l/u,u*=a):(o*=a=this._lineHeight/u,u*=a),h>0&&(o=h),this._maxWidth>0?(this._lineOffsetX+o>this._maxWidth&&this._updateLineInfo(),this._lineOffsetX+=o):(this._lineOffsetX+=o,this._lineOffsetX>this._labelWidth&&(this._labelWidth=this._lineOffsetX)),r.node._uiProps.uiTransformComp.setContentSize(o,u),r.lineCount=this._lineCount,r.clickHandler="",r.clickParam="";var c=e.event;c&&(r.clickHandler=c.click,r.clickParam=c.param)}else j(4400)}},i._updateRichText=function(){if(this.enabledInHierarchy){var t=vj.parse(this._string);if(!this._needsUpdateTextLayout(t))return this._textArray=t.slice(),void this._updateLabelSegmentTextAttributes();this._textArray=t.slice(),this._resetState();for(var e,i=!1,n=0;n0){var h=this._measureText(n,u);this._updateRichTextWithMaxWidth(u,h,n),a.length>1&&othis._labelWidth&&(this._labelWidth=this._lineOffsetX),a.length>1&&o0&&(this._labelWidth=this._maxWidth),this._labelHeight=(this._lineCount+DU)*this._lineHeight,this.node._uiProps.uiTransformComp.setContentSize(this._labelWidth,this._labelHeight),this._updateRichTextPosition(),this._layoutDirty=!1}},i._getFirstWordLen=function(t,e,i){var n=t.charAt(e);if(HU(n)||VU(n))return 1;for(var r=1,s=e+1;se&&(t=0,e=u);var h=this._labelWidth*(.5*this._horizontalAlign-r);switch(this._horizontalAlign){case Lz.LEFT:break;case Lz.CENTER:h-=this._linesWidth[u-1]/2;break;case Lz.RIGHT:h-=this._linesWidth[u-1]}var l=o.node.position;if(o.node.setPosition(t+h,this._lineHeight*(i-u)-this._labelHeight*s,l.z),u===e&&(t+=o.node._uiProps.uiTransformComp.width),o.node.getComponent(PW)){var c=o.node.position.clone(),_=this._lineHeight,f=this._lineHeight*(1+DU);switch(o.node._uiProps.uiTransformComp.anchorY){case 1:c.y+=_+(f-_)/2;break;case.5:c.y+=f/2;break;default:c.y+=(f-_)/2}if(o.imageOffset){var d=o.imageOffset.split(",");if(1===d.length&&d[0]){var p=parseFloat(d[0]);Number.isInteger(p)&&(c.y+=p)}else if(2===d.length){var m=parseFloat(d[0]),g=parseFloat(d[1]);Number.isInteger(m)&&(c.x+=m),Number.isInteger(g)&&(c.y+=g)}}o.node.position=c}var v=o.node.getComponent(tX);if(v){var y=o.node.position.clone();y.y-=v.width,o.node.position=y}}},i._convertLiteralColorValue=function(t){var e=t.toUpperCase();return Gi[e]?Gi[e]:(new Gi).fromHEX(t)},i._applyTextAttribute=function(t){var e=t.node.getComponent(zz);if(e){this._resetLabelState(e);var i,n=t.styleIndex;if(this._textArray[n]&&(i=this._textArray[n].style),i){if(e.color=this._convertLiteralColorValue(i.color||"white"),e.isBold=!!i.bold,e.isItalic=!!i.italic,e.isUnderline=!!i.underline,i.outline){var r=t.node.getComponent(tX);r||(r=t.node.addComponent(tX)),r.color=this._convertLiteralColorValue(i.outline.color),r.width=i.outline.width}e.fontSize=i.size||this._fontSize,t.clickHandler="",t.clickParam="";var s=i.event;s&&(t.clickHandler=s.click||"",t.clickParam=s.param||"")}e.cacheMode=this._cacheMode,this._font instanceof mU&&!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=y(this._segments);!(t=e()).done;)t.value.node.layer=this.node.layer},i._resetLabelState=function(t){t.fontSize=this._fontSize,t.color=Gi.WHITE,t.isBold=!1,t.isItalic=!1,t.isUnderline=!1},h(e,[{key:"string",get:function(){return this._string},set:function(t){this._string!==t&&(this._string=t,this._updateRichTextStatus())}},{key:"horizontalAlign",get:function(){return this._horizontalAlign},set:function(t){this.horizontalAlign!==t&&(this._horizontalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"verticalAlign",get:function(){return this._verticalAlign},set:function(t){this._verticalAlign!==t&&(this._verticalAlign=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontSize",get:function(){return this._fontSize},set:function(t){this._fontSize!==t&&(this._fontSize=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"fontFamily",get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"font",get:function(){return this._font},set:function(t){this._font!==t&&(this._font=t,this._layoutDirty=!0,this._font?(this.useSystemFont=!1,this._onTTFLoaded()):this.useSystemFont=!0,this._updateRichTextStatus())}},{key:"useSystemFont",get:function(){return this._isSystemFontUsed},set:function(t){this._isSystemFontUsed!==t&&(this._isSystemFontUsed=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"cacheMode",get:function(){return this._cacheMode},set:function(t){this._cacheMode!==t&&(this._cacheMode=t,this._updateRichTextStatus())}},{key:"maxWidth",get:function(){return this._maxWidth},set:function(t){this._maxWidth!==t&&(this._maxWidth=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"lineHeight",get:function(){return this._lineHeight},set:function(t){this._lineHeight!==t&&(this._lineHeight=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"imageAtlas",get:function(){return this._imageAtlas},set:function(t){this._imageAtlas!==t&&(this._imageAtlas=t,this._layoutDirty=!0,this._updateRichTextStatus())}},{key:"handleTouchEvent",get:function(){return this._handleTouchEvent},set:function(t){this._handleTouchEvent!==t&&(this._handleTouchEvent=t,this.enabledInHierarchy&&(this.handleTouchEvent?this._addEventListeners():this._removeEventListeners()))}}]),e}(bc),mj.HorizontalAlign=Lz,mj.VerticalAlign=Fz,T((ij=gj).prototype,"string",[Hh,FX],Object.getOwnPropertyDescriptor(ij.prototype,"string"),ij.prototype),T(ij.prototype,"horizontalAlign",[UX,GX],Object.getOwnPropertyDescriptor(ij.prototype,"horizontalAlign"),ij.prototype),T(ij.prototype,"verticalAlign",[kX,zX],Object.getOwnPropertyDescriptor(ij.prototype,"verticalAlign"),ij.prototype),T(ij.prototype,"fontSize",[HX],Object.getOwnPropertyDescriptor(ij.prototype,"fontSize"),ij.prototype),T(ij.prototype,"fontFamily",[VX],Object.getOwnPropertyDescriptor(ij.prototype,"fontFamily"),ij.prototype),T(ij.prototype,"font",[WX,XX],Object.getOwnPropertyDescriptor(ij.prototype,"font"),ij.prototype),T(ij.prototype,"useSystemFont",[jX,YX],Object.getOwnPropertyDescriptor(ij.prototype,"useSystemFont"),ij.prototype),T(ij.prototype,"cacheMode",[KX,qX],Object.getOwnPropertyDescriptor(ij.prototype,"cacheMode"),ij.prototype),T(ij.prototype,"maxWidth",[QX],Object.getOwnPropertyDescriptor(ij.prototype,"maxWidth"),ij.prototype),T(ij.prototype,"lineHeight",[ZX],Object.getOwnPropertyDescriptor(ij.prototype,"lineHeight"),ij.prototype),T(ij.prototype,"imageAtlas",[JX,$X],Object.getOwnPropertyDescriptor(ij.prototype,"imageAtlas"),ij.prototype),T(ij.prototype,"handleTouchEvent",[tj],Object.getOwnPropertyDescriptor(ij.prototype,"handleTouchEvent"),ij.prototype),nj=T(ij.prototype,"_lineHeight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 40}}),rj=T(ij.prototype,"_string",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"RichText"}}),sj=T(ij.prototype,"_horizontalAlign",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Lz.LEFT}}),aj=T(ij.prototype,"_verticalAlign",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Fz.TOP}}),oj=T(ij.prototype,"_fontSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 40}}),uj=T(ij.prototype,"_maxWidth",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),hj=T(ij.prototype,"_fontFamily",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return"Arial"}}),lj=T(ij.prototype,"_font",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),cj=T(ij.prototype,"_isSystemFontUsed",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),_j=T(ij.prototype,"_userDefinedFont",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),fj=T(ij.prototype,"_cacheMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gz.NONE}}),dj=T(ij.prototype,"_imageAtlas",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),pj=T(ij.prototype,"_handleTouchEvent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),ej=ij))||ej)||ej)||ej)||ej)||ej));b.RichText=Cj;var wj=function(e){return t({UIMeshRenderer:e,UIModelComponent:e}),e}(_h("cc.UIMeshRenderer")(bj=xh()(bj=dh(110)(bj=Ch()(bj=bh(bj=function(t){function e(){var e;return(e=t.call(this)||this)._modelComponent=null,e.modelCount=0,e._dirtyVersion=-1,e._internalId=-1,e.stencilStage=mG.DISABLED,e._renderData=null,e._renderEntity=new hk(AG.DYNAMIC),e}c(e,t);var i=e.prototype;return i.__preload=function(){this.node._uiProps.uiComp=this},i.onEnable=function(){wL.addRenderer(this),this.markForUpdateRenderData()},i.onDisable=function(){wL.removeRenderer(this),this.renderEntity.enabled=this._canRender()},i.onLoad=function(){this.node._uiProps.uiTransformComp||this.node.addComponent("cc.UITransform"),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent?this.renderEntity.setNode(this.node):console.warn("node '"+(this.node&&this.node.name)+"' doesn't have any renderable component")},i.onDestroy=function(){this.renderEntity.setNode(null),this.node._uiProps.uiComp===this&&(this.node._uiProps.uiComp=null),this._modelComponent=this.getComponent("cc.ModelRenderer"),this._modelComponent&&(this._modelComponent._sceneGetter=null)},i._render=function(t){if(this._modelComponent){var e=this._modelComponent._collectModels();this._modelComponent._detachFromScene();for(var i=0;i0)for(s=e;s=e;s-=n)a=wY(s,t[s],t[s+1],a);return a&&AY(a,a.next)&&(IY(a),a=a.next),a}function lY(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||!AY(i,i.next)&&0!==SY(i.prev,i,i.next))i=i.next;else{if(IY(i),(i=e=i.prev)===i.next)return null;n=!0}}while(n||i!==e);return e}function cY(t,e,i,n,r,s,a){if(void 0===a&&(a=0),t){!a&&s&&function(t,e,i,n){var r=t;do{null===r.z&&(r.z=vY(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e=0,i=null,n=null,r=null,s=null,a=0,o=0,u=0,h=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,n=i,o=0,e=0;e0||u>0&&n;)0===o?(r=n,n=n.nextZ,u--):0!==u&&n?i.z<=n.z?(r=i,i=i.nextZ,o--):(r=n,n=n.nextZ,u--):(r=i,i=i.nextZ,o--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(a>1)}(r)}(t,n,r,s);for(var o=t,u=null,h=null;t.prev!==t.next;)if(u=t.prev,h=t.next,s?fY(t,n,r,s):_Y(t))e.push(u.i/i),e.push(t.i/i),e.push(h.i/i),IY(t),t=h.next,o=h.next;else if((t=h)===o){a?1===a?cY(t=dY(t,e,i),e,i,n,r,s,2):2===a&&pY(t,e,i,n,r,s):cY(lY(t),e,i,n,r,s,1);break}}}function _Y(t){var e=t.prev,i=t,n=t.next;if(SY(e,i,n)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(EY(e.x,e.y,i.x,i.y,n.x,n.y,r.x,r.y)&&SY(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function fY(t,e,i,n){var r=t.prev,s=t,a=t.next;if(SY(r,s,a)>=0)return!1;for(var o=r.xs.x?r.x>a.x?r.x:a.x:s.x>a.x?s.x:a.x,l=r.y>s.y?r.y>a.y?r.y:a.y:s.y>a.y?s.y:a.y,c=vY(o,u,e,i,n),_=vY(h,l,e,i,n),f=t.nextZ;f&&f.z<=_;){if(f!==t.prev&&f!==t.next&&EY(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&SY(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=t.prevZ;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&EY(r.x,r.y,s.x,s.y,a.x,a.y,f.x,f.y)&&SY(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function dY(t,e,i){var n=t;do{var r=n.prev,s=n.next.next;!AY(r,s)&&RY(r,n,n.next,s)&&bY(r,s)&&bY(s,r)&&(e.push(r.i/i),e.push(n.i/i),e.push(s.i/i),IY(n),IY(n.next),n=t=s),n=n.next}while(n!==t);return n}function pY(t,e,i,n,r,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&TY(a,o)){var u=CY(a,o);return a=lY(a,a.next),u=lY(u,u.next),cY(a,e,i,n,r,s),void cY(u,e,i,n,r,s)}o=o.next}a=a.next}while(a!==t)}function mY(t,e){return t.x-e.x}function gY(t,e){if(e=function(t,e){var i=e,n=t.x,r=t.y,s=-1/0,a=null;do{if(r<=i.y&&r>=i.next.y){var o=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>s){if(s=o,o===n){if(r===i.y)return i;if(r===i.next.y)return i.next}a=i.x=i.x&&i.x>=l&&EY(ra.x)&&bY(i,t)&&(a=i,_=u),i=i.next;return a}(t,e)){var i=CY(e,t);lY(i,i.next)}}function vY(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 yY(t){var e=t,i=t;do{e.x=0&&(t-a)*(n-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(r-a)*(n-o)>=0}function TY(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&&RY(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&bY(t,e)&&bY(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 SY(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function AY(t,e){return t.x===e.x&&t.y===e.y}function RY(t,e,i,n){return!!(AY(t,e)&&AY(i,n)||AY(t,n)&&AY(i,e))||SY(t,e,i)>0!=SY(t,e,n)>0&&SY(i,n,t)>0!=SY(i,n,e)>0}function bY(t,e){return SY(t.prev,t,t.next)<0?SY(t,e,t.next)>=0&&SY(t,t.prev,e)>=0:SY(t,e,t.prev)<0||SY(t,t.next,e)<0}function CY(t,e){var i=new uY(t.i,t.x,t.y),n=new uY(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 wY(t,e,i,n){var r=new uY(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 IY(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 OY(t,e,i){i=i||3;var n=e?e.length:0,r=n?e[0]*i:t.length,s=hY(t,0,r,i,!0),a=[];if(!s)return a;var o=0,u=0,h=0,l=0,c=0,_=0,f=0;if(n&&(s=function(t,e,i,n){var r,s=[],a=0,o=null;for(a=0,r=e.length;a80*i){o=h=t[0],u=l=t[1];for(var d=i;dh&&(h=c),_>l&&(l=_);f=Math.max(h-o,l-u)}return cY(s,a,i,o,u,f),a}for(var xY=Math.PI,PY=Math.min,DY=Math.max,BY=Math.ceil,NY=Math.acos,MY=Math.cos,LY=Math.sin,FY=Math.atan2,UY=null,GY=null,kY=new Gi,zY=[],HY=0;HY<4;HY++)zY.push(new ji);function VY(t,e,i){return ti?i:t}var WY={useModel:!0,updateRenderData:function(){},fillBuffers:function(){},renderIA:function(){},getRenderData:function(t,e){if(!GY)return null;var i=GY.getRenderDataList(),n=i[GY.dataOffset];if(!n)return null;var r=n,s=r?r.vertexStart+e:0;return(s>65535||3*s>131070)&&(++GY.dataOffset,GY.dataOffset0&&(r=1/e);for(var s=t.paths,a=t.pathOffset,o=t.pathLength;a1e-6){var E=1/d;E>600&&(E=600),_.dmx*=E,_.dmy*=E}_.dx*c.dy-c.dx*_.dy>0&&(_.flags|=wH.PT_LEFT),d*(p=DY(11,PY(c.len,_.len)*r))*p<1&&(_.flags|=wH.PT_INNERBEVEL),_.flags&wH.PT_CORNER&&(d*n*n<1||i===CH.BEVEL||i===CH.ROUND)&&(_.flags|=wH.PT_BEVEL),0!=(_.flags&(wH.PT_BEVEL|wH.PT_INNERBEVEL))&&u.bevel++,c=_,_=h[f+1]}}},_flattenPaths:function(t){for(var e=t.paths,i=t.pathOffset,n=t.pathLength;i2&&a.equals(o)&&(r.closed=!0,s.pop(),a=s[s.length-1]);for(var u=0,h=s.length;um&&(g-=2*xY),this._vSet(_,f,1),this._vSet(h-s*n,e.y-a*n,-1);for(var v=VY(BY((m-g)/xY)*r,2,r),y=0;y0&&n>0&&E+h.w*_K>bK&&!VU(c)){eK.push(a),a=0,i++,n=0,r-=EK*this._getFontScale()+0,g=!0;break}sK.x=E,sK.y=r-h.offsetY*_K,this._recordLetterInfo(sK,c,y,i),y+1<$Y.length&&ysK.y-h.h*_K&&(d=sK.y-h.h*_K)}else this._recordPlaceholderInfo(y,c),console.log("Can't find letter definition in texture atlas "+aK.atlasName+" for letter:"+c);else this._recordPlaceholderInfo(y,c)}g||(n=m,od&&(u=d),s<(a=p)&&(s=a),l+=_)}else eK.push(a),a=0,i++,n=0,r-=EK*this._getFontScale()+0,this._recordPlaceholderInfo(l,c),l++}return eK.push(a),uK=(oK=i+1)*EK*this._getFontScale(),oK>1&&(uK+=0*(oK-1)),rK.width=AK,rK.height=RK,AK<=0&&(rK.width=parseFloat(s.toFixed(2))+2*nG.margin),RK<=0&&(rK.height=parseFloat(uK.toFixed(2))+2*nG.margin),lK=rK.height,cK=0,o>0&&(lK=rK.height+o),u<-uK&&(cK=uK+u),!0},_getFirstCharLen:function(){return 1},_getFontScale:function(){return TK===Uz.SHRINK?_K:1},_getFirstWordLen:function(t,e,i){var n=t.charAt(e);if(HU(n)||"\n"===n||VU(n))return 1;var r=1,s=nG.fontAtlas.getLetterDefinitionForChar(n,nG);if(!s)return r;for(var a=s.xAdvance*_K+yK,o=e+1;obK&&!VU(n)&&bK>0)return r;if(a+=s.xAdvance*_K+yK,"\n"===n||VU(n)||HU(n))break;r++}return r},_multilineTextWrapByWord:function(){return this._multilineTextWrap(this._getFirstWordLen)},_multilineTextWrapByChar:function(){return this._multilineTextWrap(this._getFirstCharLen)},_recordPlaceholderInfo:function(t,e){if(t>=tK.length){var i=new YY;tK.push(i)}tK[t].char=e,tK[t].hash=""+e.charCodeAt(0)+nG.hash,tK[t].valid=!1},_recordLetterInfo:function(t,e,i,n){if(i>=tK.length){var r=new YY;tK.push(r)}var s=""+e.charCodeAt(0)+nG.hash;tK[i].line=n,tK[i].char=e,tK[i].hash=s,tK[i].valid=nG.fontAtlas.getLetter(s).valid,tK[i].x=t.x,tK[i].y=t.y},_alignText:function(){uK=0,eK.length=0,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),TK===Uz.SHRINK&&pK>0&&this._isVerticalClamp()&&this._shrinkLabelToContentSize(this._isVerticalClamp),this._updateQuads()||TK===Uz.SHRINK&&this._shrinkLabelToContentSize(this._isHorizontalClamp)},_scaleFontSizeDown:function(t){var e=!0;t||(t=.1,e=!1),pK=t,e&&this._updateContent()},_shrinkLabelToContentSize:function(t){for(var e=0,i=0|pK,n=0;e>1;if(r<=0)break;_K=r/mK,this._multilineTextWrapByWord(),this._computeAlignmentOffset(),t()?i=n-1:e=n}e>=0&&this._scaleFontSizeDown(e)},_isVerticalClamp:function(){return uK>rK.height},_isHorizontalClamp:function(){for(var t=!1,e=0,i=dK.length;e0)if(SK){if(eK[a]>rK.width&&(s>rK.width||s<0)){t=!0;break}}else if(s>rK.width){t=!0;break}}}return t},_isHorizontalClamped:function(t,e){var i=eK[e],n=t>rK.width||t<0;return SK?i>rK.width&&n:n},_updateQuads:function(){if(!ZY)return!1;var t=fK?fK.texture:nG.fontAtlas.getTexture(),e=ZY.renderData;e.dataLength=0,e.resize(0,0);for(var i=JY.anchorPoint,n=rK,r=i.x*n.width,s=i.y*n.height,a=!0,o=0,u=dK.length;o0){if(c>lK){var _=c-lK;KY.y+=_,KY.height-=_,c-=_}c-KY.height*_K0&&this._isHorizontalClamped(d,f))if(TK===Uz.CLAMP)KY.width=0;else if(TK===Uz.SHRINK){if(rK.width>l.w){a=!1;break}KY.width=0}if(KY.height>0&&KY.width>0){var p=this._determineRect(),m=h.x+iK[h.line];this.appendQuad(ZY,t,KY,p,m-r,c-s,_K)}}else console.warn("Can't find letter in this bitmap-font")}}var g=e.indexCount;return this.createQuadIndices(g),e.chunk.setIndexBuffer(jY),a},createQuadIndices:function(t){if(t%6==0){var e=t/6;jY=null,jY=new Uint16Array(t);for(var i=0,n=0;n0&&(i=i+t.margin+t.out.toHEX()),""+t.fontSize+t.fontFamily+e+i}(nG)},_getFontDesc:function(){return nG.fontSize.toString()+"px "+nG.fontFamily},_computeHorizontalKerningForText:function(){},_determineRect:function(){return!1}}),PK=new Gi(255,255,255,255),DK={createData:function(t){return t.requestRenderData()},fillBuffers:function(t){if(t.renderData){var e=t.node;PK.a=255*e._uiProps.opacity,vF(e,0,t.renderData,PK)}},appendQuad:IK.appendQuad};Vt(DK,xK);var BK=zz.Overflow,NK=(1/255).toFixed(3),MK=null,LK=null,FK=null,UK="",GK="",kK=0,zK=0,HK=[],VK=new gn,WK=0,XK=0,jK=0,YK=new Gi,KK="",qK=BK.NONE,QK=!1,ZK=null,JK=Gi.BLACK.clone(),$K=null,tq=Gi.BLACK.clone(),eq=new yn,iq=gn.ZERO.clone(),nq=gn.ZERO.clone(),rq=_n.ZERO.clone(),sq=_n.ZERO.clone(),aq=0,oq=0,uq=!1,hq=!1,lq=!1,cq=["left","center","right"],_q={getAssemblerData:function(){var t=zz._canvasPool.get();return t.canvas.width=t.canvas.height=1,t},resetAssemblerData:function(t){t&&zz._canvasPool.put(t)},updateRenderData:function(t){if(t.renderData){if(t.renderData.vertDirty){var e=t.node._uiProps.uiTransformComp;this._updateFontFamily(t),this._updateProperties(t,e),this._calculateLabelFont(),this._updateLabelDimensions(),this._updateTexture(t),this._calDynamicAtlas(t),t.actualFontSize=kK,e.setContentSize(VK),this.updateVertexData(t),this.updateUVs(t),t.renderData.vertDirty=!1,t.contentWidth=nq.width,MK=null,LK=null,FK=null}t.spriteFrame&&t.renderData.updateRenderData(t,t.spriteFrame)}},updateVertexData:function(){},updateUVs:function(){},_updateFontFamily:function(t){KK=t.useSystemFont?t.fontFamily||"Arial":t.font&&t.font._nativeAsset||"Arial"},_updateProperties:function(t,e){var i=t.assemblerData;i&&(MK=i.context,LK=i.canvas,FK=t.spriteFrame,GK=t.string.toString(),kK=t.fontSize,zK=kK,qK=t.overflow,nq.width=VK.width=e.width,nq.height=VK.height=e.height,oq=t.underlineHeight,WK=t.lineHeight,XK=t.horizontalAlign,jK=t.verticalAlign,YK=t.color,t.node._uiProps.opacity,uq=t.isBold,hq=t.isItalic,lq=t.isUnderline,QK=qK!==BK.NONE&&(qK===BK.RESIZE_HEIGHT||t.enableWrapText),(ZK=(ZK=tX&&t.getComponent(tX))&&ZK.enabled&&ZK.width>0?ZK:null)&&JK.set(ZK.color),($K=($K=aY&&t.getComponent(aY))&&$K.enabled?$K:null)&&tq.set($K.color),this._updatePaddingRect())},_updatePaddingRect:function(){var t=0,e=0,i=0,n=0,r=0;if(iq.width=iq.height=0,ZK&&(t=e=i=n=r=ZK.width,iq.width=iq.height=2*r),$K){var s=$K.blur+r,a=$K.offset.x,o=$K.offset.y;i=Math.max(i,-a+s),n=Math.max(n,a+s),t=Math.max(t,o+s),e=Math.max(e,-o+s)}if(hq){var u=zK*Math.tan(.20943951);n+=u,iq.width+=u}eq.x=i,eq.y=t,eq.width=i+n,eq.height=t+e},_calculateFillTextStartPosition:function(){var t=0;XK===Lz.RIGHT?t=VK.width-eq.width:XK===Lz.CENTER&&(t=(VK.width-eq.width)/2);var e=this._getLineHeight()*(HK.length-1),i=kK*(1-DU/2);if(jK!==Fz.TOP){var n=e+eq.height+kK-VK.height;jK===Fz.BOTTOM?i-=n+=DU/2*kK:i-=n/2}i+=0*kK,rq.set(t+eq.x,i+eq.y)},_updateTexture:function(t){if(MK&&LK){MK.clearRect(0,0,LK.width,LK.height),MK.font=UK,this._calculateFillTextStartPosition();var e=this._getLineHeight();MK.lineJoin="round",ZK?(MK.fillStyle="rgba("+JK.r+", "+JK.g+", "+JK.b+", "+NK+")",MK.fillRect(0,0,LK.width,LK.height)):t._srcBlendFactor===jn.SRC_ALPHA&&(MK.fillStyle="rgba("+YK.r+", "+YK.g+", "+YK.b+", "+NK+")",MK.fillRect(0,0,LK.width,LK.height)),MK.fillStyle="rgb("+YK.r+", "+YK.g+", "+YK.b+")";var i=rq.x,n=0;this._drawTextEffect(rq,e);for(var r=0;r1&&$K,n=this._measureText(MK,UK),r=0,s=0;$K&&this._setupShadow(),ZK&&this._setupOutline();for(var a=0;a>1)<=0){W(4003);break}kK=h,UK=this._getFontDesc(),MK.font=UK;var l=this._getLineHeight();for(n=0,i=0;ia?u=h-1:o=h}0===o?W(4003):(kK=o,UK=this._getFontDesc(),MK.font=UK)}else{for(n=t.length*this._getLineHeight(),i=0;ir?e:r}i=(HK.length+DU)*this._getLineHeight();var s=parseFloat(e.toFixed(2)),a=parseFloat(i.toFixed(2));VK.width=s+eq.width,VK.height=a+eq.height,nq.width=s+iq.width,nq.height=a+iq.height;break;case BK.SHRINK:this._calculateShrinkFont(t),this._calculateWrapText(t);break;case BK.CLAMP:this._calculateWrapText(t);break;case BK.RESIZE_HEIGHT:this._calculateWrapText(t);var o=(HK.length+DU)*this._getLineHeight();VK.height=o+eq.height,nq.height=o+iq.height}}}},fq=Gi.WHITE.clone(),dq=Uint16Array.from([0,1,2,1,3,2]),pq={createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6);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++)Gi.toArray(i,fq,n),n+=9;return e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(dq),e},fillBuffers:function(t){for(var e=t.renderData,i=e.chunk,n=e.data,r=t.node,s=i.vb,a=r.worldMatrix,o=e.floatStride,u=0,h=n.length,l=0;l1?1:r)<0?0:r;var s=(n=(n=n>1?1:n)<0?0:n)+(r=(r-=n)<0?0:r);s=s>1?1:s,this.updateUVs(t,n,s),this.updateVertexData(t,n,s),i.updateRenderData(t,e)}},updateUVs:function(t,e,i){var n=t.spriteFrame,r=t.renderData.chunk.vb,s=n.width,a=n.height,o=n.rect,u=0,h=0,l=0,c=0,_=0,f=0,d=0,p=0,m=0,g=0;switch(n.isRotated()?(u=o.x/s,h=(o.y+o.width)/a,l=_=u,d=m=(o.x+o.height)/s,f=g=h,c=p=o.y/a):(u=o.x/s,h=(o.y+o.height)/a,l=d=u,_=m=(o.x+o.width)/s,c=f=h,p=g=o.y/a),t.fillType){case vq.HORIZONTAL:r[3]=l+(_-l)*e,r[4]=c+(f-c)*e,r[12]=l+(_-l)*i,r[13]=c+(f-c)*i,r[21]=d+(m-d)*e,r[22]=p+(g-p)*e,r[30]=d+(m-d)*i,r[31]=p+(g-p)*i;break;case vq.VERTICAL:r[3]=l+(d-l)*e,r[4]=c+(p-c)*e,r[12]=_+(m-_)*e,r[13]=f+(g-f)*e,r[21]=l+(d-l)*i,r[22]=c+(p-c)*i,r[30]=_+(m-_)*i,r[31]=f+(g-f)*i;break;default:K(2626)}},updateVertexData:function(t,e,i){var n=t.renderData.data,r=t.node._uiProps.uiTransformComp,s=r.width,a=r.height,o=r.anchorX*s,u=r.anchorY*a,h=-o,l=-u,c=s-o,_=a-u,f=0;switch(t.fillType){case vq.HORIZONTAL:f=h+(c-h)*i,h+=(c-h)*e,c=f;break;case vq.VERTICAL:f=l+(_-l)*i,l+=(_-l)*e,_=f;break;default:K(2626)}n[0].x=h,n[0].y=l,n[1].x=c,n[1].y=l,n[2].x=h,n[2].y=_,n[3].x=c,n[3].y=_},createData:function(t){var e=t.requestRenderData();e.dataLength=4,e.resize(4,6),e.vertexRow=2,e.vertexCol=2,e.chunk.setIndexBuffer(Eq);for(var i,n=y(e.data);!(i=n()).done;)i.value.z=0;return e},updateWorldVertexData:function(t,e){t.node.getWorldMatrix(yq);for(var i=t.renderData.floatStride,n=t.renderData.data,r=e.vb,s=0,a=0;a<4;a++){var o=n[a],u=o.x,h=o.y,l=yq.m03*u+yq.m07*h+yq.m15;l=l?Math.abs(1/l):1,r[s=a*i]=(yq.m00*u+yq.m04*h+yq.m12)*l,r[s+1]=(yq.m01*u+yq.m05*h+yq.m13)*l,r[s+2]=(yq.m02*u+yq.m06*h+yq.m14)*l}},fillBuffers:function(t){var e=t.renderData,i=e.chunk;(t.node.hasChangedFlags||e.vertDirty)&&(this.updateWorldVertexData(t,i),e.vertDirty=!1),i.bufferId;var n=i.vertexOffset,r=i.meshBuffer,s=i.meshBuffer.iData,a=r.indexOffset;s[a++]=n,s[a++]=n+1,s[a++]=n+2,s[a++]=n+2,s[a++]=n+1,s[a++]=n+3,r.indexOffset+=6},updateColor:function(t){for(var e=t.renderData,i=e.chunk.vb,n=e.floatStride,r=5,s=t.color,a=s.r/255,o=s.g/255,u=s.b/255,h=t.node._uiProps.opacity,l=0;l<4;l++)i[r]=a,i[r+1]=o,i[r+2]=u,i[r+3]=h,r+=n}},Sq=2*Math.PI,Aq=1e-6,Rq=new un,bq=[new _n,new _n,new _n,new _n],Cq=new Array(4),wq=new Array(8),Iq=[new _n,new _n,new _n,new _n],Oq=[new _n,new _n,new _n,new _n],xq=new _n,Pq=[new _n,new _n,new _n,new _n];function Dq(t,e,i,n,r,s,a){var o=Math.sin(s);o=Math.abs(o)>Aq?o:0;var u=Math.cos(s),h=0,l=0;if(0!==(u=Math.abs(u)>Aq?u:0)){if(h=o/u,(t-r.x)*u>0){var c=r.y+h*(t-r.x);a[0].x=t,a[0].y=c}if((e-r.x)*u>0){var _=r.y+h*(e-r.x);a[2].x=e,a[2].y=_}}if(0!==o){if(l=u/o,(n-r.y)*o>0){var f=r.x+l*(n-r.y);a[3].x=f,a[3].y=n}if((i-r.y)*o>0){var d=r.x+l*(i-r.y);a[1].x=d,a[1].y=i}}}function Bq(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 Nq(t,e,i,n,r){var s=Cq,a=s[0],o=s[1],u=s[2],h=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,Mq((i.x-a)/(u-a),(i.y-o)/(h-o),t,e),Mq((n.x-a)/(u-a),(n.y-o)/(h-o),t,e+1),Mq((r.x-a)/(u-a),(r.y-o)/(h-o),t,e+2)}function Mq(t,e,i,n){var r=wq,s=r[0]+(r[2]-r[0])*t,a=r[4]+(r[6]-r[4])*t,o=r[1]+(r[3]-r[1])*t,u=r[5]+(r[7]-r[5])*t,h=i[n];h.u=s+(a-s)*e,h.v=o+(u-o)*e}for(var Lq={useModel:!1,createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.spriteFrame;RF.packToDynamicAtlas(t,e),this.updateUVs(t);var i=t.renderData;if(i&&e){if(!i.vertDirty)return;var n=i.data,r=t.fillStart,s=t.fillRange;for(s<0&&(r+=s,s=-s);r>=1;)r-=1;for(;r<0;)r+=1;var a=(r*=Sq)+(s*=Sq);!function(t){var e=t.node._uiProps.uiTransformComp,i=e.width,n=e.height,r=e.anchorX*i,s=e.anchorY*n,a=-r,o=-s,u=i-r,h=n-s,l=Cq;l[0]=a,l[1]=o,l[2]=u,l[3]=h;var c=t.fillCenter,_=xq.x=Math.min(Math.max(0,c.x),1)*(u-a)+a,f=xq.y=Math.min(Math.max(0,c.y),1)*(h-o)+o;bq[0].x=bq[3].x=a,bq[1].x=bq[2].x=u,bq[0].y=bq[1].y=o,bq[2].y=bq[3].y=h;for(var d,p=y(Pq);!(d=p()).done;){var m=d.value;_n.set(m,0,0)}_!==l[0]&&_n.set(Pq[0],3,0),_!==l[2]&&_n.set(Pq[2],1,2),f!==l[1]&&_n.set(Pq[1],0,1),f!==l[3]&&_n.set(Pq[3],2,3)}(t),function(t){var e=t.width,i=t.height,n=t.getRect(),r=0,s=0,a=0,o=0,u=wq;t.isRotated()?(r=n.x/e,s=(n.x+n.height)/e,a=n.y/i,o=(n.y+n.width)/i,u[0]=u[2]=r,u[4]=u[6]=s,u[3]=u[7]=o,u[1]=u[5]=a):(r=n.x/e,s=(n.x+n.width)/e,a=n.y/i,o=(n.y+n.height)/i,u[0]=u[4]=r,u[2]=u[6]=s,u[1]=u[3]=o,u[5]=u[7]=a)}(e),Dq(Cq[0],Cq[2],Cq[1],Cq[3],xq,r,Iq),Dq(Cq[0],Cq[2],Cq[1],Cq[3],xq,r+s,Oq);for(var o=0,u=0;u<4;++u){var h=Pq[u];if(h)if(s>=Sq)i.dataLength=o+3,Nq(n,o,xq,bq[h.x],bq[h.y]),o+=3;else{var l=Bq(xq,bq[h.x]),c=Bq(xq,bq[h.y]);c=a||(l>=r?(i.dataLength=o+3,Nq(n,o,xq,bq[h.x],c>=a?Oq[u]:bq[h.y]),o+=3):c>r&&(c<=a?(i.dataLength=o+3,Nq(n,o,xq,Iq[u],bq[h.y]),o+=3):(i.dataLength=o+3,Nq(n,o,xq,Iq[u],Oq[u]),o+=3))),l+=Sq,c+=Sq}}0===o&&(i.dataLength=0),i.resize(o,o),i.updateRenderData(t,e)}},createQuadIndices:function(t){gq=null,gq=new Uint16Array(t);for(var e=0,i=0;i1?1:p,m=Number.isNaN(m)||m>1?1:m,f=f<0?0:f,d=d<0?0:d,kq[0].x=-a,kq[0].y=-o,kq[1].x=h*p-a,kq[1].y=_*m-o,kq[2].x=kq[1].x+f,kq[2].y=kq[1].y+d,kq[3].x=r-a,kq[3].y=s-o;for(var g=0;g0||t.insetBottom>0||t.insetLeft>0||t.insetRight>0)?2:0}var eQ={createData:function(t){return t.requestRenderData()},updateRenderData:function(t){var e=t.renderData,i=t.spriteFrame;if(i&&e&&e.vertDirty){var n=t.node._uiProps.uiTransformComp,r=Math.abs(n.width),s=Math.abs(n.height),a=i.getRect(),o=i.insetLeft,u=i.insetRight,h=a.width-o-u,l=i.insetTop,c=i.insetBottom,_=a.height-l-c,f=r-o-u,d=s-l-c;f=f>0?f:0,d=d>0?d:0;var p=0===h?f:f/h,m=0===_?d:d/_,g=tQ(i),v=Math.ceil(m+g),y=Math.ceil(p+g);e.dataLength=4*v*y,this.updateVerts(t,f,d,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;qq=null,qq=new Uint16Array(t);for(var i=0,n=0;n1?1:o.width/(p+m),S=o.height/(v+y)>1?1:o.height/(v+y);s=g>0?Math.floor(1e3*e)/1e3%g==0?g:e%g:e,a=E>0?Math.floor(1e3*i)/1e3%E==0?E:i%E:i,Jq=Math.max(n+1,r+1);for(var A=0;A=r?c-f:b*g-f,$q[b].y=b>=n?_-d:b*E-d;else for(var C=0;C1&&C0?p*T-f+g*(C-1):p+e-f:C===r-1?$q[C].x=p*T-f+s+g*(C-2):C>=r&&($q[C].x=Math.min(p+e+m,c)-f),0===C?$q[C].y=-d:1===C?$q[C].y=y*S-d:C>1&&C0?y*S-d+E*(C-1):y+i-d:C===n-1?$q[C].y=y*S-d+a+E*(C-2):C>=n&&($q[C].y=Math.min(y+i+v,_)-d);for(var w=0,I=0,O=0,x=0,P=0;PE?i>=(R>0?H:H+1)*E?1:G%1:G;for(var V=0;Vg?e>=(R>0?V:V+1)*g?1:U%1:U,N?(0===R?(k[0]=jq.u,k[1]=jq.u,k[2]=jq.u+(Yq.u-jq.u)*F,z[0]=Vq.v,z[1]=Vq.v+(Wq.v-Vq.v)*L,z[2]=Vq.v):(0===H?(k[0]=Hq.u,k[1]=Hq.u,k[2]=jq.u):H0){var o=a.claimedTouchIdList.indexOf(n.getID());if(-1!==o){if(a._handleEventTouch(t),t.type!==oA.TOUCH_END&&t.type!==oA.TOUCH_CANCEL||le.array.removeAt(a.claimedTouchIdList,o),r=!1,!t.preventSwallow)break;t.preventSwallow=!1}}}return--this._inDispatchCount<=0&&this._updatePointerEventProcessorList(),r},e._updatePointerEventProcessorList=function(){for(var t=this._processorListToAdd,e=t.length,i=0;ie)for(;e0&&(this._meshDataArray.forEach((function(t){t.uploadBuffers()})),this._bufferAccessors.forEach((function(t){t.uploadBuffers(),t.reset()})),this._descriptorSetCache.update())},e.reset=function(){for(var t=0;t0){!function(t,e){for(var i,n,r,s=t.vertexFormat,a=t.chunk.vb,o=0,u=0;u>>0;else if(n.size/n.count==4)for(var c=o+3;c>2}}(r.renderData,a);var u=r.renderData.getMeshBuffer();u&&u.setDirty()}if(i.length>0&&!t._static)for(var h=0;h0&&(this.autoMergeBatches(this._currComponent),this.resetRenderStates(),IG.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=vy.get("default-clear-stencil"),this._maskClearModel=b.director.root.createModel(mB);var t=cG(rG),e=Ja.gfxDevice,i=e.createBuffer(new Mr(Dn.VERTEX|Dn.TRANSFER_DST,Mn.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 Mr(Dn.INDEX|Dn.TRANSFER_DST,Mn.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 wN([i],rG,er.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=IG.sharedManager;e.pushMask(1);var i,n=e.clear(t),r=0,s=this._maskClearMtl;s&&(i=e.getStencilStage(n,s),r=e.getStencilHash(n));var a=this._maskClearModel,o=b.director.getTotalFrames();a&&(a.updateTransform(o),a.updateUBOs(o));for(var u=0;u=0;i--)t.splice(e[i],1)},e.reset=function(){var t=this;this._localDescriptorSetCache.forEach((function(e){t._localCachePool.free(e)})),this._localDescriptorSetCache.length=0},e.releaseDescriptorSetCache=function(t){var e=this._dsCacheHashByTexture.get(t);e&&this._descriptorSetCache.has(e)&&(this._descriptorSetCache.get(e).destroy(),this._descriptorSetCache.delete(e),this._dsCacheHashByTexture.delete(t))},e.destroy=function(){this._descriptorSetCache.forEach((function(t){t.destroy()})),this._descriptorSetCache.clear(),this._dsCacheHashByTexture.clear(),this._localDescriptorSetCache.length=0,this._localCachePool.destroy()},t}();b.internal.Batcher2D=hQ,t("UIDrawBatch",function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(rY)),nt(vG.prototype,"MeshBuffer",["byteStart","vertexStart","indicesStart","request"].map((function(t){return{name:t,suggest:"please use meshBuffer.accessor."+t+" instead"}}))),et(vG.prototype,"MeshBuffer",[{name:"indicesOffset",newName:"indexOffset"}]),it(vG.prototype,"MeshBuffer",[{name:"vertexBuffers"},{name:"indexBuffer"}]),et(hQ.prototype,"Batcher2D",[{name:"currBufferBatch",newName:"currBufferAccessor"},{name:"acquireBufferBatch",newName:"switchBufferAccessor"}]),it(dk.prototype,"MeshRenderData",[{name:"formatByte"},{name:"byteStart"},{name:"byteCount"}]),et(dk.prototype,"MeshRenderData",[{name:"indicesStart",newName:"indexStart"}]),t("QuadRenderData",function(t){function e(e){var i;return i=t.call(this,e)||this,j(9006),i}return c(e,t),e}(dk));var _Q,fQ=null,dQ=-1,pQ="BES bswy:->@123丁ぁᄁ",mQ=Object.create(null),gQ=[],vQ=3e3;function yQ(){for(var t=!0,e=Date.now(),i=gQ.length-1;i>=0;i--){var n=gQ[i],r=n.fontFamilyName;if(e-n.startTime>vQ)j(4933,r),n.onComplete(null,r),gQ.splice(i,1);else{var s=n.refWidth,a="40px "+r;fQ.font=a,s!==WU(fQ,pQ,a)?(gQ.splice(i,1),n.onComplete(null,r)):t=!1}}t&&(clearInterval(dQ),dQ=-1)}function EQ(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(mQ[n])i(null,n);else{if(!fQ){var r=document.createElement("canvas");r.width=100,r.height=100,fQ=r.getContext("2d")}var s=WU(fQ,pQ,"40px "+n),a=document.createElement("style");a.type="text/css";var o="";Number.isNaN(n)?o+="@font-face { font-family:"+n+"; src:":o+='@font-face { font-family:"'+n+'"; src:',o+='url("'+t+'");',a.textContent=o+"}",document.body.appendChild(a);var u=document.createElement("div"),h=u.style;if(h.fontFamily=n,u.innerHTML=".",h.position="absolute",h.left="-100px",h.top="-100px",document.body.appendChild(u),function(){if(void 0===_Q)if("FontFace"in window){var t=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent),e=/OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgent)&&/Apple/.exec(window.navigator.vendor);_Q=t?parseInt(t[1],10)>42:!e}else _Q=!1;return _Q}())!function(t,e,i){var n=new Promise((function(i,n){!function r(){Date.now()-t>=vQ?n():document.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,vQ)}));Promise.race([s,n]).then((function(){r&&(clearTimeout(r),r=null),i(null,e)}),(function(){j(4933,e),i(null,e)}))}(Date.now(),n,i);else{var l={fontFamilyName:n,refWidth:s,onComplete:i,startTime:Date.now()};gQ.push(l),-1===dQ&&(dQ=setInterval(yQ,100))}mQ[n]=a}}function TQ(t,e,i,n){var r=new CU;r._nativeUrl=t,r._nativeAsset=e,n(null,r)}Gv.register({".font":EQ,".eot":EQ,".ttf":EQ,".woff":EQ,".svg":EQ,".ttc":EQ}),Zv.register({".font":TQ,".eot":TQ,".ttf":TQ,".woff":TQ,".svg":TQ,".ttc":TQ}),b.UI={MeshBuffer:vG,spriteAssembler:rQ,graphicsAssembler:XY,labelAssembler:mq,RenderData:fk,MeshRenderData:dk};var SQ,AQ,RQ,bQ,CQ,wQ,IQ,OQ=Symbol("CreateEval"),xQ=(_h("cc.animation.EmbeddedPlayer")((wQ=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;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(IQ.PLAY,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onStop=function(){var t;this.isPaused||this._onPauseOrStop(),this.emit(IQ.STOP,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostStop()},i.onResume=function(){var t;this._onReplayOrResume(),this.emit(IQ.RESUME,this),null===(t=this._clipEmbeddedPlayerEval)||void 0===t||t.notifyHostPlay(this.current)},i.onPause=function(){var t;this._onPauseOrStop(),this.emit(IQ.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 Zu(e),this.repeatCount>1&&(0|e.iterations)>(0|t.iterations)&&this.emit(IQ.LASTFRAME,this),t.set(e)),e.stopped&&(this.stop(),this.emit(IQ.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&Wu.Reverse)===Wu.Reverse&&(i=!i),i},i.getWrappedInfo=function(t,e){e=e||new Zu;var i=this._playbackRange.min,n=this._playbackDuration,r=this.repeatCount;if(0===n)return e.time=0,e.ratio=0,e.direction=1,e.stopped=!!Number.isFinite(r),e.iterations=0,e;var s=!1,a=(t-=i)>0?t/n:-t/n;if(a>=r){a=r,s=!0;var o=r-(0|r);0===o&&(o=1),t=o*n*(t>0?1:-1)}if(t>n){var u=t%n;t=0===u?n:u}else t<0&&0!=(t%=n)&&(t+=n);var h=!1,l=this._wrapMode&Wu.ShouldWrap;l&&(h=this._needReverse(a));var c=h?-1:1;return this.speed<0&&(c*=-1),l&&h&&(t=n-t),e.time=i+t,e.ratio=e.time/this.duration,e.direction=c,e.stopped=s,e.iterations=a,e},i._getPlaybackStart=function(){return this._playbackRange.min},i._sampleEvents=function(t){var e;null===(e=this._clipEventEval)||void 0===e||e.sample(t.ratio,t.direction,t.iterations)},i._sampleEmbeddedPlayers=function(t){var e;null===(e=this._clipEmbeddedPlayerEval)||void 0===e||e.evaluate(t.time,Math.trunc(t.iterations))},i._emit=function(t,e){this._target&&this._target.isValid&&this._target.emit(t,t,e)},i._onReplayOrResume=function(){NQ().addAnimation(this)},i._onPauseOrStop=function(){NQ().removeAnimation(this)},h(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&Wu.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&Wu.ShouldWrap,i=(this.wrapMode&Wu.Reverse)===Wu.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}(DQ));b.AnimationState=GQ,_h("cc.animation.EmbeddedAnimationClipPlayable")((UQ=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 eJ(new Pf)})))}}}]),e}(tJ),AZ=T((SZ=RZ).prototype,"_channels",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),SZ)),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;n1}return!1}(e,this.uniformName)?{set:function(t){e.setUniformArray(n,t)}}:{set:function(t){e.setUniform(n,t)}}}var r=by.getBindingFromHandle(i),s=e.properties[this.uniformName],a=s&&s.value?""+s.value+Mm(s.type):Nm(s.type),o=vy.get(a);return o||(L("Illegal texture default value: "+a+"."),o=vy.get("default-texture")),{set:function(t){t||(t=o);var i=t.getGFXTexture();i&&i.width&&i.height&&(e.bindTexture(r,i),t instanceof Tg&&e.bindSampler(r,Ja.gfxDevice.getSampler(t.getSamplerInfo())))}}},t}(),wZ=T((CZ=xZ).prototype,"passIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),IZ=T(CZ.prototype,"uniformName",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),OZ=T(CZ.prototype,"channelIndex",[Xh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){}}),bZ=CZ))||bZ,aJ=_h("cc.animation.MorphWeightValueProxy")((MZ=function(){function t(){E(this,"subMeshIndex",BZ,this),E(this,"shapeIndex",NZ,this)}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeight(i,e.subMeshIndex,e.shapeIndex)}}},t}(),BZ=T((DZ=MZ).prototype,"subMeshIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),NZ=T(DZ.prototype,"shapeIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),PZ=DZ))||PZ,oJ=_h("cc.animation.MorphWeightsValueProxy")((GZ=function(){function t(){E(this,"subMeshIndex",UZ,this)}return t.prototype.forTarget=function(t){var e=this;return{set:function(i){t.setWeights(i,e.subMeshIndex)}}},t}(),UZ=T((FZ=GZ).prototype,"subMeshIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),LZ=FZ))||LZ,uJ=_h("cc.animation.MorphWeightsAllValueProxy")(kZ=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?ZJ:Ju}return t.prototype.sample=function(t){return this._findRatio(this.ratios,t)},t}());b.RatioSampler=YJ;var KJ=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 QJ(t,e){if("string"==typeof e){var i=Ef[e];i?t=i(t):K(3906,e)}else Array.isArray(e)&&(t=fd(e,t));return t}function ZJ(t,e){var i=t.length-1;if(0===i)return 0;var n=t[0];if(er)return i;var s=(e=(e-n)/(r-n))/(1/i),a=0|s,o=1e-6;return s-a=0)i=r;else{var s=~r,a=s-1;i=a;var o=t[s],u=t[a];n=(e-u)/(o-u)}return{index:i,ratio:n}}!function(){function t(){this._reset()}var e=t.prototype;e.transformTime=function(t){return t-this._timeOffset},e.calculate=function(t,e,i){this._reset();var n=t.length;if(n){var r=t[0],s=t[n-1],a=vi(e,r,s),o=vi(i,r,s);this._timeOffset=a;var u=function(t,e,i){var n=t.length;i>=e&&e>=t[0]&&t[n-1];var r=t0(t,e),s=r.index,a=r.ratio,o=t0(t,i);return{fromIndex:s,fromRatio:a,toIndex:o.index,toRatio:o.ratio}}(t,a,o),h=u.fromIndex,l=u.fromRatio,c=u.toIndex,_=u.toRatio,f=!l,d=!_;h!==c||l!==_?(f||(this.preLerpIndex=h,this.preLerpRatio=l),this.directKeyframesBegin=f?h:h+1,this.directKeyframesEnd=c+1,d||(this.postLerpIndex=c,this.postLerpRatio=_)):f?(this.directKeyframesBegin=h,this.directKeyframesEnd=h+1):(this.preLerpIndex=h,this.preLerpRatio=l)}},e._reset=function(){this.preLerpIndex=-1,this.preLerpRatio=0,this.directKeyframesBegin=0,this.directKeyframesEnd=0,this.postLerpIndex=-1,this.postLerpRatio=0,this._timeOffset=0},h(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 e0,i0=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}(),n0=function(){function t(t,e,i,n,r){this._position=null,this._rotation=null,this._scale=null,e&&(this._position=A0(e.times,e.values,ji,t,"position",r)),i&&(this._rotation=A0(i.times,i.values,$i,t,"rotation",r)),n&&(this._scale=A0(n.times,n.values,ji,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}(),r0=function(){function t(t,e,i){this._times=void 0,this._inputSampleResultCache={just:!1,index:-1,nextIndex:-1,ratio:0},this._values=void 0,this._prevValue=void 0,this._nextValue=void 0,this._resultValue=void 0,this._times=t,this._values=e,this._prevValue=new i,this._nextValue=new i,this._resultValue=new i}return t.prototype.evaluate=function(t){var e=this._times,i=this._values,n=this._resultValue;if(0===e.length)return n;var r=function(t,e,i){var n=t.length,r=t[0],s=t[n-1];if(es)i.just=!0,i.index=n-1;else{var a=Ju(t,e);if(a>=0)i.just=!0,i.index=a;else{var o=~a,u=o-1,h=t[u],l=t[o],c=(e-t[u])/(l-h);i.just=!1,i.index=u,i.nextIndex=o,i.ratio=c}}return i}(e,t,this._inputSampleResultCache);return r.just?i.get(r.index,n):i.lerp(r.index,r.nextIndex,r.ratio,this._prevValue,this._nextValue,n),n},t}(),s0={uint8:Uint8Array,uint16:Uint16Array};function a0(t){switch(t.BYTES_PER_ELEMENT){default:case 4:return e0.FLOAT_32;case 8:return e0.FLOAT_64}}!function(t){t[t.FLOAT_32=0]="FLOAT_32",t[t.FLOAT_64=1]="FLOAT_64"}(e0||(e0={}));var o0,u0,h0,l0,c0,_0,f0,d0,p0,m0,g0,v0,y0,E0,T0=_h("cc.animation.QuantizedFloatArray")((W$=function(){function t(t,e,i,n){void 0===n&&(n=0),E(this,"originalPrecision",k$,this),E(this,"min",z$,this),E(this,"extent",H$,this),E(this,"values",V$,this),this.originalPrecision=t,this.values=e,this.extent=i,this.min=n}return t.prototype.toHashString=function(){var t=this.originalPrecision,e=this.min,i=this.extent,n=this.values;return t+" "+K$(e)+" "+K$(i)+" "+n.join(" ")},h(t,[{key:"quantizationType",get:function(){switch(this.values.BYTES_PER_ELEMENT){default:case 1:return"uint8";case 2:return"uint16"}}}]),t}(),k$=T((G$=W$).prototype,"originalPrecision",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),z$=T(G$.prototype,"min",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),H$=T(G$.prototype,"extent",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),V$=T(G$.prototype,"values",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:null}),U$=G$))||U$;function S0(t,e){return t.values[e]/(1<=0){var _=h.substring(0,c),f=u[_];f&&(l.parent=f)}}for(var d=this._createEvalWithBinder(void 0,(function(t){var e=t.parseTrsPath();if(e){var i=u[e.node];if(i)return z0(i,e.property)}}),void 0),p=0;p=0&&this._embeddedPlayers.splice(e,1)},i[D0]=function(){this._embeddedPlayers.length=0},i._createEvalWithBinder=function(t,e,i){this._legacyDataDirty&&(this._legacyDataDirty=!1,this.syncLegacyData());var n,r=[];i&&(n=this._createRootMotionEvaluation(t,i,r));for(var s,a=[],o=this._tracks,u=o.length,h=0;h=c&&t<=_?o?e!==h&&(u.stop(),u.play(),a.entered=!0):(u.play(),a.entered=!0):o&&(u.stop(),a.entered=!1),a.lastIterations=e,a.entered){var f=t-c;a.instantiatedPlayer.setTime(f)}}}},e.notifyHostSpeedChanged=function(t){for(var e=this._embeddedPlayers,i=this._embeddedPlayerEvaluationInfos,n=e.length,r=0;r0?((s&Wu.PingPong)===Wu.PingPong?e*=-1:u=n,o++):1===e&&u===n-1&&ra)break}u+=e,this._doFire(u,!0)}while(u!==r&&u>-1&&u=e.length||this._ignoreIndex===t))for(var i=e[t],n=this._targetNode.components,r=i.events.length,s=0;s0||delete e[t])},e.apply=function(t){var e,i,n,r=this._transformApplyFlags,s=this._properties,a=s.position,o=s.scale,u=s.rotation,h=s.eulerAngles;r&&(a&&r&X0.POSITION&&(e=a.result),o&&r&X0.SCALE&&(i=o.result),h&&r&X0.EULER_ANGLES&&(n=h.result),u&&r&X0.ROTATION&&(n=u.result),(n||e||i)&&t.setRTS(n,e,i),this._transformApplyFlags=0)},h(t,[{key:"empty",get:function(){var t=this._properties;return!(t.position||t.rotation||t.eulerAngles||t.scale)}}]),t}(),J0=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.apply=function(e){var i=this._properties,n=i.position,r=i.scale,s=i.rotation,a=i.eulerAngles;n&&n.accumulatedWeight&&(this._transformApplyFlags|=X0.POSITION,n.accumulatedWeight<1&&n.blend(e.position,1-n.accumulatedWeight)),r&&r.accumulatedWeight&&(this._transformApplyFlags|=X0.SCALE,r.accumulatedWeight<1&&r.blend(e.scale,1-r.accumulatedWeight)),a&&a.accumulatedWeight&&(this._transformApplyFlags|=X0.EULER_ANGLES,a.accumulatedWeight<1&&a.blend(e.eulerAngles,1-a.accumulatedWeight)),s&&s.accumulatedWeight&&(this._transformApplyFlags|=X0.ROTATION,s.accumulatedWeight<1&&s.blend(e.rotation,1-s.accumulatedWeight)),t.prototype.apply.call(this,e),null==n||n.reset(),null==r||r.reset(),null==s||s.reset(),null==a||a.reset()},i._createVec3BlendState=function(){return new q0},i._createQuatBlendState=function(){return new Q0},e}(Z0),$0=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e.prototype.createNodeBlendState=function(){return new J0},e}(j0),t1=function(){function t(t){this.refCount=0,this.result=new ji,this._defaultValue=new ji,this._clipBlendResult=new ji,this._accumulatedWeight=0,ji.copy(this._defaultValue,t),ji.copy(this.result,t)}var e=t.prototype;return e.blend=function(t,e){this._accumulatedWeight=n1(this._clipBlendResult,this._clipBlendResult,this._accumulatedWeight,t,e)},e.commitLayerChange=function(t){var e=this.result,i=this._clipBlendResult,n=this._accumulatedWeight;n<1&&this.blend(this._defaultValue,1-n),ji.lerp(e,e,i,t),ji.zero(this._clipBlendResult),this._accumulatedWeight=0},e.reset=function(){ji.copy(this.result,this._defaultValue)},t}(),e1=function(){function t(t){this.refCount=0,this.result=new $i,this._defaultValue=new $i,this._clipBlendResult=new $i,this._accumulatedWeight=0,$i.copy(this._defaultValue,t),$i.copy(this.result,t)}var e=t.prototype;return e.blend=function(t,e){this._accumulatedWeight=r1(this._clipBlendResult,this._clipBlendResult,this._accumulatedWeight,t,e)},e.commitLayerChange=function(t){var e=this.result,i=this._clipBlendResult,n=this._accumulatedWeight;n<1&&this.blend(this._defaultValue,1-n),$i.slerp(e,e,i,t),$i.identity(this._clipBlendResult),this._accumulatedWeight=0},e.reset=function(){$i.copy(this.result,this._defaultValue)},t}(),i1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r>>0,e}c(e,t);var i=e.prototype;return i.setLayerMask=function(t){this._layerMask&=~(1<0;){t=u1[--i],u1[i]=null;var r=t.node;un.fromRTS(t.local,r.rotation,r.position,r.scale),n=un.multiply(t.world,n,t.local)}return n}function c1(t){for(var e=h1.get(t.uuid)||null;e;)h1.delete(e.node.uuid),e=e.parent}var _1=t("AnimationManager",_h((o1=a1=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?this._crossFades.fastRemoveAt(e):K(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):K(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(n){var r=e[n];if(i._sockets.find((function(t){return t.target===r.target})))return"continue";var s=t.getChildByPath(r.path),a=r.target&&s&&function(t,e){for(var i,n=null,r=0;t!==e;){var s=t.uuid;if(h1.has(s)){n=h1.get(s);break}n={node:t,local:new un,world:new un,stamp:-1,parent:null},h1.set(s,n),u1[r++]=n,t=t.parent,n=null}for(;r>0;)i=u1[--r],u1[r]=null,i.parent=n,n=i;return n}(s,t);a&&i._sockets.push({target:r.target,transform:a})},r=0;r=u.easeDuration){a=o+1,u.easeTime=u.easeDuration;break}}if(a!==i.length){for(var c=a;c=0||(this._clips.push(t),this.createState(t)))}}]),e}(Da(bc)),I1.EventType=IQ,T((R1=O1).prototype,"clips",[g1,v1],Object.getOwnPropertyDescriptor(R1.prototype,"clips"),R1.prototype),T(R1.prototype,"defaultClip",[y1,E1],Object.getOwnPropertyDescriptor(R1.prototype,"defaultClip"),R1.prototype),b1=T(R1.prototype,"playOnLoad",[Eh,T1],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),C1=T(R1.prototype,"_clips",[S1],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),w1=T(R1.prototype,"_defaultClip",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),A1=R1))||A1)||A1)||A1)||A1)||A1));function D1(t,e){return t===e||!!t&&!!e&&t._uuid===e._uuid&&t._uuid}b.Animation=P1,b.AnimationComponent=P1,le.setClassAlias(P1,"cc.AnimationComponent");var B1,N1,M1,L1=new un;b.easing=Ef,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"}(B1||(B1={})),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"}(N1||(N1={})),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"}(M1||(M1={}));var F1,U1=t("AudioPCMDataView",function(){function t(){if(this._bufferView=void 0,this._normalizeFactor=1,2===arguments.length)this._bufferView=arguments.length<=0?void 0:arguments[0],this._normalizeFactor=arguments.length<=1?void 0:arguments[1];else{var t=arguments.length<=0?void 0:arguments[0],e=arguments.length<=1?void 0:arguments[1],i=arguments.length<=2?void 0:arguments[2];this._bufferView=new e(t),this._normalizeFactor=i}}return t.prototype.getData=function(t){return this._bufferView[t]*this._normalizeFactor},h(t,[{key:"length",get:function(){return this._bufferView.length}}]),t}()),G1=0;function k1(t,e){var i;e.invoking||(e.invoking=!0,(i=e.func).call.apply(i,[t].concat(e.args)).then((function(){e.invoking=!1,t._operationQueue.shift(),t._eventTarget.emit(e.id.toString());var i=t._operationQueue[0];i&&k1(t,i)})).catch((function(){})))}function z1(t,e,i){var n=i.value;i.value=function(){for(var t=this,e=arguments.length,i=new Array(e),r=0;r=this.duration&&(this._startTime=this._now(),this._startOffset=0),e%this.duration},e.start=function(){this._isPaused=!1,this._startTime=this._now()},e.pause=function(){this._isPaused||(this._isPaused=!0,this._startOffset=this._calculateCurrentTime())},e.stop=function(){this._isPaused=!0,this._startOffset=0},e.seek=function(t){this._startTime=this._now(),this._startOffset=vi(t,0,this.duration)},h(t,[{key:"duration",get:function(){return this._nativeAudio.duration}},{key:"currentTime",get:function(){return this._isPaused?this._startOffset:this._calculateCurrentTime()}}]),t}(),K1=new(function(){function t(){this._audioBufferDataMap={}}var e=t.prototype;return e.addCache=function(t,e){this._audioBufferDataMap[t]?console.warn("Audio buffer "+t+" has been cached"):this._audioBufferDataMap[t]={usedCount:1,audioBuffer:e}},e.retainCache=function(t){var e=this._audioBufferDataMap[t];e?e.usedCount++:console.warn("Audio buffer cache "+t+" has not been added.")},e.getCache=function(t){var e=this._audioBufferDataMap[t];return null==e?void 0:e.audioBuffer},e.tryReleasingCache=function(t){var e=this._audioBufferDataMap[t];e?--e.usedCount<=0&&delete this._audioBufferDataMap[t]:console.warn("Audio buffer cache "+t+" has not been added.")},t}()),q1=window.AudioContext||window.webkitAudioContext||window.mozAudioContext,Q1="on-context-running",Z1=function(){function t(){var t=this;this._eventTarget=void 0,this._context=void 0,this._isRunning=!1,this._context=new(window.AudioContext||window.webkitAudioContext||window.mozAudioContext),this._eventTarget=new Ba,this._context.onstatechange=function(){"running"===t._context.state?(t._isRunning=!0,t._eventTarget.emit(Q1)):t._isRunning=!1}}var e=t.prototype;return e.onceRunning=function(t,e){this._eventTarget.once(Q1,t,e)},e.offRunning=function(t,e){this._eventTarget.off(Q1,t,e)},e.decodeAudioData=function(t){var e=this;return new Promise((function(i){var n=e._context.decodeAudioData(t,(function(t){i(t)}),(function(t){console.error("failed to load Web Audio",t)}));null==n||n.catch((function(){}))}))},e.runContext=function(){var t=this;return new Promise((function(e){if(t.isRunning)e();else{var i=t._context;if(i.resume)if(i.resume().catch((function(){})),"running"!==i.state){var n=document.getElementById("GameCanvas"),r=function(){i.resume().then(e).catch((function(){}))};null==n||n.addEventListener("touchend",r,{once:!0,capture:!0}),null==n||n.addEventListener("mouseup",r,{once:!0,capture:!0})}else e();else e()}}))},e.createBufferSource=function(t,e){var i=this._context.createBufferSource();return void 0!==t&&(i.buffer=t),void 0!==e&&(i.loop=e),i},e.createGain=function(t){void 0===t&&(t=1);var e=this._context.createGain();return this.setGainValue(e,t),e},e.setGainValue=function(t,e){if(t.gain.setTargetAtTime)try{t.gain.setTargetAtTime(e,this._context.currentTime,0)}catch(i){t.gain.setTargetAtTime(e,this._context.currentTime,.01)}else t.gain.value=e},e.connectContext=function(t){this._context&&t.connect(this._context.destination)},h(t,[{key:"isRunning",get:function(){return this._isRunning}},{key:"currentTime",get:function(){return this._context.currentTime}}]),t}();Z1.support=!!q1,Z1.support&&(W1=new Z1);var J1,$1,t2,e2,i2,n2=function(){function t(t,e,i){this._duration=void 0,this._bufferSourceNode=void 0,this._onPlayCb=void 0,this._currentTimer=0,this._url=void 0,this._onEndCb=void 0,this._duration=t.duration,this._url=i,this._bufferSourceNode=W1.createBufferSource(t,!1);var n=W1.createGain(e);this._bufferSourceNode.connect(n),W1.connectContext(n)}var e=t.prototype;return e.play=function(){var t=this;this._bufferSourceNode.start(),W1.runContext().then((function(){var e;null===(e=t.onPlay)||void 0===e||e.call(t),t._currentTimer=window.setTimeout((function(){var e;K1.tryReleasingCache(t._url),null===(e=t.onEnd)||void 0===e||e.call(t)}),1e3*t._duration)})).catch((function(){}))},e.stop=function(){clearTimeout(this._currentTimer),K1.tryReleasingCache(this._url),this._bufferSourceNode.stop(),this._bufferSourceNode.buffer=null},h(t,[{key:"onPlay",get:function(){return this._onPlayCb},set:function(t){this._onPlayCb=t}},{key:"onEnd",get:function(){return this._onEndCb},set:function(t){this._onEndCb=t}}]),t}(),r2=(T((V1=function(){function t(t,e){this._src=void 0,this._audioBuffer=void 0,this._sourceNode=void 0,this._gainNode=void 0,this._currentTimer=0,this._volume=1,this._loop=!1,this._state=M1.INIT,this._audioTimer=void 0,this._eventTarget=new Ba,this._operationQueue=[],this._audioBuffer=t,this._audioTimer=new Y1(t),this._gainNode=W1.createGain(),W1.connectContext(this._gainNode),this._src=e,Ha.on("hide",this._onHide,this),Ha.on("show",this._onShow,this)}var e=t.prototype;return e.destroy=function(){this._audioTimer.destroy(),this._audioBuffer&&(this._audioBuffer=null),K1.tryReleasingCache(this._src),Ha.off("hide",this._onHide,this),Ha.off("show",this._onShow,this)},t.load=function(e){return new Promise((function(i){t.loadNative(e).then((function(n){i(new t(n,e))})).catch((function(){}))}))},t.loadNative=function(t){return new Promise((function(e,i){var n=K1.getCache(t);if(n)return K1.retainCache(t),void e(n);var r=new XMLHttpRequest,s="load audio failed: "+t+", status: ";r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=function(){200===r.status||0===r.status?W1.decodeAudioData(r.response).then((function(i){K1.addCache(t,i),e(i)})).catch((function(){})):i(new Error(""+s+r.status+"(no response)"))},r.onerror=function(){i(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){i(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){i(new Error(""+s+r.status+"(abort)"))},r.send(null)}))},t.loadOneShotAudio=function(e,i){return new Promise((function(n,r){t.loadNative(e).then((function(t){var r=new n2(t,i,e);n(r)})).catch(r)}))},e.getPCMData=function(t){return new U1(this._audioBuffer.getChannelData(t),1)},e._onHide=function(){var t=this;this._state===M1.PLAYING&&this.pause().then((function(){t._state=M1.INTERRUPTED,t._eventTarget.emit(B1.INTERRUPTION_BEGIN)})).catch((function(){}))},e._onShow=function(){var t=this;this._state===M1.INTERRUPTED&&this.play().then((function(){t._eventTarget.emit(B1.INTERRUPTION_END)})).catch((function(){}))},e.seek=function(t){var e=this;return new Promise((function(i){W1.offRunning(),e._audioTimer.seek(t),e._state===M1.PLAYING?e._doPlay().then(i).catch((function(){})):i()}))},e.play=function(){return W1.offRunning(),this._doPlay()},e._doPlay=function(){var t=this;return new Promise((function(e){W1.isRunning?(t._startSourceNode(),e()):(W1.onceRunning((function(){t._startSourceNode(),e()})),W1.runContext().catch((function(){})))}))},e._startSourceNode=function(){var t=this;this._stopSourceNode(),this._sourceNode=W1.createBufferSource(this._audioBuffer,this.loop),this._sourceNode.connect(this._gainNode),this._sourceNode.start(0,this._audioTimer.currentTime),this._state=M1.PLAYING,this._audioTimer.start(),window.clearTimeout(this._currentTimer),this._currentTimer=window.setTimeout((function e(){t.loop?t._currentTimer=window.setTimeout(e,1e3*t._audioBuffer.duration):(t._audioTimer.stop(),t._eventTarget.emit(B1.ENDED),t._state=M1.INIT)}),1e3*(this._audioBuffer.duration-this._audioTimer.currentTime))},e._stopSourceNode=function(){try{this._sourceNode&&(this._sourceNode.stop(),this._sourceNode.buffer=null)}catch(t){}},e.pause=function(){return W1.offRunning(),this._state===M1.PLAYING&&this._sourceNode?(this._audioTimer.pause(),this._state=M1.PAUSED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.stop=function(){return W1.offRunning(),this._sourceNode?(this._audioTimer.stop(),this._state=M1.STOPPED,window.clearTimeout(this._currentTimer),this._stopSourceNode(),Promise.resolve()):Promise.resolve()},e.onInterruptionBegin=function(t){this._eventTarget.on(B1.INTERRUPTION_BEGIN,t)},e.offInterruptionBegin=function(t){this._eventTarget.off(B1.INTERRUPTION_BEGIN,t)},e.onInterruptionEnd=function(t){this._eventTarget.on(B1.INTERRUPTION_END,t)},e.offInterruptionEnd=function(t){this._eventTarget.off(B1.INTERRUPTION_END,t)},e.onEnded=function(t){this._eventTarget.on(B1.ENDED,t)},e.offEnded=function(t){this._eventTarget.off(B1.ENDED,t)},h(t,[{key:"sampleRate",get:function(){return this._audioBuffer.sampleRate}},{key:"src",get:function(){return this._src}},{key:"type",get:function(){return N1.WEB_AUDIO}},{key:"state",get:function(){return this._state}},{key:"loop",get:function(){return this._loop},set:function(t){this._loop=t,this._sourceNode&&(this._sourceNode.loop=t)}},{key:"volume",get:function(){return this._volume},set:function(t){t=yi(t),this._volume=t,W1.setGainValue(this._gainNode,t)}},{key:"duration",get:function(){return this._audioBuffer.duration}},{key:"currentTime",get:function(){return this._audioTimer.currentTime}}]),t}()).prototype,"seek",[z1],Object.getOwnPropertyDescriptor(V1.prototype,"seek"),V1.prototype),T(V1.prototype,"play",[z1],Object.getOwnPropertyDescriptor(V1.prototype,"play"),V1.prototype),T(V1.prototype,"pause",[z1],Object.getOwnPropertyDescriptor(V1.prototype,"pause"),V1.prototype),T(V1.prototype,"stop",[z1],Object.getOwnPropertyDescriptor(V1.prototype,"stop"),V1.prototype),V1),s2=function(){function t(t){this._audio=void 0,this._audio=t}var e=t.prototype;return e.play=function(){this._audio.play()},e.stop=function(){this._audio.stop()},h(t,[{key:"onPlay",get:function(){return this._audio.onPlay},set:function(t){this._audio.onPlay=t}},{key:"onEnd",get:function(){return this._audio.onEnd},set:function(t){this._audio.onEnd=t}}]),t}(),a2=function(){function t(t){this._player=void 0,this._player=t}t.load=function(e,i){return new Promise((function(n){(null==i?void 0:i.audioLoadMode)!==N1.DOM_AUDIO&&Z1.support?r2.load(e).then((function(e){n(new t(e))})).catch((function(){})):(Z1.support||j(5201),j1.load(e).then((function(e){n(new t(e))})).catch((function(){})))}))};var e=t.prototype;return e.destroy=function(){this._player.destroy()},t.loadNative=function(t,e){return(null==e?void 0:e.audioLoadMode)!==N1.DOM_AUDIO&&Z1.support?r2.loadNative(t):(Z1.support||j(5201),j1.loadNative(t))},t.loadOneShotAudio=function(t,e,i){return new Promise((function(n,r){(null==i?void 0:i.audioLoadMode)!==N1.DOM_AUDIO&&Z1.support?r2.loadOneShotAudio(t,e).then((function(t){n(new s2(t))})).catch(r):(Z1.support||j(5201),j1.loadOneShotAudio(t,e).then((function(t){n(new s2(t))})).catch(r))}))},e.getPCMData=function(t){return this._player.getPCMData(t)},e.seek=function(t){return this._player.seek(t)},e.play=function(){return this._player.play()},e.pause=function(){return this._player.pause()},e.stop=function(){return this._player.stop()},e.onInterruptionBegin=function(t){this._player.onInterruptionBegin(t)},e.offInterruptionBegin=function(t){this._player.offInterruptionBegin(t)},e.onInterruptionEnd=function(t){this._player.onInterruptionEnd(t)},e.offInterruptionEnd=function(t){this._player.offInterruptionEnd(t)},e.onEnded=function(t){this._player.onEnded(t)},e.offEnded=function(t){this._player.offEnded(t)},h(t,[{key:"src",get:function(){return this._player.src}},{key:"type",get:function(){return this._player.type}},{key:"state",get:function(){return this._player.state}},{key:"loop",get:function(){return this._player.loop},set:function(t){this._player.loop=t}},{key:"volume",get:function(){return this._player.volume},set:function(t){this._player.volume=t}},{key:"duration",get:function(){return this._player.duration}},{key:"currentTime",get:function(){return this._player.currentTime}},{key:"sampleRate",get:function(){return this._player.sampleRate}}]),t}();a2.maxAudioChannel=24;var o2=t("AudioClip",_h("cc.AudioClip")((i2=e2=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r-1?(t[i].playTime=performance.now(),!1):(t.push({audio:e,playTime:performance.now()}),!0)},e.addPlaying=function(t){if(t instanceof a2){if(this._tryAddPlaying(this._audioPlayerInfoList,t))return}else this._tryAddPlaying(this._oneShotAudioInfoList,t)},e._tryRemovePlaying=function(t,e){var i=this._findIndex(t,e);return-1!==i&&(gt(t,i),!0)},e.removePlaying=function(t){if(t instanceof a2){if(this._tryRemovePlaying(this._audioPlayerInfoList,t))return}else this._tryRemovePlaying(this._oneShotAudioInfoList,t)},e.discardOnePlayingIfNeeded=function(){var t;this._audioPlayerInfoList.length+this._oneShotAudioInfoList.length0?this._oneShotAudioInfoList.forEach((function(e){(!t||e.playTime=0&&R.gpuDescriptors[b],w=null,I=0;if(C&&C.gpuBuffer){var O=C.gpuBuffer,x=T[A.set],P=x&&x[A.binding];P>=0&&(I=r[P]),"vf32"in O?w=O.vf32:(I+=O.offset,w=O.gpuBuffer.vf32),I>>=2}if(w)for(var D=A.glActiveUniforms.length,B=0;B=0&&Ot.gpuDescriptors[xt],Dt=It.units.length,Bt=0;Bt0){var Mt=Pt.gpuTexture,Lt=l.glTexUnits[Nt];Lt.glTexture!==Mt.glTexture&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),Mt.glTexture?h.bindTexture(Mt.glTarget,Mt.glTexture):h.bindTexture(Mt.glTarget,t.nullTex2D.gpuTexture.glTexture),Lt.glTexture=Mt.glTexture);var Ft=Pt.gpuSampler;Mt.isPowerOf2?(a=Ft.glWrapS,o=Ft.glWrapT):(a=h.CLAMP_TO_EDGE,o=h.CLAMP_TO_EDGE),u=Mt.isPowerOf2?Mt.mipLevel<=1&&(Ft.glMinFilter===h.LINEAR_MIPMAP_NEAREST||Ft.glMinFilter===h.LINEAR_MIPMAP_LINEAR)?h.LINEAR:Ft.glMinFilter:Ft.glMinFilter===h.LINEAR||Ft.glMinFilter===h.LINEAR_MIPMAP_NEAREST||Ft.glMinFilter===h.LINEAR_MIPMAP_LINEAR?h.LINEAR:h.NEAREST,Mt.glWrapS!==a&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),h.texParameteri(Mt.glTarget,h.TEXTURE_WRAP_S,a),Mt.glWrapS=a),Mt.glWrapT!==o&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),h.texParameteri(Mt.glTarget,h.TEXTURE_WRAP_T,o),Mt.glWrapT=o),Mt.glMinFilter!==u&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),h.texParameteri(Mt.glTarget,h.TEXTURE_MIN_FILTER,u),Mt.glMinFilter=u),Mt.glMagFilter!==Ft.glMagFilter&&(l.texUnit!==Nt&&(h.activeTexture(h.TEXTURE0+Nt),l.texUnit=Nt),h.texParameteri(Mt.glTarget,h.TEXTURE_MAG_FILTER,Ft.glMagFilter),Mt.glMagFilter=Ft.glMagFilter)}Pt=Ot.gpuDescriptors[++xt]}else F("Sampler binding '"+It.name+"' at set "+It.set+" binding "+It.binding+" index "+Bt+" is not bounded")}}if(i&&c&&(_||r3.gpuInputAssembler!==i)){r3.gpuInputAssembler=i;var Ut=t.extensions.ANGLE_instanced_arrays;if(t.extensions.useVAO){var Gt=t.extensions.OES_vertex_array_object,kt=i.glVAOs.get(c.glProgram);if(!kt){var zt;kt=Gt.createVertexArrayOES(),i.glVAOs.set(c.glProgram,kt),Gt.bindVertexArrayOES(kt),h.bindBuffer(h.ARRAY_BUFFER,null),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,null),l.glArrayBuffer=null,l.glElementArrayBuffer=null;for(var Ht=c.glInputs.length,Vt=0;Vt=0&&(h.enableVertexAttribArray(oe),l.glEnabledAttribLocs[oe]=!0),l.glCurrentAttribLocs[oe]=!0,h.vertexAttribPointer(oe,ie.count,ie.glType,ie.isNormalized,ie.stride,ue),Ut&&Ut.vertexAttribDivisorANGLE(oe,ie.isInstanced?1:0)}}}var he=i.gpuIndexBuffer;he&&l.glElementArrayBuffer!==he.glBuffer&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,he.glBuffer),l.glElementArrayBuffer=he.glBuffer);for(var le=0;le0){var f=e.firstIndex*u.stride;r.drawElementsInstancedANGLE(o,e.indexCount,a.glIndexType,f,e.instanceCount)}}else e.vertexCount>0&&r.drawArraysInstancedANGLE(o,e.firstVertex,e.vertexCount,e.instanceCount);else if(u){if(e.indexCount>0){var d=e.firstIndex*u.stride;i.drawElements(o,e.indexCount,a.glIndexType,d)}}else e.vertexCount>0&&i.drawArrays(o,e.firstVertex,e.vertexCount)}}var h3=new Array(X2.COUNT);function l3(t,e){h3.fill(0);for(var i=0;i0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var v,y=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,E=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,T=e[a++];v=d.width===_.width&&d.height===_.height?new h(T.buffer,T.byteOffset+m.buffOffset):_3(T,i.format,m.buffOffset,d,_),l?i.glInternalFmt===L2.COMPRESSED_RGB_ETC1_WEBGL||t.extensions.noCompressedTexSubImage2D?r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,y,E,0,v):r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,E,i.glFormat,v):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,E,i.glFormat,i.glType,v)}break;case r.TEXTURE_CUBE_MAP:for(var S=0;S0?A.buffStride:_.width,d.height=A.buffTexHeight>0?A.buffTexHeight:_.height;var b=A.texExtent.width+f.x===i.width>>R?A.texExtent.width:_.width,C=A.texExtent.height+f.y===i.height>>R?A.texExtent.height:_.height,w=A.texSubres.baseArrayLayer+A.texSubres.layerCount;for(o=A.texSubres.baseArrayLayer;o0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=s(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}(),p3=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&(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 d3,glTarget:0,glBuffer:null},this._usage&Dn.UNIFORM&&(this._gpuBuffer.buffer=this._uniformBuffer),function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Mn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;if(e.usage&Dn.VERTEX){e.glTarget=i.ARRAY_BUFFER;var s=i.createBuffer();s&&(e.glBuffer=s,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),r3.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&Dn.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),r3.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&Dn.UNIFORM?(e.glTarget=i.NONE,e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer))):(e.usage&Dn.INDIRECT||e.usage&Dn.TRANSFER_DST||e.usage&Dn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(U2.instance,this._gpuBuffer),U2.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(function(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),t.stateCache.glVAO=null),r3.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),r3.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}(U2.instance,this._gpuBuffer),U2.instance.memoryStatus.bufferSize-=this._size,this._gpuBuffer=null),this._gpuBufferView&&(this._gpuBufferView=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._uniformBuffer&&(this._uniformBuffer=new Uint8Array(t)),this._gpuBuffer&&(this._uniformBuffer&&(this._gpuBuffer.buffer=this._uniformBuffer),this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Mn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&Dn.VERTEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),r3.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&Dn.INDEX?(t.extensions.useVAO&&n.glVAO&&(t.extensions.OES_vertex_array_object.bindVertexArrayOES(null),n.glVAO=null),r3.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&Dn.UNIFORM?e.buffer&&(e.vf32=new Float32Array(e.buffer.buffer)):(e.usage&Dn.INDIRECT||e.usage&Dn.TRANSFER_DST||e.usage&Dn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(U2.instance,this._gpuBuffer),U2.instance.memoryStatus.bufferSize-=e,U2.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&Dn.INDIRECT?0:t.byteLength,n3(U2.instance,this._gpuBuffer,t,0,i))},h(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}},{key:"gpuBufferView",get:function(){return this._gpuBufferView}}]),e}(Ls),m3=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new ma(e);for(var i=0;ii&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o0){e.glBlocks=new Array(e.blocks.length);for(var y=0;y0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var O=0;Ot.capabilities.maxTextureSize&&K(9100,s,t.capabilities.maxTextureSize),t.textureExclusive[e.format]||t.extensions.WEBGL_depth_texture||!As[e.format].hasDepth){if(e.glTexture=i.createTexture(),e.size>0){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),As[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else for(var l=0;l>1),r=Math.max(1,r>>1);e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}}else e.glInternalFmt=function(t,e){switch(t){case On.R5G6B5:return e.RGB565;case On.RGB5A1:return e.RGB5_A1;case On.RGBA4:return e.RGBA4;case On.RGBA16F:return L2.RGBA16F_EXT;case On.RGBA32F:return L2.RGBA32F_EXT;case On.SRGB8_A8:return L2.SRGB8_ALPHA8_EXT;case On.DEPTH:return e.DEPTH_COMPONENT16;case On.DEPTH_STENCIL:return e.DEPTH_STENCIL;default:return console.error("Unsupported Format, convert to WebGL internal format failed."),e.RGBA}}(e.format,i),e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r));break;case Ln.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);if(c>t.capabilities.maxCubeMapTextureSize&&K(9100,c,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),As[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var v=0;v>1),r=Math.max(1,r>>1)}e.isPowerOf2?(e.glWrapS=i.REPEAT,e.glWrapT=i.REPEAT):(e.glWrapS=i.CLAMP_TO_EDGE,e.glWrapT=i.CLAMP_TO_EDGE),e.glMinFilter=i.LINEAR,e.glMagFilter=i.LINEAR,i.texParameteri(e.glTarget,i.TEXTURE_WRAP_S,e.glWrapS),i.texParameteri(e.glTarget,i.TEXTURE_WRAP_T,e.glWrapT),i.texParameteri(e.glTarget,i.TEXTURE_MIN_FILTER,e.glMinFilter),i.texParameteri(e.glTarget,i.TEXTURE_MAG_FILTER,e.glMagFilter)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Ln.TEX2D,e.glTarget=i.TEXTURE_2D}}(U2.instance,this._gpuTexture),U2.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=Os(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,function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case Ln.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&K(9100,s,t.capabilities.maxTextureSize),e.glRenderbuffer)t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,e.glInternalFmt,n,r);else if(e.glTexture){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),As[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else for(var l=0;l>1),r=Math.max(1,r>>1)}break;case Ln.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var c=Math.max(n,r);c>t.capabilities.maxCubeMapTextureSize&&K(9100,c,t.capabilities.maxTextureSize);var _=t.stateCache.glTexUnits[t.stateCache.texUnit];if(_.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),_.glTexture=e.glTexture),As[e.format].isCompressed)for(var f=0;f<6;++f){n=e.width,r=e.height;for(var d=0;d>1),r=Math.max(1,r>>1)}}else for(var g=0;g<6;++g){n=e.width,r=e.height;for(var v=0;v>1),r=Math.max(1,r>>1)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Ln.TEX2D,e.glTarget=i.TEXTURE_2D}}}(U2.instance,this._gpuTexture),U2.instance.memoryStatus.textureSize-=n,U2.instance.memoryStatus.textureSize+=this._size)}},i.initAsSwapchainTexture=function(t){var e=new kr;e.format=t.format,e.usage=As[t.format].hasDepth?Fn.DEPTH_STENCIL_ATTACHMENT:Fn.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},h(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"lodLevel",get:function(){return this._lodLevel}}]),e}(ra),B3="webglcontextlost";function N3(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;nt.capabilities.maxTextureSize&&K(9100,s,t.capabilities.maxTextureSize),e.samples===kn.ONE){if(e.glTexture=i.createTexture(),e.size>0){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),As[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_2D,e.mipLevel,e.glInternalFmt,n,r)}}else e.glRenderbuffer=i.createRenderbuffer(),e.size>0&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case Ln.CUBE:e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);if(l>t.capabilities.maxCubeMapTextureSize&&K(9100,l,t.capabilities.maxTextureSize),e.glTexture=i.createTexture(),e.size>0){var c=t.stateCache.glTexUnits[t.stateCache.texUnit];if(c.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),c.glTexture=e.glTexture),As[e.format].isCompressed)for(var _=0;_>1),r=Math.max(1,r>>1)}else i.texStorage2D(i.TEXTURE_CUBE_MAP,e.mipLevel,e.glInternalFmt,n,r)}break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Ln.TEX2D,e.glTarget=i.TEXTURE_2D}}function u4(t,e){var i=t.gl;if(e.glTexture){var n=t.stateCache.glTexUnits,r=t.stateCache.texUnit;i.deleteTexture(e.glTexture);for(var s=0;s=0&&T.gpuDescriptors[S];if(A&&A.gpuBuffer){var R=v[E.set],b=R&&R[E.binding],C=A.gpuBuffer.glOffset;b>=0&&(C+=r[b]),o.glBindUBOs[E.glBinding]===A.gpuBuffer.glBuffer&&o.glBindUBOOffsets[E.glBinding]===C||(C?a.bindBufferRange(a.UNIFORM_BUFFER,E.glBinding,A.gpuBuffer.glBuffer,C,A.gpuBuffer.size):a.bindBufferBase(a.UNIFORM_BUFFER,E.glBinding,A.gpuBuffer.glBuffer),o.glUniformBuffer=o.glBindUBOs[E.glBinding]=A.gpuBuffer.glBuffer,o.glBindUBOOffsets[E.glBinding]=C)}else F("Buffer binding '"+E.name+"' at set "+E.set+" binding "+E.binding+" is not bounded")}for(var w=u.glSamplerTextures.length,I=0;I=0&&x.gpuDescriptors[P],B=0;B0){M.glTexture!==U.glTexture&&(o.texUnit!==N&&(a.activeTexture(a.TEXTURE0+N),o.texUnit=N),U.glTexture?a.bindTexture(U.glTarget,U.glTexture):a.bindTexture(U.glTarget,t.nullTex2D.gpuTexture.glTexture),M.glTexture=U.glTexture);var z=D.gpuSampler.getGLSampler(t,G,k);o.glSamplerUnits[N]!==z&&(a.bindSampler(N,z),o.glSamplerUnits[N]=z)}D=x.gpuDescriptors[++P]}else F("Sampler binding '"+O.name+"' at set "+O.set+" binding "+O.binding+" index "+B+" is not bounded")}}if(i&&u&&(h||h4.gpuInputAssembler!==i))if(h4.gpuInputAssembler=i,t.extensions.useVAO){var H=i.glVAOs.get(u.glProgram);if(!H){var V;H=a.createVertexArray(),i.glVAOs.set(u.glProgram,H),a.bindVertexArray(H),a.bindBuffer(a.ARRAY_BUFFER,null),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null),o.glArrayBuffer=null,o.glElementArrayBuffer=null;for(var W=0;W=0&&(a.enableVertexAttribArray(st),o.glEnabledAttribLocs[st]=!0),o.glCurrentAttribLocs[st]=!0,a.vertexAttribPointer(st,et.count,et.glType,et.isNormalized,et.stride,at),a.vertexAttribDivisor(st,et.isInstanced?1:0)}}}var ot=i.gpuIndexBuffer;ot&&o.glElementArrayBuffer!==ot.glBuffer&&(a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,ot.glBuffer),o.glElementArrayBuffer=ot.glBuffer);for(var ut=0;ut0){var c=e.firstIndex*a.stride;i.drawElementsInstanced(r,e.indexCount,n.glIndexType,c,e.instanceCount)}}else e.vertexCount>0&&i.drawArraysInstanced(r,e.firstVertex,e.vertexCount,e.instanceCount);else if(a){if(e.indexCount>0){var _=e.firstIndex*a.stride;i.drawElements(r,e.indexCount,n.glIndexType,_)}}else e.vertexCount>0&&i.drawArrays(r,e.firstVertex,e.vertexCount)}}var f4=new Array(K3.COUNT);function d4(t,e){f4.fill(0);for(var i=0;i0?m.buffStride:_.width,d.height=m.buffTexHeight>0?m.buffTexHeight:_.height;var v,y=m.texExtent.width+f.x===i.width>>g?m.texExtent.width:_.width,E=m.texExtent.height+f.y===i.height>>g?m.texExtent.height:_.height,T=e[a++];v=d.width===_.width&&d.height===_.height?new h(T.buffer,T.byteOffset+m.buffOffset):m4(T,i.format,m.buffOffset,d,_),l?i.glInternalFmt!==U3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,E,i.glFormat,v):r.compressedTexImage2D(r.TEXTURE_2D,g,i.glInternalFmt,y,E,0,v):r.texSubImage2D(r.TEXTURE_2D,g,f.x,f.y,y,E,i.glFormat,i.glType,v)}break;case r.TEXTURE_2D_ARRAY:for(var S=0;S0?A.buffStride:_.width,d.height=A.buffTexHeight>0?A.buffTexHeight:_.height;var b=A.texExtent.width+f.x===i.width>>R?A.texExtent.width:_.width,C=A.texExtent.height+f.y===i.height>>R?A.texExtent.height:_.height,w=A.texSubres.baseArrayLayer+A.texSubres.layerCount;for(o=A.texSubres.baseArrayLayer;o0?P.buffStride:_.width,d.height=P.buffTexHeight>0?P.buffTexHeight:_.height;var B,N=P.texExtent.width+f.x===i.width>>D?P.texExtent.width:_.width,M=P.texExtent.height+f.y===i.height>>D?P.texExtent.height:_.height,L=e[a++];B=d.width===_.width&&d.height===_.height?new h(L.buffer,L.byteOffset+P.buffOffset):m4(L,i.format,P.buffOffset,d,_),l?i.glInternalFmt!==U3.COMPRESSED_RGB_ETC1_WEBGL?r.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,D,f.x,f.y,f.z,N,M,_.depth,i.glFormat,B):r.compressedTexImage3D(r.TEXTURE_2D_ARRAY,D,i.glInternalFmt,N,M,_.depth,0,B):r.texSubImage3D(r.TEXTURE_2D_ARRAY,D,f.x,f.y,f.z,N,M,_.depth,i.glFormat,i.glType,B)}break;case r.TEXTURE_CUBE_MAP:for(var F=0;F0?U.buffStride:_.width,d.height=U.buffTexHeight>0?U.buffTexHeight:_.height;var k=U.texExtent.width+f.x===i.width>>G?U.texExtent.width:_.width,z=U.texExtent.height+f.y===i.height>>G?U.texExtent.height:_.height,H=U.texSubres.baseArrayLayer+U.texSubres.layerCount;for(o=U.texSubres.baseArrayLayer;o0,this.instancedDraw=!!e.instanceCount,this.drawCount=Math.max(t+1,this.drawCount),this.drawByIndex?(this.counts[t]=e.indexCount,this.offsets[t]=e.firstIndex):(this.counts[t]=e.vertexCount,this.offsets[t]=e.firstVertex),this.instances[t]=Math.max(1,e.instanceCount)},e._ensureCapacity=function(t){if(!(this._capacity>t)){this._capacity=s(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}(),y4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),h4.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&Dn.INDEX){e.glTarget=i.ELEMENT_ARRAY_BUFFER;var a=i.createBuffer();a&&(e.glBuffer=a,e.size>0&&(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),h4.gpuInputAssembler=null,t.stateCache.glElementArrayBuffer!==e.glBuffer&&(i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.glBuffer),t.stateCache.glElementArrayBuffer=e.glBuffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null))}else if(e.usage&Dn.UNIFORM){e.glTarget=i.UNIFORM_BUFFER;var o=i.createBuffer();o&&e.size>0&&(e.glBuffer=o,t.stateCache.glUniformBuffer!==e.glBuffer&&(i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),t.stateCache.glUniformBuffer=e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null)}else e.usage&Dn.INDIRECT||e.usage&Dn.TRANSFER_DST||e.usage&Dn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE}(k3.instance,this._gpuBuffer),k3.instance.memoryStatus.bufferSize+=this._size},i.destroy=function(){this._gpuBuffer&&(this._isBufferView||(function(t,e){var i=t.gl,n=t.stateCache;if(e.glBuffer){switch(e.glTarget){case i.ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),h4.gpuInputAssembler=null,i.bindBuffer(i.ARRAY_BUFFER,null),t.stateCache.glArrayBuffer=null;break;case i.ELEMENT_ARRAY_BUFFER:t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),t.stateCache.glVAO=null),h4.gpuInputAssembler=null,i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,null),t.stateCache.glElementArrayBuffer=null;break;case i.UNIFORM_BUFFER:i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null}i.deleteBuffer(e.glBuffer),e.glBuffer=null}}(k3.instance,this._gpuBuffer),k3.instance.memoryStatus.bufferSize-=this._size),this._gpuBuffer=null)},i.resize=function(t){if(this._isBufferView)console.warn("cannot resize buffer views!");else{var e=this._size;e!==t&&(this._size=t,this._count=this._size/this._stride,this._gpuBuffer&&(this._gpuBuffer.size=t,t>0&&(function(t,e){var i=t.gl,n=t.stateCache,r=e.memUsage&Mn.HOST?i.DYNAMIC_DRAW:i.STATIC_DRAW;e.usage&Dn.VERTEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),h4.gpuInputAssembler=null,n.glArrayBuffer!==e.glBuffer&&i.bindBuffer(i.ARRAY_BUFFER,e.glBuffer),e.buffer?i.bufferData(i.ARRAY_BUFFER,e.buffer,r):i.bufferData(i.ARRAY_BUFFER,e.size,r),i.bindBuffer(i.ARRAY_BUFFER,null),n.glArrayBuffer=null):e.usage&Dn.INDEX?(t.extensions.useVAO&&n.glVAO&&(i.bindVertexArray(null),n.glVAO=null),h4.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&Dn.UNIFORM?(t.stateCache.glUniformBuffer!==e.glBuffer&&i.bindBuffer(i.UNIFORM_BUFFER,e.glBuffer),i.bufferData(i.UNIFORM_BUFFER,e.size,r),i.bindBuffer(i.UNIFORM_BUFFER,null),t.stateCache.glUniformBuffer=null):(e.usage&Dn.INDIRECT||e.usage&Dn.TRANSFER_DST||e.usage&Dn.TRANSFER_SRC||console.error("Unsupported BufferType, create buffer failed."),e.glTarget=i.NONE)}(k3.instance,this._gpuBuffer),k3.instance.memoryStatus.bufferSize-=e,k3.instance.memoryStatus.bufferSize+=t)))}},i.update=function(t,e){var i;this._isBufferView?console.warn("cannot update through buffer views!"):(i=void 0!==e?e:this._usage&Dn.INDIRECT?0:t.byteLength,a4(k3.instance,this._gpuBuffer,t,0,i))},h(e,[{key:"gpuBuffer",get:function(){return this._gpuBuffer}}]),e}(Ls),E4=function(){function t(t,e){this._frees=void 0,this._freeIdx=0,this._freeCmds=void 0,this._frees=new Array(e),this._freeCmds=new ma(e);for(var i=0;i0?this.gpuColorViews[0].gpuTexture.width:this.gpuDepthStencilView.gpuTexture.width},set width(t){s=t},get height(){return this.isOffscreen?s:this.gpuColorViews.length>0?this.gpuColorViews[0].gpuTexture.height:this.gpuDepthStencilView.gpuTexture.height},set height(t){}},function(t,e){for(var i=0;i>o.baseLevel),e.height=Math.min(e.height,u.height>>o.baseLevel))}var h=e.gpuDepthStencilView;if(h){var l=h.gpuTexture,c=As[l.format].hasStencil?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;l.glTexture?n.framebufferTexture2D(n.FRAMEBUFFER,c,l.glTarget,l.glTexture,e.gpuDepthStencilView.baseLevel):n.framebufferRenderbuffer(n.FRAMEBUFFER,c,n.RENDERBUFFER,l.glRenderbuffer),e.width=Math.min(e.width,l.width>>h.baseLevel),e.height=Math.min(e.height,l.height>>h.baseLevel)}n.drawBuffers(r);var _=n.checkFramebufferStatus(n.FRAMEBUFFER);if(_!==n.FRAMEBUFFER_COMPLETE)switch(_){case n.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");break;case n.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_INCOMPLETE_DIMENSIONS");break;case n.FRAMEBUFFER_UNSUPPORTED:console.error("glCheckFramebufferStatus() - FRAMEBUFFER_UNSUPPORTED")}t.stateCache.glFramebuffer!==e.glFramebuffer&&n.bindFramebuffer(n.FRAMEBUFFER,t.stateCache.glFramebuffer)}}(k3.instance,this._gpuFramebuffer)},i.destroy=function(){var t,e;this._gpuFramebuffer&&(t=k3.instance,(e=this._gpuFramebuffer).glFramebuffer&&(t.gl.deleteFramebuffer(e.glFramebuffer),t.stateCache.glFramebuffer===e.glFramebuffer&&(t.gl.bindFramebuffer(t.gl.FRAMEBUFFER,null),t.stateCache.glFramebuffer=null),e.glFramebuffer=null),this._gpuFramebuffer=null)},h(e,[{key:"gpuFramebuffer",get:function(){return this._gpuFramebuffer}}]),e}(ks),R4=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;ri&&(i=s.binding)}this._bindingIndices=Array(i+1).fill(-1);for(var a=this._descriptorIndices=Array(i+1).fill(-1),o=0;o0){e.glSamplerTextures=new Array(e.samplerTextures.length);for(var x=0;x1&&(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=Os(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,function(t,e){if(e.size){var i=t.gl,n=e.width,r=e.height;switch(e.type){case Ln.TEX2D:e.glTarget=i.TEXTURE_2D;var s=Math.max(n,r);if(s>t.capabilities.maxTextureSize&&K(9100,s,t.capabilities.maxTextureSize),e.samples===kn.ONE){var a=t.stateCache.glTexUnits[t.stateCache.texUnit];if(a.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_2D,e.glTexture),a.glTexture=e.glTexture),As[e.format].isCompressed)for(var o=0;o>1),r=Math.max(1,r>>1)}else u4(t,e),o4(t,e)}else e.glRenderbuffer&&(t.stateCache.glRenderbuffer!==e.glRenderbuffer&&(i.bindRenderbuffer(i.RENDERBUFFER,e.glRenderbuffer),t.stateCache.glRenderbuffer=e.glRenderbuffer),i.renderbufferStorageMultisample(i.RENDERBUFFER,e.samples,e.glInternalFmt,e.width,e.height));break;case Ln.CUBE:e.type=Ln.CUBE,e.glTarget=i.TEXTURE_CUBE_MAP;var l=Math.max(n,r);l>t.capabilities.maxCubeMapTextureSize&&K(9100,l,t.capabilities.maxTextureSize);var c=t.stateCache.glTexUnits[t.stateCache.texUnit];if(c.glTexture!==e.glTexture&&(i.bindTexture(i.TEXTURE_CUBE_MAP,e.glTexture),c.glTexture=e.glTexture),As[e.format].isCompressed)for(var _=0;_<6;++_){n=e.width,r=e.height;for(var f=0;f>1),r=Math.max(1,r>>1)}}else u4(t,e),o4(t,e);break;default:console.error("Unsupported TextureType, create texture failed."),e.type=Ln.TEX2D,e.glTarget=i.TEXTURE_2D}}}(k3.instance,this._gpuTexture),k3.instance.memoryStatus.textureSize-=n,k3.instance.memoryStatus.textureSize+=this._size)}},i.initAsSwapchainTexture=function(t){var e=new kr;e.format=t.format,e.usage=As[t.format].hasDepth?Fn.DEPTH_STENCIL_ATTACHMENT:Fn.COLOR_ATTACHMENT,e.width=t.width,e.height=t.height,this.initialize(e,!0)},h(e,[{key:"gpuTexture",get:function(){return this._gpuTexture}},{key:"gpuTextureView",get:function(){return this._gpuTextureView}}]),e}(ra),L4="webglcontextlost";function F4(t,e){for(var i=["","WEBKIT_","MOZ_"],n=0;n=i.length||i[e].length===t.length&&(i[e]=t.slice(0),this._uploadSubMeshShapesWeights(e))},i.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))}},i.setInstancedAttribute=function(t,e){if(this.model)for(var i=this.model.subModels,n=0;nthis._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)}},h(t,[{key:"value",get:function(){return this._value},set:function(t){this._value=t}}]),t}(),M5=_h("cc.PerfCounter")(I5=function(t){function e(e,i,n){var r;return(r=t.call(this,e,i,n)||this)._time=void 0,r._time=n,r}c(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}(N5))||I5,L5="0123456789. ",F5=500,U5={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,".":10},G5={fps:{desc:"Framerate (FPS)",below:30,average:F5,isInteger:!0},draws:{desc:"Draw call",isInteger:!0},frame:{desc:"Frame time (ms)",min:0,max:50,average:F5},instances:{desc:"Instance Count",isInteger:!0},tricount:{desc:"Triangle",isInteger:!0},logic:{desc:"Game Logic (ms)",min:0,max:50,average:F5,color:"#080"},physics:{desc:"Physics (ms)",min:0,max:50,average:F5},render:{desc:"Renderer (ms)",min:0,max:50,average:F5,color:"#f90"},textureMemory:{desc:"GFX Texture Mem(M)"},bufferMemory:{desc:"GFX Buffer Mem(M)"}},k5=t("Profiler",function(t){function e(){var e;return(e=t.call(this)||this)._stats=null,e._showFPS=!1,e._rootNode=null,e._device=null,e._swapchain=null,e._pipeline=null,e._meshRenderer=null,e._canvas=null,e._ctx=null,e._texture=null,e._region=new Ir,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=256/(Object.keys(G5).length+1),e._wordHeight=0,e._eachNumWidth=0,e._totalLines=0,e.lastTime=0,e._canvas=document.createElement("canvas"),e._ctx=e._canvas.getContext("2d"),e._canvasArr.push(e._canvas),e}c(e,t);var i=e.prototype;return i.init=function(){ye.querySettings(ve.Category.PROFILING,"showFPS")?this.showStats():this.hideStats()},i.isShowingStats=function(){return this._showFPS},i.hideStats=function(){this._showFPS&&(this._rootNode&&(this._rootNode.active=!1),b.director.off(b.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),b.director.off(b.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),b.director.off(b.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),b.director.off(b.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),b.director.off(b.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),b.director.off(b.Director.EVENT_AFTER_DRAW,this.afterDraw,this),this._showFPS=!1,OL.root.pipeline.profiler=null,b.game.config.showFPS=!1)},i.showStats=function(){if(!this._showFPS){if(!this._device){var t=b.director.root;this._device=Ja.gfxDevice,this._swapchain=t.mainWindow.swapchain,this._pipeline=t.pipeline}this.generateCanvas(),this.generateStats(),b.game.once(b.Game.EVENT_ENGINE_INITED,this.generateNode,this),b.game.on(b.Game.EVENT_RESTART,this.generateNode,this),this._rootNode&&(this._rootNode.active=!0),b.director.on(b.Director.EVENT_BEFORE_UPDATE,this.beforeUpdate,this),b.director.on(b.Director.EVENT_AFTER_UPDATE,this.afterUpdate,this),b.director.on(b.Director.EVENT_BEFORE_PHYSICS,this.beforePhysics,this),b.director.on(b.Director.EVENT_AFTER_PHYSICS,this.afterPhysics,this),b.director.on(b.Director.EVENT_BEFORE_DRAW,this.beforeDraw,this),b.director.on(b.Director.EVENT_AFTER_DRAW,this.afterDraw,this),this._showFPS=!0,this._canvasDone=!0,this._statsDone=!0,b.game.config.showFPS=!0}},i.generateCanvas=function(){if(!this._canvasDone){this._ctx&&this._canvas&&(this._canvas.width=256,this._canvas.height=256,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 kr(Ln.TEX2D,Fn.SAMPLED|Fn.TRANSFER_DST,On.RGBA8,256,256)),this._region.texExtent.width=256,this._region.texExtent.height=256)}},i.generateStats=function(){if(!this._statsDone&&this._ctx&&this._canvas){this._stats=null;var t=performance.now();this._ctx.textAlign="left";var e=0;for(var i in G5){var n=G5[i];this._ctx.fillText(n.desc,0,e*this._lineHeight),n.counter=new M5(i,n,t),e++}this._totalLines=e,this._wordHeight=this._totalLines*this._lineHeight/this._canvas.height;for(var r=0;r=0;o--){var u=8*i+o,h=a[a.length-(8-o)],l=U5[h];void 0===l&&(l=11),n[u]=l}i++}}}},e}(KE)),z5=t("profiler",new k5);OL.registerSystem("profiler",z5,0),b.profiler=z5;var H5=function(){function t(){this.originalTarget=null,this.target=null,this.tag=t.TAG_INVALID}var e=t.prototype;return e.clone=function(){var e=new t;return e.originalTarget=null,e.target=null,e.tag=this.tag,e},e.isDone=function(){return!0},e.startWithTarget=function(t){this.originalTarget=t,this.target=t},e.stop=function(){this.target=null},e.step=function(){W(1006)},e.update=function(){W(1007)},e.getTarget=function(){return this.target},e.setTarget=function(t){this.target=t},e.getOriginalTarget=function(){return this.originalTarget},e.setOriginalTarget=function(t){this.originalTarget=t},e.getTag=function(){return this.tag},e.setTag=function(t){this.tag=t},e.reverse=function(){return W(1008),null},e.retain=function(){},e.release=function(){},t}();H5.TAG_INVALID=-1;var V5=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=n&&i.actionIndex--;break}}},e._removeActionByTag=function(t,e,i){for(var n=0,r=e.actions.length;n=0;--n){var r=e.actions[n];if(r&&r.getTag()===t){if(i&&r.getOriginalTarget()!==i)continue;this._removeActionAtIndex(n,e)}}},e.removeActionByTag=function(t,e){var i=this;t===H5.TAG_INVALID&&W(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===H5.TAG_INVALID&&W(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===H5.TAG_INVALID&&W(1004);var i=this._hashTargets.get(e);if(i){if(null!=i.actions)for(var n=0;n=t&&e.actionIndex--,0===e.actions.length&&this._deleteHashElement(e)},e._deleteHashElement=function(t){var e=!1;if(t&&!t.lock&&this._hashTargets.get(t.target)){this._hashTargets.delete(t.target);for(var i=this._arrayTargets,n=0,r=i.length;n=this._duration},i._cloneDecoration=function(t){t._repeatForever=this._repeatForever,t._speed=this._speed,t._timesForRepeat=this._timesForRepeat,t._easeList=this._easeList,t._speedMethod=this._speedMethod,t._repeatMethod=this._repeatMethod},i._reverseEaseList=function(t){if(this._easeList){t._easeList=[];for(var e=0;e1.192092896e-7?this._duration:1.192092896e-7);e=e<1?e:1,this.update(e>0?e:0),this._repeatMethod&&this._timesForRepeat>1&&this.isDone()&&(this._repeatForever||this._timesForRepeat--,this.startWithTarget(this.target),this.step(this._elapsed-this._duration))},i.startWithTarget=function(t){H5.prototype.startWithTarget.call(this,t),this._elapsed=0,this._firstTick=!0},i.reverse=function(){return W(1010),this},i.setAmplitudeRate=function(){W(1011)},i.getAmplitudeRate=function(){return W(1012),0},i.speed=function(t){return t<=0?(W(1013),this):(this._speedMethod=!0,this._speed*=t,this)},i.getSpeed=function(){return this._speed},i.setSpeed=function(t){return this._speed=t,this},i.repeat=function(t){return t=Math.round(t),isNaN(t)||t<1?(W(1014),this):(this._repeatMethod=!0,this._timesForRepeat*=t,this)},i.repeatForever=function(){return this._repeatMethod=!0,this._timesForRepeat=this.MAX_VALUE,this._repeatForever=!0,this},e}(V5),t8=function(t){function e(i){var n;(n=t.call(this)||this)._actions=[],n._split=0,n._last=0,n._reversed=!1;var r=i instanceof Array?i:arguments;if(1===r.length)return K(1019),g(n);var s=r.length-1;if(s>=0&&null==r[s]&&W(1015),s>=0){for(var a,o=r[0],u=1;u1?e%1:e),this._last=n)},i.reverse=function(){var t=e._actionOneTwo(this._actions[1].reverse(),this._actions[0].reverse());return this._cloneDecoration(t),this._reverseEaseList(t),t._reversed=!0,t},e}($5);function e8(t){var e=t instanceof Array?t:arguments;if(1===e.length)return K(1019),null;var i=e.length-1;i>=0&&null==e[i]&&W(1015);var n=null;if(i>=0){n=e[0];for(var r=1;r<=i;r++)e[r]&&(n=t8._actionOneTwo(n,e[r]))}return n}t8._actionOneTwo=function(t,e){var i=new t8;return i.initWithTwoActions(t,e),i};var i8=function(t){function e(e,i){var n;return(n=t.call(this)||this)._times=0,n._total=0,n._nextDt=0,n._actionInstant=!1,n._innerAction=null,void 0!==i&&n.initWithAction(e,i),n}c(e,t);var i=e.prototype;return i.initWithAction=function(t,e){var i=t._duration*e;return!!this.initWithDuration(i)&&(this._times=e,this._innerAction=t,t instanceof K5&&(this._actionInstant=!0,this._times-=1),this._total=0,!0)},i.clone=function(){var t=new e;return this._cloneDecoration(t),t.initWithAction(this._innerAction.clone(),this._times),t},i.startWithTarget=function(t){this._total=0,this._nextDt=this._innerAction._duration/this._duration,$5.prototype.startWithTarget.call(this,t),this._innerAction.startWithTarget(t)},i.stop=function(){this._innerAction.stop(),H5.prototype.stop.call(this)},i.update=function(t){t=this._computeEaseTime(t);var e=this._innerAction,i=this._duration,n=this._times,r=this._nextDt;if(t>=r){for(;t>r&&this._total1?1:r;t>=1&&this._total=0&&null==r[s]&&W(1015),s>=0){for(var a,o=r[0],u=1;ur?this._two=t8._actionOneTwo(e,o8(n-r)):n0&&null==e[e.length-1]&&W(1015);for(var i=e[0],n=1;n0&&(i=this._time/this._duration),i>=1&&(i=1),this._transition===A6.COLOR){var n=e._uiProps.uiComp;Gi.lerp(C6,this._fromColor,this._toColor,i),n&&(n.color=C6)}else this.transition===A6.SCALE&&(e.getScale(this._targetScale),this._targetScale.x=Ei(this._fromScale.x,this._toScale.x,i),this._targetScale.y=Ei(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===A6.COLOR&&this._interactable){var i=t.getComponent(kz);i&&(i.color=this._normalColor)}else e===A6.SCALE&&this._originalScale&&t.setScale(this._originalScale);this._transitionFinished=!0}},i._registerNodeEvent=function(){this.node.on(aE.TOUCH_START,this._onTouchBegan,this),this.node.on(aE.TOUCH_MOVE,this._onTouchMove,this),this.node.on(aE.TOUCH_END,this._onTouchEnded,this),this.node.on(aE.TOUCH_CANCEL,this._onTouchCancel,this),this.node.on(aE.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.on(aE.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.on(h8.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.on(h8.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.on(h8.XRUI_CLICK,this._xrClick,this),this.node.on(h8.XRUI_UNCLICK,this._xrUnClick,this)},i._registerTargetEvent=function(t){t.on(aE.TRANSFORM_CHANGED,this._onTargetTransformChanged,this)},i._unregisterNodeEvent=function(){this.node.off(aE.TOUCH_START,this._onTouchBegan,this),this.node.off(aE.TOUCH_MOVE,this._onTouchMove,this),this.node.off(aE.TOUCH_END,this._onTouchEnded,this),this.node.off(aE.TOUCH_CANCEL,this._onTouchCancel,this),this.node.off(aE.MOUSE_ENTER,this._onMouseMoveIn,this),this.node.off(aE.MOUSE_LEAVE,this._onMouseMoveOut,this),this.node.off(h8.XRUI_HOVER_ENTERED,this._xrHoverEnter,this),this.node.off(h8.XRUI_HOVER_EXITED,this._xrHoverExit,this),this.node.off(h8.XRUI_CLICK,this._xrClick,this),this.node.off(h8.XRUI_UNCLICK,this._xrUnClick,this)},i._unregisterTargetEvent=function(t){t.off(aE.TRANSFORM_CHANGED)},i._getTargetSprite=function(t){var e=null;return t&&(e=t.getComponent(PW)),e},i._applyTarget=function(){this.target&&(this._sprite=this._getTargetSprite(this.target),this._originalScale||(this._originalScale=new ji),ji.copy(this._originalScale,this.target.getScale()),this._registerTargetEvent(this.target))},i._onTargetSpriteFrameChanged=function(t){this._transition===A6.SPRITE&&this._setCurrentStateSpriteFrame(t.spriteFrame)},i._setCurrentStateSpriteFrame=function(t){if(t)switch(this._getButtonState()){case R6.NORMAL:this._normalSprite=t;break;case R6.HOVER:this._hoverSprite=t;break;case R6.PRESSED:this._pressedSprite=t;break;case R6.DISABLED:this._disabledSprite=t}},i._onTargetColorChanged=function(t){this._transition===A6.COLOR&&this._setCurrentStateColor(t)},i._setCurrentStateColor=function(t){switch(this._getButtonState()){case R6.NORMAL:this._normalColor=t;break;case R6.HOVER:this._hoverColor=t;break;case R6.PRESSED:this._pressedColor=t;break;case R6.DISABLED:this._disabledColor=t}},i._onTargetTransformChanged=function(t){t&AE.SCALE&&this._originalScale&&this._transition===A6.SCALE&&this._transitionFinished&&ji.copy(this._originalScale,this.target.getScale())},i._onTouchBegan=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState(),t&&(t.propagationStopped=!0))},i._onTouchMove=function(t){if(this._interactable&&this.enabledInHierarchy&&this._pressed&&t){var e=t.touch;if(e){var i,n=this.node._uiProps.uiTransformComp.hitTest(e.getLocation());this._transition===A6.SCALE&&this.target&&this._originalScale?n?(ji.copy(this._fromScale,this._originalScale),ji.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._transitionFinished=!1):(this._time=0,this._transitionFinished=!0,this.target.setScale(this._originalScale)):(i=n?R6.PRESSED:R6.NORMAL,this._applyTransition(i)),t&&(t.propagationStopped=!0)}}},i._onTouchEnded=function(t){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Sc.emitEvents(this.clickEvents,t),this.node.emit(b6.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!==A6.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=R6.NORMAL;return this._interactable?this._pressed?t=R6.PRESSED:this._hovered&&(t=R6.HOVER):t=R6.DISABLED,t.toString()},i._updateColorTransition=function(t){var e,i=this[t+"Color"],n=null===(e=this.target)||void 0===e?void 0:e.getComponent(kz);n&&(t===R6.DISABLED?n.color=i:(this._fromColor=n.color.clone(),this._toColor=i,this._time=0,this._transitionFinished=!1))},i._updateSpriteTransition=function(t){var e=this[t+"Sprite"];this._sprite&&e&&(this._sprite.spriteFrame=e)},i._updateScaleTransition=function(t){this._interactable&&(t===R6.PRESSED?this._zoomUp():this._zoomBack())},i._zoomUp=function(){this._originalScale&&(ji.copy(this._fromScale,this._originalScale),ji.multiplyScalar(this._toScale,this._originalScale,this._zoomScale),this._time=0,this._transitionFinished=!1)},i._zoomBack=function(){this.target&&this._originalScale&&(ji.copy(this._fromScale,this.target.getScale()),ji.copy(this._toScale,this._originalScale),this._time=0,this._transitionFinished=!1)},i._applyTransition=function(t){var e=this._transition;e===A6.COLOR?this._updateColorTransition(t):e===A6.SPRITE?this._updateSpriteTransition(t):e===A6.SCALE&&this._updateScaleTransition(t)},i._xrHoverEnter=function(){this._onMouseMoveIn(),this._updateState()},i._xrHoverExit=function(){this._onMouseMoveOut(),this._pressed&&(this._pressed=!1,this._updateState())},i._xrClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed=!0,this._updateState())},i._xrUnClick=function(){this._interactable&&this.enabledInHierarchy&&(this._pressed&&(Sc.emitEvents(this.clickEvents,this),this.node.emit(b6.CLICK,this)),this._pressed=!1,this._updateState())},h(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===A6.COLOR?this._updateColorTransition(R6.NORMAL):this._transition===A6.SPRITE&&this._updateSpriteTransition(R6.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(PW);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}(bc),T6.Transition=A6,T6.EventType=b6,T((a6=S6).prototype,"target",[S8,A8,R8],Object.getOwnPropertyDescriptor(a6.prototype,"target"),a6.prototype),T(a6.prototype,"interactable",[b8,C8],Object.getOwnPropertyDescriptor(a6.prototype,"interactable"),a6.prototype),T(a6.prototype,"transition",[w8,I8,O8],Object.getOwnPropertyDescriptor(a6.prototype,"transition"),a6.prototype),T(a6.prototype,"normalColor",[x8,P8],Object.getOwnPropertyDescriptor(a6.prototype,"normalColor"),a6.prototype),T(a6.prototype,"pressedColor",[D8,B8],Object.getOwnPropertyDescriptor(a6.prototype,"pressedColor"),a6.prototype),T(a6.prototype,"hoverColor",[N8,M8],Object.getOwnPropertyDescriptor(a6.prototype,"hoverColor"),a6.prototype),T(a6.prototype,"disabledColor",[L8,F8],Object.getOwnPropertyDescriptor(a6.prototype,"disabledColor"),a6.prototype),T(a6.prototype,"duration",[U8,G8,k8,z8],Object.getOwnPropertyDescriptor(a6.prototype,"duration"),a6.prototype),T(a6.prototype,"zoomScale",[H8,V8],Object.getOwnPropertyDescriptor(a6.prototype,"zoomScale"),a6.prototype),T(a6.prototype,"normalSprite",[W8,X8,j8],Object.getOwnPropertyDescriptor(a6.prototype,"normalSprite"),a6.prototype),T(a6.prototype,"pressedSprite",[Y8,K8,q8],Object.getOwnPropertyDescriptor(a6.prototype,"pressedSprite"),a6.prototype),T(a6.prototype,"hoverSprite",[Q8,Z8,J8],Object.getOwnPropertyDescriptor(a6.prototype,"hoverSprite"),a6.prototype),T(a6.prototype,"disabledSprite",[$8,t6,e6],Object.getOwnPropertyDescriptor(a6.prototype,"disabledSprite"),a6.prototype),o6=T(a6.prototype,"clickEvents",[i6,Eh,n6,r6],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),u6=T(a6.prototype,"_interactable",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),h6=T(a6.prototype,"_transition",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return A6.NONE}}),l6=T(a6.prototype,"_normalColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gi.WHITE.clone()}}),c6=T(a6.prototype,"_hoverColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Gi(211,211,211,255)}}),_6=T(a6.prototype,"_pressedColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Gi.WHITE.clone()}}),f6=T(a6.prototype,"_disabledColor",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new Gi(124,124,124,255)}}),d6=T(a6.prototype,"_normalSprite",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),p6=T(a6.prototype,"_hoverSprite",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),m6=T(a6.prototype,"_pressedSprite",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),g6=T(a6.prototype,"_disabledSprite",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),v6=T(a6.prototype,"_duration",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return.1}}),y6=T(a6.prototype,"_zoomScale",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1.2}}),E6=T(a6.prototype,"_target",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),s6=a6))||s6)||s6)||s6)||s6)||s6)||s6));b.Button=w6;var I6,O6,x6,P6=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}();P6._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"}(I6||(I6={})),_e(I6),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"}(O6||(O6={})),_e(O6),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"}(x6||(x6={})),_e(x6);var D6,B6,N6,M6,L6,F6,U6,G6,k6,z6,H6,V6,W6,X6,j6,Y6,K6,q6,Q6,Z6,J6,$6,t7,e7,i7,n7,r7,s7,a7,o7,u7,h7,l7,c7,_7,f7,d7,p7,m7,g7,v7,y7,E7,T7,S7,A7,R7,b7,C7,w7,I7,O7,x7,P7,D7,B7,N7,M7,L7,F7,U7,G7=function(){function t(){this._editing=!1,this._delegate=null}var e=t.prototype;return e.init=function(){},e.onEnable=function(){},e.update=function(){},e.onDisable=function(){this._editing&&this.endEditing()},e.clear=function(){this._delegate=null},e.setTabIndex=function(){},e.setSize=function(){},e.setFocus=function(t){t?this.beginEditing():this.endEditing()},e.isFocused=function(){return this._editing},e.beginEditing=function(){},e.endEditing=function(){},t}(),k7=new un,z7=new un,H7=new ji,V7=null,W7=0,X7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&(e.value=e.value.slice(0,r)),n._editBoxTextChanged(e.value)}},n.onClick=function(){t._editing&&Qa.isMobile&&t._adjustWindowScroll()},n.onKeydown=function(i){i.keyCode===dA.ENTER?(i.propagationStopped=!0,t._delegate._editBoxEditingReturn(),t._isTextArea||e.blur()):i.keyCode===dA.TAB&&(i.propagationStopped=!0,i.preventDefault(),P6.next(t))},n.onBlur=function(){Qa.isMobile&&i&&n.compositionEnd(),t._editing=!1,V7=null,t._hideDom(),t._delegate._editBoxEditingDidEnded()},e.addEventListener("compositionstart",n.compositionStart),e.addEventListener("compositionend",n.compositionEnd),e.addEventListener("input",n.onInput),e.addEventListener("keydown",n.onKeydown),e.addEventListener("blur",n.onBlur),e.addEventListener("touchstart",n.onClick)}},i._removeEventListeners=function(){if(this._edTxt){var t=this._edTxt,e=this.__eventListeners;t.removeEventListener("compositionstart",e.compositionStart),t.removeEventListener("compositionend",e.compositionEnd),t.removeEventListener("input",e.onInput),t.removeEventListener("keydown",e.onKeydown),t.removeEventListener("blur",e.onBlur),t.removeEventListener("touchstart",e.onClick),e.compositionStart=null,e.compositionEnd=null,e.onInput=null,e.onKeydown=null,e.onBlur=null,e.onClick=null}},e}(G7);!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"}(U7||(U7={}));var j7,Y7,K7,q7,Q7,Z7,J7,$7,t9,e9,i9,n9,r9,s9,a9,o9,u9,h9,l9,c9,_9,f9,d9,p9,m9,g9,v9,y9,E9,T9,S9,A9,R9,b9,C9,w9,I9,O9,x9,P9,D9,B9,N9,M9,L9,F9,U9,G9,k9,z9,H9,V9,W9,X9,j9,Y9,K9,q9,Q9,Z9,J9,$9=function(e){return t({EditBox:e,EditBoxComponent:e}),e}((D6=_h("cc.EditBox"),B6=xh(),N6=dh(110),M6=Ch(),L6=fh(Ak),F6=zh(),U6=Mh(),G6=zh(),k6=Mh(),z6=Kh(zz),H6=zh(),V6=Mh(),W6=Kh(zz),X6=zh(),j6=Mh(),Y6=Kh(hU),K6=zh(),q6=Mh(),Q6=Kh(x6),Z6=zh(),J6=Mh(),$6=Kh(O6),t7=zh(),e7=Mh(),i7=Kh(I6),n7=zh(),r7=Mh(),s7=zh(),a7=Mh(),o7=zh(),u7=Mh(),h7=Kh([Sc]),l7=zh(),c7=Mh(),_7=Kh([Sc]),f7=zh(),d7=Mh(),p7=Kh([Sc]),m7=zh(),g7=Mh(),v7=Kh([Sc]),y7=zh(),E7=Mh(),D6(T7=B6(T7=N6(T7=M6(T7=L6(T7=bh((F7=L7=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0&&t.length>=this._maxLength&&(t=t.slice(0,this._maxLength)),this._string!==t&&(this._string=t,this._updateString(t))}},{key:"placeholder",get:function(){return this._placeholderLabel?this._placeholderLabel.string:""},set:function(t){this._placeholderLabel&&(this._placeholderLabel.string=t)}},{key:"textLabel",get:function(){return this._textLabel},set:function(t){this._textLabel!==t&&(this._textLabel=t,this._textLabel&&(this._updateTextLabel(),this._updateLabels()))}},{key:"placeholderLabel",get:function(){return this._placeholderLabel},set:function(t){this._placeholderLabel!==t&&(this._placeholderLabel=t,this._placeholderLabel&&(this._updatePlaceholderLabel(),this._updateLabels()))}},{key:"backgroundImage",get:function(){return this._backgroundImage},set:function(t){this._backgroundImage!==t&&(this._backgroundImage=t,this._ensureBackgroundSprite(),this._background.spriteFrame=t)}},{key:"inputFlag",get:function(){return this._inputFlag},set:function(t){this._inputFlag!==t&&(this._inputFlag=t,this._updateString(this._string))}},{key:"inputMode",get:function(){return this._inputMode},set:function(t){this._inputMode!==t&&(this._inputMode=t,this._updateTextLabel(),this._updatePlaceholderLabel())}},{key:"returnType",get:function(){return this._returnType},set:function(t){this._returnType=t}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t}},{key:"tabIndex",get:function(){return this._tabIndex},set:function(t){this._tabIndex!==t&&(this._tabIndex=t,this._impl&&this._impl.setTabIndex(t))}}]),e}(bc),L7._EditBoxImpl=G7,L7.KeyboardReturnType=I6,L7.InputFlag=x6,L7.InputMode=O6,L7.EventType=U7,T((S7=F7).prototype,"string",[F6,U6],Object.getOwnPropertyDescriptor(S7.prototype,"string"),S7.prototype),T(S7.prototype,"placeholder",[G6,k6],Object.getOwnPropertyDescriptor(S7.prototype,"placeholder"),S7.prototype),T(S7.prototype,"textLabel",[z6,H6,V6],Object.getOwnPropertyDescriptor(S7.prototype,"textLabel"),S7.prototype),T(S7.prototype,"placeholderLabel",[W6,X6,j6],Object.getOwnPropertyDescriptor(S7.prototype,"placeholderLabel"),S7.prototype),T(S7.prototype,"backgroundImage",[Y6,K6,q6],Object.getOwnPropertyDescriptor(S7.prototype,"backgroundImage"),S7.prototype),T(S7.prototype,"inputFlag",[Q6,Z6,J6],Object.getOwnPropertyDescriptor(S7.prototype,"inputFlag"),S7.prototype),T(S7.prototype,"inputMode",[$6,t7,e7],Object.getOwnPropertyDescriptor(S7.prototype,"inputMode"),S7.prototype),T(S7.prototype,"returnType",[i7,n7,r7],Object.getOwnPropertyDescriptor(S7.prototype,"returnType"),S7.prototype),T(S7.prototype,"maxLength",[s7,a7],Object.getOwnPropertyDescriptor(S7.prototype,"maxLength"),S7.prototype),T(S7.prototype,"tabIndex",[o7,u7],Object.getOwnPropertyDescriptor(S7.prototype,"tabIndex"),S7.prototype),A7=T(S7.prototype,"editingDidBegan",[h7,Eh,l7,c7],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),R7=T(S7.prototype,"textChanged",[_7,Eh,f7,d7],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),b7=T(S7.prototype,"editingDidEnded",[p7,Eh,m7,g7],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),C7=T(S7.prototype,"editingReturn",[v7,Eh,y7,E7],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),w7=T(S7.prototype,"_textLabel",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),I7=T(S7.prototype,"_placeholderLabel",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),O7=T(S7.prototype,"_returnType",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return I6.DEFAULT}}),x7=T(S7.prototype,"_string",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),P7=T(S7.prototype,"_tabIndex",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),D7=T(S7.prototype,"_backgroundImage",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),B7=T(S7.prototype,"_inputFlag",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return x6.DEFAULT}}),N7=T(S7.prototype,"_inputMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return O6.ANY}}),M7=T(S7.prototype,"_maxLength",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 20}}),T7=S7))||T7)||T7)||T7)||T7)||T7)||T7));"object"==typeof window&&"object"==typeof document&&($9._EditBoxImpl=X7),b.internal.EditBox=$9,function(t){t[t.NONE=0]="NONE",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.GRID=3]="GRID"}(Y9||(Y9={})),pe(Y9),function(t){t[t.NONE=0]="NONE",t[t.CONTAINER=1]="CONTAINER",t[t.CHILDREN=2]="CHILDREN"}(K9||(K9={})),pe(K9),function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(q9||(q9={})),pe(q9),function(t){t[t.BOTTOM_TO_TOP=0]="BOTTOM_TO_TOP",t[t.TOP_TO_BOTTOM=1]="TOP_TO_BOTTOM"}(Q9||(Q9={})),pe(Q9),function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT"}(Z9||(Z9={})),pe(Z9),function(t){t[t.NONE=0]="NONE",t[t.FIXED_ROW=1]="FIXED_ROW",t[t.FIXED_COL=2]="FIXED_COL"}(J9||(J9={})),pe(J9);var ttt,ett,itt,ntt,rtt,stt,att,ott,utt,htt,ltt,ctt,_tt,ftt,dtt,ptt,mtt,gtt,vtt,ytt,Ett,Ttt,Stt,Att=new ji,Rtt=function(e){return t({Layout:e,LayoutComponent:e}),e}((j7=_h("cc.Layout"),Y7=xh(),K7=dh(110),q7=Ch(),Q7=fh(Ak),Z7=Dh(),J7=Mh(),$7=Dh(),t9=Mh(),e9=Kh(Y9),i9=zh(),n9=Mh(),r9=Kh(K9),s9=Dh(),a9=Mh(),o9=Dh(),u9=Mh(),h9=Kh(q9),l9=Mh(),c9=Mh(),_9=Mh(),f9=Mh(),d9=Mh(),p9=Mh(),m9=Mh(),g9=Kh(Q9),v9=Mh(),y9=Kh(Z9),E9=Mh(),T9=Kh(J9),S9=Dh(),A9=Mh(),R9=Dh(),b9=Mh(),C9=Mh(),j7(w9=Y7(w9=K7(w9=q7(w9=Q7(w9=bh((j9=X9=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0&&(this._doLayout(),this._layoutDirty=!1)},i.onEnable=function(){this._addEventListeners();var t=this.node._uiProps.uiTransformComp;t.contentSize.equals(gn.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_&&(f=Math.max(_,f),c=_||w,_=w),h+=a*(b*C+this._spacingX);var I=a*(1-b)*C;if(e){if(s>0)(d=y/s>0&&y%s==0)&&(c=_>w?_:c);else if(C>t-g)h>u+a*b*C&&(d=!0);else{var O=(1-this._horizontalDirection-r.x)*t,x=h+I+a*(a>0?this._paddingRight:this._paddingLeft);d=Math.abs(x)>Math.abs(O)}d&&(h=u+a*b*C,w!==_&&(c=_),l+=c+this._spacingY,c=_=w)}var P=i(T,E,l);n&&T.setPosition(h,P),h+=I}return c=Math.max(c,_),Math.max(f,l+c)+this._getPaddingV()},i._doLayoutVertically=function(t,e,i,n){var r=this.node._uiProps.uiTransformComp.anchorPoint,s=this._getFixedBreakingNum(),a=1,o=this._paddingBottom;this._verticalDirection===Q9.TOP_TO_BOTTOM&&(a=-1,o=this._paddingTop);var u=(this._verticalDirection-r.y)*t+a*o,h=u-a*this._spacingY,l=0,c=0,_=0,f=0,d=!1,p=this._usefulLayoutObj.length,m=this._cellSize.height,g=this._getPaddingV();this._layoutType!==Y9.GRID&&this._resizeMode===K9.CHILDREN&&(m=(t-g-(p-1)*this._spacingY)/p);for(var v=this._usefulLayoutObj,y=0;yl&&(c=Math.max(l,c),_=l||C,l=C),h+=a*(b*w+this._spacingY);var I=a*(1-b)*w;if(e){if(s>0)(d=y/s>0&&y%s==0)&&(_=l>w?l:_);else if(w>t-g)h>u+a*b*w&&(d=!0);else{var O=(1-this._verticalDirection-r.y)*t,x=h+I+a*(a>0?this._paddingTop:this._paddingBottom);d=Math.abs(x)>Math.abs(O)}d&&(h=u+a*b*w,C!==l&&(_=l),f+=_+this._spacingX,_=l=C)}var P=i(T,E,f);n&&(T.getPosition(Att),T.setPosition(P,h,Att.z)),h+=I}return _=Math.max(_,l),Math.max(c,f+_)+this._getPaddingH()},i._doLayoutGridAxisHorizontal=function(t,e){var i=this,n=e.width,r=1,s=-t.y*e.height,a=this._paddingBottom;this._verticalDirection===Q9.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*e.height,a=this._paddingTop);var o=function(t,e,n){return s+r*(n+(1-e.anchorY)*e.height*i._getUsedScaleValue(t.scale.y)+a)},u=0;this._resizeMode===K9.CONTAINER&&(u=this._doLayoutHorizontally(n,!0,o,!1),s=-t.y*u,this._verticalDirection===Q9.TOP_TO_BOTTOM&&(r=-1,s=(1-t.y)*u)),this._doLayoutHorizontally(n,!0,o,!0),this._resizeMode===K9.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(n,u)},i._doLayoutGridAxisVertical=function(t,e){var i=this,n=e.height,r=1,s=-t.x*e.width,a=this._paddingLeft;this._horizontalDirection===Z9.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*e.width,a=this._paddingRight);var o=function(t,e,n){return s+r*(n+(1-e.anchorX)*e.width*i._getUsedScaleValue(t.scale.x)+a)},u=0;this._resizeMode===K9.CONTAINER&&(u=this._doLayoutVertically(n,!0,o,!1),s=-t.x*u,this._horizontalDirection===Z9.RIGHT_TO_LEFT&&(r=-1,s=(1-t.x)*u)),this._doLayoutVertically(n,!0,o,!0),this._resizeMode===K9.CONTAINER&&this.node._uiProps.uiTransformComp.setContentSize(u,n)},i._doLayoutGrid=function(){var t=this.node._uiProps.uiTransformComp,e=t.anchorPoint,i=t.contentSize;this.startAxis===q9.HORIZONTAL?this._doLayoutGridAxisHorizontal(e,i):this.startAxis===q9.VERTICAL&&this._doLayoutGridAxisVertical(e,i)},i._getHorizontalBaseWidth=function(){var t=this._usefulLayoutObj,e=0,i=t.length;if(this._resizeMode===K9.CONTAINER){for(var n=0;n0?n:-n)),i*(e/r)},i._calculatePosition=function(t,e,i,n,r,s,a){var o=e-i;s&&(o+=Math.abs(s));var u=0;o&&(u=yi(u=r/o));var h=(n-a)*u;this._direction===Qtt.VERTICAL?t.set(0,h):t.set(h,0)},i._updateLength=function(t){if(this._handle){var e=this._handle.node._uiProps.uiTransformComp,i=e.contentSize,n=e.anchorPoint;n.x===tet.x&&n.y===tet.y||e.setAnchorPoint(tet),this._direction===Qtt.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)}},h(e,[{key:"handle",get:function(){return this._handle},set:function(t){this._handle!==t&&(this._handle=t,this.onScroll(_n.ZERO))}},{key:"direction",get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.onScroll(_n.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}(bc),Ytt.Direction=Qtt,T((ztt=Ktt).prototype,"handle",[xtt,Ptt,Dtt],Object.getOwnPropertyDescriptor(ztt.prototype,"handle"),ztt.prototype),T(ztt.prototype,"direction",[Btt,Ntt,Mtt],Object.getOwnPropertyDescriptor(ztt.prototype,"direction"),ztt.prototype),T(ztt.prototype,"enableAutoHide",[Ltt,Ftt],Object.getOwnPropertyDescriptor(ztt.prototype,"enableAutoHide"),ztt.prototype),T(ztt.prototype,"autoHideTime",[Utt,Gtt],Object.getOwnPropertyDescriptor(ztt.prototype,"autoHideTime"),ztt.prototype),Htt=T(ztt.prototype,"_scrollView",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Vtt=T(ztt.prototype,"_handle",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Wtt=T(ztt.prototype,"_direction",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Qtt.HORIZONTAL}}),Xtt=T(ztt.prototype,"_enableAutoHide",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),jtt=T(ztt.prototype,"_autoHideTime",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),ktt=ztt))||ktt)||ktt)||ktt)||ktt)||ktt));b.ScrollBar=ret;var set,aet,oet,uet,het,cet,_et,fet,det,pet,met,get,vet,yet,Eet,Tet,Aet,Ret,bet,Cet,wet,Iet,Oet,xet,Pet,Det,Bet,Net,Met,Let,Fet,Uet,Get,ket,zet,Het,Vet,Wet,Xet,jet,Yet,Ket,qet,Qet,Zet,Jet,$et,tit,eit=t("ViewGroup",_h("cc.ViewGroup")(net=dh(110)(net=function(t){function e(){return t.apply(this,arguments)||this}return c(e,t),e}(bc))||net)||net);b.ViewGroup=eit;var iit,nit,rit=1e-4,sit=new ji,ait=new ji,oit=new _n,uit=new _n,hit=function(){return(new Date).getMilliseconds()},lit={"scroll-to-top":0,"scroll-to-bottom":1,"scroll-to-left":2,"scroll-to-right":3,scrolling:4,"bounce-bottom":6,"bounce-left":7,"bounce-right":8,"bounce-top":5,"scroll-ended":9,"touch-up":10,"scroll-ended-with-threshold":11,"scroll-began":12};!function(t){t.SCROLL_TO_TOP="scroll-to-top",t.SCROLL_TO_BOTTOM="scroll-to-bottom",t.SCROLL_TO_LEFT="scroll-to-left",t.SCROLL_TO_RIGHT="scroll-to-right",t.SCROLL_BEGAN="scroll-began",t.SCROLL_ENDED="scroll-ended",t.BOUNCE_TOP="bounce-top",t.BOUNCE_BOTTOM="bounce-bottom",t.BOUNCE_LEFT="bounce-left",t.BOUNCE_RIGHT="bounce-right",t.SCROLLING="scrolling",t.SCROLL_ENG_WITH_THRESHOLD="scroll-ended-with-threshold",t.TOUCH_UP="touch-up"}(iit||(iit={})),function(t){t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT"}(nit||(nit={}));var cit,_it,fit,dit,pit,mit,git,vit,yit,Eit,Tit,Sit,Ait,Rit,bit,Cit,wit,Iit,Oit,xit,Pit,Dit=function(e){return t({ScrollView:e,ScrollViewComponent:e}),e}((set=_h("cc.ScrollView"),aet=xh(),oet=dh(110),uet=Ch(),het=fh(Ak),cet=Lh(),_et=zh(),fet=Mh(),det=Lh(),pet=zh(),met=Mh(),get=zh(),vet=Mh(),yet=zh(),Eet=Mh(),Tet=Kh(jE),Aet=zh(),Ret=Mh(),bet=zh(),Cet=Mh(),wet=Kh(ret),Iet=zh(),Oet=Mh(),xet=zh(),Pet=Mh(),Det=Kh(ret),Bet=zh(),Net=Mh(),Met=zh(),Let=Mh(),Fet=Kh([Sc]),Uet=zh(),Get=Mh(),set(ket=aet(ket=oet(ket=uet(ket=het((tit=$et=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=0?e:0,i=i>=0?i:0)},i.scrollToPercentHorizontal=function(t,e,i){var n=this._calculateMovePercentDelta({anchor:new _n(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 _n(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 _n(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 fA(t.getTouches(),t.bubbles,aA.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(iit.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(Rtt);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!==uA.CAPTURING_PHASE)return!1;if(e)for(var i,n=y(e);!(i=n()).done;){var r=i.value;if(this.node===r)return!(!t.target||!t.target.getComponent(eit));if(r.getComponent(eit))return!0}return!1},i._startInertiaScroll=function(t){var e=new ji(t);e.multiplyScalar(.7),this._startAttenuatingAutoScroll(e,t)},i._calculateAttenuatedFactor=function(t){return this.brake<=0?1-this.brake:(1-this.brake)*(1/(1+14e-6*t+t*t*8e-9))},i._startAttenuatingAutoScroll=function(t,e){var i=t.clone();if(i.normalize(),this._content&&this.view){var n=this._content._uiProps.uiTransformComp.contentSize,r=this.view.contentSize,s=n.width-r.width,a=n.height-r.height,o=this._calculateAttenuatedFactor(s),u=this._calculateAttenuatedFactor(a);i.x=i.x*s*(1-this.brake)*o,i.y=i.y*a*u*(1-this.brake),i.z=0}var h=t.length(),l=i.length()/h;if(i.add(t),this.brake>0&&l>7){l=Math.sqrt(l);var c=t.clone();c.multiplyScalar(l),i.set(c),i.add(t)}var _=this._calculateAutoScrollTimeByInitialSpeed(e.length());this.brake>0&&l>3&&(_*=l=3),0===this.brake&&l>1&&(_*=l),this._startAutoScroll(i,_,!0)},i._calculateAutoScrollTimeByInitialSpeed=function(t){return Math.sqrt(Math.sqrt(t/5))},i._startAutoScroll=function(t,e,i){void 0===i&&(i=!1);var n=this._flattenVectorByDirection(t);this._autoScrolling=!0,this._autoScrollTargetDelta=n,this._autoScrollAttenuate=i,ji.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(ji.ZERO,rit)||(this._autoScrollCurrentlyOutOfBoundary=!0)},i._calculateTouchMoveVelocity=function(){var t=new ji,e=0;if((e=this._touchMoveTimeDeltas.reduce((function(t,e){return t+e}),e))<=0||e>=.5)t.set(ji.ZERO);else{var i=new ji;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);sit.set(this._getContentPosition()),sit.add(i),sit.set(Math.round(1e4*sit.x)*rit,Math.round(1e4*sit.y)*rit,sit.z),this._setContentPosition(sit);var n=this._getHowMuchOutOfBoundary();oit.set(n.x,n.y),this._updateScrollBar(oit),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 ji).equals(ji.ZERO,rit)&&!this._outOfBoundaryAmountDirty)return this._outOfBoundaryAmount;var e=new ji,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(ji.ZERO,rit)&&(this._outOfBoundaryAmount=e,this._outOfBoundaryAmountDirty=!1),this._clampDelta(e),e},i._updateScrollBar=function(t){this._horizontalScrollBar&&this._horizontalScrollBar.onScroll(t),this.verticalScrollBar&&this.verticalScrollBar.onScroll(t)},i._onScrollBarTouchBegan=function(){this._horizontalScrollBar&&this._horizontalScrollBar.onTouchBegan(),this.verticalScrollBar&&this.verticalScrollBar.onTouchBegan()},i._onScrollBarTouchEnded=function(){this._horizontalScrollBar&&this._horizontalScrollBar.onTouchEnded(),this.verticalScrollBar&&this.verticalScrollBar.onTouchEnded()},i._dispatchEvent=function(t){if(t===iit.SCROLL_ENDED)this._scrollEventEmitMask=0;else if(t===iit.SCROLL_TO_TOP||t===iit.SCROLL_TO_BOTTOM||t===iit.SCROLL_TO_LEFT||t===iit.SCROLL_TO_RIGHT){var e=1<0?l.y-o*h+i.y>=this._bottomBoundary&&(n=iit.SCROLL_TO_BOTTOM):i.y<0&&l.y-o*h+h+i.y<=this._topBoundary&&(n=iit.SCROLL_TO_TOP)),this.horizontal&&(i.x<0?l.x-a*u+u+i.x<=this._rightBoundary&&(r=iit.SCROLL_TO_RIGHT):i.x>0&&l.x-a*u+i.x>=this._leftBoundary&&(r=iit.SCROLL_TO_LEFT))}this._moveContent(i,!1),(this.horizontal&&0!==i.x||this.vertical&&0!==i.y)&&(this._scrolling||(this._scrolling=!0,this._dispatchEvent(iit.SCROLL_BEGAN)),this._dispatchEvent(iit.SCROLLING)),""!==n&&this._dispatchEvent(n),""!==r&&this._dispatchEvent(r)},i._handlePressLogic=function(){this._autoScrolling&&this._dispatchEvent(iit.SCROLL_ENDED),this._autoScrolling=!1,this._isBouncing=!1,this._touchMovePreviousTimestamp=hit(),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=hit();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(ji.ZERO,rit))return!1;var e=Math.max(this.bounceDuration,0);return this._startAutoScroll(t,e,!0),this._isBouncing||(t.y>0&&this._dispatchEvent(iit.BOUNCE_TOP),t.y<0&&this._dispatchEvent(iit.BOUNCE_BOTTOM),t.x>0&&this._dispatchEvent(iit.BOUNCE_RIGHT),t.x<0&&this._dispatchEvent(iit.BOUNCE_LEFT),this._isBouncing=!0),!0},i._processInertiaScroll=function(){if(!this._startBounceBackIfNeeded()&&this.inertia){var t=this._calculateTouchMoveVelocity();!t.equals(sit,rit)&&this.brake<1&&this._startInertiaScroll(t)}this._onScrollBarTouchEnded()},i._isOutOfBoundary=function(){return!this._getHowMuchOutOfBoundary().equals(ji.ZERO,rit)},i._isNecessaryAutoScrollBrake=function(){if(this._autoScrollBraking)return!0;if(this._isOutOfBoundary()){if(!this._autoScrollCurrentlyOutOfBoundary)return this._autoScrollCurrentlyOutOfBoundary=!0,this._autoScrollBraking=!0,ji.copy(this._autoScrollBrakingStartPosition,this._getContentPosition()),!0}else this._autoScrollCurrentlyOutOfBoundary=!1;return!1},i._processAutoScrolling=function(t){var e=this._isNecessaryAutoScrollBrake(),i=e?.05:1;this._autoScrollAccumulatedTime+=t*(1/i);var n,r=Math.min(1,this._autoScrollAccumulatedTime/this._autoScrollTotalTime);this._autoScrollAttenuate&&(n=r,r=(n-=1)*n*n*n*n+1);var s=this._autoScrollTargetDelta.clone();s.multiplyScalar(r);var a=this._autoScrollStartPosition.clone();a.add(s);var o=Math.abs(r-1)<=rit;if(Math.abs(r-1)<=this.getScrollEndedEventTiming()&&!this._isScrollEndedWithThresholdEventFired&&(this._dispatchEvent(iit.SCROLL_ENG_WITH_THRESHOLD),this._isScrollEndedWithThresholdEventFired=!0),this.elastic){var u=a.clone();u.subtract(this._autoScrollBrakingStartPosition),e&&u.multiplyScalar(i),a.set(this._autoScrollBrakingStartPosition),a.add(u)}else{var h=a.clone();h.subtract(this.getContentPosition());var l=this._getHowMuchOutOfBoundary(h);l.equals(ji.ZERO,rit)||(a.add(l),o=!0)}o&&(this._autoScrolling=!1);var c=a.clone();c.subtract(this._getContentPosition()),this._clampDelta(c),this._moveContent(c,o),this._dispatchEvent(iit.SCROLLING),this._autoScrolling||(this._isBouncing=!1,this._scrolling=!1,this._dispatchEvent(iit.SCROLL_ENDED))},i._checkMouseWheel=function(t){if(!this._getHowMuchOutOfBoundary().equals(ji.ZERO,rit))return this._processInertiaScroll(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(iit.SCROLL_ENDED),void(this._stopMouseWheel=!1);this._mouseWheelEventElapsedTime+=t,this._mouseWheelEventElapsedTime>.1&&(this._onScrollBarTouchEnded(),this.unschedule(this._checkMouseWheel),this._dispatchEvent(iit.SCROLL_ENDED),this._stopMouseWheel=!1)},i._calculateMovePercentDelta=function(t){var e=t.anchor,i=t.applyToHorizontal,n=t.applyToVertical;this._calculateBoundary(),e.clampf(_n.ZERO,_n.ONE);var r=this._getContentBottomBoundary()-this._bottomBoundary;r=-r;var s=this._getContentLeftBoundary()-this._leftBoundary;s=-s;var a=new ji;if(this._content&&this.view){var o=0,u=this._content._uiProps.uiTransformComp.contentSize,h=this.view.contentSize;i&&(o=u.width-h.width,a.x=s-o*e.x),n&&(o=u.height-h.height,a.y=r-o*e.y)}return a},i._moveContentToTopLeft=function(t){var e=this._getContentBottomBoundary()-this._bottomBoundary;e=-e;var i=new ji,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:NL;this.isAlignLeft&&t===hrt.LEFT?this._left=e?this._left*r.width:this._left/r.width:this.isAlignRight&&t===hrt.RIGHT?this._right=e?this._right*r.width:this._right/r.width:this.isAlignHorizontalCenter&&t===hrt.CENTER?this._horizontalCenter=e?this._horizontalCenter*r.width:this._horizontalCenter/r.width:this.isAlignTop&&t===hrt.TOP?this._top=e?this._top*r.height:this._top/r.height:this.isAlignBottom&&t===hrt.BOT?this._bottom=e?this._bottom*r.height:this._bottom/r.height:this.isAbsoluteVerticalCenter&&t===hrt.MID&&(this._verticalCenter=this._verticalCenter/r.height),this._recursiveDirty()}},i._registerTargetEvents=function(){var t=this._target||this.node.parent;t&&t.getComponent(Ak)&&(t.on(aE.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.on(aE.SIZE_CHANGED,this._setDirtyByMode,this),t.on(aE.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterTargetEvents=function(){var t=this._target||this.node.parent;t&&(t.off(aE.TRANSFORM_CHANGED,this._setDirtyByMode,this),t.off(aE.SIZE_CHANGED,this._setDirtyByMode,this),t.off(aE.ANCHOR_CHANGED,this._setDirtyByMode,this))},i._unregisterOldParentEvents=function(t){var e=this._target||t;e&&(e.off(aE.TRANSFORM_CHANGED,this._setDirtyByMode,this),e.off(aE.SIZE_CHANGED,this._setDirtyByMode,this))},i._setDirtyByMode=function(){this.alignMode===urt.ALWAYS&&this._recursiveDirty()},i._setAlign=function(t,e){if(e!==(this._alignFlags&t)>0){var i=(t&Brt)>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)},h(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&hrt.TOP)>0},set:function(t){this._setAlign(hrt.TOP,t),this._recursiveDirty()}},{key:"isAlignBottom",get:function(){return(this._alignFlags&hrt.BOT)>0},set:function(t){this._setAlign(hrt.BOT,t),this._recursiveDirty()}},{key:"isAlignLeft",get:function(){return(this._alignFlags&hrt.LEFT)>0},set:function(t){this._setAlign(hrt.LEFT,t),this._recursiveDirty()}},{key:"isAlignRight",get:function(){return(this._alignFlags&hrt.RIGHT)>0},set:function(t){this._setAlign(hrt.RIGHT,t),this._recursiveDirty()}},{key:"isAlignVerticalCenter",get:function(){return(this._alignFlags&hrt.MID)>0},set:function(t){t?(this.isAlignTop=!1,this.isAlignBottom=!1,this._alignFlags|=hrt.MID):this._alignFlags&=~hrt.MID,this._recursiveDirty()}},{key:"isAlignHorizontalCenter",get:function(){return(this._alignFlags&hrt.CENTER)>0},set:function(t){t?(this.isAlignLeft=!1,this.isAlignRight=!1,this._alignFlags|=hrt.CENTER):this._alignFlags&=~hrt.CENTER,this._recursiveDirty()}},{key:"isStretchWidth",get:function(){return(this._alignFlags&Brt)===Brt}},{key:"isStretchHeight",get:function(){return(this._alignFlags&Drt)===Drt}},{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(hrt.TOP,this._isAbsTop))}},{key:"isAbsoluteBottom",get:function(){return this._isAbsBottom},set:function(t){this._isAbsBottom!==t&&(this._isAbsBottom=t,this._autoChangedValue(hrt.BOT,this._isAbsBottom))}},{key:"isAbsoluteLeft",get:function(){return this._isAbsLeft},set:function(t){this._isAbsLeft!==t&&(this._isAbsLeft=t,this._autoChangedValue(hrt.LEFT,this._isAbsLeft))}},{key:"isAbsoluteRight",get:function(){return this._isAbsRight},set:function(t){this._isAbsRight!==t&&(this._isAbsRight=t,this._autoChangedValue(hrt.RIGHT,this._isAbsRight))}},{key:"isAbsoluteHorizontalCenter",get:function(){return this._isAbsHorizontalCenter},set:function(t){this._isAbsHorizontalCenter!==t&&(this._isAbsHorizontalCenter=t,this._autoChangedValue(hrt.CENTER,this._isAbsHorizontalCenter))}},{key:"isAbsoluteVerticalCenter",get:function(){return this._isAbsVerticalCenter},set:function(t){this._isAbsVerticalCenter!==t&&(this._isAbsVerticalCenter=t,this._autoChangedValue(hrt.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}(bc),srt.AlignMode=urt,T((knt=art).prototype,"target",[Tnt,Snt],Object.getOwnPropertyDescriptor(knt.prototype,"target"),knt.prototype),T(knt.prototype,"isAlignTop",[Ant],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignTop"),knt.prototype),T(knt.prototype,"isAlignBottom",[Rnt],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignBottom"),knt.prototype),T(knt.prototype,"isAlignLeft",[bnt],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignLeft"),knt.prototype),T(knt.prototype,"isAlignRight",[Cnt],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignRight"),knt.prototype),T(knt.prototype,"isAlignVerticalCenter",[wnt],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignVerticalCenter"),knt.prototype),T(knt.prototype,"isAlignHorizontalCenter",[Int],Object.getOwnPropertyDescriptor(knt.prototype,"isAlignHorizontalCenter"),knt.prototype),T(knt.prototype,"isStretchWidth",[Ont],Object.getOwnPropertyDescriptor(knt.prototype,"isStretchWidth"),knt.prototype),T(knt.prototype,"isStretchHeight",[xnt],Object.getOwnPropertyDescriptor(knt.prototype,"isStretchHeight"),knt.prototype),T(knt.prototype,"top",[Pnt],Object.getOwnPropertyDescriptor(knt.prototype,"top"),knt.prototype),T(knt.prototype,"editorTop",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorTop"),knt.prototype),T(knt.prototype,"bottom",[Dnt],Object.getOwnPropertyDescriptor(knt.prototype,"bottom"),knt.prototype),T(knt.prototype,"editorBottom",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorBottom"),knt.prototype),T(knt.prototype,"left",[Bnt],Object.getOwnPropertyDescriptor(knt.prototype,"left"),knt.prototype),T(knt.prototype,"editorLeft",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorLeft"),knt.prototype),T(knt.prototype,"right",[Nnt],Object.getOwnPropertyDescriptor(knt.prototype,"right"),knt.prototype),T(knt.prototype,"editorRight",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorRight"),knt.prototype),T(knt.prototype,"horizontalCenter",[Mnt],Object.getOwnPropertyDescriptor(knt.prototype,"horizontalCenter"),knt.prototype),T(knt.prototype,"editorHorizontalCenter",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorHorizontalCenter"),knt.prototype),T(knt.prototype,"verticalCenter",[Lnt],Object.getOwnPropertyDescriptor(knt.prototype,"verticalCenter"),knt.prototype),T(knt.prototype,"editorVerticalCenter",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"editorVerticalCenter"),knt.prototype),T(knt.prototype,"isAbsoluteTop",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteTop"),knt.prototype),T(knt.prototype,"isAbsoluteBottom",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteBottom"),knt.prototype),T(knt.prototype,"isAbsoluteLeft",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteLeft"),knt.prototype),T(knt.prototype,"isAbsoluteRight",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteRight"),knt.prototype),T(knt.prototype,"isAbsoluteHorizontalCenter",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteHorizontalCenter"),knt.prototype),T(knt.prototype,"isAbsoluteVerticalCenter",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"isAbsoluteVerticalCenter"),knt.prototype),T(knt.prototype,"alignMode",[Fnt,Unt],Object.getOwnPropertyDescriptor(knt.prototype,"alignMode"),knt.prototype),T(knt.prototype,"alignFlags",[Ph],Object.getOwnPropertyDescriptor(knt.prototype,"alignFlags"),knt.prototype),znt=T(knt.prototype,"_alignFlags",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Hnt=T(knt.prototype,"_target",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Vnt=T(knt.prototype,"_left",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Wnt=T(knt.prototype,"_right",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Xnt=T(knt.prototype,"_top",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),jnt=T(knt.prototype,"_bottom",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Ynt=T(knt.prototype,"_horizontalCenter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Knt=T(knt.prototype,"_verticalCenter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),qnt=T(knt.prototype,"_isAbsLeft",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Qnt=T(knt.prototype,"_isAbsRight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Znt=T(knt.prototype,"_isAbsTop",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),Jnt=T(knt.prototype,"_isAbsBottom",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),$nt=T(knt.prototype,"_isAbsHorizontalCenter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),trt=T(knt.prototype,"_isAbsVerticalCenter",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),ert=T(knt.prototype,"_originalWidth",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),irt=T(knt.prototype,"_originalHeight",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),nrt=T(knt.prototype,"_alignMode",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return urt.ON_WINDOW_RESIZE}}),rrt=T(knt.prototype,"_lockFlags",[Eh,Sh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),Gnt=knt))||Gnt)||Gnt)||Gnt)||Gnt)||Gnt)||Gnt));b.internal.computeInverseTransForTarget=_rt,b.internal.getReadonlyNodeSize=crt,b.Widget=Nrt;var Mrt,Lrt=new Gi;!function(t){t[t.HORIZONTAL=0]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(Mrt||(Mrt={})),pe(Mrt);var Frt,Urt,Grt,krt,zrt,Hrt,Vrt,Wrt,Xrt,jrt,Yrt,Krt,qrt,Qrt,Zrt,Jrt,$rt,tst,est,ist,nst,rst,sst,ast,ost,ust,hst,lst,cst,_st,fst,dst,pst,mst,gst,vst,yst,Est,Tst,Sst,Ast,Rst,bst,Cst=function(e){return t({PageViewIndicator:e,PageViewIndicatorComponent:e}),e}((frt=_h("cc.PageViewIndicator"),drt=xh(),prt=dh(110),mrt=Ch(),grt=Kh(hU),vrt=Mh(),yrt=Kh(Mrt),Ert=Mh(),Trt=Kh(gn),Srt=Mh(),Art=Mh(),frt(Rrt=drt(Rrt=prt(Rrt=mrt((Prt=xrt=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=t.length)){for(var i=0;it.length)for(i=0;i0;--i){var n=t[i-1];this.node.removeChild(n),t.splice(i-1,1)}this._layout&&this._layout.enabledInHierarchy&&this._layout.updateLayout(),this._changedState()}}},h(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}(bc),xrt.Direction=Mrt,T((brt=Prt).prototype,"spriteFrame",[grt,vrt],Object.getOwnPropertyDescriptor(brt.prototype,"spriteFrame"),brt.prototype),T(brt.prototype,"direction",[yrt,Ert],Object.getOwnPropertyDescriptor(brt.prototype,"direction"),brt.prototype),T(brt.prototype,"cellSize",[Trt,Srt],Object.getOwnPropertyDescriptor(brt.prototype,"cellSize"),brt.prototype),Crt=T(brt.prototype,"spacing",[Eh,Art],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),wrt=T(brt.prototype,"_spriteFrame",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Irt=T(brt.prototype,"_direction",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return Mrt.HORIZONTAL}}),Ort=T(brt.prototype,"_cellSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(20,20)}}),Rrt=brt))||Rrt)||Rrt)||Rrt)||Rrt));b.PageViewIndicator=Cst;var wst,Ist,Ost,xst=new _n;!function(t){t[t.Unified=0]="Unified",t[t.Free=1]="Free"}(wst||(wst={})),pe(wst),function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(Ist||(Ist={})),pe(Ist),function(t){t.PAGE_TURNING="page-turning"}(Ost||(Ost={}));var Pst=function(e){return t({PageView:e,PageViewComponent:e}),e}((Frt=_h("cc.PageView"),Urt=xh(),Grt=dh(110),krt=Ch(),zrt=Kh(wst),Hrt=Mh(),Vrt=Kh(Ist),Wrt=Mh(),Xrt=Lh(),jrt=Mh(),Yrt=Lh(),Krt=Mh(),qrt=Kh(Cst),Qrt=Mh(),Zrt=Mh(),Jrt=Kh(ret),$rt=Dh(),tst=Kh(ret),est=Dh(),ist=Dh(),nst=Dh(),rst=Dh(),sst=Kh([Sc]),ast=Dh(),ost=Mh(),ust=Kh([Sc]),hst=Mh(),Frt(lst=Urt(lst=Grt(lst=krt((bst=Rst=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r=this._pages.length)this.addPage(t);else{if(!t._uiProps.uiTransformComp)return void W(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):j(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(Rtt);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===Ist.Horizontal?(e.paddingLeft=(t.width-i.width)/2,e.paddingRight=(t.width-n.width)/2):this.direction===Ist.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,Sc.emitEvents(this.pageEvents,this,Ost.PAGE_TURNING),this.node.emit(Ost.PAGE_TURNING,this))},i._isQuicklyScrollable=function(t){if(this.direction===Ist.Horizontal){if(Math.abs(t.x)>this.autoPageTurningThreshold)return!0}else if(this.direction===Ist.Vertical&&Math.abs(t.y)>this.autoPageTurningThreshold)return!0;return!1},i._moveOffsetValue=function(t){var e=new _n;if(this._sizeMode===wst.Free)this.direction===Ist.Horizontal?e.x=this._scrollCenterOffsetX[t]:this.direction===Ist.Vertical&&(e.y=this._scrollCenterOffsetY[t]);else{var i=this.view;if(!i)return e;this.direction===Ist.Horizontal?e.x=t*i.width:this.direction===Ist.Vertical&&(e.y=t*i.height)}return e},i._getDragDirection=function(t){return this._direction===Ist.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===wst.Free){var n=0,r=0;if(this.direction===Ist.Horizontal)return n=this._scrollCenterOffsetX[e],r=this._scrollCenterOffsetX[i],Math.abs(t.x)>=Math.abs(n-r)*this.scrollThreshold;if(this.direction===Ist.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===Ist.Horizontal)return Math.abs(t.x)>=s.width*this.scrollThreshold;if(this.direction===Ist.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 _n;_n.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=Lst;s.set(0,0);var a=Fst;if(a.set(1,1),t.target&&_rt(n,r=t.target,s,a),!e)return;var o=r._uiProps&&r._uiProps.uiTransformComp,u=o?o.anchorPoint:Bst,h=n._uiProps.uiTransformComp,l=crt(r),c=h.anchorPoint,_=n.getPosition(),f=hrt,d=n.getScale(),p=0;if(e&f.LEFT){var m=-u.x*l.width;m+=s.x,m*=a.x,p=_.x-c.x*h.width*Math.abs(d.x)-m,t.isAbsoluteLeft||(p/=l.width),p/=a.x,t.left=i(t.left,p)}if(e&f.RIGHT){var g=(1-u.x)*l.width;g+=s.x,p=(g*=a.x)-(_.x+(1-c.x)*h.width*Math.abs(d.x)),t.isAbsoluteRight||(p/=l.width),p/=a.x,t.right=i(t.right,p)}if(e&f.TOP){var v=(1-u.y)*l.height;v+=s.y,p=(v*=a.y)-(_.y+(1-c.y)*h.height*Math.abs(d.y)),t.isAbsoluteTop||(p/=l.height),p/=a.y,t.top=i(t.top,p)}if(e&f.BOT){var y=-u.y*l.height;y+=s.y,y*=a.y,p=_.y-c.y*h.height*Math.abs(d.y)-y,t.isAbsoluteBottom||(p/=l.height),p/=a.y,t.bottom=i(t.bottom,p)}}},updateAlignment:function t(e){var i=e.parent;i&&jE.isNode(i)&&t(i);var n=e.getComponent(Nrt);n&&i&&Ust(e,n)},AlignMode:urt,AlignFlags:hrt});OL.on(IL.EVENT_INIT,(function(){Vst.init()}));var Wst,Xst,jst,Yst,Kst,qst,Qst,Zst,Jst,$st,tat,eat,iat,nat,rat,sat,aat,oat,uat,hat=function(e){return t({SafeArea:e,SafeAreaComponent:e}),e}(_h("cc.SafeArea")(zst=xh()(zst=dh(110)(zst=bh(zst=Ch()(zst=fh(Nrt)(zst=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.onEnable=function(){this.updateArea(),Xa.on("window-resize",this.updateArea,this),Xa.on("orientation-change",this.updateArea,this)},i.onDisable=function(){Xa.off("window-resize",this.updateArea,this),Xa.off("orientation-change",this.updateArea,this)},i.updateArea=function(){var t=this.node.getComponent(Nrt),e=this.node.getComponent(Ak);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=zL.getVisibleSize(),s=r.width,a=r.height,o=Qa.getSafeAreaRect();t.top=a-o.y-o.height,t.bottom=o.y,t.left=o.x,t.right=s-o.x-o.width,t.updateAlignment();var u=this.node.position.clone(),h=n.x-(u.x-i.x)/e.width,l=n.y-(u.y-i.y)/e.height;e.setAnchorPoint(h,l),Vst.add(t)}},e}(bc))||zst)||zst)||zst)||zst)||zst)||zst);b.SafeArea=hat;var lat,cat=function(e){return t({UICoordinateTracker:e,UICoordinateTrackerComponent:e}),e}((Wst=_h("cc.UICoordinateTracker"),Xst=xh(),jst=Ch(),Yst=dh(110),Kst=Kh(jE),qst=Mh(),Qst=Kh(HS),Zst=Mh(),Jst=Mh(),$st=Mh(),tat=Kh([Sc]),eat=Mh(),Wst(iat=Xst(iat=jst(iat=Yst((T((nat=function(t){function e(){for(var e,i=arguments.length,n=new Array(i),r=0;r0)){var i=this._distance/Math.abs(this._viewPos.z);Sc.emitEvents(this.syncEvents,this._transformPos,i)}},i._checkCanMove=function(){this._canMove=!(!this._camera||!this._target)},h(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}(bc)).prototype,"target",[Kst,qst],Object.getOwnPropertyDescriptor(nat.prototype,"target"),nat.prototype),T(nat.prototype,"camera",[Qst,Zst],Object.getOwnPropertyDescriptor(nat.prototype,"camera"),nat.prototype),T(nat.prototype,"useScale",[Jst],Object.getOwnPropertyDescriptor(nat.prototype,"useScale"),nat.prototype),T(nat.prototype,"distance",[$st],Object.getOwnPropertyDescriptor(nat.prototype,"distance"),nat.prototype),rat=T(nat.prototype,"syncEvents",[tat,Eh,eat],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),sat=T(nat.prototype,"_target",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),aat=T(nat.prototype,"_camera",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),oat=T(nat.prototype,"_useScale",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),uat=T(nat.prototype,"_distance",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1}}),iat=nat))||iat)||iat)||iat)||iat)),_at=[aE.TOUCH_START,aE.TOUCH_END,aE.TOUCH_MOVE,aE.MOUSE_DOWN,aE.MOUSE_MOVE,aE.MOUSE_UP,aE.MOUSE_ENTER,aE.MOUSE_LEAVE,aE.MOUSE_WHEEL];function fat(t){t.propagationStopped=!0}var dat,pat,mat,gat,vat,yat,Eat,Tat,Sat,Aat,Rat,bat,Cat=function(e){return t({BlockInputEvents:e,BlockInputEventsComponent:e}),e}(_h("cc.BlockInputEvents")(lat=xh()(lat=Ch()(lat=function(t){function e(){return t.apply(this,arguments)||this}c(e,t);var i=e.prototype;return i.onEnable=function(){for(var t=0;t<_at.length;t++)this.node.on(_at[t],fat,this)},i.onDisable=function(){for(var t=0;t<_at.length;t++)this.node.off(_at[t],fat,this)},e}(bc))||lat)||lat)||lat),wat=t("SubContextView",(dat=_h("cc.SubContextView"),pat=xh(),mat=dh(110),gat=fh(Ak),vat=Ch(),yat=Mh(),Eat=Mh(),dat(Tat=pat(Tat=mat(Tat=gat(Tat=vat((T((Sat=function(t){function e(){var e;return E(e=t.call(this)||this,"_fps",Aat,g(e)),e._sprite=void 0,e._imageAsset=void 0,e._texture=void 0,e._updatedTime=0,e._updateInterval=0,e._openDataContext=void 0,e._content=void 0,E(e,"_designResolutionSize",Rat,g(e)),e._content=new jE("content"),e._content.hideFlags|=Ta.Flags.DontSave|Ta.Flags.HideInHierarchy,e._sprite=null,e._imageAsset=new Ag,e._openDataContext=null,e._updatedTime=performance.now(),e._texture=new qg,e}c(e,t);var i=e.prototype;return i.onLoad=function(){yF.getOpenDataContext?(this._updateInterval=1e3/this._fps,this._openDataContext=yF.getOpenDataContext(),this._initSharedCanvas(),this._initContentNode(),this._updateSubContextView(),this._updateContentLayer()):this.enabled=!1},i.onEnable=function(){this._registerNodeEvent()},i.onDisable=function(){this._unregisterNodeEvent()},i._initSharedCanvas=function(){if(this._openDataContext){var t=this._openDataContext.canvas,e=this._designResolutionSize.width,i=this._designResolutionSize.height;t.width=e,t.height=i}},i._initContentNode=function(){if(this._openDataContext){var t=this._openDataContext.canvas,e=this._imageAsset;if(e.reset(t),this._texture.image=e,this._texture.create(t.width,t.height),this._sprite=this._content.getComponent(PW),this._sprite||(this._sprite=this._content.addComponent(PW)),this._sprite.spriteFrame)this._sprite.spriteFrame.texture=this._texture;else{var i=new hU;i.texture=this._texture,this._sprite.spriteFrame=i}this._content.parent=this.node}},i._updateSubContextView=function(){if(this._openDataContext){var t=this.node.getComponent(Ak),e=this._content.getComponent(Ak),i=t.width/e.width,n=t.height/e.height,r=i>n?n:i;e.width*=r,e.height*=r;var s=zL.getViewportRect(),a=e.getBoundingBoxToWorld(),o=zL.getVisibleSize(),u=Xa.devicePixelRatio,h=(s.width*(a.x/o.width)+s.x)/u,l=(s.height*(a.y/o.height)+s.y)/u,c=s.width*(a.width/o.width)/u,_=s.height*(a.height/o.height)/u;this._openDataContext.postMessage({fromEngine:!0,type:"engine",event:"viewport",x:h,y:l,width:c,height:_})}},i._updateSubContextTexture=function(){var t=this._imageAsset;if(t&&this._openDataContext&&!(t.width<=0||t.height<=0)){var e=this._openDataContext.canvas;t.reset(e),(e.width>t.width||e.height>t.height)&&this._texture.create(e.width,e.height),this._texture.uploadData(e)}},i._registerNodeEvent=function(){this.node.on(aE.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.on(aE.SIZE_CHANGED,this._updateSubContextView,this),this.node.on(aE.LAYER_CHANGED,this._updateContentLayer,this)},i._unregisterNodeEvent=function(){this.node.off(aE.TRANSFORM_CHANGED,this._updateSubContextView,this),this.node.off(aE.SIZE_CHANGED,this._updateSubContextView,this),this.node.off(aE.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},h(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}(bc)).prototype,"designResolutionSize",[yat],Object.getOwnPropertyDescriptor(Sat.prototype,"designResolutionSize"),Sat.prototype),T(Sat.prototype,"fps",[Eat],Object.getOwnPropertyDescriptor(Sat.prototype,"fps"),Sat.prototype),Aat=T(Sat.prototype,"_fps",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 60}}),Rat=T(Sat.prototype,"_designResolutionSize",[Eh],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return new gn(640,960)}}),Tat=Sat))||Tat)||Tat)||Tat)||Tat)||Tat));b.SubContextView=wat,ft({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 Iat=t("UIReorderComponent",_h("cc.UIReorderComponent")(bat=function(){j(1408,"UIReorderComponent")})||bat);b.UIReorderComponent=Iat,b.ButtonComponent=w6,le.setClassAlias(w6,"cc.ButtonComponent"),b.EditBoxComponent=$9,le.setClassAlias($9,"cc.EditBoxComponent"),b.LayoutComponent=Rtt,le.setClassAlias(Rtt,"cc.LayoutComponent"),b.ProgressBarComponent=qtt,le.setClassAlias(qtt,"cc.ProgressBarComponent"),b.ScrollViewComponent=Dit,le.setClassAlias(Dit,"cc.ScrollViewComponent"),b.ScrollBarComponent=ret,le.setClassAlias(ret,"cc.ScrollBarComponent"),b.SliderComponent=ent,le.setClassAlias(ent,"cc.SliderComponent"),b.ToggleComponent=pnt,le.setClassAlias(pnt,"cc.ToggleComponent"),b.ToggleContainerComponent=ort,le.setClassAlias(ort,"cc.ToggleContainerComponent"),b.WidgetComponent=Nrt,le.setClassAlias(Nrt,"cc.WidgetComponent"),b.PageViewComponent=Pst,le.setClassAlias(Pst,"cc.PageViewComponent"),b.PageViewIndicatorComponent=Cst,le.setClassAlias(Cst,"cc.PageViewIndicatorComponent"),b.SafeAreaComponent=hat,le.setClassAlias(hat,"cc.SafeAreaComponent"),le.setClassAlias(cat,"cc.UICoordinateTrackerComponent"),b.BlockInputEventsComponent=Cat,le.setClassAlias(Cat,"cc.BlockInputEventsComponent")}}}));