@galacean/effects 2.6.4 → 2.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.min.js CHANGED
@@ -3,6 +3,6 @@
3
3
  * Description: Galacean Effects runtime player for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.6.4
7
- */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ge={})}(this,function(t){"use strict";function e(t,e,i,r,n,a,o){try{var s=t[a](o),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function i(t){return function(){var i=this,r=arguments;return new Promise(function(n,a){var o=t.apply(i,r);function s(t){e(o,n,a,s,u,"next",t)}function u(t){e(o,n,a,s,u,"throw",t)}s(void 0)})}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function n(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return r(t,void 0);var i=Object.prototype.toString.call(t).slice(8,-1);if("Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return r(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):a(t,e)}function o(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function s(t,e,i,r){var n,a=arguments.length,o=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,i,o):n(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o}function u(t,e){var i,r,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(i)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,C,S,A,w,R,I,M,O,P,N,F,L,V,D,k,z,U,B,G,j,X,H,W,Y,Z,q,K,Q,J,$,tt,te,ti,tr,tn,ta,to,ts,tu,th,tl,tc,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tE,t_,tC,tS,tA,tw,tR,tI,tM,tO,tP,tN,tF,tL,tV,tD,tk,tz,tU,tB,tG,tj,tX,tH,tW,tY,tZ,tq,tK,tQ,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,ea,eo,es,eu,eh,el,ec,ef,ed,ep,em,ev,ey,eg,ex,eb,eT,eE,e_,eC,eS,eA,ew,eR,eI,eM,eO,eP,eN=new Uint8Array(16),eF=[],eL=0;eL<256;++eL)eF.push((eL+256).toString(16).slice(1));var eV={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function eD(t,e){return t.includes(e)||t.push(e),t}function ek(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function ez(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(a);return o.set(t),o}return t}function eU(t,e){var i=[0,0,0,0];if(e7(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else a(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)i[o]/=255;return i}function eB(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var a=t[n-1],o=t[n];if(a.stop<=e&&e<=o.stop){r=ej(a.color,o.color,(e-a.stop)/(o.stop-a.stop));break}}return r||(r=t[t.length-1].color),i?r.map(function(t){return t/255}):r}return[0,0,0,0]}function eG(t){var e=[];if(a(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4];e.push({stop:eX(i),color:[r,n,a,o]})}):Object.keys(t).forEach(function(i){var r=eU(t[i]);e.push({stop:eX(i),color:r})}),(e=e.sort(function(t,e){return t.stop-e.stop})).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var i=e[e.length-1];1!==i.stop&&e.push({stop:1,color:i.color.slice()})}return e}function ej(t,e,i,r){var n=[],a=1-i;if(r)for(var o=0;o<4;o++)n[o]=t[o]*a+e[o]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*a+e[s]*e[s]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function eX(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eH(){if("object"==typeof screen&&"object"==typeof document){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0);return Math.min(screen.width/t*2,2)}return 1}var eW="undefined"!=typeof window;function eY(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}function eZ(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function eq(){return/\bOpenHarmony\b/.test(navigator.userAgent)}function eK(){return eZ()||eq()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eQ(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eJ(){return"miniprogram"===window.__wxjs_environment}function e$(t){e7(t)&&(t=eU(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}function e0(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=eG(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var a=n/128,o=void 0,s=void 0,u=0;u<r.length&&(o=r[u],s=r[u+1],!(o.stop<=a)||!(s.stop>a));u++);var h=ej(o.color,s.color,(a-o.stop)/(s.stop-o.stop));i.set(h,4*n)}i.set(r[r.length-1].color,508)}return e}function e1(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(!(i<=30))return function t(e,i,r,n){if(void 0===r&&(r=0),void 0===n&&(n=e.length-1),r>=n)return e;for(var a,o,s=e[r],u=r,h=n;u<h;){if(2===i){for(;e[h].priority>s.priority&&h>=u;)h--;for(;e[u].priority<=s.priority&&u<h;)u++}else{for(;e[h].priority<s.priority&&h>=u;)h--;for(;e[u].priority>=s.priority&&u<h;)u++}a=[e[h],e[u]],e[u]=a[0],e[h]=a[1]}return o=[e[u],e[r]],e[r]=o[0],e[u]=o[1],t(e,i,r,u-1),t(e,i,h+1,n),e}(t,e);for(var r=1;r<i;r++)e3(t,r,e);return t}function e2(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&e3(t,t.length-1,i)),t}function e3(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function e4(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function e5(t){return/^[^\d.][\w-]*$/.test(t)}function e6(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(h=t.OrderType||(t.OrderType={}))[h.none=1]="none",h[h.ascending=2]="ascending",h[h.descending=3]="descending";var e8={error:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).error.apply(e,[].concat(e6(t),[r])),null==tN||tN("error",t,r)},info:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(e6(t))),null==tN||tN("info",t,r)},warn:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(e6(t))),null==tN||tN("warn",t,r)},register:function(t){t&&ie(t)&&(tN=t)}};function e9(){}function e7(t){return"string"==typeof t}t.DestroyOptions=void 0,(l=t.DestroyOptions||(t.DestroyOptions={}))[l.destroy=0]="destroy",l[l.keep=1]="keep",l[l.force=0]="force";var it=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function ie(t){return"[object Function]"===Object.prototype.toString.call(t)}function ii(t){return"[object Object]"===Object.prototype.toString.call(t)}function ir(t){if(null===t||"object"!=typeof t||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function ia(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function io(t,e){return t+Math.random()*(e-t)}function is(){throw Error("Destroyed item cannot be used again.")}function iu(){return(function(t,e,i){if(eV.randomUUID&&!t)return eV.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tP&&!(tP="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tP(eN)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),eF[n[r+0]]+eF[n[r+1]]+eF[n[r+2]]+eF[n[r+3]]+"-"+eF[n[r+4]]+eF[n[r+5]]+"-"+eF[n[r+6]]+eF[n[r+7]]+"-"+eF[n[r+8]]+eF[n[r+9]]+"-"+eF[n[r+10]]+eF[n[r+11]]+eF[n[r+12]]+eF[n[r+13]]+eF[n[r+14]]+eF[n[r+15]]})().replace(/-/g,"")}function ih(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],a=0;a<r.length;a+=512){for(var o=r.slice(a,a+512),s=Array(o.length),u=0;u<o.length;u++)s[u]=o.charCodeAt(u);var h=new Uint8Array(s);n.push(h)}return new File([new Blob(n,{type:i})],e,{type:i})}function il(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)})})}var ic={},id=[],ip={};function im(t,e,i){ip[t]&&e8.error("Duplicate registration for plugin "+t+"."),ip[t]=i,ic[t]=e,eD(id,t)}var iv=function(){function t(t){var e={},i=[];id.forEach(function(t){var r=ic[t];i.includes(r)||(i.push(r),e[t]=r)});for(var r,a=n(t);!(r=a()).done;){var o=r.value;if(!ic[o])throw Error("The plugin '"+o+"' not found."+function(t){var e=iy[t];return e?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""}(o))}this.plugins=Object.keys(e).map(function(t){var e=new ic[t];return e.name=t,e}).sort(function(t,e){return t.order-e.order})}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionConstructed(t,e)})},e.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},e.resetComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionReset(t,e)})},e.processRawJSON=function(t,e){var r=this;return i(function(){return u(this,function(i){return[2,r.callStatic("processRawJSON",t,e)]})})()},e.processAssets=function(t,e){var r=this;return i(function(){return u(this,function(i){return[2,r.callStatic("processAssets",t,e)]})})()},e.precompile=function(t,e){for(var i,r=n(this.plugins);!(i=r()).done;)i.value.precompile(t,e)},e.loadResources=function(t,e){var r=this;return i(function(){return u(this,function(i){return[2,r.callStatic("prepareResource",t,e)]})})()},e.callStatic=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var a=this;return i(function(){var e,i,n,o,s,h;return u(this,function(u){for(n=0,e=[],i=a.plugins;n<i.length;n++)t in(o=ic[i[n].name])&&e.push(Promise.resolve(null==(h=o[t])?void 0:(s=h).call.apply(s,[].concat([o],r))));return[2,Promise.all(e)]})})()},t}(),iy={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer","rich-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"},ig=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.precompile=function(t,e){},e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t}();function ix(t,e){return(ix=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ib(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ix(t,e)}(c=tF||(tF={}))["1_0"]="1.0",c["1_1"]="1.1",c["1_2"]="1.2",c["1_3"]="1.3",c["1_5"]="1.5",c["1_8"]="1.8",c["2_0"]="2.0",c["2_1"]="2.1",c["2_2"]="2.2",c["2_3"]="2.3",c["2_4"]="2.4",c["3_0"]="3.0",c["3_1"]="3.1",c["3_2"]="3.2",c["3_3"]="3.3",c["3_4"]="3.4",c.LATEST="3.4",(f=tL||(tL={})).S="S",f.APlus="A+",f.A="A",f.BPlus="B+",f.B="B",(d=tV||(tV={}))[d.ALPHA=0]="ALPHA",d[d.ADD=1]="ADD",d[d.MULTIPLY=2]="MULTIPLY",d[d.BRIGHTNESS=3]="BRIGHTNESS",d[d.SUBTRACTION=4]="SUBTRACTION",d[d.STRONG_LIGHT=5]="STRONG_LIGHT",d[d.WEAK_LIGHT=6]="WEAK_LIGHT",d[d.SUPERPOSITION=7]="SUPERPOSITION",(p=tD||(tD={}))[p.DOUBLE=1032]="DOUBLE",p[p.FRONT=1028]="FRONT",p[p.BACK=1029]="BACK",(m=tk||(tk={}))[m.OBSCURED=2]="OBSCURED",m[m.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(v=tz||(tz={}))[v.NONE=0]="NONE",v[v.SPHERE=1]="SPHERE",v[v.CONE=2]="CONE",v[v.HEMISPHERE=3]="HEMISPHERE",v[v.CIRCLE=4]="CIRCLE",v[v.DONUT=5]="DONUT",v[v.RECTANGLE=6]="RECTANGLE",v[v.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",v[v.EDGE=8]="EDGE",v[v.TEXTURE=9]="TEXTURE",(y=tU||(tU={}))[y.GYROSCOPE=0]="GYROSCOPE",y[y.SPINE=1]="SPINE",(g=tB||(tB={}))[g.CLICK=0]="CLICK",g[g.MESSAGE=1]="MESSAGE",g[g.DRAG=2]="DRAG",(x=tG||(tG={}))[x.NONE=0]="NONE",x[x.NOTIFY=1]="NOTIFY",x[x.RESUME_PLAYER=2]="RESUME_PLAYER",x[x.REMOVE=3]="REMOVE",x[x.PAUSE=4]="PAUSE",(b=tj||(tj={})).base="0",b.sprite="1",b.particle="2",b.null="3",b.interact="4",b.plugin="5",b.camera="6",b.composition="7",b.spine="spine",b.mesh="mesh",b.tree="tree",b.text="text",b.light="light",b.skybox="skybox",b.effect="effect",b.shape="shape",b.postProcessVolume="postProcessVolume",b.node="node",b.video="video",b.audio="audio",b.richtext="richtext",(T=tX||(tX={}))[T.BILLBOARD=0]="BILLBOARD",T[T.MESH=1]="MESH",T[T.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",T[T.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(E=tH||(tH={}))[E.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",E[E.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",E[E.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",E[E.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",E[E.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",E[E.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",E[E.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",E[E.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",E[E.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(_=tW||(tW={})).Opaque="Opaque",_.Transparent="Transparent",(C=tY||(tY={})).Both="Both",C.Back="Back",C.Front="Front",(S=tZ||(tZ={}))[S.portrait=1]="portrait",S[S.landscape=0]="landscape",(A=tq||(tq={}))[A.CONSTANT=0]="CONSTANT",A[A.CONSTANT_VEC2=1]="CONSTANT_VEC2",A[A.CONSTANT_VEC3=2]="CONSTANT_VEC3",A[A.CONSTANT_VEC4=3]="CONSTANT_VEC4",A[A.RANDOM=4]="RANDOM",A[A.LINE=5]="LINE",A[A.CURVE=6]="CURVE",A[A.BEZIER_PATH=7]="BEZIER_PATH",A[A.RGBA_COLOR=8]="RGBA_COLOR",A[A.GRADIENT_COLOR=9]="GRADIENT_COLOR",A[A.SHAPE_POINTS=10]="SHAPE_POINTS",A[A.SHAPE_SPLITS=11]="SHAPE_SPLITS",A[A.LINEAR_PATH=12]="LINEAR_PATH",A[A.COLORS=13]="COLORS",A[A.BINARY=20]="BINARY",A[A.BEZIER_CURVE=21]="BEZIER_CURVE",A[A.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",A[A.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",A[A.COLOR_CURVE=24]="COLOR_CURVE",A[A.VECTOR4_CURVE=25]="VECTOR4_CURVE",A[A.VECTOR2_CURVE=26]="VECTOR2_CURVE",A[A.VECTOR3_CURVE=27]="VECTOR3_CURVE",(w=tK||(tK={}))[w.AUTO=0]="AUTO",w[w.EASE=1]="EASE",w[w.EASE_IN=2]="EASE_IN",w[w.EASE_OUT=3]="EASE_OUT",w[w.LINE=4]="LINE",w[w.HOLD=5]="HOLD",w[w.LINE_OUT=6]="LINE_OUT",(R=tQ||(tQ={}))[R.destroy=0]="destroy",R[R.restart=5]="restart",R[R.forward=2]="forward",R[R.freeze=4]="freeze",(I=tJ||(tJ={}))[I.none=0]="none",I[I.removeParticle=1]="removeParticle",(M=t$||(t$={}))[M.RANDOM=0]="RANDOM",M[M.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",M[M.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",M[M.UNIFORM_BURST=3]="UNIFORM_BURST",(O=t0||(t0={})).point="point",O.spot="spot",O.directional="directional",O.ambient="ambient",(P=t1||(t1={}))[P.box=2]="box",P[P.sphere=3]="sphere",(N=t2||(t2={})).orthographic="orthographic",N.perspective="perspective",(F=t3||(t3={})).unlit="unlit",F.pbr="pbr",F.hair="hair",(L=t4||(t4={}))[L.opaque=100]="opaque",L[L.masked=101]="masked",L[L.translucent=102]="translucent",L[L.additive=103]="additive",(V=t5||(t5={})).none="none",V.uv="uv",V.normal="normal",V.basecolor="basecolor",V.alpha="alpha",V.metallic="metallic",V.roughness="roughness",V.ao="ao",V.emissive="emissive",V.diffuse="diffuse",(D=t6||(t6={}))[D.display=0]="display",D[D.clip=1]="clip",D[D.ellipsis=2]="ellipsis",(k=t8||(t8={}))[k.top=0]="top",k[k.middle=1]="middle",k[k.bottom=2]="bottom",(z=t9||(t9={}))[z.left=0]="left",z[z.middle=1]="middle",z[z.right=2]="right",(U=t7||(t7={})).normal="normal",U.bold="bold",U.lighter="lighter",(B=et||(et={})).normal="normal",B.italic="italic",B.oblique="oblique";var iT={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(G=ee||(ee={}))[G.Custom=0]="Custom",G[G.Rectangle=1]="Rectangle",G[G.Ellipse=2]="Ellipse",G[G.Polygon=3]="Polygon",G[G.Star=4]="Star",(j=ei||(ei={}))[j.Butt=0]="Butt",j[j.Round=1]="Round",j[j.Square=2]="Square",(X=er||(er={}))[X.Round=0]="Round",X[X.Bevel=1]="Bevel",X[X.Miter=2]="Miter",(H=en||(en={})).AnimationClipNodeData="AnimationClipNodeData",H.BlendNodeData="BlendNodeData",H.ApplyAdditiveNodeData="ApplyAdditiveNodeData",H.LayerBlendNodeData="LayerBlendNodeData",H.StateMachineNodeData="StateMachineNodeData",H.TransitionNodeData="TransitionNodeData",H.StateNodeData="StateNodeData",H.ConstFloatNodeData="ConstFloatNodeData",H.ConstBoolNodeData="ConstBoolNodeData",H.ControlParameterBoolNodeData="ControlParameterBoolNodeData",H.ControlParameterFloatNodeData="ControlParameterFloatNodeData",H.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",H.NotNodeData="NotNodeData",H.AndNodeData="AndNodeData",H.OrNodeData="OrNodeData",H.EqualNodeData="EqualNodeData",H.GreaterNodeData="GreaterNodeData",H.LessNodeData="LessNodeData",(W=ea||(ea={})).video="video",W.image="image",(Y=eo||(eo={})).video="video",Y.audio="audio",(Z=es||(es={})).VFXItemData="VFXItemData",Z.Material="Material",Z.Shader="Shader",Z.Geometry="Geometry",Z.Texture="Texture",Z.Image="Image",Z.AnimationClip="AnimationClip",Z.BinaryAsset="BinaryAsset",Z.TrackAsset="TrackAsset",Z.TimelineAsset="TimelineAsset",Z.ObjectBindingTrack="ObjectBindingTrack",Z.TransformTrack="TransformTrack",Z.SpriteColorTrack="SpriteColorTrack",Z.ActivationTrack="ActivationTrack",Z.SubCompositionTrack="SubCompositionTrack",Z.FloatPropertyTrack="FloatPropertyTrack",Z.ColorPropertyTrack="ColorPropertyTrack",Z.Vector2PropertyTrack="Vector2PropertyTrack",Z.Vector4PropertyTrack="Vector4PropertyTrack",Z.TransformPlayableAsset="TransformPlayableAsset",Z.SpriteColorPlayableAsset="SpriteColorPlayableAsset",Z.ActivationPlayableAsset="ActivationPlayableAsset",Z.SubCompositionPlayableAsset="SubCompositionPlayableAsset",Z.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",Z.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",Z.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",Z.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",Z.MeshComponent="MeshComponent",Z.SkyboxComponent="SkyboxComponent",Z.LightComponent="LightComponent",Z.CameraComponent="CameraComponent",Z.ModelPluginComponent="ModelPluginComponent",Z.TreeComponent="TreeComponent",Z.AnimationComponent="AnimationComponent",Z.SpineComponent="SpineComponent",Z.VideoComponent="VideoComponent",Z.AudioComponent="AudioComponent",Z.RichTextComponent="RichTextComponent",Z.OrientationComponent="OrientationComponent",Z.ShapeComponent="ShapeComponent",Z.SpriteComponent="SpriteComponent",Z.ParticleSystem="ParticleSystem",Z.InteractComponent="InteractComponent",Z.CameraController="CameraController",Z.PostProcessVolume="PostProcessVolume",Z.EffectComponent="EffectComponent",Z.TextComponent="TextComponent",Z.AnimationGraphAsset="AnimationGraphAsset",Z.Animator="Animator",Z.TimelineClip="TimelineClip",(q=eu||(eu={}))[q.POINTS=0]="POINTS",q[q.LINES=1]="LINES",q[q.LINE_LOOP=2]="LINE_LOOP",q[q.LINE_STRIP=3]="LINE_STRIP",q[q.TRIANGLES=4]="TRIANGLES",q[q.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",q[q.TRIANGLE_FAN=6]="TRIANGLE_FAN",(K=eh||(eh={}))[K.Float16=0]="Float16",K[K.Float32=1]="Float32",K[K.Int8=2]="Int8",K[K.Int16=3]="Int16",K[K.Int32=4]="Int32",K[K.UInt8=5]="UInt8",K[K.UInt16=6]="UInt16",K[K.UInt32=7]="UInt32",(Q=el||(el={}))[Q.None=-1]="None",Q[Q.UInt8=0]="UInt8",Q[Q.UInt16=1]="UInt16",Q[Q.UInt32=2]="UInt32",(J=ec||(ec={})).Position="POSITION",J.Uv="TEXCOORD0",J.Uv2="TEXCOORD1",J.Normal="NORMAL",J.Tangent="TANGENT",J.Color="COLOR",J.Joints="JOINTS",J.Weights="WEIGHTS",J.PositionBS0="POSITION_BS0",J.PositionBS1="POSITION_BS1",J.PositionBS2="POSITION_BS2",J.PositionBS3="POSITION_BS3",J.PositionBS4="POSITION_BS4",J.PositionBS5="POSITION_BS5",J.PositionBS6="POSITION_BS6",J.PositionBS7="POSITION_BS7",J.NormalBS0="NORMAL_BS0",J.NormalBS1="NORMAL_BS1",J.NormalBS2="NORMAL_BS2",J.NormalBS3="NORMAL_BS3",J.TangentBS0="TANGENT_BS0",J.TangentBS1="TANGENT_BS1",J.TangentBS2="TANGENT_BS2",J.TangentBS3="TANGENT_BS3";var iE=Object.freeze({__proto__:null,LATEST_VERSION:tF.LATEST,get RenderLevel(){return tL},get BlendingMode(){return tV},get SideMode(){return tD},get ObscuredMode(){return tk},get ParticleEmitterShapeType(){return tz},get PluginType(){return tU},get InteractType(){return tB},get InteractBehavior(){return tG},get ItemType(){return tj},get RenderMode(){return tX},get ParticleOrigin(){return tH},get RenderType(){return tW},get RenderFace(){return tY},get CameraClipMode(){return tZ},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:0,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return tq},get BezierKeyframeType(){return tK},get JSONSceneVersion(){return tF},get EndBehavior(){return tQ},get ParticleInteractionBehavior(){return tJ},get ShapeArcMode(){return t$},get LightType(){return t0},get ModelBoundingType(){return t1},get CameraType(){return t2},get MaterialType(){return t3},get MaterialBlending(){return t4},get RenderMode3D(){return t5},get TextOverflow(){return t6},get TextBaseline(){return t8},get TextAlignment(){return t9},get TextWeight(){return t7},get FontStyle(){return et},BuiltinObjectGUID:iT,get ShapePrimitiveType(){return ee},get LineCap(){return ei},get LineJoin(){return er},get NodeDataType(){return en},get BackgroundType(){return ea},get MultimediaType(){return eo},get DataType(){return es},get GeometryType(){return eu},get VertexFormatType(){return eh},get IndexFormatType(){return el},get VertexBufferSemantic(){return ec}}),i_=new Map,iC=new Map,iS={};function iA(t){return function(e,i){iS[t]&&console.warn("Class "+t+" is already registered."),iS[t]=e}}function iw(t){var e=t.constructor;if(iC.get(e))return iC.get(e);var i={};iC.set(e,i);for(var r=t,n=e;n;){var a=i_.get(n);for(var o in a)i[o]=a[o];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function iR(t,e){return function(i,r){var n,a=(n=i.constructor,i_.get(n)||i_.set(n,{}),i_.get(n));a&&(a[r]||(a[r]={type:t,sourceName:e}))}}var iI=function(){function t(t){this.engine=t,this.guid=iu(),this.defination={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){},e.dispose=function(){},t.is=function(e){return a(e,t)&&"guid"in e},t}(),iM=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),iO={};function iP(t){return function(e,i){iO[t]&&console.warn("NodeData Class "+t+" is already registered."),iO[t]=e}}var iN=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw Error("Node not initialized!");0==--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw Error("Node still initialized!");this.lastUpdateID=-1},t}(),iF=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i},t}(),iL=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.previousTime=0,e.currentTime=0,e}ib(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(iN),iV=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.setValue=function(t){},e}(iN),iD=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iV),ik=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iV);t.AnimationGraphAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.nodeDatas=[],e.graphDataSet=new iM,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=-1,e}return ib(e,t),e.prototype.fromData=function(t){var i=t.nodeDatas;this.rootNodeIndex=t.rootNodeIndex,this.controlParameterIDs=t.controlParameterIDs;for(var r=t.controlParameterIDs.length,a=0;a<r;a++)this.parameterLookupMap.set(t.controlParameterIDs[a],a);this.nodeDatas=[];for(var o=0;o<i.length;o++)this.nodeDatas[o]=e.createNodeData(i[o].type),this.nodeDatas[o].load(i[o]);this.graphDataSet=new iM,this.graphDataSet.resources=[];for(var s,u=n(t.graphDataSet.resources);!(s=u()).done;){var h=s.value,l=this.engine.findObject(h);this.graphDataSet.resources.push(l)}},e.createNodeData=function(t){var e=iO[t];if(e)return new e;throw Error("Unknown node type: "+t+".")},e}(iI),t.AnimationGraphAsset=s([iA("AnimationGraphAsset")],t.AnimationGraphAsset),($=ef||(ef={}))[$.Active=0]="Active",$[$.Inactive=1]="Inactive";var iz=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),iU=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t].asset=this.nodeDatas[t],this.nodes[t]):null},t}();function iB(){return(iB=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}var iG=Math.PI/180,ij=180/Math.PI;function iX(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var iH=function(t,e,i){return(1-i)*t+i*e};function iW(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i;return Math.min(Math.max(t,Math.min(r,n)),Math.max(r,n))}t.AnimationClipNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(iY,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=iB({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(iF),t.AnimationClipNodeData=s([iP(en.AnimationClipNodeData)],t.AnimationClipNodeData);var iY=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.animation=null,e.animatable=null,e}ib(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=iW(this.currentTime,0,1);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new iZ(e.skeleton,this.animation))},e}(iL);(tt=ed||(ed={}))[tt.Position=0]="Position",tt[tt.Scale=1]="Scale",tt[tt.Rotation=2]="Rotation",tt[tt.Euler=3]="Euler";var iZ=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=n(e.positionCurves);!(i=r()).done;){var a=i.value;this.addTransformCurveInfo(a,0)}for(var o,s=n(e.scaleCurves);!(o=s()).done;){var u=o.value;this.addTransformCurveInfo(u,1)}for(var h,l=n(e.rotationCurves);!(h=l()).done;){var c=h.value;this.addTransformCurveInfo(c,2)}for(var f,d=n(e.eulerCurves);!(f=d()).done;){var p=f.value;this.addTransformCurveInfo(p,3)}for(var m,v=n(e.floatCurves);!(m=v()).done;){var y=m.value;this.addFloatCurveInfo(y)}for(var g,x=n(e.colorCurves);!(g=x()).done;){var b=g.value;this.addColorCurveInfo(b)}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=iW(t,0,this.animationClip.duration),a=n(this.transformCurveInfos);!(i=a()).done;){var o=i.value,s=o.curve.keyFrames.getValue(r),u=e.parentSpaceTransforms[o.boneIndex];switch(o.type){case 0:u.position.copyFrom(s);break;case 1:u.scale.copyFrom(s);break;case 2:u.rotation.copyFrom(s);break;case 3:u.euler.copyFrom(s)}}for(var h,l=n(this.floatCurveInfos);!(h=l()).done;){var c=h.value,f=c.curve.keyFrames.getValue(r);e.floatPropertyValues[c.animatedObjectIndex]=f}for(var d,p=n(this.colorCurveInfos);!(d=p()).done;){var m=d.value,v=m.curve.keyFrames.getValue(r);e.colorPropertyValues[m.animatedObjectIndex]=v}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),iq=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):a(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):a(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):a(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):a(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=this.x,e=this.y;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iq.ONE=new iq(1,1),iq.ZERO=new iq(0,0);var iK=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):a(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):a(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):a(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):a(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=this.x,e=this.y,i=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new iq(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iK.X=new iK(1,0,0),iK.Y=new iK(0,1,0),iK.Z=new iK(0,0,1),iK.ONE=new iK(1,1,1),iK.ZERO=new iK(0,0,0);var iQ=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],a=e[1],o=e[5],s=e[9],u=e[2],h=e[6],l=e[10],c=i+o+l;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(h-s)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>o&&i>l){var d=2*Math.sqrt(1+i-o-l);this.w=(h-s)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(o>l){var p=2*Math.sqrt(1+o-i-l);this.w=(n-u)/p,this.x=(r+a)/p,this.y=.25*p,this.z=(s+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-o);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(s+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0):(this.x=0,this.y=-t.z,this.z=t.y)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x),this.w=i,this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(iW(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);return 0===i||this.slerp(t,Math.min(1,e/i)),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=e.x,s=e.y,u=e.z,h=e.w;return this.x=i*h+a*o+r*u-n*s,this.y=r*h+a*s+n*o-i*u,this.z=n*h+a*u+i*s-r*o,this.w=a*h-i*o-r*s-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this.x,r=this.y,n=this.z,a=this.w,o=a*t.w+i*t.x+r*t.y+n*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=a,this.x=i,this.y=r,this.z=n,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-e;return this.w=u*a+e*this.w,this.x=u*i+e*this.x,this.y=u*r+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var h=Math.sqrt(s),l=Math.atan2(h,o),c=Math.sin((1-e)*l)/h,f=Math.sin(e*l)/h;return this.w=a*c+this.w*f,this.x=i*c+this.x*f,this.y=r*c+this.y*f,this.z=n*c+this.z*f,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this.x,r=this.y,n=this.z,a=this.w,o=t.x,s=t.y,u=t.z,h=a*o+r*u-n*s,l=a*s+n*o-i*u,c=a*u+i*s-r*o,f=-i*o-r*s-n*u,d=null!=e?e:t;return d.x=h*a+-(f*i)+-(l*n)- -(c*r),d.y=l*a+-(f*r)+-(c*i)- -(h*n),d.z=c*a+-(f*n)+-(h*r)- -(l*i),d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(iK.ZERO,this,iK.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,i){return new t().setFromAxisAngle(e,i)},t.fromVector4=function(e){return new t().setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return new t().setFromUnitVectors(e,i)},t}();iQ.tempVec0=new iK;var iJ=new iQ,i$=function(){},i0=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(i$),i1=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=iJ.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(i$),i2=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var a=0;a<t.parentSpaceTransforms.length;a++){var o=t.parentSpaceTransforms[a],s=e.parentSpaceTransforms[a],u=r.parentSpaceTransforms[a],h=o.position,l=s.position,c=u.position;n.blendVector3(h,l,i,c);var f=o.rotation,d=s.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=o.scale,v=s.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=o.euler,x=s.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var E=t.floatPropertyValues[T],_=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,_,i)}for(var C=0;C<t.colorPropertyValues.length;C++){var S=t.colorPropertyValues[C],A=e.colorPropertyValues[C],w=r.colorPropertyValues[C];n.blendColor(S,A,i,w)}},t}();i2.normalBlendFunction=new i0,i2.additiveBlendFunction=new i1;var i3=function(){function t(t){this.position=new iK,this.rotation=new iQ,this.scale=new iK,this.euler=new iK,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),i4=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=n(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push(new i3().copyFrom(r))}for(var a,o=n(t.defaultFloatPropertyValues);!(a=o()).done;){var s=a.value;this.floatPropertyValues.push(s)}for(var u,h=n(t.defaultColorPropertyValues);!(u=h()).done;){var l=u.value;this.colorPropertyValues.push(l)}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),i5=function(t){this.pose=new i4(t)};t.ApplyAdditiveNodeData=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(i6,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(iF),t.ApplyAdditiveNodeData=s([iP(en.ApplyAdditiveNodeData)],t.ApplyAdditiveNodeData);var i6=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new i5(e.skeleton),this.additiveNodeResult=new i5(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){i2.additiveBlend(t,e,i,r)},e}(iL);t.BlendNodeData=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(i8,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(iF),t.BlendNodeData=s([iP(en.BlendNodeData)],t.BlendNodeData);var i8=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.source0=null,e.source1=null,e.inputParameterValueNode=null,e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new i5(e.skeleton),this.source1Result=new i5(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){i2.localBlend(t,e,i,r)},e}(iL);t.AndNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(i9,t),r=n(this.conditionNodeIndices);!(e=r()).done;){var a=e.value;i.conditionNodes.push(t.getNode(a))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(iF),t.AndNodeData=s([iP(en.AndNodeData)],t.AndNodeData);var i9=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=n(this.conditionNodes);!(e=i()).done;)if(!e.value.getValue(t)){this.result=!1;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=n(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=n(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(ik);t.OrNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(i7,t),r=n(this.conditionNodeIndices);!(e=r()).done;){var a=e.value;i.conditionNodes.push(t.getNode(a))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(iF),t.OrNodeData=s([iP(en.OrNodeData)],t.OrNodeData);var i7=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=n(this.conditionNodes);!(e=i()).done;)if(e.value.getValue(t)){this.result=!0;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=n(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=n(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(ik);t.NotNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rt,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(iF),t.NotNodeData=s([iP(en.NotNodeData)],t.NotNodeData);var rt=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.result=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){return!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}(ik);t.ConstFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(re,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iF),t.ConstFloatNodeData=s([iP(en.ConstFloatNodeData)],t.ConstFloatNodeData);var re=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}return ib(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(iD);t.ConstBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ri,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iF),t.ConstBoolNodeData=s([iP(en.ConstBoolNodeData)],t.ConstBoolNodeData);var ri=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}return ib(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(ik);t.ControlParameterFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rr,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iF),t.ControlParameterFloatNodeData=s([iP(en.ControlParameterFloatNodeData)],t.ControlParameterFloatNodeData);var rr=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(iD);t.ControlParameterBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rn,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iF),t.ControlParameterBoolNodeData=s([iP(en.ControlParameterBoolNodeData)],t.ControlParameterBoolNodeData);var rn=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(ik);t.ControlParameterTriggerNodeData=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ra,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(iF),t.ControlParameterTriggerNodeData=s([iP(en.ControlParameterTriggerNodeData)],t.ControlParameterTriggerNodeData);var ra=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(ik);t.LayerBlendNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNodeIndex=-1,e.layerDatas=[],e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ro,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=n(this.layerDatas);!(i=r()).done;){var a=i.value;e.layers.push({inputNode:t.getNode(a.inputNodeIndex),weightValueNode:t.getNode(a.weightValueNodeIndex),weight:0})}},i.load=function(e){if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:-1,e.layerDatas)for(var i,r,a=n(e.layerDatas);!(r=a()).done;){var o=r.value;this.layerDatas.push(iB({inputNodeIndex:-1,weightValueNodeIndex:-1},o))}},e}(iF),t.LayerBlendNodeData=s([iP(en.LayerBlendNodeData)],t.LayerBlendNodeData);var ro=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseLayerNode=null,e.layers=[],e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new i5(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var i,r,a=n(this.layers);!(r=a()).done;){var o,s,u=r.value;null==(o=u.inputNode)||o.initialize(e),null==(s=u.weightValueNode)||s.initialize(e)}},i.shutdownInternal=function(e){null==(i=this.baseLayerNode)||i.shutdown(e);for(var i,r,a=n(this.layers);!(r=a()).done;){var o,s,u=r.value;null==(o=u.inputNode)||o.shutdown(e),null==(s=u.weightValueNode)||s.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()&&(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e)),e},i.updateLayers=function(t,e){for(var i,r=n(this.layers);!(i=r()).done;){var a=i.value;if(a.inputNode&&a.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),a.inputNode.evaluate(t,this.layerNodeResult);var o=a.weightValueNode.getValue(t);i2.localBlend(e.pose,this.layerNodeResult.pose,o,e.pose)}}return e},e}(iL);t.EqualNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rs,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(iF),t.EqualNodeData=s([iP(en.EqualNodeData)],t.EqualNodeData);var rs=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}(ik),ru=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}return ib(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(iF);(te=ep||(ep={}))[te.GreaterThan=0]="GreaterThan",te[te.LessThan=1]="LessThan";var rh=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}(ik);t.GreaterNodeData=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.instantiate=function(t){var e=this.createNode(rh,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(ru),t.GreaterNodeData=s([iP(en.GreaterNodeData)],t.GreaterNodeData),t.LessNodeData=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.instantiate=function(t){var e=this.createNode(rh,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(ru),t.LessNodeData=s([iP(en.LessNodeData)],t.LessNodeData),t.StateMachineNodeData=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rl,t);e.defaultStateIndex=this.defaultStateIndex;for(var i,r=n(this.stateDatas);!(i=r()).done;){var a=i.value,o={stateNode:t.getNode(a.stateNodeIndex),transitions:[]};e.states.push(o);for(var s,u=n(a.transitionDatas);!(s=u()).done;){var h=s.value,l={transitionNode:t.getNode(h.transitionNodeIndex),conditionNode:t.getNode(h.conditionNodeIndex),targetStateIndex:h.targetStateIndex};o.transitions.push(l)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex},e}(iF),t.StateMachineNodeData=s([iP(en.StateMachineNodeData)],t.StateMachineNodeData);var rl=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.states=[],e.defaultStateIndex=-1,e.activeTransition=null,e.activeStateIndex=-1,e}ib(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===ef.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=-1,n=i.transitions.length,a=0;a<n;a++){var o=i.transitions[a];if(-1===o.targetStateIndex)throw Error("Invalid target state index.");if(!this.states[o.targetStateIndex].stateNode.isTransitioning()){var s=!1;if(o.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>o.transitionNode.exitTime&&(s=!0)}else null!==o.conditionNode&&o.conditionNode.getValue(t)&&(s=!0);if(s){r=a;break}}}if(-1!==r){var h=i.transitions[r];h.transitionNode.initialize(t),e=null!==this.activeTransition?h.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):h.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=h.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=h.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=-1,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=n(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=n(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(iL);t.TransitionState=void 0,(ti=t.TransitionState||(t.TransitionState={}))[ti.None=0]="None",ti[ti.TransitioningIn=1]="TransitioningIn",ti[ti.TransitioningOut=2]="TransitioningOut",t.StateNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNodeIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rc,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex},e}(iF),t.StateNodeData=s([iP(en.StateNodeData)],t.StateNodeData);var rc=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}ib(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(iL);t.SourceType=void 0,(tr=t.SourceType||(t.SourceType={}))[tr.State=0]="State",tr[tr.Transition=1]="Transition",tr[tr.CachedPose=2]="CachedPose",t.TransitionNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rf,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(iF),t.TransitionNodeData=s([iP(en.TransitionNodeData)],t.TransitionNodeData);var rf=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.hasExitTime=!1,t.exitTime=.75,t.transitionLength=0,t.transitionProgress=0,t.blendWeight=0,t.sourceNode=null,t.sourceType=0,t.blendedDuration=0,t}ib(i,e);var r=i.prototype;return r.evaluate=function(t,e){e4(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=iW(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=ef.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult);if(this.registerPoseTasksAndUpdateRootMotion(i,n,e),this.blendedDuration=iH(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var a=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+a)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),e},r.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},r.getProgressPercentage=function(){return this.transitionProgress},r.getSourceType=function(){return this.sourceType},r.isSourceATransition=function(){return 1===this.sourceType},r.isSourceAState=function(){return 0===this.sourceType},r.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.getSourceStateNode=function(){return this.sourceNode},r.getSourceTransitionNode=function(){return this.sourceNode},r.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},r.initializeInternal=function(t){e.prototype.initializeInternal.call(this,t),this.sourceNodeResult=new i5(t.skeleton),this.targetNodeResult=new i5(t.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},r.shutdownInternal=function(i){this.targetNode.setTransitioningState(t.TransitionState.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(i),this.sourceNode.shutdown(i),this.sourceNode=null),e.prototype.shutdownInternal.call(this,i)},r.endSourceTransition=function(e){var i,r=this.getSourceTransitionNode().targetNode;null==(i=this.sourceNode)||i.shutdown(e),this.sourceNode=r,this.sourceType=0,this.getSourceStateNode().setTransitioningState(t.TransitionState.TransitioningOut)},r.initializeTargetStateAndUpdateTransition=function(t,e,i){this.markNodeActive(t);var r=this.targetNodeResult;return 0===this.sourceType&&this.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),r=this.targetNode.evaluate(t,r),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,r,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=iH(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},r.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=iW(this.blendWeight,0,1))},r.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;i2.localBlend(t.pose,e.pose,r,i.pose)},i}(iL);(tn=em||(em={}))[tn.Float=0]="Float",tn[tn.Color=1]="Color";var rd=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=n(e.position);!(i=r()).done;){var a=i.value;this.addReferenceTransform(a)}for(var o,s=n(e.rotation);!(o=s()).done;){var u=o.value;this.addReferenceTransform(u)}for(var h,l=n(e.scale);!(h=l()).done;){var c=h.value;this.addReferenceTransform(c)}for(var f,d=n(e.euler);!(f=d()).done;){var p=f.value;this.addReferenceTransform(p),this.useEuler=!0}for(var m=0;m<e.floats.length;m++){var v=e.floats[m];this.addRecordedProperty(v.path,v.className,v.property,0)}for(var y=0;y<e.colors.length;y++){var g=e.colors[y];this.addRecordedProperty(g.path,g.className,g.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new i3(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n,a=t+e+i;if(void 0===this.pathToObjectIndex.get(a)){var o=this.findTarget(t);if(o){(n="VFXItem"===e?o:o.getComponent(iS[e]))||console.error("The "+e+" Component was not found.");for(var s=i.split("."),u=s[s.length-1],h=n,l=0;l<s.length-1;l++){var c=h[s[l]];void 0===c&&console.error("The "+s[l]+" property of "+h+" was not found."),h=c}var f={target:h,property:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(a,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push(h[u]),this.pathToObjectIndex.set(a,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,a=n(i);!(e=a()).done;){var o=e.value,s=r.find(o);if(!s)return null;r=s}return r},t}(),rp=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.context=new iz;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},a=n(t.graphDataSet.resources);!(i=a()).done;){var o=i.value;if(o){for(var s,u=n(o.positionCurves);!(s=u()).done;){var h=s.value;r.position.push(h.path)}for(var l,c=n(o.rotationCurves);!(l=c()).done;){var f=l.value;r.rotation.push(f.path)}for(var d,p=n(o.scaleCurves);!(d=p()).done;){var m=d.value;r.scale.push(m.path)}for(var v,y=n(o.eulerCurves);!(v=y()).done;){var g=v.value;r.euler.push(g.path)}for(var x,b=n(o.floatCurves);!(x=b()).done;){var T=x.value;r.floats.push(T)}for(var E,_=n(o.colorCurves);!(E=_()).done;){var C=E.value;r.colors.push(C)}}}this.skeleton=new rd(e,r),this.result=new i5(this.skeleton),this.context.skeleton=this.skeleton;var S=new iU;S.nodes=this.nodes,S.nodeDatas=t.nodeDatas,S.dataSet=t.graphDataSet;for(var A=0;A<t.nodeDatas.length;A++)S.nodes[A]||t.nodeDatas[A].instantiate(S);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];a(i,ra)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),-1)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);-1!==i&&this.nodes[i].setValue(e)},t}();function rm(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rv(t,e,i){return e&&rm(t.prototype,e),i&&rm(t,i),t}var ry=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}ib(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onDestroy=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&ek(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},rv(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(iI);s([iR(void 0,void 0)],ry.prototype,"item",void 0),s([iR(void 0,void 0)],ry.prototype,"_enabled",void 0);var rg=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(ry);t.Animator=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.graph=null,e.graphAsset=null,e}ib(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graph&&this.graph.setBool(t,e)},i.setFloat=function(t,e){this.graph&&this.graph.setFloat(t,e)},i.setTrigger=function(t){this.graph&&this.graph.setTrigger(t)},i.resetTrigger=function(t){this.graph&&this.graph.resetTrigger(t)},i.onStart=function(){this.graphAsset&&(this.graph=new rp(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graph){for(var e=this.graph.evaluateGraph(t/1e3),i=this.graph.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,a=e.pose.parentSpaceTransforms[r].rotation,o=e.pose.parentSpaceTransforms[r].scale,s=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(o.x,o.y,o.z),this.graph.skeleton.useEuler?i[r].setRotation(s.x,s.y,s.z):i[r].setQuaternion(a.x,a.y,a.z,a.w)}for(var u=this.graph.skeleton.floatAnimatedObjects,h=0;h<u.length;h++){var l=u[h],c=l.property;l.target[c]=e.pose.floatPropertyValues[h]}for(var f=this.graph.skeleton.colorAnimatedObjects,d=0;d<f.length;d++){var p=f[d],m=p.property;p.target[m]=e.pose.colorPropertyValues[d]}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(ry),t.Animator=s([iA("Animator")],t.Animator);var rx=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e._priority=0,e}ib(e,t);var i=e.prototype;return i.render=function(t){},i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},rv(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(ry);s([iR(void 0,void 0)],rx.prototype,"materials",void 0),s([iR(void 0,void 0)],rx.prototype,"_priority",void 0);var rb=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(a=t[e+3])?a:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):a(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):a(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):a(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):a(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=this.x,e=this.y,i=this.z,r=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new iK(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();rb.ONE=new rb(1,1,1,1),rb.ZERO=new rb(0,0,0,0);var rT=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.meshCollider=new oL,e.getHitTestParams=function(t){var i=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,i);var r=e.meshCollider.getBoundingBoxData();if(r)return{type:r.type,triangles:r.area}},e}ib(e,t);var i=e.prototype;return i.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.materials[e],e)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(rx);s([iR(void 0,void 0)],rT.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}ib(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new rb;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(rT),t.EffectComponent=s([iA(es.EffectComponent)],t.EffectComponent),t.PostProcessVolume=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return ib(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(ry),s([iR(void 0,void 0)],t.PostProcessVolume.prototype,"bloom",void 0),s([iR(void 0,void 0)],t.PostProcessVolume.prototype,"vignette",void 0),s([iR(void 0,void 0)],t.PostProcessVolume.prototype,"tonemapping",void 0),s([iR(void 0,void 0)],t.PostProcessVolume.prototype,"colorAdjustments",void 0),t.PostProcessVolume=s([iA(es.PostProcessVolume)],t.PostProcessVolume);var rE=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,o=n*(1-Math.abs(a%2-1)),s=0,u=0,h=0;a>=0&&a<=1?(s=n,u=o):a>=1&&a<=2?(s=o,u=n):a>=2&&a<=3?(u=n,h=o):a>=3&&a<=4?(u=o,h=n):a>=4&&a<=5?(s=o,h=n):a>=5&&a<=6&&(s=n,h=o);var l=i-n;return this.set(s+l,u+l,h+l,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):a(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):a(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):a(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):a(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return .3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new rb(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,a=Math.max(e,i,r),o=Math.min(e,i,r),s=a-o,u=0,h=0;return 0!==a&&(h=s/a),a!=o&&(a==e?(u=(i-r)/s,i<r&&(u+=6)):a==i?u=(r-e)/s+2:a==r&&(u=(e-i)/s+4),u*=60),new t(u,h,a,n)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),new t().setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();rE.BLACK=new rE(0,0,0,1),rE.BLUE=new rE(0,0,1,1),rE.CLEAR=new rE(0,0,0,0),rE.CYAN=new rE(0,1,1,1),rE.GRAY=new rE(.5,.5,.5,1),rE.GREEN=new rE(0,1,0,1),rE.MAGENTA=new rE(1,0,1,1),rE.RED=new rE(1,0,0,1),rE.WHITE=new rE(1,1,1,1),rE.YELLOW=new rE(1,.92,.016,1);var r_=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=a,v[6]=o,v[7]=s,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=a,v[9]=o,v[13]=s,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),a=Math.sin(i),o=1-n,s=r.x,u=r.y,h=r.z,l=o*s,c=o*u;return this.set(l*s+n,l*u+a*h,l*h-a*u,0,l*u-a*h,c*u+n,c*h+a*s,0,l*h+a*u,c*h-a*s,o*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(iK.ZERO,t,iK.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),o.normalize(),n.crossVectors(r,o),n.normalize(),a.crossVectors(o,n);var s=this.elements;return s[0]=n.x,s[1]=a.x,s[2]=o.x,s[3]=0,s[4]=n.y,s[5]=a.y,s[6]=o.y,s[7]=0,s[8]=n.z,s[9]=a.z,s[10]=o.z,s[11]=0,s[12]=-n.dot(e),s[13]=-a.dot(e),s[14]=-o.dot(e),s[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<16;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[4],s=i[8],u=i[12],h=i[1],l=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],E=r[4],_=r[8],C=r[12],S=r[1],A=r[5],w=r[9],R=r[13],I=r[2],M=r[6],O=r[10],P=r[14],N=r[3],F=r[7],L=r[11],V=r[15];return n[0]=a*T+o*S+s*I+u*N,n[4]=a*E+o*A+s*M+u*F,n[8]=a*_+o*w+s*O+u*L,n[12]=a*C+o*R+s*P+u*V,n[1]=h*T+l*S+c*I+f*N,n[5]=h*E+l*A+c*M+f*F,n[9]=h*_+l*w+c*O+f*L,n[13]=h*C+l*R+c*P+f*V,n[2]=d*T+p*S+m*I+v*N,n[6]=d*E+p*A+m*M+v*F,n[10]=d*_+p*w+m*O+v*L,n[14]=d*C+p*R+m*P+v*V,n[3]=y*T+g*S+x*I+b*N,n[7]=y*E+g*A+x*M+b*F,n[11]=y*_+g*w+x*O+b*L,n[15]=y*C+g*R+x*P+b*V,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],a=t[1],o=t[5],s=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*s*l-r*u*l-n*o*c+i*u*c+r*o*f-i*s*f)+t[7]*(+e*s*f-e*u*c+n*a*c-r*a*f+r*u*h-n*s*h)+t[11]*(+e*u*l-e*o*f-n*a*l+i*a*f+n*o*h-i*u*h)+t[15]*(-r*o*h-e*s*l+e*o*c+r*a*l-i*a*c+i*s*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],o=t[5],s=t[6],u=t[7],h=t[8],l=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=l*m*u-p*c*u+p*s*f-o*m*f-l*s*v+o*c*v,g=d*c*u-h*m*u-d*s*f+a*m*f+h*s*v-a*c*v,x=h*p*u-d*l*u+d*o*f-a*p*f-h*o*v+a*l*v,b=d*l*s-h*p*s-d*o*c+a*p*c+h*o*m-a*l*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=y*E,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*E,t[2]=(o*m*n-p*s*n+p*r*u-i*m*u-o*r*v+i*s*v)*E,t[3]=(l*s*n-o*c*n-l*r*u+i*c*u+o*r*f-i*s*f)*E,t[4]=g*E,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*E,t[6]=(d*s*n-a*m*n-d*r*u+e*m*u+a*r*v-e*s*v)*E,t[7]=(a*c*n-h*s*n+h*r*u-e*c*u-a*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*E,t[10]=(a*p*n-d*o*n+d*i*u-e*p*u-a*i*v+e*o*v)*E,t[11]=(h*o*n-a*l*n-h*i*u+e*l*u+a*i*f-e*o*f)*E,t[12]=b*E,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*E,t[14]=(d*o*r-a*p*r-d*i*s+e*p*s+a*i*m-e*o*m)*E,t[15]=(a*l*r-h*o*r+h*i*s-e*l*s-a*i*c+e*o*c)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=iK.ZERO);var n=this.elements,a=e.x,o=e.y,s=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=a+a,d=o+o,p=s+s,m=a*f,v=a*d,y=a*p,g=o*d,x=o*p,b=s*p,T=u*f,E=u*d,_=u*p,C=i.x,S=i.y,A=i.z;return n[0]=(1-(g+b))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+b))*S,n[6]=(x+T)*S,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=h*n[0]+l*n[4]+c*n[8]-h+t.x,n[13]=h*n[1]+l*n[5]+c*n[9]-l+t.y,n[14]=h*n[2]+l*n[6]+c*n[10]-c+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,a=this.elements,o=n.set(a[0],a[1],a[2]).length(),s=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();0>this.determinant()&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14];var h=t.tempMat0;h.copyFrom(this);var l=1/o,c=1/s,f=1/u;return h.elements[0]*=l,h.elements[1]*=l,h.elements[2]*=l,h.elements[4]*=c,h.elements[5]*=c,h.elements[6]*=c,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),r.x=o,r.y=s,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new iK,e=new iQ,i=new iK;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var o=1/(e-t),s=1/(i-r),u=1/(a-n),h=-(e+t)*o,l=-(i+r)*s,c=-(a+n)*u;o*=2,s*=2,u*=-2;var f=this.elements;return f[0]=o,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=l,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var a=1/Math.tan(.5*t),o=1/(i-r),s=this.elements;return s[0]=n?a:a/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?a*e:a,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*o,s[15]=0,(null===r||r===1/0)&&(s[10]=-1,s[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14];var s=a[3]*i+a[7]*r+a[11]*n+a[15];return o.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14],o},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n,o.y=a[1]*i+a[5]*r+a[9]*n,o.z=a[2]*i+a[6]*r+a[10]*n,o.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n+o[12]*a,s.y=o[1]*i+o[5]*r+o[9]*n+o[13]*a,s.z=o[2]*i+o[6]*r+o[10]*n+o[14]*a,s.w=o[3]*i+o[7]*r+o[11]*n+o[15]*a,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!iX(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return new t().lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,a){return new t().perspective(e,i,r,n,a)},t.fromColumnVectors=function(e,i,r,n){return new t().setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromScale=function(e,i,r){return new t().setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return new t().setFromTranslation(e,i,r)},t.fromRotationX=function(e){return new t().setFromRotationX(e)},t.fromRotationY=function(e){return new t().setFromRotationY(e)},t.fromRotationZ=function(e){return new t().setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return new t().setFromRotationAxis(e,i)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,i,r){return new t().setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return new t().setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h,l,c,f,d,p,m,v){return new t(e,a,h,d,i,o,l,p,r,s,c,m,n,u,f,v)},t}();function rC(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"!==e||(r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}function rS(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var r=t.createQuery(),n=i(function(){return u(this,function(i){return[2,new Promise(function(i,a){if(r){var o=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);o&&!s&&i(t.getQueryParameter(r,t.QUERY_RESULT)/1e3/1e3),(o||s)&&(t.deleteQuery(r),r=null),null!==o&&r&&window.setTimeout(function(){n().then(i).catch},1)}})]})});if(!r)return;return{begin:function(){r&&t.beginQuery(e.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:n}}}r_.IDENTITY=new r_(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),r_.ZERO=new r_(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),r_.tempVec0=new iK,r_.tempVec1=new iK,r_.tempVec2=new iK,r_.tempMat0=new r_;var rA=[],rw={},rR="WebGL Constants not in global, please check your environment";function rI(){"function"==typeof WebGL2RenderingContext?rO(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(rO(WebGLRenderingContext),rO(WebGLRenderingContext.prototype)):eW?rA.push(eY()?"iOS16 lockdown mode, WebGL Constants not in global":rR):rA.push(rR),rA.length||"HALF_FLOAT"in rw||(rw.HALF_FLOAT=5131)}function rM(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function rO(t){for(var e in t)/^[A-Z_]/.test(e)&&(rw[e]=t[e])}function rP(t){switch(t){case eh.Float32:return WebGLRenderingContext.FLOAT;case eh.Int16:return WebGLRenderingContext.SHORT;case eh.Int8:return WebGLRenderingContext.BYTE;case eh.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case eh.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}}function rN(t){switch(t){case tV.ALPHA:case tV.ADD:case tV.SUBTRACTION:case tV.STRONG_LIGHT:case tV.WEAK_LIGHT:return 1;case tV.SUPERPOSITION:return 2;case tV.BRIGHTNESS:return 3;case tV.MULTIPLY:return 0;default:return 1}}function rF(t,e){switch(e){case void 0:case tV.ALPHA:t.blendFunction=[rw.ONE,rw.ONE_MINUS_SRC_ALPHA,rw.ONE,rw.ONE_MINUS_SRC_ALPHA];break;case tV.ADD:t.blendFunction=[rw.ONE,rw.ONE,rw.ONE,rw.ONE];break;case tV.SUBTRACTION:t.blendFunction=[rw.ONE,rw.ONE,rw.ZERO,rw.ONE],t.blendEquation=[rw.FUNC_REVERSE_SUBTRACT,rw.FUNC_REVERSE_SUBTRACT];break;case tV.SUPERPOSITION:t.blendFunction=[rw.ONE,rw.ONE,rw.ONE,rw.ONE];break;case tV.MULTIPLY:t.blendFunction=[rw.DST_COLOR,rw.ONE_MINUS_SRC_ALPHA,rw.DST_COLOR,rw.ONE_MINUS_SRC_ALPHA];break;case tV.BRIGHTNESS:t.blendFunction=[rw.ONE,rw.ONE_MINUS_SRC_ALPHA,rw.ONE,rw.ONE_MINUS_SRC_ALPHA];break;case tV.STRONG_LIGHT:t.blendFunction=[rw.DST_COLOR,rw.DST_ALPHA,rw.ZERO,rw.ONE];break;case tV.WEAK_LIGHT:t.blendFunction=[rw.DST_COLOR,rw.ZERO,rw.ZERO,rw.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function rL(t,e){e===tD.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=rw.CW,t.cullFace=e===tD.BACK?rw.BACK:rw.FRONT)}function rV(e,i){switch(i){case void 0:e.stencilTest=!1;break;case t.MaskMode.MASK:e.stencilTest=!0,e.stencilFunc=[rw.ALWAYS,rw.ALWAYS],e.stencilOpZPass=[rw.REPLACE,rw.REPLACE];break;case t.MaskMode.OBSCURED:e.stencilTest=!0,e.stencilFunc=[rw.EQUAL,rw.EQUAL];break;case t.MaskMode.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[rw.NOTEQUAL,rw.NOTEQUAL];break;case t.MaskMode.NONE:e.stencilTest=!1;break;default:console.warn("MaskMode "+i+" not in specification, please set stencil params seperately.")}}rA.length||rI(),t.ShaderType=void 0,(ta=t.ShaderType||(t.ShaderType={}))[ta.vertex=0]="vertex",ta[ta.fragment=1]="fragment",t.MaskMode=void 0,(to=t.MaskMode||(t.MaskMode={}))[to.NONE=0]="NONE",to[to.MASK=1]="MASK",to[to.OBSCURED=2]="OBSCURED",to[to.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",t.TextureLoadAction=void 0,(ts=t.TextureLoadAction||(t.TextureLoadAction={}))[ts.whatever=0]="whatever",ts[ts.clear=2]="clear",t.TextureSourceType=void 0,(tu=t.TextureSourceType||(t.TextureSourceType={}))[tu.none=0]="none",tu[tu.data=1]="data",tu[tu.image=2]="image",tu[tu.compressed=3]="compressed",tu[tu.video=4]="video",tu[tu.canvas=5]="canvas",tu[tu.framebuffer=6]="framebuffer",tu[tu.mipmaps=7]="mipmaps";var rD=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.download=function(t,e,i,r){var n=this;if(void 0===e&&(e="json"),!this.start(t,i,r)){var a=new XMLHttpRequest,o=function(){n.finish(t,a.status,a.response)};a.responseType=e,a.addEventListener("load",function(){200==a.status?n.finish(t,200,a.response):o()}),a.addEventListener("error",o),a.open("GET",t,!0),a.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(t,e,i){var r=this.callbacks[t];delete this.callbacks[t];for(var n=200==e?[i]:[e,i],a=n.length-1,o=r.length;a<o;a+=2)r[a].apply(null,n)},t}(),rk=!1,rz=!1;function rU(t,e){return rB.apply(this,arguments)}function rB(){return(rB=i(function(t,e){return u(this,function(i){switch(i.label){case 0:if(!(rk||!e))return[3,2];return[4,rX(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rX(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rk=!0,[4,rX(t)];case 6:return[2]}})})).apply(this,arguments)}function rG(t,e){return rj.apply(this,arguments)}function rj(){return(rj=i(function(t,e){return u(this,function(i){switch(i.label){case 0:if(!(rz||!e))return[3,2];return[4,rX(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rX(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rz=!0,[4,rX(t)];case 6:return[2]}})})).apply(this,arguments)}function rX(t){return rH.apply(this,arguments)}function rH(){return(rH=i(function(t){var e,i;return u(this,function(r){if(e="",a(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else a(t,Blob)?(e=URL.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,r){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&URL.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function rW(t){return rY.apply(this,arguments)}function rY(){return(rY=i(function(t){return u(this,function(e){return[2,new Promise(function(e,i){new rD().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function rZ(){return(rZ=i(function(t){return u(this,function(e){return[2,new Promise(function(e,i){new rD().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function rq(t){return rK.apply(this,arguments)}function rK(){return(rK=i(function(t){var e;return u(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eZ()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=e.play().catch(function(t){i(t)});r?r.then(function(){return t(e)}):e.addEventListener("loadeddata",function i(){t(e),e.removeEventListener("loadeddata",i)},!0),e.addEventListener("error",function(t){i("Load video fail.")})})]})})).apply(this,arguments)}function rQ(t,e){return rJ.apply(this,arguments)}function rJ(){return(rJ=i(function(t,e){return u(this,function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function r$(t,e,i){return r0.apply(this,arguments)}function r0(){return(r0=i(function(e,i,r,n){var a,o,s,h,l,c,f;return u(this,function(u){switch(u.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return a=e.mipmaps,o=e.target,[4,Promise.all(a.map(function(t){return Promise.all(t.map(function(t){return t.id?r[t.id]:r1(t,i)}))}))];case 1:return s=u.sent(),[2,iB({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return h=e.mipmaps,l=e.target,[4,Promise.all(h.map(function(t){return r1(t,i)}))];case 3:return c=u.sent(),f=n[h[0][1][0]].url,[2,iB({keepImageSource:!1},e,{mipmaps:c,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:l,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:h.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function r1(t,e){return r2.apply(this,arguments)}function r2(){return(r2=i(function(t,e){var i,r,n,a,o;return u(this,function(s){if(r=(i=t[1])[0],n=i[1],a=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,rX(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var r3=1,r4=function(e){function r(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+r3++,i}ib(r,e);var n=r.prototype;return n.getWidth=function(){return this.width||0},n.getHeight=function(){return this.height||0},n.uploadCurrentVideoFrame=function(){},n.offloadData=function(){},n.reloadData=function(){},n.initialize=function(){},n.assembleOptions=function(e){var i=e.target,r=void 0===i?rw.TEXTURE_2D:i,n=e.format,a=void 0===n?rw.RGBA:n;return e.sourceType||("image"in e?e.sourceType=t.TextureSourceType.image:"data"in e?e.sourceType=t.TextureSourceType.data:"video"in e?e.sourceType=t.TextureSourceType.video:e.sourceType=0),iB({minFilter:rw.NEAREST,magFilter:rw.NEAREST,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE,target:r,format:rw.RGBA,internalFormat:a,type:rw.UNSIGNED_BYTE},e)},r.fromImage=function(e,n,a){return i(function(){var i,o;return u(this,function(s){switch(s.label){case 0:return[4,rX(e)];case 1:return i=s.sent(),(o=r.create(n,iB({sourceType:t.TextureSourceType.image,image:i,target:rw.TEXTURE_2D,id:iu(),flipY:!0},a))).initialize(),[2,o]}})})()},r.fromVideo=function(e,n,a){return i(function(){var i,o;return u(this,function(s){switch(s.label){case 0:return[4,rq(e)];case 1:return i=s.sent(),(o=r.create(n,iB({sourceType:t.TextureSourceType.video,video:i,id:iu(),flipY:!0},a))).initialize(),[2,o]}})})()},rv(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(iI);function r5(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?rw.RGBA:3===o?rw.RGB:2===o?rw.LUMINANCE_ALPHA:rw.LUMINANCE,r4.createWithData(t,{data:e,width:i,height:r},{type:rw.HALF_FLOAT,format:n,internalFormat:a,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE})}var r6={type:rw.UNSIGNED_BYTE,format:rw.RGBA,internalFormat:rw.RGBA,wrapS:rw.MIRRORED_REPEAT,wrapT:rw.MIRRORED_REPEAT,minFilter:rw.NEAREST,magFilter:rw.NEAREST};function r8(e){return r4.create(e,iB({id:iT.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},r6))}function r9(e){return r4.create(e,iB({id:iT.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},r6))}var r7=function(){function t(t,e,i){void 0===i&&(i=0),this.arrayBuffer=t,this.baseOffset=i;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==r[0]||75!==r[1]||84!==r[2]||88!==r[3]||32!==r[4]||49!==r[5]||49!==r[6]||187!==r[7]||13!==r[8]||10!==r[9]||26!==r[10]||10!==r[11])throw Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),o=67305985===a.getUint32(0,!0);if(this.glType=a.getUint32(1*n,o),this.glTypeSize=a.getUint32(2*n,o),this.glFormat=a.getUint32(3*n,o),this.glInternalFormat=a.getUint32(4*n,o),this.glBaseInternalFormat=a.getUint32(5*n,o),this.pixelWidth=a.getUint32(6*n,o),this.pixelHeight=a.getUint32(7*n,o),this.pixelDepth=a.getUint32(8*n,o),this.numberOfArrayElements=a.getUint32(9*n,o),this.numberOfFaces=a.getUint32(10*n,o),this.numberOfMipmapLevels=a.getUint32(11*n,o),this.bytesOfKeyValueData=a.getUint32(12*n,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){e8.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){e8.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){e8.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+".");return}0===this.glType?this.loadType=0:this.loadType=2}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,o=0;o<a;o++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,s);e.push({data:h,width:r,height:n}),i+=s+4+(3-(s+3)%4)}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function nt(e){var i=new r7(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,a=i.pixelHeight,o=i.glType,s=i.numberOfFaces,u=i.glInternalFormat,h=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:o,target:6===s?rw.TEXTURE_CUBE_MAP:rw.TEXTURE_2D,internalFormat:u,format:h,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,a))+1))}}var ne=function(){function e(){this.reloadPending={}}var r=e.prototype;return r.reload=function(t){var e=this;return i(function(){var i,r;return u(this,function(n){switch(n.label){case 0:if(i=t.id,e.reloadPending[i])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw Error("No source from.");case 3:return[2]}})})()},r.canOffloadTexture=function(e){if(e){var i=e.type;if(i===t.TextureSourceType.compressed||i===t.TextureSourceType.image){var r=e.target,n=e.map,a=e.url;return r===rw.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:e7(a)&&a.length>0}if(i===t.TextureSourceType.mipmaps){var o=e.bin,s=e.mipmaps,u=e.target,h=e.maps,l=e.urls;return o?s.length>0:u===rw.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):l.every(function(t){return e7(t)&&t.length>0})}}return!1},r.loadSource=function(e,r){var n=this;return i(function(){var i,a,o,s,h,l,c,f,d,p,m,v,y,g,x,b,T,E;return u(this,function(u){switch(u.label){case 0:if(i=e.type,a=e.target,o=e.map,s=e.url,h=e.bin,l=e.mipmaps,c=e.urls,f=e.maps,!(a===rw.TEXTURE_CUBE_MAP&&i!==t.TextureSourceType.mipmaps))return[3,2];return[4,n.loadCubeMap(o)];case 1:return d=u.sent(),[2,iB({},r,{cube:d,target:rw.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iB({},o),target:rw.TEXTURE_CUBE_MAP}})];case 2:if(i!==t.TextureSourceType.image)return[3,4];return[4,rX(s)];case 3:return p=u.sent(),[2,iB({},r,{image:p,sourceType:t.TextureSourceType.image,sourceFrom:{type:i,url:s,target:rw.TEXTURE_2D}})];case 4:if(i!==t.TextureSourceType.video)return[3,6];return[4,rq(s)];case 5:return m=u.sent(),[2,iB({},r,{video:m,sourceType:t.TextureSourceType.video})];case 6:if(i!==t.TextureSourceType.compressed)return[3,8];return[4,rW(s)];case 7:return v=u.sent(),[2,iB({},nt(v),r,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(i!==t.TextureSourceType.mipmaps)return[3,17];if(!h)return[3,13];return[4,rW(h)];case 9:if(y=u.sent(),x=(g=null!=a?a:rw.TEXTURE_2D)===rw.TEXTURE_2D?l.slice():l.map(function(t){return t.slice()}),a!==rw.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(l.map(function(t){return n.loadMipmapImages(t,y)}))];case 10:return b=u.sent(),[3,12];case 11:b=n.loadMipmapImages(l,y),u.label=12;case 12:return[2,iB({},r,{mipmaps:b,target:g,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:h,mipmaps:x,target:g,type:t.TextureSourceType.mipmaps}})];case 13:if(!(a===rw.TEXTURE_2D||!a))return[3,15];return[4,Promise.all(c.map(function(t){return rX(t)}))];case 14:return T=u.sent(),[2,iB({},r,{mipmaps:T,target:rw.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:c.slice(),target:rw.TEXTURE_2D}})];case 15:if(a!==rw.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(f.map(function(t){return n.loadCubeMap(t)}))];case 16:return E=u.sent(),[2,iB({},r,{mipmaps:E,target:rw.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:f.map(function(t){return iB({},t)}),target:rw.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+i+".")}})})()},r.loadMipmapImages=function(t,e){return i(function(){return u(this,function(i){return[2,Promise.all(t.map(function(t){return rX(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},r.loadCubeMap=function(t){return i(function(){return u(this,function(e){return[2,Promise.all(t.map(function(t){return rX(t)}))]})})()},e}();function ni(){return ev||(ev=new ne),ev}var nr=function(){function t(t){this.destroyed=!1;var e=t.name;this.name=void 0===e?"defaultDataBlock":e}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach(function(i){e.setUniformValue(i,t[i])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function nn(t){return"object"==typeof t&&t&&void 0===t.length&&a(t,r4)}t.MaterialRenderType=void 0,(th=t.MaterialRenderType||(t.MaterialRenderType={}))[th.normal=0]="normal",th[th.transformFeedback=1]="transformFeedback";var na=1,no=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,a=void 0===n?"Material"+na++:n,o=i.renderType,s=i.shader,u=i.uniformSemantics;r.name=a,r.renderType=void 0===o?0:o,r.shaderSource=s,r.props=i,r.uniformSemantics=iB({},u)}else r.name="Material"+na++,r.renderType=0;return r}ib(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},rv(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(iI),ns=function(){function e(e){this.engine=e,this.alphaMaskEnabled=!1,this.maskMode=t.MaskMode.NONE,this.maskable=null,this.stencilClearAction={stencilAction:t.TextureLoadAction.clear}}var i=e.prototype;return i.getRefValue=function(){return 1},i.setMaskOptions=function(e){var i=e.isMask,r=e.inverted,n=e.reference,a=e.alphaMaskEnabled;this.alphaMaskEnabled=void 0!==a&&a,void 0!==i&&i?this.maskMode=t.MaskMode.MASK:(this.maskMode=void 0!==r&&r?t.MaskMode.REVERSE_OBSCURED:t.MaskMode.OBSCURED,this.maskable=this.engine.findObject(n))},i.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},e}();t.ShaderCompileResultStatus=void 0,(tl=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[tl.noShader=0]="noShader",tl[tl.success=1]="success",tl[tl.fail=2]="fail",tl[tl.compiling=3]="compiling",t.GLSLVersion=void 0,(tc=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",tc.GLSL3="300 es";var nu=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return ib(e,t),e}(iI);t.Shader=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=n(Object.keys(t));!(i=r()).done;){var a=i.value;e.push([a,t[a]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(iI),t.Shader=s([iA(es.Shader)],t.Shader);var nh="effects-internal-copy",nl="effects-internal-copy-mesh",nc="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",nf="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function nd(e,i){return{name:nh,vertex:nc,fragment:nf,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:nl+ +i}}var np={format:rw.RGBA,type:rw.UNSIGNED_BYTE,minFilter:rw.LINEAR,magFilter:rw.LINEAR,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE},nm=Symbol("dispose"),nv=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var i=e.prototype;return i.requestColorAttachmentTexture=function(e){var i=this,r=e.width,n=e.height,a=e.name,o={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:a},s=[a];Object.getOwnPropertyNames(np).forEach(function(t){var i,r=null!=(i=e[t])?i:np[t];o[t]=r,s.push(t,r)});var u=s.join(":"),h=this.textureCache[u];if(h)this.textureRef[u]++;else{var l=this.engine;e4(l),h=r4.create(l,o),this.textureCache[u]=h,this.textureRef[u]=1,h[nm]=h.dispose,h.dispose=function(){return i.removeTexture(u)}}return h},i.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[nm](),i.dispose=i[nm]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},i.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var i=t.textureCache[e];i[nm](),i.dispose=i[nm]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),ny=function(){function t(t){void 0===t&&(t={}),this.semantics=iB({},t)}var e=t.prototype;return e.toObject=function(){return iB({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var i=this.semantics[t];return ie(i)?i(e):i},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach(function(e){delete t.semantics[e]})},t}(),ng=((ey={})[rw.FLOAT]=Float32Array.BYTES_PER_ELEMENT,ey[rw.INT]=Int32Array.BYTES_PER_ELEMENT,ey[rw.SHORT]=Int16Array.BYTES_PER_ELEMENT,ey[rw.BYTE]=Int8Array.BYTES_PER_ELEMENT,ey),nx=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="",e.subMeshes=[],e}ib(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(iI);function nb(t){return t===rw.INT?new Int32Array(0):t===rw.SHORT?new Int16Array(0):new Float32Array(0)}(tf=eg||(eg={}))[tf.XYZ=0]="XYZ",tf[tf.XZY=1]="XZY",tf[tf.YXZ=2]="YXZ",tf[tf.YZX=3]="YZX",tf[tf.ZXY=4]="ZXY",tf[tf.ZYX=5]="ZYX";var nT=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],a=i[8],o=i[1],s=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case eg.XYZ:this.y=Math.asin(iW(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,s),this.z=0);break;case eg.YXZ:this.x=Math.asin(-iW(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(a,c),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-h,r),this.z=0);break;case eg.ZXY:this.x=Math.asin(iW(l,-1,1)),.9999999>Math.abs(l)?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case eg.ZYX:this.y=Math.asin(-iW(h,-1,1)),.9999999>Math.abs(h)?(this.x=Math.atan2(l,c),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case eg.YZX:this.z=Math.asin(iW(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case eg.XZY:this.z=Math.asin(-iW(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(l,s),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=ij,this.y*=ij,this.z*=ij,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,a,o;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(a=t[e+2])?a:0,this.order=null!=(o=t[e+3])?o:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?console.error("add euler with different order"):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addEulers=function(t,e){return t.order!=e.order?console.error("add euler with different order"):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new iQ;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this.x,i=this.y,r=this.z,n=this.order,a=Math.cos(e*iG*.5),o=Math.cos(i*iG*.5),s=Math.cos(r*iG*.5),u=Math.sin(e*iG*.5),h=Math.sin(i*iG*.5),l=Math.sin(r*iG*.5);switch(n){case eg.XYZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case eg.YXZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case eg.ZXY:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case eg.ZYX:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case eg.YZX:t.set(u*o*s+a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s-u*h*l);break;case eg.XZY:t.set(u*o*s-a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s+u*h*l);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,i=this.x,r=this.y,n=this.z,a=this.order,o=Math.cos(i*iG),s=Math.sin(i*iG),u=Math.cos(r*iG),h=Math.sin(r*iG),l=Math.cos(n*iG),c=Math.sin(n*iG);if(a===eg.XYZ){var f=o*l,d=o*c,p=s*l,m=s*c;e[0]=u*l,e[4]=-u*c,e[8]=h,e[1]=d+p*h,e[5]=f-m*h,e[9]=-s*u,e[2]=m-f*h,e[6]=p+d*h,e[10]=o*u}else if(a===eg.YXZ){var v=u*l,y=u*c,g=h*l,x=h*c;e[0]=v+x*s,e[4]=g*s-y,e[8]=o*h,e[1]=o*c,e[5]=o*l,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=o*u}else if(a===eg.ZXY){var b=u*l,T=u*c,E=h*l,_=h*c;e[0]=b-_*s,e[4]=-o*c,e[8]=E+T*s,e[1]=T+E*s,e[5]=o*l,e[9]=_-b*s,e[2]=-o*h,e[6]=s,e[10]=o*u}else if(a===eg.ZYX){var C=o*l,S=o*c,A=s*l,w=s*c;e[0]=u*l,e[4]=A*h-S,e[8]=C*h+w,e[1]=u*c,e[5]=w*h+C,e[9]=S*h-A,e[2]=-h,e[6]=s*u,e[10]=o*u}else if(a===eg.YZX){var R=o*u,I=o*h,M=s*u,O=s*h;e[0]=u*l,e[4]=O-R*c,e[8]=M*c+I,e[1]=c,e[5]=o*l,e[9]=-s*l,e[2]=-h*l,e[6]=I*c+M,e[10]=R-O*c}else if(a===eg.XZY){var P=o*u,N=o*h,F=s*u,L=s*h;e[0]=u*l,e[4]=-c,e[8]=h*l,e[1]=P*c+L,e[5]=o*l,e[9]=N*c-F,e[2]=F*c-N,e[6]=s*l,e[10]=L*c+P}else console.error("toMatrix4: Invalid order "+a);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromArray(e,i,r)},t}();nT.DEFAULT_ORDER=eg.ZYX,nT.tempQuat0=new iQ,nT.tempMat0=new r_;var nE=function(){function t(t,e,i,r,n,a,o,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,o,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=o,h[1]=e,h[4]=n,h[7]=s,h[2]=i,h[5]=a,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=a,h[2]=o,h[5]=s,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,a=e+e,o=i+i,s=r+r,u=e*a,h=e*o,l=e*s,c=i*o,f=i*s,d=r*s,p=n*a,m=n*o,v=n*s,y=this.elements;return y[0]=1-(c+d),y[1]=h+v,y[2]=l-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=l+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],a=r[3],o=r[6],s=r[1],u=r[4],h=r[7];return r[0]=e*n+i*s,r[3]=e*a+i*u,r[6]=e*o+i*h,r[1]=-i*n+e*s,r[4]=-i*a+e*u,r[7]=-i*o+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<9;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[3],s=i[6],u=i[1],h=i[4],l=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],E=r[8];return n[0]=a*p+o*y+s*b,n[3]=a*m+o*g+s*T,n[6]=a*v+o*x+s*E,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*E,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8];return e*(a*h-u*o)+n*(u*r-i*h)+s*(i*o-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8],l=h*a-u*o,c=u*r-h*i,f=o*i-a*r,d=e*l+n*c+s*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(s*o-h*n)*p,t[2]=(u*n-s*a)*p,t[3]=c*p,t[4]=(h*e-s*r)*p,t[5]=(s*i-u*e)*p,t[6]=f*p,t[7]=(n*r-o*e)*p,t[8]=(a*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[3]*r+a[6]*n,o.y=a[1]*i+a[4]*r+a[7]*n,o.z=a[2]*i+a[5]*r+a[8]*n,o},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!iX(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return new t().setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h){return new t(e,n,s,i,a,u,r,o,h)},t}(),n_=function(){function t(t,e){void 0===t&&(t=iK.ZERO),void 0===e&&(e=iK.X),this.origin=new iK,this.direction=new iK,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new iK;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,o,s,u=this.origin,h=u.x,l=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,E=b.y,_=b.z,C=1/d,S=1/p,A=1/m;if(C>=0?(i=(y-h)*C,r=(T-h)*C):(i=(T-h)*C,r=(y-h)*C),S>=0?(n=(g-l)*S,a=(E-l)*S):(n=(E-l)*S,a=(g-l)*S),!(i>a)&&!(n>r)&&((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),A>=0?(o=(x-c)*A,s=(_-c)*A):(o=(_-c)*A,s=(x-c)*A),!(i>s)&&!(o>r))&&((o>i||i!=i)&&(i=o),(s<r||r!=r)&&(r=s),!(r<0)))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new iK).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),o=n.dot(n)-a*a,s=e.radius*e.radius;if(!(o>s)){var u=Math.sqrt(s-o),h=a-u,l=a+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,o=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(o,a),h=t.tempVec1.subtractVectors(s,a),l=t.tempVec2.subtractVectors(this.origin,a),c=t.tempVec3.crossVectors(u,h),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(l,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(l);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*l.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();n_.tempVec0=new iK,n_.tempVec1=new iK,n_.tempVec2=new iK,n_.tempVec3=new iK;var nC=function(){function t(t,e){void 0===t&&(t=new iK(1/0,1/0,1/0)),void 0===e&&(e=new iK(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,a=-1/0,o=-1/0,s=0,u=t.length;s<u;s+=3){var h=t[s],l=t[s+1],c=t[s+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>a&&(a=l),c>o&&(o=c)}return this.min.set(e,i,r),this.max.set(n,a,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return new t().copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new iK),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new iK),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,a=0,o=n.length;a<o;a++)this.expandByObject(n[a]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new iK),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){var e=new iK;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new iK),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new iK),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new iK),this.isEmpty())return[];var i=[];return i[0]=new iK(this.min.x,this.min.y,this.min.z),i[1]=new iK(this.min.x,this.min.y,this.max.z),i[2]=new iK(this.min.x,this.max.y,this.min.z),i[3]=new iK(this.min.x,this.max.y,this.max.z),i[4]=new iK(this.max.x,this.min.y,this.min.z),i[5]=new iK(this.max.x,this.min.y,this.max.z),i[6]=new iK(this.max.x,this.max.y,this.min.z),i[7]=new iK(this.max.x,this.max.y,this.max.z),i.forEach(function(i){i.subtract(e),i.applyMatrix(t),i.add(e)}),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new iK;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),nS=function(){function t(t,e){void 0===t&&(t=iK.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var a=new nC().setFromPoints(t);a.getCenter(i),this.radius=a.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new iK),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return(void 0===t&&(t=new nC),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return this.center.applyMatrix(t),this.radius=this.radius*Math.sqrt(Math.max(i,r,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=new iK().subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=(r-this.radius)*.5;this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new iK,i=new iK;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=new iK().subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}(),nA=Object.freeze({__proto__:null,get EulerOrder(){return eg},Euler:nT,Quaternion:iQ,Vector2:iq,Vector3:iK,Vector4:rb,Matrix3:nE,Matrix4:r_,Ray:n_,PI2:2*Math.PI,DEG2RAD:iG,RAD2DEG:ij,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:iX,damp:function(t,e,i,r){return iH(t,e,1-Math.exp(-i*r))},lerp:iH,degToRad:function(t){return t*iG},radToDeg:function(t){return t*ij},clamp:iW,Color:rE,Box3:nC,Sphere:nS}),nw=1,nR=function(e){function i(t,i){var r;if((r=e.call(this,t)||this).destroyed=!1,r.visible=!0,i){var n=i.material,a=i.geometry,o=i.name,s=i.priority,u=i.worldMatrix,h=void 0===u?r_.fromIdentity():u;r.id="Mesh"+nw++,r.name=void 0===o?"<unnamed>":o,r.geometry=a,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=h}else r.id="Mesh"+nw++,r.name="<unnamed>",r.worldMatrix=r_.fromIdentity(),r._priority=0;return r}ib(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.restore=function(){},r.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var i=null==e?void 0:e.material;i!==t.DestroyOptions.keep&&this.material.dispose(i),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},rv(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(rx);t.RenderPassAttachmentStorageType=void 0,(td=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[td.none=0]="none",td[td.color=1]="color",td[td.stencil_8_opaque=2]="stencil_8_opaque",td[td.depth_16_opaque=3]="depth_16_opaque",td[td.depth_stencil_opaque=4]="depth_stencil_opaque",td[td.depth_16_texture=5]="depth_16_texture",td[td.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(tp=t.TextureStoreAction||(t.TextureStoreAction={}))[tp.store=0]="store",tp[tp.clear=2]="clear";var nI=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(a(r,r4))this.texture=r,this.externalTexture=!0;else if(r){var o=r.wrapT,s=r.wrapS,u=r.minFilter,h=r.magFilter,l=r.internalFormat,c=r.format,f=void 0===c?rw.RGBA:c,d=r.type,p=void 0===d?rw.UNSIGNED_BYTE:d;this.externalTexture=!1,this.textureOptions={size:n,format:f,type:p,internalFormat:l||f,wrapT:o,wrapS:s,minFilter:u,magFilter:h,name:i.name},this.texture=r4.create(e,iB({},this.textureOptions,{sourceType:t.TextureSourceType.framebuffer,data:{width:n[0],height:n[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},rv(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),e}();t.RenderPassDestroyAttachmentType=void 0,(tm=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[tm.force=0]="force",tm[tm.keep=1]="keep",tm[tm.keepExternal=2]="keepExternal",tm[tm.destroy=0]="destroy";var nM=1,nO=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+nM++:r,a=i.clearAction,o=i.semantics,s=i.depthStencilAttachment,u=i.storeAction,h=i.priority,l=i.meshOrder,c=void 0===l?t.OrderType.ascending:l,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===h?0:h,this.meshOrder=c,this.meshes=e1((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=iB({},a),this.storeAction=iB({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new ny(o),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){e2(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){ek(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),e1(this.meshes,this.meshOrder),this.meshes},i.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},i.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],a=e[3];t.setViewport(i,r,n,a)}},i.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},i.frameCleanup=function(t){},i.resetColorAttachments=function(e){var i=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var r=e.map(function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new nI(i.renderer.engine,{texture:e})});this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments=r,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(e.map(function(t){return t})))}else this.resetAttachments({attachments:e.map(function(t){return{texture:t}})})},i.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},i.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},i._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var a=this.viewportScale,o=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*a,r.getHeight()*a],s=[o[2],o[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map(function(t,e){var r;return new nI(i.renderer.engine,iB({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=h;var l=n5.create({storeAction:this.storeAction,name:u,viewport:o,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);l.bind(),l.unbind(),this.framebuffer=l}else this.attachments.length=0},i.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var i=this.renderer,r=this.viewportScale;return i?[0,0,i.getWidth()*r,i.getHeight()*r]:[0,0,0,0]},i.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:i}}},i.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:i}}},i.getDepthTexture=function(t,e){if(!this.depthTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.depthTexture=n),n}return this.depthTexture},i.getStencilTexture=function(t,e){if(!this.stencilTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},i.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},i.dispose=function(e){if(!this.destroyed){var i,r,n=(null==e?void 0:e.meshes)||void 0;n!==t.DestroyOptions.keep&&this.meshes.forEach(function(t){t.dispose(n)}),this.meshes.length=0;var a=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===a||1===a||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var o=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,s=this.framebuffer;s&&(s.dispose({depthStencilAttachment:o}),s.externalStorage&&2===o||1===o||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=is}},rv(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),e}(),nP="precision highp float;attribute vec2 aUV;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(aUV.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(texParams.w,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",nN="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",nF="#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",nL="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}",nV="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",nD="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",nk="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",nz="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",nU="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",nB="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform sampler2D _GaussianDownTex;uniform vec2 _GaussianDownTextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=1;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec3 lowResColor=GaussNxN(_MainTex,uv,0.5/_GaussianDownTextureSize,1.0);vec3 highResColor=GaussNxN(_GaussianDownTex,uv,1.0/_GaussianDownTextureSize,1.0);vec3 color=mix(highResColor,lowResColor,0.7);gl_FragColor=vec4(color,1.0);}",nG="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}",nj={},nX=function(){function e(){}return e.registerInclude=function(t,e){nj[t]&&e8.warn('The "'+t+'" shader include already exist.'),nj[t]=e},e.unRegisterInclude=function(t){delete nj[t]},e.unRegisterAllIncludes=function(){Object.keys(nj).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,a=i.shader,o=i.macros,s=i.removeVersion,u=e.genMacroString(r,o),h=e.genShaderVersion(r),l=e.parseIncludes(a),c=e.isVersion300(l);return(l=e.removeWebGLVersion(l),2!==r||c||(l=e.convertTo300(l,n===t.ShaderType.fragment)),s)?u+l:h+u+l},e.convertTo300=function(t,i){if(t=(t=(t=t.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(t=(t=(t=t.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!e.has300Output(t)){if(/\bgl_FragData\[.+?\]/g.test(t)){var r=(t=t.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(t=e.replaceMRTShader(t,r))}else t=(t=t.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}}else t=t.replace(/\battribute\b/g,"in");return t},e.parseIncludes=function(t,e){for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var i,r=i[1],n=nj[r];if(void 0===n)throw Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},e.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return(r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach(function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)}),r.length)?r.join("\n")+"\n":""},e.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},e.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},e.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},e.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},e.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[1])}return i.forEach(function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"}),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},e}(),nH=function(e){function i(i,r){var n,a=(n=e.call(this,i,r)||this).renderer.engine,o=nx.create(a,{mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=no.create(a,{shader:{vertex:nD,fragment:nG,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=nR.create(a,{geometry:o,material:s,priority:0}),n.priority=5e3,n}ib(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var i,r,n,a=null!=(n=null==(r=e.renderingData.currentFrame.globalVolume)?void 0:null==(i=r.bloom)?void 0:i.threshold)?n:1;this.screenMesh.material.setFloat("_Threshold",a),e.renderMeshes([this.screenMesh])},i}(nO),nW=function(e){function i(i,r,n){(a=e.call(this,i,n)||this).type=r;var a,o=a.renderer.engine,s="PostProcess",u=nx.create(o,{name:s,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),h={vertex:nD,fragment:"H"===r?nz:nU,glslVersion:t.GLSLVersion.GLSL1},l=no.create(o,{name:s,shader:h});return l.blending=!1,l.depthTest=!1,l.culling=!1,a.screenMesh=nR.create(o,{name:s,geometry:u,material:l,priority:0}),a.priority=5e3,a}ib(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",nJ(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(nO),nY=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",a=r.renderer.engine,o=nx.create(a,{name:n,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=no.create(a,{name:n,shader:{vertex:nD,fragment:nB}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=nR.create(a,{name:n,geometry:o,material:s,priority:0}),r.priority=5e3,r}ib(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",nJ(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(nO),nZ=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,a="PostProcess",o=n.renderer.engine;n.sceneTextureHandle=r||new nI(o);var s=nx.create(o,{name:a,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=no.create(o,{name:a,shader:{vertex:nD,fragment:nk,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=nR.create(o,{name:a,geometry:s,material:u,priority:0}),n.priority=5e3,n}ib(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var i=e.renderingData.currentFrame.globalVolume,r=iB({threshold:0,intensity:0,active:!1},null==i?void 0:i.bloom),n=iB({intensity:0,smoothness:0,roundness:0,active:!1},null==i?void 0:i.vignette),a=iB({brightness:0,saturation:0,contrast:0,active:!1},null==i?void 0:i.colorAdjustments),o=iB({active:!1},null==i?void 0:i.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,a.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*a.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*a.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),n.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",n.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",n.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",n.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new iq(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new iK(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(o.active)),e.renderMeshes([this.screenMesh])},i}(nO),nq="_effects_default_",nK=1,nQ=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i,r,n=e.camera,a=e.keepColorBuffer,o=e.renderer,s=e.editorTransform,u=e.globalVolume,h=e.postProcessingEnabled,l=void 0!==h&&h,c=e.clearAction,f=void 0===c?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:c,d=o.engine;u&&(this.globalVolume=u),this.globalUniforms=new n0;var p=[],m={};if(this.renderer=o,l){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw Error("Half float texture is not supported.");var v=rw.HALF_FLOAT;p=[{texture:{format:rw.RGBA,type:v,magFilter:rw.LINEAR,minFilter:rw.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}this.drawObjectPass=new nO(o,{name:nq,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),l){var g=new nI(d),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=Array(7),T=rw.HALF_FLOAT,E=new nH(o,{name:"BloomThresholdPass",attachments:[{texture:{format:rw.RGBA,type:T,minFilter:rw.LINEAR,magFilter:rw.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new nI(d);var C=new nW(o,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:rw.RGBA,type:T,minFilter:rw.LINEAR,magFilter:rw.LINEAR}}]}),S=new nW(o,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:rw.RGBA,type:T,minFilter:rw.LINEAR,magFilter:rw.LINEAR}}]});S.gaussianResult=b[_],this.addRenderPass(C),this.addRenderPass(S),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var w=new nY(o,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:rw.RGBA,type:T,minFilter:rw.LINEAR,magFilter:rw.LINEAR}}]});w.gaussianDownSampleResult=b[5-A],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new nZ(o,g);this.addRenderPass(R)}this.semantics=new ny(e.semantics),this.clearAction=f,this.name="RenderFrame"+nK++;var I=y[0];this.emptyTexture=r8(d),this.transparentTexture=r9(d),this.camera=n,this.keepColorBuffer=a,this.renderPassInfoMap.set(I,{listStart:0,listEnd:0,renderPass:I,intermedia:!1}),this.editorTransform=rb.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new nv(d);var M=d.gpuCapability,O=M.detail,P=nd(M.level,O.readableDepthStencilTextures&&O.writableFragDepth);null==(i=this.renderer.getShaderLibrary())||i.addShader(P)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},i.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},i.dispose=function(e){(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var i,r,n=(null==e?void 0:e.passes)?e.passes:void 0;n!==t.DestroyOptions.keep&&this._renderPasses.forEach(function(t){t.dispose(n)}),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(i=r.texture)||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},i.resetRenderPassDefaultAttachment=function(t,e){for(var i=this.resource,r=i.color_a,n=i.color_b,a=e;a<t.length;a++){var o,s,u,h=t[a],l=null==(s=h.attachments[0])?void 0:s.texture;if(l&&o===l){var c=l===r?n:r;h.resetColorAttachments([c])}(l=null==(u=h.attachments[0])?void 0:u.texture)&&(o=l)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(nq)&&i.meshes.includes(t))||(e=r,!1)}),e},i.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;i&&(0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e))},i.getRPAttachments=function(t,e){if((null==t?void 0:t.length)===1){var i,r=t[0],n=r.texture,a=r.persistent,o=n.format,s=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(o===rw.RGBA&&!a){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[0].texture===u?this.resource.color_b:u}]}}return t},i.resetClearActions=function(){var e=this.renderPasses.length>1?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;this.clearAction.stencilAction=e,this.clearAction.depthAction=e,this.clearAction.colorAction=e,this.keepColorBuffer&&(this.clearAction.colorAction=t.TextureLoadAction.whatever)},i.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach(function(t){return t.initialize(e.renderer)}),this._renderPasses=t.slice()},i.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},i.createResource=function(){var e=this.renderer.engine;if(!this.resource){var i,r=e.gpuCapability,n=r.detail,a=r.level,o=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===a?rw.LINEAR:rw.NEAREST,h=r4.create(e,{sourceType:t.TextureSourceType.framebuffer,format:rw.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=r4.create(e,{sourceType:t.TextureSourceType.framebuffer,format:rw.RGBA,data:{width:o,height:s},minFilter:u,magFilter:u,name:"frame_b"}),c=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new nO(this.renderer,{depthStencilAttachment:{storageType:c},attachments:[{texture:h}]}).initialize(this.renderer),d=new n$(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,colorAction:t.TextureLoadAction.clear},meshOrder:t.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(i=f.getDepthAttachment())?void 0:i.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:l,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=nx.create(i,{name:nh,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=nd(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var a=no.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:nh,shader:n});return a.blending=!1,a.depthTest=!1,a.culling=!1,(null==t?void 0:t.blend)&&(a.blending=!0,a.blendFunction=[rw.SRC_ALPHA,rw.ONE_MINUS_SRC_ALPHA,rw.SRC_ALPHA,rw.ONE_MINUS_SRC_ALPHA]),nR.create(i,{name:nh,geometry:r,material:a,priority:0})},i.removeRenderPass=function(t){ek(this._renderPasses,t)},rv(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function nJ(t){return t?new iq(t.getWidth(),t.getHeight()):new iq}var n$=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",nJ(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(nO),n0=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},n1=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return rv(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),n2="function"==typeof WebGL2RenderingContext,n3=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=n2&&a(t,WebGL2RenderingContext)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),s=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),r&&!s&&(s=n4(t,t.HALF_FLOAT)),r&&!u&&(u=n4(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=r||t.getExtension("OES_texture_float")?t.FLOAT:0,l=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,c={floatTexture:h,halfFloatTexture:l,maxSample:r?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0,halfFloatLinear:s,floatLinear:u,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!o,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=c,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw Error("Draw multiple color buffers not available.");var o=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];o?t.framebufferTexture2D(e,o,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1===this.level&&!i){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function n4(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}t.COMPRESSED_TEXTURE=void 0,(tv=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[tv.NONE=0]="NONE",tv[tv.PVRTC=1]="PVRTC",tv[tv.ASTC=2]="ASTC",t.FilterMode=void 0,(ty=t.FilterMode||(t.FilterMode={}))[ty.Nearest=0]="Nearest",ty[ty.Linear=1]="Linear",t.RenderTextureFormat=void 0,(tg=t.RenderTextureFormat||(t.RenderTextureFormat={}))[tg.RGBA32=0]="RGBA32",tg[tg.RGBAHalf=1]="RGBAHalf";var n5=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},rv(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),n6=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i){},e.getTemporaryRT=function(t,e,i,r,n,a){return null},e.dispose=function(t){},t}(),n8=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=n9(this.arc,this.arcMode,t)*iG,i=new iK(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*iG),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(io(0,1)),direction:n.normalize()}},t}();function n9(t,e,i){if(e===t$.RANDOM)t=io(0,t);else if(e===t$.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===t$.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===t$.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var n7=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=n9(this.arc,this.arcMode,t)*iG,i=new iK(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),at=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=io(-this._d,this._d),i=io(-this._h,this._h);return{direction:new iK(0,0,1),position:new iK(e,i,0)}},t}(),ae=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=n9(this.arc,this.arcMode,t)*iG,i=new iK(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new iK;return e<a?s.set(r,r*o,0):e>=a&&e<Math.PI-a?s.set(n/o,n,0):e<Math.PI+a?s.set(-r,-r*o,0):e<2*Math.PI-a?s.set(-n/o,-n,0):s.set(r,r*o,0),{direction:i,position:s}},t}(),ai=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===t$.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):io(0,1);return{direction:new iK(0,1,0),position:new iK(this._d*(e-.5),0,0)}},t}(),ar=new r_,an=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=io(0,2*Math.PI),n=n9(this.arc,this.arcMode,t)*iG,a=ar.setFromRotationZ(n),o=new iK(Math.cos(r),Math.sin(r),0),s=new iK(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),aa=new r_,ao=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}var e=t.prototype;return e.getHorizontalAngle=function(){return io(-90,90)},e.generate=function(t){var e=n9(this.arc,this.arcMode,t)*iG,i=this.getHorizontalAngle()*iG,r=this.radius,n=new iK(Math.cos(i),0,Math.sin(i)),a=aa.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),as=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.getHorizontalAngle=function(){return io(0,90)},e}(ao),au=function(){function t(t){var e=t.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(e.anchors),this.width=t.width||1,this.height=t.height||1,this.block=e.block,this.arcMode=t.arcMode,this.random=iW(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(n9(e.length/2-1,this.arcMode,t)),r=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new iK(r,n,0);return{position:new iK(r*this.width,n*this.height,0),direction:a.normalize()}},t}(),ah=function(){function t(){}return t.prototype.generate=function(){return{position:new iK,direction:new iK}},t}(),al=((ex={})[tz.NONE]=ah,ex[tz.CONE]=n8,ex[tz.SPHERE]=ao,ex[tz.HEMISPHERE]=as,ex[tz.CIRCLE]=n7,ex[tz.DONUT]=an,ex[tz.RECTANGLE]=at,ex[tz.EDGE]=ai,ex[tz.RECTANGLE_EDGE]=ae,ex[tz.TEXTURE]=au,ex);function ac(t){if(!t)return new ah;var e=iB({radius:1,arc:360,angle:0,arcMode:t$.RANDOM},t),i=t.type,r=al[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tz.NONE){var a=t.alignSpeedDirection,o=t.upDirection;n.alignSpeedDirection=a,n.upDirection=iK.fromArray(void 0===o?[0,0,1]:o).normalize()}return n}function af(t,e,i,r,n){var a,o;if(n===function(t,e,i,r){for(var n=0,a=e,o=i-r;a<i;a+=r)n+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)o=aC(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=aC(a,t[a],t[a+1],o);return o&&ag(o,o.next)&&(aS(o),o=o.next),o}function ad(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(ag(r,r.next)||0===ay(r.prev,r,r.next))){if(aS(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function ap(t,e){return t.x-e.x}function am(t,e,i,r,n){return(t=((t=((t=((t=((t=32767*(t-i)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-r)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function av(t,e,i,r,n,a,o,s){return(n-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(n-o)*(r-s)>=0}function ay(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ag(t,e){return t.x===e.x&&t.y===e.y}function ax(t,e,i,r){var n=aT(ay(t,e,i)),a=aT(ay(t,e,r)),o=aT(ay(i,r,t)),s=aT(ay(i,r,e));return!!(n!==a&&o!==s||0===n&&ab(t,i,e)||0===a&&ab(t,r,e)||0===o&&ab(i,t,r)||0===s&&ab(i,e,r))}function ab(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function aT(t){return t>0?1:t<0?-1:0}function aE(t,e){return 0>ay(t.prev,t,t.next)?ay(t,e,t.next)>=0&&ay(t,t.prev,e)>=0:0>ay(t,e,t.prev)||0>ay(t,t.next,e)}function a_(t,e){var i=new aA(t.i,t.x,t.y),r=new aA(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function aC(t,e,i,r){var n=new aA(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function aS(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 aA(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var aw=0;function aR(t,e,i,r){i=i||2,aw=r||0;var n,a,o,s,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=af(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,a,o,s,u,h=[];for(n=0,a=e.length;n<a;n++)o=e[n]*r,s=n<a-1?e[n+1]*r:t.length,(u=af(t,o,s,r,!1))===u.next&&(u.steiner=!0),h.push(function(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}(u));for(h.sort(ap),n=0;n<h.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,a=e,o=t.x,s=t.y,u=-1/0;do{if(s<=a.y&&s>=a.next.y&&a.next.y!==a.y){var h=a.x+(s-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(h<=o&&h>u){if(u=h,h===o){if(s===a.y)return a;if(s===a.next.y)return a.next}n=a.x<a.next.x?a:a.next}}a=a.next}while(a!==e);if(!n)return null;if(o===u)return n;var l,c=n,f=n.x,d=n.y,p=1/0;a=n;do o>=a.x&&a.x>=f&&o!==a.x&&av(s<d?o:u,s,f,d,s<d?u:o,s,a.x,a.y)&&(l=Math.abs(s-a.y)/(o-a.x),aE(a,t)&&(l<p||l===p&&(a.x>n.x||a.x===n.x&&(i=n,r=a,0>ay(i.prev,i,r.prev)&&0>ay(r.next,i,i.next))))&&(n=a,p=l)),a=a.next;while(a!==c);return n}(t,e)){var i=a_(e,t);ad(e,e.next),ad(i,i.next)}})(h[n],i),i=ad(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],a=s=t[1];for(var m=i;m<f;m+=i)u=t[m],h=t[m+1],u<n&&(n=u),h<a&&(a=h),u>o&&(o=u),h>s&&(s=h);l=0!==(l=Math.max(o-n,s-a))?1/l:0}return function t(e,i,r,n,a,o,s){if(e){!s&&o&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=am(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,o,s,u,h=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,r=i,s=0,e=0;e<h&&(s++,r=r.nextZ);e++);for(u=h;s>0||u>0&&r;)0!==s&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(o>1)}(n)}(e,n,a,o);for(var u,h,l=e;e.prev!==e.next;){if(u=e.prev,h=e.next,o?function(t,e,i,r){var n=t.prev,a=t.next;if(ay(n,t,a)>=0)return!1;for(var o=n.x<t.x?n.x<a.x?n.x:a.x:t.x<a.x?t.x:a.x,s=n.y<t.y?n.y<a.y?n.y:a.y:t.y<a.y?t.y:a.y,u=n.x>t.x?n.x>a.x?n.x:a.x:t.x>a.x?t.x:a.x,h=n.y>t.y?n.y>a.y?n.y:a.y:t.y>a.y?t.y:a.y,l=am(o,s,e,i,r),c=am(u,h,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=l&&d&&d.z<=c;){if(f!==t.prev&&f!==t.next&&av(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ay(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&av(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ay(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&av(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ay(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=c;){if(d!==t.prev&&d!==t.next&&av(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ay(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,a,o):function(t){var e=t.prev,i=t.next;if(ay(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(av(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&ay(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+aw),i.push(e.i/r+aw),i.push(h.i/r+aw),aS(e),e=h.next,l=h.next;continue}if((e=h)===l){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!ag(n,a)&&ax(n,r,r.next,a)&&aE(n,a)&&aE(a,n)&&(e.push(n.i/i+aw),e.push(r.i/i+aw),e.push(a.i/i+aw),aS(r),aS(r.next),r=t=a),r=r.next}while(r!==t);return ad(r)}(ad(e),i,r),i,r,n,a,o,2):2===s&&function(e,i,r,n,a,o){var s=e;do{for(var u,h,l=s.next.next;l!==s.prev;){if(s.i!==l.i&&(u=s,h=l,u.next.i!==h.i&&u.prev.i!==h.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&&ax(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,h)&&(aE(u,h)&&aE(h,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,h)&&(ay(u.prev,u,h.prev)||ay(u,h.prev,h))||ag(u,h)&&ay(u.prev,u,u.next)>0&&ay(h.prev,h,h.next)>0))){var c=a_(s,l);s=ad(s,s.next),c=ad(c,c.next),t(s,i,r,n,a,o),t(c,i,r,n,a,o);return}l=l.next}s=s.next}while(s!==e)}(e,i,r,n,a,o):t(ad(e),i,r,n,a,o,1);break}}}}(d,p,i,n,a,l),p}var aI="editor",aM={"Item duration can't be less than 0":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"};function aO(t,e){for(var i,r,n=t.s,a=t.p,o=n[1],s=a[1],u=0,h=0;h<o.length;h++)u+=o[h].length-1;var l,c=new Float32Array(6*u),f=e.indexBase,d=e.uvTransform,p=0,m=0,v=0,y=1,g=1;d&&(m=d[0],v=d[1],y=(l=d[4])?d[3]:d[2],g=l?d[2]:d[3]);for(var x=[0,0],b=0===l?0:-Math.PI/2,T=0;T<o.length;T++)for(var E=o[T],_=s[T],C=s[T+1]||s[0],S=[0,0],A=0;A<E.length-1;A++)(function(t,e,i,r,n,a,o,s){var u=1-e,h=u*u*u,l=3*e*u*u,c=3*e*e*u,f=e*e*e;t[0]=h*i[0]+l*n+c*o+f*r[0],t[1]=h*i[1]+l*a+c*s+f*r[1]})(S,E[A],_,C,_[4],_[5],C[2],C[3]),i=S[0],r=S[1],c[p++]=i/2,c[p++]=r/2,d?(x[0]=i,x[1]=r,aN(x,x,b),c[p++]=m+(x[0]+1)/2*y,c[p++]=v+(x[1]+1)/2*g):(c[p++]=(i+1)/2,c[p++]=(r+1)/2),p+=2;var w=aR(Array.from(c),null,6,void 0===f?0:f);return{aPoint:c,index:new Uint16Array(w)}}function aP(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[tq.SHAPE_POINTS,t.p],s:[tq.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[tq.SHAPE_POINTS,t.g.p],s:[tq.SHAPE_SPLITS,t.g.s]}):i.push(t),i),a=0,o=0,s=0,u=0;u<n.length;u++){var h=aO(n[u],{indexBase:a,uvTransform:e});a+=h.aPoint.length/5,r.push(h),o+=h.aPoint.length,s+=h.index.length}if(1===r.length)return r[0];for(var l=new Float32Array(o),c=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];l.set(m.aPoint,d),d+=m.aPoint.length,c.set(m.index,p),p+=m.index.length}return{aPoint:l,index:c}}function aN(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],o=e[1];return t[0]=r*a+n*o,t[1]=-n*a+r*o,t}var aF=[[0,0,1,1,0]],aL=function(e){function r(t){(i=e.call(this,t)||this).visible=!0,i.splits=aF,i.meshCollider=new oL,i._color=new rE(1,1,1,1),i.getHitTestParams=function(t){var e=r_.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.meshCollider.setGeometry(i.geometry,e);var n,a=i.meshCollider.getBoundingBoxData();if(a)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===tD.FRONT}}},i.renderer={renderMode:tX.MESH,blending:tV.ALPHA,texture:i.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:tD.DOUBLE,mask:0},i.defaultGeometry=nx.create(i.engine,{attributes:{aPos:{type:rw.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:rw.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:rw.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var i,r=no.create(i.engine,{shader:{fragment:nN,vertex:nP,shared:!0}});return i.material=r,i.material.setColor("_Color",new rE(1,1,1,1)),i.maskManager=new ns(t),i}ib(r,e);var o=r.prototype;return o.setVisible=function(t){this.visible=t},o.getVisible=function(){return this.visible},o.setColor=function(t){a(t,rE)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},o.setTexture=function(t){var e=this;return i(function(){var i;return u(this,function(r){switch(r.label){case 0:if("string"!=typeof t)return[3,2];return[4,r4.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}})})()},o.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},o.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},o.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},o.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},o.getItemGeometryData=function(t){var e=this.splits,i=this.textureSheetAnimation,r=this.defaultGeometry;if(t.shape){for(var n=t.shape,a=n.index,o=n.aPoint,s=void 0===o?[]:o,u=new Float32Array(s),h=[],l=[],c=0;c<u.length;c+=6)u[c]*=1,u[c+1]*=1,l.push(s[c+2],s[c+3]),h.push(u[c],u[c+1],0);return r.setAttributeData("aPos",new Float32Array(h)),{index:void 0===a?[]:a,aUV:l}}var f=[],d=[],p=[];if(1===e.length){var m=i?[0,0,1,1,e[0][4]]:e[0],v=m[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],y=m[0],g=m[1],x=m[4]?m[3]:m[2],b=m[4]?m[2]:m[3];f.push(v[0]*x+y,v[1]*b+g,v[2]*x+y,v[3]*b+g,v[4]*x+y,v[5]*b+g,v[6]*x+y,v[7]*b+g),p.push(-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0),d.push(0,1,2,2,1,3)}else for(var T=0;T<2;T++)for(var E=0;E<2;E++){var _=(2*E+T)*4,C=i?[0,0,1,1,e[0][4]]:e[2*E+T],S=C[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],A=((T+T+1)/2-1)/2,w=((E+E+1)/2-1)/2,R=C[0],I=C[1],M=C[4]?C[3]:C[2],O=C[4]?C[2]:C[3],P=[-.25+A,.25+w,-.25+A,-.25+w,.25+A,.25+w,.25+A,-.25+w];f.push(S[0]*M+R,S[1]*O+I,S[2]*M+R,S[3]*O+I,S[4]*M+R,S[5]*O+I,S[6]*M+R,S[7]*O+I),p.push(1*P[0],1*P[1],0,1*P[2],1*P[3],0,1*P[4],1*P[5],0,1*P[6],1*P[7],0),d.push(_,1+_,2+_,2+_,1+_,3+_)}return r.setAttributeData("aPos",new Float32Array(p)),{index:d,aUV:f}},o.configureDefaultGeometry=function(t){var e=this.getItemGeometryData(t),i=e.index,r=e.aUV,n=this.defaultGeometry;return n.setIndexData(new Uint16Array(i)),n.setAttributeData("aUV",new Float32Array(r)),n.setDrawCount(i.length),n},o.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.mask,a=t.texture,o=this.maskManager.maskMode,s=this.material;s.blending=!0,s.depthTest=!0,s.depthMask=i,s.stencilRef=void 0!==n?[n,n]:void 0,rF(s,r),rV(s,o),rL(s,e),s.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',s.setVector4("_TexOffset",new rb(0,0,1,1)),s.setTexture("_MainTex",a);var u=rN(r),h=new rb;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=u,h.z=t.renderMode,h.w=o,s.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?s.enableMacro("ALPHA_CLIP"):s.disableMacro("ALPHA_CLIP"),s},o.draw=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++){var i=this.materials[e];i.setVector2("_Size",this.transform.size),(this.renderer.renderMode===tX.BILLBOARD||this.renderer.renderMode===tX.VERTICAL_BILLBOARD||this.renderer.renderMode===tX.HORIZONTAL_BILLBOARD)&&i.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,i,e)}},o.fromData=function(i){e.prototype.fromData.call(this,i);var r=null!=(I=i.renderer)?I:{},a=i.splits,o=i.textureSheetAnimation,s=i.mask;s&&this.maskManager.setMaskOptions(s);var u=r.shape,h=a&&!o?a[0]:void 0,l=void 0;if(null==u||"aPoint"in u&&"index"in u||(l=aP(u,h)),this.splits=a||aF,this.textureSheetAnimation=o,this.renderer={renderMode:null!=(M=r.renderMode)?M:tX.MESH,blending:null!=(O=r.blending)?O:tV.ALPHA,texture:r.texture?this.engine.findObject(r.texture):this.engine.emptyTexture,occlusion:!!r.occlusion,transparentOcclusion:!!r.transparentOcclusion||this.maskManager.maskMode===t.MaskMode.MASK,side:null!=(P=r.side)?P:tD.DOUBLE,mask:this.maskManager.getRefValue(),shape:l},this.configureMaterial(this.renderer),i.geometry){var c=this.engine.findObject(i.geometry),f=i.splits&&!i.textureSheetAnimation?i.splits[0]:aF[0],d=f[0],p=f[1],m=!!f[4],v=m?f[3]:f[2],y=m?f[2]:f[3],g=m?-Math.PI/2:0,x=c.getAttributeData("aUV"),b=c.getAttributeData("aPos"),T=c.getIndexData(),E=[0,0];if(x&&b&&T){for(var _=x.length/2,C=0;C<_;C++){var S=3*C,A=2*C,w=b[S],R=b[S+1];E[0]=w,E[1]=R,aN(E,E,g),x[A]=(E[0]+.5)*v+d,x[A+1]=(E[1]+.5)*y+p}this.geometry.setAttributeData("aPos",b.slice()),this.geometry.setAttributeData("aUV",x.slice()),this.geometry.setIndexData(T.slice()),this.geometry.setDrawCount(T.length)}this.geometry.subMeshes.length=0;for(var I,M,O,P,N,F=n(c.subMeshes);!(N=F()).done;){var L=N.value;this.geometry.subMeshes.push({offset:L.offset,indexCount:L.indexCount,vertexCount:L.vertexCount})}}else this.geometry=this.defaultGeometry,this.configureDefaultGeometry(this.renderer)},rv(r,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),r}(rx);t.ShapeComponent=function(e){function i(i){(r=e.call(this,i)||this).hasStroke=!1,r.hasFill=!1,r.shapeDirty=!0,r.graphicsPath=new us,r.vert="\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n",r.frag="\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n",r.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0});var r,n={shader:{vertex:r.vert,fragment:r.frag,glslVersion:t.GLSLVersion.GLSL1}},a=no.create(i,n),o=no.create(i,n);return a.color=new rE(1,1,1,1),a.depthMask=!1,a.depthTest=!0,a.blending=!0,r.material=a,o.color=new rE(.25,.25,.25,1),o.depthMask=!1,o.depthTest=!0,o.blending=!0,r.materials[1]=o,r.strokeAttributes={width:1,alignment:.5,cap:ei.Butt,join:er.Miter,miterLimit:10,color:new rE(1,1,1,1)},r.fillAttribute={color:new rE(1,1,1,1)},r.shapeAttribute={type:ee.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},r}ib(i,e);var r=i.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){this.material.color=this.fillAttribute.color,this.materials[1].color=this.strokeAttributes.color,this.shapeDirty&&(this.buildPath(this.shapeAttribute),this.buildGeometryFromPath(this.graphicsPath.shapePath),this.shapeDirty=!1)},r.buildGeometryFromPath=function(t){var e=t.shapePrimitives,i=[],r=[];if(this.hasFill)for(var a,o=n(e);!(a=o()).done;){var s=a.value.shape,u=[],h=r.length,l=i.length/2;s.build(u),s.triangulate(u,i,l,r,h)}var c=r.length;if(this.hasStroke)for(var f,d=n(e);!(f=d()).done;){var p=f.value.shape,m=[];r.length;var v=i.length/2,y=this.strokeAttributes,g=!0;this.shapeAttribute.type===ee.Custom&&(g=p.closePath),p.build(m),s5(m,y,!1,g,i,2,v,r)}var x=r.length-c,b=i.length/2,T=this.geometry.getAttributeData("aPos"),E=this.geometry.getAttributeData("aUV"),_=this.geometry.getIndexData();(!T||T.length<3*b)&&(T=new Float32Array(3*b)),(!E||E.length<2*b)&&(E=new Float32Array(2*b)),(!_||_.length<r.length)&&(_=new Uint16Array(r.length));for(var C=0;C<b;C++){var S=3*C,A=2*C,w=2*C;T[S]=i[A],T[S+1]=i[A+1],T[S+2]=0,E[w]=T[S],E[w+1]=T[S+1]}_.set(r),this.geometry.setAttributeData("aPos",T),this.geometry.setAttributeData("aUV",E),this.geometry.setIndexData(_),this.geometry.setDrawCount(r.length);var R=this.geometry.subMeshes[0],I=this.geometry.subMeshes[1];R.indexCount=c,I.offset=2*c,I.indexCount=x},r.buildPath=function(e){switch(this.graphicsPath.clear(),e.type){case ee.Custom:for(var i,r=this.shapeAttribute,a=r.points,o=r.easingIns,s=r.easingOuts,u=n(r.shapes);!(i=u()).done;){var h=i.value,l=h.indexes,c=a[l[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var f=1;f<l.length;f++){var d=l[f],p=l[f-1],m=a[d.point],v=a[p.point],y=s[p.easingOut],g=o[d.easingIn];this.graphicsPath.bezierCurveTo(y.x+v.x,y.y+v.y,g.x+m.x,g.y+m.y,m.x,m.y,1)}if(h.close){var x=l[0],b=l[l.length-1],T=a[x.point],E=a[b.point],_=s[b.easingOut],C=o[x.easingIn];this.graphicsPath.bezierCurveTo(_.x+E.x,_.y+E.y,C.x+T.x,C.y+T.y,T.x,T.y,1),this.graphicsPath.closePath()}}break;case ee.Ellipse:this.graphicsPath.ellipse(0,0,e.xRadius,e.yRadius);break;case ee.Rectangle:this.graphicsPath.rect(-e.width/2,-e.height/2,e.width,e.height,e.roundness);break;case ee.Star:this.graphicsPath.polyStar(e.pointCount,e.outerRadius,e.innerRadius,e.outerRoundness,e.innerRoundness,t.StarType.Star);break;case ee.Polygon:this.graphicsPath.polyStar(e.pointCount,e.radius,e.radius,e.roundness,e.roundness,t.StarType.Polygon)}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.shapeDirty=!0;var i=t.stroke;i&&(this.hasStroke=!0,this.strokeAttributes.width=i.width,this.strokeAttributes.color.copyFrom(i.color),this.strokeAttributes.cap=i.cap,this.strokeAttributes.join=i.join);var r=t.fill;switch(r&&(this.hasFill=!0,this.fillAttribute.color.copyFrom(r.color)),t.type){case ee.Custom:for(var a,o={type:ee.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:t.fill},s=n(t.points);!(a=s()).done;){var u=a.value;o.points.push(new iq(u.x,u.y))}for(var h,l=n(t.easingIns);!(h=l()).done;){var c=h.value;o.easingIns.push(new iq(c.x,c.y))}for(var f,d=n(t.easingOuts);!(f=d()).done;){var p=f.value;o.easingOuts.push(new iq(p.x,p.y))}o.shapes=t.shapes,this.shapeAttribute=o;break;case ee.Ellipse:var m={type:ee.Ellipse,xRadius:t.xRadius,yRadius:t.yRadius,fill:t.fill};this.shapeAttribute=m;break;case ee.Rectangle:var v={type:ee.Rectangle,width:t.width,height:t.height,roundness:t.roundness,fill:t.fill};this.shapeAttribute=v;break;case ee.Star:var y={type:ee.Star,pointCount:t.pointCount,innerRadius:t.innerRadius,outerRadius:t.outerRadius,innerRoundness:t.innerRoundness,outerRoundness:t.outerRoundness,fill:t.fill};this.shapeAttribute=y;break;case ee.Polygon:var g={type:ee.Polygon,pointCount:t.pointCount,radius:t.radius,roundness:t.roundness,fill:t.fill};this.shapeAttribute=g}t.mask&&this.maskManager.setMaskOptions(t.mask);var x=this.maskManager.getRefValue();this.material.stencilRef=void 0!==x?[x,x]:void 0,rV(this.material,this.maskManager.maskMode)},rv(i,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),i}(aL),t.ShapeComponent=s([iA("ShapeComponent")],t.ShapeComponent),t.Fake3DComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.loop=!1,t.amountOfMotion=1,t.animationLength=2,t.mode=1,t.startPositionX=0,t.startPositionY=0,t.startPositionZ=0,t.endPositionX=0,t.endPositionY=0,t.endPositionZ=0,t.amplitudeX=0,t.amplitudeY=0,t.amplitudeZ=0,t.phaseX=0,t.phaseY=0,t.phaseZ=0,t}ib(i,e);var r=i.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(t.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var a=t;this.loop&&(a>.5&&(a=1-a),a*=2),e=this.startPositionX*(1-a)+a*this.endPositionX,i=this.startPositionY*(1-a)+a*this.endPositionY,r=this.startPositionZ*(1-a)+a*this.endPositionZ}var o=this.effectComponent.material;o.setFloat("_PosX",e*this.amountOfMotion),o.setFloat("_PosY",i*this.amountOfMotion),o.setFloat("_PosZ",r*this.amountOfMotion)}},i}(ry),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"loop",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"amountOfMotion",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"animationLength",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"mode",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionX",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionY",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionZ",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionX",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionY",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionZ",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeX",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeY",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeZ",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"phaseX",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"phaseY",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"phaseZ",void 0),t.Fake3DComponent=s([iA("Fake3DComponent")],t.Fake3DComponent),t.Fake3DAnimationMode=void 0,(tx=t.Fake3DAnimationMode||(t.Fake3DAnimationMode={}))[tx.Circular=0]="Circular",tx[tx.Linear=1]="Linear",t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}ib(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(ry),t.CameraController=s([iA(es.CameraController)],t.CameraController);var aV=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig);t.HitTestType=void 0,(tb=t.HitTestType||(t.HitTestType={}))[tb.triangle=1]="triangle",tb[tb.box=2]="box",tb[tb.sphere=3]="sphere",tb[tb.custom=4]="custom";var aD="click",ak="touchstart",az="touchmove",aU="touchend",aB=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var e=t.prototype;return e.bindListeners=function(){var t,e,i,r,n,a,o=this;n=function(t){return t};var s="mousedown",u="mousemove",h="mouseup",l="mouseleave",c=function(t,e,i,n,a){void 0===n&&(n=0),void 0===a&&(a=0);var s=0,u=0,h=performance.now();if(!o.target)return e8.warn("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:a,ts:h,width:0,height:0,origin:t};var l=o.target,c=l.width,f=l.height;if(r){var d=h-r.ts;s=(n-r.dx)/d||0,u=(a-r.dy)/d||0,r={dx:n,dy:a,ts:h}}return{x:e,y:i,vx:s,vy:u,dx:n,dy:a,ts:h,width:c,height:f,origin:t}};eK()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",h="touchend",l="touchcancel"),this.nativeHandlers=((a={})[s]=function(a){if(o.enabled){var s=n(a),u=aG(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},o.dispatchEvent(ak,c(a,t,e))}},a[u]=function(r){if(i&&o.enabled){var a=aG(n(r));t=a.x,e=a.y,o.dispatchEvent(az,c(r,t,e,t-i.x,e-i.y))}},a[h]=function(r){if(i&&o.enabled){!o.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var a=n(r),s=aG(a),u=Math.abs(i.clientX-a.clientX)+Math.abs(i.clientY-a.clientY);t=s.x,e=s.y,u<4&&o.dispatchEvent(aD,c(r,t,e)),o.dispatchEvent(aU,c(r,t,e,t-i.x,e-i.y))}i=0},a),this.nativeHandlers[l]=this.nativeHandlers[h],Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=o.target)||e.addEventListener(String(t),o.nativeHandlers[t])})},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),eD(i,e),function(){ek(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&ek(i,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={},this.target=null)},t}();function aG(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,o=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-o)/n.height*2}}var aj=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig),aX=(tE=new Int32Array((tT=new Float32Array(1)).buffer),function(t){tT[0]=t;var e=tE[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?(r|=2048,i|=(r>>114-n)+(r>>113-n&1)):(i|=n-112<<10|r>>1,i+=1&r)}),aH=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=aX(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=aX(t[i])},t}(),aW=new nT,aY=new r_;function aZ(t,e,i,r,n,a,o){var s=r/n,u=r,h=e.speedOverLifetime;h&&(u=h.getIntegrateValue(0,r,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(a),t.addScaledVector(o,u),t.addScaledVector(i,l);var c=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new iK;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),m=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?m?e.getValue(s):e.getIntegrateValue(0,r,n):0});aW.setFromArray(v).negate(),aY.setFromEuler(aW);var y=aY.transformPoint(p);t.addVectors(d,y)}if(c.enabled){var g=c.asMovement,x=c.x,b=c.y,T=c.z;if(x){var E=g?x.getValue(s):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(b){var _=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.y=t.y+_}if(T){var C=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.z=t.z+C}}return t}function aq(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function aK(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function aQ(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var o=0;o<i.length;o++)t[o]=i[o];return t}var aJ=((eb={})[tH.PARTICLE_ORIGIN_CENTER]=[0,0],eb[tH.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eb[tH.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eb[tH.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eb[tH.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eb[tH.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eb[tH.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eb[tH.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eb[tH.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eb);function a$(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function a0(t,e,i){var r=i.position,n=new iK(t,e,0),a=new iK;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new n_(r,a)}function a1(t,e,i){var r=t.x,n=t.y,a=t.z,o=new iK(r-e,n+i,a),s=new iK(r-e,n-i,a),u=new iK(r+e,n-i,a),h=new iK(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function a2(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function a3(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var a4={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex;return new iq(e[r],e[n])},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===tK.LINE?0:i===tK.EASE_OUT?0:i===tK.EASE_IN?2:i===tK.EASE?2:i===tK.HOLD&&r===tK.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tK.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tK.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tK.EASE,tK.EASE_IN,tK.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tK.EASE,tK.EASE_OUT,tK.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tK.HOLD&&[tK.HOLD,tK.LINE_OUT,tK.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tK.HOLD&&[tK.HOLD,tK.LINE,tK.EASE_IN].includes(i)}},a5=function(t,e){this.points=t,this.totalLength=e},a6={},a8={};function a9(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function a7(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var ot=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,i,r){var n=a3(e.x-t.x,3)+"_"+a3(e.y-t.y,3)+"_"+a3(e.z-t.z,3)+"&"+(a3(i.x-t.x,3)+"_"+a3(i.y-t.y,3))+"_"+a3(i.z-t.z,3)+"&"+(a3(r.x-t.x,3)+"_"+a3(r.y-t.y,3))+"_"+a3(r.z-t.z,3);if(a8[n])return{data:a8[n],interval:t};for(var a=[],o=null,s=0,u=0,h=0;h<300;h+=1){var l=new iK,c=h/299;u=0,l.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),l.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),l.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==o&&(u+=Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2)+Math.pow(l.z-o.z,2)),o=l,s+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new a5(a,s);return a8[n]=f,{data:f,interval:new iK(t.x,t.y,t.z)}}(t,e,i,r),a=n.data,o=n.interval;this.lengthData=a,this.interval=o,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(a2(1-t,0))return e.points[299].point.clone().add(this.interval);if(a2(e.totalLength,0))return this.p1.clone();var i=new iK,r=a3(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(a2(n,r))return e.points[a].point.clone().add(this.interval);var o=!0,s=1;for(r<n&&(s=-1);o;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}s>0&&a<299?(a+=s,n+=a3(e.points[a].partialLength,5)):s<0&&a>0?(n-=a3(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),oe=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new iQ,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):a2(1-t,0)?this.temp.copyFrom(this.p2):(oa.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),oi=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new iq,this.control2=new iq,this.weighted=!1,this.isConstant=!1,this.mSampleValues=Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),a9(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var a=1-n,o=a*a,s=n*n;return o*a*t+e*o*n*3+i*a*s*3+s*n*r},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=a9(.1*t,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=.1;var n=i+(t-e[--r])/(e[r+1]-e[r])*.1,a=a7(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=a7(e,i,r);if(0===a)break;var o=a9(e,i,r)-t;e-=o/a}return e}(t,n,this.control1.x,this.control2.x):0===a?n:function(t,e,i,r,n){var a,o,s=0;do(a=a9(o=e+(i-e)/2,r,n)-t)>0?i=o:e=o;while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+.1,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,(this.control1.x!==this.control1.y||this.control2.x!==this.control2.y)&&this.calcSampleValues()},t}();function or(t,e){var i,r,n,a=on(t,e,!0),o=a.p0,s=a.p1,u=a.p2,h=a.p3;e4(u),e4(h);var l=h.x-o.x,c=h.y-o.y,f=a3((s.x-o.x)/l,5),d=a3((u.x-o.x)/l,5);a2(c,0)?i=r=NaN:(i=a3((s.y-o.y)/c,5),r=a3((u.y-o.y)/c,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",o,s,u,h),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",o,s,u,h),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",o,s,u,h),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",o,s,u,h),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return a6[p]?n=a6[p]:(n=a2(c,0)?new oi:new oi(f,i,d,r),a6[p]=n),{points:[o,s,u,h],timeInterval:l,valueInterval:c,curve:n}}function on(t,e,i){var r=t[1],n=a4.isHoldOutKeyframe(t),a=a4.isHoldInKeyframe(e),o=!a&&a4.isRightSideEase(t),s=!n&&a4.isLeftSideEase(e);if(o&&!s&&!a){var u=new iq(r[r.length-4],r[r.length-3]),h=new iq(r[r.length-2],r[r.length-1]),l=a4.getPointInCurve(e),c=new iq(l.x,l.y),f=new iq(c.x-(c.x-u.x)/10,c.y);return{type:"ease",p0:u,p1:h,p2:f,p3:c}}if(!o&&s&&!n){var d=e[1],p=a4.getPointInCurve(t),m=new iq(p.x,p.y),v=new iq(d[0],d[1]),y=new iq(d[2],d[3]),g=new iq(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(o&&s){var x=e[1];return{type:"ease",p0:new iq(r[r.length-4],r[r.length-3]),p1:new iq(r[r.length-2],r[r.length-1]),p2:new iq(x[0],x[1]),p3:new iq(x[2],x[3])}}var b=a4.getPointInCurve(t),T=a4.getPointInCurve(e);if(n?T.y=b.y:a&&(b.y=T.y),!i)return{type:"line",p0:b,p1:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a};var E=new iq((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),_=new iq((T.x-b.x)/3*2+b.x,(T.y-b.y)/3*2+b.y);return{type:"ease",p0:b,p1:E,p2:_,p3:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var oa=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,o=e.z,s=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r){t.x=n,t.y=a,t.z=o,t.w=s;return}if(1===r){t.x=u,t.y=h,t.z=l,t.w=c;return}if(s!==c||n!==u||a!==h||o!==l){var f=1-r,d=n*u+a*h+o*l+s*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,a=a*f+h*g,o=o*f+l*g,s=s*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+o*o+s*s);n*=x,a*=x,o*=x,s*=x}}t.x=n,t.y=a,t.z=o,t.w=s},t}(),oo="not_implement",os=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(oo)},e.getIntegrateValue=function(t,e,i){throw Error(oo)},e.getIntegrateByTime=function(t,e){throw Error(oo)},e.getValue=function(t){throw Error(oo)},e.getMaxTime=function(){throw Error(oo)},e.toUniform=function(t){throw Error(oo)},e.map=function(t){throw Error(oo)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(oo)},t.getAllData=function(t,e){for(var i=new(e?aH:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var o=a[r].toData();i.set(o,n),n+=o.length}return e?i.data:i},t}(),ou=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(os),oh=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(os),ol=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){return this.min+(null!=e?e:Math.random())*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){return(this.min+(null!=i?i:1)*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(os),oc=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(os),of=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return ox(e,0,this.xCoord,this.min,this.max)-ox(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(os),od=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=eG(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1];if(n.stop<=t&&a.stop>t){var o=(t-n.stop)/(a.stop-n.stop);return ej(n.color,a.color,o,!0)}}return e[i].color.slice()},e}(os),op=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map(function(t){return t.slice?t.slice(0,2):[t.time,t.value]}).sort(function(t,e){return t[0]-e[0]});var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1],o=n[0],s=a[0];if(t>=o&&t<=s){var u=(t-o)/(s-o),h=n[1];return h+u*(a[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,a=e?ox:og,o=0;o<n;o++){var s=i[o],u=i[o+1],h=s[0],l=u[0];if(t>h&&t<=l)return r+a(t,h,l,s[1],u[1]);r+=a(l,h,l,s[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=Math.ceil(this.keys.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},i.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},i.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(os),om=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],a=e[r+1];if(n[0]<=t&&a[0]>=t){var o=a[1]-n[1],s=void 0;return s=0===o?(t-n[0])/(a[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,o=(t-e[0])/r,s=o*o,u=s*o;return(2*u-3*s+1)*e[1]+(u-2*s+o)*n+(u-s)*a+(-2*u+3*s)*i[1]}(t,n,a)-n[1])/o,this.calculateVec(r,s)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(os),ov=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=new iK(i[n][0],i[n][1],i[n][2]),u=new iK(i[n+1][0],i[n+1][1],i[n+1][2]),h=new iK(r[2*n][0],r[2*n][1],r[2*n][2]),l=new iK(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=or(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new ot(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=a3(t,5),i=0,r=new iK,n=this.keyTimeData;if(!n.length)return r;var a=this.curveSegments[n[0]].timeStart,o=this.curveSegments[n[n.length-1]].timeEnd;if(e<=a)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=this.curveSegments[n[s]].timeStart,h=this.curveSegments[n[s]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=a3((e-r.x)/n,4);return iW(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(os),oy=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=iQ.fromArray(i[n]),u=iQ.fromArray(i[n+1]),h=iQ.fromArray(r[2*n]),l=iQ.fromArray(r[2*n+1]),c=or(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new oe(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=a3(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<r.length;o++){var s=r[o].split("&"),u=s[0],h=s[1];if(i>=Number(u)&&i<Number(h)){var l=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),l.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=a3((e-r.x)/n,4);return iW(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(os);function og(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function ox(t,e,i,r,n){var a=t*t,o=e*e;return(a*t*2*(r-n)+3*a*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function ob(t,e){if(e){var i=e[0],r=e[1];if(i===tq.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===tq.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var o=Math.ceil(a/2);t.lineSegCount+=o,t.curves.push(r),t.index+=o,t.max=Math.max(t.max,o)}else if(i===tq.BEZIER_CURVE){var s=r.length-1;t.index+=2*s,t.curves.push(r),t.max=Math.max(t.max,2*s),t.curveCount+=2*s}}}function oT(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function oE(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(oE=function(){return!!t})()}function o_(t,e,i){return(o_=oE()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&ix(n,i.prototype),n}).apply(null,arguments)}var oC=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new rb,e}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=oM(t[0]),this.yCurve=oM(t[1]),this.zCurve=oM(t[2]),this.wCurve=oM(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(os),oS=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iK,e}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=oM(t[0]),this.yCurve=oM(t[1]),this.zCurve=oM(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(os),oA=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iq,e}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=oM(t[0]),this.yCurve=oM(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(os);t.TangentMode=void 0,(t_=t.TangentMode||(t.TangentMode={}))[t_.Cubic=0]="Cubic",t_[t_.Linear=1]="Linear",t_[t_.Constant=2]="Constant",t.WeightedMode=void 0,(tC=t.WeightedMode||(t.WeightedMode={}))[tC.None=0]="None",tC[tC.In=1]="In",tC[tC.Out=2]="Out",tC[tC.Both=3]="Both";var ow=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=t;var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=function(t,e){var i,r,n,a=new iq(t.time,t.value),o=new iq,s=new iq,u=new iq,h=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,l=2===t.tangentMode,c=(h?t.outWeight:1)*(e.time-t.time)/3;o.x=t.time+c,o.y=t.value+c*(l?0:t.outSlope);var f=(h?e.inWeight:1)*(e.time-t.time)/3;s.x=e.time-f,s.y=e.value-f*(l?0:e.inSlope),u.x=e.time,u.y=l?t.value:e.value,e4(s),e4(u);var d=u.x-a.x,p=u.y-a.y,m=a3((o.x-a.x)/d,5),v=a3((s.x-a.x)/d,5);a2(p,0)?i=r=NaN:(i=a3((o.y-a.y)/p,5),r=a3((s.y-a.y)/p,5)),m<0&&(console.error("Invalid bezier points, x1 < 0",a,o,s,u),m=0),v<0&&(console.error("Invalid bezier points, x2 < 0",a,o,s,u),v=0),m>1&&(console.error("Invalid bezier points, x1 >= 1",a,o,s,u),m=1),v>1&&(console.error("Invalid bezier points, x2 >= 1",a,o,s,u),v=1);var y=("bez_"+m+"_"+i+"_"+v+"_"+r).replace(/\./g,"p");return a6[y]?n=a6[y]:(n=a2(p,0)?new oi:h?new oi(m,i,v,r):new oi(i,r),a6[y]=n),{points:[a,o,s,u],timeInterval:d,valueInterval:p,curve:n}}(e[i],e[i+1]),n=r.points,a=r.curve,o=r.timeInterval,s=r.valueInterval,u=n[0],h=n[n.length-1];this.keys.push([].concat(u.toArray(),n[1].toArray())),this.keys.push([].concat(h.toArray(),n[2].toArray()));var l={points:n,timeInterval:o,valueInterval:s,curve:a,timeStart:Number(u.x),timeEnd:Number(h.x)};this.curveMap[u.x+"&"+h.x]=l,this.curveInfos.push(l)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,a=this.keyFrames[r+1].time;if(t>=n&&t<a){var o=this.curveInfos[r],s=o.points[0],u=o.timeInterval,h=o.valueInterval,l=(t-s.x)/u,c=o.curve.getValue(l);e=s.y+h*c;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var o=0;o<a.length;o++){var s=this.curveMap[a[o]].timeStart,u=this.curveMap[a[o]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[o],Number(u))),r>=Number(s)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[o],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,o=0,s=(e-r.x)/20,u=0;u<=20;u++){var h=u*s/n,l=r.y+a*i.curve.getValue(h);0===u||20===u?o+=l:u%2==1?o+=4*l:o+=2*l}return s/3*o},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(os);function oR(t){for(var e=[],i=[],r={x:0,y:0},n=0;n<t.length-1;n++){var a=t[n],o=t[n+1],s=on(a,o,!0),u=s.p0,h=s.p1,l=s.p2,c=s.p3;e4(l),e4(c);var f={leftControl:r,value:u,rightControl:h,tangentMode:0};if(a[0]===tK.HOLD&&(f.tangentMode=2),i.push(f),r=l,n===t.length-2){var d=on(o,o,!0);e4(d.p3),i.push({leftControl:l,value:d.p3,rightControl:{x:0,y:0},tangentMode:o[0]===tK.HOLD?2:0})}}for(var p=function(t,e){return(e.y-t.y)/(e.x-t.x+1e-6)},m=0;m<i.length;m++){var v=i[m].leftControl,y=i[m].value,g=i[m].rightControl,x=p(y,g),b=p(v,y),T={time:y.x,value:y.y,inSlope:b,outSlope:x,inWeight:0,outWeight:0,tangentMode:i[m].tangentMode,weightedMode:3};e.push(T),m>0&&(T.inWeight=(y.x-v.x)/((y.x-i[m-1].value.x)/3)),m+1<i.length&&(T.outWeight=(g.x-y.x)/((i[m+1].value.x-y.x)/3))}return e}var oI=((eT={})[tq.RANDOM]=function(t){return a(t[0],Array)?new oc(t):new ol(t)},eT[tq.CONSTANT]=function(t){return new ou(t)},eT[tq.CONSTANT_VEC2]=function(t){return new ou(t)},eT[tq.CONSTANT_VEC3]=function(t){return new ou(t)},eT[tq.CONSTANT_VEC4]=function(t){return new ou(t)},eT[tq.RGBA_COLOR]=function(t){return new ou(t)},eT[tq.COLORS]=function(t){return new oh(t.map(function(t){return eU(t,!1)}))},eT[tq.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new of([t[0][1],t[1][1]]):new op(t)},eT[tq.GRADIENT_COLOR]=function(t){return new od(t)},eT[tq.LINEAR_PATH]=function(t){return new om(t)},eT[tq.BEZIER_CURVE]=function(t){return 1===t.length?new ou(t[0][1][1]):new ow(oR(t))},eT[tq.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new ou(o_(iK,[].concat(t[1][0]))):new ov(t)},eT[tq.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new ou(o_(iQ,[].concat(t[1][0]))):new oy(t)},eT[tq.COLOR_CURVE]=function(t){return new oO(t)},eT[tq.VECTOR4_CURVE]=function(t){return new oC(t)},eT[tq.VECTOR2_CURVE]=function(t){return new oA(t)},eT[27]=function(t){return new oS(t)},eT);function oM(t){if(!t||!isNaN(+t))return new ou(t||0);if(a(t,os))return t;if(ie(oI[t[0]]))return oI[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+aM["ValueType: 21/22 is not supported"]+".")}var oO=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new rE,e}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=oM(t[0]),this.gCurve=oM(t[1]),this.bCurve=oM(t[2]),this.aCurve=oM(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(os),oP=1,oN=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),a=this.createGeometry();this.mesh=this.createMesh(a,n),this.updateMesh()}var i=e.prototype;return i.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new iK,n=new iQ,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},i.createMaterial=function(e){var i,r=[["ENV_EDITOR",(null==(i=this.engine.renderer)?void 0:i.env)===aI]],n=oM(this.color).getValue(0),a={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:t.GLSLVersion.GLSL1,cacheId:""+e.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},o=no.create(this.engine,a);return o.blending=!0,o.depthTest=!1,o.setVector4("uPos",new rb(0,0,0,0)),o.setVector2("uSize",new iq(1,1)),o.setVector4("uColor",new rb(n[0]/255,n[1]/255,n[2]/255,n[3])),o.setQuaternion("uQuat",new iQ(0,0,0,0)),o},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return nx.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:rw.LINES,maxVertex:4})},i.createMesh=function(t,e){return nR.create(this.engine,{name:"Interact_preview"+oP++,priority:0,worldMatrix:r_.fromIdentity(),geometry:t,material:e})},e}();function oF(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.speed=25,t.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},t.invalidBorderRange=0,t.invalidByBorderRange=!1,t.duringPlay=!1,t._interactive=!0,t.lastTime=-1,t.getHitTestParams=function(e){if(t.clickable){var i=t.item.props.content.options.behavior,r=t.getBoundingBox();if(r)return{type:r.type,triangles:r.area,behavior:i}}},t}ib(i,e);var r=i.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.engine.renderer.env,e=this.item.composition,i=this.interactData.options,r=i.type,n=i.showPreview;if(r===tB.CLICK&&(this.clickable=!0,n&&t===aI)){var a=null==e?void 0:e.getRendererOptions();void 0!==a&&(this.previewContent=new oN(this.item.props.content,a,this.transform,this.engine))}this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){e.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){e.prototype.onEnable.call(this);var t=this.interactData.options.type,i=this.item.engine.renderer.env;if(t===tB.CLICK)this.clickable=!0;else if(t===tB.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==aI||n){var a,o=(null!=(a=this.item.composition)?a:{}).event;o&&this.beginDragTarget(r,o)}}},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,a=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,a.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,oF(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,a=n.position,o=n.fov,s=e.dy,u=e.dx*e.width/e.height,h=a[2],l=Math.tan(o*Math.PI/180/2)*Math.abs(h),c=this.dragRange,f=c.dxRange,d=c.dyRange,p=a[0]-this.dragRatio[0]*(u*l),m=a[1]-this.dragRatio[1]*(s*l),v=f[0],y=f[1],g=d[0],x=d[1];p=iW(p,v,y),m=iW(m,g,x),p!==v&&p!==y&&v!==y&&(null==(i=e.origin)||i.preventDefault()),m!==g&&m!==x&&g!==x&&(null==(r=e.origin)||r.preventDefault()),this.item.composition.camera.position=new iK(p,m,h)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var a={touchstart:function(t){if(n.canInteract()&&(n.invalidByBorderRange=n.checkInvalidBorderRange({x:t.x,y:t.y}),!n.invalidByBorderRange)){n.dragEvent=null,n.bouncingArg=null;var e,i=null==(e=n.item.composition)?void 0:e.camera;r={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){n.invalidByBorderRange||(n.handleDragMove(r,t),n.bouncingArg=t)},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!oF(e,3)&&e&&(e.vx*=n.speed,e.vy*=n.speed,n.dragEvent=iB({},r)),r=null}}};Object.keys(a).forEach(function(t){e.addEventListener(t,a[t])}),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(a).forEach(function(t){e.removeEventListener(t,a[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=a1(iK.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}},r.fromData=function(t){if(e.prototype.fromData.call(this,t),this.interactData=t,t.options.type===tB.DRAG){var i=t.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},r.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i,r,n,a,o=0,s=0,u=0,h=0;if("number"==typeof e?(o=e,s=e,u=e,h=e):it(e)&&(o=void 0===(i=e[0])?0:i,s=void 0===(r=e[1])?0:r,u=void 0===(n=e[2])?0:n,h=void 0===(a=e[3])?0:a),t.x<h-1||t.x>1-s||t.y<o-1||t.y>1-u)return!0}return!1},rv(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(rx),t.InteractComponent=s([iA(es.InteractComponent)],t.InteractComponent);var oL=function(){function e(){this.triangles=[],this.worldMatrix=new r_,this.assemblyTriangles=function(t,e,i,r,n){for(var a=i;a<r;a+=3){var o=3*e[a],s=3*e[a+1],u=3*e[a+2],h={x:t[o],y:t[o+1],z:t[o+2]},l={x:t[s],y:t[s+1],z:t[s+2]},c={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:l,p2:c})}}}var i=e.prototype;return i.getBoundingBoxData=function(){return this.applyWorldMatrix(this.boundingBoxData.area),this.boundingBoxData},i.getBoundingBox=function(){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=Number.MAX_VALUE,s=n(this.boundingBoxData.area);!(e=s()).done;){var u=e.value;i=Math.max(u.p0.x,u.p1.x,u.p2.x,i),r=Math.max(u.p0.y,u.p1.y,u.p2.y,r),a=Math.min(u.p0.x,u.p1.x,u.p2.x,a),o=Math.min(u.p0.y,u.p1.y,u.p2.y,o)}var h=[],l=new iK(a,r,0),c=new iK(i,r,0),f=new iK(i,o,0),d=new iK(a,o,0);return h.push({p0:l,p1:c,p2:f}),h.push({p0:l,p1:f,p2:d}),this.applyWorldMatrix(h),{type:t.HitTestType.triangle,area:h}},i.setGeometry=function(e,i){this.triangles=this.geometryToTriangles(e);for(var r,a=[],o=n(this.triangles);!(r=o()).done;){var s=r.value;a.push({p0:s.p0,p1:s.p1,p2:s.p2})}i&&this.worldMatrix.copyFrom(i),this.boundingBoxData={type:t.HitTestType.triangle,area:a}},i.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var a,o=n(t.subMeshes);!(a=o()).done;){var s=a.value;if(void 0!==s.indexCount){var u=e.BYTES_PER_ELEMENT,h=s.offset/u,l=h+s.indexCount;this.assemblyTriangles(i,e,h,l,r)}}return r},i.applyWorldMatrix=function(t){var e=this;return t.forEach(function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new iK),t.p1=e.worldMatrix.transformPoint(t.p1,new iK),t.p2=e.worldMatrix.transformPoint(t.p2,new iK)}),t},e}(),oV=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="sprite",e}return ib(e,t),e}(ig),oD=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=n(this.playableOutputs);!(e=i()).done;)e.value.context.deltaTime=t;for(var r,a=n(this.playableOutputs);!(r=a()).done;){var o=r.value;this.prepareFrameWithRoot(o)}for(var s,u=n(this.playableOutputs);!(s=u()).done;){var h=s.value;this.processFrameWithRoot(h)}},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrame(t.context),t.processFrame()},e.prepareFrameWithRoot=function(t){t.prepareFrame(),t.sourcePlayable.prepareFrame(t.context)},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&t.setTime(t.getTime()+e)},t}(),ok=function(){function t(t,e){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0,t.addPlayable(this)}var e=t.prototype;return e.play=function(){switch(this.playState){case 0:break;case 1:this.playState=0,this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1}},e.pause=function(){0===this.playState&&(this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1)},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},t}(),oz=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayable=function(t){this.sourcePlayable=t},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),oU=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iI);function oB(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(tS=eE||(eE={}))[tS.Playing=0]="Playing",tS[tS.Paused=1]="Paused";var oG=new iQ,oj=1,oX=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new iK(0,0,0),this.quat=new iQ(0,0,0,1),this.rotation=new nT(0,0,0),this.scale=new iK(1,1,1),this.anchor=new iK(0,0,0),this.size=new iq(1,1),this.children=[],this.worldMatrix=r_.fromIdentity(),this.localMatrix=r_.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new iK(0,0,0),quat:new iQ(0,0,0,1),scale:new iK(1,1,1)},this.name="transform_"+oj++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,o=t.size,s=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),i&&(a(i,iK)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),s)a(s,iQ)?this.setQuaternion(s.x,s.y,s.z,s.w):this.setQuaternion(s[0],s[1],s[2],s[3]);else if(r){var l=e?-1:1;a(r,nT)?this.setRotation(r.x*l,r.y*l,r.z*l):this.setRotation(r[0]*l,r[1]*l,r[2]*l)}n&&(a(n,iK)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),h&&(a(h,iq)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){eD(this.children,t)},e.removeChild=function(t){ek(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new nT)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;return this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1),this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new nT)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=new iK().copyFrom(t.position),t.quat?e.quat=new iQ(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new nT(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=new iK().copyFrom(t.scale),t.size&&(e.size=new iq().copyFrom(t.size)),t.anchor&&(e.anchor=new iq().copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach(function(t){t.parentMatrixDirty=!0})},t.getRotation=function(t,e){var i=oG.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},rv(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}(),oH=new iK(1,1,1),oW=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new oX,this.viewportMatrix=r_.fromIdentity(),this.viewMatrix=r_.fromIdentity(),this.projectionMatrix=r_.fromIdentity(),this.viewProjectionMatrix=r_.fromIdentity(),this.inverseViewMatrix=r_.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,a=e.aspect,o=e.clipMode,s=void 0===o?tZ.portrait:o,u=e.position,h=void 0===u?[0,0,8]:u,l=e.rotation,c=void 0===l?[0,0,0]:l,f=new nT(c[0],c[1],c[2]),d=new iQ().setFromEuler(f);this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===a?1:a,clipMode:s},this.transform.setPosition(h[0],h[1],h[2]),this.transform.setQuaternion(d.x,d.y,d.z,d.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new iK(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var a=i.projectPoint(e).z,o=r.projectPoint(new iK(1,1,a)),s=o.x,u=o.y,h=r.projectPoint(new iK(-1,-1,a));return new iK((s-h.x)/2,(u-h.y)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return iB({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,a=t.aspect,o=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=o,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,a=e.far,o=e.clipMode;this.projectionMatrix.perspective(i*iG,r,n,a,o===tZ.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),oH),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:r_.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},rv(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.transform.position.clone()},set:function(t){this.transform.position.equals(t)||(this.transform.setPosition(t.x,t.y,t.z),this.dirty=!0)}},{key:"worldPosition",get:function(){return this.transform.getWorldPosition()}},{key:"rotation",get:function(){return this.transform.rotation.clone()},set:function(t){this.transform.rotation.equals(t)||(this.transform.setRotation(t.x,t.y,t.z),this.dirty=!0)}}]),t}(),oY=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+i||1,this.count=a(r,os)?r:oM(r),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),oZ=function(t){this.content=t},oq=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do if(t(e.content))return e;while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new oZ(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(0>=this.sort(i.content,e.content)))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new oZ(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(0>=this.sort(e.content,i.content)))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,a=t.next;n.next=a,a&&(a.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do t.call(e||this,i.content,r++);while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do t.call(e||this,i.content,r--);while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),oK="lookup_texture",oQ="offscreen_canvas",oJ={},o$=new iK,o0=new iK,o1=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,o=i.colorOverTrail,s=i.maxTrailCount,u=i.opacityOverLifetime,h=void 0===u?oM(1):u,l=i.widthOverTrail,c=i.name,f=i.occlusion,d=i.blending,p=i.maskMode,m=i.mask,v=i.textureMap,y=i.texture,g=i.transparentOcclusion,x=i.minimumVertexDistance,b=i.lifetime,T=i.matrix,E=e.gpuCapability,_=E.detail,C=E.level,S=Math.max(i.pointCountPerTrail,2),A=oT(),w=_.maxVertexTextures>0,R=(null!=(r=e.renderer)?r:{}).env,I={},M=[["ENABLE_VERTEX_TEXTURE",w],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",R===aI]],O=s>64,P=0;n&&(M.push(["COLOR_OVER_LIFETIME",!0]),P|=1,I.uColorOverLifetime=r4.createWithData(e,e0(n))),o&&(M.push(["COLOR_OVER_TRAIL",!0]),P|=4,I.uColorOverTrail=r4.createWithData(e,e0(o))),O?(M.push(["ATTR_TRAIL_START",1]),P|=8):I.uTrailStart=new Float32Array(s),I.uOpacityOverLifetimeValue=h.toUniform(A);var N=l.toUniform(A);M.push(["VERT_CURVE_VALUE_COUNT",A.index],["VERT_MAX_KEY_FRAME_COUNT",A.max]),I.uVCurveValues=os.getAllData(A);var F={shader:{vertex:nV,fragment:nF,macros:M,glslVersion:1===C?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+P+"+"+A.index+"+"+A.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},L=S*s*2,V=(S-1)*s,D=Float32Array.BYTES_PER_ELEMENT,k=12*D,z={attributes:{aColor:{size:4,stride:k,data:new Float32Array(12*L)},aSeed:{size:1,stride:k,offset:4*D,dataSource:"aColor"},aInfo:{size:3,stride:k,offset:5*D,dataSource:"aColor"},aPos:{size:4,stride:k,offset:8*D,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(L)},aDir:{size:3,data:new Float32Array(3*L)}},indices:{data:new Uint16Array(6*L)},drawCount:6*V,name:"trail#"+c,bufferUsage:rw.DYNAMIC_DRAW};if(O)z.attributes.aTrailStart={size:1,data:new Float32Array(L)};else{var U=new Float32Array(L);z.attributes.aTrailStartIndex={size:1,data:U};for(var B=0;B<s;B++)for(var G=2*S,j=B*G,X=0;X<G;X++)U[j+X]=B}var H=rN(d),W=no.create(e,F);W.blending=!0,W.depthMask=f,W.depthTest=!0,W.stencilRef=m?[m,m]:void 0,rV(W,p),rF(W,d);var Y=this.mesh=nR.create(e,{name:"MTrail_"+c,material:W,geometry:nx.create(e,z)}),Z=null!=y?y:r4.createWithData(e);Object.keys(I).map(function(t){var e=I[t];if(a(e,r4))W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new rb(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}W.setVector4Array(t,i)}else W.setVector4(t,rb.fromArray(e))}),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",rb.fromArray(N)),W.setVector2("uTexOffset",new iq(0,0)),W.setVector4("uTextureMap",rb.fromArray(void 0===v?[0,0,1,1]:v)),W.setVector4("uParams",new rb(0,S-1,0,0)),W.setTexture("uMaskTex",Z),W.setVector4("uColorParams",new rb(y?1:0,+H,0,+(f&&!g))),this.maxTrailCount=s,this.pointCountPerTrail=S,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=O,this.lifetime=b,T&&(this.mesh.worldMatrix=T),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(s)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,a=this.geometry,o=n-1,s=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,o$);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+s,f=o5(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),a.setAttributeSubData("aDir",6*c,v),a.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var y=i.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(p,4),g[7]=0,g.set(x,8),g[11]=.5*m,g.set(y,12),g.set(p,16),g[19]=1,g.set(x,20),g[23]=-.5*m,a.setAttributeSubData("aColor",24*c,g),u>=0){var b=new Float32Array(o5(this.getTrailPosition(t,h,o0),l,e)),T=(t*n+u)*6;a.setAttributeSubData("aDir",T,b),a.setAttributeSubData("aDir",T+3,b);var E=t*n*2,_=new Uint16Array([2*u+E,2*u+1+E,2*s+E,2*s+E,2*u+1+E,2*s+1+E]),C=(t*o+(r-1)%o)*6;a.setIndexSubData(C,_)}r=++this.trailCursors[t];var S=this.mesh.material,A=S.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var R=2*n,I=new Float32Array(R),M=0;M<R;M++)I[M]=w;a.setAttributeSubData("aTrailStart",t*I.length,I)}else{var O=S.getFloats("uTrailStart");void 0!=O&&(O[t]=w,S.setFloats("uTrailStart",O))}A&&(A.y=Math.max(A.y,r-1)-Math.max(0,r-n),S.setVector4("uParams",A))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,a=this.geometry.getAttributeData("aColor");return e4(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();e4(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},i.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");e4(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},i.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,i=this.geometry.getIndexData();e4(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},i.getPointStartPos=function(t){return this.pointStart[t]},i.setPointStartPos=function(t,e){this.pointStart[t]=e},i.onUpdate=function(t){},rv(e,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),e}(),o2=new iK,o3=new iK,o4=new iK;function o5(t,e,i){return t||i?(t?i?(o3.subtractVectors(e,t).normalize(),o3.subtractVectors(i,e),o4.copyFrom(o3).normalize(),o2.addVectors(o3,o4)):o2.subtractVectors(e,t):o2.subtractVectors(i,e),o2.normalize().toArray()):[0,0,0]}var o6=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}ib(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&a(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;e&&(this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),e.update(this.time-e.time)),this.lastTime=this.time},i}(ok),o8=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){return new o6(t)},e}(oU),o9={uSprite:"vec4",uParams:"vec4",uAcceleration:"vec4",uGravityModifierValue:"vec4",uOpacityOverLifetimeValue:"vec4",uRXByLifeTimeValue:"vec4",uRYByLifeTimeValue:"vec4",uRZByLifeTimeValue:"vec4",uLinearXByLifetimeValue:"vec4",uLinearYByLifetimeValue:"vec4",uLinearZByLifetimeValue:"vec4",uSpeedLifetimeValue:"vec4",uOrbXByLifetimeValue:"vec4",uOrbYByLifetimeValue:"vec4",uOrbZByLifetimeValue:"vec4",uSizeByLifetimeValue:"vec4",uSizeYByLifetimeValue:"vec4",uColorParams:"vec4",uFSprite:"vec4",uPreviewColor:"vec4",uVCurveValues:"vec4Array",uFCurveValues:"vec4",uFinalTarget:"vec3",uForceCurve:"vec4",uOrbCenter:"vec3",uTexOffset:"vec2",uPeriodValue:"vec4",uMovementValue:"vec4",uStrengthValue:"vec4",uWaveParams:"vec4"},o7=function(){function e(e,i){this.particleCount=0,this.cachedRotationVector3=new iK,this.cachedRotationMatrix=new nE,this.cachedLinearMove=new iK,this.tempMatrix3=new nE,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,o,s,u,h,l,c,f,d=(null!=(l=e.renderer)?l:{}).env,p=i.speedOverLifetime,m=i.colorOverLifetime,v=i.linearVelOverLifetime,y=i.orbitalVelOverLifetime,g=i.sizeOverLifetime,x=i.rotationOverLifetime,b=i.sprite,T=i.gravityModifier,E=i.maxCount,_=i.textureFlip,C=i.useSprite,S=i.name,A=i.gravity,w=i.forceTarget,R=i.side,I=i.occlusion,M=i.anchor,O=i.blending,P=i.maskMode,N=i.mask,F=i.transparentOcclusion,L=i.meshSlots,V=i.renderMode,D=void 0===V?0:V,k=i.diffuse,z=void 0===k?r4.createWithData(e):k,U=e.gpuCapability.detail,B=U.halfFloatTexture,G=U.maxVertexUniforms,j=[["RENDER_MODE",+D],["ENV_EDITOR",d===aI]],X=e.gpuCapability.level,H=oT(),W=oT(),Y=G>0,Z={},q=0,K=0;this.useSprite=C,Y&&j.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(j.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=p.toUniform(H)),(null==b?void 0:b.animate)&&(j.push(["USE_SPRITE",!0]),K|=4,Z.uFSprite=Z.uSprite=new Float32Array([b.col,b.row,b.total,b.blend?1:0]),this.useSprite=!0),(null==m?void 0:m.color)&&(j.push(["COLOR_OVER_LIFETIME",!0]),K|=16,Z.uColorOverLifetime=a(m.color,r4)?m.color:r4.createWithData(e,e0(m.color))),(null==m?void 0:m.opacity)?Z.uOpacityOverLifetimeValue=m.opacity.toUniform(H):Z.uOpacityOverLifetimeValue=oM(1).toUniform(H),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==v?void 0:v[t])&&(Z["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(H),i=1,K|=1<<7+e,v.enabled=!0),j.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==y?void 0:y[t])&&(Z["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=y[t].toUniform(H),r=1,K|=1<<10+e,c=!0,y.enabled=!0),j.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==v?void 0:v.asMovement)&&(j.push(["AS_LINEAR_MOVEMENT",!0]),K|=32),c&&((null==y?void 0:y.asRotation)&&(j.push(["AS_ORBITAL_MOVEMENT",!0]),K|=64),Z.uOrbCenter=new Float32Array((null==y?void 0:y.center)||[0,0,0])),Z.uSizeByLifetimeValue=null==g?void 0:g.x.toUniform(H),(null==g?void 0:g.separateAxes)&&(j.push(["SIZE_Y_BY_LIFE",1]),K|=16384,Z.uSizeYByLifetimeValue=null==g?void 0:null==(f=g.y)?void 0:f.toUniform(H)),(null==x?void 0:x.z)&&(Z.uRZByLifeTimeValue=x.z.toUniform(H),K|=32768,j.push(["ROT_Z_LIFETIME",1])),(null==x?void 0:x.x)&&(Z.uRXByLifeTimeValue=x.x.toUniform(H),K|=65536,j.push(["ROT_X_LIFETIME",1])),(null==x?void 0:x.y)&&(Z.uRYByLifeTimeValue=x.y.toUniform(H),K|=131072,j.push(["ROT_Y_LIFETIME",1])),(null==x?void 0:x.asRotation)&&(j.push(["ROT_LIFETIME_AS_MOVEMENT",1]),K|=262144),Z.uGravityModifierValue=T.toUniform(H),w&&(j.push(["FINAL_TARGET",!0]),K|=524288,Z.uFinalTarget=new Float32Array(w.target||[0,0,0]),Z.uForceCurve=w.curve.toUniform(H)),B&&W.max?(K|=1048576,Z.uFCurveValueTexture=r5(e,os.getAllData(W,!0),W.index,1)):Z.uFCurveValues=os.getAllData(W);var Q=H.max+H.curves.length-32>G;if(2===X&&(H.max=-1,H.index=L?L[0]:se(H.index),W.index>0&&(W.max=-1,W.index=L?L[1]:se(W.index))),Q&&B&&Y){var J=r5(e,os.getAllData(H,!0),H.index,1);Z.uVCurveValueTexture=J,q=1}else Z.uVCurveValues=os.getAllData(H);var $=["-p:",D,K,H.index,H.max,W.index,W.max].join("+");j.push(["VERT_CURVE_VALUE_COUNT",H.index],["FRAG_CURVE_VALUE_COUNT",W.index],["VERT_MAX_KEY_FRAME_COUNT",H.max],["FRAG_MAX_KEY_FRAME_COUNT",W.max]),this.VERT_MAX_KEY_FRAME_COUNT=H.max;var tt={fragment:nF,vertex:"#define LOOKUP_TEXTURE_CURVE "+q+"\n"+nL,glslVersion:1===X?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:$,macros:j,name:"particle#"+S},te=rN(O);Z.uTexOffset=new Float32Array(z?[1/z.getWidth(),1/z.getHeight()]:[0,0]),Z.uMaskTex=z,Z.uColorParams=new Float32Array([z?1:0,+te,0,+(!!I&&!F)]),Z.uParams=[0,0,0,0],Z.uAcceleration=[(null==A?void 0:A[0])||0,(null==A?void 0:A[1])||0,(null==A?void 0:A[2])||0,0];var ti=no.create(e,{shader:tt,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});ti.blending=!0,ti.depthTest=!0,ti.depthMask=!!I,ti.stencilRef=N?[N,N]:void 0,rV(ti,P),rF(ti,O),rL(ti,R),Object.keys(Z).map(function(t){var e=Z[t];if(a(e,r4)){ti.setTexture(t,e);return}var i=[];switch(o9[t]){case"vec4":ti.setVector4(t,rb.fromArray(e));break;case"vec3":ti.setVector3(t,iK.fromArray(e));break;case"vec2":ti.setVector2(t,iq.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new rb(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}ti.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),ti.setVector3("emissionColor",new iK(0,0,0)),ti.setFloat("emissionIntensity",0);var tr=nx.create(e,(r=4*E,n=this.useSprite,o="particle#"+S,h={aPos:{size:3,offset:0,stride:u=12*(s=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*s,stride:u,dataSource:"aPos"},aDirX:{size:3,offset:6*s,stride:u,dataSource:"aPos"},aDirY:{size:3,offset:9*s,stride:u,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*s,data:new Float32Array(0)},aSeed:{size:1,offset:3*s,stride:8*s,dataSource:"aRot"},aColor:{size:4,offset:4*s,stride:8*s,dataSource:"aRot"},aOffset:{size:4,stride:4*s,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*s,data:new Float32Array(0)},aRotation1:{size:3,offset:3*s,stride:9*s,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*s,stride:9*s,dataSource:"aRotation0"}},n&&(h.aSprite={size:3,stride:3*s,data:new Float32Array(0)}),{attributes:h,indices:{data:new Uint16Array(0)},name:o,maxVertex:r})),tn=nR.create(e,{name:"MParticle_"+S,material:ti,geometry:tr});this.anchor=M,this.mesh=tn,this.geometry=tn.firstGeometry(),this.forceTarget=w,this.sizeOverLifetime=g,this.speedOverLifetime=p,this.linearVelOverLifetime=v,this.orbitalVelOverLifetime=y,this.orbitalVelOverLifetime=y,this.gravityModifier=T,this.rotationOverLifetime=x,this.maxCount=E,this.textureOffsets=_?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var i=e.prototype;return i.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return e4(e),[e[i],e[i+1],e[i+2],e[i+3]]},i.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},i.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.constructor(0))}t.setIndexData(new i.constructor(0))},i.onUpdate=function(t){var e=Math.ceil(this.geometry.getAttributeData("aPos").length/12);this.applyTranslation(e,t),this.applyRotation(e,t),this.applyLinearMove(e,t)},i.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},i.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},i.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r,n=t+1,a=4*n,o=this.geometry,s=n>this.maxParticleBufferCount,u=1;this.particleCount>300?u=(this.particleCount+100)/this.particleCount:this.particleCount>100?u=1.4:this.particleCount>0&&(u=2);var h={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},l=this.useSprite;l&&(h.aSprite=new Float32Array(12));var c=new iK,f=new iQ,d=new iK(1,1,1);e.transform.assignWorldTRS(c,f,d);var p=oX.getRotation(f,new nT),m=c.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();l&&(r=e.sprite);for(var C=0;C<4;C++){var S=2*C,A=3*C,w=4*C,R=12*C,I=8*C;h.aPos.set(m,R),b.fill(h.aPos,R+3),h.aRot.set(v,I),h.aRot[I+3]=_,h.aRot.set(T,I+4),l&&h.aSprite.set(r,A);var M=e.uv||x;if(M){var O=l?1-y[S+1]:y[S+1];g[0]=M[0]+y[S]*M[2],g[1]=M[1]+O*M[3]}h.aOffset.set(g,w);for(var P=C+C,N=(E[P]-this.anchor.x)*d.x,F=(E[P+1]-this.anchor.y)*d.y,L=0;L<3;L++)h.aPos[R+6+L]=e.dirX.getElement(L)*N,h.aPos[R+9+L]=e.dirY.getElement(L)*F}var V=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var D=ez(o.getIndexData(),6*n,6*i,u);D.set(V,6*t),o.setIndexData(D),this.maxParticleBufferCount=D.length/6}else o.setIndexSubData(6*t,V);Object.keys(h).forEach(function(e){var r=h[e],n=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=o.getAttributeData(e);e4(l);var c=ez(l,a*n,4*i*n,u);c.set(r,r.length*t),o.setAttributeData(e,c)}else o.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),o.setDrawCount(6*this.particleCount)}},i.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,s=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),l=this.mesh.material.getVector4("uGravityModifierValue"),c=0;c<t;c+=4){var f=12*c+3;o=n[f],s=n[f+1],u=n[f+2];var d=i-a[4*c+2],p=a[4*c+3];if(h&&l){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);o=o*x+v,s=s*x+y,u=u*x+g}else o+=v,s+=y,u+=g}var b=3*c;if(a[4*c+2]<i){var T=e/1e3*o,E=e/1e3*s,_=e/1e3*u;r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},i.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),o=this.geometry.getAttributeData("aSeed"),s=this.time,u=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var h=0;h<t;h+=4){var l=iW((s-r[4*h+2])/r[4*h+3],0,1),c=8*h,f=this.cachedRotationVector3.set(n[c],n[c+1],n[c+2]),d=o[8*h+3];this.rotationOverLifetime?(this.rotationOverLifetime.x&&(a(this.rotationOverLifetime.x,ol)?f.x+=this.rotationOverLifetime.x.getValue(l,d):f.x+=this.rotationOverLifetime.x.getValue(l)),this.rotationOverLifetime.y&&(a(this.rotationOverLifetime.y,ol)?f.y+=this.rotationOverLifetime.y.getValue(l,d):f.y+=this.rotationOverLifetime.y.getValue(l)),this.rotationOverLifetime.z&&(a(this.rotationOverLifetime.z,ol)?f.z+=this.rotationOverLifetime.z.getValue(l,d):f.z+=this.rotationOverLifetime.z.getValue(l))):u.setZero(),0===f.dot(f)&&u.identity();var p=Math.PI/180,m=f.x*p,v=f.y*p,y=f.z*p,g=Math.sin(m),x=Math.sin(v),b=Math.sin(y),T=Math.cos(m),E=Math.cos(v),_=Math.cos(y);u.set(_,-b,0,b,_,0,0,0,1),u.multiply(this.tempMatrix3.set(E,0,x,0,1,0,-x,0,E)),u.multiply(this.tempMatrix3.set(1,0,0,0,T,-g,0,g,T));var C=9*h,S=u.elements;i.set(S,C),h+4<=t&&(i.set(S,C+9),i.set(S,C+18),i.set(S,C+27))}this.geometry.setAttributeData("aRotation0",i)},i.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),o=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var s=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=o-r[4*u+2],l=r[4*u+3],c=h/l,f=n[8*u+3];s.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(a(this.linearVelOverLifetime.x,ol)?s.x=this.linearVelOverLifetime.x.getValue(c,f):s.x=this.linearVelOverLifetime.x.getValue(c)),this.linearVelOverLifetime.y&&(a(this.linearVelOverLifetime.y,ol)?s.y=this.linearVelOverLifetime.y.getValue(c,f):s.y=this.linearVelOverLifetime.y.getValue(c)),this.linearVelOverLifetime.z&&(a(this.linearVelOverLifetime.z,ol)?s.z=this.linearVelOverLifetime.z.getValue(c,f):s.z=this.linearVelOverLifetime.z.getValue(c))):(this.linearVelOverLifetime.x&&(a(this.linearVelOverLifetime.x,ol)?s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.y&&(a(this.linearVelOverLifetime.y,ol)?s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.z&&(a(this.linearVelOverLifetime.z,ol)?s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,l)));var d=3*u;i[d]=s.x,i[d+1]=s.y,i[d+2]=s.z,i[d+3]=s.x,i[d+4]=s.y,i[d+5]=s.z,i[d+6]=s.x,i[d+7]=s.y,i[d+8]=s.z,i[d+9]=s.x,i[d+10]=s.y,i[d+11]=s.z}this.geometry.setAttributeData("aLinearMove",i)},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),st=[10,32,64,160];function se(t){for(var e=0;e<st.length;e++){var i=st[e];if(i>t)return i}return t||st[0]}var si=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new o7(e,i)),r&&(n.trailMesh=new o1(e,r));var n,a=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(a.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=a,n}ib(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=n(this.meshes);!(t=e()).done;)t.value.onStart()},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new rb;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t);for(var e,i=n(this.meshes);!(e=i()).done;)e.value.render(t)},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(i){t.push(e[i])}),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach(function(e){t.push(i[e])})}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(rx);t.ParticleSystem=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).destroyed=!1,n.getHitTestParams=function(e){var i=n.interaction;if(e||i)return{type:t.HitTestType.custom,collect:function(t){return n.raycast({radius:(null==i?void 0:i.radius)||.4,multiple:!!(null==i?void 0:i.multiple),removeParticle:(null==i?void 0:i.behavior)===tJ.removeParticle,ray:t})}}},n.maskManager=new ns(i),r&&n.fromData(r),n}ib(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===tq.CONSTANT_VEC3?e.add(r[1]):t=oM(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var a=r.first;r.removeNode(a),i=n[1]=a.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},r.setVisible=function(t){this.renderer.setVisible(t)},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new oq(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1,this.destroyed=!1},r.onStart=function(){this.startEmit(),this.initEmitterTransform()},r.onUpdate=function(t){this.update(t)},r.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,h=!1,l=function(){e.trails&&!h&&(h=!0,o.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,a,n)}))};if(this.ended){if(this.item.endBehavior!==tQ.restart&&tQ.destroy===this.item.endBehavior){var c=o.last;c&&c.content[0]<this.time&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/a.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=p/m,y=r.maxCount;this.updateEmitterTransform(u);for(var g=function(){var t=o.first;return e.emissionStopped||o.length===y&&t&&t.content[0]-n>u},x=0;x<m&&x<y&&!g();x++){var b=this.createPoint(d);b.delay+=i+x*v,this.addParticle(b,y),this.lastEmitTime=u}for(var T=a.bursts,E=(null==T?void 0:T.length)-1,_=0;E>=0&&_<y&&!g();E--){var C=T[E],S=!C.disabled&&C.getGeneratorOptions(u,d);if(S){var A=[0,0,0],w=a.burstOffsets[E],R=w&&w[S.cycleIndex]||A;C.once&&this.removeBurst(E);for(var I=0;I<S.count&&_<y&&!g();I++){var M,O=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:I,burstCount:S.count}));O.delay+=i,_++,(M=O.transform).translate.apply(M,[].concat(R)),this.addParticle(O,y)}}}}else this.item.endBehavior===tQ.restart?(l(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.time-=f,a.bursts.forEach(function(t){return t.reset()}),this.particleLink.forEach(function(t){t[0]-=f,t[2]-=f,t[3].delay-=f}),this.renderer.minusTimeForLoop(f)):(this.ended=!0,this.item.endBehavior===tQ.freeze&&(this.frozen=!0))}l()}},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=[],i=0;i<this.renderer.meshes.length;i++){var r=this.renderer.meshes[i].material;e.push(r.colorMask),r.colorMask=!1}for(var a,o=n(this.renderer.meshes);!(a=o()).done;)a.value.render(t);for(var s=0;s<this.renderer.meshes.length;s++)this.renderer.meshes[s].material.colorMask=e[s]}},r.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach(function(e){return e.dispose({material:{textures:t.DestroyOptions.keep}})})},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var a=t.last,o=!1;!o;){var s=a.content[0],u=a.content[3];if(s>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),a.pre?a=a.pre:o=!0}++n>r&&(o=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new iK,o=!1;if(r&&r.content)do{var s=r.content,u=s[0],h=s[1];s[2];var l=s[3];if(u>this.timePassed){var c=this.getPointPosition(l),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:c,radius:t.radius},a)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),r.content=[0]),n.push(c),t.multiple||(o=!0))}}while((r=r.pre)&&!o);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var a=this.trails,o=this.getPointPosition(i),s=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(l*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&o.subtract(c)}n.addTrailPoint(t,o,{color:s,lifetime:l,size:h,time:r})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,o=this.options.forceTarget,s=this.time-n,u=new iK,h=iK.fromArray(void 0===a?[]:a);e.assignWorldTRS(u);var l=aZ(new iK,this.options,h,s,r,u,i);if(o){var c=o.target||[0,0,0],f=o.curve.getValue(s/r),d=1-f;l.x=l.x*d+c[0]*f,l.y=l.y*d+c[1]*f,l.z=l.z*d+c[2]*f}return l},r.initPoint=function(t){var e,i,r,n,a=this.options,o=this.lifetime,s=this.shape,u=a.startSpeed.getValue(o),h=a.particleFollowParent?r_.IDENTITY:this.transform.getWorldMatrix(),l=t.position,c=new oX({position:h.transformPoint(l,new iK),valid:!0}),f=t.direction;if(f=h.transformNormal(f,sr).normalize(),a.startTurbulence&&a.turbulence){for(var d=0;d<3;d++)su.setElement(d,a.turbulence[d].getValue(o));sh.setFromVector3(su.negate()),sc.setFromEuler(sh).transformNormal(f).normalize()}s.alignSpeedDirection?(ss.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=iK.Z.clone(),h.transformNormal(this.upDirectionWorld)),so.crossVectors(ss,this.upDirectionWorld).normalize(),so.isZero()&&so.set(1,0,0)):(so.set(1,0,0),ss.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=sl)[0]=p.animationDelay.getValue(o),n[1]=p.animationDuration.getValue(o),n[2]=p.cycles.getValue(o)),a.start3DRotation?sa.set(a.startRotationX.getValue(o),a.startRotationY.getValue(o),a.startRotationZ.getValue(o)):a.startRotation?sa.set(0,0,a.startRotation.getValue(o)):sa.set(0,0,0),c.setRotation(sa.x,sa.y,sa.z);var m=a.startColor.getValue(o);if(3===m.length&&(m[3]=1),a.start3DSize)sn.x=a.startSizeX.getValue(o),sn.y=a.startSizeY.getValue(o);else{var v=a.startSize.getValue(o),y=a.sizeAspect.getValue(o);sn.x=v,sn.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!a.particleFollowParent){var x=new iK;this.transform.assignWorldTRS(void 0,void 0,x),sn.x*=x.x,sn.y*=x.y}return c.setScale(sn.x,sn.y,1),{size:sn,vel:g,color:m,delay:a.startDelay.getValue(o),lifetime:a.startLifetime.getValue(o),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:a.gravity,sprite:n,dirY:ss,dirX:so,transform:c}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&a(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return -1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,r,n,o,s,u,h,l,c,f,d,p,m,v=t.options,y=t.positionOverLifetime,g=void 0===y?{}:y,x=t.shape,b=null==g?void 0:g.gravityOverLifetime,T=aq(null==g?void 0:g.gravity),E=t.textureSheetAnimation,_=E?{animationDelay:oM(E.animationDelay||0),animationDuration:oM(E.animationDuration||1),cycles:oM(E.cycles||1),animate:E.animate,col:E.col,row:E.row,total:E.total||E.col*E.row}:void 0,C=!!(x&&x.turbulenceX||(null==x?void 0:x.turbulenceY)||(null==x?void 0:x.turbulenceZ));C&&(n=[oM(null!=(o=x.turbulenceX)?o:0),oM(null!=(s=x.turbulenceY)?s:0),oM(null!=(u=x.turbulenceZ)?u:0)]),this.name="ParticleSystem",this.shape=ac(x),this.emission={rateOverTime:oM(t.emission.rateOverTime),burstOffsets:(i=null!=(h=t.emission.burstOffsets)?h:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=a(t,Array),i=e?t[0]:t.index,n=r[i];n||(n=r[i]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),r),bursts:(t.emission.bursts||[]).map(function(t){return new oY(t)})},this.textureSheetAnimation=_;var S=t.renderer||{},A=t.rotationOverLifetime;A&&((l={}).asRotation=!!A.asRotation,l.z=A.z?oM(A.z):oM(0),A.separateAxes&&(l.x=A.x&&oM(A.x),l.y=A.y&&oM(A.y))),(null==g?void 0:g.forceTarget)&&(c={target:g.target||[0,0,0],curve:oM(g.forceCurve||[tq.LINE,[[0,0],[1,1]]])});var w={x:g.linearX&&oM(g.linearX||0),y:g.linearY&&oM(g.linearY||0),z:g.linearZ&&oM(g.linearZ||0),asMovement:g.asMovement},R={x:g.orbitalX&&oM(g.orbitalX),y:g.orbitalY&&oM(g.orbitalY),z:g.orbitalZ&&oM(g.orbitalZ),center:g.orbCenter,asRotation:g.asRotation},I=t.sizeOverLifetime||{},M=t.colorOverLifetime,O=(null==I?void 0:I.separateAxes)?{separateAxes:!0,x:oM(I.x),y:oM(I.y)}:{separateAxes:!1,x:oM(("size"in I?I.size:I.x)||1)};S.anchor=S.anchor||[0,0];var P=iq.fromArray(S.anchor);this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:oM(v.startLifetime),startDelay:oM(v.startDelay||0),startSpeed:oM(g.startSpeed||0),startColor:oM(v.startColor),looping:!1,maxCount:null!=(f=v.maxCount)?f:0,gravityModifier:oM(b||0),gravity:T,start3DSize:!!v.start3DSize,startTurbulence:C,turbulence:n,speedOverLifetime:g.speedOverLifetime&&oM(g.speedOverLifetime),linearVelOverLifetime:w,orbitalVelOverLifetime:R,forceTarget:c},v.startRotationZ&&(this.options.startRotation=oM(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=oM(v.startRotationX||0),this.options.startRotationY=oM(v.startRotationY||0),this.options.startRotationZ=oM(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=oM(v.startSizeX),this.options.startSizeY=oM(v.startSizeY)):(this.options.startSize=oM(v.startSize),this.options.sizeAspect=oM(v.sizeAspect||1)),t.mask&&this.maskManager.setMaskOptions(t.mask);var N={meshSlots:v.meshSlots,name:this.name,matrix:r_.IDENTITY,shaderCachePrefix:"",renderMode:S.renderMode||tX.BILLBOARD,side:S.side||tD.DOUBLE,gravity:T,blending:S.blending||tV.ALPHA,rotationOverLifetime:l,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:_,occlusion:!!S.occlusion,transparentOcclusion:!!S.transparentOcclusion,maxCount:v.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:c,diffuse:S.texture?this.engine.findObject(S.texture):void 0,sizeOverLifetime:O,anchor:P};if(M){var F=M.color,L=M.opacity;N.colorOverLifetime={},L&&(N.colorOverLifetime.opacity=oM(M.opacity)),F&&(F[0]===tq.GRADIENT_COLOR?N.colorOverLifetime.color=M.color[1]:F[0]===tq.RGBA_COLOR?N.colorOverLifetime.color=r4.createWithData(this.engine,{data:new Uint8Array(F[1]),width:1,height:1}):a(F,r4)&&(N.colorOverLifetime.color=F))}var V=[],D=[0,0,1,1];if(t.splits){var k=t.splits[0];D=(d=k[4])?[k[0],k[1],k[3],k[2]]:[k[0],k[1],k[2],k[3]]}if(_&&!_.animate)for(var z=d?_.row:_.col,U=d?_.col:_.row,B=_.total||z*U,G=0,j=0;j<z;j++)for(var X=0;X<U&&G<B;X++,G++)V.push([j*D[2]/z+D[0],X*D[3]/U+D[1],D[2]/z,D[3]/U]);else V.push(D);this.uvs=V,N.textureFlip=d;var H=t.trails;H&&(this.trails={lifetime:oM(H.lifetime),dieWithParticles:!1!==H.dieWithParticles,sizeAffectsWidth:!!H.sizeAffectsWidth,sizeAffectsLifetime:!!H.sizeAffectsLifetime,inheritParticleColor:!!H.inheritParticleColor,parentAffectsPosition:!!H.parentAffectsPosition},H.mask&&this.maskManager.setMaskOptions(H.mask),p={name:"Trail",matrix:r_.IDENTITY,minimumVertexDistance:H.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(H.maxPointPerTrail)||32,blending:H.blending,texture:H.texture?this.engine.findObject(H.texture):void 0,opacityOverLifetime:oM(H.opacityOverLifetime||1),widthOverTrail:oM(H.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!H.occlusion,transparentOcclusion:!!H.transparentOcclusion,textureMap:H.textureMap,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},H.colorOverLifetime&&H.colorOverLifetime[0]===tq.GRADIENT_COLOR&&(p.colorOverLifetime=H.colorOverLifetime[1]),H.colorOverTrail&&H.colorOverTrail[0]===tq.GRADIENT_COLOR&&(p.colorOverTrail=H.colorOverTrail[1])),this.renderer=new si(this.engine,N,p),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var W=t.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(m=W.radius)?m:.4,behavior:W.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},rv(i,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),i}(ry),t.ParticleSystem=s([iA(es.ParticleSystem)],t.ParticleSystem);var sr=new iK,sn=new iq,sa=new nT,so=new iK,ss=new iK,su=new iK,sh=new nT,sl=[0,0,0],sc=new r_,sf=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clipPlayables=[],e.clipWeights=[],e}ib(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=n(this.clipPlayables);!(e=i()).done;)e.value.processFrame(t);this.evaluate(t)},i.setClipWeight=function(t,e){if(a(t,ok)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t){this.clipWeights[i]=e;return}}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(ok),sd=function(e){function i(){return e.apply(this,arguments)}return ib(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(a(i,t.VFXItem)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},i}(sf),sp=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(ok),sm=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return ib(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(e){var i=!1;if(this.propertyValue=e[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var o=this.getClipPlayable(r);if(!a(o,sp)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var s=o.value;this.addWeightedValue(s,n),i=!0}}i&&(e[this.propertyName]=this.propertyValue)}}},e}(sf),sv=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(sm),sy=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(sm),sg=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.evaluate=function(t){},e}(sf),sx=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.evaluate=function(t){},e}(sf),sb=function(e){function i(){return e.apply(this,arguments)}return ib(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();a(i,t.CompositionComponent)&&(i.time=this.getTime())},i}(ok),sT=function(e){function i(){return e.apply(this,arguments)}return ib(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(a(i,t.CompositionComponent)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},i}(sf),sE=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.evaluate=function(t){},e}(sf),s_=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(sm),sC=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(sm),sS=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===tQ.restart?e%=i:this.endBehavior===tQ.freeze&&(e=Math.min(i,e))),e},t}();t.TrackAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}ib(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new sf(t)},i.createOutput=function(){return new oz},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],a=n(this.clips);!(i=a()).done;){var o=i.value;r.push(o)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,a=this.createTrackMixer(t),o=n(e);!(r=o()).done;){var s=r.value,u=this.createClipPlayable(t,s);u.setDuration(s.duration);var h=new sA(s,u,a,this);i.push(h),a.clipPlayables.push(u),a.setClipWeight(u,0)}return a},i.createPlayable=function(t){return new ok(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new sS;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=n(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=n(this.children);!(i=r()).done;)i.value.parent=this},e}(oU),s([iR(sS,void 0)],t.TrackAsset.prototype,"clips",void 0),s([iR(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=s([iA(es.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tA=t.TrackType||(t.TrackType={}))[tA.MasterTrack=0]="MasterTrack",tA[tA.ObjectTrack=1]="ObjectTrack";var sA=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,a(this.track.boundObject,t.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,o=!1,s=this.track.boundObject;e>=i.start+i.duration&&i.endBehavior===tQ.destroy?a(s,t.VFXItem)&&t.VFXItem.isParticle(s)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,o=!0):e<i.start&&(r=0),o&&this.playable.getPlayState()!==eE.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var u=i.toLocalTime(e);this.playable.setTime(u),n&&this.playable.getPlayState()===eE.Playing&&this.playable.pause()},rv(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),e}();t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sd(t)},e}(t.TrackAsset),t.ActivationTrack=s([iA(es.ActivationTrack)],t.ActivationTrack);var sw=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}ib(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(t.TrackAsset);s([iR(void 0,void 0)],sw.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new sy(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},e}(sw),t.FloatPropertyTrack=s([iA(es.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sx(t)},e}(t.TrackAsset),t.SpriteColorTrack=s([iA(es.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}ib(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!a(this.parent.boundObject,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(t.CompositionComponent)},r.createTrackMixer=function(t){return new sT(t)},i}(t.TrackAsset),t.SubCompositionTrack=s([iA(es.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sE(t)},e}(t.TrackAsset),t.TransformTrack=s([iA(es.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.updateAnimatedObject=function(){a(this.parent.boundObject,rx)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(t.TrackAsset),s([iR(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=s([iA("MaterialTrack")],t.MaterialTrack);var sR=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sg(t)},e}(t.TrackAsset);t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){var e=new s_(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(sw),t.Vector4PropertyTrack=s([iA(es.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){var e=new sC(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(sw),t.Vector2PropertyTrack=s([iA("Vector2PropertyTrack")],t.Vector2PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){var e=new sv(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(sw),t.ColorPropertyTrack=s([iA(es.ColorPropertyTrack)],t.ColorPropertyTrack),t.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){var e=new sp(t);return e.curve=oM(this.curveData),e.value=e.curve.getValue(0),e},e}(oU),s([iR(void 0,void 0)],t.ColorPropertyPlayableAsset.prototype,"curveData",void 0),t.ColorPropertyPlayableAsset=s([iA(es.ColorPropertyPlayableAsset)],t.ColorPropertyPlayableAsset),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){var e=new sp(t);return e.curve=oM(this.curveData),e.value=e.curve.getValue(0),e},e}(oU),s([iR(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=s([iA(es.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){return new sb(t)},e}(oU),t.SubCompositionPlayableAsset=s([iA(es.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset),t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}ib(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){},r.create=function(e){if(a(this.boundObject,t.VFXItem)){for(var i,r=this.boundObject,o=!1,s=n(this.getChildTracks());!(i=s()).done;)if(a(i.value,t.ActivationTrack)){o=!0;break}if(o){if(r.getComponent(t.ParticleSystem)){var u=e.createTrack(sR,this,"ParticleTrack");u.boundObject=this.boundObject;var h=u.createClip(o8);h.start=r.start,h.duration=r.duration,h.endBehavior=r.endBehavior}if(r.getComponent(t.SpriteComponent)){var l=e.createTrack(sG,this,"ComponentTimeTrack");l.boundObject=this.boundObject.getComponent(t.SpriteComponent);var c=l.createClip(sj);c.start=r.start,c.duration=r.duration,c.endBehavior=r.endBehavior}if(r.getComponent(t.EffectComponent)){var f=e.createTrack(sG,this,"ComponentTimeTrack");f.boundObject=this.boundObject.getComponent(t.EffectComponent);var d=f.createClip(sj);d.start=r.start,d.duration=r.duration,d.endBehavior=r.endBehavior}}}},i}(t.TrackAsset),t.ObjectBindingTrack=s([iA(es.ObjectBindingTrack)],t.ObjectBindingTrack);var sI=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i}return t.prototype.addChild=function(t){this.children.push(t)},t}();t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t.cacheFlattenedTracks=null,t}ib(i,e);var r=i.prototype;return r.createPlayable=function(e){for(var i,r=new sM(e),o=n(this.tracks);!(i=o()).done;){var s=i.value;a(s,t.ObjectBindingTrack)&&s.create(this)}return this.sortTracks(this.tracks),r.compileTracks(e,this.flattenedTracks),r},r.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},r.invalidate=function(){this.cacheFlattenedTracks=null},r.addSubTracksRecursive=function(t,e){for(var i,r=n(t.getChildTracks());!(i=r()).done;){var a=i.value;e.push(a)}for(var o,s=n(t.getChildTracks());!(o=s()).done;){var u=o.value;this.addSubTracksRecursive(u,e)}},r.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new sO(t[i],i));e.sort(sP),t.length=0;for(var r,a=n(e);!(r=a()).done;){var o=r.value;t.push(o.track)}},r.fromData=function(t){},rv(i,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=n(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),i}(oU),s([iR(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=s([iA(es.TimelineAsset)],t.TimelineAsset);var sM=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.masterTrackInstances=[],e}ib(e,t);var i=e.prototype;return i.prepareFrame=function(t){},i.evaluate=function(){for(var t,e=this.getTime(),i=n(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){for(var i,r={},a=n(e);!(i=a()).done;){var o=i.value,s=o.createPlayableGraph(t,this.clips),u=o.createOutput();u.setUserData(o.boundObject),t.addOutput(u),u.setSourcePlayable(s);var h=new sI(o,s,u);r[o.getInstanceId()]=h,o.parent||this.masterTrackInstances.push(h)}for(var l,c=n(e);!(l=c()).done;)for(var f,d=l.value,p=r[d.getInstanceId()],m=n(d.getChildTracks());!(f=m()).done;){var v=r[f.value.getInstanceId()];p.addChild(v)}},e}(ok),sO=function(t,e){this.track=t,this.originalIndex=e};function sP(e,i){var r=e.track.boundObject,n=i.track.boundObject;return a(r,t.VFXItem)&&a(n,t.VFXItem)?t.VFXItem.isAncestor(r,n)?-1:t.VFXItem.isAncestor(n,r)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}t.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){var e=new sp(t);return e.curve=oM(this.curveData),e.value=e.curve.getValue(0),e},e}(oU),s([iR(void 0,void 0)],t.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector4PropertyPlayableAsset=s([iA(es.Vector4PropertyPlayableAsset)],t.Vector4PropertyPlayableAsset),t.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){var e=new sp(t);return e.curve=oM(this.curveData),e.value=e.curve.getValue(0),e},e}(oU),s([iR(void 0,void 0)],t.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector2PropertyPlayableAsset=s([iA(es.Vector2PropertyPlayableAsset)],t.Vector2PropertyPlayableAsset),t.CompositionComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.items=[],t.state=eE.Playing,t.reusable=!1,t.sceneBindings=[],t.graph=new oD,t}ib(i,e);var r=i.prototype;return r.onStart=function(){var e;this.timelineAsset||(this.timelineAsset=new t.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tQ.destroy&&this.setReusable(!0),null==(e=this.item.composition)||e.refContent.push(this.item)},r.setReusable=function(e){for(var r,o=n(this.timelineAsset.tracks);!(r=o()).done;){var s=r.value.boundObject;if(a(s,t.VFXItem)){var u=s.getComponent(i);u&&u.setReusable(e)}}},r.getReusable=function(){return this.reusable},r.pause=function(){this.state=eE.Paused},r.resume=function(){this.state=eE.Playing},r.onUpdate=function(t){if(this.state!==eE.Paused){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.timelinePlayable.evaluate(),this.graph.evaluate(t)}},r.onEnable=function(){for(var t,e=n(this.items);!(t=e()).done;)t.value.setActive(!0)},r.onDisable=function(){for(var t,e=n(this.items);!(t=e()).done;)t.value.setActive(!1)},r.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},r.hitTest=function(e,i,r,n,a,s){for(var u,h=[],l=(null==s?void 0:s.stop)||e9,c=(null==s?void 0:s.skip)||e9,f=(null==s?void 0:s.maxCount)||this.items.length,d=0;d<this.items.length&&n.length<f;d++){var p=(u=this,function(o){var s=u.items[o];if(s.isActive&&s.transform.getValid()&&!t.VFXItem.isComposition(s)&&!c(s)){var f=s.getHitTestParams(a);if(f){var d=!1,p=new iK;if(f.type===t.HitTestType.triangle)for(var m=f.triangles,v=f.backfaceCulling,y=0;y<m.length;y++){var g=m[y];if(e.intersectTriangle(g,p,v)){d=!0,h.push(p);break}}else if(f.type===t.HitTestType.box){var x=f.center,b=f.size,T=x.clone().addScaledVector(b,.5),E=x.clone().addScaledVector(b,-.5);e.intersectBox({min:T,max:E},p)&&(d=!0,h.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,C=f.radius;e.intersectSphere({center:_,radius:C},p)&&(d=!0,h.push(p))}else if(f.type===t.HitTestType.custom){var S=f.collect(e,new iq(i,r));S&&S.length>0&&(S.forEach(function(t){h.push(t)}),d=!0)}if(d){var A={compContent:u.item,id:s.id,name:s.name,position:h[h.length-1],parentId:s.parentId,hitPositions:h,behavior:f.behavior};if(s.emit("click",A),n.push(A),l(A))return{v:n}}}}}(d));if("object"===o(p))return p.v}return n},r.setChildrenRenderOrder=function(t){for(var e,r=n(this.items);!(e=r()).done;){var a=e.value;a.renderOrder=t++;var o=a.getComponent(i);o&&(t=o.setChildrenRenderOrder(t))}return t},r.fromData=function(t){e.prototype.fromData.call(this,t)},r.resolveBindings=function(){for(var t,e=n(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,a=n(this.timelineAsset.tracks);!(r=a()).done;){var o=r.value;this.updateTrackAnimatedObject(o)}},r.updateTrackAnimatedObject=function(t){for(var e,i=n(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},i}(ry),s([iR(void 0,void 0)],t.CompositionComponent.prototype,"items",void 0),s([iR(void 0,void 0)],t.CompositionComponent.prototype,"sceneBindings",void 0),s([iR(void 0,void 0)],t.CompositionComponent.prototype,"timelineAsset",void 0),t.CompositionComponent=s([iA("CompositionComponent")],t.CompositionComponent);var sN=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter(function(t){return t.listener!==i}))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i,r=arguments.length,n=Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,a=i.options;r.apply(void 0,[].concat(n)),(null==a?void 0:a.once)&&e.off(t,r)})},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map(function(t){return t.listener}))||[]}},sF=function(){function t(){this.update=new sV,this.lateUpdate=new sD}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==ry.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==ry.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==ry.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==ry.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),sL=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),sV=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=n(t);!(i=r()).done;)i.value.onUpdate(e)},e}(sL),sD=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=n(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(sL),sk=function(e){function r(i,o){(x=e.call(this)||this).sceneTicking=new sF,x.speed=1,x.isEnded=!1,x.loaderData={},x.refContent=[],x.startTime=0,x.postProcessingEnabled=!1,x.destroyed=!1,x.postLoaders=[],x.paused=!1,x.isEndCalled=!1,x._textures=[],x.videos=[];var s,u,h,l=i.reusable,c=void 0!==l&&l,f=i.speed,d=i.baseRenderOrder,p=i.renderer,m=i.event,v=i.width,y=i.height,g=i.handleItemMessage;x.renderer=p,x._textures=o.textures;for(var x,b,T,E=n(Object.keys(o.assets));!(T=E()).done;){var _=T.value,C=o.assets[_];a(C,HTMLVideoElement)&&x.videos.push(C)}x.postProcessingEnabled=null!=(S=null==(b=o.jsonScene.renderSettings)?void 0:b.postProcessingEnabled)&&S,x.getEngine().renderLevel=o.renderLevel,c&&(x.keepResource=!0,o.consumed=!0);for(var S,A,w=o.jsonScene.compositions[0],R=n(o.jsonScene.compositions);!(A=R()).done;){var I=A.value;I.id===o.jsonScene.compositionId&&(w=I)}e4(w),x.rootItem=new t.VFXItem(x.getEngine()),x.rootItem.name="rootItem",x.rootItem.duration=w.duration,x.rootItem.endBehavior=w.endBehavior,x.rootItem.composition=oB(x);for(var M,O=w.components,P=n(O);!(M=P()).done;){var N=M.value,F=x.getEngine().findObject(N);x.rootItem.components.push(F),F.item=x.rootItem}return x.rootComposition=x.rootItem.getComponent(t.CompositionComponent),x.width=v,x.height=y,x.renderOrder=void 0===d?0:d,x.id=w.id,x.startTime=null!=(s=w.startTime)?s:0,x.renderer=p,x.event=m,x.statistic={loadStart:null!=(u=o.startTime)?u:0,loadTime:null!=(h=o.totalTime)?h:0,compileTime:0,firstFrameTime:0},x.reusable=c,x.speed=void 0===f?1:f,x.name=w.name,x.pluginSystem=o.pluginSystem,x.pluginSystem.initializeComposition(oB(x),o),x.camera=new oW(x.name,iB({},null==w?void 0:w.camera,{aspect:v/y})),x.url=o.url,x.interactive=!0,x.handleItemMessage=g,x.createRenderFrame(),x.rendererOptions=null,r.buildItemTree(x.rootItem),x.rootComposition.setChildrenRenderOrder(0),x.pluginSystem.resetComposition(oB(x),x.renderFrame),x}ib(r,e);var o=r.prototype;return o.getDuration=function(){return this.rootItem.duration},o.restart=function(){this.reset(),this.forwardTime(this.startTime)},o.setIndex=function(t){this.renderOrder=t},o.getIndex=function(){return this.renderOrder},o.setSpeed=function(t){this.speed=t},o.setVisible=function(t){this.rootItem.setVisible(t)},o.getSpeed=function(){return this.speed},o.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},o.pause=function(){this.paused=!0,this.emit("pause")},o.getPaused=function(){return this.paused},o.resume=function(){this.paused=!1},o.gotoAndPlay=function(t){this.setTime(t),this.resume(),this.emit("play",{time:t})},o.gotoAndStop=function(t){this.setTime(t),this.pause()},o.createRenderFrame=function(){this.renderFrame=new nQ({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},o.setTime=function(t){var e=this.speed,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0),this.emit("goto",{time:t})},o.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},o.getComponent=function(t){return this.rootItem.getComponent(t)},o.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},o.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},o.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach(function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},o.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=(this.time-e)*1e3;this.updatePluginLoaders(i),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},o.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===tQ.destroy&&!this.reusable},o.callAwake=function(t){for(var e,i=n(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var a,o=n(t.children);!(a=o()).done;){var s=a.value;this.callAwake(s)}},o.updateCamera=function(){this.camera.updateMatrix()},o.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},o.updateCompositionTime=function(t){if(this.rootComposition.state!==eE.Paused&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e-i>.001)switch(n=!0,r){case tQ.restart:e%=i,this.restart();break;case tQ.freeze:e=Math.min(i,e);case tQ.forward:case tQ.destroy:}this.rootComposition.time=e+this.startTime,this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},o.getItemByName=function(t){return this.rootItem.find(t)},o.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return a0((t-i.z)/r,(e-i.w)/n,this.camera)},o.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},o.hitTest=function(e,i,r,n){if(this.isDestroyed||!this.interactive)return[];var a=[],o=this.getHitTestRay(e,i);return this.refContent.forEach(function(s){var u;null==(u=s.getComponent(t.CompositionComponent))||u.hitTest(o,e,i,a,r,n)}),a},o.addInteractiveItem=function(t,e){if(e===tB.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},o.removeInteractiveItem=function(t,e){e===tB.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},o.destroyItem=function(e){var i=this;e.type==tj.composition?e.endBehavior!==tQ.freeze&&e.getComponent(t.CompositionComponent).items.forEach(function(t){return i.pluginSystem.plugins.forEach(function(e){return e.onCompositionItemRemoved(i,t)})}):(ek(this.items,e),this.pluginSystem.plugins.forEach(function(t){return t.onCompositionItemRemoved(i,e)}))},o.lost=function(t){this.videoState=this.textures.map(function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime}),this.textures.map(function(t){return t.dispose()}),this.dispose()},o.dispose=function(){var e=this;if(!this.destroyed){this.destroyed=!0;var i={},r=this.textures;r&&this.keepResource&&r.forEach(function(t){(null==t?void 0:t.dispose)&&(i[t.id]=t.dispose,t.dispose=e9)});for(var a,o,s,u=n(this.videos);!(s=u()).done;){var h=s.value;h.pause(),h.removeAttribute("src"),h.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),null==(a=this.rendererOptions)||a.emptyTexture.dispose(),null==(o=this.pluginSystem)||o.destroyComposition(this),this.update=function(){e8.error("Update disposed composition: "+e.name+".")},this.dispose=e9,r&&this.keepResource&&r.forEach(function(t){t.dispose=i[t.id],t.dispose()}),this.renderer.env!==aI&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},o.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},o.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},o.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},o.translate=function(t,e,i){this.rootItem.translate(t,e,i)},o.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},o.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},o.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},o.scale=function(t,e,i){this.rootItem.scale(t,e,i)},o.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},o.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},o.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},o.reloadTexture=function(){var t=this;return i(function(){return u(this,function(e){switch(e.label){case 0:if(!t.textureOffloaded)return[3,2];return[4,Promise.all(t.textures.map(function(t){return null==t?void 0:t.reloadData()}))];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}})})()},r.buildItemTree=function(e){for(var i,r=new Map,a=e.getComponent(t.CompositionComponent).items,o=n(a);!(i=o()).done;){var s=i.value;r.set(s.id,s)}for(var u,h=n(a);!(u=h()).done;){var l=u.value;if(void 0===l.parentId)l.setParent(e);else{var c=r.get(l.parentId);if(c)l.setParent(c);else throw Error("The element references a non-existent element, please check the data.")}}},rv(r,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),r}(sN);t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new oX,r.time=-1,r.duration=0,r.start=0,r.endBehavior=tQ.forward,r.type=tj.base,r.components=[],r.isDuringPlay=!1,r.active=!0,r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new sN,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}ib(i,e);var r=i.prototype;return r.on=function(t,e,i){this.eventProcessor.on(t,e,i)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.emit=function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=this.eventProcessor).emit.apply(e,[].concat([t],r))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.setSpeed=function(t){this.speed=t},r.getSpeed=function(){return this.speed},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,i,r=n(this.components);!(i=r()).done;){var o=i.value;if(a(o,t)){e=o;break}}return e},r.getComponents=function(t){for(var e,i=[],r=n(this.components);!(e=r()).done;){var o=e.value;a(o,t)&&i.push(o)}return i},r.setParent=function(t){(t!==this||t)&&(this.parent&&ek(this.parent.children,this),this.parent=t,this.transform.parentTransform=t.transform,t.children.push(this),!this.composition&&t.composition&&(this.composition=t.composition),!this.isDuringPlay&&t.isDuringPlay&&this.beginPlay())},r.setColor=function(t,e,i,r){},r.setOpacity=function(t){},r.setActive=function(t){!!t!==this.active&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,i=n(this.components);!(e=i()).done;)e.value.enabled=t;this.visible=t},r.getVisible=function(){return this.visible},r.getWorldTransform=function(t){var e=null!=t?t:new oX({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,i){this.transform.translate(t,e,i)},r.rotate=function(t,e,i){var r=new nT(t,e,i),n=iQ.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},r.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,a=r.y,o=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/o-1)*n,(1-2*e/s)*a,i)}},r.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},r.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},r.setScale=function(t,e,i){this.transform.setScale(t,e,i)},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.getCurrentPosition=function(){var t=new iK;return this.transform.assignWorldTRS(t),t},r.find=function(t){if(this.name===t)return this;var e=[];e.push.apply(e,[].concat(this.children));for(var i=0;i<e.length;){var r=e[i];if(i++,r.name===t)return r;e.push.apply(e,[].concat(r.children))}},r.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.resetGUID();var e=this.engine.findObject({id:this.defination.id});return e.resetGUID(),this.resetGUID(t),this.composition&&e.setParent(this.composition.rootItem),e},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=n(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},r.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},r.onEnable=function(){this.isEnabled=!0;for(var t,e=n(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,a=n(this.components);!(r=a()).done;){var o=r.value;o.enabled&&!o.isEnableCalled&&o.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=n(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},r.fromData=function(r){e.prototype.fromData.call(this,r);var o=r.id,s=r.name,u=r.delay,h=r.parentId,l=r.endBehavior,c=r.transform,f=r.duration,d=void 0===f?0:f;if(this.props=r,this.type=r.type,this.id=o.toString(),this.name=s,this.start=u||this.start,c&&this.transform.fromData(c),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=h,this.duration=d,this.endBehavior=l,r.content||(r.content={options:{}}),d<0)throw Error("Item duration can't be less than 0, see "+aM["Item duration can't be less than 0"]+".");if(r.components){this.components.length=0;for(var p,m=n(r.components);!(p=m()).done;){var v=p.value,y=this.engine.findObject(v);this.components.push(y),a(y,t.ParticleSystem)&&!this.components.includes(y.renderer)&&this.components.push(y.renderer)}}i.isComposition(this)&&this.instantiatePreComposition()},r.toData=function(){if(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=es.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.defination.parentId=null==(i=this.parent)?void 0:i.guid),!this.defination.components){this.defination.components=[];for(var e,i,r,o=n(this.components);!(r=o()).done;){var s=r.value;a(s,t.EffectComponent)&&this.defination.components.push(s)}}this.defination.content={}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(a),s=o.x,u=o.y;this.transform.translate(2*t*s/r,-2*e*u/n,0)}},r.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=n(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this._composition=null,this.transform.setValid(!1)}},r.resetChildrenParent=function(){for(var t,e,i=n(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&ek(null==(t=this.parent)?void 0:t.children,this)},r.instantiatePreComposition=function(){var e=this.props.content.options.refId,i=this.engine.findEffectsObjectData(e);if(!i)throw Error("Referenced precomposition with Id: "+e+" does not exist.");for(var r,o=i.components,s=n(o);!(r=s()).done;){var u=r.value,h=this.engine.findObject(u);if(h.item=this,this.components.push(h),h.setInstanceId(iu()),a(h,t.CompositionComponent))for(var l,c=n(h.items);!(l=c()).done;){var f=l.value;f.setInstanceId(iu());for(var d,p=n(f.components);!(d=p()).done;)d.value.setInstanceId(iu())}}sk.buildItemTree(this)},r.resetGUID=function(t){var e=null!=(i=null==t?void 0:t.get(this))?i:iu();this.setInstanceId(e);for(var i,r,a=n(this.components);!(r=a()).done;){var o,s=r.value,u=null!=(o=null==t?void 0:t.get(s))?o:iu();s.setInstanceId(u)}for(var h,l=n(this.children);!(h=l()).done;)h.value.resetGUID(t)},r.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=n(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var a,o=n(this.children);!(a=o()).done;)a.value.gatherPreviousObjectID(t)},i.isComposition=function(t){return t.type===tj.composition},i.isSprite=function(t){return t.type===tj.sprite},i.isParticle=function(t){return t.type===tj.particle},i.isNull=function(t){return t.type===tj.null},i.isTree=function(t){return t.type===tj.tree},i.isCamera=function(t){return t.type===tj.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},rv(i,[{key:"content",get:function(){return this._content}},{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=n(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=n(this.components);!(e=i()).done;){var r=e.value;a(r,rx)&&(r.priority=t)}}}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),i}(iI),t.VFXItem=s([iA(es.VFXItemData)],t.VFXItem),t.Item=void 0,(tw=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tw.isComposition=function(t){return t.type===tj.composition},tw.isParticle=function(t){return t.type===tj.particle},tw.isNull=function(t){return t.type===tj.null};var sz=[1,1,1,1],sU=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}ib(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n,o=e.output.getUserData();if(a(o,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(o)),!this.activeMaterial){this.activeMaterial=null==(s=this.activeComponent)?void 0:s.material;var s,u,h=null==(u=this.activeMaterial)?void 0:u.getColor("_Color");h&&(this.startColor=h.toArray())}var l=aK(sz,1),c=this.time/o.duration,f=this.opacityOverLifetime,d=this.colorOverLifetime;d&&(l=eB(d,c,!0),i=!0),f&&(l[3]*=f.getValue(c),i=!0),i&&(aQ(this.renderColor,l,this.startColor),null==(n=this.activeMaterial)||null==(r=n.getColor("_Color"))||r.setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=oM(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tq.GRADIENT_COLOR&&(this.colorOverLifetime=eG(i.color[1]))),this},r.getActiveComponent=function(t){return t.getComponent(aL)},i}(ok),sB=0;t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new sU(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(oU),t.SpriteColorPlayableAsset=s([iA(es.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset);var sG=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sf(t)},e}(t.TrackAsset),sj=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){return new sX(t)},e}(oU),sX=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(ok);function sH(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0}t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).time=0,r.duration=0,r.frameAnimationLoop=!0,r.name="MSprite"+sB++,i&&r.fromData(i),r}ib(i,e);var r=i.prototype;return r.onUpdate=function(t){var e=this,i=this.time,r=this.duration;i>r&&this.frameAnimationLoop&&(i%=r);var n=Math.min(Math.max(i/r,0),1),a=this.textureSheetAnimation,o=this.renderer.texture.source.video;if(o&&(0===i?o.pause():o.play().catch(function(t){e.engine.renderErrors.add(t)}),this.renderer.texture.uploadCurrentVideoFrame()),a){var s,u,h,l,c,f=a.total||a.row*a.col,d=0,p=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],d=y[0],p=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/a.row*m,l=1/a.col*v):(h=1/a.col*m,l=1/a.row*v),a.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/a.col),b=g-x*a.col;c=u?[h*x,l*(a.col-b)]:[h*b,l*(1+x)]}else c=[0,l];null==(s=this.material.getVector4("_TexOffset"))||s.setFromArray([d+c[0],v+p-c[1],h,l])}this.time=i+t/1e3},r.onDisable=function(){e.prototype.onDisable.call(this),this.time=0},r.onDestroy=function(){var e=this.renderer.texture.source;e.sourceType===t.TextureSourceType.video&&(null==e?void 0:e.video)&&(e.video.pause(),e.video.src="",e.video.load())},r.fromData=function(t){e.prototype.fromData.call(this,t);var i,r=t.interaction,n=t.options;this.interaction=r;var a=n.startColor||[1,1,1,1];this.material.setColor("_Color",new rE().setFromArray(a)),this.duration=null!=(i=t.duration)?i:this.item.duration},i}(aL),t.SpriteComponent=s([iA(es.SpriteComponent)],t.SpriteComponent),t.maxSpriteMeshItemCount=8;var sW=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig),sY=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig),sZ=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,i){return this.findCurveValue(t,e)?this.curveValues[t+e].value=i:this.curveValues[t+e]={componentType:t,propertyName:e,value:i},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},t}(),sq=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new sZ(oB(i)),i}return ib(e,t),e}(ok),sK=new nT,sQ=new iK(1,1,1),sJ=new iK,s$=function(e){function i(){return e.apply(this,arguments)}ib(i,e);var r=i.prototype;return r.start=function(){var t,e=this.boundObject,i=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new iK(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=oM(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&oM(r.linearX),y:r.linearY&&oM(r.linearY),z:r.linearZ&&oM(r.linearZ),asMovement:r.asMovement,enabled:!!o});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&oM(r.orbitalX),y:r.orbitalY&&oM(r.orbitalY),z:r.orbitalZ&&oM(r.orbitalZ),center:aq(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&oM(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=oM(a.x||1),this.sizeYOverLifetime=oM(a.y||1),this.sizeZOverLifetime=oM(a.z||1)):this.sizeXOverLifetime=oM(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:oM(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=oM(n.x||0),u.y=oM(n.y||0)}this.gravity=iK.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=oM(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?iK.fromArray(r.direction).normalize():new iK,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(e){if(!this.boundObject){var i=e.output.getUserData();a(i,t.VFXItem)&&(this.boundObject=i,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.boundObject,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){sQ.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(sQ.y=this.sizeYOverLifetime.getValue(r),sQ.z=this.sizeZOverLifetime.getValue(r)):sQ.z=sQ.y=sQ.x;var n=this.originalTransform.scale;e.transform.setScale(sQ.x*n.x,sQ.y*n.y,sQ.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},o=a(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;sK.x=s?a(this.rotationOverLifetime.x):0,sK.y=s?a(this.rotationOverLifetime.y):0,sK.z=o;var u=sK.addEulers(this.originalTransform.rotation,sK);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(aZ(sJ,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&sJ.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(sJ.x,sJ.y,sJ.z))},i}(sq);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new s$(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(oU),t.TransformPlayableAsset=s([iA(es.TransformPlayableAsset)],t.TransformPlayableAsset);var s0=function(e){function i(){return e.apply(this,arguments)}return ib(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();a(i,t.VFXItem)&&(i.time=this.time)},i}(ok);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){return new s0(t)},e}(oU),t.ActivationPlayableAsset=s([iA(es.ActivationPlayableAsset)],t.ActivationPlayableAsset),t.AnimationClip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e}ib(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=iW(e,0,this.duration),a=n(this.positionCurves);!(i=a()).done;){var o=i.value,s=o.keyFrames.getValue(r),u=this.findTarget(t,o.path);null==u||u.transform.setPosition(s.x,s.y,s.z)}for(var h,l=n(this.rotationCurves);!(h=l()).done;){var c=h.value,f=c.keyFrames.getValue(r),d=this.findTarget(t,c.path);null==d||d.transform.setQuaternion(f.x,f.y,f.z,f.w)}for(var p,m=n(this.eulerCurves);!(p=m()).done;){var v=p.value,y=v.keyFrames.getValue(r),g=this.findTarget(t,v.path);null==g||g.transform.setRotation(y.x,y.y,y.z)}for(var x,b=n(this.scaleCurves);!(x=b()).done;){var T=x.value,E=T.keyFrames.getValue(r),_=this.findTarget(t,T.path);null==_||_.transform.setScale(E.x,E.y,E.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=n(t.positionCurves);!(i=r()).done;){var a=i.value,o={path:a.path,keyFrames:oM(a.keyFrames)};e=Math.max(e,o.keyFrames.getMaxTime()),this.positionCurves.push(o)}if(t.rotationCurves)for(var s,u=n(t.rotationCurves);!(s=u()).done;){var h=s.value,l={path:h.path,keyFrames:oM(h.keyFrames)};e=Math.max(e,l.keyFrames.getMaxTime()),this.rotationCurves.push(l)}if(t.eulerCurves)for(var c,f=n(t.eulerCurves);!(c=f()).done;){var d=c.value,p={path:d.path,keyFrames:oM(d.keyFrames)};e=Math.max(e,p.keyFrames.getMaxTime()),this.eulerCurves.push(p)}if(t.scaleCurves)for(var m,v=n(t.scaleCurves);!(m=v()).done;){var y=m.value,g={path:y.path,keyFrames:oM(y.keyFrames)};e=Math.max(e,g.keyFrames.getMaxTime()),this.scaleCurves.push(g)}if(t.floatCurves)for(var x,b=n(t.floatCurves);!(x=b()).done;){var T=x.value,E={path:T.path,keyFrames:oM(T.keyFrames),property:T.property,className:T.className};e=Math.max(e,E.keyFrames.getMaxTime()),this.floatCurves.push(E)}if(t.colorCurves)for(var _,C=n(t.colorCurves);!(_=C()).done;){var S=_.value,A={path:S.path,keyFrames:oM(S.keyFrames),property:S.property,className:S.className};e=Math.max(e,A.keyFrames.getMaxTime()),this.colorCurves.push(A)}void 0!==t.duration?this.duration=t.duration:this.duration=e},i.findTarget=function(t,e){for(var i,r=t,a=e.split("."),o=n(a);!(i=o()).done;){for(var s,u=i.value,h=!1,l=n(r.children);!(s=l()).done;){var c=s.value;if(c.name===u){r=c,h=!0;break}}if(!h)return}return r},e}(iI),t.AnimationClip=s([iA(es.AnimationClip)],t.AnimationClip);var s1=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){return this.set(t.x,t.y),this},e.copyTo=function(t){return t.set(this.x,this.y),t},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},rv(t,null,[{key:"shared",get:function(){return s2.x=0,s2.y=0,s2}}]),t}(),s2=new s1;function s3(t,e,i,r,n,a,o,s){o?(u=r,h=-i):(u=-r,h=i);var u,h,l=t-i*n+u,c=e-r*n+h,f=t+i*a+u,d=e+r*a+h;return s.push(l,c),s.push(f,d),2}function s4(t,e,i,r,n,a,o,s){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,a-e);s&&l<c?l+=2*Math.PI:!s&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.sqrt(u*u+h*h),m=(15*Math.abs(d)*Math.sqrt(p)/Math.PI>>0)+1,v=d/m;if(f+=v,s){o.push(t,e),o.push(i,r);for(var y=1,g=f;y<m;y++,g+=v)o.push(t,e),o.push(t+Math.sin(g)*p,e+Math.cos(g)*p);o.push(t,e),o.push(n,a)}else{o.push(i,r),o.push(t,e);for(var x=1,b=f;x<m;x++,b+=v)o.push(t+Math.sin(b)*p,e+Math.cos(b)*p),o.push(t,e);o.push(n,a),o.push(t,e)}return 2*m}function s5(t,e,i,r,n,a,o,s,u){if(0!==t.length){var h=e.alignment;if(.5!==e.alignment){var l=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],a=t[e-1];r<e;r+=2){var o=t[r],s=t[r+1];i+=(o-n)*(s+a),n=o,a=s}return i<0?-1:1}(t);i&&(l*=-1),h=(h-.5)*l+.5}var c=new s1(t[0],t[1]),f=new s1(t[t.length-2],t[t.length-1]),d=1e-4>Math.abs(c.x-f.x)&&1e-4>Math.abs(c.y-f.y);if(r){t=t.slice(),d&&(t.pop(),t.pop(),f.set(t[t.length-2],t[t.length-1]));var p=(c.x+f.x)*.5,m=(f.y+c.y)*.5;t.unshift(p,m),t.push(p,m)}var v=t.length/2,y=t.length,g=n.length/2,x=e.width/2,b=x*x,T=e.miterLimit*e.miterLimit,E=t[0],_=t[1],C=t[2],S=t[3],A=0,w=0,R=-(_-S),I=E-C,M=0,O=0,P=Math.sqrt(R*R+I*I)+1e-6;R/=P,I/=P,R*=x,I*=x;var N=h,F=(1-N)*2,L=2*N;r||(e.cap===ei.Round?y+=s4(E-R*(F-L)*.5,_-I*(F-L)*.5,E-R*F,_-I*F,E+R*L,_+I*L,n,!0)+2:e.cap===ei.Square&&(y+=s3(E,_,R,I,F,L,!0,n))),n.push(E-R*F,_-I*F),n.push(E+R*L,_+I*L);for(var V=1;V<v-1;++V){E=t[(V-1)*2],_=t[(V-1)*2+1],C=t[2*V],S=t[2*V+1],A=t[(V+1)*2],w=t[(V+1)*2+1],P=Math.sqrt((R=-(_-S))*R+(I=E-C)*I)+1e-6,R/=P,I/=P,R*=x,I*=x,P=Math.sqrt((M=-(S-w))*M+(O=C-A)*O)+1e-6,M/=P,O/=P,M*=x,O*=x;var D=C-E,k=_-S,z=C-A,U=w-S,B=D*z+k*U,G=k*z-U*D,j=G<0;if(Math.abs(G)<.001*Math.abs(B)){n.push(C-R*F,S-I*F),n.push(C+R*L,S+I*L),B>=0&&(e.join===er.Round?y+=s4(C,S,C-R*F,S-I*F,C-M*F,S-O*F,n,!1)+4:y+=2,n.push(C-M*L,S-O*L),n.push(C+M*F,S+O*F));continue}var X=(-R+E)*(-I+S)-(-R+C)*(-I+_),H=(-M+A)*(-O+S)-(-M+C)*(-O+w),W=(D*H-z*X)/G,Y=(U*X-k*H)/G,Z=(W-C)*(W-C)+(Y-S)*(Y-S),q=C+(W-C)*F,K=S+(Y-S)*F,Q=C-(W-C)*L,J=S-(Y-S)*L,$=j?F:L;Z<=Math.min(D*D+k*k,z*z+U*U)+$*$*b?e.join===er.Bevel||Z/b>T?(j?(n.push(q,K),n.push(C+R*L,S+I*L),n.push(q,K),n.push(C+M*L,S+O*L)):(n.push(C-R*F,S-I*F),n.push(Q,J),n.push(C-M*F,S-O*F),n.push(Q,J)),y+=2):e.join===er.Round?j?(n.push(q,K),n.push(C+R*L,S+I*L),y+=s4(C,S,C+R*L,S+I*L,C+M*L,S+O*L,n,!0)+4,n.push(q,K),n.push(C+M*L,S+O*L)):(n.push(C-R*F,S-I*F),n.push(Q,J),y+=s4(C,S,C-R*F,S-I*F,C-M*F,S-O*F,n,!1)+4,n.push(C-M*F,S-O*F),n.push(Q,J)):(n.push(q,K),n.push(Q,J)):(n.push(C-R*F,S-I*F),n.push(C+R*L,S+I*L),e.join===er.Round?j?y+=s4(C,S,C+R*L,S+I*L,C+M*L,S+O*L,n,!0)+2:y+=s4(C,S,C-R*F,S-I*F,C-M*F,S-O*F,n,!1)+2:e.join===er.Miter&&Z/b<=T&&(j?(n.push(Q,J),n.push(Q,J)):(n.push(q,K),n.push(q,K)),y+=2),n.push(C-M*F,S-O*F),n.push(C+M*L,S+O*L),y+=2)}E=t[(v-2)*2],_=t[(v-2)*2+1],C=t[(v-1)*2],P=Math.sqrt((R=-(_-(S=t[(v-1)*2+1])))*R+(I=E-C)*I)+1e-6,R/=P,I/=P,R*=x,I*=x,n.push(C-R*F,S-I*F),n.push(C+R*L,S+I*L),r||(e.cap===ei.Round?y+=s4(C-R*(F-L)*.5,S-I*(F-L)*.5,C-R*F,S-I*F,C+R*L,S+I*L,n,!1)+2:e.cap===ei.Square&&(y+=s3(C,S,R,I,F,L,!1,n)));for(var tt=g;tt<y+g-2;++tt)E=n[2*tt],_=n[2*tt+1],C=n[(tt+1)*2],S=n[(tt+1)*2+1],A=n[(tt+2)*2],1e-8>Math.abs(E*(S-(w=n[(tt+2)*2+1]))+C*(w-_)+A*(_-S))||s.push(tt,tt+1,tt+2)}}var s6=function(){},s8="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s9={exports:{}};!function(t){function e(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function r(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function a(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function s(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function u(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function h(t){var e=p(t.b);return v(e,t.c),v(e.b,t.c),y(e,t.a),e}function l(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,x(e.a,t.a)),e.d!==t.d&&(i=!0,b(e.d,t.d)),m(e,t),r||(v(e,t.a),t.a.c=t),i||(y(e,t.d),t.d.a=t))}function c(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,b(t.d,t.b.d)),t.c===t?x(t.a,null):(t.b.d.a=K(t),t.a.c=t.c,m(t,K(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=K(e),e.a.c=e.c,m(e,K(e))),g(t)}function f(t){var e=p(t),i=e.b;return m(e,t.e),e.a=t.b.a,v(i,e.a),e.d=i.d=t.d,e=e.b,m(t.b,K(t.b)),m(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function d(t,e){var i=!1,r=p(t),n=r.b;return e.d!==t.d&&(i=!0,b(e.d,t.d)),m(r,t.e),m(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||y(r,t.d),r}function p(t){var e=new q,i=new q,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function m(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function v(t,e){var i=e.f,r=new J(e,i);i.e=r,e.f=r,i=r.c=t;do i.a=r,i=i.c;while(i!==t)}function y(t,e){var i=e.d,r=new Z(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do i.d=r,i=i.e;while(i!==t)}function g(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function x(t,e){var i=t.c,r=i;do r.a=e,r=r.c;while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function b(t,e){var i=t.a,r=i;do r.d=e,r=r.e;while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function T(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var E,_=4*1e150;function C(t,e){t.f+=e.f,t.b.f+=e.b.f}function S(t,e,a){return(t=t.a,e=e.a,a=a.a,e.b.a===t)?a.b.a===t?i(e.a,a.a)?0>=n(a.b.a,e.a,a.a):0<=n(e.b.a,a.a,e.a):0>=n(a.b.a,t,a.a):a.b.a===t?0<=n(e.b.a,t,e.a):(e=r(e.b.a,t,e.a))>=(t=r(a.b.a,t,a.a))}function A(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function w(t,e){c(t.a),t.c=!1,t.a=e,e.i=t}function R(t){var e=t.a.a;do t=tl(t);while(t.a.a===e);return t.c&&(e=d(th(t).a.b,t.a.e),w(t,e),t=tl(t)),t}function I(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function M(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function O(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,A(t)}function P(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=th(t),n=r.a;if(n.a!==e.a){if(!r.c){O(t);break}w(r,n=d(e.c.b,n.b))}e.c!==n&&(l(K(n),n),l(e,n)),O(t),e=r.a,t=r}return e}function N(t,e,i,r,n,a){var o=!0;do I(t,e,i.b),i=i.c;while(i!==r);for(null===n&&(n=th(e).a.b.c);(i=(r=th(e)).a.b).a===n.a;)i.c!==n&&(l(K(i),i),l(K(n),i)),r.f=e.f-i.f,r.d=M(t,r.f),e.b=!0,!o&&D(t,e)&&(C(i,n),A(e),c(n)),o=!1,e=r,n=i;e.b=!0,a&&z(t,e)}function F(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(Y(t,100156),t.n=!0):e.d=i[0])}function L(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,F(t,e.a,r,[.5,.5,0,0],!1),l(e,i)}function V(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),s=n+1;r[n]=.5*o/(a+o),r[s]=.5*a/(a+o),t.g[0]+=r[n]*e.g[0]+r[s]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[s]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[s]*i.g[2]}function D(t,r){var a=th(r),o=r.a,s=a.a;if(i(o.a,s.a)){if(0<n(s.b.a,o.a,s.a))return!1;if(e(o.a,s.a)){if(o.a!==s.a){var a=t.e,u=o.a.h;if(0<=u){var a=a.b,h=a.d,c=a.e,d=a.c,p=d[u];h[p]=h[a.a],d[h[p]]=p,p<=--a.a&&(1>=p?to(a,p):i(c[h[p>>1]],c[h[p]])?to(a,p):ts(a,p)),c[u]=null,d[u]=a.b,a.b=u}else for(a.c[-(u+1)]=null;0<a.a&&null===a.c[a.d[a.a-1]];)--a.a;L(t,K(s),o)}}else f(s.b),l(o,K(s)),r.b=a.b=!0}else{if(0>n(o.b.a,s.a,o.a))return!1;tl(r).b=r.b=!0,f(o.b),l(K(s),o)}return!0}function k(t,h){var c=th(h),d=h.a,p=c.a,m=d.a,v=p.a,y=d.b.a,g=p.b.a,x=new J;if(n(y,t.a,m),n(g,t.a,v),m===v||Math.min(m.a,y.a)>Math.max(v.a,g.a))return!1;if(i(m,v)){if(0<n(g,m,v))return!1}else if(0>n(y,v,m))return!1;var b,T,E=y,_=m,C=g,S=v;if(i(E,_)||(b=E,E=_,_=b),i(C,S)||(b=C,C=S,S=b),i(E,C)||(b=E,E=C,C=b,b=_,_=S,S=b),i(C,_)?i(_,S)?(0>(b=r(E,C,_))+(T=r(C,_,S))&&(b=-b,T=-T),x.b=u(b,C.b,T,_.b)):(0>(b=n(E,C,_))+(T=-n(E,S,_))&&(b=-b,T=-T),x.b=u(b,C.b,T,S.b)):x.b=(C.b+_.b)/2,a(E,_)||(b=E,E=_,_=b),a(C,S)||(b=C,C=S,S=b),a(E,C)||(b=E,E=C,C=b,b=_,_=S,S=b),a(C,_)?a(_,S)?(0>(b=o(E,C,_))+(T=o(C,_,S))&&(b=-b,T=-T),x.a=u(b,C.a,T,_.a)):(0>(b=s(E,C,_))+(T=-s(E,S,_))&&(b=-b,T=-T),x.a=u(b,C.a,T,S.a)):x.a=(C.a+_.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=i(m,v)?m:v,i(E,x)&&(x.b=E.b,x.a=E.a),e(x,m)||e(x,v))return D(t,h),!1;if(!e(y,t.a)&&0<=n(y,t.a,x)||!e(g,t.a)&&0>=n(g,t.a,x)){if(g===t.a)return f(d.b),l(p.b,d),d=th(h=R(h)).a,P(t,th(h),c),N(t,h,K(d),d,d,!0),!0;if(y===t.a){f(p.b),l(d.e,K(p)),v=(m=c=h).a.b.a;do m=tl(m);while(m.a.b.a===v);return m=th(h=m).a.b.c,c.a=K(p),p=P(t,c,null),N(t,h,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(tl(h).b=h.b=!0,f(d.b),d.a.b=t.a.b,d.a.a=t.a.a),0>=n(g,t.a,x)&&(h.b=c.b=!0,f(p.b),p.a.b=t.a.b,p.a.a=t.a.a),!1}return f(d.b),f(p.b),l(K(p),d),d.a.b=x.b,d.a.a=x.a,d.a.h=tt(t.e,d.a),d=d.a,p=[0,0,0,0],x=[m.d,y.d,v.d,g.d],d.g[0]=d.g[1]=d.g[2]=0,V(d,m,y,p,0),V(d,v,g,p,2),F(t,d,x,p,!0),tl(h).b=h.b=c.b=!0,!1}function z(t,e){for(var r=th(e);;){for(;r.b;)e=r,r=th(r);if(!e.b&&(r=e,null===(e=tl(e))||!e.b))break;e.b=!1;var a,o=e.a,s=r.a;if(a=o.b.a!==s.b.a)t:{var u=th(a=e),h=a.a,d=u.a,p=void 0;if(i(h.b.a,d.b.a)){if(0>n(h.b.a,d.b.a,h.a)){a=!1;break t}tl(a).b=a.b=!0,p=f(h),l(d.b,p),p.d.c=a.d}else{if(0<n(d.b.a,h.b.a,d.a)){a=!1;break t}a.b=u.b=!0,p=f(d),l(h.e,d.b),p.b.d.c=a.d}a=!0}if(a&&(r.c?(A(r),c(s),s=(r=th(e)).a):e.c&&(A(e),c(o),o=(e=tl(r)).a)),o.a!==s.a){if(o.b.a===s.b.a||e.c||r.c||o.b.a!==t.a&&s.b.a!==t.a)D(t,e);else if(k(t,e))break}o.a===s.a&&o.b.a===s.b.a&&(C(s,o),A(e),c(o),e=tl(r))}}function U(t,e){var i=new tu,r=h(t.b);r.a.b=_,r.a.a=e,r.b.a.b=-_,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=G(r=t.f,r.a,i),i.e=r}function B(t){this.a=new j,this.b=t,this.c=S}function G(t,e,i){do e=e.c;while(null!==e.b&&!t.c(t.b,e.b,i));return t=new j(i,e.a,e),e.a.c=t,e.a=t}function j(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function X(){this.d=H,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var H=0;function W(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case H:Y(t,100151),t.u(null);break;case 1:Y(t,100152),t.t()}else switch(t.d){case 2:Y(t,100154),t.v();break;case 1:Y(t,100153),t.w()}}function Y(t,e){t.p&&t.p(e,t.c)}function Z(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function q(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function K(t){return t.b.e}function Q(){this.c=new J,this.a=new Z,this.b=new q,this.d=new q,this.b.b=this.d,this.d.b=this.b}function J(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function $(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ti}function tt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=tr(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&ts(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function te(t){if(0===t.a)return ta(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&i(tn(t.b),e))return ta(t.b);do--t.a;while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function ti(){this.d=tr([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function tr(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function tn(t){return t.e[t.d[1]]}function ta(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&to(t,1)),a}function to(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[s],n[h])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function ts(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o>>1,h=r[u];if(0===u||i(n[h],n[s])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function tu(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function th(t){return t.e.c.b}function tl(t){return t.e.a.b}(E=X.prototype).x=function(){W(this,H)},E.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:this.s=e;return}break;case 100141:this.m=!!e;return;default:Y(this,100900);return}Y(this,100901)},E.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Y(this,100900)}return!1},E.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},E.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:Y(this,100900)}},E.C=function(t,e){var i=!1,r=[0,0,0];W(this,2);for(var n=0;3>n;++n){var a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}i&&Y(this,100155),null===(i=this.q)?l(i=h(this.b),i.b):(f(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},E.u=function(t){W(this,H),this.d=1,this.b=new Q,this.c=t},E.t=function(){W(this,1),this.d=2,this.q=null},E.v=function(){W(this,2),this.d=1},E.w=function(){W(this,1),this.d=H;var t,r,a=this.j[0],o=this.j[1],s=this.j[2],u=!1,h=[a,o,s];if(0===a&&0===o&&0===s){for(var o=[-2*1e150,-2*1e150,-2*1e150],p=[2*1e150,2*1e150,2*1e150],s=[],v=[],u=this.b.c,a=u.e;a!==u;a=a.e)for(var y=0;3>y;++y){var b=a.g[y];b<p[y]&&(p[y]=b,v[y]=a),b>o[y]&&(o[y]=b,s[y]=a)}if(a=0,o[1]-p[1]>o[0]-p[0]&&(a=1),o[2]-p[2]>o[a]-p[a]&&(a=2),p[a]>=o[a])h[0]=0,h[1]=0,h[2]=1;else{for(o=0,p=v[a],s=s[a],v=[0,0,0],p=[p.g[0]-s.g[0],p.g[1]-s.g[1],p.g[2]-s.g[2]],y=[0,0,0],a=u.e;a!==u;a=a.e)y[0]=a.g[0]-s.g[0],y[1]=a.g[1]-s.g[1],y[2]=a.g[2]-s.g[2],v[0]=p[1]*y[2]-p[2]*y[1],v[1]=p[2]*y[0]-p[0]*y[2],v[2]=p[0]*y[1]-p[1]*y[0],(b=v[0]*v[0]+v[1]*v[1]+v[2]*v[2])>o&&(o=b,h[0]=v[0],h[1]=v[1],h[2]=v[2]);0>=o&&(h[0]=h[1]=h[2]=0,h[T(p)]=1)}u=!0}for(v=T(h),a=this.b.c,o=(v+1)%3,s=(v+2)%3,v=0<h[v]?1:-1,h=a.e;h!==a;h=h.e)h.b=h.g[o],h.a=v*h.g[s];if(u){for(h=0,a=(u=this.b.a).b;a!==u;a=a.b)if(!(0>=(o=a.a).f))do h+=(o.a.b-o.b.a.b)*(o.a.a+o.b.a.a),o=o.e;while(o!==a.a);if(0>h)for(u=(h=this.b.c).e;u!==h;u=u.e)u.a=-u.a}for(this.n=!1,a=(h=this.b.b).h;a!==h;a=u)u=a.h,o=a.e,e(a.a,a.b.a)&&a.e.e!==a&&(L(this,o,a),c(a),o=(a=o).e),o.e===a&&(o!==a&&((o===u||o===u.b)&&(u=u.h),c(o)),(a===u||a===u.b)&&(u=u.h),c(a));for(this.e=h=new $,a=(u=this.b.c).e;a!==u;a=a.e)a.h=tt(h,a);for(function(t){t.d=[];for(var e,r=0;r<t.a;r++)t.d[r]=r;t.d.sort((e=t.c,function(t,r){return i(e[t],e[r])?1:-1})),t.e=!0,function(t){for(var e=t.a;1<=e;--e)to(t,e);t.h=!0}(t.b)}(h),this.f=new B(this),U(this,-_),U(this,_);null!==(h=te(this.e));){for(;;){t:if(0===(a=this.e).a)u=tn(a.b);else if(u=a.c[a.d[a.a-1]],0!==a.b.a&&i(a=tn(a.b),u)){u=a;break t}if(null===u||!e(u,h))break;u=te(this.e),L(this,h.c,u.c)}!function t(r,a){r.a=a;for(var o=a.c;null===o.i;)if((o=o.c)===a.c){var o=r,s=a,u=new tu;u.a=s.c.b;var h=o.f,p=h.a;do p=p.a;while(null!==p.b&&!h.c(h.b,u,p.b));var h=p.b,m=th(h),u=h.a,p=m.a;if(0===n(u.b.a,s,u.a))e((u=h.a).a,s)||e(u.b.a,s)||(f(u.b),h.c&&(c(u.c),h.c=!1),l(s.c,u),t(o,s));else{var v=i(p.b.a,u.b.a)?h:m,m=void 0;h.d||v.c?(m=v===h?d(s.c.b,u.e):d(p.b.c.b,s.c).b,v.c?w(v,m):(u=o,(h=I(o,h,m)).f=tl(h).f+h.a.f,h.d=M(u,h.f)),t(o,s)):N(o,h,s.c,s.c,null,!0)}return}if(h=(u=th(o=R(o.i))).a,(u=P(r,u,null)).c===h){var h=u,u=h.c,p=th(o),m=o.a,v=p.a,y=!1;m.b.a!==v.b.a&&k(r,o),e(m.a,r.a)&&(l(K(u),m),u=th(o=R(o)).a,P(r,th(o),p),y=!0),e(v.a,r.a)&&(l(h,K(v)),h=P(r,p,null),y=!0),y?N(r,o,h.c,u,u,!0):(s=i(v.a,m.a)?K(v):m,N(r,o,s=d(h.c.b,s),s.c,s.c,!1),s.b.i.c=!0,z(r,o))}else N(r,o,u.c,h,h,!0)}(this,h)}for(h=0,this.a=this.f.a.a.b.a.a;null!==(u=this.f.a.a.b);)u.h||++h,A(u);for(this.f=null,(h=this.e).b=null,h.d=null,this.e=h.c=null,a=(h=this.b).a.b;a!==h.a;a=u)u=a.b,(a=a.a).e.e===a&&(C(a.c,a),c(a));if(!this.n){if(h=this.b,this.m)for(a=h.b.h;a!==h.b;a=u)u=a.h,a.b.d.c!==a.d.c?a.f=a.d.c?1:-1:c(a);else for(a=h.a.b;a!==h.a;a=u)if(u=a.b,a.c){for(a=a.a;i(a.b.a,a.a);a=a.c.b);for(;i(a.a,a.b.a);a=a.e);for(o=a.c.b,s=void 0;a.e!==o;)if(i(a.b.a,o.a)){for(;o.e!==a&&(i((t=o.e).b.a,t.a)||0>=n(o.a,o.b.a,o.e.b.a));)o=(s=d(o.e,o)).b;o=o.c.b}else{for(;o.e!==a&&(i((r=a.c.b).a,r.b.a)||0<=n(a.b.a,a.a,a.c.b.a));)a=(s=d(a,a.c.b)).b;a=a.e}for(;o.e.e!==a;)o=(s=d(o.e,o)).b}if(this.h||this.i||this.k||this.l){if(this.m){for(u=(h=this.b).a.b;u!==h.a;u=u.b)if(u.c){this.h&&this.h(2,this.c),a=u.a;do this.k&&this.k(a.a.d,this.c),a=a.e;while(a!==u.a);this.i&&this.i(this.c)}}else{for(h=this.b,u=!!this.l,a=!1,o=-1,s=h.a.d;s!==h.a;s=s.d)if(s.c){a||(this.h&&this.h(4,this.c),a=!0),v=s.a;do u&&o!==(p=v.b.d.c?0:1)&&(o=p,this.l&&this.l(!!o,this.c)),this.k&&this.k(v.a.d,this.c),v=v.e;while(v!==s.a)}a&&this.i&&this.i(this.c)}}if(this.r){for(a=(h=this.b).a.b;a!==h.a;a=u)if(u=a.b,!a.c){s=(o=a.a).e,v=void 0;do s=(v=s).e,v.d=null,null===v.b.d&&(v.c===v?x(v.a,null):(v.a.c=v.c,m(v,K(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,K(p))),g(v));while(v!==o);o=a.d,(a=a.b).d=o,o.b=a}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null},s8.libtess={GluTesselator:X,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},X.prototype.gluDeleteTess=X.prototype.x,X.prototype.gluTessProperty=X.prototype.B,X.prototype.gluGetTessProperty=X.prototype.y,X.prototype.gluTessNormal=X.prototype.A,X.prototype.gluTessCallback=X.prototype.z,X.prototype.gluTessVertex=X.prototype.C,X.prototype.gluTessBeginPolygon=X.prototype.u,X.prototype.gluTessBeginContour=X.prototype.t,X.prototype.gluTessEndContour=X.prototype.v,X.prototype.gluTessEndPolygon=X.prototype.w,t.exports=s8.libtess}(s9);var s7=((tR=new s9.exports.GluTesselator).gluTessCallback(s9.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),tR.gluTessCallback(s9.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==s9.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),tR.gluTessCallback(s9.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),tR.gluTessCallback(s9.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),tR.gluTessCallback(s9.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),tR);function ut(t){s7.gluTessNormal(0,0,1);var e=[];s7.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){s7.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];s7.gluTessVertex(a,a)}s7.gluTessEndContour()}return s7.gluTessEndPolygon(),e}var ue=function(t){function e(){for(var e,i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];(e=t.call(this)||this).points=[],e.closePath=!1;var a=Array.isArray(r[0])?r[0]:r;if("number"!=typeof a[0]){for(var o=[],s=0,u=a.length;s<u;s++)o.push(a[s].x,a[s].y);a=o}return e.points=a,e.closePath=!0,e}ib(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,a=r-1;n<r;a=n++){var o=this.points[2*n],s=this.points[2*n+1],u=this.points[2*a],h=this.points[2*a+1];s>e!=h>e&&t<(e-s)/(h-s)*(u-o)+o&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){var a=ut([t]),o=e.length/2;0===a.length&&this.getLineEndPointsTriangle(t,a);for(var s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw Error("Invalid points array");if(2===t.length){e.push(t[0],t[1],t[0],t[1],t[0],t[1]);return}var i=t[2]-t[0],r=t[3]-t[1],n=t[0],a=t[1],o=t[0],s=t[1];if(Math.abs(i)>=Math.abs(r))for(var u=0;u<t.length;u+=2){var h=t[u],l=t[u+1];h<n&&(n=h,a=l),h>o&&(o=h,s=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<a&&(n=f,a=d),d>s&&(o=f,s=d)}e.push(n,a,o,s,o,s)},rv(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(s6);function ui(t,e,i,r,n,a,o,s,u,h){var l=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function t(e,i,r,n,a,o,s,u,h,l,c){if(!(c>8)){var f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+o)/2,v=(a+s)/2,y=(o+u)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(m+y)/2,E=(g+b)/2,_=(x+T)/2;if(c>0){var C=s-e,S=u-i,A=Math.abs((r-s)*S-(n-u)*C),w=Math.abs((a-s)*S-(o-u)*C);if(A>11920929e-14&&w>11920929e-14){if((A+w)*(A+w)<=l*(C*C+S*S)){h.push(E,_);return}}else if(A>11920929e-14){if(A*A<=l*(C*C+S*S)){h.push(E,_);return}}else if(w>11920929e-14){if(w*w<=l*(C*C+S*S)){h.push(E,_);return}}else if((C=E-(e+s)/2)*C+(S=_-(i+u)/2)*S<=l){h.push(E,_);return}}t(e,i,f,d,g,x,E,_,h,l,c+1),t(E,_,b,T,v,y,s,u,h,l,c+1)}}(e,i,r,n,a,o,s,u,t,l*=l,0),t.push(s,u),t}var ur=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}ib(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var a=i/2,o=r-a,s=n-a,u=r+a,h=n+a,l=t-this.x,c=e-this.y;return l*l/(o*o)+c*c/(s*s)>1&&l*l/(u*u)+c*c/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var a=Math.ceil(5*Math.sqrt(r+n)),o=8*a+0+0;if(0===o)return t;if(0===a)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var s=0,u=4*a+0+2,h=u,l=o,c=0+r,f=0,d=e+c,p=e-c,m=i+0;t[s++]=d,t[s++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<a;v++){var y=Math.PI/2*(v/a),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,_=i-x;t[s++]=b,t[s++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--l]=_,t[--l]=b}c=0,f=0+n,d=e+c,p=e-c,m=i+f;var C=i-f;return t[s++]=d,t[s++]=m,t[--l]=C,t[--l]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(s6);t.StarType=void 0,(tI=t.StarType||(t.StarType={}))[tI.Star=0]="Star",tI[tI.Polygon=1]="Polygon";var un=function(t){function e(e,i,r,n,a,o){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(s=t.call(this)||this).pointCount=e,s.outerRadius=i,s.innerRadius=r,s.outerRoundness=n,s.innerRoundness=a,s.starType=o,s.v=[],s.in=[],s.out=[],s}ib(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)ui(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var i=this.v.length-1;ui(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var a=ut([t]),o=e.length/2,s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),a=2*Math.PI/n,o=!0,s=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*s/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){e=o?s:u,i=o?h:l,r=o?c:f;var p=e*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,o=!o,d+=1*a}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,a=2*Math.PI*r/(4*e),o=-(.5*Math.PI);for(t=0;t<e;t++){var s=r*Math.cos(o),u=r*Math.sin(o),h=0===s&&0===u?0:u/Math.sqrt(s*s+u*u),l=0===s&&0===u?0:-s/Math.sqrt(s*s+u*u),c=2*t;this.v[c]=s,this.v[c+1]=u,this.in[c]=s+h*a*n*1,this.in[c+1]=u+l*a*n*1,this.out[c]=s-h*a*n*1,this.out[c+1]=u-l*a*n*1,o+=1*i}},e}(s6),ua=function(t){function e(e,i,r,n,a){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=20),(o=t.call(this)||this).x=e,o.y=i,o.width=r,o.height=n,o.roundness=a,o}ib(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t){var e,i=this.width/2,r=this.height/2,n=this.x+i,a=this.y+r,o=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(i,r)),s=i-o,u=r-e;if(o>=0&&e>=0&&s>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(o+e)),l=8*h+(s?4:0)+(u?4:0);if(0!==l){if(0===h){t[0]=t[6]=n+s,t[1]=t[3]=a+u,t[2]=t[4]=n-s,t[5]=t[7]=a-u;return}var c=0,f=4*h+(s?2:0)+2,d=f,p=l,m=s+o,v=u,y=n+m,g=n-m,x=a+v;if(t[c++]=y,t[c++]=x,t[--f]=x,t[--f]=g,u){var b=a-v;t[d++]=g,t[d++]=b,t[--p]=b,t[--p]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),_=s+Math.cos(E)*o,C=u+Math.sin(E)*e,S=n+_,A=n-_,w=a+C,R=a-C;t[c++]=S,t[c++]=w,t[--f]=w,t[--f]=A,t[d++]=A,t[d++]=R,t[--p]=R,t[--p]=S}m=s,v=u+e,y=n+m,g=n-m,x=a+v;var I=a-v;t[c++]=y,t[c++]=x,t[--p]=I,t[--p]=y,s&&(t[c++]=g,t[c++]=x,t[--p]=I,t[--p]=g)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(s6),uo=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=this.graphicsPath,i=n(e.instructions);!(t=i()).done;){var r=t.value,a=r.action,o=r.data;switch(a){case"bezierCurveTo":this.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5],o[6]);break;case"moveTo":this.moveTo(o[0],o[1]);break;case"ellipse":this.ellipse(o[0],o[1],o[2],o[3],o[4]);break;case"polyStar":this.polyStar(o[0],o[1],o[2],o[3],o[4],o[5],o[6]);break;case"rect":this.rect(o[0],o[1],o[2],o[3],o[4]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,o){this.ensurePoly();var s=this.currentPoly;return ui(s.points,s.lastX,s.lastY,t,e,i,r,n,a,o),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new ur(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,a,o){return this.drawShape(new un(t,e,i,r,n,a),o),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new ua(t,e,i,r,n),a),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new ue).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new ue,this.currentPoly.points.push(0,0))},t}(),us=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,o]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,a){return this.instructions.push({action:"rect",data:[t,e,i,r,n,a]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,a,o){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,a,o]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},rv(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new uo(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function uu(t,e){return e&&("object"===o(e)||"function"==typeof e)?e:oB(t)}var uh=new(function(){function t(){this.elements=[]}var e=t.prototype;return e.dispose=function(){this.elements.forEach(function(t){return t.remove()}),this.elements.length=0},e.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return e4(t),t}if(oJ[oQ])return window._createOffscreenCanvas(10,10);var e=document.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?eD(this.elements,t):t.remove()},t}()),ul=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?t6.clip:r,a=t.textBaseline,o=void 0===a?t8.top:a,s=t.textAlign,u=void 0===s?t9.left:s,h=t.text,l=t.letterSpace,c=void 0===l?0:l,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=(void 0===h?" ":h).length*(d+c),this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.letterSpace=c,this.overflow=n,this.textBaseline=o,this.textAlign=u,this.lineHeight=void 0===p?d:p}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,a=t.fontScale,o=(i-r)/3,s=r+n*a,u=i*(e-1),h=0;switch(this.textBaseline){case t8.top:h=s+o;break;case t8.middle:h=(this.height*a-u+s)/2;break;case t8.bottom:h=this.height*a-u-o}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case t9.left:i=t.outlineWidth*t.fontScale;break;case t9.middle:i=(this.width*t.fontScale-e)/2;break;case t9.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),uc=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,a,o,s=t.textColor,u=t.fontSize,h=t.outline,l=t.shadow,c=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,this.textWeight=void 0===c?"normal":c,this.fontStyle=void 0===f?"normal":f,this.fontFamily=void 0===d?"sans-serif":d,this.fontSize=void 0===u?40:u,h&&(this.isOutlined=!0,this.outlineColor=null!=(e=h.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=h.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),l&&(this.hasShadow=!0,this.shadowBlur=null!=(r=l.shadowBlur)?r:2,this.shadowColor=null!=(n=l.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(a=l.shadowOffsetX)?a:0,this.shadowOffsetY=null!=(o=l.shadowOffsetY)?o:0),this.fontStyle!==et.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},uf=["serif","sans-serif","monospace","courier"],ud=0;t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.maxLineWidth=0,r.SCALE_FACTOR=.1,r.ALPHA_FIX_VALUE=1/255,r.name="MText"+ud++,i&&r.fromData(i),r.canvas=uh.getCanvas(),uh.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return uu(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}ib(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new rE(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(aL),t.TextComponent=s([iA(es.TextComponent)],t.TextComponent);var up=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new uc(t),this.textLayout=new ul(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var i=this.context,r=this.textLayout,n=r.letterSpace,a=r.overflow,o=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,s=this.textLayout.width+this.textStyle.fontOffset,u=1,h=0,l=0;l<t.length;l++){var c,f,d=t[l],p=(null!=(f=null==i?void 0:null==(c=i.measureText(d))?void 0:c.width)?f:0)*o;h+=n,a===t6.display?"\n"===d?(u++,h=0):(h+=p,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+p>s&&l>0||"\n"===d)&&(u++,this.maxLineWidth=Math.max(this.maxLineWidth,h),h=0),"\n"!==d&&(h+=p))}return u},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){if(this.textStyle.fontFamily===t&&!e5(t)){console.warn("The font is either the current font or an risky font family.");return}this.textStyle.fontFamily=t,this.isDirty=!0},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,i=this.textStyle,r=this.textLayout,n=i.fontScale,a=(r.width+i.fontOffset)*n,o=r.lineHeight*this.lineCount,s=i.fontSize*n,u=r.lineHeight*n;i.fontDesc=this.getFontDesc(s),this.char=(this.text||"").split(""),this.canvas.width=a,r.autoWidth?(this.canvas.height=o*n,this.item.transform.size.set(1,o/r.height)):this.canvas.height=r.height*n;var h=this.canvas.height;e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),this.maxLineWidth>a&&r.overflow===t6.display?e.font=this.getFontDesc(s*a/this.maxLineWidth):e.font=i.fontDesc,e.clearRect(0,0,a,h),i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var l=[],c=0,f=r.getOffsetY(i,this.lineCount,u,s),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((c+=r.letterSpace*n)+y.width>a&&m>0||"\n"===v)&&(l.push({y:f,width:c,chars:d,charOffsetX:p}),c=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(c),c+=y.width)}l.push({y:f,width:c,chars:d,charOffsetX:p}),l.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,a){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[a],t.y),e.fillText(r,n+t.charOffsetX[a],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=r4.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:rw.LINEAR,minFilter:rw.LINEAR,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE});this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontScale,n=e.fontFamily,a=e.textWeight,o=e.fontStyle,s=""+(t||i*r).toString()+"px ";return uf.includes(n)?s+=n:s+='"'+n+'"',a!==t7.normal&&(s=a+" "+s),o!==et.normal&&(s=o+" "+s),s},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],a=i[1],o=i[2],s=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*a+", "+255*o+", "+s+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,o=i[0],s=i[1],u=i[2],h=i[3];t&&(t.shadowColor="rgba("+255*o+", "+255*s+", "+255*u+", "+h+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-a)},t}();il(t.TextComponent,[up]);var um=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig),uv=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iI);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iI),s([iR(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=s([iA(es.BinaryAsset)],t.BinaryAsset);var uy=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=iw(e);if(r)for(var a,o=n(Object.keys(r));!(a=o()).done;){var s=a.value,u=e[s];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(u)?i[s]=u:it(u)?(i[s]||(i[s]=[]),t.serializeArrayProperty(u,i[s],0)):iI.is(u)?i[s]={id:u.getInstanceId()}:ii(u)&&(i[s]||(i[s]={}),t.serializeObjectProperty(u,i[s],0))}for(var h,l=n(Object.keys(e.defination));!(h=l()).done;){var c=h.value,f=e.defination[c];"number"==typeof f||"string"==typeof f||"boolean"==typeof f||t.checkTypedArray(f)?i[c]=f:it(f)?(i[c]||(i[c]=[]),t.serializeArrayProperty(f,i[c],0)):iI.is(f)?i[c]={id:f.getInstanceId()}:ii(f)&&(i[c]||(i[c]={}),t.serializeObjectProperty(f,i[c],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=iw(i),a=i.engine;if(r)for(var o,s=n(Object.keys(r));!(o=s()).done;){var u=o.value,h=e[u];if(void 0!==h){var l=r[u].type;i[u]=t.deserializeProperty(h,a,0,l)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return a(t,Int8Array)||a(t,Uint8Array)||a(t,Uint8ClampedArray)||a(t,Int16Array)||a(t,Uint16Array)||a(t,Int32Array)||a(t,Uint32Array)||a(t,Float32Array)||a(t,Float64Array)||a(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(ii(t)&&1===Object.keys(t).length&&"id"in t&&e7(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return ii(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return ia(t)||a(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,a,o){if(void 0===o&&(o=!0),r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(it(e)){for(var s,u=[],h=n(e);!(s=h()).done;){var l=s.value;u.push(t.deserializeProperty(l,i,r+1,a,o))}return u}if(t.checkDataPath(e)){var c=i.findObject(e);return o?c:e}if(!ir(e))return e;f=a?new a:{};for(var f,d,p=n(Object.keys(e));!(d=p()).done;){var m=d.value;f[m]=t.deserializeProperty(e[m],i,r+1,void 0,o)}return f},t.serializeObjectProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i={});for(var a,o=n(Object.keys(e));!(a=o()).done;){var s=a.value,u=e[s];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(e)?i[s]=u:it(u)?(i[s]||(i[s]=[]),t.serializeArrayProperty(u,i[s],r+1)):iI.is(u)?i[s]={id:u.getInstanceId()}:ii(u)&&(i[s]||(i[s]={}),t.serializeObjectProperty(u,i[s],r+1))}},t.serializeArrayProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i=[]);for(var n=0;n<e.length;n++){var a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:it(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):iI.is(a)?i[n]={id:a.getInstanceId()}:ii(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}},t}(),ug=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(!r){console.error("Object data with uuid: "+i+" not found.");return}switch(r.dataType){case es.Material:e=no.create(this.engine);break;case es.Geometry:e=nx.create(this.engine);break;case es.Texture:e=r4.create(this.engine);break;default:var n=iS[r.dataType];n&&(e=new n(this.engine))}if(!e){console.error("Constructor for DataType: "+r.dataType+" not found.");return}return e.setInstanceId(r.id),this.engine.addInstance(e),uy.deserialize(r,e),e},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),ux=function(){function t(){}return t.prototype.loadGUID=function(t){return i(function(){return u(this,function(t){return[2,void 0]})})()},t}();function ub(t,e){if(!t.includes(e))return t.push(e),!0}function uT(t){if(Number.isFinite(t))return[tq.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tq.CONSTANT)return[tq.CONSTANT,t[1]];if("lines"===e)return[tq.LINE,t[1]];if(e===tq.LINE){var r=i.map(function(t){return[tK.LINE,t]});return[tq.BEZIER_CURVE,r]}return"curve"===e||e===tq.CURVE?[tq.BEZIER_CURVE,uk(i)]:t}}function uE(t,e){return Array.isArray(t)&&"random"===t[0]?[tq.CONSTANT,t[1][e]]:uT(t)}function u_(t){return t&&"color"===t[0]?uA(t[1],!0):[1,1,1,1]}function uC(t){return t&&"random"===t[0]?[tq.RANDOM,t[1]]:uT(t)}function uS(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,a=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,o=uA(t[r],e);i.push([a,o[0],o[1],o[2],o[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tq.GRADIENT_COLOR,i]}}function uA(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else a(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=uw(i)),i}function uw(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function uR(t,e){return Array.isArray(t)?t[0]===tq.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&uS(t[1],e):uS(t,e)}function uI(t){if(t){if(3===t.length)return[tq.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tq.BEZIER_PATH||e===tq.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=uk(r);if(!a){a=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&a.push(u),a.push(u)}}return[tq.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function uM(t){for(var e,i=n(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function uO(t){for(var e,i=n(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var uP=Math.cos,uN=Math.sin,uF=Math.PI/180,uL=180/Math.PI;function uV(t,e){return t?[t[0]-.5,.5-t[1]]:e?uD[e]:[0,0]}var uD=((e_={})[tH.PARTICLE_ORIGIN_CENTER]=[0,0],e_[tH.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],e_[tH.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],e_[tH.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],e_[tH.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],e_[tH.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],e_[tH.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],e_[tH.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],e_[tH.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],e_);function uk(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],a=0;a<t.length-1;a++){var o=t[a][3]*(e-i),s=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],h=[t[a+1][0],t[a+1][1]];if(u[0]!=h[0]){var l=function(t,e,i,r){var n=i[0],a=i[1],o=r[0],s=r[1],u=o-n;return[[n+(o-n)/3,a+(t*=u)/3],[o-(o-n)/3,s-(e*=u)/3]]}(o,s,u,h),c=l[0],f=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map(function(t,e){return 0===e?[tK.EASE_OUT,t]:e===n.length-1?[tK.EASE_IN,t]:[tK.EASE,t]})}function uz(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tj.null&&t.endBehavior===tQ.destroy&&(t.endBehavior=tQ.freeze)})}),t.version=tF["2_1"],t}var uU=new Map,uB=new Map;function uG(t){for(var e,i=n(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===es.ShapeComponent&&r.type===ee.Custom){(null==(a=r.shapes)?void 0:a.length)>0&&r.shapes[0].fill&&(r.fill=r.shapes[0].fill);for(var a,o,s=Array(r.easingIns.length),u=Array(r.easingOuts.length).fill(!1),h=n(r.shapes);!(o=h()).done;)for(var l,c=o.value,f=n(c.indexes);!(l=f()).done;){var d=l.value,p=r.points[d.point],m=r.easingIns[d.easingIn],v=r.easingOuts[d.easingOut];s[d.easingIn]||(m.x-=p.x,m.y-=p.y,s[d.easingIn]=!0),u[d.easingOut]||(v.x-=p.x,v.y-=p.y,u[d.easingOut]=!0)}}}return t.version=tF["3_2"],t}function uj(e){uU.clear(),uB.clear();for(var i,r=e.compositions,a=e.items,o=e.components,s=n(o);!(i=s()).done;){var u=i.value;uU.set(u.id,u)}for(var h,l=n(a);!(h=l()).done;){var c=h.value;uB.set(c.id,c)}for(var f,d=n(r);!(f=d()).done;)!function(e){for(var i,r=n(e.items);!(i=r()).done;){var a=i.value,o=uB.get(a.id);if(!o)return;if(o.type===tj.sprite||o.type===tj.particle||o.type===tj.spine||o.type===tj.text||o.type===tj.richtext||o.type===tj.video||o.type===tj.shape){var s=uU.get(o.components[0].id);s&&function(e){var i=e.renderer,r=null==i?void 0:i.maskMode;r&&r!==t.MaskMode.NONE&&(r===t.MaskMode.MASK?(e.mask={isMask:!0},eC=e.id):(r===tk.OBSCURED||r===tk.REVERSE_OBSCURED)&&(e.mask={inverted:r===tk.REVERSE_OBSCURED,reference:{id:eC}}))}(s)}}}(f.value);return e.version=tF["3_3"],e}function uX(t){null==(e=t.plugins)||e.forEach(function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")});for(var e,i,r=n(t.items);!(i=r()).done;){var a=i.value;if(a.type===tj.sprite){var o=uU.get(a.components[0].id);if(o){var s=o.renderer.shape,u=void 0;u=Number.isInteger(s)?t.shapes[s]:s,o.renderer.shape=u}}}for(var h,l=t.compositionId,c={},f=n(t.compositions);!(h=f()).done;){var d=h.value,p=iu();c[d.id]=p,d.id===l&&(t.compositionId=p),d.id=p;var m={id:iu(),dataType:"CompositionComponent",items:d.items,timelineAsset:d.timelineAsset,sceneBindings:d.sceneBindings};d.timelineAsset=void 0,d.sceneBindings=void 0,d.components=[{id:m.id}],t.components.push(m)}for(var v,y=n(t.items);!(v=y()).done;){var g=v.value;if(g.content){var x=g.content.options;x&&void 0!==x.refId&&(x.refId=c[x.refId])}}return t.version=tF["3_4"],t}function uH(t){for(var e,i=iB({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=n(i.images);!(e=r()).done;)e.value.id=iu();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=iu(),t.dataType=es.Texture,t.source={id:null==(e=i.images[t.source])?void 0:e.id}}),i.textures.length<i.images.length)for(var a=i.textures.length;a<i.images.length;a++)i.textures.push({id:iu(),dataType:es.Texture,source:{id:i.images[a].id},flipY:!0});t.bins&&(o=t.bins,i.bins=o.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:iu()}}));for(var o,s,u={},h={},l=n(t.compositions);!(s=l()).done;)!function(){var t=s.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=tQ.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tj.particle&&t.content.filter&&delete t.content.filter});for(var e,r=n(t.items);!(e=r()).done;){var a=e.value;u[a.id]=iu(),a.oldId=a.id,a.id=u[a.id],h[a.id]=a}t.items.forEach(function(e,r){if(e.parentId){if(e.parentId.includes("^")){var n=e.parentId.split("^")[0],a=e.parentId.split("^")[1];e.parentId=u[n]+"^"+a}else e.parentId=u[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var o=iB({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(o),function(t,e,i){for(var r,a=[],o=[],s=[],u={tracks:[],id:iu(),dataType:"TimelineAsset"},h=n(t.items);!(r=h()).done;){var l=e[r.value.id],c=[],f={id:iu(),dataType:"ActivationPlayableAsset"};s.push(f);var d={id:iu(),dataType:"ActivationTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:f.id}}]};if(c.push({id:d.id}),o.push(d),l.type!==tj.particle){var p={id:iu(),dataType:"TransformPlayableAsset",sizeOverLifetime:l.content.sizeOverLifetime,rotationOverLifetime:l.content.rotationOverLifetime,positionOverLifetime:l.content.positionOverLifetime};s.push(p);var m={id:iu(),dataType:"TransformTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:p.id}}]};c.push({id:m.id}),o.push(m)}if(l.type===tj.sprite||l.type===tj.text){var v={id:iu(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:l.content.colorOverLifetime};s.push(v);var y={id:iu(),dataType:"SpriteColorTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:v.id}}]};c.push({id:y.id}),o.push(y)}if(l.type===tj.composition){var g={id:iu(),dataType:"SubCompositionPlayableAsset"};s.push(g);var x={id:iu(),dataType:"SubCompositionTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:g.id}}]};c.push({id:x.id}),o.push(x)}var b={id:iu(),dataType:"ObjectBindingTrack",children:c,clips:[]};o.push(b),u.tracks.push({id:b.id}),a.push({key:{id:b.id},value:{id:l.id}})}for(var T,E=[],_=n(o);!(T=_()).done;){var C=T.value;E.push({id:C.id})}t.timelineAsset={id:u.id},t.sceneBindings=a,i.miscs.push(u);for(var S,A=n(o);!(S=A()).done;){var w=S.value;i.miscs.push(w)}for(var R,I=n(s);!(R=I()).done;){var M=R.value;i.miscs.push(M)}}(o,h,i)}();for(var c,f=n(i.items);!(c=f()).done;){var d=c.value;if(d.content){if(d.content.renderer&&void 0!==d.content.renderer.texture){var p=d.content.renderer.texture;d.content.renderer.texture={id:i.textures[p].id}}if(d.content.trails&&void 0!==d.content.trails.texture){var m=d.content.trails.texture;d.content.trails.texture={id:i.textures[m].id}}}if(d.transform){var v=[].concat(null!=(x=d.transform.position)?x:[0,0,0]),y=[].concat(null!=(b=d.transform.rotation)?b:[0,0,0]),g=[].concat(null!=(T=d.transform.scale)?T:[1,1,1]);if(Object.assign(d,{transform:{position:{x:v[0],y:v[1],z:v[2]},eulerHint:{x:y[0],y:y[1],z:y[2]},scale:{x:g[0],y:g[1],z:g[0]}}}),d.type===tj.sprite&&(d.transform.size={x:g[0],y:g[1]},d.transform.scale={x:1,y:1,z:1}),d.type===tj.sprite){var x,b,T,E,_,C,S,A=d.content;A.renderer||(A.renderer={});var w=A.renderer,R=uV(w.anchor,w.particleOrigin),I=d.transform.size;w.anchor||void 0===w.particleOrigin||(d.transform.position.x+=-R[0]*(null!=(E=null==I?void 0:I.x)?E:1),d.transform.position.y+=-R[1]*(null!=(_=null==I?void 0:I.y)?_:1)),d.transform.anchor={x:R[0]*(null!=(C=null==I?void 0:I.x)?C:1),y:R[1]*(null!=(S=null==I?void 0:I.y)?S:1)}}}if(d.type===tj.particle){var M=d.content;M.renderer||(M.renderer={});var O=M.renderer;M.renderer.anchor=uV(O.anchor,O.particleOrigin)}if(d.type===tj.camera&&d.content.positionOverLifetime&&0!==Object.keys(d.content.positionOverLifetime).length&&(d.content.positionOverLifetime.asMovement=!0),void 0!==d.pn){var P=d.pn,N=t.plugins,F=void 0===N?[]:N;void 0!==P&&Number.isInteger(P)&&(d.pluginName=F[P])}switch("editor-gizmo"===d.pluginName&&(d.type="editor-gizmo"),"orientation-transformer"===d.pluginName&&(d.type="orientation-transformer"),d.content.options.target&&"editor-gizmo"===d.pluginName&&(d.content.options.target=u[d.content.options.target]),d.type===tj.spine&&t.spines&&0!==t.spines.length&&function(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:i.textures[t].id}})}}(t.spines[d.content.options.spine],d.content,i),(d.type===tj.sprite||d.type===tj.particle||d.type===tj.mesh||d.type===tj.skybox||d.type===tj.light||"camera"===d.type||d.type===tj.tree||d.type===tj.interact||d.type===tj.camera||d.type===tj.text||d.type===tj.spine||"editor-gizmo"===d.type||"orientation-transformer"===d.type)&&(d.components=[],i.components.push(d.content),d.content.id=iu(),d.content.item={id:d.id},d.dataType=es.VFXItemData,d.components.push({id:d.content.id})),(d.type===tj.null||d.type===tj.composition)&&(d.components=[],d.dataType=es.VFXItemData),d.type){case tj.sprite:d.content.dataType=es.SpriteComponent;break;case tj.particle:d.content.dataType=es.ParticleSystem;break;case tj.mesh:d.content.dataType=es.MeshComponent;break;case tj.skybox:d.content.dataType=es.SkyboxComponent;break;case tj.light:d.content.dataType=es.LightComponent;break;case"camera":d.content.dataType=es.CameraComponent;break;case"editor-gizmo":d.content.dataType="GizmoComponent";break;case"orientation-transformer":d.content.dataType="OrientationComponent";break;case tj.tree:d.content.dataType=es.TreeComponent;break;case tj.interact:d.content.dataType=es.InteractComponent;break;case tj.camera:d.content.dataType=es.CameraController;break;case tj.text:d.content.dataType=es.TextComponent;break;case tj.spine:d.content.dataType=es.SpineComponent}}return i.version=tF["3_0"],i}function uW(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:uI(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:uT(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:uT(n.linearX),linearY:uT(n.linearY),linearZ:uT(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:uT(n.orbitalX),orbitalY:uT(n.orbitalY),orbitalZ:uT(n.orbitalZ),speedOverLifetime:uT(n.speedOverLifetime)};uO(a);var o={options:{startColor:u_(r.startColor)},positionOverLifetime:a};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var s=t.rotationOverLifetime;if(s){var u=o.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=uT(s.x),u.y=uT(s.y),u.z=uT(s.z)):u.z=uT(s.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=o.colorOverLifetime={opacity:uT(h.opacity)};h.color&&(l.color=uR(h.color))}var c=t.sizeOverLifetime;return c&&(o.sizeOverLifetime={separateAxes:c.separateAxes,size:uT(c.size),x:uT(c.x),y:uT(c.y),z:uT(c.z)}),o}var uY="2.6.4",uZ=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,uq=/^(\d+)\.(\d+)$/,uK=!1;function uQ(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(function(t){var e=(t.playerVersion||{}).web,i=void 0===e?"":e;if(i){var r,n,a=null!=(r=uZ.exec(i))?r:[],o=null!=(n=uZ.exec(uY))?n:[],s=a[1],u=a[2],h=o[1],l=o[2];return Number(h)<Number(s)||Number(h)===Number(s)&&Number(l)<Number(u)}return!1}(t)&&console.warn("The JSON need higher than "+(null==(p=t.playerVersion)?void 0:p.web)+" runtime version(current: "+uY+"). Some features may not work as expected."),!(d=null==(f=(c=t).version)?void 0:f.split("."))||Number(d[0])>2||2===Number(d[0])&&Number(d[1])>=2||c.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tj.mesh||t.type===tj.light)&&(t.endBehavior=1===t.endBehavior?tQ.destroy:t.endBehavior)})}),uZ.test(t.version)){var e,i,r,a,o,s,u,h;return uK=(null==(m=/^(\d+)/.exec(t.version))?void 0:m[0])==="0",uX(uj(uG(uH(uz((e=t,uJ=tF["1_0"],a=e.plugins||[],(null==(i=e.bins)?void 0:i.length)&&(uJ=tF["1_3"]),o=(e.requires||[]).slice(),s=e.images.map(function(t,i){return u$(t,i,e.imageTags||[])}),u=e.textures||s.map(function(t,e){return{source:e,flipY:!0}}),h={plugins:a,shapes:e.shapes||[],type:"ge",version:uJ,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return u0(t,{plugins:a,requires:o})}),images:s,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:u,bins:(e.bins||[]).slice()},e._textures&&(h._textures=e._textures),h))))))}uK=!1;var l,c,f,d,p,m,v=uq.exec(t.version)||[],y=Number(v[1]),g=Number(v[2]);if(y)return(y<2||2===y&&g<4)&&((l=t).compositions.map(function(t){for(var e,i=n(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=n(Object.keys(e));!(i=r()).done;){var a=i.value,o=e[a],s=Array.isArray(o);s&&2===o.length&&Array.isArray(o[1])?"path"===a?e[a]=uI(o):e[a]=uT(o):s||"object"!=typeof o||t(o)}})(e.value.content)}),t=l),y<3&&(t=uH(uz(t))),y=Number((v=uq.exec(t.version)||[])[1]),g=Number(v[2]),y<4&&(g<2&&(t=uG(t)),g<3&&(t=uj(t)),g<4&&(t=uX(t))),t;throw Error("Invalid JSON version: "+t.version+".")}var uJ=tF["1_0"];function u$(t,e,i){var r=i[e];if("string"==typeof t)return{id:iu(),renderLevel:r,url:t};if(t.template)return{id:iu(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:iu(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:iu(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function u0(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iB({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return u2(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var u1=[0,0,0,1];function u2(t,e){void 0===e&&(e={});var i=tj.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tj.plugin,m=t.pn,p=t.pluginName,f=t.content,c=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),l=t.transform||b(c.transform)):t.particle?(i=tj.particle,l=b((c=t.particle).transform,uK,!0),f=function(t){var e=t.options,i=t.transform,r={type:tz.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iB({},t.shape,{type:tz[a]}),t.shape.upDirection){var o=t.shape.upDirection,s=o[0],u=o[1],h=o[2];0===s&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=uC(e.turbulenceX),r.turbulenceY=uC(e.turbulenceY),r.turbulenceZ=uC(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map(function(t){return uM(t)})),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map(function(t){return uM(t)})),l.rateOverTime&&(l.rateOverTime=uC(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:uC(e.startLifetime),start3DSize:!!e.start3DSize,startSize:uC(e.startSize),startSizeX:uC(e.startSizeX),startSizeY:uC(e.startSizeY),sizeAspect:uC(e.sizeAspect),maxCount:e.maxCount,startDelay:uC(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tq.COLORS,t[1].map(function(t){return uA(t,e)})]:"gradient"===t[0]?uS(t[1],e):"color"===t[0]?[tq.RGBA_COLOR,uA(t[1],e)]:t}(e.startColor,!0),startRotationZ:uC(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=uC(e.startRotationX),c.options.startRotationY=uC(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:uI(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:uC(f.x),y:uC(f.y)}:c.sizeOverLifetime={size:uC(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?uT(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:uT(e.gravityModifier),startSpeed:uC(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:uC(d.linearX),linearY:uC(d.linearY),linearZ:uC(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:uC(d.orbitalX),orbitalY:uC(d.orbitalY),orbitalZ:uC(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:uT(d.forceCurve)},uO(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:uC(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=uT(m.y),c.rotationOverLifetime.x=uT(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:uT(v.opacity)};v.color&&(y.color=uR(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:uT(g.cycles),animationDelay:uE(g.animationDelay,0),animationDuration:uE(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:uC(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:uT(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&uR(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&uR(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:uC(x.opacityOverLifetime)}),c.trails&&uO(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(c)):t.sprite?(i=tj.sprite,l=b((c=t.sprite).transform,!1,!0),s=uW(o=c,l),(u=o.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=o.renderer,o.splits&&(s.splits=o.splits),o.interaction&&(s.interaction=o.interaction),f=s):t.cal?(i=tj.null,l=b((c=t.cal).transform,!1,!0),f=uW(c,l)):t.ui?(i=tj.interact,l=b((c=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tB.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&u_(i.previewColor),behavior:i.behavior||tG.NOTIFY};break;case"drag":e={type:tB.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tB.MESSAGE}}return{options:e}}(c),l.scale=[c.options.width||1,c.options.height||1,1]):t.model&&(c=t.model,1===t.model.options.type&&(i=tj.camera,l=b(c.transform),f=function(t){var e=t.options,i={options:{fov:e.fov,far:e.far,near:e.near,clipMode:e.clipMode}},r=t.velocityOverLifetime;if(r||(null==(n=t.transform)?void 0:n.path)){var n,a,o={path:uI(null==(a=t.transform)?void 0:a.path),linearX:uT(null==r?void 0:r.translateX),linearY:uT(null==r?void 0:r.translateY),linearZ:uT(null==r?void 0:r.translateZ)};uO(o),i.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:uT(null==s?void 0:s.rotateX),y:uT(null==s?void 0:s.rotateY),z:s.separateAxes?uT(null==s?void 0:s.rotateZ):uT(s.rotation)};uO(u),i.rotationOverLifetime=u}return i}(c))),null==(h=f.renderer)?void 0:h.anchor){var a=new Float32Array(f.renderer.anchor);.5==a[0]&&.5==a[1]?delete f.renderer.anchor:e.requires&&ub(e.requires,"anchor")}if(c){var o,s,u,h,l,c,f,d,p,m,v,y,g=null==(v=c.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tQ.restart:tQ.destroy:tQ.restart:r||(null==c?void 0:null==(y=c.options)?void 0:y.endBehavior)||tQ.destroy,c.options.renderLevel&&(d=c.options.renderLevel),isNaN(n)&&(n=c.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:l,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(ub(e.plugins,p),x.pn=e.plugins.indexOf(p)):x.pluginName=p:Number.isInteger(m)&&(x.pn=m),t.parentId&&(x.parentId=t.parentId+""),x;function b(t,e,i){if(t){var r={},n=t.rotation;if(n&&(e?r.rotation=[-n[0],-n[1],-n[2]]:r.rotation=[n[0],n[1],n[2]],i)){var a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,C,S,A,w,R,I=(a=r.rotation[0],o=r.rotation[1],s=r.rotation[2],u=uP(a*uF/2),h=uP(o*uF/2),l=uP(s*uF/2),c=uN(a*uF/2),f=uN(o*uF/2),d=uN(s*uF/2),u1[0]=c*h*l+u*f*d,u1[1]=u*f*l-c*h*d,u1[2]=u*h*d+c*f*l,u1[3]=u*h*l-c*f*d,u1);r.rotation=(p=[],m=I[0],v=I[1],y=I[2],g=I[3],x=m+m,b=v+v,T=y+y,E=m*x,_=v*x,C=v*b,S=y*T,A=g*T,w=y*x-g*b,p[1]=Math.asin((R=-w)>1?1:R<-1?-1:R)*uL,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*b+g*x,1-E-C)*uL,p[2]=Math.atan2(_+A,1-C-S)*uL):(p[0]=0,p[2]=Math.atan2(-(_-A),1-E-S)*uL),p)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}return{}}}var u3=((eS={})[tL.S]=[tL.S,tL.BPlus,tL.APlus],eS[tL.A]=[tL.A,tL.BPlus,tL.APlus],eS[tL.B]=[tL.B,tL.BPlus],eS);function u4(t,e){if(!t||!e)return!0;var i=u3[e];return!!i&&i.includes(t)}function u5(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,o=n.url;return a&&(e&&e[a]?i=e[a]:o&&(i=o)),i}function u6(t,e,i){return u8.apply(this,arguments)}function u8(){return(u8=i(function(t,e,i){var r,n;return u(this,function(o){switch(o.label){case 0:if("string"!=typeof t)return[3,2];return[4,rX(t)];case 1:return r=o.sent(),[3,3];case 2:r=t,o.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=u5(e,i)){if(e7(n)&&n!==r.src)return[2,rX(n)];if(a(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}t.Scene=void 0,(tM=t.Scene||(t.Scene={})).isJSONObject=function(t){return ii(t)&&"jsonScene"in t},tM.isURL=function(t){return ii(t)&&"url"in t},tM.isWithOptions=function(t){return ii(t)&&"options"in t};var u9=1,u7=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new rD),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=u9++,this.timers=[],this.updateOptions(t)}var r=e.prototype;return r.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout;this.timeout=void 0===e?10:e},r.loadScene=function(e,r,n){var a=this;return i(function(){var o,s,h,l,c,f,d,p,m,v,y,g;return u(this,function(x){return s=e7(e)?e:a.id,h=performance.now(),l=[],d=null!=(f=null==(c=null==r?void 0:r.engine.gpuCapability)?void 0:c.detail.compressedTexture)?f:t.COMPRESSED_TEXTURE.NONE,p={},v=!1,y=new Promise(function(t,e){m=window.setTimeout(function(){v=!0,a.removeTimer(m),e(Error("Load time out: totalTime: "+(performance.now()-h).toFixed(4)+"ms "+l.join(" ")+", url: "+s+"."))},1e3*a.timeout),a.timers.push(m)}),g=i(function(t,e){var i,r,n;return u(this,function(a){switch(a.label){case 0:if(v)return[3,4];i=performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e()];case 2:return r=a.sent(),n=performance.now()-i,l.push("["+t+": "+n.toFixed(2)+"]"),p[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+a.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([y,i(function(){var i,r,c,f,v,y,x,b,T,E,_,C,S,A;return u(this,function(u){switch(u.label){case 0:if(!e7(e))return[3,2];return r=new URL(e,location.href).href,a.baseUrl=r,[4,g("loadJSON",function(){return a.loadJSON(r)})];case 1:return e7(o=u.sent())&&(o=JSON.parse(o)),[3,3];case 2:o=e,a.baseUrl=location.href,u.label=3;case 3:if(!t.Scene.isJSONObject(o))return[3,4];return i=iB({},o),[3,9];case 4:return[4,g("processJSON",function(){return a.processJSON(o)})];case 5:return f=(c=u.sent()).jsonScene,v=c.pluginSystem,x=void 0===(y=f.bins)?[]:y,b=f.images,T=f.fonts,[4,Promise.all([g("processBins",function(){return a.processBins(x)}),g("processImages",function(){return a.processImages(b,d)}),g("plugin:processAssets",function(){return a.processPluginAssets(f,v,n)}),g("processFontURL",function(){return a.processFontURL(T)})])];case 6:return _=(E=u.sent())[0],C=E[1],[4,g("processTextures",function(){return a.processTextures(C,_,f)})];case 7:return S=u.sent(),i={timeInfos:p,url:e,renderLevel:a.options.renderLevel,storage:{},pluginSystem:v,jsonScene:f,bins:_,textureOptions:S,textures:[],images:C,assets:a.assets},[4,g("plugin:prepareResource",function(){return v.loadResources(i,a.options)})];case 8:u.sent(),u.label=9;case 9:return A=performance.now()-h,e8.info("Load asset: totalTime: "+A.toFixed(4)+"ms "+l.join(" ")+", url: "+s+"."),window.clearTimeout(m),a.removeTimer(m),i.totalTime=A,i.startTime=h,i.timeInfos=p,[2,i]}})})()])]})})()},r.getAssets=function(){return this.assets},r.processJSON=function(t){var e=this;return i(function(){var i,r,n;return u(this,function(a){switch(a.label){case 0:return[4,(n=new iv(void 0===(r=(i=uQ(t)).plugins)?[]:r)).processRawJSON(i,e.options)];case 1:return a.sent(),[2,{jsonScene:i,pluginSystem:n}]}})})()},r.processBins=function(t){var e=this;return i(function(){var i,r;return u(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(a(n,ArrayBuffer))return n;if(u4(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},r.processFontURL=function(t){var r=this;return i(function(){return u(this,function(n){return t?[2,Promise.all(t.map(i(function(t){var i,n,a;return u(this,function(o){switch(o.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];e5(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),i=new URL(t.fontURL,r.baseUrl).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+i+")")).load()];case 2:return o.sent(),document.fonts.add(a),e.fontCache.add(t.fontFamily),[3,4];case 3:return o.sent(),e8.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},r.processImages=function(e,r){void 0===r&&(r=0);var n=this;return i(function(){var o,s,h,l,c,f,d;return u(this,function(p){switch(p.label){case 0:return s=(o=n.options).useCompressedTexture,h=o.variables,l=o.disableWebP,c=o.disableAVIF,f=n.baseUrl,[4,Promise.all(e.map(i(function(e,i){var o,d,p,m,v,y,g,x,b,T,E,_,C,S,A,w,R,I,M,O,P;return u(this,function(i){switch(i.label){case 0:if(o=e.url,d=e.webp,p=e.avif,m=new URL(o,f).href,v=!l&&d?new URL(d,f).href:void 0,y=!c&&p?new URL(p,f).href:void 0,g=e.id,!("template"in e))return[3,8];if(!(b=(x=e.template).background))return[3,7];T=u5(x,h),E=b.type===ea.video,_=b&&E?rq:rX,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,rQ(T,_)];case 2:if(!a(C=i.sent(),HTMLVideoElement))return[3,3];return n.sourceFrom[g]={url:C.src,type:t.TextureSourceType.video},[2,C];case 3:return b&&Array.isArray(T)&&h&&(h[b.name]=C.src),n.sourceFrom[g]={url:C.src,type:t.TextureSourceType.image},[4,u6(C,x,h)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw S=i.sent(),Error("Failed to load. Check the template or if the URL is "+(E?"video":"image")+" type, URL: "+T+", Error: "+(S.message||S)+".");case 7:return[3,9];case 8:if("compressed"in e&&s&&r){if(A=e.compressed,r===t.COMPRESSED_TEXTURE.ASTC?w=A.astc:r===t.COMPRESSED_TEXTURE.PVRTC&&(w=A.pvrtc),w)return R=new URL(w,f).href,n.sourceFrom[g]={url:R,type:t.TextureSourceType.compressed},[2,n.loadBins(R)]}else if(a(e,HTMLImageElement)||a(e,HTMLCanvasElement)||a(e,HTMLVideoElement)||a(e,r4))return[2,e];i.label=9;case 9:if(!y)return[3,11];return[4,rG(m,y)];case 10:return P=i.sent(),[3,13];case 11:return[4,rU(m,v)];case 12:P=i.sent(),i.label=13;case 13:return M=(I=P).url,O=I.image,n.sourceFrom[g]={url:M,type:t.TextureSourceType.image},[2,O]}})})))];case 1:return d=p.sent(),n.assignImagesToAssets(e,d),[2,d]}})})()},r.processPluginAssets=function(t,e,r){var n=this;return i(function(){var i,a,o,s;return u(this,function(u){switch(u.label){case 0:return[4,e.processAssets(t,r)];case 1:for(a=(i=u.sent().reduce(function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t},{assets:[],loadedAssets:[]})).assets,o=i.loadedAssets,s=0;s<a.length;s++)n.assets[a[s].id]=o[s];return[2]}})})()},r.processTextures=function(e,r,n){var o=this;return i(function(){var s;return u(this,function(h){return[2,Promise.all((null!=(s=n.textures)?s:e.map(function(t,e){return{source:e}})).map(i(function(e,i){var s,h,l,c,f;return u(this,function(u){switch(u.label){case 0:if(a(e,r4))return[2,e];if(!("mipmaps"in e))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,r$(e,r,o.assets,n.bins)];case 2:return[2,u.sent()];case 3:throw Error("Load texture "+i+" fails, error message: "+u.sent()+".");case 4:if(s=e.source,h=e.id,c="",!ii(s))return[3,5];return l=o.assets[s.id],c=s.id,[3,7];case 5:if("string"!=typeof s)return[3,7];return[4,rX(ih(s))];case 6:l=u.sent(),u.label=7;case 7:if(l)return[2,(f=function(e,i,r){var n={id:r,dataType:es.Texture};if(a(e,r4))return iB({},e.source,n);if(a(e,HTMLImageElement)||ia(e))return iB({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:rw.LINEAR,magFilter:rw.LINEAR},n);if(a(e,HTMLVideoElement))return iB({sourceType:t.TextureSourceType.video,video:e,minFilter:rw.LINEAR,magFilter:rw.LINEAR},n);if(a(e,ArrayBuffer))return iB({},nt(e),{sourceFrom:i},n);if("width"in e&&"height"in e&&"data"in e)return iB({sourceType:t.TextureSourceType.data,data:e,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE,minFilter:rw.NEAREST,magFilter:rw.NEAREST},n);throw Error("Invalid texture options.")}(l,o.sourceFrom[c],h)).sourceType===t.TextureSourceType.compressed?f:iB({},f,e)];throw Error("Invalid texture source: "+s+".")}})})))]})})()},r.loadJSON=function(t){var e=this;return i(function(){return u(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadJSON(t,i,function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},r.loadBins=function(t){var e=this;return i(function(){return u(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadBinary(t,i,function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},r.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},r.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},r.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e}();u7.fontCache=new Set;var ht=function(){function e(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(r8(t))}var i=e.prototype;return i.assembleSceneLoadOptions=function(e,i){void 0===i&&(i={});var r=e;return t.Scene.isURL(e)&&(t.Scene.isJSONObject(e)||(r=e.url),t.Scene.isWithOptions(e)&&(i=iB({},i,e.options))),{source:r,options:i}},i.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach(function(t){if(t.type===tj.text||t.type===tj.richtext){var r=e[t.name];r&&t.components.forEach(function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);((null==n?void 0:n.dataType)===es.TextComponent||(null==n?void 0:n.dataType)===es.RichTextComponent)&&(n.options.text=r)})}})},i.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++)t.textures[e]=this.engine.findObject({id:t.textureOptions[e].id}),t.textures[e].initialize()},i.prepareAssets=function(t,e){this.engine.clearResources();for(var i,r=n(Object.keys(e));!(i=r()).done;){var a=i.value,o=e[a],s=new uv(this.engine);s.data=o,s.setInstanceId(a)}this.engine.addPackageDatas(t);for(var u,h=n(this.builtinObjects);!(u=h()).done;){var l=u.value;this.engine.addInstance(l)}},i.createShaderVariant=function(){for(var t,e=n(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];a(r,no)&&r.createShaderVariant()}},i.destroyBuiltinObjects=function(){for(var t,e=n(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},i.dispose=function(){this.destroyBuiltinObjects()},e}(),he=new Int32Array(2),hi=new Float32Array(he.buffer),hr=new Float64Array(he.buffer),hn=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tO=eA||(eA={}))[tO.UTF8_BYTES=1]="UTF8_BYTES",tO[tO.UTF16_STRING=2]="UTF16_STRING";var ha=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return he[0]=this.readInt32(t),hi[0]},e.readFloat64=function(t){return he[hn?0:1]=this.readInt32(t),he[hn?1:0]=this.readInt32(t+4),hr[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){hi[0]=e,this.writeInt32(t,he[0])},e.writeFloat64=function(t,e){hr[0]=e,this.writeInt32(t,he[hn?0:1]),this.writeInt32(t+4,he[hn?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===eA.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),ho=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=ha.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=~(this.bb.capacity()-this.space+i)+1&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(i+2)*2;this.addInt16(r);var n=0,a=this.space;e:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(o)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(a+s)!=this.bb.readInt16(o+s))continue e;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){if(this.prep(this.minalign,8+r),4!=e.length)throw TypeError("FlatBuffers: file identifier must be length 4");for(var n=3;n>=0;n--)this.writeInt8(e.charCodeAt(n))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){var e;return null==t?0:(a(t,Uint8Array)?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null!==r)e.push(this.createObjectOffset(r));else throw TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=ha.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),hs=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new hu(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),hu=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=hs.createDataVector(t,this.data);return hs.createFBEffectsObjectData(t,e,i)},t}(),hh=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new hs).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new hl(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),hl=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=hh.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return hh.createFBEffectsPackageData(t,e)},t}(),hc=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new hf(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),hf=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return hc.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),hd=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new hp(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,a,o){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),hp=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return hd.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),hm=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new hd).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new hv(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),hv=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=hm.createChannelsVector(t,t.createObjectOffsetList(this.channels));return hm.createFBVertexData(t,this.vertexCount,e)},t}(),hy=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new hm).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new hc).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new hg(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),hg=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=[]),void 0===o&&(o=0),void 0===s&&(s=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===l&&(l=null),void 0===c&&(c=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=a,this.mode=o,this.buffer=s,this.binaryData=u,this.boneNames=h,this.rootBoneName=l,this.inverseBindMatrices=c}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=hy.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=hy.createBinaryDataVector(t,this.binaryData),s=hy.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=hy.createInverseBindMatricesVector(t,this.inverseBindMatrices);return hy.startFBGeometryData(t),hy.addId(t,e),hy.addName(t,i),hy.addVertexData(t,r),hy.addIndexFormat(t,this.indexFormat),hy.addIndexOffset(t,this.indexOffset),hy.addSubMeshes(t,n),hy.addMode(t,this.mode),hy.addBuffer(t,a),hy.addBinaryData(t,o),hy.addBoneNames(t,s),hy.addRootBoneName(t,u),hy.addInverseBindMatrices(t,h),hy.endFBGeometryData(t)},t}(),hx=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new ho(1),i=new hl,r=[],a=n(this.exportObjectDatas);!(t=a()).done;){var o=t.value,s=void 0;o.dataType===es.Geometry&&(s=new hu("Geometry",this.geometryDataToBinary(o))),s&&r.push(s)}return i.exportObjects=r,hh.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new ha(t),i=hh.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),o=n.dataType();if(a){var s=void 0;o===es.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new ho(1),i=new hg,r=t.indexFormat,a=t.indexOffset,o=t.mode,s=t.id,u=t.vertexData,h=t.boneNames,l=t.rootBoneName,c=t.inverseBindMatrices,f=t.binaryData;i.indexFormat=r,i.indexOffset=a,i.mode=o,i.id=s,i.boneNames=void 0===h?[]:h,i.rootBoneName=void 0===l?"":l,i.inverseBindMatrices=void 0===c?[]:c,i.binaryData=void 0===f?[]:f;var d=new hv;d.vertexCount=u.vertexCount,d.channels=[];for(var p,m=n(u.channels);!(p=m()).done;){var v=p.value,y=new hp(v.semantic,v.offset,v.format,v.dimension,v.normalize);d.channels.push(y)}i.vertexData=d;for(var g,x=[],b=n(t.subMeshes);!(g=b()).done;){var T=g.value,E=new hf(T.offset,T.indexCount,T.vertexCount);x.push(E)}return i.subMeshes=x,hh.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,a=new ha(t),o=hy.getRootAsFBGeometryData(a),s={vertexCount:0,channels:[]},u=o.vertexData();if(u){s.vertexCount=u.vertexCount();for(var h=0;h<u.channelsLength();h++){var l,c=u.channels(h);if(c){var f={semantic:null!=(l=c.semantic())?l:"",offset:c.offset(),format:c.format(),dimension:c.dimension(),normalize:c.normalize()};s.channels.push(f)}}}for(var d=[],p=0;p<o.subMeshesLength();p++){var m=o.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<o.boneNamesLength();g++){var x=o.boneNames(g);y.push(x)}var b=o.inverseBindMatricesArray();return{vertexData:s,indexFormat:o.indexFormat(),indexOffset:o.indexOffset(),subMeshes:d,mode:o.mode(),buffer:null!=(e=o.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=o.rootBoneName())?i:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(r=o.binaryDataArray())?r:void 0,id:null!=(n=o.id())?n:"",dataType:es.Geometry}},t}(),hb=function(){function t(){this.renderErrors=new Set,this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new ug(this),this.emptyTexture=r8(this),this.transparentTexture=r9(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.findObject=function(t){return ir(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,a=i.items,o=i.materials,s=i.shaders,u=i.geometries,h=i.components,l=i.animations,c=i.bins,f=void 0===c?[]:c,d=i.miscs,p=i.compositions,m=n(p);!(e=m()).done;){var v=e.value;this.addEffectsObjectData(v)}for(var y,g=n(void 0===a?[]:a);!(y=g()).done;){var x=y.value;u4(x.renderLevel,t.renderLevel)||(x.components=[],x.type=tj.null),this.addEffectsObjectData(x)}for(var b,T=n(void 0===o?[]:o);!(b=T()).done;){var E=b.value;this.addEffectsObjectData(E)}for(var _,C=n(void 0===s?[]:s);!(_=C()).done;){var S=_.value;this.addEffectsObjectData(S)}for(var A,w=n(void 0===u?[]:u);!(A=w()).done;){var R=A.value;this.addEffectsObjectData(R)}for(var I,M=n(void 0===h?[]:h);!(I=M()).done;){var O=I.value;this.addEffectsObjectData(O)}for(var P,N=n(void 0===l?[]:l);!(P=N()).done;){var F=P.value;this.addEffectsObjectData(F)}for(var L,V=n(void 0===d?[]:d);!(L=V()).done;){var D=L.value;this.addEffectsObjectData(D)}for(var k=0;k<f.length;k++){var z=f[k],U=t.bins[k];if(z.dataType===es.BinaryAsset)z.buffer=U,z.id&&this.addEffectsObjectData(z);else{var B=new hx;B.deserializeFromBinary(new Uint8Array(U));for(var G,j=n(B.exportObjectDatas);!(G=j()).done;){var X=G.value;this.addEffectsObjectData(X)}}}for(var H,W=n(void 0===r?[]:r);!(H=W()).done;){var Y=H.value;this.addEffectsObjectData(Y)}},e.createVFXItems=function(t){var e=this;return i(function(){var i,r,a,o;return u(this,function(s){for(i=n(t.jsonScene.items);!(r=i()).done;)("ECS"===(o=(a=r.value).type)||"camera"===o||o===tj.sprite||o===tj.particle||o===tj.mesh||o===tj.skybox||o===tj.light||o===tj.tree||o===tj.interact||o===tj.camera)&&e.database&&e.assetLoader.loadGUID(a);return[2]})})()},e.addTexture=function(t){this.destroyed||eD(this.textures,t)},e.removeTexture=function(t){this.destroyed||ek(this.textures,t)},e.addMaterial=function(t){this.destroyed||eD(this.materials,t)},e.removeMaterial=function(t){this.destroyed||ek(this.materials,t)},e.addGeometry=function(t){this.destroyed||eD(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||ek(this.geometries,t)},e.addMesh=function(t){this.destroyed||eD(this.meshes,t)},e.removeMesh=function(t){this.destroyed||ek(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||eD(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||ek(this.renderPasses,t)},e.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass "+this.renderPasses.length),this.meshes.length>0&&t.push("Mesh "+this.meshes.length),this.geometries.length>0&&t.push("Geom "+this.geometries.length),this.textures.length>0&&t.push("Tex "+this.textures.length),t.length>0&&e8.warn("Release GPU memory: "+t.join(", ")+"."),this.renderPasses.forEach(function(t){return t.dispose()}),this.meshes.forEach(function(t){return t.dispose()}),this.geometries.forEach(function(t){return t.dispose()}),this.materials.forEach(function(t){return t.dispose()}),this.textures.forEach(function(t){return t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},rv(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),hT=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=iW(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e=0,i=this.tickers.length;e<i;e++)(0,this.tickers[e])(this.dt)}}},e.add=function(t){if("function"!=typeof t)throw Error("The tick object must implement the tick method.");this.tickers.push(t)},rv(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();im("camera",aV,t.VFXItem),im("text",um,t.VFXItem),im("sprite",oV,t.VFXItem),im("particle",sW,t.VFXItem),im("cal",sY,t.VFXItem),im("interact",aj,t.VFXItem),e8.info("Core version: 2.6.4.");var hE=((ew={})[rw.RGBA]=34842,ew[rw.RGB]=34843,ew[rw.ALPHA]=33325,ew[rw.RED]=33325,ew[rw.LUMINANCE_ALPHA]=33327,ew[rw.LUMINANCE]=33325,ew),h_=((eR={})[rw.RGBA]=34836,eR[rw.RGB]=34837,eR[rw.ALPHA]=33326,eR[rw.RED]=33326,eR[rw.LUMINANCE_ALPHA]=33328,eR[rw.LUMINANCE]=33326,eR),hC=function(e){function r(t,i){var r;return(r=e.call(this,t)||this).initialized=!1,i&&r.fromData(i),r}ib(r,e);var n=r.prototype;return n.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},n.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,i=this.source,r=i.target,n=void 0===r?e.TEXTURE_2D:r,a=i.name;this.textureBuffer=e.createTexture(),hI(this.textureBuffer,a),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},n.clone=function(){var t=new r(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},n.release=function(){switch(this.source.sourceType){case t.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case t.TextureSourceType.data:delete this.source.data;break;case t.TextureSourceType.compressed:case t.TextureSourceType.mipmaps:delete this.source.mipmaps}},n.update=function(e){var i,r,n,a,o,s=this;if(!this.pipelineContext||!this.textureBuffer){this.width=0,this.height=0;return}var u=this.target,h=this.source,l=this.pipelineContext.gl,c=this.engine.gpuCapability.detail,f=h.sourceType,d=h.data,p=h.cube,m=h.image,v=h.video,y=h.mipmaps,g=h.mipmaps,x=e.data,b=e.cube,T=e.generateMipmap,E=e.mipmaps,_=h.format,C=h.type,S=h.internalFormat,A=0,w=0;(this.bind(f===t.TextureSourceType.video),C===rw.HALF_FLOAT?((C=c.halfFloatTexture)||e8.error("Half float texture is not support."),rM(l)&&S===_&&(_===rw.LUMINANCE&&(_=rw.RED),S=hE[_]),c.halfFloatLinear||(h.minFilter=h.magFilter=l.NEAREST,e8.warn("Half float linear not support, change to NEAREST."))):C!==l.FLOAT||((C=c.floatTexture)||e8.error("Float texture is not support."),rM(l)&&S===_&&(_===rw.LUMINANCE&&(_=rw.RED),S=h_[_]),c.floatLinear||(h.minFilter=l.NEAREST,h.magFilter=l.NEAREST,e8.warn("Float linear not support, change to NEAREST."))),void 0===h.premultiplyAlpha&&(h.premultiplyAlpha=!1),l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),void 0===h.flipY&&(h.flipY=!1),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,h.flipY),f===t.TextureSourceType.framebuffer)?x&&(A=null!=(i=x.width)?i:0,w=null!=(r=x.height)?r:0,A&&w&&(this.width!==A||this.height!==w)&&l.texImage2D(u,0,S,A,w,0,_,C,null)):f===t.TextureSourceType.data?u===l.TEXTURE_CUBE_MAP?b.forEach(function(t,e){var i=s.texImage2DData(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,C,t),r=i[0],n=i[1];A=Math.max(r,A),w=Math.max(n,w)}):(A=(n=this.texImage2DData(l,u,0,S,_,C,d))[0],w=n[1]):f===t.TextureSourceType.image||f===t.TextureSourceType.video?(u===l.TEXTURE_CUBE_MAP?p.forEach(function(t,e){var i=s.texImage2D(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,C,t),r=i[0],n=i[1];A=Math.max(r,A),w=Math.max(n,w)}):u===l.TEXTURE_2D&&(A=(a=this.texImage2D(l,u,0,S,_,C,null!=m?m:v))[0],w=a[1]),T&&(hS(A)&&hS(w)||rM(l))&&l.generateMipmap(u)):f===t.TextureSourceType.mipmaps?u===l.TEXTURE_2D?y.forEach(function(t,e){if(o="data"in t?s.texImage2DData(l,u,e,S,_,C,t):s.texImage2D(l,u,e,S,_,C,t),0===e){var i;A=(i=o)[0],w=i[1]}}):u===l.TEXTURE_CUBE_MAP&&g.forEach(function(t,e){t.forEach(function(t,i){if(o="data"in t?s.texImage2DData(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,S,_,C,t):s.texImage2D(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,S,_,C,t),0===e){var r;A=(r=o)[0],w=r[1]}})}):f===t.TextureSourceType.compressed&&E&&0!==E.length&&(A=E[0].width,w=E[0].height,E.forEach(function(t,e){l.compressedTexImage2D(u,e,S,t.width,t.height,0,t.data)})),this.width=A,this.height=w,this.setTextureFilters(l,u,h)},n.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=i.wrapS,a=void 0===n?t.CLAMP_TO_EDGE:n,o=i.wrapT,s=void 0===o?t.CLAMP_TO_EDGE:o,u=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&u.setTextureAnisotropic(t,this.target,void 0===r?4:r);var h=rM(t)||hS(this.width)&&hS(this.height),l=i.magFilter?i.magFilter:t.NEAREST,c=i.minFilter?i.minFilter:t.NEAREST;h||c!==t.LINEAR_MIPMAP_LINEAR&&c!==t.LINEAR_MIPMAP_NEAREST&&c!==t.NEAREST_MIPMAP_LINEAR&&c!==t.NEAREST_MIPMAP_NEAREST||(c=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,c),t.texParameteri(e,t.TEXTURE_MAG_FILTER,l),t.texParameteri(e,t.TEXTURE_WRAP_S,h?a:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,h?s:t.CLAMP_TO_EDGE)},n.fromData=function(t){e.prototype.fromData.call(this,t);var i=this.assembleOptions(t),r=i.sourceType,n=i.sourceFrom,a=i.name;this.source=i,this.sourceType=r,this.sourceFrom=n,this.name=void 0===a?"":a,this.guid=t.id},n.texImage2D=function(e,i,r,n,a,o,s){var u,h=this,l=this.source,c=l.sourceType,f=l.minFilter,d=l.magFilter,p=l.wrapS,m=l.wrapT,v=null!=(u=this.engine.gpuCapability.detail.maxTextureSize)?u:2048,y=s;if(c!==t.TextureSourceType.video){var g=f!==e.NEAREST||d!==e.NEAREST||p!==e.CLAMP_TO_EDGE||m!==e.CLAMP_TO_EDGE;(g=g||s.width>v||s.height>v)&&setTimeout(function(){y=h.resizeImage(s)})}e.texImage2D(i,r,n,a,o,y);var x=[y.width,y.height];return c===t.TextureSourceType.video?[s.videoWidth,s.videoHeight]:x},n.texImage2DData=function(t,e,i,r,n,a,o){var s=o.data,u=o.width,h=o.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return t.texImage2D(e,i,r,u,h,0,n,a,l),[u,h]},n.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;return rM(this.pipelineContext.gl)&&t.width<n&&t.height<n?t:function(t,e,i,r){var n=t.width,a=t.height,o=Math.min(e,i||a$(n)),s=Math.min(e,r||a$(a));if(s!==a||o!==n){var u=uh.getCanvas(),h=u.getContext("2d");return u.width=o,u.height=s,null==h||h.drawImage(t,0,0,n,a,0,0,o,s),e8.warn("Image resize from "+n+"x"+a+" to "+o+"x"+s+"."),u}}(t,n,e,i)||t},n.reloadData=function(){var t=this;return i(function(){return u(this,function(e){switch(e.label){case 0:if(!t.offloaded)return[3,2];return[4,ni().reload(t)];case 1:e.sent(),e.label=2;case 2:return[2]}})})()},n.offloadData=function(){if(this.initialized&&ni().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},n.uploadCurrentVideoFrame=function(){var e=this;return i(function(){return u(this,function(i){return e.source.sourceType===t.TextureSourceType.video&&e.source.video&&e.initialized?(e.update({video:e.source.video}),[2,!0]):[2,!1]})})()},n.updateSource=function(t){this.source=this.assembleOptions(iB({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},n.restore=function(){},n.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){e8.error("This texture has been destroyed.")},this.initialize=is,void 0!==this.engine&&this.engine.removeTexture(this)},r}(r4);function hS(t){return(t&t-1)==0&&0!==t}var hA=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return rM(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),hI(e,t),e},e.bindVertexArray=function(t){if(rM(this.gl))this.gl.bindVertexArray(t);else{var e;null==(e=this.vaoExt)||e.bindVertexArrayOES(t)}},e.dispose=function(){if(rM(this.gl))this.gl.deleteVertexArray(this.vao);else{var t;null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)}},t}(),hw=1,hR=function(){function e(e){this.engine=e,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var i={width:1,height:1,data:new Uint8Array([255])},r=e.getGLPipelineContext(),n=r.gl;this.gl=n,this.pipelineContext=r,this.emptyTexture2D=new hC(e,{data:i,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new hC(e,{target:n.TEXTURE_CUBE_MAP,cube:[i,i,i,i,i,i],sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+hw,hw++}var i=e.prototype;return i.copy2=function(t,e){var i=this.gl;if(i){this.sourceFbo||(this.sourceFbo=i.createFramebuffer()),this.targetFbo||(this.targetFbo=i.createFramebuffer());var r=this.pipelineContext;r.bindFramebuffer(i.FRAMEBUFFER,this.sourceFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t.textureBuffer,0),r.bindFramebuffer(i.FRAMEBUFFER,this.targetFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.textureBuffer,0),r.bindFramebuffer(i.READ_FRAMEBUFFER,this.sourceFbo),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?i.NEAREST:i.LINEAR;i.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),i.COLOR_BUFFER_BIT,n),r.bindFramebuffer(i.FRAMEBUFFER,null),r.bindFramebuffer(i.READ_FRAMEBUFFER,null),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,null)}},i.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},i.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&eD(this.renderbuffers,t),e},i.resize=function(t,e){var i=this.gl;(i&&i.drawingBufferWidth!==t||i.drawingBufferHeight!==e)&&(i.canvas.width=t,i.canvas.height=e,i.viewport(0,0,t,e),this.framebuffers.forEach(function(i){var r=i.viewport;i.isCustomViewport||i.resize(r[0],r[1],t*i.viewportScale,e*i.viewportScale)}))},i.drawGeometry=function(t,e,i){if(!this.gl){console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.");return}var r=e.shaderVariant.program;if(r){var n=r.setupAttributes(t),a=this.gl,o=t.indicesBuffer,s=t.drawStart,u=t.drawCount,h=t.mode,l=t.subMeshes;if(l&&l.length){var c,f=l[i];if(u<0)return;s=f.offset,u=o?null!=(c=f.indexCount)?c:0:f.vertexCount}o?a.drawElements(h,u,o.type,null!=s?s:0):a.drawArrays(h,s,u),null==n||n.unbind()}},i.createGLFramebuffer=function(t,e){var i=this.gl.createFramebuffer();if(i)eD(this.framebuffers,t),hI(i,e,e);else throw Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return i},i.createVAO=function(t){return new hA(this.engine,t)},i.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),ek(this.textures,t),delete t.textureBuffer)},i.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},i.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),ek(this.framebuffers,t),delete t.fbo)},i.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),ek(this.renderbuffers,t),delete t.buffer)},i.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.framebuffers.forEach(function(e){return t.deleteGLFramebuffer(e)}),this.framebuffers.length=0,this.renderbuffers.forEach(function(e){return t.deleteGLRenderbuffer(e)}),this.renderbuffers.length=0,this.textures.forEach(function(e){return t.deleteGLTexture(e)}),this.textures.length=0)},i.lost=function(t){e8.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},i.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},rv(e,[{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function hI(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var hM=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var i,r,n=e.name,a=e.data,o=e.elementCount,s=e.target,u=void 0===s?rw.ARRAY_BUFFER:s,h=e.type,l=void 0===h?rw.FLOAT:h,c=e.usage,f=void 0===c?rw.STATIC_DRAW:c,d=null!=(r=null==(i=hO[l])?void 0:i.BYTES_PER_ELEMENT)?r:0;this.target=u,this.type=l,this.usage=f,this.glBuffer=this.createGLBuffer(n),this.bytesPerElement=d,a?this.bufferData(a):o&&this.bufferData(d*o)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return hI(e,t),e},e.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var i=this.pipelineContext.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var i=this.pipelineContext.gl,r=this.target,n=t*this.bytesPerElement,a=n+e.byteLength;i.bindBuffer(r,this.glBuffer),a>this.byteLength&&(this.byteLength=a,i.bufferData(r,a,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!rM(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},rv(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),hO=((eI={})[rw.INT]=Int32Array,eI[rw.FLOAT]=Float32Array,eI[rw.SHORT]=Int16Array,eI[rw.BYTE]=Int8Array,eI[rw.UNSIGNED_BYTE]=Uint8Array,eI[rw.UNSIGNED_INT]=Uint32Array,eI[rw.UNSIGNED_SHORT]=Uint16Array,eI),hP=((eM={})[Uint8Array.BYTES_PER_ELEMENT]=rw.UNSIGNED_BYTE,eM[Uint16Array.BYTES_PER_ELEMENT]=rw.UNSIGNED_SHORT,eM[Uint32Array.BYTES_PER_ELEMENT]=rw.UNSIGNED_INT,eM),hN=1,hF=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}ib(e,t);var i=e.prototype;return i.getOptions=function(){return iB({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;e4(e),e.addGeometry(this);var i=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach(function(e){t.buffers[e]=new hM(i,t.bufferProps[e])}),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(i,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(void 0!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,a=i.target;this.bufferProps[r]={data:e,usage:n,target:a,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(void 0!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(void 0!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&void 0!=r.data){var n=e+i.length;if(r.data.length<n){var a=new i.constructor(n);a.set(r.data),r.data=a,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var o=this.dirtyFlags[t];void 0!==o.start&&(o.start=Math.min(o.start,e)),void 0!==o.end&&(o.end=Math.max(o.end,n-1))}r.data.set(i,e),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(a(t,Uint8Array)||a(t,Uint16Array)||a(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t+e.length;if(this.indices.length<r){var n=new e.constructor(r);n.set(this.indices),this.indices=n,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var a=this.dirtyFlags.index;void 0!==a.start&&(a.start=Math.min(a.start,t)),void 0!==a.end&&(a.end=Math.max(a.end,r-1))}null==(i=this.indices)||i.set(e,t),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*ng[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t,e){var i=hP[e.BYTES_PER_ELEMENT];return new hM(t,{data:e,target:rw.ELEMENT_ARRAY_BUFFER,type:i,name:""+this.name+"##index"})},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach(function(n){var a,o,s=t.dirtyFlags[n];if("index"==n)a=t.indicesBuffer,o=r;else{var u=e[n].dataSource;a=t.buffers[u],o=i[u].data}if((s.dirty||s.discard)&&a&&o){if(s.discard)a.bufferData(o);else if(void 0!==s.start&&void 0!==s.end){var h=s.start*o.BYTES_PER_ELEMENT+o.byteOffset,l=s.end-s.start+1,c=new o.constructor(o.buffer,h,l);a.bufferSubData(s.start,c)}s.start=Number.POSITIVE_INFINITY,s.end=0,s.dirty=s.discard=!1}}),Object.keys(this.attributesReleasable).forEach(function(r){var n=t.attributesReleasable[r],a=e[r].dataSource;i[a]&&n&&(i[a].data=void 0)}),this.indicesReleasable}},i.processProps=function(t){var e=t.drawStart,i=t.drawCount,r=t.mode,n=t.indices,o=t.name,s=void 0===o?"effectsGeometry:"+hN++:o,u=t.bufferUsage,h=void 0===u?rw.STATIC_DRAW:u;this.name=s;var l={},c=[],f={},d={},p={};this.drawStart=void 0===e?0:e,void 0!==i&&(this.drawCount=i),this.mode=isNaN(r)?rw.TRIANGLES:r,Object.keys(t.attributes).forEach(function(e){var i=t.attributes[e],r=i.size,n=i.stride,o=i.offset,s=i.normalize,u=i.type,m=void 0===u?rw.FLOAT:u,v=i.releasable,y=i.data;if(!m||"dataSource"in i||y||(y=nb(m)),y){var g=a(y,Float32Array)?rw.FLOAT:rw.INT;l[e]={data:y,usage:h,target:rw.ARRAY_BUFFER,name:e},f[e]={size:r,stride:n,offset:o,type:null!=m?m:g,normalize:!!s,dataSource:e},p[e]=null!=v&&v,d[e]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=i.dataSource;x&&(f[e]={size:r,stride:n,offset:o,type:m,dataSource:x,normalize:!!s})}c.push(e)}),d.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==n?void 0:n.data,this.indicesReleasable=(null==n?void 0:n.releasable)===!0,this.bufferProps=l,this.attributes=f,this.attributesName=c,this.attributesReleasable=p,this.dirtyFlags=d,this.options=t,this.initialized=!1},i.fromData=function(e){var i,r=this;if(t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes,e.buffer?i=new Uint8Array(function(t){for(var e=atob(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return i.buffer}(e.buffer)):e.binaryData&&(i=e.binaryData),i){var n=e.vertexData.vertexCount;if(this.hasSemantic(e)){var a={mode:rw.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach(function(t){var e,o=null!=(e=hL[t.semantic])?e:t.semantic,s=r.createVertexTypedArray(t,i,n);a.attributes[o]={type:rP(t.format),size:t.dimension,data:s,normalize:t.normalize}}),e.indexFormat!==el.None){var o=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset);a.indices={data:o},a.drawCount=o.length}else a.drawCount=n;this.processProps(a)}else{var s=e.vertexData.channels[0],u=e.vertexData.channels[1],h=e.vertexData.channels[2],l=this.createVertexTypedArray(s,i,n),c=this.createVertexTypedArray(u,i,n),f=this.createVertexTypedArray(h,i,n),d=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset),p={mode:rw.TRIANGLES,attributes:{aPos:{type:rP(s.format),size:3,data:l,normalize:s.normalize},aUV:{type:rP(u.format),size:2,data:c,normalize:u.normalize},aNormal:{type:rP(h.format),size:3,data:f,normalize:h.normalize}}};p.indices={data:d},p.drawCount=d.length,this.processProps(p)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},i.dispose=function(){var t,e=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach(function(t){e.buffers[t].dispose()}),this.buffers={},null==(t=this.indicesBuffer)||t.dispose(),Object.keys(this.vaos).forEach(function(t){var i;null==(i=e.vaos[t])||i.dispose(),e.vaos[t]=void 0}),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},i.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case eh.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case eh.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case eh.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case eh.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case eh.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},i.createIndexTypedArray=function(t,e,i){var r=e.buffer;switch(t){case el.UInt16:return new Uint16Array(r,e.byteOffset+i);case el.UInt32:return new Uint32Array(r,e.byteOffset+i);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,e.byteOffset+i)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach(function(t){t.semantic&&t.semantic.length>0&&(e=!0)}),e},rv(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(nx),hL={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"},hV=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendColor[0]!==e||this.blendColor[1]!==i||this.blendColor[2]!==r||this.blendColor[3]!==n)&&(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendFunctionParameters[0]!==e||this.blendFunctionParameters[1]!==i||this.blendFunctionParameters[2]!==r||this.blendFunctionParameters[3]!==n)&&(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];(this.blendEquationParameters[0]!==e||this.blendEquationParameters[1]!==i)&&(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){(this.depthRange[0]!==t[0]||this.depthRange[1]!==t[1])&&(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){(this.polygonOffset[0]!==t[0]||this.polygonOffset[1]!==t[1])&&(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){(this.stencilMask[0]!==t[0]||this.stencilMask[1]!==t[1])&&(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){(this.stencilRef[0]!==t[0]||this.stencilRef[1]!==t[1])&&(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){(this.stencilFunc[0]!==t[0]||this.stencilFunc[1]!==t[1])&&(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){(this.stencilOpFail[0]!==t[0]||this.stencilOpFail[1]!==t[1])&&(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){(this.stencilOpZFail[0]!==t[0]||this.stencilOpZFail[1]!==t[1])&&(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){(this.stencilOpZPass[0]!==t[0]||this.stencilOpZPass[1]!==t[1])&&(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[rw.ONE,rw.ONE_MINUS_SRC_ALPHA,rw.ONE,rw.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[rw.FUNC_ADD,rw.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=rw.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[rw.ALWAYS,rw.ALWAYS],this.stencilOpFail=[rw.KEEP,rw.KEEP],this.stencilOpZFail=[rw.KEEP,rw.KEEP],this.stencilOpZPass=[rw.KEEP,rw.KEEP],this.culling=!1,this.frontFace=rw.CCW,this.cullFace=rw.FRONT},e.apply=function(t){if(t.toggle(rw.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(rw.BLEND,this.blending),t.toggle(rw.DEPTH_TEST,this.depthTest),t.toggle(rw.STENCIL_TEST,this.stencilTest),t.toggle(rw.CULL_FACE,this.culling),t.toggle(rw.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(rw.BACK,this.stencilMask[1]),t.stencilMaskSeparate(rw.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(rw.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(rw.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(rw.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(rw.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this.blendColor,i=this.blendEquationParameters,r=this.blendFunctionParameters;t.blendColor(e[0],e[1],e[2],e[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(r[0],r[1],r[2],r[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),hD=function(e){function i(i,r){var n;return(n=e.call(this,i,r)||this).floats={},n.ints={},n.vector2s={},n.vector3s={},n.vector4s={},n.colors={},n.quaternions={},n.matrices={},n.matrice3s={},n.textures={},n.floatArrays={},n.vector4Arrays={},n.matrixArrays={},n.samplers=[],n.uniforms=[],n.uniformDirty=!0,n.macrosDirty=!0,n.glMaterialState=new hV,r&&(n.shader=new t.Shader(i),n.shader.shaderData=iB({},r.shader,{id:iu(),dataType:es.Shader})),n}ib(i,e);var r=i.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach(function(e){var i=t.textures[e];if(!ie(i.initialize)){e8.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.");return}i.initialize()}),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.glMaterialState.apply(t)},r.use=function(t,e){var i=t.engine.getGLPipelineContext(),r=this.shaderVariant;if(!r.program){null==(a=this.engine)||a.renderErrors.add(Error("Shader program is not initialized."));return}if(r.program.bind(),this.setupStates(i),e){for(var a,o,s,u=n(e.uniforms);!(s=u()).done;)o=s.value,this.checkUniform(o);for(var h,l=n(e.samplers);!(h=l()).done;)o=h.value,this.samplers.includes(o)||(this.samplers.push(o),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(o in e.floats)r.setFloat(o,e.floats[o]);for(o in e.ints)r.setInt(o,e.ints[o]);for(o in e.vector4s)r.setVector4(o,e.vector4s[o]);for(o in e.vector3s)r.setVector3(o,e.vector3s[o]);for(o in e.matrices)r.setMatrix(o,e.matrices[o])}for(o in this.textures)this.textures[o].textureBuffer||this.textures[o].initialize();for(o in this.floats)r.setFloat(o,this.floats[o]);for(o in this.ints)r.setInt(o,this.ints[o]);for(o in this.floatArrays)r.setFloats(o,this.floatArrays[o]);for(o in this.textures)r.setTexture(o,this.textures[o]);for(o in this.vector2s)r.setVector2(o,this.vector2s[o]);for(o in this.vector3s)r.setVector3(o,this.vector3s[o]);for(o in this.vector4s)r.setVector4(o,this.vector4s[o]);for(o in this.colors)r.setColor(o,this.colors[o]);for(o in this.quaternions)r.setQuaternion(o,this.quaternions[o]);for(o in this.matrices)r.setMatrix(o,this.matrices[o]);for(o in this.matrice3s)r.setMatrix3(o,this.matrice3s[o]);for(o in this.vector4Arrays)r.setVector4Array(o,this.vector4Arrays[o]);for(o in this.matrixArrays)r.setMatrixArray(o,this.matrixArrays[o])},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=n(e);!(i=r()).done;){var a=i.value;this.vector4Arrays[t].push(a.x,a.y,a.z,a.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=n(e);!(i=r()).done;)for(var a=i.value,o=0;o<16;o++)this.matrixArrays[t].push(a.elements[o])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var e=t||this.props,r=this.engine;e4(r);var n=new i(r,e);return n.glMaterialState=Object.assign(new hV,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},r.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i,r,n=iB({},t);void 0!==t.stringTags.RenderType&&(this.blending=t.stringTags.RenderType===tW.Transparent),void 0!==t.floats.ZTest&&(this.depthTest=0!==t.floats.ZTest),void 0!==t.floats.ZWrite&&(this.depthMask=0!==t.floats.ZWrite);var a=t.stringTags.RenderFace;for(i in a===tY.Front?(this.culling=!0,this.cullFace=rw.BACK):a===tY.Back?(this.culling=!0,this.cullFace=rw.FRONT):this.culling=!1,n.floats)this.setFloat(i,n.floats[i]);for(i in n.ints)this.setInt(i,n.ints[i]);for(i in n.vector4s){var o=n.vector4s[i];this.setVector4(i,new rb(o.x,o.y,o.z,o.w))}for(i in n.colors){var s=n.colors[i];this.setColor(i,new rE(s.r,s.g,s.b,s.a))}for(i in n.textures){var u=n.textures[i],h=this.engine.findObject(u.texture);this.setTexture(i,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(i+"_ST",new rb(c.x,c.y,l.x,l.y))}if(t.shader){var f=this.engine.findObject(t.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(r=t.stringTags)?r:{},this.initialized=!1},r.toData=function(){var t=this.defination;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=es.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var a in this.textures){t.textures[a]||(t.textures[a]={texture:this.textures[a]});var o=t.textures[a],s=this.getVector4(a+"_ST");s&&(o.scale={x:s.x,y:s.y},o.offset={x:s.z,y:s.w},delete t.vector4s[a+"_ST"])}return t},r.cloneUniforms=function(t){var e;for(e in t.floats)this.setFloat(e,t.floats[e]);for(e in t.ints)this.setInt(e,t.ints[e]);for(e in t.floatArrays)this.setFloats(e,t.floatArrays[e]);for(e in t.textures)this.setTexture(e,t.textures[e]);for(e in t.vector2s)this.setVector2(e,t.vector2s[e]);for(e in t.vector3s)this.setVector3(e,t.vector3s[e]);for(e in t.vector4s)this.setVector4(e,t.vector4s[e]);for(e in t.colors)this.setColor(e,t.colors[e]);for(e in t.quaternions)this.setQuaternion(e,t.quaternions[e]);for(e in t.matrices)this.setMatrix(e,t.matrices[e]);for(e in t.vector4Arrays){for(var i=[],r=0;r<t.vector4Arrays[e].length;r+=4)i.push(new rb(t.vector4Arrays[e][r],t.vector4Arrays[e][r+1],t.vector4Arrays[e][r+2],t.vector4Arrays[e][r+3]));this.setVector4Array(e,i)}for(e in t.matrixArrays){for(var n=[],a=0;a<t.matrixArrays[e].length;a+=16){for(var o=r_.fromIdentity(),s=0;s<16;s++)o.elements[s]=t.matrixArrays[e][a+s];n.push(o)}this.setMatrixArray(e,n)}},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(e){var i,r=this;this.destroyed||(null==(i=this.shaderVariant)||i.dispose(),(null==e?void 0:e.textures)!==t.DestroyOptions.keep&&Object.keys(this.textures).forEach(function(t){var e=r.textures[t];e!==r.engine.emptyTexture&&e.dispose()}),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=is,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},rv(i,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask[0]},set:function(t){this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(no),hk=function(){function e(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}var i=e.prototype;return i.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},i.copyTexture=function(e,i){this.renderer&&(e.initialize(),i.initialize(),i.updateSource({sourceType:t.TextureSourceType.framebuffer,data:{width:i.getWidth()||e.getWidth(),height:i.getHeight()||e.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(e,i):this.copy1(e,i))},i.copy2=function(t,e){var i=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(i)},i.copy1=function(t,e){var i=this.copyRenderPass;if(i){var r=this.renderer;if(r){var n=i.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),r.glRenderer.resetColorAttachments(n,[e]),i.meshes[0].material.setTexture("uTex",t),r.renderRenderPass(i)}}},i.createCopyRenderPass=function(){var e="mri-copy-mesh",i={texture:{format:rw.RGBA}},r=this.renderer.engine,n=new hF(r,{name:e,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=r.gpuCapability.level,o=new hD(r,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===a?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1}});o.blending=!1,o.depthTest=!1,o.culling=!1;var s=new nR(r,{name:e,geometry:n,material:o,priority:0});return new hz(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[i],meshes:[s]})},i.dispose=function(){if(this.renderer){var t;null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0}},e}(),hz=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},i.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(nO),hU=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],e4(t),this.gl=rC(t,e,i),this.contextLostListener=function(t){for(var e,i,a=n(r.lostHandlers);!(i=a()).done;)i.value.lost(t);null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,a=n(r.restoreHandlers);!(i=a()).done;)i.value.restore();null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),hB=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new n3(e),i}ib(e,t);var i=e.prototype;return i.dispose=function(){this.destroyed||t.prototype.dispose.call(this)},i.getGLRenderer=function(){return this.renderer},i.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},i.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(hb),hG=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}ib(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},i.setSize=function(t,e){if(!this.initialized){e8.error("Can't set size for uninitialized render buffer.");return}if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer,r=i.gl;i.pipelineContext.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):e8.error("Invalid render buffer size: "+t+"x"+e+".")}},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=is},e}(n1),hj=1,hX=function(e){function i(i,r){(n=e.call(this)||this).attachmentTextures=[];var n,a,o=i.depthStencilAttachment,s=i.viewport,u=i.isCustomViewport,h=i.storeAction,l=i.viewportScale,c=i.name,f=void 0===c?"GLFramebuffer"+hj++:c;return n.renderer=r,n.engine=r.engine,n.depthStencilStorageType=null!=(a=null==o?void 0:o.storageType)?a:t.RenderPassAttachmentStorageType.none,n.viewport=s,n.isCustomViewport=!!u,n.viewportScale=void 0===l?1:l,n.name=f,n.storeAction=h,n.updateProps(i),n}ib(i,e);var r=i.prototype;return r.getDepthTexture=function(){return this.depthTexture},r.getStencilTexture=function(){return this.stencilTexture},r.getColorTextures=function(){return this.colorTextures},r.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach(function(e){e.initialize(),eD(t.attachmentTextures,e.textureBuffer)}),this.stencilTexture&&eD(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&eD(this.attachmentTextures,this.depthTexture.textureBuffer)},r.updateProps=function(e){var i,r,n=this.renderer,o=this.engine.gpuCapability,s=null!=(r=e.depthStencilAttachment)?r:{storageType:t.RenderPassAttachmentStorageType.none},u=e.attachments.length>0,h=!0;if(this.externalStorage=!1,e.attachments.length>1&&!o.detail.drawBuffers)throw Error("Multiple color attachments not support.");var l=null==(i=e.depthStencilAttachment)?void 0:i.texture,c=o.detail.readableDepthStencilTextures,f=s.storageType,d=s.storage;if(this.colorTextures=e.attachments.slice(),!u&&f!==t.RenderPassAttachmentStorageType.none)throw Error("Use depth stencil attachment without color attachments.");switch(u&&(this.fbo=n.glRenderer.createGLFramebuffer(this,this.name)),f){case t.RenderPassAttachmentStorageType.depth_stencil_opaque:if(d){if(a(d,hG))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth stencil attachment storage.")}else this.depthStencilRenderbuffer=new hG({format:rw.DEPTH_STENCIL,attachment:rw.DEPTH_STENCIL_ATTACHMENT,storageType:f},n.glRenderer);h=!1;break;case t.RenderPassAttachmentStorageType.depth_16_opaque:if(d){if(a(d,hG))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth attachment storage.")}else this.depthStencilRenderbuffer=new hG({attachment:rw.DEPTH_ATTACHMENT,format:rw.DEPTH_COMPONENT16,storageType:f},n.glRenderer);break;case t.RenderPassAttachmentStorageType.stencil_8_opaque:if(d){if(a(d,hG))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid stencil attachment storage.")}else this.depthStencilRenderbuffer=new hG({attachment:rw.STENCIL_ATTACHMENT,format:rw.STENCIL_INDEX8,storageType:f},n.glRenderer);break;case t.RenderPassAttachmentStorageType.depth_16_texture:if(!c)throw Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=l?l:new hC(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:rw.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:rw.UNSIGNED_SHORT,name:""+this.name+"##depthTex"}),this.depthTexture.initialize();break;case t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!c)throw Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=l?l:new hC(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:rw.DEPTH_STENCIL,internalFormat:o.internalFormatDepth24_stencil8,type:o.UNSIGNED_INT_24_8,name:""+this.name+"##dpthStclTex"}),this.depthTexture.initialize(),h=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,h),this.updateAttachmentTextures()},r.getStoreAttachments=function(e,i){var r=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(e&&rM(r)&&n>0){var a=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&eD(a,i?r.DEPTH_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&eD(a,i?r.STENCIL_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var o=0;o<n;o++)eD(a,r["COLOR_ATTACHMENT"+o]);return a}},r.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;rM(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},r.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,i=this.renderer.pipelineContext,r=this.viewport,n=r[0],a=r[1],o=r[2],s=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,a,o,s);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(i.textureUnitDict).forEach(function(e){var r=i.textureUnitDict[e];r&&r!==u&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())});for(var h=0;h<4;h++)i.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var l=this.depthStencilRenderbuffer,c=this.depthTexture,f=this.stencilTexture;if(i.activeTexture(e.TEXTURE0),l)l.setSize(o,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,l.attachment,e.RENDERBUFFER,l.buffer);else if(c){c.source.data={width:o,height:s},c.update({data:{width:o,height:s,data:new Uint16Array(0)}});var d=c&&f?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,d,e.TEXTURE_2D,c.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var p=e.checkFramebufferStatus(e.FRAMEBUFFER);if(p!==e.FRAMEBUFFER_COMPLETE)throw Error("Framebuffer failed. gl status="+p+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+".");this.ready=!0}}},r.resetColorTextures=function(t){var e=this.renderer.glRenderer.gl,i=this.engine.gpuCapability,r=this.viewport,a=[];if(t){for(var o,s=n(t);!(o=s()).done;)o.value.initialize();this.colorTextures=t.slice()}this.renderer.pipelineContext.activeTexture(e.TEXTURE0),this.colorTextures.forEach(function(t,n){var o={width:r[2],height:r[3],data:new Uint8Array(0)};t.update({data:o}),i.framebufferTexture2D(e,e.FRAMEBUFFER,n,e.TEXTURE_2D,t.textureBuffer),a.push(!0)}),i.drawBuffers(e,a),this.updateAttachmentTextures()},r.resize=function(t,e,i,r){var n=this.viewport,a=n[0],o=n[1],s=n[2],u=n[3];(a!==t||o!==e||s!==i||u!==r)&&(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},r.dispose=function(e){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force;n!==t.RenderPassDestroyAttachmentType.force&&(n!==t.RenderPassDestroyAttachmentType.keepExternal||this.externalStorage)||(null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose()),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},rv(i,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),i}(n5),hH=((eO={})[rw.FLOAT]=1,eO[rw.INT]=1,eO[rw.UNSIGNED_INT]=1,eO[rw.SHORT]=1,eO[rw.BOOL]=1,eO[rw.UNSIGNED_SHORT]=1,eO[rw.FLOAT_VEC2]=2,eO[rw.FLOAT_VEC3]=3,eO[rw.FLOAT_VEC4]=4,eO[rw.FLOAT_MAT2]=4,eO[rw.FLOAT_MAT3]=9,eO[rw.FLOAT_MAT4]=16,eO[rw.FLOAT_MAT2x3]=6,eO[rw.FLOAT_MAT2x4]=8,eO[rw.FLOAT_MAT4x3]=12,eO[rw.FLOAT_MAT4x2]=8,eO[rw.FLOAT_MAT3x4]=12,eO[rw.FLOAT_MAT3x2]=6,eO[rw.INT_VEC2]=2,eO[rw.INT_VEC3]=3,eO[rw.INT_VEC4]=4,eO[rw.UNSIGNED_INT_VEC2]=2,eO[rw.UNSIGNED_INT_VEC3]=3,eO[rw.UNSIGNED_INT_VEC4]=4,eO[rw.BOOL_VEC2]=2,eO[rw.BOOL_VEC3]=3,eO[rw.BOOL_VEC4]=4,eO),hW=hK(Float32Array),hY=hK(Int32Array),hZ=hK(Uint8Array);function hq(t){return function(e,i,r,n){var a={start:i[1],dirty:!0};if(i[2]>1){if(e.length){for(var o=n[1]||e.length,s=i[4]/t.BYTES_PER_ELEMENT,u=a.buffer=new t(o*s),h=n[0]||0,l=0;l<o;l++)u[l*s]=e[l+h];a.start+=h*s}}else a.buffer=new t([e]);return a}}function hK(t){return function(e,i,r,n){for(var a=i[8],o=i[2],s=i[5],u=1===o?a:i[4],h=s?u/s:1,l=u/t.BYTES_PER_ELEMENT/h,c=a/t.BYTES_PER_ELEMENT/l,f=hH[i[0]],d=f/h,p=(n[0]||0)*f,m=n[1]?h*n[1]:c,v=new t(l*m),y={start:i[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=p;g<m;g++){for(var T=0;T<d;T++)v[x+T]=e[b+T];x+=l,b+=d}return y}}function hQ(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var a=e[n],o=0;o<a.length;o++)r=Math.imul(31,r)+a.charCodeAt(o)|0;return r}(eP={})[rw.FLOAT]=hq(Float32Array),eP[rw.INT]=hq(Int32Array),eP[rw.UNSIGNED_INT]=hq(Uint32Array),eP[rw.SHORT]=hq(Int16Array),eP[rw.BOOL]=hq(Uint8Array),eP[rw.UNSIGNED_SHORT]=hq(Uint16Array),eP[rw.FLOAT_VEC2]=hW,eP[rw.FLOAT_VEC3]=hW,eP[rw.FLOAT_VEC4]=hW,eP[rw.FLOAT_MAT2]=hW,eP[rw.FLOAT_MAT3]=hW,eP[rw.FLOAT_MAT4]=hW,eP[rw.FLOAT_MAT2x3]=hW,eP[rw.FLOAT_MAT2x4]=hW,eP[rw.FLOAT_MAT4x3]=hW,eP[rw.FLOAT_MAT4x2]=hW,eP[rw.FLOAT_MAT3x4]=hW,eP[rw.FLOAT_MAT3x2]=hW,eP[rw.INT_VEC2]=hY,eP[rw.INT_VEC3]=hY,eP[rw.INT_VEC4]=hY,eP[rw.UNSIGNED_INT_VEC2]=hY,eP[rw.UNSIGNED_INT_VEC3]=hY,eP[rw.UNSIGNED_INT_VEC4]=hY,eP[rw.BOOL_VEC2]=hZ,eP[rw.BOOL_VEC3]=hZ,eP[rw.BOOL_VEC4]=hZ;var hJ=function(){function t(t,e,i){var r=this;this.engine=t,this.program=e,this.id=i,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),rM(n)&&(function(t,e){for(var i=[],r=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),a=0;a<n;++a)!function(n){var a=t.getActiveUniformBlockName(e,n);e4(a);var o={index:t.getUniformBlockIndex(e,a),usedByVertexShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:a,id:""};o.used=o.usedByVertexShader||o.usedByFragmentShader,i[n]=o;for(var s=o.uniformIndices,u=[],h=0;h<s.length;h++){var l=t.getActiveUniform(e,s[h]).name.replace("[0]","");o.uniforms[l]=[0,0,0,0,0,0,0,h,0],u[h]=l,r.push(l)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach(function(i,r){t.getActiveUniforms(e,s,i).forEach(function(t,e){var i=u[e];o.uniforms[i][r]=+t})});for(var c=0;c<u.length;c++){var f=o.uniforms[u[c]],d=o.uniforms[u[c+1]],p=d?d[1]:o.size;f[8]=p-f[1]}o.id=function(t){var e=t.name,i=t.size,r=t.uniforms,n=t.uniformIndices,a=Object.keys(r).map(function(t){return t+"["+r[t].join(":")+"]"}).join("+");return hQ(""+e+"+",""+i+"+",""+n.length+"+",a)}(o)+""}(a);return{blockSpecs:i,blockUniformNames:r}})(n,e).blockSpecs.forEach(function(t){return r.uniformBlockMap[t.name]=t}),this.pipelineContext.useProgram(null)}var e=t.prototype;return e.bind=function(){this.pipelineContext.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,a=this.pipelineContext.gl;return t.vaos[n]?i=t.vaos[n]:(i=new hA(this.engine,t.name+"-"+n),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach(function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var o=t.buffers[n.dataSource];if(!o)throw Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");o.bind(),a.enableVertexAttribArray(i.loc),a.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}}),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var a=t.getActiveAttrib(e,n);if(a){var o=a.name,s=a.type,u=a.size,h=t.getAttribLocation(e,o);i[o]={type:s,name:o,size:u,loc:h}}}return i},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),h$=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}ib(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i,r=e.slice();t=t.concat(r);for(var n=this.pipelineContext.getUniforms(this.program.program,t),a=0;a<t.length;a++)this.uniformLocations[t[a]]=n[a];for(i=0;i<r.length;i++)null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--);for(i=0;i<r.length;i++){var o=r[i];this.samplerChannels[o]=i}},i.toData=function(){var t=this.defination;t.dataType=es.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(nu),h0=0,h1=function(){function e(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var i=e.prototype;return i.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],a=n(Object.keys(this.cachedShaders));!(i=a()).done;){var o=i.value;this.cachedShaders[o].initialized||r.push(o)}t?r.length?Promise.all(r.map(function(t){return new Promise(function(i){return e.compileShader(e.cachedShaders[t],i)})})).then(t).catch(function(){return 0}):t([]):r.map(function(t){return e.compileShader(e.cachedShaders[t])}),this.shaderAllDone=!0}},i.addShader=function(e,i){var r=[];e.macros&&r.push.apply(r,[].concat(e.macros)),i&&r.push.apply(r,[].concat(i));var n=iB({},e,{vertex:nX.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:e.vertex,macros:r}),fragment:nX.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:e.fragment,macros:r})}),a=this.computeShaderCacheId(n);if(this.cachedShaders[a])return a;this.shaderAllDone=!1;var o=!1;return(n.shared||n.cacheId)&&(o=!0),this.cachedShaders[a]=new h$(this.engine,iB({},n,{vertex:n.vertex,fragment:n.fragment,name:n.name||a,shared:o})),this.cachedShaders[a].id=a,a},i.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},i.compileShader=function(e,i){var r=this,n=e.source,a=n.shared,o=n.vertex,s=n.fragment,u=n.name,h=e.source.cacheId,l=!1;(a||h)&&(l=!0);var c=this.pipelineContext.gl,f={shared:l,status:t.ShaderCompileResultStatus.compiling},d=this.createProgram(c,o,s,f),p=this.glAsyncCompileExt,m=performance.now(),v=function(i){f.status=t.ShaderCompileResultStatus.success,f.compileTime=performance.now()-m,e.program=i,e.initialized=!0,e.pipelineContext=r.pipelineContext,void 0!==r.programMap[e.id]&&console.warn("Find duplicated shader id: "+e.id+"."),r.programMap[e.id]=i},y=function(){if(r.engine.isDestroyed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==i?void 0:i(f);if(e.initialized)return null==i?void 0:i(f);var n=(!i||!p||p&&!0==c.getProgramParameter(f.program,p.COMPLETION_STATUS_KHR))&&d();if(n){if(f.status!==t.ShaderCompileResultStatus.fail){hI(n,u);var a=new hJ(r.engine,n,e.id);if(c.validateProgram(n),c.getProgramParameter(n,c.VALIDATE_STATUS))v(a);else{var h=c.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))||(null==h?void 0:h.includes("Two textures of different types use the same sampler"))?v(a):(f.status=t.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",o,"\nfragment:\n",s),c.deleteProgram(n))}}null==i||i(f)}else i&&requestAnimationFrame(y)};e.compileResult=f,y()},i.computeShaderCacheId=function(t){var e=t.vertex,i=t.fragment,r=t.shared,n=t.cacheId;return r||n?n||"shared_"+hQ(void 0===e?"":e,void 0===i?"":i):"instanced_"+h0++},i.createProgram=function(e,i,r,n){var a=e.createProgram(),o=this.createGLShader(e,e.VERTEX_SHADER,i),s=this.createGLShader(e,e.FRAGMENT_SHADER,r);return a&&o&&s?(e.attachShader(a,o),e.attachShader(a,s),e.linkProgram(a),n.program=a,n.status=t.ShaderCompileResultStatus.compiling,function(){if(n.program=void 0,!e.getProgramParameter(a,e.LINK_STATUS)){console.error("Failed to link program: "+e.getProgramInfoLog(a)+".");var u=h2(e,o,"vertex",i),h=h2(e,s,"fragment",r);n.status=t.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),h&&(n.error=h.error,n.status=h.status)}return a}):(n.status=t.ShaderCompileResultStatus.fail,function(){return null})},i.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=hQ(null!=i?i:""),a=r.get(n);if(a)return a;var o=t.createShader(e);return o&&(t.shaderSource(o,i),t.compileShader(o),r.set(n,o)),o},i.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},i.restore=function(){},i.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach(function(e){t.programMap[e].dispose()}),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},e}();function h2(e,i,r,n){if(!e.getShaderParameter(i,e.COMPILE_STATUS)){var a=e.getShaderInfoLog(i);return console.error("compile "+r+" error: "+a,(null!=n?n:"").split("\n").map(function(t,e){return e+1+" "+t}).join("\n")),{error:a,status:t.ShaderCompileResultStatus.fail}}}var h3=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new h1(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}var e=t.prototype;return e.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=rw.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},e.toggle=function(t,e){e?this.enable(t):this.disable(t)},e.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},e.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},e.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},e.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},e.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.useProgram=function(t){this.set1("useProgram",t)},e.clear=function(t){this.gl.clear(t)},e.clearDepth=function(t){this.set1("clearDepth",t)},e.depthFunc=function(t){this.set1("depthFunc",t)},e.depthMask=function(t){this.set1("depthMask",t)},e.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},e.depthRange=function(t,e){this.set2("depthRange",t,e)},e.clearStencil=function(t){this.set1("clearStencil",t)},e.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},e.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},e.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},e.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},e.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},e.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},e.blendEquation=function(t){this.set1("blendEquation",t)},e.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},e.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},e.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},e.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},e.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},e.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},e.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),(r.x!==e||r.y!==i)&&this.gl[t](r.x=e,r.y=i)},e.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),(n.x!==e||n.y!==i||n.z!==r)&&this.gl[t](n.x=e,n.y=i,n.z=r)},e.set4=function(t,e,i,r,n){var a=this.glCapabilityCache[t];a||(a=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),(a.x!==e||a.y!==i||a.z!==r||a.w!==n)&&this.gl[t](a.x=e,a.y=i,a.z=r,a.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},e.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},e.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},e.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},t}(),h4=function(e){function i(i,r,n){(a=e.call(this)||this).canvas=i,a.temporaryRTs={};var a,o=iB({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},n);a.context=new hU(i,r,o);var s=a.context.gl;return e4(s),a.engine=new hB(s),a.engine.renderer=oB(a),a.pipelineContext=new h3(a.engine,s),a.glRenderer=new hR(a.engine),a.extension=new hk(oB(a)),a.renderingData={currentFrame:{}},a.framebuffer=new hX({storeAction:{},viewport:[0,0,a.width,a.height],attachments:[new hC(a.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:a.width,height:a.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},oB(a)),a}ib(i,e);var r=i.prototype;return r.renderRenderFrame=function(t){t.resource&&t.resource.color_b.initialize(),t.emptyTexture.initialize(),t.transparentTexture.initialize();var e=t._renderPasses;if(this.isDestroyed){console.error("Renderer is destroyed, target: GLRenderer.");return}null==(r=t.renderer.getShaderLibrary())||r.compileAllShaders(),this.setFramebuffer(null),this.clear(t.clearAction);var i=t.camera;this.renderingData.currentFrame=t,this.renderingData.currentCamera=i,this.setGlobalMatrix("effects_MatrixInvV",i.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",i.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",i.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",i.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",i.position),e1(e);for(var r,a,o=n(e);!(a=o()).done;){var s=a.value,u=s.delegate;null==u.willBeginRenderPass||u.willBeginRenderPass.call(u,s,this.renderingData),this.renderRenderPass(s),null==u.didEndRenderPass||u.didEndRenderPass.call(u,s,this.renderingData)}for(var h,l=n(e);!(h=l()).done;)h.value.frameCleanup(this)},r.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},r.renderMeshes=function(t){for(var e,i=this.renderingData.currentPass.delegate,r=n(t);!(e=r()).done;){var a=e.value;null==i.willRenderMesh||i.willRenderMesh.call(i,a,this.renderingData),a.render(this),null==i.didRenderMesh||i.didRenderMesh.call(i,a,this.renderingData)}},r.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},r.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},r.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},r.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},r.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},r.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},r.drawGeometry=function(t,e,i){if(void 0===i&&(i=0),t&&e){e.initialize(),t.initialize(),t.flush();var r=this.renderingData;r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){console.error(t);return}this.glRenderer.drawGeometry(t,e,i)}},r.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.getFramebuffer=function(){return this.framebuffer},r.getTemporaryRT=function(e,i,r,n,a,o){if(this.temporaryRTs[e])return this.temporaryRTs[e];var s,u,h=t.RenderPassAttachmentStorageType.none;a===t.FilterMode.Linear?s=rw.LINEAR:a===t.FilterMode.Nearest&&(s=rw.NEAREST),o===t.RenderTextureFormat.RGBA32?u=rw.UNSIGNED_BYTE:o===t.RenderTextureFormat.RGBAHalf&&(u=rw.HALF_FLOAT),0===n?h=t.RenderPassAttachmentStorageType.none:16===n?h=t.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(h=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var l=new hX({name:e,storeAction:{},viewport:[0,0,i,r],viewportScale:1,isCustomViewport:!0,attachments:[new hC(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:rw.RGBA,format:rw.RGBA,type:u})],depthStencilAttachment:{storageType:h}},this);return this.temporaryRTs[e]=l,l},r.setViewport=function(t,e,i,r){this.pipelineContext.viewport(t,e,i,r)},r.clear=function(e){var i=this.pipelineContext,r=0;if(e.colorAction===t.TextureLoadAction.clear){var n=e.clearColor;n&&i.clearColor(n[0],n[1],n[2],n[3]),i.colorMask(!0,!0,!0,!0),r=rw.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(i.stencilMask(255),i.clearStencil(e.clearStencil||0),r|=rw.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var a=e.clearDepth;i.depthMask(!0),i.clearDepth(Number.isFinite(a)?a:1),r|=rw.DEPTH_BUFFER_BIT}r&&i.clear(r)},r.addLostHandler=function(t){this.context.addLostHandler(t)},r.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},r.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.getWidth=function(){return this.width},r.getHeight=function(){return this.height},r.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},r.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},r.restore=function(){var t=this.context.gl;if(!t)throw Error("Can not restore automatically because losing gl context.");this.engine.gpuCapability=new n3(t),this.engine.renderer=this,this.pipelineContext=new h3(this.engine,t),this.glRenderer=new hR(this.engine),this.extension=new hk(this)},r.resize=function(t,e){var i=this.glRenderer;i&&(this.width!==t||this.height!==e)&&i.resize(t,e)},r.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},rv(i,[{key:"isDestroyed",get:function(){var t=this.glRenderer;return!t||t.isDestroyed}},{key:"height",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.height)?e:0}},{key:"width",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.width)?e:0}}]),i}(n6),h5={"Container size overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY","DPI overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT","Invalid container size":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW","Container is not an HTMLElement":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Never use destroyed player again":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr","Current running player count":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ","Create player with different WebGL version":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg"},h6=new Map,h8=!1,h9=1,h7=function(e){function r(t){(a=e.call(this)||this).compositions=[],a.displayScale=1,a.resumePending=!1,a.disposed=!1,a.assetManagers=[],a.speed=1,a.baseCompositionIndex=0,a.useExternalCanvas=!1,a.lost=function(t){var e;null==(e=a.ticker)||e.pause(),a.compositions.forEach(function(e){return e.lost(t)}),a.renderer.lost(t),a.handleEmitEvent("webglcontextlost",t),lt(oB(a),!1)};var r,a,o=oB(a);a.restore=i(function(){var t;return u(this,function(e){switch(e.label){case 0:return o.renderer.restore(),[4,Promise.all(o.compositions.map(i(function(t){var e,i,r,n,a,s,h,l,c,f,d,p;return u(this,function(u){switch(u.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.keepResource,a=t.reusable,s=t.renderOrder,h=t.transform,l=t.videoState,[4,o.loadScene(i)];case 1:(c=u.sent()).speed=r,c.reusable=a,c.keepResource=n,c.renderOrder=s,c.transform.setPosition(h.position.x,h.position.y,h.position.z),c.transform.setRotation(h.rotation.x,h.rotation.y,h.rotation.z),c.transform.setScale(h.scale.x,h.scale.y,h.scale.z),f=0,u.label=2;case 2:if(!(f<l.length))return[3,5];if(!l[f])return[3,4];return(d=c.textures[f].source.video).currentTime=null!=(p=l[f])?p:0,[4,d.play()];case 3:u.sent(),u.label=4;case 4:return f++,[3,2];case 5:return c.isEnded=!1,c.gotoAndPlay(e),[2,c]}})})))];case 1:return o.compositions=e.sent(),o.emit("webglcontextrestored"),null==(t=o.ticker)||t.resume(),eY()&&o.canvas&&(o.canvas.style.display="none",window.setTimeout(function(){o.canvas.style.display=""},0)),[2]}})}),a.handleClick=function(t){var e=t.x,i=t.y,r=[];a.compositions.forEach(function(t){for(var o,s=t.hitTest(e,i),u=n(s);!(o=u()).done;){var h=o.value;r.push(iB({},h,{player:oB(a),composition:t}))}});for(var o=0;o<r.length;o++){var s=r[o],u=s.behavior||tG.NOTIFY;u===tG.NOTIFY?(a.emit("click",iB({},s,{compositionId:s.composition.id,compositionName:s.composition.name})),s.composition.emit("click",iB({},s,{compositionId:s.composition.id,compositionName:s.composition.name}))):u===tG.RESUME_PLAYER&&a.resume()}};var s=t.container,h=t.canvas,l=t.fps,c=t.name,f=t.pixelRatio,d=t.manualRender,p=t.reportGPUTime,m=t.renderFramework,v=t.notifyTouch,y=t.onError,g=t.interactive,x=t.renderOptions,b=void 0===x?{}:x,T=t.env,E=void 0===T?"":T,_=b.willCaptureImage,C=b.premultipliedAlpha;if(a.onError=y,h8||"debug-disable"===m)return uu(a);var S=(r=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===r[1]||"16"===r[1]&&"5"===r[2])?"webgl":"webgl2";m&&(S="webgl"===m?"webgl":"webgl2"),a.reportGPUTime=p,a.pixelRatio=Number.isFinite(f)?f:eH(),a.offscreenMode=!0,a.env=E,a.name=c||""+h9++;try{if(rA.length)throw Error("Errors before player create: "+rA.map(function(t,e){return"\n "+(e+1)+": "+t})+".",{cause:"webgliniterror"});h?(a.canvas=h,a.useExternalCanvas=!0):(le(s),a.canvas=document.createElement("canvas"),s.appendChild(a.canvas)),a.container=a.canvas.parentElement,a.renderer=n6.create(a.canvas,S,{preserveDrawingBuffer:_,premultipliedAlpha:C}),a.renderer.env=E,a.renderer.addLostHandler({lost:a.lost}),a.renderer.addRestoreHandler({restore:a.restore}),a.gpuCapability=a.renderer.engine.gpuCapability,a.assetService=new ht(a.renderer.engine),d||(a.ticker=new hT(l),a.ticker.add(a.tick.bind(oB(a)))),a.event=new aB(a.canvas,!!v),a.event.bindListeners(),a.event.addEventListener(aD,a.handleClick),a.interactive=void 0!==g&&g,a.resize(),sH(a.gpuCapability.detail)}catch(t){a.canvas&&!a.useExternalCanvas&&a.canvas.remove(),a.handleThrowError(t)}return h6.forEach(function(t){t.gpuCapability.type!==a.gpuCapability.type&&e8.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+a.gpuCapability.type+".\nsee "+h5["Create player with different WebGL version"]+".")}),h6.set(a.canvas,oB(a)),!function(){for(var t,e=[],i=n(h6.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&e8.error("Current running player count: "+e.length+", see "+h5["Current running player count"]+".",e)}(),lt(oB(a),!0),a}ib(r,e);var o=r.prototype;return o.setSpeed=function(t){isNaN(t)||(this.speed=t)},o.getSpeed=function(){return this.speed},o.getCompositionByName=function(t){return this.compositions.find(function(e){return e.name===t})},o.getCompositions=function(){return this.compositions.sort(function(t,e){return t.getIndex()-e.getIndex()})},o.getAssetManager=function(){return this.assetManagers},o.loadScene=function(t,e){var r=this;return i(function(){var a,o,s,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,C,S;return u(this,function(A){switch(A.label){case 0:return e4(r.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),h=performance.now(),l=[],c=[],d=null==(f=null==e?void 0:e.autoplay)||f,p=null==(o=r.renderer.engine.gpuCapability)?void 0:null==(a=o.detail)?void 0:a.asyncShaderCompile,m=r.baseCompositionIndex,it(t)?(v=l).push.apply(v,[].concat(t)):l.push(t),r.baseCompositionIndex+=l.length,d&&(r.autoPlaying=!0),y=[],[4,Promise.all(l.map(i(function(t,i){var n,a,o,s,h,l,f,p;return u(this,function(u){switch(u.label){case 0:return a=(n=r.assetService.assembleSceneLoadOptions(t,iB({autoplay:d},e))).source,h=null!=(s=null==(o=n.options)?void 0:o.autoplay)?s:d,l=new u7(o),r.assetManagers.push(l),[4,l.loadScene(a,r.renderer,{env:r.env})];case 1:if(f=u.sent(),r.disposed)return c.length=0,[2];return r.assetService.prepareAssets(f,f.assets),r.assetService.updateTextVariables(f,l.options.variables),r.assetService.initializeTexture(f),f.pluginSystem.precompile(f.jsonScene.compositions,r.renderer),(p=r.createComposition(f,o)).setIndex(m+i),c[i]=p,y[i]=h,[2]}})})))];case 1:return A.sent(),g=performance.now(),[4,new Promise(function(t){var e;null==(e=r.renderer.getShaderLibrary())||e.compileAllShaders(function(){return t(null)})})];case 2:for(A.sent(),x=performance.now()-g,b=0;b<c.length;b++)y[b]?c[b].play():c[b].pause(),r.compositions.push(c[b]);for(null==(s=r.ticker)||s.start(),c.some(function(t){return!t.getPaused()})&&r.emit("play",{time:0}),T=c.map(function(t){return t.name}),E=performance.now()-h,_=n(c);!(C=_()).done;)(S=C.value).statistic.compileTime=x,S.statistic.firstFrameTime=E;return e8.info("First frame ["+T+"]: "+E.toFixed(4)+"ms."),e8.info("Shader "+(p?"async":"sync")+" compile ["+T+"]: "+x.toFixed(4)+"ms."),[2,it(t)?c:c[0]]}})})()},o.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=this.renderer,n=new sk(iB({},e,{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,handleItemMessage:function(t){i.emit("message",t)}}),t);return this.ticker&&e.renderLevel===tL.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==aI&&this.assetService.createShaderVariant(),n},o.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(t){t.play()}),null==(t=this.ticker)||t.start(),this.emit("play",{time:0})},o.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(e){e.gotoAndPlay(t)}),this.ticker?this.ticker.start():this.doTick(0,!0),this.emit("play",{time:t})},o.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map(function(e){e.gotoAndStop(t)}),(!this.ticker||(null==(e=this.ticker)?void 0:e.getPaused()))&&this.doTick(0,!0),this.emit("pause")},o.playSequence=function(t){for(var e,i=function(e){t[e].on("end",function(){t[e+1].play()})},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},o.pause=function(t){var e;!this.paused&&(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},o.resume=function(){var t=this;return i(function(){var e;return u(this,function(i){switch(i.label){case 0:if(t.resumePending)return[2];if(!t.paused)return[3,2];return t.resumePending=!0,[4,Promise.all(t.compositions.map(function(t){return t.reloadTexture()}))];case 1:i.sent(),t.resumePending=!1,t.emit("resume"),i.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}})})()},o.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},o.doTick=function(e,i){var r,n,a=this,o=this.renderer.engine.renderErrors;o.size>0&&(this.handleEmitEvent("rendererror",o.values().next().value),null==(r=this.ticker)||r.pause()),e=Math.min(e,33)*this.speed;var s=this.compositions,u=!1;s.sort(function(t,e){return t.getIndex()-e.getIndex()});for(var h=[],l=0;l<s.length;l++){var c=s[l];if(c.textureOffloaded){u=!0,e8.error("Composition "+c.name+" texture offloaded, skip render."),h.push(c);continue}!c.isDestroyed&&c.renderer&&c.update(e),c.isDestroyed||h.push(c)}if(this.compositions=h,this.baseCompositionIndex=this.compositions.length,u)return this.handleEmitEvent("rendererror",Error("Play when texture offloaded.")),null==(n=this.ticker)?void 0:n.pause();if(!this.paused||i){var f=this.gpuCapability.level,d=this.renderer.context.gl,p=2===f&&this.reportGPUTime?rS(d):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<s.length||i){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var m=0;m<s.length;m++)s[m].renderFrame.isDestroyed||this.renderer.renderRenderFrame(s[m].renderFrame)}null==p||p.end(),null==p||p.getTime().then(function(t){return null==a.reportGPUTime?void 0:a.reportGPUTime.call(a,null!=t?t:0)}).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},o.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},o.resize=function(){var t=this.canvas.parentElement;if(t){var e=this.getTargetSize(t);r=e[0],n=e[1],a=e[2],o=e[3]}else r=a=this.canvas.width,n=o=this.canvas.height;var i=r/n;if(r&&n){var r,n,a,o,s,u=document.documentElement.clientWidth;a>2*u&&e8.error("DPI overflowed, width "+a+" is more than 2x document width "+u+", see "+h5["DPI overflowed"]+".");var h=this.env?this.gpuCapability.detail.maxTextureSize:2048;(a>h||o>h)&&(e8.error("Container size overflowed "+a+"x"+o+", see "+h5["Container size overflowed"]+"."),i>1?(a=Math.round(h),o=Math.round(h/i)):(o=Math.round(h),a=Math.round(h*i))),this.renderer.resize(a,o),this.canvas.style.width=r+"px",this.canvas.style.height=n+"px",e8.info("Resize player "+this.name+" ["+a+","+o+","+r+","+n+"]."),null==(s=this.compositions)||s.forEach(function(t){t.camera.aspect=i})}},o.clearCanvas=function(e){e?this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},o.destroyCurrentCompositions=function(){this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.baseCompositionIndex=0},o.dispose=function(t){if(e8.info("Call player destroyed: "+this.name+"."),!this.disposed){h6.delete(this.canvas),this.pause(),null==(e=this.ticker)||e.stop(),this.assetManagers.forEach(function(t){return t.dispose()}),this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.renderer&&(this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.renderer.dispose(!t)),this.event&&this.event.dispose(),this.assetService.dispose(),lt(this,!1),a(this.canvas,HTMLCanvasElement)&&!t&&this.renderer.context&&(uh.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var e,i="Never use destroyed player: "+this.name+" again, see "+h5["Never use destroyed player again"]+".",r=function(){return function(t){throw Error(t)}(i)},n=function(){return Promise.reject(i)};this.tick=r,this.resize=r,this.loadScene=n,this.play=n,this.gotoAndPlay=n,this.gotoAndStop=n,this.playSequence=r,this.destroyCurrentCompositions=r,this.resume=n,this.disposed=!0}},o.offloadTexture=function(){this.compositions.forEach(function(t){return t.offloadTexture()})},o.getTargetSize=function(t){le(t);var e,i,r=this.displayAspect,n=null==window.getComputedStyle?void 0:window.getComputedStyle.call(window,t),a=0,o=0;n?(a=parseInt(n.width,10),o=parseInt(n.height,10)):(a=t.clientWidth,o=t.clientHeight),r?a/o>r?e=(i=o*this.displayScale)*r:i=(e=a*this.displayScale)/r:(e=a,i=o);var s=this.pixelRatio,u=e,h=i;if(e=Math.round(e*s),(i=Math.round(i*s))<1||i<1){if(this.offscreenMode)e=i=u=h=1;else throw Error("Invalid container size "+e+"x"+i+", see "+h5["Invalid container size"]+".")}return[u,h,e,i]},o.handleThrowError=function(t){if(this.onError)this.onError(t);else throw t},o.handleEmitEvent=function(t,e){this.onError?a(e,Event)?this.onError(Error(e.type,{cause:t}),e):a(e,Error)?this.onError(Error(e.message,{cause:t}),e):this.onError(Error("Unknown error.",{cause:t}),e):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,e))},rv(r,[{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),r}(sN);function lt(t,e){Object.keys(ic).forEach(function(i){var r=ic[i],n=e?r.onPlayerCreated:r.onPlayerDestroy;null==n||n(t)})}function le(t){if(null==t)throw Error("Container is not an HTMLElement, see "+h5["Container is not an HTMLElement"]+".")}s([function(t,e,r){var n=r.value;return r.value=i(function(){var e,i,r,a,o=arguments;return u(this,function(s){switch(s.label){case 0:for(i=Array(e=o.length),r=0;r<e;r++)i[r]=o[r];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.apply(this,i)];case 2:return[2,s.sent()];case 3:return a=s.sent(),t.handleThrowError.call(this,a),[3,4];case 4:return[2]}})}),r}],h7.prototype,"loadScene",null),r4.create=function(t,e){return new hC(t,e)},r4.createWithData=function(e,i,r){void 0===i&&(i=e$("#fff")),void 0===r&&(r={});var n=r.type,a=void 0===n?rw.UNSIGNED_BYTE:n,o=r.format,s=void 0===o?rw.RGBA:o,u=r.internalFormat,h=r.wrapS,l=void 0===h?rw.MIRRORED_REPEAT:h,c=r.wrapT,f=void 0===c?rw.MIRRORED_REPEAT:c,d=r.minFilter,p=void 0===d?rw.NEAREST:d,m=r.magFilter,v=void 0===m?rw.NEAREST:m,y=r.flipY;return new hC(e,{data:i,type:a,sourceType:t.TextureSourceType.data,format:s,internalFormat:u||s,wrapS:l,wrapT:f,minFilter:p,magFilter:v,flipY:void 0!==y&&y})},no.create=function(t,e){return new hD(t,e)},nx.create=function(t,e){return new hF(t,e)},nR.create=function(t,e){return new nR(t,e)},n1.create=function(t){return new hG(t)},n5.create=function(t,e){return new hX(t,e)},n6.create=function(t,e,i){return new h4(t,e,i)},hb.create=function(t){return new hB(t)};var li="2.6.4";e8.info("Player version: "+li+"."),t.AbstractPlugin=ig,t.ActivationPlayable=s0,t.AndNode=i9,t.Animatable=iZ,t.AnimationClipNode=iY,t.ApplyAdditiveNode=i6,t.Asset=uv,t.AssetLoader=ug,t.AssetManager=u7,t.AssetService=ht,t.BYTES_TYPE_MAP=ng,t.BaseRenderComponent=aL,t.Behaviour=rg,t.BezierCurve=ow,t.BezierCurvePath=ov,t.BezierCurveQuat=oy,t.BlendNode=i8,t.BoolValueNode=ik,t.COPY_FRAGMENT_SHADER=nf,t.COPY_MESH_SHADER_ID=nl,t.COPY_VERTEX_SHADER=nc,t.CalculateLoader=sY,t.Camera=oW,t.CameraVFXItemLoader=aV,t.ColorCurve=oO,t.Component=ry,t.ComponentTimePlayable=sX,t.ComponentTimePlayableAsset=sj,t.ComponentTimeTrack=sG,t.Composition=sk,t.ConstBoolNode=ri,t.ConstFloatNode=re,t.ControlParameterBoolNode=rn,t.ControlParameterFloatNode=rr,t.ControlParameterTriggerNode=ra,t.DEFAULT_FONTS=uf,t.DEFAULT_FPS=60,t.Database=ux,t.Deferred=function(){var t=this;this.promise=new Promise(function(e,i){t.resolve=e,t.reject=i})},t.Downloader=rD,t.EFFECTS_COPY_MESH_NAME=nh,t.EVENT_TYPE_CLICK=aD,t.EVENT_TYPE_TOUCH_END=aU,t.EVENT_TYPE_TOUCH_MOVE=az,t.EVENT_TYPE_TOUCH_START=ak,t.EffectsObject=iI,t.EffectsPackage=hx,t.Ellipse=ur,t.Engine=hb,t.EventEmitter=sN,t.EventSystem=aB,t.Float16ArrayWrapper=aH,t.FloatComparisonNode=rh,t.FloatComparisonNodeData=ru,t.FloatValueNode=iD,t.Framebuffer=n5,t.GLEngine=hB,t.GLGeometry=hF,t.GLRenderer=h4,t.GPUCapability=n3,t.Geometry=nx,t.GlobalUniforms=n0,t.GradientValue=od,t.GraphInstance=rp,t.GraphNode=iN,t.GraphNodeData=iF,t.GraphicsPath=us,t.HELP_LINK=aM,t.InteractLoader=aj,t.InteractMesh=oN,t.InvalidIndex=-1,t.KTXTexture=r7,t.LayerBlendNode=ro,t.LineSegments=op,t.LinearValue=of,t.MaskProcessor=ns,t.Material=no,t.MaterialDataBlock=nr,t.Mesh=nR,t.MeshCollider=oL,t.NodeTransform=i3,t.NotNode=rt,t.OrNode=i7,t.PLAYER_OPTIONS_ENV_EDITOR=aI,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=o6,t.ParticleBehaviourPlayableAsset=o8,t.ParticleLoader=sW,t.ParticleMesh=o7,t.ParticleSystemRenderer=si,t.ParticleTrack=sR,t.PassTextureCache=nv,t.PathSegments=om,t.Player=h7,t.PluginSystem=iv,t.PolyStar=un,t.Polygon=ue,t.Pose=i4,t.PoseNode=iL,t.PropertyTrack=sw,t.RENDER_PASS_NAME_PREFIX=nq,t.RENDER_PREFER_LOOKUP_TEXTURE=oK,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=oh,t.RandomValue=ol,t.RandomVectorValue=oc,t.RenderFrame=nQ,t.RenderPass=nO,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=nI,t.Renderbuffer=n1,t.Renderer=n6,t.RendererComponent=rx,t.RuntimeClip=sA,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",t.SPRITE_VERTEX_STRIDE=6,t.SemanticMap=ny,t.SerializationHelper=uy,t.ShaderFactory=nX,t.ShaderVariant=nu,t.ShapePath=uo,t.SpriteLoader=oV,t.StateMachineNode=rl,t.StateNode=rc,t.StaticValue=ou,t.TEMPLATE_USE_OFFSCREEN_CANVAS=oQ,t.TextComponentBase=up,t.TextLayout=ul,t.TextLoader=um,t.TextStyle=uc,t.Texture=r4,t.TextureFactory=ne,t.Ticker=hT,t.TimelineClip=sS,t.TimelinePlayable=sM,t.TrackSortWrapper=sO,t.Transform=oX,t.TransformAnimationPlayable=s$,t.TransitionNode=rf,t.ValueGetter=os,t.ValueNode=iV,t.Vector2Curve=oA,t.Vector3Curve=oS,t.Vector4Curve=oC,t.addByOrder=e2,t.addItem=eD,t.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}},t.applyMixins=il,t.assertExist=e4,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=ih,t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",t.buildLine=s5,t.calculateTranslation=aZ,t.canUseBOM=eW,t.canvasPool=uh,t.closePointEps=1e-4,t.colorGradingFrag=nk,t.colorStopsFromGradient=eG,t.colorToArr=eU,t.combineImageTemplate=u6,t.createCopyShader=nd,t.createGLContext=rC,t.createKeyFrameMeta=oT,t.createShape=ac,t.createValueGetter=oM,t.curveEps=1e-4,t.decimalEqual=a2,t.defaultPlugins=id,t.deserializeMipmapTexture=r$,t.disableAllPlayer=function(t){h8=!!t},t.earcut=aR,t.effectsClass=iA,t.effectsClassStore=iS,t.enlargeBuffer=ez,t.ensureFixedNumber=uT,t.ensureVec3=aq,t.findPreviousRenderPass=function(t,e){var i=t.indexOf(e);return t[i-1]},t.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",t.gaussianDownHFrag=nz,t.gaussianDownVFrag=nU,t.gaussianUpFrag=nB,t.generateEmptyTypedArray=nb,t.generateGUID=iu,t.generateHalfFloatTexture=r5,t.generateTransparentTexture=r9,t.generateWhiteTexture=r8,t.getActivePlayers=function(){return Array.from(h6.values())},t.getBackgroundImage=u5,t.getClass=function(t){return iS[t]},t.getColorFromGradientStops=eB,t.getConfig=function(t){return oJ[t]},t.getDefaultTextureFactory=ni,t.getGeometryByShape=aP,t.getGeometryTriangles=aO,t.getKTXTextureOptions=nt,t.getKeyFrameMetaByRawValue=ob,t.getMergedStore=iw,t.getNodeDataClass=function(t){return iO[t]},t.getParticleMeshShader=function(t,e,i){void 0===i&&(i="");var r,n,a,o=t.content,s=+((null==(r=o.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===aI]],h=e.level,l=e.detail,c=oT(),f=oT(),d=l.maxVertexUniforms>0,p=(null!=(n=o.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,ob(c,p));var y=o.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=o.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&ob(c,x);var b=o.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[r])&&(ob(c,b[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==b?void 0:b[n])&&(ob(c,b[n]),o=1,v|=1<<10+e,a=!0),u.push(["ORB_VEL_"+t.toUpperCase(),o])}),(null==b?void 0:b.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),a&&(null==b?void 0:b.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),o.sizeOverLifetime){var T=o.sizeOverLifetime;T.separateAxes?(ob(c,T.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,ob(c,T.y)):ob(c,T.size)}if(o.rotationOverLifetime){var E=o.rotationOverLifetime;E.z&&(ob(c,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(ob(c,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(ob(c,E.y),v|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),v|=262144)}ob(c,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,ob(c,b.forceCurve));var _=l.halfFloatTexture;_&&f.max&&(v|=1048576);var C=l.maxVertexUniforms,S=c.max+c.curves.length-32>C;oJ[oK]&&(S=!0),2===h&&(c.max=-1,f.index>0&&(f.max=-1)),S&&_&&d&&(m=1);var A={fragment:nF,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+nL,shared:!0,cacheId:["-p:",s,v,c.index,c.max,f.index,f.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:A,vertex:c.index,fragment:f.index}},t.getPixelRatio=eH,t.getPlayerByCanvas=function(t){return h6.get(t)},t.getPreMultiAlpha=rN,t.getStandardComposition=u0,t.getStandardImage=u$,t.getStandardItem=u2,t.getStandardJSON=uQ,t.getTextureSize=nJ,t.glContext=rw,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return eh.Float32;case WebGLRenderingContext.SHORT:return eh.Int16;case WebGLRenderingContext.BYTE:return eh.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return eh.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return eh.UInt8;default:return eh.Float32}},t.gpuTimer=rS,t.imageDataFromColor=e$,t.imageDataFromGradient=e0,t.initErrors=rA,t.initGLContext=rI,t.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",t.interpolateColor=ej,t.isAlipayMiniApp=eQ,t.isAndroid=eZ,t.isArray=it,t.isCanvas=ia,t.isCanvasUsedByPlayer=function(t){return h6.has(t)},t.isFunction=ie,t.isIOS=eY,t.isIOSByUA=function(){var t=navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},t.isMiniProgram=function(){return eQ()||eJ()},t.isObject=ii,t.isOpenHarmony=eq,t.isPlainObject=ir,t.isSimulatorCellPhone=eK,t.isString=e7,t.isUniformStruct=nn,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&nn(t[0])},t.isValidFontFamily=e5,t.isWebGL2=rM,t.isWechatMiniApp=eJ,t.itemFrag=nN,t.itemFrameFrag="#version 100\nprecision highp float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}",t.itemVert=nP,t.loadAVIFOptional=rG,t.loadBinary=rW,t.loadBlob=function(t){return rZ.apply(this,arguments)},t.loadImage=rX,t.loadMedia=rQ,t.loadVideo=rq,t.loadWebPOptional=rU,t.logger=e8,t.math=nA,t.modifyMaxKeyframeShader=function(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var a=0;a<t.macros.length;a++){var o=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===o[0])o[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===o[0]){o[1]=i;break}}},t.nearestPowerOfTwo=a$,t.nodeDataClass=iP,t.noop=e9,t.normalizeColor=uw,t.numberToFix=a3,t.oldBezierKeyFramesToNew=oR,t.parsePercent=eX,t.particleFrag=nF,t.particleOriginTranslateMap=aJ,t.particleUniformTypeMap=o9,t.particleVert=nL,t.passRenderLevel=u4,t.pluginLoaderMap=ic,t.randomInRange=io,t.registerPlugin=im,t.removeItem=ek,t.rotateVec2=aN,t.screenMeshVert=nD,t.serialize=function(t,e){return iR(t,e)},t.setBlendMode=rF,t.setConfig=function(t,e){return oJ[t]=e},t.setDefaultTextureFactory=function(t){ev=t},t.setMaskMode=rV,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=a0,t.setSideMode=rL,t.setSpriteMeshMaxItemCountByGPU=sH,t.sortByOrder=e1,t.spec=iE,t.thresholdFrag=nG,t.throwDestroyedError=is,t.trailVert=nV,t.translatePoint=function(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i},t.trianglesFromRect=a1,t.unregisterPlugin=function(t){delete ip[t],delete ic[t],ek(id,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecFill=aK,t.vecMulCombine=aQ,t.version=li,t.vertexFormatType2GLType=rP,Object.defineProperty(t,"__esModule",{value:!0})});
6
+ * Version: v2.6.5
7
+ */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ge={})}(this,function(t){"use strict";function e(t,e,i,r,n,a,o){try{var s=t[a](o),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function i(t){return function(){var i=this,r=arguments;return new Promise(function(n,a){var o=t.apply(i,r);function s(t){e(o,n,a,s,u,"next",t)}function u(t){e(o,n,a,s,u,"throw",t)}s(void 0)})}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function n(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return r(t,void 0);var i=Object.prototype.toString.call(t).slice(8,-1);if("Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return r(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function a(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):a(t,e)}function o(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function s(t,e,i,r){var n,a=arguments.length,o=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(o=(a<3?n(o):a>3?n(e,i,o):n(e,i))||o);return a>3&&o&&Object.defineProperty(e,i,o),o}function u(t,e){var i,r,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(i)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&s[0]?r.return:s[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,s[1])).done)return n;switch(r=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{i=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,C,S,A,w,R,I,M,O,P,N,F,L,V,D,k,z,U,B,G,j,X,H,W,Y,Z,q,K,Q,J,$,tt,te,ti,tr,tn,ta,to,ts,tu,th,tl,tc,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tE,t_,tC,tS,tA,tw,tR,tI,tM,tO,tP,tN,tF,tL,tV,tD,tk,tz,tU,tB,tG,tj,tX,tH,tW,tY,tZ,tq,tK,tQ,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,ea,eo,es,eu,eh,el,ec,ef,ed,ep,em,ev,ey,eg,ex,eb,eT,eE,e_,eC,eS,eA,ew,eR,eI,eM,eO,eP,eN=new Uint8Array(16),eF=[],eL=0;eL<256;++eL)eF.push((eL+256).toString(16).slice(1));var eV={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function eD(t,e){return t.includes(e)||t.push(e),t}function ek(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function ez(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),o=new t.constructor(a);return o.set(t),o}return t}function eU(t,e){var i=[0,0,0,0];if(e7(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else a(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)i[o]/=255;return i}function eB(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var a=t[n-1],o=t[n];if(a.stop<=e&&e<=o.stop){r=ej(a.color,o.color,(e-a.stop)/(o.stop-a.stop));break}}return r||(r=t[t.length-1].color),i?r.map(function(t){return t/255}):r}return[0,0,0,0]}function eG(t){var e=[];if(a(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3],o=t[4];e.push({stop:eX(i),color:[r,n,a,o]})}):Object.keys(t).forEach(function(i){var r=eU(t[i]);e.push({stop:eX(i),color:r})}),(e=e.sort(function(t,e){return t.stop-e.stop})).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var i=e[e.length-1];1!==i.stop&&e.push({stop:1,color:i.color.slice()})}return e}function ej(t,e,i,r){var n=[],a=1-i;if(r)for(var o=0;o<4;o++)n[o]=t[o]*a+e[o]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*a+e[s]*e[s]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function eX(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eH(){if("object"==typeof screen&&"object"==typeof document){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0);return Math.min(screen.width/t*2,2)}return 1}var eW="undefined"!=typeof window;function eY(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}function eZ(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function eq(){return/\bOpenHarmony\b/.test(navigator.userAgent)}function eK(){return eZ()||eq()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eQ(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eJ(){return"miniprogram"===window.__wxjs_environment}function e$(t){e7(t)&&(t=eU(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}function e0(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=eG(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var a=n/128,o=void 0,s=void 0,u=0;u<r.length&&(o=r[u],s=r[u+1],!(o.stop<=a)||!(s.stop>a));u++);var h=ej(o.color,s.color,(a-o.stop)/(s.stop-o.stop));i.set(h,4*n)}i.set(r[r.length-1].color,508)}return e}function e1(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(!(i<=30))return function t(e,i,r,n){if(void 0===r&&(r=0),void 0===n&&(n=e.length-1),r>=n)return e;for(var a,o,s=e[r],u=r,h=n;u<h;){if(2===i){for(;e[h].priority>s.priority&&h>=u;)h--;for(;e[u].priority<=s.priority&&u<h;)u++}else{for(;e[h].priority<s.priority&&h>=u;)h--;for(;e[u].priority>=s.priority&&u<h;)u++}a=[e[h],e[u]],e[u]=a[0],e[h]=a[1]}return o=[e[u],e[r]],e[r]=o[0],e[u]=o[1],t(e,i,r,u-1),t(e,i,h+1,n),e}(t,e);for(var r=1;r<i;r++)e3(t,r,e);return t}function e2(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&e3(t,t.length-1,i)),t}function e3(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function e4(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function e5(t){return/^[^\d.][\w-]*$/.test(t)}function e6(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(h=t.OrderType||(t.OrderType={}))[h.none=1]="none",h[h.ascending=2]="ascending",h[h.descending=3]="descending";var e8={error:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).error.apply(e,[].concat(e6(t),[r])),null==tN||tN("error",t,r)},info:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(e6(t))),null==tN||tN("info",t,r)},warn:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(e6(t))),null==tN||tN("warn",t,r)},register:function(t){t&&ie(t)&&(tN=t)}};function e9(){}function e7(t){return"string"==typeof t}t.DestroyOptions=void 0,(l=t.DestroyOptions||(t.DestroyOptions={}))[l.destroy=0]="destroy",l[l.keep=1]="keep",l[l.force=0]="force";var it=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function ie(t){return"[object Function]"===Object.prototype.toString.call(t)}function ii(t){return"[object Object]"===Object.prototype.toString.call(t)}function ir(t){if(null===t||"object"!=typeof t||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function ia(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function io(t,e){return t+Math.random()*(e-t)}function is(){throw Error("Destroyed item cannot be used again.")}function iu(){return(function(t,e,i){if(eV.randomUUID&&!t)return eV.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tP&&!(tP="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tP(eN)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),eF[n[r+0]]+eF[n[r+1]]+eF[n[r+2]]+eF[n[r+3]]+"-"+eF[n[r+4]]+eF[n[r+5]]+"-"+eF[n[r+6]]+eF[n[r+7]]+"-"+eF[n[r+8]]+eF[n[r+9]]+"-"+eF[n[r+10]]+eF[n[r+11]]+eF[n[r+12]]+eF[n[r+13]]+eF[n[r+14]]+eF[n[r+15]]})().replace(/-/g,"")}function ih(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],a=0;a<r.length;a+=512){for(var o=r.slice(a,a+512),s=Array(o.length),u=0;u<o.length;u++)s[u]=o.charCodeAt(u);var h=new Uint8Array(s);n.push(h)}return new File([new Blob(n,{type:i})],e,{type:i})}function il(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)})})}var ic={},id=[],ip={};function im(t,e,i){ip[t]&&e8.error("Duplicate registration for plugin "+t+"."),ip[t]=i,ic[t]=e,eD(id,t)}var iv=function(){function t(t){var e={},i=[];id.forEach(function(t){var r=ic[t];i.includes(r)||(i.push(r),e[t]=r)});for(var r,a=n(t);!(r=a()).done;){var o=r.value;if(!ic[o])throw Error("The plugin '"+o+"' not found."+function(t){var e=iy[t];return e?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""}(o))}this.plugins=Object.keys(e).map(function(t){var e=new ic[t];return e.name=t,e}).sort(function(t,e){return t.order-e.order})}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionConstructed(t,e)})},e.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},e.resetComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionReset(t,e)})},e.processRawJSON=function(t,e){var r=this;return i(function(){return u(this,function(i){return[2,r.callStatic("processRawJSON",t,e)]})})()},e.processAssets=function(t,e){var r=this;return i(function(){return u(this,function(i){return[2,r.callStatic("processAssets",t,e)]})})()},e.precompile=function(t,e){for(var i,r=n(this.plugins);!(i=r()).done;)i.value.precompile(t,e)},e.loadResources=function(t,e){var r=this;return i(function(){return u(this,function(i){return[2,r.callStatic("prepareResource",t,e)]})})()},e.callStatic=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var a=this;return i(function(){var e,i,n,o,s,h;return u(this,function(u){for(n=0,e=[],i=a.plugins;n<i.length;n++)t in(o=ic[i[n].name])&&e.push(Promise.resolve(null==(h=o[t])?void 0:(s=h).call.apply(s,[].concat([o],r))));return[2,Promise.all(e)]})})()},t}(),iy={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer","rich-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"},ig=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.precompile=function(t,e){},e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t}();function ix(t,e){return(ix=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ib(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ix(t,e)}(c=tF||(tF={}))["1_0"]="1.0",c["1_1"]="1.1",c["1_2"]="1.2",c["1_3"]="1.3",c["1_5"]="1.5",c["1_8"]="1.8",c["2_0"]="2.0",c["2_1"]="2.1",c["2_2"]="2.2",c["2_3"]="2.3",c["2_4"]="2.4",c["3_0"]="3.0",c["3_1"]="3.1",c["3_2"]="3.2",c["3_3"]="3.3",c["3_4"]="3.4",c.LATEST="3.4",(f=tL||(tL={})).S="S",f.APlus="A+",f.A="A",f.BPlus="B+",f.B="B",(d=tV||(tV={}))[d.ALPHA=0]="ALPHA",d[d.ADD=1]="ADD",d[d.MULTIPLY=2]="MULTIPLY",d[d.BRIGHTNESS=3]="BRIGHTNESS",d[d.SUBTRACTION=4]="SUBTRACTION",d[d.STRONG_LIGHT=5]="STRONG_LIGHT",d[d.WEAK_LIGHT=6]="WEAK_LIGHT",d[d.SUPERPOSITION=7]="SUPERPOSITION",(p=tD||(tD={}))[p.DOUBLE=1032]="DOUBLE",p[p.FRONT=1028]="FRONT",p[p.BACK=1029]="BACK",(m=tk||(tk={}))[m.OBSCURED=2]="OBSCURED",m[m.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(v=tz||(tz={}))[v.NONE=0]="NONE",v[v.SPHERE=1]="SPHERE",v[v.CONE=2]="CONE",v[v.HEMISPHERE=3]="HEMISPHERE",v[v.CIRCLE=4]="CIRCLE",v[v.DONUT=5]="DONUT",v[v.RECTANGLE=6]="RECTANGLE",v[v.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",v[v.EDGE=8]="EDGE",v[v.TEXTURE=9]="TEXTURE",(y=tU||(tU={}))[y.GYROSCOPE=0]="GYROSCOPE",y[y.SPINE=1]="SPINE",(g=tB||(tB={}))[g.CLICK=0]="CLICK",g[g.MESSAGE=1]="MESSAGE",g[g.DRAG=2]="DRAG",(x=tG||(tG={}))[x.NONE=0]="NONE",x[x.NOTIFY=1]="NOTIFY",x[x.RESUME_PLAYER=2]="RESUME_PLAYER",x[x.REMOVE=3]="REMOVE",x[x.PAUSE=4]="PAUSE",(b=tj||(tj={})).base="0",b.sprite="1",b.particle="2",b.null="3",b.interact="4",b.plugin="5",b.camera="6",b.composition="7",b.spine="spine",b.mesh="mesh",b.tree="tree",b.text="text",b.light="light",b.skybox="skybox",b.effect="effect",b.shape="shape",b.postProcessVolume="postProcessVolume",b.node="node",b.video="video",b.audio="audio",b.richtext="richtext",(T=tX||(tX={}))[T.BILLBOARD=0]="BILLBOARD",T[T.MESH=1]="MESH",T[T.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",T[T.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(E=tH||(tH={}))[E.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",E[E.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",E[E.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",E[E.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",E[E.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",E[E.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",E[E.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",E[E.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",E[E.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(_=tW||(tW={})).Opaque="Opaque",_.Transparent="Transparent",(C=tY||(tY={})).Both="Both",C.Back="Back",C.Front="Front",(S=tZ||(tZ={}))[S.portrait=1]="portrait",S[S.landscape=0]="landscape",(A=tq||(tq={}))[A.CONSTANT=0]="CONSTANT",A[A.CONSTANT_VEC2=1]="CONSTANT_VEC2",A[A.CONSTANT_VEC3=2]="CONSTANT_VEC3",A[A.CONSTANT_VEC4=3]="CONSTANT_VEC4",A[A.RANDOM=4]="RANDOM",A[A.LINE=5]="LINE",A[A.CURVE=6]="CURVE",A[A.BEZIER_PATH=7]="BEZIER_PATH",A[A.RGBA_COLOR=8]="RGBA_COLOR",A[A.GRADIENT_COLOR=9]="GRADIENT_COLOR",A[A.SHAPE_POINTS=10]="SHAPE_POINTS",A[A.SHAPE_SPLITS=11]="SHAPE_SPLITS",A[A.LINEAR_PATH=12]="LINEAR_PATH",A[A.COLORS=13]="COLORS",A[A.BINARY=20]="BINARY",A[A.BEZIER_CURVE=21]="BEZIER_CURVE",A[A.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",A[A.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",A[A.COLOR_CURVE=24]="COLOR_CURVE",A[A.VECTOR4_CURVE=25]="VECTOR4_CURVE",A[A.VECTOR2_CURVE=26]="VECTOR2_CURVE",A[A.VECTOR3_CURVE=27]="VECTOR3_CURVE",(w=tK||(tK={}))[w.AUTO=0]="AUTO",w[w.EASE=1]="EASE",w[w.EASE_IN=2]="EASE_IN",w[w.EASE_OUT=3]="EASE_OUT",w[w.LINE=4]="LINE",w[w.HOLD=5]="HOLD",w[w.LINE_OUT=6]="LINE_OUT",(R=tQ||(tQ={}))[R.destroy=0]="destroy",R[R.restart=5]="restart",R[R.forward=2]="forward",R[R.freeze=4]="freeze",(I=tJ||(tJ={}))[I.none=0]="none",I[I.removeParticle=1]="removeParticle",(M=t$||(t$={}))[M.RANDOM=0]="RANDOM",M[M.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",M[M.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",M[M.UNIFORM_BURST=3]="UNIFORM_BURST",(O=t0||(t0={})).point="point",O.spot="spot",O.directional="directional",O.ambient="ambient",(P=t1||(t1={}))[P.box=2]="box",P[P.sphere=3]="sphere",(N=t2||(t2={})).orthographic="orthographic",N.perspective="perspective",(F=t3||(t3={})).unlit="unlit",F.pbr="pbr",F.hair="hair",(L=t4||(t4={}))[L.opaque=100]="opaque",L[L.masked=101]="masked",L[L.translucent=102]="translucent",L[L.additive=103]="additive",(V=t5||(t5={})).none="none",V.uv="uv",V.normal="normal",V.basecolor="basecolor",V.alpha="alpha",V.metallic="metallic",V.roughness="roughness",V.ao="ao",V.emissive="emissive",V.diffuse="diffuse",(D=t6||(t6={}))[D.display=0]="display",D[D.clip=1]="clip",D[D.ellipsis=2]="ellipsis",(k=t8||(t8={}))[k.top=0]="top",k[k.middle=1]="middle",k[k.bottom=2]="bottom",(z=t9||(t9={}))[z.left=0]="left",z[z.middle=1]="middle",z[z.right=2]="right",(U=t7||(t7={})).normal="normal",U.bold="bold",U.lighter="lighter",(B=et||(et={})).normal="normal",B.italic="italic",B.oblique="oblique";var iT={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(G=ee||(ee={}))[G.Custom=0]="Custom",G[G.Rectangle=1]="Rectangle",G[G.Ellipse=2]="Ellipse",G[G.Polygon=3]="Polygon",G[G.Star=4]="Star",(j=ei||(ei={}))[j.Butt=0]="Butt",j[j.Round=1]="Round",j[j.Square=2]="Square",(X=er||(er={}))[X.Round=0]="Round",X[X.Bevel=1]="Bevel",X[X.Miter=2]="Miter",(H=en||(en={})).AnimationClipNodeData="AnimationClipNodeData",H.BlendNodeData="BlendNodeData",H.ApplyAdditiveNodeData="ApplyAdditiveNodeData",H.LayerBlendNodeData="LayerBlendNodeData",H.StateMachineNodeData="StateMachineNodeData",H.TransitionNodeData="TransitionNodeData",H.StateNodeData="StateNodeData",H.ConstFloatNodeData="ConstFloatNodeData",H.ConstBoolNodeData="ConstBoolNodeData",H.ControlParameterBoolNodeData="ControlParameterBoolNodeData",H.ControlParameterFloatNodeData="ControlParameterFloatNodeData",H.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",H.NotNodeData="NotNodeData",H.AndNodeData="AndNodeData",H.OrNodeData="OrNodeData",H.EqualNodeData="EqualNodeData",H.GreaterNodeData="GreaterNodeData",H.LessNodeData="LessNodeData",(W=ea||(ea={})).video="video",W.image="image",(Y=eo||(eo={})).video="video",Y.audio="audio",(Z=es||(es={})).VFXItemData="VFXItemData",Z.Material="Material",Z.Shader="Shader",Z.Geometry="Geometry",Z.Texture="Texture",Z.Image="Image",Z.AnimationClip="AnimationClip",Z.BinaryAsset="BinaryAsset",Z.TrackAsset="TrackAsset",Z.TimelineAsset="TimelineAsset",Z.ObjectBindingTrack="ObjectBindingTrack",Z.TransformTrack="TransformTrack",Z.SpriteColorTrack="SpriteColorTrack",Z.ActivationTrack="ActivationTrack",Z.SubCompositionTrack="SubCompositionTrack",Z.FloatPropertyTrack="FloatPropertyTrack",Z.ColorPropertyTrack="ColorPropertyTrack",Z.Vector2PropertyTrack="Vector2PropertyTrack",Z.Vector4PropertyTrack="Vector4PropertyTrack",Z.TransformPlayableAsset="TransformPlayableAsset",Z.SpriteColorPlayableAsset="SpriteColorPlayableAsset",Z.ActivationPlayableAsset="ActivationPlayableAsset",Z.SubCompositionPlayableAsset="SubCompositionPlayableAsset",Z.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",Z.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",Z.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",Z.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",Z.MeshComponent="MeshComponent",Z.SkyboxComponent="SkyboxComponent",Z.LightComponent="LightComponent",Z.CameraComponent="CameraComponent",Z.ModelPluginComponent="ModelPluginComponent",Z.TreeComponent="TreeComponent",Z.AnimationComponent="AnimationComponent",Z.SpineComponent="SpineComponent",Z.VideoComponent="VideoComponent",Z.AudioComponent="AudioComponent",Z.RichTextComponent="RichTextComponent",Z.OrientationComponent="OrientationComponent",Z.ShapeComponent="ShapeComponent",Z.SpriteComponent="SpriteComponent",Z.ParticleSystem="ParticleSystem",Z.InteractComponent="InteractComponent",Z.CameraController="CameraController",Z.PostProcessVolume="PostProcessVolume",Z.EffectComponent="EffectComponent",Z.TextComponent="TextComponent",Z.AnimationGraphAsset="AnimationGraphAsset",Z.Animator="Animator",Z.TimelineClip="TimelineClip",(q=eu||(eu={}))[q.POINTS=0]="POINTS",q[q.LINES=1]="LINES",q[q.LINE_LOOP=2]="LINE_LOOP",q[q.LINE_STRIP=3]="LINE_STRIP",q[q.TRIANGLES=4]="TRIANGLES",q[q.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",q[q.TRIANGLE_FAN=6]="TRIANGLE_FAN",(K=eh||(eh={}))[K.Float16=0]="Float16",K[K.Float32=1]="Float32",K[K.Int8=2]="Int8",K[K.Int16=3]="Int16",K[K.Int32=4]="Int32",K[K.UInt8=5]="UInt8",K[K.UInt16=6]="UInt16",K[K.UInt32=7]="UInt32",(Q=el||(el={}))[Q.None=-1]="None",Q[Q.UInt8=0]="UInt8",Q[Q.UInt16=1]="UInt16",Q[Q.UInt32=2]="UInt32",(J=ec||(ec={})).Position="POSITION",J.Uv="TEXCOORD0",J.Uv2="TEXCOORD1",J.Normal="NORMAL",J.Tangent="TANGENT",J.Color="COLOR",J.Joints="JOINTS",J.Weights="WEIGHTS",J.PositionBS0="POSITION_BS0",J.PositionBS1="POSITION_BS1",J.PositionBS2="POSITION_BS2",J.PositionBS3="POSITION_BS3",J.PositionBS4="POSITION_BS4",J.PositionBS5="POSITION_BS5",J.PositionBS6="POSITION_BS6",J.PositionBS7="POSITION_BS7",J.NormalBS0="NORMAL_BS0",J.NormalBS1="NORMAL_BS1",J.NormalBS2="NORMAL_BS2",J.NormalBS3="NORMAL_BS3",J.TangentBS0="TANGENT_BS0",J.TangentBS1="TANGENT_BS1",J.TangentBS2="TANGENT_BS2",J.TangentBS3="TANGENT_BS3";var iE=Object.freeze({__proto__:null,LATEST_VERSION:tF.LATEST,get RenderLevel(){return tL},get BlendingMode(){return tV},get SideMode(){return tD},get ObscuredMode(){return tk},get ParticleEmitterShapeType(){return tz},get PluginType(){return tU},get InteractType(){return tB},get InteractBehavior(){return tG},get ItemType(){return tj},get RenderMode(){return tX},get ParticleOrigin(){return tH},get RenderType(){return tW},get RenderFace(){return tY},get CameraClipMode(){return tZ},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:0,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return tq},get BezierKeyframeType(){return tK},get JSONSceneVersion(){return tF},get EndBehavior(){return tQ},get ParticleInteractionBehavior(){return tJ},get ShapeArcMode(){return t$},get LightType(){return t0},get ModelBoundingType(){return t1},get CameraType(){return t2},get MaterialType(){return t3},get MaterialBlending(){return t4},get RenderMode3D(){return t5},get TextOverflow(){return t6},get TextBaseline(){return t8},get TextAlignment(){return t9},get TextWeight(){return t7},get FontStyle(){return et},BuiltinObjectGUID:iT,get ShapePrimitiveType(){return ee},get LineCap(){return ei},get LineJoin(){return er},get NodeDataType(){return en},get BackgroundType(){return ea},get MultimediaType(){return eo},get DataType(){return es},get GeometryType(){return eu},get VertexFormatType(){return eh},get IndexFormatType(){return el},get VertexBufferSemantic(){return ec}}),i_=new Map,iC=new Map,iS={};function iA(t){return function(e,i){iS[t]&&console.warn("Class "+t+" is already registered."),iS[t]=e}}function iw(t){var e=t.constructor;if(iC.get(e))return iC.get(e);var i={};iC.set(e,i);for(var r=t,n=e;n;){var a=i_.get(n);for(var o in a)i[o]=a[o];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function iR(t,e){return function(i,r){var n,a=(n=i.constructor,i_.get(n)||i_.set(n,{}),i_.get(n));a&&(a[r]||(a[r]={type:t,sourceName:e}))}}var iI=function(){function t(t){this.engine=t,this.guid=iu(),this.defination={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){},e.dispose=function(){},t.is=function(e){return a(e,t)&&"guid"in e},t}(),iM=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),iO={};function iP(t){return function(e,i){iO[t]&&console.warn("NodeData Class "+t+" is already registered."),iO[t]=e}}var iN=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw Error("Node not initialized!");0==--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw Error("Node still initialized!");this.lastUpdateID=-1},t}(),iF=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i},t}(),iL=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.previousTime=0,e.currentTime=0,e}ib(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(iN),iV=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.setValue=function(t){},e}(iN),iD=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iV),ik=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iV);t.AnimationGraphAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.nodeDatas=[],e.graphDataSet=new iM,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=-1,e}return ib(e,t),e.prototype.fromData=function(t){var i=t.nodeDatas;this.rootNodeIndex=t.rootNodeIndex,this.controlParameterIDs=t.controlParameterIDs;for(var r=t.controlParameterIDs.length,a=0;a<r;a++)this.parameterLookupMap.set(t.controlParameterIDs[a],a);this.nodeDatas=[];for(var o=0;o<i.length;o++)this.nodeDatas[o]=e.createNodeData(i[o].type),this.nodeDatas[o].load(i[o]);this.graphDataSet=new iM,this.graphDataSet.resources=[];for(var s,u=n(t.graphDataSet.resources);!(s=u()).done;){var h=s.value,l=this.engine.findObject(h);this.graphDataSet.resources.push(l)}},e.createNodeData=function(t){var e=iO[t];if(e)return new e;throw Error("Unknown node type: "+t+".")},e}(iI),t.AnimationGraphAsset=s([iA("AnimationGraphAsset")],t.AnimationGraphAsset),($=ef||(ef={}))[$.Active=0]="Active",$[$.Inactive=1]="Inactive";var iz=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),iU=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t].asset=this.nodeDatas[t],this.nodes[t]):null},t}();function iB(){return(iB=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}var iG=Math.PI/180,ij=180/Math.PI;function iX(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var iH=function(t,e,i){return(1-i)*t+i*e};function iW(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i;return Math.min(Math.max(t,Math.min(r,n)),Math.max(r,n))}t.AnimationClipNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(iY,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=iB({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(iF),t.AnimationClipNodeData=s([iP(en.AnimationClipNodeData)],t.AnimationClipNodeData);var iY=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.animation=null,e.animatable=null,e}ib(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=iW(this.currentTime,0,1);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new iZ(e.skeleton,this.animation))},e}(iL);(tt=ed||(ed={}))[tt.Position=0]="Position",tt[tt.Scale=1]="Scale",tt[tt.Rotation=2]="Rotation",tt[tt.Euler=3]="Euler";var iZ=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=n(e.positionCurves);!(i=r()).done;){var a=i.value;this.addTransformCurveInfo(a,0)}for(var o,s=n(e.scaleCurves);!(o=s()).done;){var u=o.value;this.addTransformCurveInfo(u,1)}for(var h,l=n(e.rotationCurves);!(h=l()).done;){var c=h.value;this.addTransformCurveInfo(c,2)}for(var f,d=n(e.eulerCurves);!(f=d()).done;){var p=f.value;this.addTransformCurveInfo(p,3)}for(var m,v=n(e.floatCurves);!(m=v()).done;){var y=m.value;this.addFloatCurveInfo(y)}for(var g,x=n(e.colorCurves);!(g=x()).done;){var b=g.value;this.addColorCurveInfo(b)}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=iW(t,0,this.animationClip.duration),a=n(this.transformCurveInfos);!(i=a()).done;){var o=i.value,s=o.curve.keyFrames.getValue(r),u=e.parentSpaceTransforms[o.boneIndex];switch(o.type){case 0:u.position.copyFrom(s);break;case 1:u.scale.copyFrom(s);break;case 2:u.rotation.copyFrom(s);break;case 3:u.euler.copyFrom(s)}}for(var h,l=n(this.floatCurveInfos);!(h=l()).done;){var c=h.value,f=c.curve.keyFrames.getValue(r);e.floatPropertyValues[c.animatedObjectIndex]=f}for(var d,p=n(this.colorCurveInfos);!(d=p()).done;){var m=d.value,v=m.curve.keyFrames.getValue(r);e.colorPropertyValues[m.animatedObjectIndex]=v}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),iq=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):a(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):a(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):a(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):a(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=this.x,e=this.y;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iq.ONE=new iq(1,1),iq.ZERO=new iq(0,0);var iK=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):a(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):a(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):a(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):a(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,o=e.y,s=e.z;return this.x=r*s-n*o,this.y=n*a-i*s,this.z=i*o-r*a,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=this.x,e=this.y,i=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new iq(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();iK.X=new iK(1,0,0),iK.Y=new iK(0,1,0),iK.Z=new iK(0,0,1),iK.ONE=new iK(1,1,1),iK.ZERO=new iK(0,0,0);var iQ=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],a=e[1],o=e[5],s=e[9],u=e[2],h=e[6],l=e[10],c=i+o+l;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(h-s)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>o&&i>l){var d=2*Math.sqrt(1+i-o-l);this.w=(h-s)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(o>l){var p=2*Math.sqrt(1+o-i-l);this.w=(n-u)/p,this.x=(r+a)/p,this.y=.25*p,this.z=(s+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-o);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(s+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0):(this.x=0,this.y=-t.z,this.z=t.y)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x),this.w=i,this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(iW(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);return 0===i||this.slerp(t,Math.min(1,e/i)),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=e.x,s=e.y,u=e.z,h=e.w;return this.x=i*h+a*o+r*u-n*s,this.y=r*h+a*s+n*o-i*u,this.z=n*h+a*u+i*s-r*o,this.w=a*h-i*o-r*s-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this.x,r=this.y,n=this.z,a=this.w,o=a*t.w+i*t.x+r*t.y+n*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=a,this.x=i,this.y=r,this.z=n,this;var s=1-o*o;if(s<=Number.EPSILON){var u=1-e;return this.w=u*a+e*this.w,this.x=u*i+e*this.x,this.y=u*r+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var h=Math.sqrt(s),l=Math.atan2(h,o),c=Math.sin((1-e)*l)/h,f=Math.sin(e*l)/h;return this.w=a*c+this.w*f,this.x=i*c+this.x*f,this.y=r*c+this.y*f,this.z=n*c+this.z*f,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this.x,r=this.y,n=this.z,a=this.w,o=t.x,s=t.y,u=t.z,h=a*o+r*u-n*s,l=a*s+n*o-i*u,c=a*u+i*s-r*o,f=-i*o-r*s-n*u,d=null!=e?e:t;return d.x=h*a+-(f*i)+-(l*n)- -(c*r),d.y=l*a+-(f*r)+-(c*i)- -(h*n),d.z=c*a+-(f*n)+-(h*r)- -(l*i),d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(iK.ZERO,this,iK.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,i){return new t().setFromAxisAngle(e,i)},t.fromVector4=function(e){return new t().setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return new t().setFromUnitVectors(e,i)},t}();iQ.tempVec0=new iK;var iJ=new iQ,i$=function(){},i0=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(i$),i1=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=iJ.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(i$),i2=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var a=0;a<t.parentSpaceTransforms.length;a++){var o=t.parentSpaceTransforms[a],s=e.parentSpaceTransforms[a],u=r.parentSpaceTransforms[a],h=o.position,l=s.position,c=u.position;n.blendVector3(h,l,i,c);var f=o.rotation,d=s.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=o.scale,v=s.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=o.euler,x=s.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var E=t.floatPropertyValues[T],_=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,_,i)}for(var C=0;C<t.colorPropertyValues.length;C++){var S=t.colorPropertyValues[C],A=e.colorPropertyValues[C],w=r.colorPropertyValues[C];n.blendColor(S,A,i,w)}},t}();i2.normalBlendFunction=new i0,i2.additiveBlendFunction=new i1;var i3=function(){function t(t){this.position=new iK,this.rotation=new iQ,this.scale=new iK,this.euler=new iK,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),i4=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=n(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push(new i3().copyFrom(r))}for(var a,o=n(t.defaultFloatPropertyValues);!(a=o()).done;){var s=a.value;this.floatPropertyValues.push(s)}for(var u,h=n(t.defaultColorPropertyValues);!(u=h()).done;){var l=u.value;this.colorPropertyValues.push(l)}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),i5=function(t){this.pose=new i4(t)};t.ApplyAdditiveNodeData=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(i6,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(iF),t.ApplyAdditiveNodeData=s([iP(en.ApplyAdditiveNodeData)],t.ApplyAdditiveNodeData);var i6=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new i5(e.skeleton),this.additiveNodeResult=new i5(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){i2.additiveBlend(t,e,i,r)},e}(iL);t.BlendNodeData=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(i8,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(iF),t.BlendNodeData=s([iP(en.BlendNodeData)],t.BlendNodeData);var i8=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.source0=null,e.source1=null,e.inputParameterValueNode=null,e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new i5(e.skeleton),this.source1Result=new i5(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){i2.localBlend(t,e,i,r)},e}(iL);t.AndNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(i9,t),r=n(this.conditionNodeIndices);!(e=r()).done;){var a=e.value;i.conditionNodes.push(t.getNode(a))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(iF),t.AndNodeData=s([iP(en.AndNodeData)],t.AndNodeData);var i9=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=n(this.conditionNodes);!(e=i()).done;)if(!e.value.getValue(t)){this.result=!1;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=n(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=n(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(ik);t.OrNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodeIndices=[],e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(i7,t),r=n(this.conditionNodeIndices);!(e=r()).done;){var a=e.value;i.conditionNodes.push(t.getNode(a))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(iF),t.OrNodeData=s([iP(en.OrNodeData)],t.OrNodeData);var i7=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.conditionNodes=[],e.result=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=n(this.conditionNodes);!(e=i()).done;)if(e.value.getValue(t)){this.result=!0;break}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=n(this.conditionNodes);!(i=r()).done;)i.value.initialize(e);this.result=!1},i.shutdownInternal=function(e){for(var i,r=n(this.conditionNodes);!(i=r()).done;)i.value.shutdown(e);t.prototype.shutdownInternal.call(this,e)},e}(ik);t.NotNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rt,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(iF),t.NotNodeData=s([iP(en.NotNodeData)],t.NotNodeData);var rt=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.result=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){return!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}(ik);t.ConstFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(re,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iF),t.ConstFloatNodeData=s([iP(en.ConstFloatNodeData)],t.ConstFloatNodeData);var re=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}return ib(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(iD);t.ConstBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ri,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iF),t.ConstBoolNodeData=s([iP(en.ConstBoolNodeData)],t.ConstBoolNodeData);var ri=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!0,e}return ib(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(ik);t.ControlParameterFloatNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rr,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iF),t.ControlParameterFloatNodeData=s([iP(en.ControlParameterFloatNodeData)],t.ControlParameterFloatNodeData);var rr=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=0,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(iD);t.ControlParameterBoolNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rn,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(iF),t.ControlParameterBoolNodeData=s([iP(en.ControlParameterBoolNodeData)],t.ControlParameterBoolNodeData);var rn=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(ik);t.ControlParameterTriggerNodeData=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ra,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(iF),t.ControlParameterTriggerNodeData=s([iP(en.ControlParameterTriggerNodeData)],t.ControlParameterTriggerNodeData);var ra=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=!1,e}ib(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(ik);t.LayerBlendNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseNodeIndex=-1,e.layerDatas=[],e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ro,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=n(this.layerDatas);!(i=r()).done;){var a=i.value;e.layers.push({inputNode:t.getNode(a.inputNodeIndex),weightValueNode:t.getNode(a.weightValueNodeIndex),weight:0})}},i.load=function(e){if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:-1,e.layerDatas)for(var i,r,a=n(e.layerDatas);!(r=a()).done;){var o=r.value;this.layerDatas.push(iB({inputNodeIndex:-1,weightValueNodeIndex:-1},o))}},e}(iF),t.LayerBlendNodeData=s([iP(en.LayerBlendNodeData)],t.LayerBlendNodeData);var ro=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.baseLayerNode=null,e.layers=[],e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new i5(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var i,r,a=n(this.layers);!(r=a()).done;){var o,s,u=r.value;null==(o=u.inputNode)||o.initialize(e),null==(s=u.weightValueNode)||s.initialize(e)}},i.shutdownInternal=function(e){null==(i=this.baseLayerNode)||i.shutdown(e);for(var i,r,a=n(this.layers);!(r=a()).done;){var o,s,u=r.value;null==(o=u.inputNode)||o.shutdown(e),null==(s=u.weightValueNode)||s.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()&&(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e)),e},i.updateLayers=function(t,e){for(var i,r=n(this.layers);!(i=r()).done;){var a=i.value;if(a.inputNode&&a.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),a.inputNode.evaluate(t,this.layerNodeResult);var o=a.weightValueNode.getValue(t);i2.localBlend(e.pose,this.layerNodeResult.pose,o,e.pose)}}return e},e}(iL);t.EqualNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rs,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(iF),t.EqualNodeData=s([iP(en.EqualNodeData)],t.EqualNodeData);var rs=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}(ik),ru=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNodeIndex=-1,e.comparandValueNodeIndex=-1,e}return ib(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(iF);(te=ep||(ep={}))[te.GreaterThan=0]="GreaterThan",te[te.LessThan=1]="LessThan";var rh=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}ib(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}(ik);t.GreaterNodeData=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.instantiate=function(t){var e=this.createNode(rh,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(ru),t.GreaterNodeData=s([iP(en.GreaterNodeData)],t.GreaterNodeData),t.LessNodeData=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.instantiate=function(t){var e=this.createNode(rh,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(ru),t.LessNodeData=s([iP(en.LessNodeData)],t.LessNodeData),t.StateMachineNodeData=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rl,t);e.defaultStateIndex=this.defaultStateIndex;for(var i,r=n(this.stateDatas);!(i=r()).done;){var a=i.value,o={stateNode:t.getNode(a.stateNodeIndex),transitions:[]};e.states.push(o);for(var s,u=n(a.transitionDatas);!(s=u()).done;){var h=s.value,l={transitionNode:t.getNode(h.transitionNodeIndex),conditionNode:t.getNode(h.conditionNodeIndex),targetStateIndex:h.targetStateIndex};o.transitions.push(l)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex},e}(iF),t.StateMachineNodeData=s([iP(en.StateMachineNodeData)],t.StateMachineNodeData);var rl=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.states=[],e.defaultStateIndex=-1,e.activeTransition=null,e.activeStateIndex=-1,e}ib(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===ef.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=-1,n=i.transitions.length,a=0;a<n;a++){var o=i.transitions[a];if(-1===o.targetStateIndex)throw Error("Invalid target state index.");if(!this.states[o.targetStateIndex].stateNode.isTransitioning()){var s=!1;if(o.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>o.transitionNode.exitTime&&(s=!0)}else null!==o.conditionNode&&o.conditionNode.getValue(t)&&(s=!0);if(s){r=a;break}}}if(-1!==r){var h=i.transitions[r];h.transitionNode.initialize(t),e=null!==this.activeTransition?h.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):h.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=h.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=h.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=-1,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=n(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=n(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(iL);t.TransitionState=void 0,(ti=t.TransitionState||(t.TransitionState={}))[ti.None=0]="None",ti[ti.TransitioningIn=1]="TransitioningIn",ti[ti.TransitioningOut=2]="TransitioningOut",t.StateNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNodeIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(rc,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex},e}(iF),t.StateNodeData=s([iP(en.StateNodeData)],t.StateNodeData);var rc=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}ib(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(iL);t.SourceType=void 0,(tr=t.SourceType||(t.SourceType={}))[tr.State=0]="State",tr[tr.Transition=1]="Transition",tr[tr.CachedPose=2]="CachedPose",t.TransitionNodeData=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=-1,e}ib(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rf,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(iF),t.TransitionNodeData=s([iP(en.TransitionNodeData)],t.TransitionNodeData);var rf=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.hasExitTime=!1,t.exitTime=.75,t.transitionLength=0,t.transitionProgress=0,t.blendWeight=0,t.sourceNode=null,t.sourceType=0,t.blendedDuration=0,t}ib(i,e);var r=i.prototype;return r.evaluate=function(t,e){e4(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=iW(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=ef.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult);if(this.registerPoseTasksAndUpdateRootMotion(i,n,e),this.blendedDuration=iH(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var a=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+a)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),e},r.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},r.getProgressPercentage=function(){return this.transitionProgress},r.getSourceType=function(){return this.sourceType},r.isSourceATransition=function(){return 1===this.sourceType},r.isSourceAState=function(){return 0===this.sourceType},r.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},r.getSourceStateNode=function(){return this.sourceNode},r.getSourceTransitionNode=function(){return this.sourceNode},r.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},r.initializeInternal=function(t){e.prototype.initializeInternal.call(this,t),this.sourceNodeResult=new i5(t.skeleton),this.targetNodeResult=new i5(t.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},r.shutdownInternal=function(i){this.targetNode.setTransitioningState(t.TransitionState.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(i),this.sourceNode.shutdown(i),this.sourceNode=null),e.prototype.shutdownInternal.call(this,i)},r.endSourceTransition=function(e){var i,r=this.getSourceTransitionNode().targetNode;null==(i=this.sourceNode)||i.shutdown(e),this.sourceNode=r,this.sourceType=0,this.getSourceStateNode().setTransitioningState(t.TransitionState.TransitioningOut)},r.initializeTargetStateAndUpdateTransition=function(t,e,i){this.markNodeActive(t);var r=this.targetNodeResult;return 0===this.sourceType&&this.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),r=this.targetNode.evaluate(t,r),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,r,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=iH(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},r.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=iW(this.blendWeight,0,1))},r.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;i2.localBlend(t.pose,e.pose,r,i.pose)},i}(iL);(tn=em||(em={}))[tn.Float=0]="Float",tn[tn.Color=1]="Color";var rd=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=n(e.position);!(i=r()).done;){var a=i.value;this.addReferenceTransform(a)}for(var o,s=n(e.rotation);!(o=s()).done;){var u=o.value;this.addReferenceTransform(u)}for(var h,l=n(e.scale);!(h=l()).done;){var c=h.value;this.addReferenceTransform(c)}for(var f,d=n(e.euler);!(f=d()).done;){var p=f.value;this.addReferenceTransform(p),this.useEuler=!0}for(var m=0;m<e.floats.length;m++){var v=e.floats[m];this.addRecordedProperty(v.path,v.className,v.property,0)}for(var y=0;y<e.colors.length;y++){var g=e.colors[y];this.addRecordedProperty(g.path,g.className,g.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new i3(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n,a=t+e+i;if(void 0===this.pathToObjectIndex.get(a)){var o=this.findTarget(t);if(o){(n="VFXItem"===e?o:o.getComponent(iS[e]))||console.error("The "+e+" Component was not found.");for(var s=i.split("."),u=s[s.length-1],h=n,l=0;l<s.length-1;l++){var c=h[s[l]];void 0===c&&console.error("The "+s[l]+" property of "+h+" was not found."),h=c}var f={target:h,property:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(a,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push(h[u]),this.pathToObjectIndex.set(a,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,a=n(i);!(e=a()).done;){var o=e.value,s=r.find(o);if(!s)return null;r=s}return r},t}(),rp=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.context=new iz;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},a=n(t.graphDataSet.resources);!(i=a()).done;){var o=i.value;if(o){for(var s,u=n(o.positionCurves);!(s=u()).done;){var h=s.value;r.position.push(h.path)}for(var l,c=n(o.rotationCurves);!(l=c()).done;){var f=l.value;r.rotation.push(f.path)}for(var d,p=n(o.scaleCurves);!(d=p()).done;){var m=d.value;r.scale.push(m.path)}for(var v,y=n(o.eulerCurves);!(v=y()).done;){var g=v.value;r.euler.push(g.path)}for(var x,b=n(o.floatCurves);!(x=b()).done;){var T=x.value;r.floats.push(T)}for(var E,_=n(o.colorCurves);!(E=_()).done;){var C=E.value;r.colors.push(C)}}}this.skeleton=new rd(e,r),this.result=new i5(this.skeleton),this.context.skeleton=this.skeleton;var S=new iU;S.nodes=this.nodes,S.nodeDatas=t.nodeDatas,S.dataSet=t.graphDataSet;for(var A=0;A<t.nodeDatas.length;A++)S.nodes[A]||t.nodeDatas[A].instantiate(S);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];a(i,ra)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),-1)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);-1!==i&&this.nodes[i].setValue(e)},t}();function rm(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rv(t,e,i){return e&&rm(t.prototype,e),i&&rm(t,i),t}var ry=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}ib(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onDestroy=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&ek(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},rv(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(iI);s([iR(void 0,void 0)],ry.prototype,"item",void 0),s([iR(void 0,void 0)],ry.prototype,"_enabled",void 0);var rg=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(ry);t.Animator=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.graph=null,e.graphAsset=null,e}ib(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graph&&this.graph.setBool(t,e)},i.setFloat=function(t,e){this.graph&&this.graph.setFloat(t,e)},i.setTrigger=function(t){this.graph&&this.graph.setTrigger(t)},i.resetTrigger=function(t){this.graph&&this.graph.resetTrigger(t)},i.onStart=function(){this.graphAsset&&(this.graph=new rp(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graph){for(var e=this.graph.evaluateGraph(t/1e3),i=this.graph.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,a=e.pose.parentSpaceTransforms[r].rotation,o=e.pose.parentSpaceTransforms[r].scale,s=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(o.x,o.y,o.z),this.graph.skeleton.useEuler?i[r].setRotation(s.x,s.y,s.z):i[r].setQuaternion(a.x,a.y,a.z,a.w)}for(var u=this.graph.skeleton.floatAnimatedObjects,h=0;h<u.length;h++){var l=u[h],c=l.property;l.target[c]=e.pose.floatPropertyValues[h]}for(var f=this.graph.skeleton.colorAnimatedObjects,d=0;d<f.length;d++){var p=f[d],m=p.property;p.target[m]=e.pose.colorPropertyValues[d]}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(ry),t.Animator=s([iA("Animator")],t.Animator);var rx=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e._priority=0,e}ib(e,t);var i=e.prototype;return i.render=function(t){},i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},rv(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(ry);s([iR(void 0,void 0)],rx.prototype,"materials",void 0),s([iR(void 0,void 0)],rx.prototype,"_priority",void 0);var rb=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(a=t[e+3])?a:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):a(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):a(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):a(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):a(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=this.x,e=this.y,i=this.z,r=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new iK(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();rb.ONE=new rb(1,1,1,1),rb.ZERO=new rb(0,0,0,0);var rT=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.meshCollider=new oL,e.getHitTestParams=function(t){var i=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,i);var r=e.meshCollider.getBoundingBoxData();if(r)return{type:r.type,triangles:r.area}},e}ib(e,t);var i=e.prototype;return i.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.materials[e],e)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(rx);s([iR(void 0,void 0)],rT.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}ib(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new rb;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(rT),t.EffectComponent=s([iA(es.EffectComponent)],t.EffectComponent),t.PostProcessVolume=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return ib(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(ry),s([iR(void 0,void 0)],t.PostProcessVolume.prototype,"bloom",void 0),s([iR(void 0,void 0)],t.PostProcessVolume.prototype,"vignette",void 0),s([iR(void 0,void 0)],t.PostProcessVolume.prototype,"tonemapping",void 0),s([iR(void 0,void 0)],t.PostProcessVolume.prototype,"colorAdjustments",void 0),t.PostProcessVolume=s([iA(es.PostProcessVolume)],t.PostProcessVolume);var rE=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,o=n*(1-Math.abs(a%2-1)),s=0,u=0,h=0;a>=0&&a<=1?(s=n,u=o):a>=1&&a<=2?(s=o,u=n):a>=2&&a<=3?(u=n,h=o):a>=3&&a<=4?(u=o,h=n):a>=4&&a<=5?(s=o,h=n):a>=5&&a<=6&&(s=n,h=o);var l=i-n;return this.set(s+l,u+l,h+l,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):a(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):a(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):a(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):a(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return .3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new rb(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,a=Math.max(e,i,r),o=Math.min(e,i,r),s=a-o,u=0,h=0;return 0!==a&&(h=s/a),a!=o&&(a==e?(u=(i-r)/s,i<r&&(u+=6)):a==i?u=(r-e)/s+2:a==r&&(u=(e-i)/s+4),u*=60),new t(u,h,a,n)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),new t().setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();rE.BLACK=new rE(0,0,0,1),rE.BLUE=new rE(0,0,1,1),rE.CLEAR=new rE(0,0,0,0),rE.CYAN=new rE(0,1,1,1),rE.GRAY=new rE(.5,.5,.5,1),rE.GREEN=new rE(0,1,0,1),rE.MAGENTA=new rE(1,0,1,1),rE.RED=new rE(1,0,0,1),rE.WHITE=new rE(1,1,1,1),rE.YELLOW=new rE(1,.92,.016,1);var r_=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=a,v[6]=o,v[7]=s,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=a,v[9]=o,v[13]=s,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),a=Math.sin(i),o=1-n,s=r.x,u=r.y,h=r.z,l=o*s,c=o*u;return this.set(l*s+n,l*u+a*h,l*h-a*u,0,l*u-a*h,c*u+n,c*h+a*s,0,l*h+a*u,c*h-a*s,o*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(iK.ZERO,t,iK.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,o=t.tempVec2;o.subtractVectors(e,i),o.normalize(),n.crossVectors(r,o),n.normalize(),a.crossVectors(o,n);var s=this.elements;return s[0]=n.x,s[1]=a.x,s[2]=o.x,s[3]=0,s[4]=n.y,s[5]=a.y,s[6]=o.y,s[7]=0,s[8]=n.z,s[9]=a.z,s[10]=o.z,s[11]=0,s[12]=-n.dot(e),s[13]=-a.dot(e),s[14]=-o.dot(e),s[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<16;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[4],s=i[8],u=i[12],h=i[1],l=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],E=r[4],_=r[8],C=r[12],S=r[1],A=r[5],w=r[9],R=r[13],I=r[2],M=r[6],O=r[10],P=r[14],N=r[3],F=r[7],L=r[11],V=r[15];return n[0]=a*T+o*S+s*I+u*N,n[4]=a*E+o*A+s*M+u*F,n[8]=a*_+o*w+s*O+u*L,n[12]=a*C+o*R+s*P+u*V,n[1]=h*T+l*S+c*I+f*N,n[5]=h*E+l*A+c*M+f*F,n[9]=h*_+l*w+c*O+f*L,n[13]=h*C+l*R+c*P+f*V,n[2]=d*T+p*S+m*I+v*N,n[6]=d*E+p*A+m*M+v*F,n[10]=d*_+p*w+m*O+v*L,n[14]=d*C+p*R+m*P+v*V,n[3]=y*T+g*S+x*I+b*N,n[7]=y*E+g*A+x*M+b*F,n[11]=y*_+g*w+x*O+b*L,n[15]=y*C+g*R+x*P+b*V,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],a=t[1],o=t[5],s=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*s*l-r*u*l-n*o*c+i*u*c+r*o*f-i*s*f)+t[7]*(+e*s*f-e*u*c+n*a*c-r*a*f+r*u*h-n*s*h)+t[11]*(+e*u*l-e*o*f-n*a*l+i*a*f+n*o*h-i*u*h)+t[15]*(-r*o*h-e*s*l+e*o*c+r*a*l-i*a*c+i*s*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],o=t[5],s=t[6],u=t[7],h=t[8],l=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=l*m*u-p*c*u+p*s*f-o*m*f-l*s*v+o*c*v,g=d*c*u-h*m*u-d*s*f+a*m*f+h*s*v-a*c*v,x=h*p*u-d*l*u+d*o*f-a*p*f-h*o*v+a*l*v,b=d*l*s-h*p*s-d*o*c+a*p*c+h*o*m-a*l*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=y*E,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*E,t[2]=(o*m*n-p*s*n+p*r*u-i*m*u-o*r*v+i*s*v)*E,t[3]=(l*s*n-o*c*n-l*r*u+i*c*u+o*r*f-i*s*f)*E,t[4]=g*E,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*E,t[6]=(d*s*n-a*m*n-d*r*u+e*m*u+a*r*v-e*s*v)*E,t[7]=(a*c*n-h*s*n+h*r*u-e*c*u-a*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*E,t[10]=(a*p*n-d*o*n+d*i*u-e*p*u-a*i*v+e*o*v)*E,t[11]=(h*o*n-a*l*n-h*i*u+e*l*u+a*i*f-e*o*f)*E,t[12]=b*E,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*E,t[14]=(d*o*r-a*p*r-d*i*s+e*p*s+a*i*m-e*o*m)*E,t[15]=(a*l*r-h*o*r+h*i*s-e*l*s-a*i*c+e*o*c)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=iK.ZERO);var n=this.elements,a=e.x,o=e.y,s=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=a+a,d=o+o,p=s+s,m=a*f,v=a*d,y=a*p,g=o*d,x=o*p,b=s*p,T=u*f,E=u*d,_=u*p,C=i.x,S=i.y,A=i.z;return n[0]=(1-(g+b))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+b))*S,n[6]=(x+T)*S,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=h*n[0]+l*n[4]+c*n[8]-h+t.x,n[13]=h*n[1]+l*n[5]+c*n[9]-l+t.y,n[14]=h*n[2]+l*n[6]+c*n[10]-c+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,a=this.elements,o=n.set(a[0],a[1],a[2]).length(),s=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();0>this.determinant()&&(o=-o),e.x=a[12],e.y=a[13],e.z=a[14];var h=t.tempMat0;h.copyFrom(this);var l=1/o,c=1/s,f=1/u;return h.elements[0]*=l,h.elements[1]*=l,h.elements[2]*=l,h.elements[4]*=c,h.elements[5]*=c,h.elements[6]*=c,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),r.x=o,r.y=s,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new iK,e=new iQ,i=new iK;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var o=1/(e-t),s=1/(i-r),u=1/(a-n),h=-(e+t)*o,l=-(i+r)*s,c=-(a+n)*u;o*=2,s*=2,u*=-2;var f=this.elements;return f[0]=o,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=l,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var a=1/Math.tan(.5*t),o=1/(i-r),s=this.elements;return s[0]=n?a:a/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?a*e:a,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*o,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*o,s[15]=0,(null===r||r===1/0)&&(s[10]=-1,s[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14];var s=a[3]*i+a[7]*r+a[11]*n+a[15];return o.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12],o.y=a[1]*i+a[5]*r+a[9]*n+a[13],o.z=a[2]*i+a[6]*r+a[10]*n+a[14],o},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n,o.y=a[1]*i+a[5]*r+a[9]*n,o.z=a[2]*i+a[6]*r+a[10]*n,o.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n+o[12]*a,s.y=o[1]*i+o[5]*r+o[9]*n+o[13]*a,s.z=o[2]*i+o[6]*r+o[10]*n+o[14]*a,s.w=o[3]*i+o[7]*r+o[11]*n+o[15]*a,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!iX(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return new t().lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,a){return new t().perspective(e,i,r,n,a)},t.fromColumnVectors=function(e,i,r,n){return new t().setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromScale=function(e,i,r){return new t().setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return new t().setFromTranslation(e,i,r)},t.fromRotationX=function(e){return new t().setFromRotationX(e)},t.fromRotationY=function(e){return new t().setFromRotationY(e)},t.fromRotationZ=function(e){return new t().setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return new t().setFromRotationAxis(e,i)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,i,r){return new t().setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return new t().setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h,l,c,f,d,p,m,v){return new t(e,a,h,d,i,o,l,p,r,s,c,m,n,u,f,v)},t}();function rC(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"!==e||(r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}function rS(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var r=t.createQuery(),n=i(function(){return u(this,function(i){return[2,new Promise(function(i,a){if(r){var o=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);o&&!s&&i(t.getQueryParameter(r,t.QUERY_RESULT)/1e3/1e3),(o||s)&&(t.deleteQuery(r),r=null),null!==o&&r&&window.setTimeout(function(){n().then(i).catch},1)}})]})});if(!r)return;return{begin:function(){r&&t.beginQuery(e.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:n}}}r_.IDENTITY=new r_(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),r_.ZERO=new r_(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),r_.tempVec0=new iK,r_.tempVec1=new iK,r_.tempVec2=new iK,r_.tempMat0=new r_;var rA=[],rw={},rR="WebGL Constants not in global, please check your environment";function rI(){"function"==typeof WebGL2RenderingContext?rO(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(rO(WebGLRenderingContext),rO(WebGLRenderingContext.prototype)):eW?rA.push(eY()?"iOS16 lockdown mode, WebGL Constants not in global":rR):rA.push(rR),rA.length||"HALF_FLOAT"in rw||(rw.HALF_FLOAT=5131)}function rM(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function rO(t){for(var e in t)/^[A-Z_]/.test(e)&&(rw[e]=t[e])}function rP(t){switch(t){case eh.Float32:return WebGLRenderingContext.FLOAT;case eh.Int16:return WebGLRenderingContext.SHORT;case eh.Int8:return WebGLRenderingContext.BYTE;case eh.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case eh.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}}function rN(t){switch(t){case tV.ALPHA:case tV.ADD:case tV.SUBTRACTION:case tV.STRONG_LIGHT:case tV.WEAK_LIGHT:return 1;case tV.SUPERPOSITION:return 2;case tV.BRIGHTNESS:return 3;case tV.MULTIPLY:return 0;default:return 1}}function rF(t,e){switch(e){case void 0:case tV.ALPHA:t.blendFunction=[rw.ONE,rw.ONE_MINUS_SRC_ALPHA,rw.ONE,rw.ONE_MINUS_SRC_ALPHA];break;case tV.ADD:t.blendFunction=[rw.ONE,rw.ONE,rw.ONE,rw.ONE];break;case tV.SUBTRACTION:t.blendFunction=[rw.ONE,rw.ONE,rw.ZERO,rw.ONE],t.blendEquation=[rw.FUNC_REVERSE_SUBTRACT,rw.FUNC_REVERSE_SUBTRACT];break;case tV.SUPERPOSITION:t.blendFunction=[rw.ONE,rw.ONE,rw.ONE,rw.ONE];break;case tV.MULTIPLY:t.blendFunction=[rw.DST_COLOR,rw.ONE_MINUS_SRC_ALPHA,rw.DST_COLOR,rw.ONE_MINUS_SRC_ALPHA];break;case tV.BRIGHTNESS:t.blendFunction=[rw.ONE,rw.ONE_MINUS_SRC_ALPHA,rw.ONE,rw.ONE_MINUS_SRC_ALPHA];break;case tV.STRONG_LIGHT:t.blendFunction=[rw.DST_COLOR,rw.DST_ALPHA,rw.ZERO,rw.ONE];break;case tV.WEAK_LIGHT:t.blendFunction=[rw.DST_COLOR,rw.ZERO,rw.ZERO,rw.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function rL(t,e){e===tD.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=rw.CW,t.cullFace=e===tD.BACK?rw.BACK:rw.FRONT)}function rV(e,i){switch(i){case void 0:e.stencilTest=!1;break;case t.MaskMode.MASK:e.stencilTest=!0,e.stencilFunc=[rw.ALWAYS,rw.ALWAYS],e.stencilOpZPass=[rw.REPLACE,rw.REPLACE];break;case t.MaskMode.OBSCURED:e.stencilTest=!0,e.stencilFunc=[rw.EQUAL,rw.EQUAL];break;case t.MaskMode.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[rw.NOTEQUAL,rw.NOTEQUAL];break;case t.MaskMode.NONE:e.stencilTest=!1;break;default:console.warn("MaskMode "+i+" not in specification, please set stencil params seperately.")}}rA.length||rI(),t.ShaderType=void 0,(ta=t.ShaderType||(t.ShaderType={}))[ta.vertex=0]="vertex",ta[ta.fragment=1]="fragment",t.MaskMode=void 0,(to=t.MaskMode||(t.MaskMode={}))[to.NONE=0]="NONE",to[to.MASK=1]="MASK",to[to.OBSCURED=2]="OBSCURED",to[to.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",t.TextureLoadAction=void 0,(ts=t.TextureLoadAction||(t.TextureLoadAction={}))[ts.whatever=0]="whatever",ts[ts.clear=2]="clear",t.TextureSourceType=void 0,(tu=t.TextureSourceType||(t.TextureSourceType={}))[tu.none=0]="none",tu[tu.data=1]="data",tu[tu.image=2]="image",tu[tu.compressed=3]="compressed",tu[tu.video=4]="video",tu[tu.canvas=5]="canvas",tu[tu.framebuffer=6]="framebuffer",tu[tu.mipmaps=7]="mipmaps";var rD=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.download=function(t,e,i,r){var n=this;if(void 0===e&&(e="json"),!this.start(t,i,r)){var a=new XMLHttpRequest,o=function(){n.finish(t,a.status,a.response)};a.responseType=e,a.addEventListener("load",function(){200==a.status?n.finish(t,200,a.response):o()}),a.addEventListener("error",o),a.open("GET",t,!0),a.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(t,e,i){var r=this.callbacks[t];delete this.callbacks[t];for(var n=200==e?[i]:[e,i],a=n.length-1,o=r.length;a<o;a+=2)r[a].apply(null,n)},t}(),rk=!1,rz=!1;function rU(t,e){return rB.apply(this,arguments)}function rB(){return(rB=i(function(t,e){return u(this,function(i){switch(i.label){case 0:if(!(rk||!e))return[3,2];return[4,rX(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rX(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rk=!0,[4,rX(t)];case 6:return[2]}})})).apply(this,arguments)}function rG(t,e){return rj.apply(this,arguments)}function rj(){return(rj=i(function(t,e){return u(this,function(i){switch(i.label){case 0:if(!(rz||!e))return[3,2];return[4,rX(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rX(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),rz=!0,[4,rX(t)];case 6:return[2]}})})).apply(this,arguments)}function rX(t){return rH.apply(this,arguments)}function rH(){return(rH=i(function(t){var e,i;return u(this,function(r){if(e="",a(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else a(t,Blob)?(e=URL.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,r){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&URL.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function rW(t){return rY.apply(this,arguments)}function rY(){return(rY=i(function(t){return u(this,function(e){return[2,new Promise(function(e,i){new rD().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function rZ(){return(rZ=i(function(t){return u(this,function(e){return[2,new Promise(function(e,i){new rD().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function rq(t){return rK.apply(this,arguments)}function rK(){return(rK=i(function(t){var e;return u(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eZ()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=e.play().catch(function(t){i(t)});r?r.then(function(){return t(e)}):e.addEventListener("loadeddata",function i(){t(e),e.removeEventListener("loadeddata",i)},!0),e.addEventListener("error",function(t){i("Load video fail.")})})]})})).apply(this,arguments)}function rQ(t,e){return rJ.apply(this,arguments)}function rJ(){return(rJ=i(function(t,e){return u(this,function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function r$(t,e,i){return r0.apply(this,arguments)}function r0(){return(r0=i(function(e,i,r,n){var a,o,s,h,l,c,f;return u(this,function(u){switch(u.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return a=e.mipmaps,o=e.target,[4,Promise.all(a.map(function(t){return Promise.all(t.map(function(t){return t.id?r[t.id]:r1(t,i)}))}))];case 1:return s=u.sent(),[2,iB({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return h=e.mipmaps,l=e.target,[4,Promise.all(h.map(function(t){return r1(t,i)}))];case 3:return c=u.sent(),f=n[h[0][1][0]].url,[2,iB({keepImageSource:!1},e,{mipmaps:c,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:l,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:h.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function r1(t,e){return r2.apply(this,arguments)}function r2(){return(r2=i(function(t,e){var i,r,n,a,o;return u(this,function(s){if(r=(i=t[1])[0],n=i[1],a=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,rX(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var r3=1,r4=function(e){function r(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+r3++,i}ib(r,e);var n=r.prototype;return n.getWidth=function(){return this.width||0},n.getHeight=function(){return this.height||0},n.uploadCurrentVideoFrame=function(){},n.offloadData=function(){},n.reloadData=function(){},n.initialize=function(){},n.assembleOptions=function(e){var i=e.target,r=void 0===i?rw.TEXTURE_2D:i,n=e.format,a=void 0===n?rw.RGBA:n;return e.sourceType||("image"in e?e.sourceType=t.TextureSourceType.image:"data"in e?e.sourceType=t.TextureSourceType.data:"video"in e?e.sourceType=t.TextureSourceType.video:e.sourceType=0),iB({minFilter:rw.NEAREST,magFilter:rw.NEAREST,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE,target:r,format:rw.RGBA,internalFormat:a,type:rw.UNSIGNED_BYTE},e)},r.fromImage=function(e,n,a){return i(function(){var i,o;return u(this,function(s){switch(s.label){case 0:return[4,rX(e)];case 1:return i=s.sent(),(o=r.create(n,iB({sourceType:t.TextureSourceType.image,image:i,target:rw.TEXTURE_2D,id:iu(),flipY:!0},a))).initialize(),[2,o]}})})()},r.fromVideo=function(e,n,a){return i(function(){var i,o;return u(this,function(s){switch(s.label){case 0:return[4,rq(e)];case 1:return i=s.sent(),(o=r.create(n,iB({sourceType:t.TextureSourceType.video,video:i,id:iu(),flipY:!0},a))).initialize(),[2,o]}})})()},rv(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(iI);function r5(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?rw.RGBA:3===o?rw.RGB:2===o?rw.LUMINANCE_ALPHA:rw.LUMINANCE,r4.createWithData(t,{data:e,width:i,height:r},{type:rw.HALF_FLOAT,format:n,internalFormat:a,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE})}var r6={type:rw.UNSIGNED_BYTE,format:rw.RGBA,internalFormat:rw.RGBA,wrapS:rw.MIRRORED_REPEAT,wrapT:rw.MIRRORED_REPEAT,minFilter:rw.NEAREST,magFilter:rw.NEAREST};function r8(e){return r4.create(e,iB({id:iT.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},r6))}function r9(e){return r4.create(e,iB({id:iT.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},r6))}var r7=function(){function t(t,e,i){void 0===i&&(i=0),this.arrayBuffer=t,this.baseOffset=i;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==r[0]||75!==r[1]||84!==r[2]||88!==r[3]||32!==r[4]||49!==r[5]||49!==r[6]||187!==r[7]||13!==r[8]||10!==r[9]||26!==r[10]||10!==r[11])throw Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),o=67305985===a.getUint32(0,!0);if(this.glType=a.getUint32(1*n,o),this.glTypeSize=a.getUint32(2*n,o),this.glFormat=a.getUint32(3*n,o),this.glInternalFormat=a.getUint32(4*n,o),this.glBaseInternalFormat=a.getUint32(5*n,o),this.pixelWidth=a.getUint32(6*n,o),this.pixelHeight=a.getUint32(7*n,o),this.pixelDepth=a.getUint32(8*n,o),this.numberOfArrayElements=a.getUint32(9*n,o),this.numberOfFaces=a.getUint32(10*n,o),this.numberOfMipmapLevels=a.getUint32(11*n,o),this.bytesOfKeyValueData=a.getUint32(12*n,o),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){e8.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){e8.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){e8.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+".");return}0===this.glType?this.loadType=0:this.loadType=2}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,o=0;o<a;o++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,s);e.push({data:h,width:r,height:n}),i+=s+4+(3-(s+3)%4)}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function nt(e){var i=new r7(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,a=i.pixelHeight,o=i.glType,s=i.numberOfFaces,u=i.glInternalFormat,h=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:o,target:6===s?rw.TEXTURE_CUBE_MAP:rw.TEXTURE_2D,internalFormat:u,format:h,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,a))+1))}}var ne=function(){function e(){this.reloadPending={}}var r=e.prototype;return r.reload=function(t){var e=this;return i(function(){var i,r;return u(this,function(n){switch(n.label){case 0:if(i=t.id,e.reloadPending[i])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw Error("No source from.");case 3:return[2]}})})()},r.canOffloadTexture=function(e){if(e){var i=e.type;if(i===t.TextureSourceType.compressed||i===t.TextureSourceType.image){var r=e.target,n=e.map,a=e.url;return r===rw.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:e7(a)&&a.length>0}if(i===t.TextureSourceType.mipmaps){var o=e.bin,s=e.mipmaps,u=e.target,h=e.maps,l=e.urls;return o?s.length>0:u===rw.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):l.every(function(t){return e7(t)&&t.length>0})}}return!1},r.loadSource=function(e,r){var n=this;return i(function(){var i,a,o,s,h,l,c,f,d,p,m,v,y,g,x,b,T,E;return u(this,function(u){switch(u.label){case 0:if(i=e.type,a=e.target,o=e.map,s=e.url,h=e.bin,l=e.mipmaps,c=e.urls,f=e.maps,!(a===rw.TEXTURE_CUBE_MAP&&i!==t.TextureSourceType.mipmaps))return[3,2];return[4,n.loadCubeMap(o)];case 1:return d=u.sent(),[2,iB({},r,{cube:d,target:rw.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iB({},o),target:rw.TEXTURE_CUBE_MAP}})];case 2:if(i!==t.TextureSourceType.image)return[3,4];return[4,rX(s)];case 3:return p=u.sent(),[2,iB({},r,{image:p,sourceType:t.TextureSourceType.image,sourceFrom:{type:i,url:s,target:rw.TEXTURE_2D}})];case 4:if(i!==t.TextureSourceType.video)return[3,6];return[4,rq(s)];case 5:return m=u.sent(),[2,iB({},r,{video:m,sourceType:t.TextureSourceType.video})];case 6:if(i!==t.TextureSourceType.compressed)return[3,8];return[4,rW(s)];case 7:return v=u.sent(),[2,iB({},nt(v),r,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(i!==t.TextureSourceType.mipmaps)return[3,17];if(!h)return[3,13];return[4,rW(h)];case 9:if(y=u.sent(),x=(g=null!=a?a:rw.TEXTURE_2D)===rw.TEXTURE_2D?l.slice():l.map(function(t){return t.slice()}),a!==rw.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(l.map(function(t){return n.loadMipmapImages(t,y)}))];case 10:return b=u.sent(),[3,12];case 11:b=n.loadMipmapImages(l,y),u.label=12;case 12:return[2,iB({},r,{mipmaps:b,target:g,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:h,mipmaps:x,target:g,type:t.TextureSourceType.mipmaps}})];case 13:if(!(a===rw.TEXTURE_2D||!a))return[3,15];return[4,Promise.all(c.map(function(t){return rX(t)}))];case 14:return T=u.sent(),[2,iB({},r,{mipmaps:T,target:rw.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:c.slice(),target:rw.TEXTURE_2D}})];case 15:if(a!==rw.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(f.map(function(t){return n.loadCubeMap(t)}))];case 16:return E=u.sent(),[2,iB({},r,{mipmaps:E,target:rw.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:f.map(function(t){return iB({},t)}),target:rw.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+i+".")}})})()},r.loadMipmapImages=function(t,e){return i(function(){return u(this,function(i){return[2,Promise.all(t.map(function(t){return rX(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},r.loadCubeMap=function(t){return i(function(){return u(this,function(e){return[2,Promise.all(t.map(function(t){return rX(t)}))]})})()},e}();function ni(){return ev||(ev=new ne),ev}var nr=function(){function t(t){this.destroyed=!1;var e=t.name;this.name=void 0===e?"defaultDataBlock":e}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach(function(i){e.setUniformValue(i,t[i])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function nn(t){return"object"==typeof t&&t&&void 0===t.length&&a(t,r4)}t.MaterialRenderType=void 0,(th=t.MaterialRenderType||(t.MaterialRenderType={}))[th.normal=0]="normal",th[th.transformFeedback=1]="transformFeedback";var na=1,no=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,a=void 0===n?"Material"+na++:n,o=i.renderType,s=i.shader,u=i.uniformSemantics;r.name=a,r.renderType=void 0===o?0:o,r.shaderSource=s,r.props=i,r.uniformSemantics=iB({},u)}else r.name="Material"+na++,r.renderType=0;return r}ib(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},rv(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(iI),ns=function(){function e(e){this.engine=e,this.alphaMaskEnabled=!1,this.maskMode=t.MaskMode.NONE,this.maskable=null,this.stencilClearAction={stencilAction:t.TextureLoadAction.clear}}var i=e.prototype;return i.getRefValue=function(){return 1},i.setMaskOptions=function(e){var i=e.isMask,r=e.inverted,n=e.reference,a=e.alphaMaskEnabled;this.alphaMaskEnabled=void 0!==a&&a,void 0!==i&&i?this.maskMode=t.MaskMode.MASK:(this.maskMode=void 0!==r&&r?t.MaskMode.REVERSE_OBSCURED:t.MaskMode.OBSCURED,this.maskable=this.engine.findObject(n))},i.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},e}();t.ShaderCompileResultStatus=void 0,(tl=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[tl.noShader=0]="noShader",tl[tl.success=1]="success",tl[tl.fail=2]="fail",tl[tl.compiling=3]="compiling",t.GLSLVersion=void 0,(tc=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",tc.GLSL3="300 es";var nu=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return ib(e,t),e}(iI);t.Shader=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=n(Object.keys(t));!(i=r()).done;){var a=i.value;e.push([a,t[a]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(iI),t.Shader=s([iA(es.Shader)],t.Shader);var nh="effects-internal-copy",nl="effects-internal-copy-mesh",nc="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",nf="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function nd(e,i){return{name:nh,vertex:nc,fragment:nf,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:nl+ +i}}var np={format:rw.RGBA,type:rw.UNSIGNED_BYTE,minFilter:rw.LINEAR,magFilter:rw.LINEAR,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE},nm=Symbol("dispose"),nv=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var i=e.prototype;return i.requestColorAttachmentTexture=function(e){var i=this,r=e.width,n=e.height,a=e.name,o={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:a},s=[a];Object.getOwnPropertyNames(np).forEach(function(t){var i,r=null!=(i=e[t])?i:np[t];o[t]=r,s.push(t,r)});var u=s.join(":"),h=this.textureCache[u];if(h)this.textureRef[u]++;else{var l=this.engine;e4(l),h=r4.create(l,o),this.textureCache[u]=h,this.textureRef[u]=1,h[nm]=h.dispose,h.dispose=function(){return i.removeTexture(u)}}return h},i.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[nm](),i.dispose=i[nm]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},i.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var i=t.textureCache[e];i[nm](),i.dispose=i[nm]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),ny=function(){function t(t){void 0===t&&(t={}),this.semantics=iB({},t)}var e=t.prototype;return e.toObject=function(){return iB({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var i=this.semantics[t];return ie(i)?i(e):i},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach(function(e){delete t.semantics[e]})},t}(),ng=((ey={})[rw.FLOAT]=Float32Array.BYTES_PER_ELEMENT,ey[rw.INT]=Int32Array.BYTES_PER_ELEMENT,ey[rw.SHORT]=Int16Array.BYTES_PER_ELEMENT,ey[rw.BYTE]=Int8Array.BYTES_PER_ELEMENT,ey),nx=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="",e.subMeshes=[],e}ib(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(iI);function nb(t){return t===rw.INT?new Int32Array(0):t===rw.SHORT?new Int16Array(0):new Float32Array(0)}(tf=eg||(eg={}))[tf.XYZ=0]="XYZ",tf[tf.XZY=1]="XZY",tf[tf.YXZ=2]="YXZ",tf[tf.YZX=3]="YZX",tf[tf.ZXY=4]="ZXY",tf[tf.ZYX=5]="ZYX";var nT=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],a=i[8],o=i[1],s=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case eg.XYZ:this.y=Math.asin(iW(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,s),this.z=0);break;case eg.YXZ:this.x=Math.asin(-iW(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(a,c),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-h,r),this.z=0);break;case eg.ZXY:this.x=Math.asin(iW(l,-1,1)),.9999999>Math.abs(l)?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case eg.ZYX:this.y=Math.asin(-iW(h,-1,1)),.9999999>Math.abs(h)?(this.x=Math.atan2(l,c),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case eg.YZX:this.z=Math.asin(iW(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case eg.XZY:this.z=Math.asin(-iW(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(l,s),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=ij,this.y*=ij,this.z*=ij,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,a,o;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(a=t[e+2])?a:0,this.order=null!=(o=t[e+3])?o:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?console.error("add euler with different order"):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addEulers=function(t,e){return t.order!=e.order?console.error("add euler with different order"):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new iQ;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this.x,i=this.y,r=this.z,n=this.order,a=Math.cos(e*iG*.5),o=Math.cos(i*iG*.5),s=Math.cos(r*iG*.5),u=Math.sin(e*iG*.5),h=Math.sin(i*iG*.5),l=Math.sin(r*iG*.5);switch(n){case eg.XYZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case eg.YXZ:t.set(u*o*s+a*h*l,a*h*s-u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case eg.ZXY:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l+u*h*s,a*o*s-u*h*l);break;case eg.ZYX:t.set(u*o*s-a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s+u*h*l);break;case eg.YZX:t.set(u*o*s+a*h*l,a*h*s+u*o*l,a*o*l-u*h*s,a*o*s-u*h*l);break;case eg.XZY:t.set(u*o*s-a*h*l,a*h*s-u*o*l,a*o*l+u*h*s,a*o*s+u*h*l);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,i=this.x,r=this.y,n=this.z,a=this.order,o=Math.cos(i*iG),s=Math.sin(i*iG),u=Math.cos(r*iG),h=Math.sin(r*iG),l=Math.cos(n*iG),c=Math.sin(n*iG);if(a===eg.XYZ){var f=o*l,d=o*c,p=s*l,m=s*c;e[0]=u*l,e[4]=-u*c,e[8]=h,e[1]=d+p*h,e[5]=f-m*h,e[9]=-s*u,e[2]=m-f*h,e[6]=p+d*h,e[10]=o*u}else if(a===eg.YXZ){var v=u*l,y=u*c,g=h*l,x=h*c;e[0]=v+x*s,e[4]=g*s-y,e[8]=o*h,e[1]=o*c,e[5]=o*l,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=o*u}else if(a===eg.ZXY){var b=u*l,T=u*c,E=h*l,_=h*c;e[0]=b-_*s,e[4]=-o*c,e[8]=E+T*s,e[1]=T+E*s,e[5]=o*l,e[9]=_-b*s,e[2]=-o*h,e[6]=s,e[10]=o*u}else if(a===eg.ZYX){var C=o*l,S=o*c,A=s*l,w=s*c;e[0]=u*l,e[4]=A*h-S,e[8]=C*h+w,e[1]=u*c,e[5]=w*h+C,e[9]=S*h-A,e[2]=-h,e[6]=s*u,e[10]=o*u}else if(a===eg.YZX){var R=o*u,I=o*h,M=s*u,O=s*h;e[0]=u*l,e[4]=O-R*c,e[8]=M*c+I,e[1]=c,e[5]=o*l,e[9]=-s*l,e[2]=-h*l,e[6]=I*c+M,e[10]=R-O*c}else if(a===eg.XZY){var P=o*u,N=o*h,F=s*u,L=s*h;e[0]=u*l,e[4]=-c,e[8]=h*l,e[1]=P*c+L,e[5]=o*l,e[9]=N*c-F,e[2]=F*c-N,e[6]=s*l,e[10]=L*c+P}else console.error("toMatrix4: Invalid order "+a);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromArray(e,i,r)},t}();nT.DEFAULT_ORDER=eg.ZYX,nT.tempQuat0=new iQ,nT.tempMat0=new r_;var nE=function(){function t(t,e,i,r,n,a,o,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,o,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=o,h[1]=e,h[4]=n,h[7]=s,h[2]=i,h[5]=a,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,o,s,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=a,h[2]=o,h[5]=s,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,a=e+e,o=i+i,s=r+r,u=e*a,h=e*o,l=e*s,c=i*o,f=i*s,d=r*s,p=n*a,m=n*o,v=n*s,y=this.elements;return y[0]=1-(c+d),y[1]=h+v,y[2]=l-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=l+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],a=r[3],o=r[6],s=r[1],u=r[4],h=r[7];return r[0]=e*n+i*s,r[3]=e*a+i*u,r[6]=e*o+i*h,r[1]=-i*n+e*s,r[4]=-i*a+e*u,r[7]=-i*o+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<9;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],o=i[3],s=i[6],u=i[1],h=i[4],l=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],E=r[8];return n[0]=a*p+o*y+s*b,n[3]=a*m+o*g+s*T,n[6]=a*v+o*x+s*E,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*E,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8];return e*(a*h-u*o)+n*(u*r-i*h)+s*(i*o-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],o=t[7],s=t[2],u=t[5],h=t[8],l=h*a-u*o,c=u*r-h*i,f=o*i-a*r,d=e*l+n*c+s*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(s*o-h*n)*p,t[2]=(u*n-s*a)*p,t[3]=c*p,t[4]=(h*e-s*r)*p,t[5]=(s*i-u*e)*p,t[6]=f*p,t[7]=(n*r-o*e)*p,t[8]=(a*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[3]*r+a[6]*n,o.y=a[1]*i+a[4]*r+a[7]*n,o.z=a[2]*i+a[5]*r+a[8]*n,o},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!iX(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return new t().setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,a,o,s,u,h){return new t(e,n,s,i,a,u,r,o,h)},t}(),n_=function(){function t(t,e){void 0===t&&(t=iK.ZERO),void 0===e&&(e=iK.X),this.origin=new iK,this.direction=new iK,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new iK;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,o,s,u=this.origin,h=u.x,l=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,E=b.y,_=b.z,C=1/d,S=1/p,A=1/m;if(C>=0?(i=(y-h)*C,r=(T-h)*C):(i=(T-h)*C,r=(y-h)*C),S>=0?(n=(g-l)*S,a=(E-l)*S):(n=(E-l)*S,a=(g-l)*S),!(i>a)&&!(n>r)&&((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),A>=0?(o=(x-c)*A,s=(_-c)*A):(o=(_-c)*A,s=(x-c)*A),!(i>s)&&!(o>r))&&((o>i||i!=i)&&(i=o),(s<r||r!=r)&&(r=s),!(r<0)))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new iK).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),o=n.dot(n)-a*a,s=e.radius*e.radius;if(!(o>s)){var u=Math.sqrt(s-o),h=a-u,l=a+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,o=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(o,a),h=t.tempVec1.subtractVectors(s,a),l=t.tempVec2.subtractVectors(this.origin,a),c=t.tempVec3.crossVectors(u,h),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(l,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(l);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*l.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();n_.tempVec0=new iK,n_.tempVec1=new iK,n_.tempVec2=new iK,n_.tempVec3=new iK;var nC=function(){function t(t,e){void 0===t&&(t=new iK(1/0,1/0,1/0)),void 0===e&&(e=new iK(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,a=-1/0,o=-1/0,s=0,u=t.length;s<u;s+=3){var h=t[s],l=t[s+1],c=t[s+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>a&&(a=l),c>o&&(o=c)}return this.min.set(e,i,r),this.max.set(n,a,o),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return new t().copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new iK),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new iK),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,a=0,o=n.length;a<o;a++)this.expandByObject(n[a]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new iK),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){var e=new iK;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new iK),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new iK),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new iK),this.isEmpty())return[];var i=[];return i[0]=new iK(this.min.x,this.min.y,this.min.z),i[1]=new iK(this.min.x,this.min.y,this.max.z),i[2]=new iK(this.min.x,this.max.y,this.min.z),i[3]=new iK(this.min.x,this.max.y,this.max.z),i[4]=new iK(this.max.x,this.min.y,this.min.z),i[5]=new iK(this.max.x,this.min.y,this.max.z),i[6]=new iK(this.max.x,this.max.y,this.min.z),i[7]=new iK(this.max.x,this.max.y,this.max.z),i.forEach(function(i){i.subtract(e),i.applyMatrix(t),i.add(e)}),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new iK;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),nS=function(){function t(t,e){void 0===t&&(t=iK.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var a=new nC().setFromPoints(t);a.getCenter(i),this.radius=a.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new iK),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return(void 0===t&&(t=new nC),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return this.center.applyMatrix(t),this.radius=this.radius*Math.sqrt(Math.max(i,r,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=new iK().subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=(r-this.radius)*.5;this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new iK,i=new iK;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=new iK().subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}(),nA=Object.freeze({__proto__:null,get EulerOrder(){return eg},Euler:nT,Quaternion:iQ,Vector2:iq,Vector3:iK,Vector4:rb,Matrix3:nE,Matrix4:r_,Ray:n_,PI2:2*Math.PI,DEG2RAD:iG,RAD2DEG:ij,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:iX,damp:function(t,e,i,r){return iH(t,e,1-Math.exp(-i*r))},lerp:iH,degToRad:function(t){return t*iG},radToDeg:function(t){return t*ij},clamp:iW,Color:rE,Box3:nC,Sphere:nS}),nw=1,nR=function(e){function i(t,i){var r;if((r=e.call(this,t)||this).destroyed=!1,r.visible=!0,i){var n=i.material,a=i.geometry,o=i.name,s=i.priority,u=i.worldMatrix,h=void 0===u?r_.fromIdentity():u;r.id="Mesh"+nw++,r.name=void 0===o?"<unnamed>":o,r.geometry=a,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=h}else r.id="Mesh"+nw++,r.name="<unnamed>",r.worldMatrix=r_.fromIdentity(),r._priority=0;return r}ib(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.restore=function(){},r.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var i=null==e?void 0:e.material;i!==t.DestroyOptions.keep&&this.material.dispose(i),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},rv(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(rx);t.RenderPassAttachmentStorageType=void 0,(td=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[td.none=0]="none",td[td.color=1]="color",td[td.stencil_8_opaque=2]="stencil_8_opaque",td[td.depth_16_opaque=3]="depth_16_opaque",td[td.depth_stencil_opaque=4]="depth_stencil_opaque",td[td.depth_16_texture=5]="depth_16_texture",td[td.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(tp=t.TextureStoreAction||(t.TextureStoreAction={}))[tp.store=0]="store",tp[tp.clear=2]="clear";var nI=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(a(r,r4))this.texture=r,this.externalTexture=!0;else if(r){var o=r.wrapT,s=r.wrapS,u=r.minFilter,h=r.magFilter,l=r.internalFormat,c=r.format,f=void 0===c?rw.RGBA:c,d=r.type,p=void 0===d?rw.UNSIGNED_BYTE:d;this.externalTexture=!1,this.textureOptions={size:n,format:f,type:p,internalFormat:l||f,wrapT:o,wrapS:s,minFilter:u,magFilter:h,name:i.name},this.texture=r4.create(e,iB({},this.textureOptions,{sourceType:t.TextureSourceType.framebuffer,data:{width:n[0],height:n[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},rv(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),e}();t.RenderPassDestroyAttachmentType=void 0,(tm=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[tm.force=0]="force",tm[tm.keep=1]="keep",tm[tm.keepExternal=2]="keepExternal",tm[tm.destroy=0]="destroy";var nM=1,nO=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+nM++:r,a=i.clearAction,o=i.semantics,s=i.depthStencilAttachment,u=i.storeAction,h=i.priority,l=i.meshOrder,c=void 0===l?t.OrderType.ascending:l,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===h?0:h,this.meshOrder=c,this.meshes=e1((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=iB({},a),this.storeAction=iB({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new ny(o),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){e2(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){ek(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),e1(this.meshes,this.meshOrder),this.meshes},i.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},i.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],a=e[3];t.setViewport(i,r,n,a)}},i.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},i.frameCleanup=function(t){},i.resetColorAttachments=function(e){var i=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var r=e.map(function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new nI(i.renderer.engine,{texture:e})});this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments=r,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(e.map(function(t){return t})))}else this.resetAttachments({attachments:e.map(function(t){return{texture:t}})})},i.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},i.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},i._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var a=this.viewportScale,o=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*a,r.getHeight()*a],s=[o[2],o[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map(function(t,e){var r;return new nI(i.renderer.engine,iB({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=h;var l=n5.create({storeAction:this.storeAction,name:u,viewport:o,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);l.bind(),l.unbind(),this.framebuffer=l}else this.attachments.length=0},i.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var i=this.renderer,r=this.viewportScale;return i?[0,0,i.getWidth()*r,i.getHeight()*r]:[0,0,0,0]},i.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:i}}},i.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:i}}},i.getDepthTexture=function(t,e){if(!this.depthTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.depthTexture=n),n}return this.depthTexture},i.getStencilTexture=function(t,e){if(!this.stencilTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},i.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},i.dispose=function(e){if(!this.destroyed){var i,r,n=(null==e?void 0:e.meshes)||void 0;n!==t.DestroyOptions.keep&&this.meshes.forEach(function(t){t.dispose(n)}),this.meshes.length=0;var a=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===a||1===a||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var o=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,s=this.framebuffer;s&&(s.dispose({depthStencilAttachment:o}),s.externalStorage&&2===o||1===o||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=is}},rv(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),e}(),nP="precision highp float;attribute vec2 aUV;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 texParams=_TexParams;vTexCoord=vec2(aUV.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(texParams.w,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",nN="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",nF="#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",nL="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}",nV="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",nD="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",nk="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",nz="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",nU="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",nB="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform sampler2D _GaussianDownTex;uniform vec2 _GaussianDownTextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=1;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec3 lowResColor=GaussNxN(_MainTex,uv,0.5/_GaussianDownTextureSize,1.0);vec3 highResColor=GaussNxN(_GaussianDownTex,uv,1.0/_GaussianDownTextureSize,1.0);vec3 color=mix(highResColor,lowResColor,0.7);gl_FragColor=vec4(color,1.0);}",nG="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}",nj={},nX=function(){function e(){}return e.registerInclude=function(t,e){nj[t]&&e8.warn('The "'+t+'" shader include already exist.'),nj[t]=e},e.unRegisterInclude=function(t){delete nj[t]},e.unRegisterAllIncludes=function(){Object.keys(nj).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,a=i.shader,o=i.macros,s=i.removeVersion,u=e.genMacroString(r,o),h=e.genShaderVersion(r),l=e.parseIncludes(a),c=e.isVersion300(l);return(l=e.removeWebGLVersion(l),2!==r||c||(l=e.convertTo300(l,n===t.ShaderType.fragment)),s)?u+l:h+u+l},e.convertTo300=function(t,i){if(t=(t=(t=t.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(t=(t=(t=t.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!e.has300Output(t)){if(/\bgl_FragData\[.+?\]/g.test(t)){var r=(t=t.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(t=e.replaceMRTShader(t,r))}else t=(t=t.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}}else t=t.replace(/\battribute\b/g,"in");return t},e.parseIncludes=function(t,e){for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var i,r=i[1],n=nj[r];if(void 0===n)throw Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},e.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return(r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach(function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)}),r.length)?r.join("\n")+"\n":""},e.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},e.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},e.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},e.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},e.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[1])}return i.forEach(function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"}),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},e}(),nH=function(e){function i(i,r){var n,a=(n=e.call(this,i,r)||this).renderer.engine,o=nx.create(a,{mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=no.create(a,{shader:{vertex:nD,fragment:nG,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=nR.create(a,{geometry:o,material:s,priority:0}),n.priority=5e3,n}ib(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var i,r,n,a=null!=(n=null==(r=e.renderingData.currentFrame.globalVolume)?void 0:null==(i=r.bloom)?void 0:i.threshold)?n:1;this.screenMesh.material.setFloat("_Threshold",a),e.renderMeshes([this.screenMesh])},i}(nO),nW=function(e){function i(i,r,n){(a=e.call(this,i,n)||this).type=r;var a,o=a.renderer.engine,s="PostProcess",u=nx.create(o,{name:s,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),h={vertex:nD,fragment:"H"===r?nz:nU,glslVersion:t.GLSLVersion.GLSL1},l=no.create(o,{name:s,shader:h});return l.blending=!1,l.depthTest=!1,l.culling=!1,a.screenMesh=nR.create(o,{name:s,geometry:u,material:l,priority:0}),a.priority=5e3,a}ib(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",nJ(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(nO),nY=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",a=r.renderer.engine,o=nx.create(a,{name:n,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=no.create(a,{name:n,shader:{vertex:nD,fragment:nB}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=nR.create(a,{name:n,geometry:o,material:s,priority:0}),r.priority=5e3,r}ib(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",nJ(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(nO),nZ=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,a="PostProcess",o=n.renderer.engine;n.sceneTextureHandle=r||new nI(o);var s=nx.create(o,{name:a,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=no.create(o,{name:a,shader:{vertex:nD,fragment:nk,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=nR.create(o,{name:a,geometry:s,material:u,priority:0}),n.priority=5e3,n}ib(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var i=e.renderingData.currentFrame.globalVolume,r=iB({threshold:0,intensity:0,active:!1},null==i?void 0:i.bloom),n=iB({intensity:0,smoothness:0,roundness:0,active:!1},null==i?void 0:i.vignette),a=iB({brightness:0,saturation:0,contrast:0,active:!1},null==i?void 0:i.colorAdjustments),o=iB({active:!1},null==i?void 0:i.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,a.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*a.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*a.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),n.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",n.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",n.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",n.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new iq(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new iK(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(o.active)),e.renderMeshes([this.screenMesh])},i}(nO),nq="_effects_default_",nK=1,nQ=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i,r,n=e.camera,a=e.keepColorBuffer,o=e.renderer,s=e.editorTransform,u=e.globalVolume,h=e.postProcessingEnabled,l=void 0!==h&&h,c=e.clearAction,f=void 0===c?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:c,d=o.engine;u&&(this.globalVolume=u),this.globalUniforms=new n0;var p=[],m={};if(this.renderer=o,l){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw Error("Half float texture is not supported.");var v=rw.HALF_FLOAT;p=[{texture:{format:rw.RGBA,type:v,magFilter:rw.LINEAR,minFilter:rw.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}this.drawObjectPass=new nO(o,{name:nq,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),l){var g=new nI(d),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=Array(7),T=rw.HALF_FLOAT,E=new nH(o,{name:"BloomThresholdPass",attachments:[{texture:{format:rw.RGBA,type:T,minFilter:rw.LINEAR,magFilter:rw.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new nI(d);var C=new nW(o,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:rw.RGBA,type:T,minFilter:rw.LINEAR,magFilter:rw.LINEAR}}]}),S=new nW(o,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:rw.RGBA,type:T,minFilter:rw.LINEAR,magFilter:rw.LINEAR}}]});S.gaussianResult=b[_],this.addRenderPass(C),this.addRenderPass(S),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var w=new nY(o,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:rw.RGBA,type:T,minFilter:rw.LINEAR,magFilter:rw.LINEAR}}]});w.gaussianDownSampleResult=b[5-A],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new nZ(o,g);this.addRenderPass(R)}this.semantics=new ny(e.semantics),this.clearAction=f,this.name="RenderFrame"+nK++;var I=y[0];this.emptyTexture=r8(d),this.transparentTexture=r9(d),this.camera=n,this.keepColorBuffer=a,this.renderPassInfoMap.set(I,{listStart:0,listEnd:0,renderPass:I,intermedia:!1}),this.editorTransform=rb.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new nv(d);var M=d.gpuCapability,O=M.detail,P=nd(M.level,O.readableDepthStencilTextures&&O.writableFragDepth);null==(i=this.renderer.getShaderLibrary())||i.addShader(P)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},i.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},i.dispose=function(e){(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var i,r,n=(null==e?void 0:e.passes)?e.passes:void 0;n!==t.DestroyOptions.keep&&this._renderPasses.forEach(function(t){t.dispose(n)}),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(i=r.texture)||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},i.resetRenderPassDefaultAttachment=function(t,e){for(var i=this.resource,r=i.color_a,n=i.color_b,a=e;a<t.length;a++){var o,s,u,h=t[a],l=null==(s=h.attachments[0])?void 0:s.texture;if(l&&o===l){var c=l===r?n:r;h.resetColorAttachments([c])}(l=null==(u=h.attachments[0])?void 0:u.texture)&&(o=l)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(nq)&&i.meshes.includes(t))||(e=r,!1)}),e},i.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;i&&(0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e))},i.getRPAttachments=function(t,e){if((null==t?void 0:t.length)===1){var i,r=t[0],n=r.texture,a=r.persistent,o=n.format,s=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(o===rw.RGBA&&!a){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[0].texture===u?this.resource.color_b:u}]}}return t},i.resetClearActions=function(){var e=this.renderPasses.length>1?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;this.clearAction.stencilAction=e,this.clearAction.depthAction=e,this.clearAction.colorAction=e,this.keepColorBuffer&&(this.clearAction.colorAction=t.TextureLoadAction.whatever)},i.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach(function(t){return t.initialize(e.renderer)}),this._renderPasses=t.slice()},i.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},i.createResource=function(){var e=this.renderer.engine;if(!this.resource){var i,r=e.gpuCapability,n=r.detail,a=r.level,o=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===a?rw.LINEAR:rw.NEAREST,h=r4.create(e,{sourceType:t.TextureSourceType.framebuffer,format:rw.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=r4.create(e,{sourceType:t.TextureSourceType.framebuffer,format:rw.RGBA,data:{width:o,height:s},minFilter:u,magFilter:u,name:"frame_b"}),c=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new nO(this.renderer,{depthStencilAttachment:{storageType:c},attachments:[{texture:h}]}).initialize(this.renderer),d=new n$(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,colorAction:t.TextureLoadAction.clear},meshOrder:t.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(i=f.getDepthAttachment())?void 0:i.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:l,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=nx.create(i,{name:nh,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=nd(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var a=no.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:nh,shader:n});return a.blending=!1,a.depthTest=!1,a.culling=!1,(null==t?void 0:t.blend)&&(a.blending=!0,a.blendFunction=[rw.SRC_ALPHA,rw.ONE_MINUS_SRC_ALPHA,rw.SRC_ALPHA,rw.ONE_MINUS_SRC_ALPHA]),nR.create(i,{name:nh,geometry:r,material:a,priority:0})},i.removeRenderPass=function(t){ek(this._renderPasses,t)},rv(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function nJ(t){return t?new iq(t.getWidth(),t.getHeight()):new iq}var n$=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",nJ(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(nO),n0=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},n1=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return rv(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),n2="function"==typeof WebGL2RenderingContext,n3=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=n2&&a(t,WebGL2RenderingContext)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),s=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),r&&!s&&(s=n4(t,t.HALF_FLOAT)),r&&!u&&(u=n4(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=r||t.getExtension("OES_texture_float")?t.FLOAT:0,l=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,c={floatTexture:h,halfFloatTexture:l,maxSample:r?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0,halfFloatLinear:s,floatLinear:u,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!o,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=c,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw Error("Draw multiple color buffers not available.");var o=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];o?t.framebufferTexture2D(e,o,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1===this.level&&!i){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function n4(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}t.COMPRESSED_TEXTURE=void 0,(tv=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[tv.NONE=0]="NONE",tv[tv.PVRTC=1]="PVRTC",tv[tv.ASTC=2]="ASTC",t.FilterMode=void 0,(ty=t.FilterMode||(t.FilterMode={}))[ty.Nearest=0]="Nearest",ty[ty.Linear=1]="Linear",t.RenderTextureFormat=void 0,(tg=t.RenderTextureFormat||(t.RenderTextureFormat={}))[tg.RGBA32=0]="RGBA32",tg[tg.RGBAHalf=1]="RGBAHalf";var n5=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},rv(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),n6=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i){},e.getTemporaryRT=function(t,e,i,r,n,a){return null},e.dispose=function(t){},t}(),n8=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=n9(this.arc,this.arcMode,t)*iG,i=new iK(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*iG),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(io(0,1)),direction:n.normalize()}},t}();function n9(t,e,i){if(e===t$.RANDOM)t=io(0,t);else if(e===t$.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===t$.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===t$.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var n7=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=n9(this.arc,this.arcMode,t)*iG,i=new iK(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),at=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=io(-this._d,this._d),i=io(-this._h,this._h);return{direction:new iK(0,0,1),position:new iK(e,i,0)}},t}(),ae=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=n9(this.arc,this.arcMode,t)*iG,i=new iK(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new iK;return e<a?s.set(r,r*o,0):e>=a&&e<Math.PI-a?s.set(n/o,n,0):e<Math.PI+a?s.set(-r,-r*o,0):e<2*Math.PI-a?s.set(-n/o,-n,0):s.set(r,r*o,0),{direction:i,position:s}},t}(),ai=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===t$.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):io(0,1);return{direction:new iK(0,1,0),position:new iK(this._d*(e-.5),0,0)}},t}(),ar=new r_,an=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=io(0,2*Math.PI),n=n9(this.arc,this.arcMode,t)*iG,a=ar.setFromRotationZ(n),o=new iK(Math.cos(r),Math.sin(r),0),s=new iK(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),aa=new r_,ao=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}var e=t.prototype;return e.getHorizontalAngle=function(){return io(-90,90)},e.generate=function(t){var e=n9(this.arc,this.arcMode,t)*iG,i=this.getHorizontalAngle()*iG,r=this.radius,n=new iK(Math.cos(i),0,Math.sin(i)),a=aa.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),as=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.getHorizontalAngle=function(){return io(0,90)},e}(ao),au=function(){function t(t){var e=t.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(e.anchors),this.width=t.width||1,this.height=t.height||1,this.block=e.block,this.arcMode=t.arcMode,this.random=iW(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(n9(e.length/2-1,this.arcMode,t)),r=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new iK(r,n,0);return{position:new iK(r*this.width,n*this.height,0),direction:a.normalize()}},t}(),ah=function(){function t(){}return t.prototype.generate=function(){return{position:new iK,direction:new iK}},t}(),al=((ex={})[tz.NONE]=ah,ex[tz.CONE]=n8,ex[tz.SPHERE]=ao,ex[tz.HEMISPHERE]=as,ex[tz.CIRCLE]=n7,ex[tz.DONUT]=an,ex[tz.RECTANGLE]=at,ex[tz.EDGE]=ai,ex[tz.RECTANGLE_EDGE]=ae,ex[tz.TEXTURE]=au,ex);function ac(t){if(!t)return new ah;var e=iB({radius:1,arc:360,angle:0,arcMode:t$.RANDOM},t),i=t.type,r=al[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tz.NONE){var a=t.alignSpeedDirection,o=t.upDirection;n.alignSpeedDirection=a,n.upDirection=iK.fromArray(void 0===o?[0,0,1]:o).normalize()}return n}function af(t,e,i,r,n){var a,o;if(n===function(t,e,i,r){for(var n=0,a=e,o=i-r;a<i;a+=r)n+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)o=aC(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=aC(a,t[a],t[a+1],o);return o&&ag(o,o.next)&&(aS(o),o=o.next),o}function ad(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(ag(r,r.next)||0===ay(r.prev,r,r.next))){if(aS(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function ap(t,e){return t.x-e.x}function am(t,e,i,r,n){return(t=((t=((t=((t=((t=32767*(t-i)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-r)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function av(t,e,i,r,n,a,o,s){return(n-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(r-s)-(i-o)*(e-s)>=0&&(i-o)*(a-s)-(n-o)*(r-s)>=0}function ay(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ag(t,e){return t.x===e.x&&t.y===e.y}function ax(t,e,i,r){var n=aT(ay(t,e,i)),a=aT(ay(t,e,r)),o=aT(ay(i,r,t)),s=aT(ay(i,r,e));return!!(n!==a&&o!==s||0===n&&ab(t,i,e)||0===a&&ab(t,r,e)||0===o&&ab(i,t,r)||0===s&&ab(i,e,r))}function ab(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function aT(t){return t>0?1:t<0?-1:0}function aE(t,e){return 0>ay(t.prev,t,t.next)?ay(t,e,t.next)>=0&&ay(t,t.prev,e)>=0:0>ay(t,e,t.prev)||0>ay(t,t.next,e)}function a_(t,e){var i=new aA(t.i,t.x,t.y),r=new aA(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function aC(t,e,i,r){var n=new aA(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function aS(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 aA(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var aw=0;function aR(t,e,i,r){i=i||2,aw=r||0;var n,a,o,s,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=af(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,a,o,s,u,h=[];for(n=0,a=e.length;n<a;n++)o=e[n]*r,s=n<a-1?e[n+1]*r:t.length,(u=af(t,o,s,r,!1))===u.next&&(u.steiner=!0),h.push(function(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}(u));for(h.sort(ap),n=0;n<h.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,a=e,o=t.x,s=t.y,u=-1/0;do{if(s<=a.y&&s>=a.next.y&&a.next.y!==a.y){var h=a.x+(s-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(h<=o&&h>u){if(u=h,h===o){if(s===a.y)return a;if(s===a.next.y)return a.next}n=a.x<a.next.x?a:a.next}}a=a.next}while(a!==e);if(!n)return null;if(o===u)return n;var l,c=n,f=n.x,d=n.y,p=1/0;a=n;do o>=a.x&&a.x>=f&&o!==a.x&&av(s<d?o:u,s,f,d,s<d?u:o,s,a.x,a.y)&&(l=Math.abs(s-a.y)/(o-a.x),aE(a,t)&&(l<p||l===p&&(a.x>n.x||a.x===n.x&&(i=n,r=a,0>ay(i.prev,i,r.prev)&&0>ay(r.next,i,i.next))))&&(n=a,p=l)),a=a.next;while(a!==c);return n}(t,e)){var i=a_(e,t);ad(e,e.next),ad(i,i.next)}})(h[n],i),i=ad(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=o=t[0],a=s=t[1];for(var m=i;m<f;m+=i)u=t[m],h=t[m+1],u<n&&(n=u),h<a&&(a=h),u>o&&(o=u),h>s&&(s=h);l=0!==(l=Math.max(o-n,s-a))?1/l:0}return function t(e,i,r,n,a,o,s){if(e){!s&&o&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=am(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,o,s,u,h=1;do{for(i=t,t=null,a=null,o=0;i;){for(o++,r=i,s=0,e=0;e<h&&(s++,r=r.nextZ);e++);for(u=h;s>0||u>0&&r;)0!==s&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,s--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(o>1)}(n)}(e,n,a,o);for(var u,h,l=e;e.prev!==e.next;){if(u=e.prev,h=e.next,o?function(t,e,i,r){var n=t.prev,a=t.next;if(ay(n,t,a)>=0)return!1;for(var o=n.x<t.x?n.x<a.x?n.x:a.x:t.x<a.x?t.x:a.x,s=n.y<t.y?n.y<a.y?n.y:a.y:t.y<a.y?t.y:a.y,u=n.x>t.x?n.x>a.x?n.x:a.x:t.x>a.x?t.x:a.x,h=n.y>t.y?n.y>a.y?n.y:a.y:t.y>a.y?t.y:a.y,l=am(o,s,e,i,r),c=am(u,h,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=l&&d&&d.z<=c;){if(f!==t.prev&&f!==t.next&&av(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ay(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&av(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ay(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=l;){if(f!==t.prev&&f!==t.next&&av(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&ay(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=c;){if(d!==t.prev&&d!==t.next&&av(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&ay(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,a,o):function(t){var e=t.prev,i=t.next;if(ay(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(av(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&ay(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+aw),i.push(e.i/r+aw),i.push(h.i/r+aw),aS(e),e=h.next,l=h.next;continue}if((e=h)===l){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!ag(n,a)&&ax(n,r,r.next,a)&&aE(n,a)&&aE(a,n)&&(e.push(n.i/i+aw),e.push(r.i/i+aw),e.push(a.i/i+aw),aS(r),aS(r.next),r=t=a),r=r.next}while(r!==t);return ad(r)}(ad(e),i,r),i,r,n,a,o,2):2===s&&function(e,i,r,n,a,o){var s=e;do{for(var u,h,l=s.next.next;l!==s.prev;){if(s.i!==l.i&&(u=s,h=l,u.next.i!==h.i&&u.prev.i!==h.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&&ax(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,h)&&(aE(u,h)&&aE(h,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,h)&&(ay(u.prev,u,h.prev)||ay(u,h.prev,h))||ag(u,h)&&ay(u.prev,u,u.next)>0&&ay(h.prev,h,h.next)>0))){var c=a_(s,l);s=ad(s,s.next),c=ad(c,c.next),t(s,i,r,n,a,o),t(c,i,r,n,a,o);return}l=l.next}s=s.next}while(s!==e)}(e,i,r,n,a,o):t(ad(e),i,r,n,a,o,1);break}}}}(d,p,i,n,a,l),p}var aI="editor",aM={"Item duration can't be less than 0":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"};function aO(t,e){for(var i,r,n=t.s,a=t.p,o=n[1],s=a[1],u=0,h=0;h<o.length;h++)u+=o[h].length-1;var l,c=new Float32Array(6*u),f=e.indexBase,d=e.uvTransform,p=0,m=0,v=0,y=1,g=1;d&&(m=d[0],v=d[1],y=(l=d[4])?d[3]:d[2],g=l?d[2]:d[3]);for(var x=[0,0],b=0===l?0:-Math.PI/2,T=0;T<o.length;T++)for(var E=o[T],_=s[T],C=s[T+1]||s[0],S=[0,0],A=0;A<E.length-1;A++)(function(t,e,i,r,n,a,o,s){var u=1-e,h=u*u*u,l=3*e*u*u,c=3*e*e*u,f=e*e*e;t[0]=h*i[0]+l*n+c*o+f*r[0],t[1]=h*i[1]+l*a+c*s+f*r[1]})(S,E[A],_,C,_[4],_[5],C[2],C[3]),i=S[0],r=S[1],c[p++]=i/2,c[p++]=r/2,d?(x[0]=i,x[1]=r,aN(x,x,b),c[p++]=m+(x[0]+1)/2*y,c[p++]=v+(x[1]+1)/2*g):(c[p++]=(i+1)/2,c[p++]=(r+1)/2),p+=2;var w=aR(Array.from(c),null,6,void 0===f?0:f);return{aPoint:c,index:new Uint16Array(w)}}function aP(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[tq.SHAPE_POINTS,t.p],s:[tq.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[tq.SHAPE_POINTS,t.g.p],s:[tq.SHAPE_SPLITS,t.g.s]}):i.push(t),i),a=0,o=0,s=0,u=0;u<n.length;u++){var h=aO(n[u],{indexBase:a,uvTransform:e});a+=h.aPoint.length/5,r.push(h),o+=h.aPoint.length,s+=h.index.length}if(1===r.length)return r[0];for(var l=new Float32Array(o),c=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];l.set(m.aPoint,d),d+=m.aPoint.length,c.set(m.index,p),p+=m.index.length}return{aPoint:l,index:c}}function aN(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],o=e[1];return t[0]=r*a+n*o,t[1]=-n*a+r*o,t}var aF=[[0,0,1,1,0]],aL=function(e){function r(t){(i=e.call(this,t)||this).visible=!0,i.splits=aF,i.meshCollider=new oL,i._color=new rE(1,1,1,1),i.getHitTestParams=function(t){var e=r_.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.meshCollider.setGeometry(i.geometry,e);var n,a=i.meshCollider.getBoundingBoxData();if(a)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===tD.FRONT}}},i.renderer={renderMode:tX.MESH,blending:tV.ALPHA,texture:i.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:tD.DOUBLE,mask:0},i.defaultGeometry=nx.create(i.engine,{attributes:{aPos:{type:rw.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:rw.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:rw.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var i,r=no.create(i.engine,{shader:{fragment:nN,vertex:nP,shared:!0}});return i.material=r,i.material.setColor("_Color",new rE(1,1,1,1)),i.maskManager=new ns(t),i}ib(r,e);var o=r.prototype;return o.setVisible=function(t){this.visible=t},o.getVisible=function(){return this.visible},o.setColor=function(t){a(t,rE)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},o.setTexture=function(t){var e=this;return i(function(){var i;return u(this,function(r){switch(r.label){case 0:if("string"!=typeof t)return[3,2];return[4,r4.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}})})()},o.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},o.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},o.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},o.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},o.getItemGeometryData=function(t){var e=this.splits,i=this.textureSheetAnimation,r=this.defaultGeometry;if(t.shape){for(var n=t.shape,a=n.index,o=n.aPoint,s=void 0===o?[]:o,u=new Float32Array(s),h=[],l=[],c=0;c<u.length;c+=6)u[c]*=1,u[c+1]*=1,l.push(s[c+2],s[c+3]),h.push(u[c],u[c+1],0);return r.setAttributeData("aPos",new Float32Array(h)),{index:void 0===a?[]:a,aUV:l}}var f=[],d=[],p=[];if(1===e.length){var m=i?[0,0,1,1,e[0][4]]:e[0],v=m[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],y=m[0],g=m[1],x=m[4]?m[3]:m[2],b=m[4]?m[2]:m[3];f.push(v[0]*x+y,v[1]*b+g,v[2]*x+y,v[3]*b+g,v[4]*x+y,v[5]*b+g,v[6]*x+y,v[7]*b+g),p.push(-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0),d.push(0,1,2,2,1,3)}else for(var T=0;T<2;T++)for(var E=0;E<2;E++){var _=(2*E+T)*4,C=i?[0,0,1,1,e[0][4]]:e[2*E+T],S=C[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],A=((T+T+1)/2-1)/2,w=((E+E+1)/2-1)/2,R=C[0],I=C[1],M=C[4]?C[3]:C[2],O=C[4]?C[2]:C[3],P=[-.25+A,.25+w,-.25+A,-.25+w,.25+A,.25+w,.25+A,-.25+w];f.push(S[0]*M+R,S[1]*O+I,S[2]*M+R,S[3]*O+I,S[4]*M+R,S[5]*O+I,S[6]*M+R,S[7]*O+I),p.push(1*P[0],1*P[1],0,1*P[2],1*P[3],0,1*P[4],1*P[5],0,1*P[6],1*P[7],0),d.push(_,1+_,2+_,2+_,1+_,3+_)}return r.setAttributeData("aPos",new Float32Array(p)),{index:d,aUV:f}},o.configureDefaultGeometry=function(t){var e=this.getItemGeometryData(t),i=e.index,r=e.aUV,n=this.defaultGeometry;return n.setIndexData(new Uint16Array(i)),n.setAttributeData("aUV",new Float32Array(r)),n.setDrawCount(i.length),n},o.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.mask,a=t.texture,o=this.maskManager.maskMode,s=this.material;s.blending=!0,s.depthTest=!0,s.depthMask=i,s.stencilRef=void 0!==n?[n,n]:void 0,rF(s,r),rV(s,o),rL(s,e),s.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',s.setVector4("_TexOffset",new rb(0,0,1,1)),s.setTexture("_MainTex",a);var u=rN(r),h=new rb;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=u,h.z=t.renderMode,h.w=o,s.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?s.enableMacro("ALPHA_CLIP"):s.disableMacro("ALPHA_CLIP"),s},o.draw=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++){var i=this.materials[e];i.setVector2("_Size",this.transform.size),(this.renderer.renderMode===tX.BILLBOARD||this.renderer.renderMode===tX.VERTICAL_BILLBOARD||this.renderer.renderMode===tX.HORIZONTAL_BILLBOARD)&&i.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,i,e)}},o.fromData=function(i){e.prototype.fromData.call(this,i);var r=null!=(I=i.renderer)?I:{},a=i.splits,o=i.textureSheetAnimation,s=i.mask;s&&this.maskManager.setMaskOptions(s);var u=r.shape,h=a&&!o?a[0]:void 0,l=void 0;if(null==u||"aPoint"in u&&"index"in u||(l=aP(u,h)),this.splits=a||aF,this.textureSheetAnimation=o,this.renderer={renderMode:null!=(M=r.renderMode)?M:tX.MESH,blending:null!=(O=r.blending)?O:tV.ALPHA,texture:r.texture?this.engine.findObject(r.texture):this.engine.emptyTexture,occlusion:!!r.occlusion,transparentOcclusion:!!r.transparentOcclusion||this.maskManager.maskMode===t.MaskMode.MASK,side:null!=(P=r.side)?P:tD.DOUBLE,mask:this.maskManager.getRefValue(),shape:l},this.configureMaterial(this.renderer),i.geometry){var c=this.engine.findObject(i.geometry),f=i.splits&&!i.textureSheetAnimation?i.splits[0]:aF[0],d=f[0],p=f[1],m=!!f[4],v=m?f[3]:f[2],y=m?f[2]:f[3],g=m?-Math.PI/2:0,x=c.getAttributeData("aUV"),b=c.getAttributeData("aPos"),T=c.getIndexData(),E=[0,0];if(x&&b&&T){for(var _=x.length/2,C=0;C<_;C++){var S=3*C,A=2*C,w=b[S],R=b[S+1];E[0]=w,E[1]=R,aN(E,E,g),x[A]=(E[0]+.5)*v+d,x[A+1]=(E[1]+.5)*y+p}this.geometry.setAttributeData("aPos",b.slice()),this.geometry.setAttributeData("aUV",x.slice()),this.geometry.setIndexData(T.slice()),this.geometry.setDrawCount(T.length)}this.geometry.subMeshes.length=0;for(var I,M,O,P,N,F=n(c.subMeshes);!(N=F()).done;){var L=N.value;this.geometry.subMeshes.push({offset:L.offset,indexCount:L.indexCount,vertexCount:L.vertexCount})}}else this.geometry=this.defaultGeometry,this.configureDefaultGeometry(this.renderer)},rv(r,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),r}(rx);t.ShapeComponent=function(e){function i(i){(r=e.call(this,i)||this).hasStroke=!1,r.hasFill=!1,r.shapeDirty=!0,r.graphicsPath=new us,r.vert="\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n",r.frag="\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n",r.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0});var r,n={shader:{vertex:r.vert,fragment:r.frag,glslVersion:t.GLSLVersion.GLSL1}},a=no.create(i,n),o=no.create(i,n);return a.color=new rE(1,1,1,1),a.depthMask=!1,a.depthTest=!0,a.blending=!0,r.material=a,o.color=new rE(.25,.25,.25,1),o.depthMask=!1,o.depthTest=!0,o.blending=!0,r.materials[1]=o,r.strokeAttributes={width:1,alignment:.5,cap:ei.Butt,join:er.Miter,miterLimit:10,color:new rE(1,1,1,1)},r.fillAttribute={color:new rE(1,1,1,1)},r.shapeAttribute={type:ee.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},r}ib(i,e);var r=i.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){this.material.color=this.fillAttribute.color,this.materials[1].color=this.strokeAttributes.color,this.shapeDirty&&(this.buildPath(this.shapeAttribute),this.buildGeometryFromPath(this.graphicsPath.shapePath),this.shapeDirty=!1)},r.buildGeometryFromPath=function(t){var e=t.shapePrimitives,i=[],r=[];if(this.hasFill)for(var a,o=n(e);!(a=o()).done;){var s=a.value.shape,u=[],h=r.length,l=i.length/2;s.build(u),s.triangulate(u,i,l,r,h)}var c=r.length;if(this.hasStroke)for(var f,d=n(e);!(f=d()).done;){var p=f.value.shape,m=[];r.length;var v=i.length/2,y=this.strokeAttributes,g=!0;this.shapeAttribute.type===ee.Custom&&(g=p.closePath),p.build(m),s5(m,y,!1,g,i,2,v,r)}var x=r.length-c,b=i.length/2,T=this.geometry.getAttributeData("aPos"),E=this.geometry.getAttributeData("aUV"),_=this.geometry.getIndexData();(!T||T.length<3*b)&&(T=new Float32Array(3*b)),(!E||E.length<2*b)&&(E=new Float32Array(2*b)),(!_||_.length<r.length)&&(_=new Uint16Array(r.length));for(var C=0;C<b;C++){var S=3*C,A=2*C,w=2*C;T[S]=i[A],T[S+1]=i[A+1],T[S+2]=0,E[w]=T[S],E[w+1]=T[S+1]}_.set(r),this.geometry.setAttributeData("aPos",T),this.geometry.setAttributeData("aUV",E),this.geometry.setIndexData(_),this.geometry.setDrawCount(r.length);var R=this.geometry.subMeshes[0],I=this.geometry.subMeshes[1];R.indexCount=c,I.offset=2*c,I.indexCount=x},r.buildPath=function(e){switch(this.graphicsPath.clear(),e.type){case ee.Custom:for(var i,r=this.shapeAttribute,a=r.points,o=r.easingIns,s=r.easingOuts,u=n(r.shapes);!(i=u()).done;){var h=i.value,l=h.indexes,c=a[l[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var f=1;f<l.length;f++){var d=l[f],p=l[f-1],m=a[d.point],v=a[p.point],y=s[p.easingOut],g=o[d.easingIn];this.graphicsPath.bezierCurveTo(y.x+v.x,y.y+v.y,g.x+m.x,g.y+m.y,m.x,m.y,1)}if(h.close){var x=l[0],b=l[l.length-1],T=a[x.point],E=a[b.point],_=s[b.easingOut],C=o[x.easingIn];this.graphicsPath.bezierCurveTo(_.x+E.x,_.y+E.y,C.x+T.x,C.y+T.y,T.x,T.y,1),this.graphicsPath.closePath()}}break;case ee.Ellipse:this.graphicsPath.ellipse(0,0,e.xRadius,e.yRadius);break;case ee.Rectangle:this.graphicsPath.rect(-e.width/2,-e.height/2,e.width,e.height,e.roundness);break;case ee.Star:this.graphicsPath.polyStar(e.pointCount,e.outerRadius,e.innerRadius,e.outerRoundness,e.innerRoundness,t.StarType.Star);break;case ee.Polygon:this.graphicsPath.polyStar(e.pointCount,e.radius,e.radius,e.roundness,e.roundness,t.StarType.Polygon)}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.shapeDirty=!0;var i=t.stroke;i&&(this.hasStroke=!0,this.strokeAttributes.width=i.width,this.strokeAttributes.color.copyFrom(i.color),this.strokeAttributes.cap=i.cap,this.strokeAttributes.join=i.join);var r=t.fill;switch(r&&(this.hasFill=!0,this.fillAttribute.color.copyFrom(r.color)),t.type){case ee.Custom:for(var a,o={type:ee.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:t.fill},s=n(t.points);!(a=s()).done;){var u=a.value;o.points.push(new iq(u.x,u.y))}for(var h,l=n(t.easingIns);!(h=l()).done;){var c=h.value;o.easingIns.push(new iq(c.x,c.y))}for(var f,d=n(t.easingOuts);!(f=d()).done;){var p=f.value;o.easingOuts.push(new iq(p.x,p.y))}o.shapes=t.shapes,this.shapeAttribute=o;break;case ee.Ellipse:var m={type:ee.Ellipse,xRadius:t.xRadius,yRadius:t.yRadius,fill:t.fill};this.shapeAttribute=m;break;case ee.Rectangle:var v={type:ee.Rectangle,width:t.width,height:t.height,roundness:t.roundness,fill:t.fill};this.shapeAttribute=v;break;case ee.Star:var y={type:ee.Star,pointCount:t.pointCount,innerRadius:t.innerRadius,outerRadius:t.outerRadius,innerRoundness:t.innerRoundness,outerRoundness:t.outerRoundness,fill:t.fill};this.shapeAttribute=y;break;case ee.Polygon:var g={type:ee.Polygon,pointCount:t.pointCount,radius:t.radius,roundness:t.roundness,fill:t.fill};this.shapeAttribute=g}t.mask&&this.maskManager.setMaskOptions(t.mask);var x=this.maskManager.getRefValue();this.material.stencilRef=void 0!==x?[x,x]:void 0,rV(this.material,this.maskManager.maskMode)},rv(i,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),i}(aL),t.ShapeComponent=s([iA("ShapeComponent")],t.ShapeComponent),t.Fake3DComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.loop=!1,t.amountOfMotion=1,t.animationLength=2,t.mode=1,t.startPositionX=0,t.startPositionY=0,t.startPositionZ=0,t.endPositionX=0,t.endPositionY=0,t.endPositionZ=0,t.amplitudeX=0,t.amplitudeY=0,t.amplitudeZ=0,t.phaseX=0,t.phaseY=0,t.phaseZ=0,t}ib(i,e);var r=i.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(t.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var a=t;this.loop&&(a>.5&&(a=1-a),a*=2),e=this.startPositionX*(1-a)+a*this.endPositionX,i=this.startPositionY*(1-a)+a*this.endPositionY,r=this.startPositionZ*(1-a)+a*this.endPositionZ}var o=this.effectComponent.material;o.setFloat("_PosX",e*this.amountOfMotion),o.setFloat("_PosY",i*this.amountOfMotion),o.setFloat("_PosZ",r*this.amountOfMotion)}},i}(ry),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"loop",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"amountOfMotion",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"animationLength",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"mode",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionX",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionY",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionZ",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionX",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionY",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionZ",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeX",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeY",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeZ",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"phaseX",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"phaseY",void 0),s([iR(void 0,void 0)],t.Fake3DComponent.prototype,"phaseZ",void 0),t.Fake3DComponent=s([iA("Fake3DComponent")],t.Fake3DComponent),t.Fake3DAnimationMode=void 0,(tx=t.Fake3DAnimationMode||(t.Fake3DAnimationMode={}))[tx.Circular=0]="Circular",tx[tx.Linear=1]="Linear",t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}ib(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(ry),t.CameraController=s([iA(es.CameraController)],t.CameraController);var aV=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig);t.HitTestType=void 0,(tb=t.HitTestType||(t.HitTestType={}))[tb.triangle=1]="triangle",tb[tb.box=2]="box",tb[tb.sphere=3]="sphere",tb[tb.custom=4]="custom";var aD="click",ak="touchstart",az="touchmove",aU="touchend",aB=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var e=t.prototype;return e.bindListeners=function(){var t,e,i,r,n,a,o=this;n=function(t){return t};var s="mousedown",u="mousemove",h="mouseup",l="mouseleave",c=function(t,e,i,n,a){void 0===n&&(n=0),void 0===a&&(a=0);var s=0,u=0,h=performance.now();if(!o.target)return e8.warn("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:a,ts:h,width:0,height:0,origin:t};var l=o.target,c=l.width,f=l.height;if(r){var d=h-r.ts;s=(n-r.dx)/d||0,u=(a-r.dy)/d||0,r={dx:n,dy:a,ts:h}}return{x:e,y:i,vx:s,vy:u,dx:n,dy:a,ts:h,width:c,height:f,origin:t}};eK()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",h="touchend",l="touchcancel"),this.nativeHandlers=((a={})[s]=function(a){if(o.enabled){var s=n(a),u=aG(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},o.dispatchEvent(ak,c(a,t,e))}},a[u]=function(r){if(i&&o.enabled){var a=aG(n(r));t=a.x,e=a.y,o.dispatchEvent(az,c(r,t,e,t-i.x,e-i.y))}},a[h]=function(r){if(i&&o.enabled){!o.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var a=n(r),s=aG(a),u=Math.abs(i.clientX-a.clientX)+Math.abs(i.clientY-a.clientY);t=s.x,e=s.y,u<4&&o.dispatchEvent(aD,c(r,t,e)),o.dispatchEvent(aU,c(r,t,e,t-i.x,e-i.y))}i=0},a),this.nativeHandlers[l]=this.nativeHandlers[h],Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=o.target)||e.addEventListener(String(t),o.nativeHandlers[t])})},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),eD(i,e),function(){ek(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&ek(i,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={},this.target=null)},t}();function aG(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,o=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-o)/n.height*2}}var aj=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig),aX=(tE=new Int32Array((tT=new Float32Array(1)).buffer),function(t){tT[0]=t;var e=tE[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?(r|=2048,i|=(r>>114-n)+(r>>113-n&1)):(i|=n-112<<10|r>>1,i+=1&r)}),aH=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=aX(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=aX(t[i])},t}(),aW=new nT,aY=new r_;function aZ(t,e,i,r,n,a,o){var s=r/n,u=r,h=e.speedOverLifetime;h&&(u=h.getIntegrateValue(0,r,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(a),t.addScaledVector(o,u),t.addScaledVector(i,l);var c=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new iK;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),m=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?m?e.getValue(s):e.getIntegrateValue(0,r,n):0});aW.setFromArray(v).negate(),aY.setFromEuler(aW);var y=aY.transformPoint(p);t.addVectors(d,y)}if(c.enabled){var g=c.asMovement,x=c.x,b=c.y,T=c.z;if(x){var E=g?x.getValue(s):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(b){var _=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.y=t.y+_}if(T){var C=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.z=t.z+C}}return t}function aq(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function aK(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function aQ(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var o=0;o<i.length;o++)t[o]=i[o];return t}var aJ=((eb={})[tH.PARTICLE_ORIGIN_CENTER]=[0,0],eb[tH.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eb[tH.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eb[tH.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eb[tH.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eb[tH.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eb[tH.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eb[tH.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eb[tH.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eb);function a$(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function a0(t,e,i){var r=i.position,n=new iK(t,e,0),a=new iK;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new n_(r,a)}function a1(t,e,i){var r=t.x,n=t.y,a=t.z,o=new iK(r-e,n+i,a),s=new iK(r-e,n-i,a),u=new iK(r+e,n-i,a),h=new iK(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function a2(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function a3(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var a4={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex;return new iq(e[r],e[n])},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===tK.LINE?0:i===tK.EASE_OUT?0:i===tK.EASE_IN?2:i===tK.EASE?2:i===tK.HOLD&&r===tK.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tK.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tK.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tK.EASE,tK.EASE_IN,tK.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tK.EASE,tK.EASE_OUT,tK.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tK.HOLD&&[tK.HOLD,tK.LINE_OUT,tK.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tK.HOLD&&[tK.HOLD,tK.LINE,tK.EASE_IN].includes(i)}},a5=function(t,e){this.points=t,this.totalLength=e},a6={},a8={};function a9(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function a7(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var ot=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,i,r){var n=a3(e.x-t.x,3)+"_"+a3(e.y-t.y,3)+"_"+a3(e.z-t.z,3)+"&"+(a3(i.x-t.x,3)+"_"+a3(i.y-t.y,3))+"_"+a3(i.z-t.z,3)+"&"+(a3(r.x-t.x,3)+"_"+a3(r.y-t.y,3))+"_"+a3(r.z-t.z,3);if(a8[n])return{data:a8[n],interval:t};for(var a=[],o=null,s=0,u=0,h=0;h<300;h+=1){var l=new iK,c=h/299;u=0,l.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),l.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),l.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==o&&(u+=Math.pow(l.x-o.x,2)+Math.pow(l.y-o.y,2)+Math.pow(l.z-o.z,2)),o=l,s+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new a5(a,s);return a8[n]=f,{data:f,interval:new iK(t.x,t.y,t.z)}}(t,e,i,r),a=n.data,o=n.interval;this.lengthData=a,this.interval=o,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(a2(1-t,0))return e.points[299].point.clone().add(this.interval);if(a2(e.totalLength,0))return this.p1.clone();var i=new iK,r=a3(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(a2(n,r))return e.points[a].point.clone().add(this.interval);var o=!0,s=1;for(r<n&&(s=-1);o;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}s>0&&a<299?(a+=s,n+=a3(e.points[a].partialLength,5)):s<0&&a>0?(n-=a3(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),oe=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new iQ,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):a2(1-t,0)?this.temp.copyFrom(this.p2):(oa.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),oi=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new iq,this.control2=new iq,this.weighted=!1,this.isConstant=!1,this.mSampleValues=Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),a9(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var a=1-n,o=a*a,s=n*n;return o*a*t+e*o*n*3+i*a*s*3+s*n*r},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=a9(.1*t,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=.1;var n=i+(t-e[--r])/(e[r+1]-e[r])*.1,a=a7(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=a7(e,i,r);if(0===a)break;var o=a9(e,i,r)-t;e-=o/a}return e}(t,n,this.control1.x,this.control2.x):0===a?n:function(t,e,i,r,n){var a,o,s=0;do(a=a9(o=e+(i-e)/2,r,n)-t)>0?i=o:e=o;while(Math.abs(a)>1e-7&&++s<10);return o}(t,i,i+.1,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,(this.control1.x!==this.control1.y||this.control2.x!==this.control2.y)&&this.calcSampleValues()},t}();function or(t,e){var i,r,n,a=on(t,e,!0),o=a.p0,s=a.p1,u=a.p2,h=a.p3;e4(u),e4(h);var l=h.x-o.x,c=h.y-o.y,f=a3((s.x-o.x)/l,5),d=a3((u.x-o.x)/l,5);a2(c,0)?i=r=NaN:(i=a3((s.y-o.y)/c,5),r=a3((u.y-o.y)/c,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",o,s,u,h),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",o,s,u,h),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",o,s,u,h),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",o,s,u,h),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return a6[p]?n=a6[p]:(n=a2(c,0)?new oi:new oi(f,i,d,r),a6[p]=n),{points:[o,s,u,h],timeInterval:l,valueInterval:c,curve:n}}function on(t,e,i){var r=t[1],n=a4.isHoldOutKeyframe(t),a=a4.isHoldInKeyframe(e),o=!a&&a4.isRightSideEase(t),s=!n&&a4.isLeftSideEase(e);if(o&&!s&&!a){var u=new iq(r[r.length-4],r[r.length-3]),h=new iq(r[r.length-2],r[r.length-1]),l=a4.getPointInCurve(e),c=new iq(l.x,l.y),f=new iq(c.x-(c.x-u.x)/10,c.y);return{type:"ease",p0:u,p1:h,p2:f,p3:c}}if(!o&&s&&!n){var d=e[1],p=a4.getPointInCurve(t),m=new iq(p.x,p.y),v=new iq(d[0],d[1]),y=new iq(d[2],d[3]),g=new iq(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(o&&s){var x=e[1];return{type:"ease",p0:new iq(r[r.length-4],r[r.length-3]),p1:new iq(r[r.length-2],r[r.length-1]),p2:new iq(x[0],x[1]),p3:new iq(x[2],x[3])}}var b=a4.getPointInCurve(t),T=a4.getPointInCurve(e);if(n?T.y=b.y:a&&(b.y=T.y),!i)return{type:"line",p0:b,p1:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a};var E=new iq((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),_=new iq((T.x-b.x)/3*2+b.x,(T.y-b.y)/3*2+b.y);return{type:"ease",p0:b,p1:E,p2:_,p3:T,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var oa=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,o=e.z,s=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r){t.x=n,t.y=a,t.z=o,t.w=s;return}if(1===r){t.x=u,t.y=h,t.z=l,t.w=c;return}if(s!==c||n!==u||a!==h||o!==l){var f=1-r,d=n*u+a*h+o*l+s*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,a=a*f+h*g,o=o*f+l*g,s=s*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+o*o+s*s);n*=x,a*=x,o*=x,s*=x}}t.x=n,t.y=a,t.z=o,t.w=s},t}(),oo="not_implement",os=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(oo)},e.getIntegrateValue=function(t,e,i){throw Error(oo)},e.getIntegrateByTime=function(t,e){throw Error(oo)},e.getValue=function(t){throw Error(oo)},e.getMaxTime=function(){throw Error(oo)},e.toUniform=function(t){throw Error(oo)},e.map=function(t){throw Error(oo)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(oo)},t.getAllData=function(t,e){for(var i=new(e?aH:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var o=a[r].toData();i.set(o,n),n+=o.length}return e?i.data:i},t}(),ou=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(os),oh=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(os),ol=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){return this.min+(null!=e?e:Math.random())*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){return(this.min+(null!=i?i:1)*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(os),oc=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(os),of=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return ox(e,0,this.xCoord,this.min,this.max)-ox(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(os),od=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=eG(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1];if(n.stop<=t&&a.stop>t){var o=(t-n.stop)/(a.stop-n.stop);return ej(n.color,a.color,o,!0)}}return e[i].color.slice()},e}(os),op=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map(function(t){return t.slice?t.slice(0,2):[t.time,t.value]}).sort(function(t,e){return t[0]-e[0]});var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1],o=n[0],s=a[0];if(t>=o&&t<=s){var u=(t-o)/(s-o),h=n[1];return h+u*(a[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,a=e?ox:og,o=0;o<n;o++){var s=i[o],u=i[o+1],h=s[0],l=u[0];if(t>h&&t<=l)return r+a(t,h,l,s[1],u[1]);r+=a(l,h,l,s[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=Math.ceil(this.keys.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},i.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},i.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(os),om=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],a=e[r+1];if(n[0]<=t&&a[0]>=t){var o=a[1]-n[1],s=void 0;return s=0===o?(t-n[0])/(a[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,o=(t-e[0])/r,s=o*o,u=s*o;return(2*u-3*s+1)*e[1]+(u-2*s+o)*n+(u-s)*a+(-2*u+3*s)*i[1]}(t,n,a)-n[1])/o,this.calculateVec(r,s)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(os),ov=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=new iK(i[n][0],i[n][1],i[n][2]),u=new iK(i[n+1][0],i[n+1][1],i[n+1][2]),h=new iK(r[2*n][0],r[2*n][1],r[2*n][2]),l=new iK(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=or(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new ot(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=a3(t,5),i=0,r=new iK,n=this.keyTimeData;if(!n.length)return r;var a=this.curveSegments[n[0]].timeStart,o=this.curveSegments[n[n.length-1]].timeEnd;if(e<=a)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=o)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=this.curveSegments[n[s]].timeStart,h=this.curveSegments[n[s]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=a3((e-r.x)/n,4);return iW(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(os),oy=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var a=e[n],o=e[n+1],s=iQ.fromArray(i[n]),u=iQ.fromArray(i[n+1]),h=iQ.fromArray(r[2*n]),l=iQ.fromArray(r[2*n+1]),c=or(a,o),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new oe(s,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=a3(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<r.length;o++){var s=r[o].split("&"),u=s[0],h=s[1];if(i>=Number(u)&&i<Number(h)){var l=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),l.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=a3((e-r.x)/n,4);return iW(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(os);function og(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function ox(t,e,i,r,n){var a=t*t,o=e*e;return(a*t*2*(r-n)+3*a*(e*n-i*r)-o*e*(2*r+n)+3*o*i*r)/(6*(e-i))}function ob(t,e){if(e){var i=e[0],r=e[1];if(i===tq.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===tq.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var o=Math.ceil(a/2);t.lineSegCount+=o,t.curves.push(r),t.index+=o,t.max=Math.max(t.max,o)}else if(i===tq.BEZIER_CURVE){var s=r.length-1;t.index+=2*s,t.curves.push(r),t.max=Math.max(t.max,2*s),t.curveCount+=2*s}}}function oT(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function oE(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(oE=function(){return!!t})()}function o_(t,e,i){return(o_=oE()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&ix(n,i.prototype),n}).apply(null,arguments)}var oC=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new rb,e}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=oM(t[0]),this.yCurve=oM(t[1]),this.zCurve=oM(t[2]),this.wCurve=oM(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(os),oS=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iK,e}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=oM(t[0]),this.yCurve=oM(t[1]),this.zCurve=oM(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(os),oA=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iq,e}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=oM(t[0]),this.yCurve=oM(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(os);t.TangentMode=void 0,(t_=t.TangentMode||(t.TangentMode={}))[t_.Cubic=0]="Cubic",t_[t_.Linear=1]="Linear",t_[t_.Constant=2]="Constant",t.WeightedMode=void 0,(tC=t.WeightedMode||(t.WeightedMode={}))[tC.None=0]="None",tC[tC.In=1]="In",tC[tC.Out=2]="Out",tC[tC.Both=3]="Both";var ow=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=t;var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=function(t,e){var i,r,n,a=new iq(t.time,t.value),o=new iq,s=new iq,u=new iq,h=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,l=2===t.tangentMode,c=(h?t.outWeight:1)*(e.time-t.time)/3;o.x=t.time+c,o.y=t.value+c*(l?0:t.outSlope);var f=(h?e.inWeight:1)*(e.time-t.time)/3;s.x=e.time-f,s.y=e.value-f*(l?0:e.inSlope),u.x=e.time,u.y=l?t.value:e.value,e4(s),e4(u);var d=u.x-a.x,p=u.y-a.y,m=a3((o.x-a.x)/d,5),v=a3((s.x-a.x)/d,5);a2(p,0)?i=r=NaN:(i=a3((o.y-a.y)/p,5),r=a3((s.y-a.y)/p,5)),m<0&&(console.error("Invalid bezier points, x1 < 0",a,o,s,u),m=0),v<0&&(console.error("Invalid bezier points, x2 < 0",a,o,s,u),v=0),m>1&&(console.error("Invalid bezier points, x1 >= 1",a,o,s,u),m=1),v>1&&(console.error("Invalid bezier points, x2 >= 1",a,o,s,u),v=1);var y=("bez_"+m+"_"+i+"_"+v+"_"+r).replace(/\./g,"p");return a6[y]?n=a6[y]:(n=a2(p,0)?new oi:h?new oi(m,i,v,r):new oi(i,r),a6[y]=n),{points:[a,o,s,u],timeInterval:d,valueInterval:p,curve:n}}(e[i],e[i+1]),n=r.points,a=r.curve,o=r.timeInterval,s=r.valueInterval,u=n[0],h=n[n.length-1];this.keys.push([].concat(u.toArray(),n[1].toArray())),this.keys.push([].concat(h.toArray(),n[2].toArray()));var l={points:n,timeInterval:o,valueInterval:s,curve:a,timeStart:Number(u.x),timeEnd:Number(h.x)};this.curveMap[u.x+"&"+h.x]=l,this.curveInfos.push(l)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,a=this.keyFrames[r+1].time;if(t>=n&&t<a){var o=this.curveInfos[r],s=o.points[0],u=o.timeInterval,h=o.valueInterval,l=(t-s.x)/u,c=o.curve.getValue(l);e=s.y+h*c;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var o=0;o<a.length;o++){var s=this.curveMap[a[o]].timeStart,u=this.curveMap[a[o]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[o],Number(u))),r>=Number(s)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[o],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,o=0,s=(e-r.x)/20,u=0;u<=20;u++){var h=u*s/n,l=r.y+a*i.curve.getValue(h);0===u||20===u?o+=l:u%2==1?o+=4*l:o+=2*l}return s/3*o},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(os);function oR(t){for(var e=[],i=[],r={x:0,y:0},n=0;n<t.length-1;n++){var a=t[n],o=t[n+1],s=on(a,o,!0),u=s.p0,h=s.p1,l=s.p2,c=s.p3;e4(l),e4(c);var f={leftControl:r,value:u,rightControl:h,tangentMode:0};if(a[0]===tK.HOLD&&(f.tangentMode=2),i.push(f),r=l,n===t.length-2){var d=on(o,o,!0);e4(d.p3),i.push({leftControl:l,value:d.p3,rightControl:{x:0,y:0},tangentMode:o[0]===tK.HOLD?2:0})}}for(var p=function(t,e){return(e.y-t.y)/(e.x-t.x+1e-6)},m=0;m<i.length;m++){var v=i[m].leftControl,y=i[m].value,g=i[m].rightControl,x=p(y,g),b=p(v,y),T={time:y.x,value:y.y,inSlope:b,outSlope:x,inWeight:0,outWeight:0,tangentMode:i[m].tangentMode,weightedMode:3};e.push(T),m>0&&(T.inWeight=(y.x-v.x)/((y.x-i[m-1].value.x)/3)),m+1<i.length&&(T.outWeight=(g.x-y.x)/((i[m+1].value.x-y.x)/3))}return e}var oI=((eT={})[tq.RANDOM]=function(t){return a(t[0],Array)?new oc(t):new ol(t)},eT[tq.CONSTANT]=function(t){return new ou(t)},eT[tq.CONSTANT_VEC2]=function(t){return new ou(t)},eT[tq.CONSTANT_VEC3]=function(t){return new ou(t)},eT[tq.CONSTANT_VEC4]=function(t){return new ou(t)},eT[tq.RGBA_COLOR]=function(t){return new ou(t)},eT[tq.COLORS]=function(t){return new oh(t.map(function(t){return eU(t,!1)}))},eT[tq.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new of([t[0][1],t[1][1]]):new op(t)},eT[tq.GRADIENT_COLOR]=function(t){return new od(t)},eT[tq.LINEAR_PATH]=function(t){return new om(t)},eT[tq.BEZIER_CURVE]=function(t){return 1===t.length?new ou(t[0][1][1]):new ow(oR(t))},eT[tq.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new ou(o_(iK,[].concat(t[1][0]))):new ov(t)},eT[tq.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new ou(o_(iQ,[].concat(t[1][0]))):new oy(t)},eT[tq.COLOR_CURVE]=function(t){return new oO(t)},eT[tq.VECTOR4_CURVE]=function(t){return new oC(t)},eT[tq.VECTOR2_CURVE]=function(t){return new oA(t)},eT[27]=function(t){return new oS(t)},eT);function oM(t){if(!t||!isNaN(+t))return new ou(t||0);if(a(t,os))return t;if(ie(oI[t[0]]))return oI[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+aM["ValueType: 21/22 is not supported"]+".")}var oO=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new rE,e}ib(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=oM(t[0]),this.gCurve=oM(t[1]),this.bCurve=oM(t[2]),this.aCurve=oM(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(os),oP=1,oN=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),a=this.createGeometry();this.mesh=this.createMesh(a,n),this.updateMesh()}var i=e.prototype;return i.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new iK,n=new iQ,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},i.createMaterial=function(e){var i,r=[["ENV_EDITOR",(null==(i=this.engine.renderer)?void 0:i.env)===aI]],n=oM(this.color).getValue(0),a={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:t.GLSLVersion.GLSL1,cacheId:""+e.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},o=no.create(this.engine,a);return o.blending=!0,o.depthTest=!1,o.setVector4("uPos",new rb(0,0,0,0)),o.setVector2("uSize",new iq(1,1)),o.setVector4("uColor",new rb(n[0]/255,n[1]/255,n[2]/255,n[3])),o.setQuaternion("uQuat",new iQ(0,0,0,0)),o},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return nx.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:rw.LINES,maxVertex:4})},i.createMesh=function(t,e){return nR.create(this.engine,{name:"Interact_preview"+oP++,priority:0,worldMatrix:r_.fromIdentity(),geometry:t,material:e})},e}();function oF(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.speed=25,t.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},t.invalidBorderRange=0,t.invalidByBorderRange=!1,t.duringPlay=!1,t._interactive=!0,t.lastTime=-1,t.getHitTestParams=function(e){if(t.clickable){var i=t.item.props.content.options.behavior,r=t.getBoundingBox();if(r)return{type:r.type,triangles:r.area,behavior:i}}},t}ib(i,e);var r=i.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.engine.renderer.env,e=this.item.composition,i=this.interactData.options,r=i.type,n=i.showPreview;if(r===tB.CLICK&&(this.clickable=!0,n&&t===aI)){var a=null==e?void 0:e.getRendererOptions();void 0!==a&&(this.previewContent=new oN(this.item.props.content,a,this.transform,this.engine))}this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){e.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){e.prototype.onEnable.call(this);var t=this.interactData.options.type,i=this.item.engine.renderer.env;if(t===tB.CLICK)this.clickable=!0;else if(t===tB.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==aI||n){var a,o=(null!=(a=this.item.composition)?a:{}).event;o&&this.beginDragTarget(r,o)}}},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,a=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,a.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,oF(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,a=n.position,o=n.fov,s=e.dy,u=e.dx*e.width/e.height,h=a[2],l=Math.tan(o*Math.PI/180/2)*Math.abs(h),c=this.dragRange,f=c.dxRange,d=c.dyRange,p=a[0]-this.dragRatio[0]*(u*l),m=a[1]-this.dragRatio[1]*(s*l),v=f[0],y=f[1],g=d[0],x=d[1];p=iW(p,v,y),m=iW(m,g,x),p!==v&&p!==y&&v!==y&&(null==(i=e.origin)||i.preventDefault()),m!==g&&m!==x&&g!==x&&(null==(r=e.origin)||r.preventDefault()),this.item.composition.camera.position=new iK(p,m,h)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var a={touchstart:function(t){if(n.canInteract()&&(n.invalidByBorderRange=n.checkInvalidBorderRange({x:t.x,y:t.y}),!n.invalidByBorderRange)){n.dragEvent=null,n.bouncingArg=null;var e,i=null==(e=n.item.composition)?void 0:e.camera;r={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){n.invalidByBorderRange||(n.handleDragMove(r,t),n.bouncingArg=t)},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!oF(e,3)&&e&&(e.vx*=n.speed,e.vy*=n.speed,n.dragEvent=iB({},r)),r=null}}};Object.keys(a).forEach(function(t){e.addEventListener(t,a[t])}),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(a).forEach(function(t){e.removeEventListener(t,a[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=a1(iK.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}},r.fromData=function(t){if(e.prototype.fromData.call(this,t),this.interactData=t,t.options.type===tB.DRAG){var i=t.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},r.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i,r,n,a,o=0,s=0,u=0,h=0;if("number"==typeof e?(o=e,s=e,u=e,h=e):it(e)&&(o=void 0===(i=e[0])?0:i,s=void 0===(r=e[1])?0:r,u=void 0===(n=e[2])?0:n,h=void 0===(a=e[3])?0:a),t.x<h-1||t.x>1-s||t.y<o-1||t.y>1-u)return!0}return!1},rv(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(rx),t.InteractComponent=s([iA(es.InteractComponent)],t.InteractComponent);var oL=function(){function e(){this.triangles=[],this.worldMatrix=new r_,this.assemblyTriangles=function(t,e,i,r,n){for(var a=i;a<r;a+=3){var o=3*e[a],s=3*e[a+1],u=3*e[a+2],h={x:t[o],y:t[o+1],z:t[o+2]},l={x:t[s],y:t[s+1],z:t[s+2]},c={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:l,p2:c})}}}var i=e.prototype;return i.getBoundingBoxData=function(){return this.applyWorldMatrix(this.boundingBoxData.area),this.boundingBoxData},i.getBoundingBox=function(){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=Number.MAX_VALUE,s=n(this.boundingBoxData.area);!(e=s()).done;){var u=e.value;i=Math.max(u.p0.x,u.p1.x,u.p2.x,i),r=Math.max(u.p0.y,u.p1.y,u.p2.y,r),a=Math.min(u.p0.x,u.p1.x,u.p2.x,a),o=Math.min(u.p0.y,u.p1.y,u.p2.y,o)}var h=[],l=new iK(a,r,0),c=new iK(i,r,0),f=new iK(i,o,0),d=new iK(a,o,0);return h.push({p0:l,p1:c,p2:f}),h.push({p0:l,p1:f,p2:d}),this.applyWorldMatrix(h),{type:t.HitTestType.triangle,area:h}},i.setGeometry=function(e,i){this.triangles=this.geometryToTriangles(e);for(var r,a=[],o=n(this.triangles);!(r=o()).done;){var s=r.value;a.push({p0:s.p0,p1:s.p1,p2:s.p2})}i&&this.worldMatrix.copyFrom(i),this.boundingBoxData={type:t.HitTestType.triangle,area:a}},i.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var a,o=n(t.subMeshes);!(a=o()).done;){var s=a.value;if(void 0!==s.indexCount){var u=e.BYTES_PER_ELEMENT,h=s.offset/u,l=h+s.indexCount;this.assemblyTriangles(i,e,h,l,r)}}return r},i.applyWorldMatrix=function(t){var e=this;return t.forEach(function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new iK),t.p1=e.worldMatrix.transformPoint(t.p1,new iK),t.p2=e.worldMatrix.transformPoint(t.p2,new iK)}),t},e}(),oV=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="sprite",e}return ib(e,t),e}(ig),oD=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=n(this.playableOutputs);!(e=i()).done;)e.value.context.deltaTime=t;for(var r,a=n(this.playableOutputs);!(r=a()).done;){var o=r.value;this.prepareFrameWithRoot(o)}for(var s,u=n(this.playableOutputs);!(s=u()).done;){var h=s.value;this.processFrameWithRoot(h)}},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrame(t.context),t.processFrame()},e.prepareFrameWithRoot=function(t){t.prepareFrame(),t.sourcePlayable.prepareFrame(t.context)},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&t.setTime(t.getTime()+e)},t}(),ok=function(){function t(t,e){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0,t.addPlayable(this)}var e=t.prototype;return e.play=function(){switch(this.playState){case 0:break;case 1:this.playState=0,this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1}},e.pause=function(){0===this.playState&&(this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1)},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},t}(),oz=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayable=function(t){this.sourcePlayable=t},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),oU=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iI);function oB(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(tS=eE||(eE={}))[tS.Playing=0]="Playing",tS[tS.Paused=1]="Paused";var oG=new iQ,oj=1,oX=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new iK(0,0,0),this.quat=new iQ(0,0,0,1),this.rotation=new nT(0,0,0),this.scale=new iK(1,1,1),this.anchor=new iK(0,0,0),this.size=new iq(1,1),this.children=[],this.worldMatrix=r_.fromIdentity(),this.localMatrix=r_.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new iK(0,0,0),quat:new iQ(0,0,0,1),scale:new iK(1,1,1)},this.name="transform_"+oj++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,o=t.size,s=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),i&&(a(i,iK)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),s)a(s,iQ)?this.setQuaternion(s.x,s.y,s.z,s.w):this.setQuaternion(s[0],s[1],s[2],s[3]);else if(r){var l=e?-1:1;a(r,nT)?this.setRotation(r.x*l,r.y*l,r.z*l):this.setRotation(r[0]*l,r[1]*l,r[2]*l)}n&&(a(n,iK)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),h&&(a(h,iq)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){eD(this.children,t)},e.removeChild=function(t){ek(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new nT)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;return this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1),this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new nT)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=new iK().copyFrom(t.position),t.quat?e.quat=new iQ(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new nT(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=new iK().copyFrom(t.scale),t.size&&(e.size=new iq().copyFrom(t.size)),t.anchor&&(e.anchor=new iq().copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach(function(t){t.parentMatrixDirty=!0})},t.getRotation=function(t,e){var i=oG.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},rv(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}(),oH=new iK(1,1,1),oW=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new oX,this.viewportMatrix=r_.fromIdentity(),this.viewMatrix=r_.fromIdentity(),this.projectionMatrix=r_.fromIdentity(),this.viewProjectionMatrix=r_.fromIdentity(),this.inverseViewMatrix=r_.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,a=e.aspect,o=e.clipMode,s=void 0===o?tZ.portrait:o,u=e.position,h=void 0===u?[0,0,8]:u,l=e.rotation,c=void 0===l?[0,0,0]:l,f=new nT(c[0],c[1],c[2]),d=new iQ().setFromEuler(f);this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===a?1:a,clipMode:s},this.transform.setPosition(h[0],h[1],h[2]),this.transform.setQuaternion(d.x,d.y,d.z,d.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new iK(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var a=i.projectPoint(e).z,o=r.projectPoint(new iK(1,1,a)),s=o.x,u=o.y,h=r.projectPoint(new iK(-1,-1,a));return new iK((s-h.x)/2,(u-h.y)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return iB({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,a=t.aspect,o=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=o,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,a=e.far,o=e.clipMode;this.projectionMatrix.perspective(i*iG,r,n,a,o===tZ.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),oH),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:r_.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},rv(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.transform.position.clone()},set:function(t){this.transform.position.equals(t)||(this.transform.setPosition(t.x,t.y,t.z),this.dirty=!0)}},{key:"worldPosition",get:function(){return this.transform.getWorldPosition()}},{key:"rotation",get:function(){return this.transform.rotation.clone()},set:function(t){this.transform.rotation.equals(t)||(this.transform.setRotation(t.x,t.y,t.z),this.dirty=!0)}}]),t}(),oY=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+i||1,this.count=a(r,os)?r:oM(r),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),oZ=function(t){this.content=t},oq=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do if(t(e.content))return e;while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new oZ(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(0>=this.sort(i.content,e.content)))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new oZ(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(0>=this.sort(e.content,i.content)))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,a=t.next;n.next=a,a&&(a.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do t.call(e||this,i.content,r++);while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do t.call(e||this,i.content,r--);while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),oK="lookup_texture",oQ="offscreen_canvas",oJ={},o$=new iK,o0=new iK,o1=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,o=i.colorOverTrail,s=i.maxTrailCount,u=i.opacityOverLifetime,h=void 0===u?oM(1):u,l=i.widthOverTrail,c=i.name,f=i.occlusion,d=i.blending,p=i.maskMode,m=i.mask,v=i.textureMap,y=i.texture,g=i.transparentOcclusion,x=i.minimumVertexDistance,b=i.lifetime,T=i.matrix,E=e.gpuCapability,_=E.detail,C=E.level,S=Math.max(i.pointCountPerTrail,2),A=oT(),w=_.maxVertexTextures>0,R=(null!=(r=e.renderer)?r:{}).env,I={},M=[["ENABLE_VERTEX_TEXTURE",w],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",R===aI]],O=s>64,P=0;n&&(M.push(["COLOR_OVER_LIFETIME",!0]),P|=1,I.uColorOverLifetime=r4.createWithData(e,e0(n))),o&&(M.push(["COLOR_OVER_TRAIL",!0]),P|=4,I.uColorOverTrail=r4.createWithData(e,e0(o))),O?(M.push(["ATTR_TRAIL_START",1]),P|=8):I.uTrailStart=new Float32Array(s),I.uOpacityOverLifetimeValue=h.toUniform(A);var N=l.toUniform(A);M.push(["VERT_CURVE_VALUE_COUNT",A.index],["VERT_MAX_KEY_FRAME_COUNT",A.max]),I.uVCurveValues=os.getAllData(A);var F={shader:{vertex:nV,fragment:nF,macros:M,glslVersion:1===C?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+P+"+"+A.index+"+"+A.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},L=S*s*2,V=(S-1)*s,D=Float32Array.BYTES_PER_ELEMENT,k=12*D,z={attributes:{aColor:{size:4,stride:k,data:new Float32Array(12*L)},aSeed:{size:1,stride:k,offset:4*D,dataSource:"aColor"},aInfo:{size:3,stride:k,offset:5*D,dataSource:"aColor"},aPos:{size:4,stride:k,offset:8*D,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(L)},aDir:{size:3,data:new Float32Array(3*L)}},indices:{data:new Uint16Array(6*L)},drawCount:6*V,name:"trail#"+c,bufferUsage:rw.DYNAMIC_DRAW};if(O)z.attributes.aTrailStart={size:1,data:new Float32Array(L)};else{var U=new Float32Array(L);z.attributes.aTrailStartIndex={size:1,data:U};for(var B=0;B<s;B++)for(var G=2*S,j=B*G,X=0;X<G;X++)U[j+X]=B}var H=rN(d),W=no.create(e,F);W.blending=!0,W.depthMask=f,W.depthTest=!0,W.stencilRef=m?[m,m]:void 0,rV(W,p),rF(W,d);var Y=this.mesh=nR.create(e,{name:"MTrail_"+c,material:W,geometry:nx.create(e,z)}),Z=null!=y?y:r4.createWithData(e);Object.keys(I).map(function(t){var e=I[t];if(a(e,r4))W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new rb(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}W.setVector4Array(t,i)}else W.setVector4(t,rb.fromArray(e))}),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",rb.fromArray(N)),W.setVector2("uTexOffset",new iq(0,0)),W.setVector4("uTextureMap",rb.fromArray(void 0===v?[0,0,1,1]:v)),W.setVector4("uParams",new rb(0,S-1,0,0)),W.setTexture("uMaskTex",Z),W.setVector4("uColorParams",new rb(y?1:0,+H,0,+(f&&!g))),this.maxTrailCount=s,this.pointCountPerTrail=S,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=O,this.lifetime=b,T&&(this.mesh.worldMatrix=T),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(s)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,a=this.geometry,o=n-1,s=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,o$);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+s,f=o5(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),a.setAttributeSubData("aDir",6*c,v),a.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var y=i.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(p,4),g[7]=0,g.set(x,8),g[11]=.5*m,g.set(y,12),g.set(p,16),g[19]=1,g.set(x,20),g[23]=-.5*m,a.setAttributeSubData("aColor",24*c,g),u>=0){var b=new Float32Array(o5(this.getTrailPosition(t,h,o0),l,e)),T=(t*n+u)*6;a.setAttributeSubData("aDir",T,b),a.setAttributeSubData("aDir",T+3,b);var E=t*n*2,_=new Uint16Array([2*u+E,2*u+1+E,2*s+E,2*s+E,2*u+1+E,2*s+1+E]),C=(t*o+(r-1)%o)*6;a.setIndexSubData(C,_)}r=++this.trailCursors[t];var S=this.mesh.material,A=S.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var R=2*n,I=new Float32Array(R),M=0;M<R;M++)I[M]=w;a.setAttributeSubData("aTrailStart",t*I.length,I)}else{var O=S.getFloats("uTrailStart");void 0!=O&&(O[t]=w,S.setFloats("uTrailStart",O))}A&&(A.y=Math.max(A.y,r-1)-Math.max(0,r-n),S.setVector4("uParams",A))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,a=this.geometry.getAttributeData("aColor");return e4(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();e4(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},i.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");e4(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},i.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,i=this.geometry.getIndexData();e4(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},i.getPointStartPos=function(t){return this.pointStart[t]},i.setPointStartPos=function(t,e){this.pointStart[t]=e},i.onUpdate=function(t){},rv(e,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),e}(),o2=new iK,o3=new iK,o4=new iK;function o5(t,e,i){return t||i?(t?i?(o3.subtractVectors(e,t).normalize(),o3.subtractVectors(i,e),o4.copyFrom(o3).normalize(),o2.addVectors(o3,o4)):o2.subtractVectors(e,t):o2.subtractVectors(i,e),o2.normalize().toArray()):[0,0,0]}var o6=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}ib(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&a(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;e&&(this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),e.update(this.time-e.time)),this.lastTime=this.time},i}(ok),o8=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){return new o6(t)},e}(oU),o9={uSprite:"vec4",uParams:"vec4",uAcceleration:"vec4",uGravityModifierValue:"vec4",uOpacityOverLifetimeValue:"vec4",uRXByLifeTimeValue:"vec4",uRYByLifeTimeValue:"vec4",uRZByLifeTimeValue:"vec4",uLinearXByLifetimeValue:"vec4",uLinearYByLifetimeValue:"vec4",uLinearZByLifetimeValue:"vec4",uSpeedLifetimeValue:"vec4",uOrbXByLifetimeValue:"vec4",uOrbYByLifetimeValue:"vec4",uOrbZByLifetimeValue:"vec4",uSizeByLifetimeValue:"vec4",uSizeYByLifetimeValue:"vec4",uColorParams:"vec4",uFSprite:"vec4",uPreviewColor:"vec4",uVCurveValues:"vec4Array",uFCurveValues:"vec4",uFinalTarget:"vec3",uForceCurve:"vec4",uOrbCenter:"vec3",uTexOffset:"vec2",uPeriodValue:"vec4",uMovementValue:"vec4",uStrengthValue:"vec4",uWaveParams:"vec4"},o7=function(){function e(e,i){this.particleCount=0,this.cachedRotationVector3=new iK,this.cachedRotationMatrix=new nE,this.cachedLinearMove=new iK,this.tempMatrix3=new nE,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,o,s,u,h,l,c,f,d=(null!=(l=e.renderer)?l:{}).env,p=i.speedOverLifetime,m=i.colorOverLifetime,v=i.linearVelOverLifetime,y=i.orbitalVelOverLifetime,g=i.sizeOverLifetime,x=i.rotationOverLifetime,b=i.sprite,T=i.gravityModifier,E=i.maxCount,_=i.textureFlip,C=i.useSprite,S=i.name,A=i.gravity,w=i.forceTarget,R=i.side,I=i.occlusion,M=i.anchor,O=i.blending,P=i.maskMode,N=i.mask,F=i.transparentOcclusion,L=i.meshSlots,V=i.renderMode,D=void 0===V?0:V,k=i.diffuse,z=void 0===k?r4.createWithData(e):k,U=e.gpuCapability.detail,B=U.halfFloatTexture,G=U.maxVertexUniforms,j=[["RENDER_MODE",+D],["ENV_EDITOR",d===aI]],X=e.gpuCapability.level,H=oT(),W=oT(),Y=G>0,Z={},q=0,K=0;this.useSprite=C,Y&&j.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(j.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=p.toUniform(H)),(null==b?void 0:b.animate)&&(j.push(["USE_SPRITE",!0]),K|=4,Z.uFSprite=Z.uSprite=new Float32Array([b.col,b.row,b.total,b.blend?1:0]),this.useSprite=!0),(null==m?void 0:m.color)&&(j.push(["COLOR_OVER_LIFETIME",!0]),K|=16,Z.uColorOverLifetime=a(m.color,r4)?m.color:r4.createWithData(e,e0(m.color))),(null==m?void 0:m.opacity)?Z.uOpacityOverLifetimeValue=m.opacity.toUniform(H):Z.uOpacityOverLifetimeValue=oM(1).toUniform(H),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==v?void 0:v[t])&&(Z["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(H),i=1,K|=1<<7+e,v.enabled=!0),j.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==y?void 0:y[t])&&(Z["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=y[t].toUniform(H),r=1,K|=1<<10+e,c=!0,y.enabled=!0),j.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==v?void 0:v.asMovement)&&(j.push(["AS_LINEAR_MOVEMENT",!0]),K|=32),c&&((null==y?void 0:y.asRotation)&&(j.push(["AS_ORBITAL_MOVEMENT",!0]),K|=64),Z.uOrbCenter=new Float32Array((null==y?void 0:y.center)||[0,0,0])),Z.uSizeByLifetimeValue=null==g?void 0:g.x.toUniform(H),(null==g?void 0:g.separateAxes)&&(j.push(["SIZE_Y_BY_LIFE",1]),K|=16384,Z.uSizeYByLifetimeValue=null==g?void 0:null==(f=g.y)?void 0:f.toUniform(H)),(null==x?void 0:x.z)&&(Z.uRZByLifeTimeValue=x.z.toUniform(H),K|=32768,j.push(["ROT_Z_LIFETIME",1])),(null==x?void 0:x.x)&&(Z.uRXByLifeTimeValue=x.x.toUniform(H),K|=65536,j.push(["ROT_X_LIFETIME",1])),(null==x?void 0:x.y)&&(Z.uRYByLifeTimeValue=x.y.toUniform(H),K|=131072,j.push(["ROT_Y_LIFETIME",1])),(null==x?void 0:x.asRotation)&&(j.push(["ROT_LIFETIME_AS_MOVEMENT",1]),K|=262144),Z.uGravityModifierValue=T.toUniform(H),w&&(j.push(["FINAL_TARGET",!0]),K|=524288,Z.uFinalTarget=new Float32Array(w.target||[0,0,0]),Z.uForceCurve=w.curve.toUniform(H)),B&&W.max?(K|=1048576,Z.uFCurveValueTexture=r5(e,os.getAllData(W,!0),W.index,1)):Z.uFCurveValues=os.getAllData(W);var Q=H.max+H.curves.length-32>G;if(2===X&&(H.max=-1,H.index=L?L[0]:se(H.index),W.index>0&&(W.max=-1,W.index=L?L[1]:se(W.index))),Q&&B&&Y){var J=r5(e,os.getAllData(H,!0),H.index,1);Z.uVCurveValueTexture=J,q=1}else Z.uVCurveValues=os.getAllData(H);var $=["-p:",D,K,H.index,H.max,W.index,W.max].join("+");j.push(["VERT_CURVE_VALUE_COUNT",H.index],["FRAG_CURVE_VALUE_COUNT",W.index],["VERT_MAX_KEY_FRAME_COUNT",H.max],["FRAG_MAX_KEY_FRAME_COUNT",W.max]),this.VERT_MAX_KEY_FRAME_COUNT=H.max;var tt={fragment:nF,vertex:"#define LOOKUP_TEXTURE_CURVE "+q+"\n"+nL,glslVersion:1===X?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:$,macros:j,name:"particle#"+S},te=rN(O);Z.uTexOffset=new Float32Array(z?[1/z.getWidth(),1/z.getHeight()]:[0,0]),Z.uMaskTex=z,Z.uColorParams=new Float32Array([z?1:0,+te,0,+(!!I&&!F)]),Z.uParams=[0,0,0,0],Z.uAcceleration=[(null==A?void 0:A[0])||0,(null==A?void 0:A[1])||0,(null==A?void 0:A[2])||0,0];var ti=no.create(e,{shader:tt,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});ti.blending=!0,ti.depthTest=!0,ti.depthMask=!!I,ti.stencilRef=N?[N,N]:void 0,rV(ti,P),rF(ti,O),rL(ti,R),Object.keys(Z).map(function(t){var e=Z[t];if(a(e,r4)){ti.setTexture(t,e);return}var i=[];switch(o9[t]){case"vec4":ti.setVector4(t,rb.fromArray(e));break;case"vec3":ti.setVector3(t,iK.fromArray(e));break;case"vec2":ti.setVector2(t,iq.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new rb(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}ti.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),ti.setVector3("emissionColor",new iK(0,0,0)),ti.setFloat("emissionIntensity",0);var tr=nx.create(e,(r=4*E,n=this.useSprite,o="particle#"+S,h={aPos:{size:3,offset:0,stride:u=12*(s=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*s,stride:u,dataSource:"aPos"},aDirX:{size:3,offset:6*s,stride:u,dataSource:"aPos"},aDirY:{size:3,offset:9*s,stride:u,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*s,data:new Float32Array(0)},aSeed:{size:1,offset:3*s,stride:8*s,dataSource:"aRot"},aColor:{size:4,offset:4*s,stride:8*s,dataSource:"aRot"},aOffset:{size:4,stride:4*s,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*s,data:new Float32Array(0)},aRotation1:{size:3,offset:3*s,stride:9*s,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*s,stride:9*s,dataSource:"aRotation0"}},n&&(h.aSprite={size:3,stride:3*s,data:new Float32Array(0)}),{attributes:h,indices:{data:new Uint16Array(0)},name:o,maxVertex:r})),tn=nR.create(e,{name:"MParticle_"+S,material:ti,geometry:tr});this.anchor=M,this.mesh=tn,this.geometry=tn.firstGeometry(),this.forceTarget=w,this.sizeOverLifetime=g,this.speedOverLifetime=p,this.linearVelOverLifetime=v,this.orbitalVelOverLifetime=y,this.orbitalVelOverLifetime=y,this.gravityModifier=T,this.rotationOverLifetime=x,this.maxCount=E,this.textureOffsets=_?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var i=e.prototype;return i.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return e4(e),[e[i],e[i+1],e[i+2],e[i+3]]},i.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},i.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.constructor(0))}t.setIndexData(new i.constructor(0))},i.onUpdate=function(t){var e=Math.ceil(this.geometry.getAttributeData("aPos").length/12);this.applyTranslation(e,t),this.applyRotation(e,t),this.applyLinearMove(e,t)},i.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},i.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},i.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r,n=t+1,a=4*n,o=this.geometry,s=n>this.maxParticleBufferCount,u=1;this.particleCount>300?u=(this.particleCount+100)/this.particleCount:this.particleCount>100?u=1.4:this.particleCount>0&&(u=2);var h={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},l=this.useSprite;l&&(h.aSprite=new Float32Array(12));var c=new iK,f=new iQ,d=new iK(1,1,1);e.transform.assignWorldTRS(c,f,d);var p=oX.getRotation(f,new nT),m=c.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();l&&(r=e.sprite);for(var C=0;C<4;C++){var S=2*C,A=3*C,w=4*C,R=12*C,I=8*C;h.aPos.set(m,R),b.fill(h.aPos,R+3),h.aRot.set(v,I),h.aRot[I+3]=_,h.aRot.set(T,I+4),l&&h.aSprite.set(r,A);var M=e.uv||x;if(M){var O=l?1-y[S+1]:y[S+1];g[0]=M[0]+y[S]*M[2],g[1]=M[1]+O*M[3]}h.aOffset.set(g,w);for(var P=C+C,N=(E[P]-this.anchor.x)*d.x,F=(E[P+1]-this.anchor.y)*d.y,L=0;L<3;L++)h.aPos[R+6+L]=e.dirX.getElement(L)*N,h.aPos[R+9+L]=e.dirY.getElement(L)*F}var V=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var D=ez(o.getIndexData(),6*n,6*i,u);D.set(V,6*t),o.setIndexData(D),this.maxParticleBufferCount=D.length/6}else o.setIndexSubData(6*t,V);Object.keys(h).forEach(function(e){var r=h[e],n=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=o.getAttributeData(e);e4(l);var c=ez(l,a*n,4*i*n,u);c.set(r,r.length*t),o.setAttributeData(e,c)}else o.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),o.setDrawCount(6*this.particleCount)}},i.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var o=0,s=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),l=this.mesh.material.getVector4("uGravityModifierValue"),c=0;c<t;c+=4){var f=12*c+3;o=n[f],s=n[f+1],u=n[f+2];var d=i-a[4*c+2],p=a[4*c+3];if(h&&l){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);o=o*x+v,s=s*x+y,u=u*x+g}else o+=v,s+=y,u+=g}var b=3*c;if(a[4*c+2]<i){var T=e/1e3*o,E=e/1e3*s,_=e/1e3*u;r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},i.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),o=this.geometry.getAttributeData("aSeed"),s=this.time,u=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var h=0;h<t;h+=4){var l=iW((s-r[4*h+2])/r[4*h+3],0,1),c=8*h,f=this.cachedRotationVector3.set(n[c],n[c+1],n[c+2]),d=o[8*h+3];this.rotationOverLifetime?(this.rotationOverLifetime.x&&(a(this.rotationOverLifetime.x,ol)?f.x+=this.rotationOverLifetime.x.getValue(l,d):f.x+=this.rotationOverLifetime.x.getValue(l)),this.rotationOverLifetime.y&&(a(this.rotationOverLifetime.y,ol)?f.y+=this.rotationOverLifetime.y.getValue(l,d):f.y+=this.rotationOverLifetime.y.getValue(l)),this.rotationOverLifetime.z&&(a(this.rotationOverLifetime.z,ol)?f.z+=this.rotationOverLifetime.z.getValue(l,d):f.z+=this.rotationOverLifetime.z.getValue(l))):u.setZero(),0===f.dot(f)&&u.identity();var p=Math.PI/180,m=f.x*p,v=f.y*p,y=f.z*p,g=Math.sin(m),x=Math.sin(v),b=Math.sin(y),T=Math.cos(m),E=Math.cos(v),_=Math.cos(y);u.set(_,-b,0,b,_,0,0,0,1),u.multiply(this.tempMatrix3.set(E,0,x,0,1,0,-x,0,E)),u.multiply(this.tempMatrix3.set(1,0,0,0,T,-g,0,g,T));var C=9*h,S=u.elements;i.set(S,C),h+4<=t&&(i.set(S,C+9),i.set(S,C+18),i.set(S,C+27))}this.geometry.setAttributeData("aRotation0",i)},i.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),o=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var s=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=o-r[4*u+2],l=r[4*u+3],c=h/l,f=n[8*u+3];s.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(a(this.linearVelOverLifetime.x,ol)?s.x=this.linearVelOverLifetime.x.getValue(c,f):s.x=this.linearVelOverLifetime.x.getValue(c)),this.linearVelOverLifetime.y&&(a(this.linearVelOverLifetime.y,ol)?s.y=this.linearVelOverLifetime.y.getValue(c,f):s.y=this.linearVelOverLifetime.y.getValue(c)),this.linearVelOverLifetime.z&&(a(this.linearVelOverLifetime.z,ol)?s.z=this.linearVelOverLifetime.z.getValue(c,f):s.z=this.linearVelOverLifetime.z.getValue(c))):(this.linearVelOverLifetime.x&&(a(this.linearVelOverLifetime.x,ol)?s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.y&&(a(this.linearVelOverLifetime.y,ol)?s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.z&&(a(this.linearVelOverLifetime.z,ol)?s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,l)));var d=3*u;i[d]=s.x,i[d+1]=s.y,i[d+2]=s.z,i[d+3]=s.x,i[d+4]=s.y,i[d+5]=s.z,i[d+6]=s.x,i[d+7]=s.y,i[d+8]=s.z,i[d+9]=s.x,i[d+10]=s.y,i[d+11]=s.z}this.geometry.setAttributeData("aLinearMove",i)},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),st=[10,32,64,160];function se(t){for(var e=0;e<st.length;e++){var i=st[e];if(i>t)return i}return t||st[0]}var si=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new o7(e,i)),r&&(n.trailMesh=new o1(e,r));var n,a=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(a.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=a,n}ib(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=n(this.meshes);!(t=e()).done;)t.value.onStart()},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new rb;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t);for(var e,i=n(this.meshes);!(e=i()).done;)e.value.render(t)},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(i){t.push(e[i])}),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach(function(e){t.push(i[e])})}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(rx);t.ParticleSystem=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).destroyed=!1,n.getHitTestParams=function(e){var i=n.interaction;if(e||i)return{type:t.HitTestType.custom,collect:function(t){return n.raycast({radius:(null==i?void 0:i.radius)||.4,multiple:!!(null==i?void 0:i.multiple),removeParticle:(null==i?void 0:i.behavior)===tJ.removeParticle,ray:t})}}},n.maskManager=new ns(i),r&&n.fromData(r),n}ib(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===tq.CONSTANT_VEC3?e.add(r[1]):t=oM(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var a=r.first;r.removeNode(a),i=n[1]=a.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},r.setVisible=function(t){this.renderer.setVisible(t)},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new oq(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1,this.destroyed=!1},r.onStart=function(){this.startEmit(),this.initEmitterTransform()},r.onUpdate=function(t){this.update(t)},r.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,h=!1,l=function(){e.trails&&!h&&(h=!0,o.forEach(function(t){var i=t[0],r=t[1],n=t[2],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,a,n)}))};if(this.ended){if(this.item.endBehavior!==tQ.restart&&tQ.destroy===this.item.endBehavior){var c=o.last;c&&c.content[0]<this.time&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/a.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=p/m,y=r.maxCount;this.updateEmitterTransform(u);for(var g=function(){var t=o.first;return e.emissionStopped||o.length===y&&t&&t.content[0]-n>u},x=0;x<m&&x<y&&!g();x++){var b=this.createPoint(d);b.delay+=i+x*v,this.addParticle(b,y),this.lastEmitTime=u}for(var T=a.bursts,E=(null==T?void 0:T.length)-1,_=0;E>=0&&_<y&&!g();E--){var C=T[E],S=!C.disabled&&C.getGeneratorOptions(u,d);if(S){var A=[0,0,0],w=a.burstOffsets[E],R=w&&w[S.cycleIndex]||A;C.once&&this.removeBurst(E);for(var I=0;I<S.count&&_<y&&!g();I++){var M,O=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:I,burstCount:S.count}));O.delay+=i,_++,(M=O.transform).translate.apply(M,[].concat(R)),this.addParticle(O,y)}}}}else this.item.endBehavior===tQ.restart?(l(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.time-=f,a.bursts.forEach(function(t){return t.reset()}),this.particleLink.forEach(function(t){t[0]-=f,t[2]-=f,t[3].delay-=f}),this.renderer.minusTimeForLoop(f)):(this.ended=!0,this.item.endBehavior===tQ.freeze&&(this.frozen=!0))}l()}},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=[],i=0;i<this.renderer.meshes.length;i++){var r=this.renderer.meshes[i].material;e.push(r.colorMask),r.colorMask=!1}for(var a,o=n(this.renderer.meshes);!(a=o()).done;)a.value.render(t);for(var s=0;s<this.renderer.meshes.length;s++)this.renderer.meshes[s].material.colorMask=e[s]}},r.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach(function(e){return e.dispose({material:{textures:t.DestroyOptions.keep}})})},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var a=t.last,o=!1;!o;){var s=a.content[0],u=a.content[3];if(s>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),a.pre?a=a.pre:o=!0}++n>r&&(o=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new iK,o=!1;if(r&&r.content)do{var s=r.content,u=s[0],h=s[1];s[2];var l=s[3];if(u>this.timePassed){var c=this.getPointPosition(l),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:c,radius:t.radius},a)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),r.content=[0]),n.push(c),t.multiple||(o=!0))}}while((r=r.pre)&&!o);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var a=this.trails,o=this.getPointPosition(i),s=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(l*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&o.subtract(c)}n.addTrailPoint(t,o,{color:s,lifetime:l,size:h,time:r})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,o=this.options.forceTarget,s=this.time-n,u=new iK,h=iK.fromArray(void 0===a?[]:a);e.assignWorldTRS(u);var l=aZ(new iK,this.options,h,s,r,u,i);if(o){var c=o.target||[0,0,0],f=o.curve.getValue(s/r),d=1-f;l.x=l.x*d+c[0]*f,l.y=l.y*d+c[1]*f,l.z=l.z*d+c[2]*f}return l},r.initPoint=function(t){var e,i,r,n,a=this.options,o=this.lifetime,s=this.shape,u=a.startSpeed.getValue(o),h=a.particleFollowParent?r_.IDENTITY:this.transform.getWorldMatrix(),l=t.position,c=new oX({position:h.transformPoint(l,new iK),valid:!0}),f=t.direction;if(f=h.transformNormal(f,sr).normalize(),a.startTurbulence&&a.turbulence){for(var d=0;d<3;d++)su.setElement(d,a.turbulence[d].getValue(o));sh.setFromVector3(su.negate()),sc.setFromEuler(sh).transformNormal(f).normalize()}s.alignSpeedDirection?(ss.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=iK.Z.clone(),h.transformNormal(this.upDirectionWorld)),so.crossVectors(ss,this.upDirectionWorld).normalize(),so.isZero()&&so.set(1,0,0)):(so.set(1,0,0),ss.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=sl)[0]=p.animationDelay.getValue(o),n[1]=p.animationDuration.getValue(o),n[2]=p.cycles.getValue(o)),a.start3DRotation?sa.set(a.startRotationX.getValue(o),a.startRotationY.getValue(o),a.startRotationZ.getValue(o)):a.startRotation?sa.set(0,0,a.startRotation.getValue(o)):sa.set(0,0,0),c.setRotation(sa.x,sa.y,sa.z);var m=a.startColor.getValue(o);if(3===m.length&&(m[3]=1),a.start3DSize)sn.x=a.startSizeX.getValue(o),sn.y=a.startSizeY.getValue(o);else{var v=a.startSize.getValue(o),y=a.sizeAspect.getValue(o);sn.x=v,sn.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!a.particleFollowParent){var x=new iK;this.transform.assignWorldTRS(void 0,void 0,x),sn.x*=x.x,sn.y*=x.y}return c.setScale(sn.x,sn.y,1),{size:sn,vel:g,color:m,delay:a.startDelay.getValue(o),lifetime:a.startLifetime.getValue(o),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:a.gravity,sprite:n,dirY:ss,dirX:so,transform:c}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&a(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return -1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,r,n,o,s,u,h,l,c,f,d,p,m,v=t.options,y=t.positionOverLifetime,g=void 0===y?{}:y,x=t.shape,b=null==g?void 0:g.gravityOverLifetime,T=aq(null==g?void 0:g.gravity),E=t.textureSheetAnimation,_=E?{animationDelay:oM(E.animationDelay||0),animationDuration:oM(E.animationDuration||1),cycles:oM(E.cycles||1),animate:E.animate,col:E.col,row:E.row,total:E.total||E.col*E.row}:void 0,C=!!(x&&x.turbulenceX||(null==x?void 0:x.turbulenceY)||(null==x?void 0:x.turbulenceZ));C&&(n=[oM(null!=(o=x.turbulenceX)?o:0),oM(null!=(s=x.turbulenceY)?s:0),oM(null!=(u=x.turbulenceZ)?u:0)]),this.name="ParticleSystem",this.shape=ac(x),this.emission={rateOverTime:oM(t.emission.rateOverTime),burstOffsets:(i=null!=(h=t.emission.burstOffsets)?h:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=a(t,Array),i=e?t[0]:t.index,n=r[i];n||(n=r[i]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),r),bursts:(t.emission.bursts||[]).map(function(t){return new oY(t)})},this.textureSheetAnimation=_;var S=t.renderer||{},A=t.rotationOverLifetime;A&&((l={}).asRotation=!!A.asRotation,l.z=A.z?oM(A.z):oM(0),A.separateAxes&&(l.x=A.x&&oM(A.x),l.y=A.y&&oM(A.y))),(null==g?void 0:g.forceTarget)&&(c={target:g.target||[0,0,0],curve:oM(g.forceCurve||[tq.LINE,[[0,0],[1,1]]])});var w={x:g.linearX&&oM(g.linearX||0),y:g.linearY&&oM(g.linearY||0),z:g.linearZ&&oM(g.linearZ||0),asMovement:g.asMovement},R={x:g.orbitalX&&oM(g.orbitalX),y:g.orbitalY&&oM(g.orbitalY),z:g.orbitalZ&&oM(g.orbitalZ),center:g.orbCenter,asRotation:g.asRotation},I=t.sizeOverLifetime||{},M=t.colorOverLifetime,O=(null==I?void 0:I.separateAxes)?{separateAxes:!0,x:oM(I.x),y:oM(I.y)}:{separateAxes:!1,x:oM(("size"in I?I.size:I.x)||1)};S.anchor=S.anchor||[0,0];var P=iq.fromArray(S.anchor);this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:oM(v.startLifetime),startDelay:oM(v.startDelay||0),startSpeed:oM(g.startSpeed||0),startColor:oM(v.startColor),looping:!1,maxCount:null!=(f=v.maxCount)?f:0,gravityModifier:oM(b||0),gravity:T,start3DSize:!!v.start3DSize,startTurbulence:C,turbulence:n,speedOverLifetime:g.speedOverLifetime&&oM(g.speedOverLifetime),linearVelOverLifetime:w,orbitalVelOverLifetime:R,forceTarget:c},v.startRotationZ&&(this.options.startRotation=oM(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=oM(v.startRotationX||0),this.options.startRotationY=oM(v.startRotationY||0),this.options.startRotationZ=oM(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=oM(v.startSizeX),this.options.startSizeY=oM(v.startSizeY)):(this.options.startSize=oM(v.startSize),this.options.sizeAspect=oM(v.sizeAspect||1)),t.mask&&this.maskManager.setMaskOptions(t.mask);var N={meshSlots:v.meshSlots,name:this.name,matrix:r_.IDENTITY,shaderCachePrefix:"",renderMode:S.renderMode||tX.BILLBOARD,side:S.side||tD.DOUBLE,gravity:T,blending:S.blending||tV.ALPHA,rotationOverLifetime:l,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:_,occlusion:!!S.occlusion,transparentOcclusion:!!S.transparentOcclusion,maxCount:v.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:c,diffuse:S.texture?this.engine.findObject(S.texture):void 0,sizeOverLifetime:O,anchor:P};if(M){var F=M.color,L=M.opacity;N.colorOverLifetime={},L&&(N.colorOverLifetime.opacity=oM(M.opacity)),F&&(F[0]===tq.GRADIENT_COLOR?N.colorOverLifetime.color=M.color[1]:F[0]===tq.RGBA_COLOR?N.colorOverLifetime.color=r4.createWithData(this.engine,{data:new Uint8Array(F[1]),width:1,height:1}):a(F,r4)&&(N.colorOverLifetime.color=F))}var V=[],D=[0,0,1,1];if(t.splits){var k=t.splits[0];D=(d=k[4])?[k[0],k[1],k[3],k[2]]:[k[0],k[1],k[2],k[3]]}if(_&&!_.animate)for(var z=d?_.row:_.col,U=d?_.col:_.row,B=_.total||z*U,G=0,j=0;j<z;j++)for(var X=0;X<U&&G<B;X++,G++)V.push([j*D[2]/z+D[0],X*D[3]/U+D[1],D[2]/z,D[3]/U]);else V.push(D);this.uvs=V,N.textureFlip=d;var H=t.trails;H&&(this.trails={lifetime:oM(H.lifetime),dieWithParticles:!1!==H.dieWithParticles,sizeAffectsWidth:!!H.sizeAffectsWidth,sizeAffectsLifetime:!!H.sizeAffectsLifetime,inheritParticleColor:!!H.inheritParticleColor,parentAffectsPosition:!!H.parentAffectsPosition},H.mask&&this.maskManager.setMaskOptions(H.mask),p={name:"Trail",matrix:r_.IDENTITY,minimumVertexDistance:H.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(H.maxPointPerTrail)||32,blending:H.blending,texture:H.texture?this.engine.findObject(H.texture):void 0,opacityOverLifetime:oM(H.opacityOverLifetime||1),widthOverTrail:oM(H.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!H.occlusion,transparentOcclusion:!!H.transparentOcclusion,textureMap:H.textureMap,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},H.colorOverLifetime&&H.colorOverLifetime[0]===tq.GRADIENT_COLOR&&(p.colorOverLifetime=H.colorOverLifetime[1]),H.colorOverTrail&&H.colorOverTrail[0]===tq.GRADIENT_COLOR&&(p.colorOverTrail=H.colorOverTrail[1])),this.renderer=new si(this.engine,N,p),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var W=t.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(m=W.radius)?m:.4,behavior:W.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},rv(i,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),i}(ry),t.ParticleSystem=s([iA(es.ParticleSystem)],t.ParticleSystem);var sr=new iK,sn=new iq,sa=new nT,so=new iK,ss=new iK,su=new iK,sh=new nT,sl=[0,0,0],sc=new r_,sf=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clipPlayables=[],e.clipWeights=[],e}ib(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=n(this.clipPlayables);!(e=i()).done;)e.value.processFrame(t);this.evaluate(t)},i.setClipWeight=function(t,e){if(a(t,ok)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t){this.clipWeights[i]=e;return}}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(ok),sd=function(e){function i(){return e.apply(this,arguments)}return ib(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(a(i,t.VFXItem)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},i}(sf),sp=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(ok),sm=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return ib(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(e){var i=!1;if(this.propertyValue=e[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var o=this.getClipPlayable(r);if(!a(o,sp)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var s=o.value;this.addWeightedValue(s,n),i=!0}}i&&(e[this.propertyName]=this.propertyValue)}}},e}(sf),sv=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(sm),sy=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(sm),sg=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.evaluate=function(t){},e}(sf),sx=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.evaluate=function(t){},e}(sf),sb=function(e){function i(){return e.apply(this,arguments)}return ib(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();a(i,t.CompositionComponent)&&(i.time=this.getTime())},i}(ok),sT=function(e){function i(){return e.apply(this,arguments)}return ib(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(a(i,t.CompositionComponent)){for(var r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},i}(sf),sE=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.evaluate=function(t){},e}(sf),s_=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(sm),sC=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(sm),sS=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===tQ.restart?e%=i:this.endBehavior===tQ.freeze&&(e=Math.min(i,e))),e},t}();t.TrackAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}ib(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new sf(t)},i.createOutput=function(){return new oz},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],a=n(this.clips);!(i=a()).done;){var o=i.value;r.push(o)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,a=this.createTrackMixer(t),o=n(e);!(r=o()).done;){var s=r.value,u=this.createClipPlayable(t,s);u.setDuration(s.duration);var h=new sA(s,u,a,this);i.push(h),a.clipPlayables.push(u),a.setClipWeight(u,0)}return a},i.createPlayable=function(t){return new ok(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new sS;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=n(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=n(this.children);!(i=r()).done;)i.value.parent=this},e}(oU),s([iR(sS,void 0)],t.TrackAsset.prototype,"clips",void 0),s([iR(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=s([iA(es.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tA=t.TrackType||(t.TrackType={}))[tA.MasterTrack=0]="MasterTrack",tA[tA.ObjectTrack=1]="ObjectTrack";var sA=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,a(this.track.boundObject,t.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,o=!1,s=this.track.boundObject;e>=i.start+i.duration&&i.endBehavior===tQ.destroy?a(s,t.VFXItem)&&t.VFXItem.isParticle(s)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,o=!0):e<i.start&&(r=0),o&&this.playable.getPlayState()!==eE.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var u=i.toLocalTime(e);this.playable.setTime(u),n&&this.playable.getPlayState()===eE.Playing&&this.playable.pause()},rv(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),e}();t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sd(t)},e}(t.TrackAsset),t.ActivationTrack=s([iA(es.ActivationTrack)],t.ActivationTrack);var sw=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}ib(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(t.TrackAsset);s([iR(void 0,void 0)],sw.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new sy(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},e}(sw),t.FloatPropertyTrack=s([iA(es.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sx(t)},e}(t.TrackAsset),t.SpriteColorTrack=s([iA(es.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}ib(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!a(this.parent.boundObject,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(t.CompositionComponent)},r.createTrackMixer=function(t){return new sT(t)},i}(t.TrackAsset),t.SubCompositionTrack=s([iA(es.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sE(t)},e}(t.TrackAsset),t.TransformTrack=s([iA(es.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.updateAnimatedObject=function(){a(this.parent.boundObject,rx)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(t.TrackAsset),s([iR(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=s([iA("MaterialTrack")],t.MaterialTrack);var sR=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sg(t)},e}(t.TrackAsset);t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){var e=new s_(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(sw),t.Vector4PropertyTrack=s([iA(es.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){var e=new sC(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(sw),t.Vector2PropertyTrack=s([iA("Vector2PropertyTrack")],t.Vector2PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){var e=new sv(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(sw),t.ColorPropertyTrack=s([iA(es.ColorPropertyTrack)],t.ColorPropertyTrack),t.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){var e=new sp(t);return e.curve=oM(this.curveData),e.value=e.curve.getValue(0),e},e}(oU),s([iR(void 0,void 0)],t.ColorPropertyPlayableAsset.prototype,"curveData",void 0),t.ColorPropertyPlayableAsset=s([iA(es.ColorPropertyPlayableAsset)],t.ColorPropertyPlayableAsset),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){var e=new sp(t);return e.curve=oM(this.curveData),e.value=e.curve.getValue(0),e},e}(oU),s([iR(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=s([iA(es.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){return new sb(t)},e}(oU),t.SubCompositionPlayableAsset=s([iA(es.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset),t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}ib(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){},r.create=function(e){if(a(this.boundObject,t.VFXItem)){for(var i,r=this.boundObject,o=!1,s=n(this.getChildTracks());!(i=s()).done;)if(a(i.value,t.ActivationTrack)){o=!0;break}if(o){if(r.getComponent(t.ParticleSystem)){var u=e.createTrack(sR,this,"ParticleTrack");u.boundObject=this.boundObject;var h=u.createClip(o8);h.start=r.start,h.duration=r.duration,h.endBehavior=r.endBehavior}if(r.getComponent(t.SpriteComponent)){var l=e.createTrack(sG,this,"ComponentTimeTrack");l.boundObject=this.boundObject.getComponent(t.SpriteComponent);var c=l.createClip(sj);c.start=r.start,c.duration=r.duration,c.endBehavior=r.endBehavior}if(r.getComponent(t.EffectComponent)){var f=e.createTrack(sG,this,"ComponentTimeTrack");f.boundObject=this.boundObject.getComponent(t.EffectComponent);var d=f.createClip(sj);d.start=r.start,d.duration=r.duration,d.endBehavior=r.endBehavior}}}},i}(t.TrackAsset),t.ObjectBindingTrack=s([iA(es.ObjectBindingTrack)],t.ObjectBindingTrack);var sI=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i}return t.prototype.addChild=function(t){this.children.push(t)},t}();t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t.cacheFlattenedTracks=null,t}ib(i,e);var r=i.prototype;return r.createPlayable=function(e){for(var i,r=new sM(e),o=n(this.tracks);!(i=o()).done;){var s=i.value;a(s,t.ObjectBindingTrack)&&s.create(this)}return this.sortTracks(this.tracks),r.compileTracks(e,this.flattenedTracks),r},r.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},r.invalidate=function(){this.cacheFlattenedTracks=null},r.addSubTracksRecursive=function(t,e){for(var i,r=n(t.getChildTracks());!(i=r()).done;){var a=i.value;e.push(a)}for(var o,s=n(t.getChildTracks());!(o=s()).done;){var u=o.value;this.addSubTracksRecursive(u,e)}},r.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new sO(t[i],i));e.sort(sP),t.length=0;for(var r,a=n(e);!(r=a()).done;){var o=r.value;t.push(o.track)}},r.fromData=function(t){},rv(i,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=n(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),i}(oU),s([iR(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=s([iA(es.TimelineAsset)],t.TimelineAsset);var sM=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.masterTrackInstances=[],e}ib(e,t);var i=e.prototype;return i.prepareFrame=function(t){},i.evaluate=function(){for(var t,e=this.getTime(),i=n(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){for(var i,r={},a=n(e);!(i=a()).done;){var o=i.value,s=o.createPlayableGraph(t,this.clips),u=o.createOutput();u.setUserData(o.boundObject),t.addOutput(u),u.setSourcePlayable(s);var h=new sI(o,s,u);r[o.getInstanceId()]=h,o.parent||this.masterTrackInstances.push(h)}for(var l,c=n(e);!(l=c()).done;)for(var f,d=l.value,p=r[d.getInstanceId()],m=n(d.getChildTracks());!(f=m()).done;){var v=r[f.value.getInstanceId()];p.addChild(v)}},e}(ok),sO=function(t,e){this.track=t,this.originalIndex=e};function sP(e,i){var r=e.track.boundObject,n=i.track.boundObject;return a(r,t.VFXItem)&&a(n,t.VFXItem)?t.VFXItem.isAncestor(r,n)?-1:t.VFXItem.isAncestor(n,r)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}t.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){var e=new sp(t);return e.curve=oM(this.curveData),e.value=e.curve.getValue(0),e},e}(oU),s([iR(void 0,void 0)],t.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector4PropertyPlayableAsset=s([iA(es.Vector4PropertyPlayableAsset)],t.Vector4PropertyPlayableAsset),t.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){var e=new sp(t);return e.curve=oM(this.curveData),e.value=e.curve.getValue(0),e},e}(oU),s([iR(void 0,void 0)],t.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector2PropertyPlayableAsset=s([iA(es.Vector2PropertyPlayableAsset)],t.Vector2PropertyPlayableAsset),t.CompositionComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.items=[],t.state=eE.Playing,t.reusable=!1,t.sceneBindings=[],t.graph=new oD,t}ib(i,e);var r=i.prototype;return r.onStart=function(){var e;this.timelineAsset||(this.timelineAsset=new t.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tQ.destroy&&this.setReusable(!0),null==(e=this.item.composition)||e.refContent.push(this.item)},r.setReusable=function(e){for(var r,o=n(this.timelineAsset.tracks);!(r=o()).done;){var s=r.value.boundObject;if(a(s,t.VFXItem)){var u=s.getComponent(i);u&&u.setReusable(e)}}},r.getReusable=function(){return this.reusable},r.pause=function(){this.state=eE.Paused},r.resume=function(){this.state=eE.Playing},r.onUpdate=function(t){if(this.state!==eE.Paused){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.timelinePlayable.evaluate(),this.graph.evaluate(t)}},r.onEnable=function(){for(var t,e=n(this.items);!(t=e()).done;)t.value.setActive(!0)},r.onDisable=function(){for(var t,e=n(this.items);!(t=e()).done;)t.value.setActive(!1)},r.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},r.hitTest=function(e,i,r,n,a,s){for(var u,h=[],l=(null==s?void 0:s.stop)||e9,c=(null==s?void 0:s.skip)||e9,f=(null==s?void 0:s.maxCount)||this.items.length,d=0;d<this.items.length&&n.length<f;d++){var p=(u=this,function(o){var s=u.items[o];if(s.isActive&&s.transform.getValid()&&!t.VFXItem.isComposition(s)&&!c(s)){var f=s.getHitTestParams(a);if(f){var d=!1,p=new iK;if(f.type===t.HitTestType.triangle)for(var m=f.triangles,v=f.backfaceCulling,y=0;y<m.length;y++){var g=m[y];if(e.intersectTriangle(g,p,v)){d=!0,h.push(p);break}}else if(f.type===t.HitTestType.box){var x=f.center,b=f.size,T=x.clone().addScaledVector(b,.5),E=x.clone().addScaledVector(b,-.5);e.intersectBox({min:T,max:E},p)&&(d=!0,h.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,C=f.radius;e.intersectSphere({center:_,radius:C},p)&&(d=!0,h.push(p))}else if(f.type===t.HitTestType.custom){var S=f.collect(e,new iq(i,r));S&&S.length>0&&(S.forEach(function(t){h.push(t)}),d=!0)}if(d){var A={compContent:u.item,id:s.id,name:s.name,position:h[h.length-1],parentId:s.parentId,hitPositions:h,behavior:f.behavior};if(s.emit("click",A),n.push(A),l(A))return{v:n}}}}}(d));if("object"===o(p))return p.v}return n},r.setChildrenRenderOrder=function(t){for(var e,r=n(this.items);!(e=r()).done;){var a=e.value;a.renderOrder=t++;var o=a.getComponent(i);o&&(t=o.setChildrenRenderOrder(t))}return t},r.fromData=function(t){e.prototype.fromData.call(this,t)},r.resolveBindings=function(){for(var t,e=n(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,a=n(this.timelineAsset.tracks);!(r=a()).done;){var o=r.value;this.updateTrackAnimatedObject(o)}},r.updateTrackAnimatedObject=function(t){for(var e,i=n(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},i}(ry),s([iR(void 0,void 0)],t.CompositionComponent.prototype,"items",void 0),s([iR(void 0,void 0)],t.CompositionComponent.prototype,"sceneBindings",void 0),s([iR(void 0,void 0)],t.CompositionComponent.prototype,"timelineAsset",void 0),t.CompositionComponent=s([iA("CompositionComponent")],t.CompositionComponent);var sN=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter(function(t){return t.listener!==i}))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i,r=arguments.length,n=Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,a=i.options;r.apply(void 0,[].concat(n)),(null==a?void 0:a.once)&&e.off(t,r)})},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map(function(t){return t.listener}))||[]}},sF=function(){function t(){this.update=new sV,this.lateUpdate=new sD}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==ry.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==ry.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==ry.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==ry.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),sL=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),sV=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=n(t);!(i=r()).done;)i.value.onUpdate(e)},e}(sL),sD=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=n(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(sL),sk=function(e){function r(i,o){(x=e.call(this)||this).sceneTicking=new sF,x.speed=1,x.isEnded=!1,x.loaderData={},x.refContent=[],x.startTime=0,x.postProcessingEnabled=!1,x.destroyed=!1,x.postLoaders=[],x.paused=!1,x.isEndCalled=!1,x._textures=[],x.videos=[];var s,u,h,l=i.reusable,c=void 0!==l&&l,f=i.speed,d=i.baseRenderOrder,p=i.renderer,m=i.event,v=i.width,y=i.height,g=i.handleItemMessage;x.renderer=p,x._textures=o.textures;for(var x,b,T,E=n(Object.keys(o.assets));!(T=E()).done;){var _=T.value,C=o.assets[_];a(C,HTMLVideoElement)&&x.videos.push(C)}x.postProcessingEnabled=null!=(S=null==(b=o.jsonScene.renderSettings)?void 0:b.postProcessingEnabled)&&S,x.getEngine().renderLevel=o.renderLevel,c&&(x.keepResource=!0,o.consumed=!0);for(var S,A,w=o.jsonScene.compositions[0],R=n(o.jsonScene.compositions);!(A=R()).done;){var I=A.value;I.id===o.jsonScene.compositionId&&(w=I)}e4(w),x.rootItem=new t.VFXItem(x.getEngine()),x.rootItem.name="rootItem",x.rootItem.duration=w.duration,x.rootItem.endBehavior=w.endBehavior,x.rootItem.composition=oB(x);for(var M,O=w.components,P=n(O);!(M=P()).done;){var N=M.value,F=x.getEngine().findObject(N);x.rootItem.components.push(F),F.item=x.rootItem}return x.rootComposition=x.rootItem.getComponent(t.CompositionComponent),x.width=v,x.height=y,x.renderOrder=void 0===d?0:d,x.id=w.id,x.startTime=null!=(s=w.startTime)?s:0,x.renderer=p,x.event=m,x.statistic={loadStart:null!=(u=o.startTime)?u:0,loadTime:null!=(h=o.totalTime)?h:0,compileTime:0,firstFrameTime:0},x.reusable=c,x.speed=void 0===f?1:f,x.name=w.name,x.pluginSystem=o.pluginSystem,x.pluginSystem.initializeComposition(oB(x),o),x.camera=new oW(x.name,iB({},null==w?void 0:w.camera,{aspect:v/y})),x.url=o.url,x.interactive=!0,x.handleItemMessage=g,x.createRenderFrame(),x.rendererOptions=null,r.buildItemTree(x.rootItem),x.rootComposition.setChildrenRenderOrder(0),x.pluginSystem.resetComposition(oB(x),x.renderFrame),x}ib(r,e);var o=r.prototype;return o.getDuration=function(){return this.rootItem.duration},o.restart=function(){this.reset(),this.forwardTime(this.startTime)},o.setIndex=function(t){this.renderOrder=t},o.getIndex=function(){return this.renderOrder},o.setSpeed=function(t){this.speed=t},o.setVisible=function(t){this.rootItem.setVisible(t)},o.getSpeed=function(){return this.speed},o.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},o.pause=function(){this.paused=!0,this.emit("pause")},o.getPaused=function(){return this.paused},o.resume=function(){this.paused=!1},o.gotoAndPlay=function(t){this.setTime(t),this.resume(),this.emit("play",{time:t})},o.gotoAndStop=function(t){this.setTime(t),this.pause()},o.createRenderFrame=function(){this.renderFrame=new nQ({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},o.setTime=function(t){var e=this.speed,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0),this.emit("goto",{time:t})},o.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},o.getComponent=function(t){return this.rootItem.getComponent(t)},o.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},o.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},o.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach(function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},o.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=(this.time-e)*1e3;this.updatePluginLoaders(i),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},o.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===tQ.destroy&&!this.reusable},o.callAwake=function(t){for(var e,i=n(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var a,o=n(t.children);!(a=o()).done;){var s=a.value;this.callAwake(s)}},o.updateCamera=function(){this.camera.updateMatrix()},o.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},o.updateCompositionTime=function(t){if(this.rootComposition.state!==eE.Paused&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e-i>.001)switch(n=!0,r){case tQ.restart:e%=i,this.restart();break;case tQ.freeze:e=Math.min(i,e);case tQ.forward:case tQ.destroy:}this.rootComposition.time=e+this.startTime,this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},o.getItemByName=function(t){return this.rootItem.find(t)},o.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return a0((t-i.z)/r,(e-i.w)/n,this.camera)},o.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},o.hitTest=function(e,i,r,n){if(this.isDestroyed||!this.interactive)return[];var a=[],o=this.getHitTestRay(e,i);return this.refContent.forEach(function(s){var u;null==(u=s.getComponent(t.CompositionComponent))||u.hitTest(o,e,i,a,r,n)}),a},o.addInteractiveItem=function(t,e){if(e===tB.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},o.removeInteractiveItem=function(t,e){e===tB.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},o.destroyItem=function(e){var i=this;e.type==tj.composition?e.endBehavior!==tQ.freeze&&e.getComponent(t.CompositionComponent).items.forEach(function(t){return i.pluginSystem.plugins.forEach(function(e){return e.onCompositionItemRemoved(i,t)})}):(ek(this.items,e),this.pluginSystem.plugins.forEach(function(t){return t.onCompositionItemRemoved(i,e)}))},o.lost=function(t){this.videoState=this.textures.map(function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime}),this.textures.map(function(t){return t.dispose()}),this.dispose()},o.dispose=function(){var e=this;if(!this.destroyed){this.destroyed=!0;var i={},r=this.textures;r&&this.keepResource&&r.forEach(function(t){(null==t?void 0:t.dispose)&&(i[t.id]=t.dispose,t.dispose=e9)});for(var a,o,s,u=n(this.videos);!(s=u()).done;){var h=s.value;h.pause(),h.removeAttribute("src"),h.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),null==(a=this.rendererOptions)||a.emptyTexture.dispose(),null==(o=this.pluginSystem)||o.destroyComposition(this),this.update=function(){e8.error("Update disposed composition: "+e.name+".")},this.dispose=e9,r&&this.keepResource&&r.forEach(function(t){t.dispose=i[t.id],t.dispose()}),this.renderer.env!==aI&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},o.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},o.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},o.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},o.translate=function(t,e,i){this.rootItem.translate(t,e,i)},o.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},o.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},o.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},o.scale=function(t,e,i){this.rootItem.scale(t,e,i)},o.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},o.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},o.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},o.reloadTexture=function(){var t=this;return i(function(){return u(this,function(e){switch(e.label){case 0:if(!t.textureOffloaded)return[3,2];return[4,Promise.all(t.textures.map(function(t){return null==t?void 0:t.reloadData()}))];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}})})()},r.buildItemTree=function(e){for(var i,r=new Map,a=e.getComponent(t.CompositionComponent).items,o=n(a);!(i=o()).done;){var s=i.value;r.set(s.id,s)}for(var u,h=n(a);!(u=h()).done;){var l=u.value;if(void 0===l.parentId)l.setParent(e);else{var c=r.get(l.parentId);if(c)l.setParent(c);else throw Error("The element references a non-existent element, please check the data.")}}},rv(r,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),r}(sN);t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new oX,r.time=-1,r.duration=0,r.start=0,r.endBehavior=tQ.forward,r.type=tj.base,r.components=[],r.isDuringPlay=!1,r.active=!0,r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new sN,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}ib(i,e);var r=i.prototype;return r.on=function(t,e,i){this.eventProcessor.on(t,e,i)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.emit=function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=this.eventProcessor).emit.apply(e,[].concat([t],r))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.setSpeed=function(t){this.speed=t},r.getSpeed=function(){return this.speed},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,i,r=n(this.components);!(i=r()).done;){var o=i.value;if(a(o,t)){e=o;break}}return e},r.getComponents=function(t){for(var e,i=[],r=n(this.components);!(e=r()).done;){var o=e.value;a(o,t)&&i.push(o)}return i},r.setParent=function(t){(t!==this||t)&&(this.parent&&ek(this.parent.children,this),this.parent=t,this.transform.parentTransform=t.transform,t.children.push(this),!this.composition&&t.composition&&(this.composition=t.composition),!this.isDuringPlay&&t.isDuringPlay&&this.beginPlay())},r.setColor=function(t,e,i,r){},r.setOpacity=function(t){},r.setActive=function(t){!!t!==this.active&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,i=n(this.components);!(e=i()).done;)e.value.enabled=t;this.visible=t},r.getVisible=function(){return this.visible},r.getWorldTransform=function(t){var e=null!=t?t:new oX({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,i){this.transform.translate(t,e,i)},r.rotate=function(t,e,i){var r=new nT(t,e,i),n=iQ.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},r.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,a=r.y,o=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/o-1)*n,(1-2*e/s)*a,i)}},r.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},r.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},r.setScale=function(t,e,i){this.transform.setScale(t,e,i)},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.getCurrentPosition=function(){var t=new iK;return this.transform.assignWorldTRS(t),t},r.find=function(t){if(this.name===t)return this;var e=[];e.push.apply(e,[].concat(this.children));for(var i=0;i<e.length;){var r=e[i];if(i++,r.name===t)return r;e.push.apply(e,[].concat(r.children))}},r.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.resetGUID();var e=this.engine.findObject({id:this.defination.id});return e.resetGUID(),this.resetGUID(t),this.composition&&e.setParent(this.composition.rootItem),e},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=n(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},r.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},r.onEnable=function(){this.isEnabled=!0;for(var t,e=n(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,a=n(this.components);!(r=a()).done;){var o=r.value;o.enabled&&!o.isEnableCalled&&o.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=n(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},r.fromData=function(r){e.prototype.fromData.call(this,r);var o=r.id,s=r.name,u=r.delay,h=r.parentId,l=r.endBehavior,c=r.transform,f=r.duration,d=void 0===f?0:f;if(this.props=r,this.type=r.type,this.id=o.toString(),this.name=s,this.start=u||this.start,c&&this.transform.fromData(c),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=h,this.duration=d,this.endBehavior=l,r.content||(r.content={options:{}}),d<0)throw Error("Item duration can't be less than 0, see "+aM["Item duration can't be less than 0"]+".");if(r.components){this.components.length=0;for(var p,m=n(r.components);!(p=m()).done;){var v=p.value,y=this.engine.findObject(v);this.components.push(y),a(y,t.ParticleSystem)&&!this.components.includes(y.renderer)&&this.components.push(y.renderer)}}i.isComposition(this)&&this.instantiatePreComposition()},r.toData=function(){if(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=es.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.defination.parentId=null==(i=this.parent)?void 0:i.guid),!this.defination.components){this.defination.components=[];for(var e,i,r,o=n(this.components);!(r=o()).done;){var s=r.value;a(s,t.EffectComponent)&&this.defination.components.push(s)}}this.defination.content={}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(a),s=o.x,u=o.y;this.transform.translate(2*t*s/r,-2*e*u/n,0)}},r.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=n(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this._composition=null,this.transform.setValid(!1)}},r.resetChildrenParent=function(){for(var t,e,i=n(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&ek(null==(t=this.parent)?void 0:t.children,this)},r.instantiatePreComposition=function(){var e=this.props.content.options.refId,i=this.engine.findEffectsObjectData(e);if(!i)throw Error("Referenced precomposition with Id: "+e+" does not exist.");for(var r,o=i.components,s=n(o);!(r=s()).done;){var u=r.value,h=this.engine.findObject(u);if(h.item=this,this.components.push(h),h.setInstanceId(iu()),a(h,t.CompositionComponent))for(var l,c=n(h.items);!(l=c()).done;){var f=l.value;f.setInstanceId(iu());for(var d,p=n(f.components);!(d=p()).done;)d.value.setInstanceId(iu())}}sk.buildItemTree(this)},r.resetGUID=function(t){var e=null!=(i=null==t?void 0:t.get(this))?i:iu();this.setInstanceId(e);for(var i,r,a=n(this.components);!(r=a()).done;){var o,s=r.value,u=null!=(o=null==t?void 0:t.get(s))?o:iu();s.setInstanceId(u)}for(var h,l=n(this.children);!(h=l()).done;)h.value.resetGUID(t)},r.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=n(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var a,o=n(this.children);!(a=o()).done;)a.value.gatherPreviousObjectID(t)},i.isComposition=function(t){return t.type===tj.composition},i.isSprite=function(t){return t.type===tj.sprite},i.isParticle=function(t){return t.type===tj.particle},i.isNull=function(t){return t.type===tj.null},i.isTree=function(t){return t.type===tj.tree},i.isCamera=function(t){return t.type===tj.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},rv(i,[{key:"content",get:function(){return this._content}},{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=n(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=n(this.components);!(e=i()).done;){var r=e.value;a(r,rx)&&(r.priority=t)}}}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),i}(iI),t.VFXItem=s([iA(es.VFXItemData)],t.VFXItem),t.Item=void 0,(tw=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tw.isComposition=function(t){return t.type===tj.composition},tw.isParticle=function(t){return t.type===tj.particle},tw.isNull=function(t){return t.type===tj.null};var sz=[1,1,1,1],sU=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}ib(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n,o=e.output.getUserData();if(a(o,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(o)),!this.activeMaterial){this.activeMaterial=null==(s=this.activeComponent)?void 0:s.material;var s,u,h=null==(u=this.activeMaterial)?void 0:u.getColor("_Color");h&&(this.startColor=h.toArray())}var l=aK(sz,1),c=this.time/o.duration,f=this.opacityOverLifetime,d=this.colorOverLifetime;d&&(l=eB(d,c,!0),i=!0),f&&(l[3]*=f.getValue(c),i=!0),i&&(aQ(this.renderColor,l,this.startColor),null==(n=this.activeMaterial)||null==(r=n.getColor("_Color"))||r.setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=oM(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tq.GRADIENT_COLOR&&(this.colorOverLifetime=eG(i.color[1]))),this},r.getActiveComponent=function(t){return t.getComponent(aL)},i}(ok),sB=0;t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new sU(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(oU),t.SpriteColorPlayableAsset=s([iA(es.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset);var sG=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createTrackMixer=function(t){return new sf(t)},e}(t.TrackAsset),sj=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){return new sX(t)},e}(oU),sX=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(ok);function sH(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0}t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).time=0,r.duration=0,r.frameAnimationLoop=!0,r.name="MSprite"+sB++,i&&r.fromData(i),r}ib(i,e);var r=i.prototype;return r.onUpdate=function(t){var e=this,i=this.time,r=this.duration;i>r&&this.frameAnimationLoop&&(i%=r);var n=Math.min(Math.max(i/r,0),1),a=this.textureSheetAnimation,o=this.renderer.texture.source.video;if(o&&(0===i?o.pause():o.play().catch(function(t){e.engine.renderErrors.add(t)}),this.renderer.texture.uploadCurrentVideoFrame()),a){var s,u,h,l,c,f=a.total||a.row*a.col,d=0,p=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],d=y[0],p=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/a.row*m,l=1/a.col*v):(h=1/a.col*m,l=1/a.row*v),a.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/a.col),b=g-x*a.col;c=u?[h*x,l*(a.col-b)]:[h*b,l*(1+x)]}else c=[0,l];null==(s=this.material.getVector4("_TexOffset"))||s.setFromArray([d+c[0],v+p-c[1],h,l])}this.time=i+t/1e3},r.onDisable=function(){e.prototype.onDisable.call(this),this.time=0},r.onDestroy=function(){var e=this.renderer.texture.source;e.sourceType===t.TextureSourceType.video&&(null==e?void 0:e.video)&&(e.video.pause(),e.video.src="",e.video.load())},r.fromData=function(t){e.prototype.fromData.call(this,t);var i,r=t.interaction,n=t.options;this.interaction=r;var a=n.startColor||[1,1,1,1];this.material.setColor("_Color",new rE().setFromArray(a)),this.duration=null!=(i=t.duration)?i:this.item.duration},i}(aL),t.SpriteComponent=s([iA(es.SpriteComponent)],t.SpriteComponent),t.maxSpriteMeshItemCount=8;var sW=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig),sY=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig),sZ=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,i){return this.findCurveValue(t,e)?this.curveValues[t+e].value=i:this.curveValues[t+e]={componentType:t,propertyName:e,value:i},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},t}(),sq=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new sZ(oB(i)),i}return ib(e,t),e}(ok),sK=new nT,sQ=new iK(1,1,1),sJ=new iK,s$=function(e){function i(){return e.apply(this,arguments)}ib(i,e);var r=i.prototype;return r.start=function(){var t,e=this.boundObject,i=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new iK(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=oM(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&oM(r.linearX),y:r.linearY&&oM(r.linearY),z:r.linearZ&&oM(r.linearZ),asMovement:r.asMovement,enabled:!!o});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&oM(r.orbitalX),y:r.orbitalY&&oM(r.orbitalY),z:r.orbitalZ&&oM(r.orbitalZ),center:aq(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&oM(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=oM(a.x||1),this.sizeYOverLifetime=oM(a.y||1),this.sizeZOverLifetime=oM(a.z||1)):this.sizeXOverLifetime=oM(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:oM(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=oM(n.x||0),u.y=oM(n.y||0)}this.gravity=iK.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=oM(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?iK.fromArray(r.direction).normalize():new iK,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(e){if(!this.boundObject){var i=e.output.getUserData();a(i,t.VFXItem)&&(this.boundObject=i,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.boundObject,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){sQ.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(sQ.y=this.sizeYOverLifetime.getValue(r),sQ.z=this.sizeZOverLifetime.getValue(r)):sQ.z=sQ.y=sQ.x;var n=this.originalTransform.scale;e.transform.setScale(sQ.x*n.x,sQ.y*n.y,sQ.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},o=a(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;sK.x=s?a(this.rotationOverLifetime.x):0,sK.y=s?a(this.rotationOverLifetime.y):0,sK.z=o;var u=sK.addEulers(this.originalTransform.rotation,sK);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(aZ(sJ,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&sJ.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(sJ.x,sJ.y,sJ.z))},i}(sq);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new s$(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(oU),t.TransformPlayableAsset=s([iA(es.TransformPlayableAsset)],t.TransformPlayableAsset);var s0=function(e){function i(){return e.apply(this,arguments)}return ib(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();a(i,t.VFXItem)&&(i.time=this.time)},i}(ok);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e.prototype.createPlayable=function(t){return new s0(t)},e}(oU),t.ActivationPlayableAsset=s([iA(es.ActivationPlayableAsset)],t.ActivationPlayableAsset),t.AnimationClip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e}ib(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=iW(e,0,this.duration),a=n(this.positionCurves);!(i=a()).done;){var o=i.value,s=o.keyFrames.getValue(r),u=this.findTarget(t,o.path);null==u||u.transform.setPosition(s.x,s.y,s.z)}for(var h,l=n(this.rotationCurves);!(h=l()).done;){var c=h.value,f=c.keyFrames.getValue(r),d=this.findTarget(t,c.path);null==d||d.transform.setQuaternion(f.x,f.y,f.z,f.w)}for(var p,m=n(this.eulerCurves);!(p=m()).done;){var v=p.value,y=v.keyFrames.getValue(r),g=this.findTarget(t,v.path);null==g||g.transform.setRotation(y.x,y.y,y.z)}for(var x,b=n(this.scaleCurves);!(x=b()).done;){var T=x.value,E=T.keyFrames.getValue(r),_=this.findTarget(t,T.path);null==_||_.transform.setScale(E.x,E.y,E.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=n(t.positionCurves);!(i=r()).done;){var a=i.value,o={path:a.path,keyFrames:oM(a.keyFrames)};e=Math.max(e,o.keyFrames.getMaxTime()),this.positionCurves.push(o)}if(t.rotationCurves)for(var s,u=n(t.rotationCurves);!(s=u()).done;){var h=s.value,l={path:h.path,keyFrames:oM(h.keyFrames)};e=Math.max(e,l.keyFrames.getMaxTime()),this.rotationCurves.push(l)}if(t.eulerCurves)for(var c,f=n(t.eulerCurves);!(c=f()).done;){var d=c.value,p={path:d.path,keyFrames:oM(d.keyFrames)};e=Math.max(e,p.keyFrames.getMaxTime()),this.eulerCurves.push(p)}if(t.scaleCurves)for(var m,v=n(t.scaleCurves);!(m=v()).done;){var y=m.value,g={path:y.path,keyFrames:oM(y.keyFrames)};e=Math.max(e,g.keyFrames.getMaxTime()),this.scaleCurves.push(g)}if(t.floatCurves)for(var x,b=n(t.floatCurves);!(x=b()).done;){var T=x.value,E={path:T.path,keyFrames:oM(T.keyFrames),property:T.property,className:T.className};e=Math.max(e,E.keyFrames.getMaxTime()),this.floatCurves.push(E)}if(t.colorCurves)for(var _,C=n(t.colorCurves);!(_=C()).done;){var S=_.value,A={path:S.path,keyFrames:oM(S.keyFrames),property:S.property,className:S.className};e=Math.max(e,A.keyFrames.getMaxTime()),this.colorCurves.push(A)}void 0!==t.duration?this.duration=t.duration:this.duration=e},i.findTarget=function(t,e){for(var i,r=t,a=e.split("."),o=n(a);!(i=o()).done;){for(var s,u=i.value,h=!1,l=n(r.children);!(s=l()).done;){var c=s.value;if(c.name===u){r=c,h=!0;break}}if(!h)return}return r},e}(iI),t.AnimationClip=s([iA(es.AnimationClip)],t.AnimationClip);var s1=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){return this.set(t.x,t.y),this},e.copyTo=function(t){return t.set(this.x,this.y),t},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},rv(t,null,[{key:"shared",get:function(){return s2.x=0,s2.y=0,s2}}]),t}(),s2=new s1;function s3(t,e,i,r,n,a,o,s){o?(u=r,h=-i):(u=-r,h=i);var u,h,l=t-i*n+u,c=e-r*n+h,f=t+i*a+u,d=e+r*a+h;return s.push(l,c),s.push(f,d),2}function s4(t,e,i,r,n,a,o,s){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,a-e);s&&l<c?l+=2*Math.PI:!s&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.sqrt(u*u+h*h),m=(15*Math.abs(d)*Math.sqrt(p)/Math.PI>>0)+1,v=d/m;if(f+=v,s){o.push(t,e),o.push(i,r);for(var y=1,g=f;y<m;y++,g+=v)o.push(t,e),o.push(t+Math.sin(g)*p,e+Math.cos(g)*p);o.push(t,e),o.push(n,a)}else{o.push(i,r),o.push(t,e);for(var x=1,b=f;x<m;x++,b+=v)o.push(t+Math.sin(b)*p,e+Math.cos(b)*p),o.push(t,e);o.push(n,a),o.push(t,e)}return 2*m}function s5(t,e,i,r,n,a,o,s,u){if(0!==t.length){var h=e.alignment;if(.5!==e.alignment){var l=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],a=t[e-1];r<e;r+=2){var o=t[r],s=t[r+1];i+=(o-n)*(s+a),n=o,a=s}return i<0?-1:1}(t);i&&(l*=-1),h=(h-.5)*l+.5}var c=new s1(t[0],t[1]),f=new s1(t[t.length-2],t[t.length-1]),d=1e-4>Math.abs(c.x-f.x)&&1e-4>Math.abs(c.y-f.y);if(r){t=t.slice(),d&&(t.pop(),t.pop(),f.set(t[t.length-2],t[t.length-1]));var p=(c.x+f.x)*.5,m=(f.y+c.y)*.5;t.unshift(p,m),t.push(p,m)}var v=t.length/2,y=t.length,g=n.length/2,x=e.width/2,b=x*x,T=e.miterLimit*e.miterLimit,E=t[0],_=t[1],C=t[2],S=t[3],A=0,w=0,R=-(_-S),I=E-C,M=0,O=0,P=Math.sqrt(R*R+I*I)+1e-6;R/=P,I/=P,R*=x,I*=x;var N=h,F=(1-N)*2,L=2*N;r||(e.cap===ei.Round?y+=s4(E-R*(F-L)*.5,_-I*(F-L)*.5,E-R*F,_-I*F,E+R*L,_+I*L,n,!0)+2:e.cap===ei.Square&&(y+=s3(E,_,R,I,F,L,!0,n))),n.push(E-R*F,_-I*F),n.push(E+R*L,_+I*L);for(var V=1;V<v-1;++V){E=t[(V-1)*2],_=t[(V-1)*2+1],C=t[2*V],S=t[2*V+1],A=t[(V+1)*2],w=t[(V+1)*2+1],P=Math.sqrt((R=-(_-S))*R+(I=E-C)*I)+1e-6,R/=P,I/=P,R*=x,I*=x,P=Math.sqrt((M=-(S-w))*M+(O=C-A)*O)+1e-6,M/=P,O/=P,M*=x,O*=x;var D=C-E,k=_-S,z=C-A,U=w-S,B=D*z+k*U,G=k*z-U*D,j=G<0;if(Math.abs(G)<.001*Math.abs(B)){n.push(C-R*F,S-I*F),n.push(C+R*L,S+I*L),B>=0&&(e.join===er.Round?y+=s4(C,S,C-R*F,S-I*F,C-M*F,S-O*F,n,!1)+4:y+=2,n.push(C-M*L,S-O*L),n.push(C+M*F,S+O*F));continue}var X=(-R+E)*(-I+S)-(-R+C)*(-I+_),H=(-M+A)*(-O+S)-(-M+C)*(-O+w),W=(D*H-z*X)/G,Y=(U*X-k*H)/G,Z=(W-C)*(W-C)+(Y-S)*(Y-S),q=C+(W-C)*F,K=S+(Y-S)*F,Q=C-(W-C)*L,J=S-(Y-S)*L,$=j?F:L;Z<=Math.min(D*D+k*k,z*z+U*U)+$*$*b?e.join===er.Bevel||Z/b>T?(j?(n.push(q,K),n.push(C+R*L,S+I*L),n.push(q,K),n.push(C+M*L,S+O*L)):(n.push(C-R*F,S-I*F),n.push(Q,J),n.push(C-M*F,S-O*F),n.push(Q,J)),y+=2):e.join===er.Round?j?(n.push(q,K),n.push(C+R*L,S+I*L),y+=s4(C,S,C+R*L,S+I*L,C+M*L,S+O*L,n,!0)+4,n.push(q,K),n.push(C+M*L,S+O*L)):(n.push(C-R*F,S-I*F),n.push(Q,J),y+=s4(C,S,C-R*F,S-I*F,C-M*F,S-O*F,n,!1)+4,n.push(C-M*F,S-O*F),n.push(Q,J)):(n.push(q,K),n.push(Q,J)):(n.push(C-R*F,S-I*F),n.push(C+R*L,S+I*L),e.join===er.Round?j?y+=s4(C,S,C+R*L,S+I*L,C+M*L,S+O*L,n,!0)+2:y+=s4(C,S,C-R*F,S-I*F,C-M*F,S-O*F,n,!1)+2:e.join===er.Miter&&Z/b<=T&&(j?(n.push(Q,J),n.push(Q,J)):(n.push(q,K),n.push(q,K)),y+=2),n.push(C-M*F,S-O*F),n.push(C+M*L,S+O*L),y+=2)}E=t[(v-2)*2],_=t[(v-2)*2+1],C=t[(v-1)*2],P=Math.sqrt((R=-(_-(S=t[(v-1)*2+1])))*R+(I=E-C)*I)+1e-6,R/=P,I/=P,R*=x,I*=x,n.push(C-R*F,S-I*F),n.push(C+R*L,S+I*L),r||(e.cap===ei.Round?y+=s4(C-R*(F-L)*.5,S-I*(F-L)*.5,C-R*F,S-I*F,C+R*L,S+I*L,n,!1)+2:e.cap===ei.Square&&(y+=s3(C,S,R,I,F,L,!1,n)));for(var tt=g;tt<y+g-2;++tt)E=n[2*tt],_=n[2*tt+1],C=n[(tt+1)*2],S=n[(tt+1)*2+1],A=n[(tt+2)*2],1e-8>Math.abs(E*(S-(w=n[(tt+2)*2+1]))+C*(w-_)+A*(_-S))||s.push(tt,tt+1,tt+2)}}var s6=function(){},s8="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s9={exports:{}};!function(t){function e(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function r(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function a(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function s(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function u(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function h(t){var e=p(t.b);return v(e,t.c),v(e.b,t.c),y(e,t.a),e}function l(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,x(e.a,t.a)),e.d!==t.d&&(i=!0,b(e.d,t.d)),m(e,t),r||(v(e,t.a),t.a.c=t),i||(y(e,t.d),t.d.a=t))}function c(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,b(t.d,t.b.d)),t.c===t?x(t.a,null):(t.b.d.a=K(t),t.a.c=t.c,m(t,K(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=K(e),e.a.c=e.c,m(e,K(e))),g(t)}function f(t){var e=p(t),i=e.b;return m(e,t.e),e.a=t.b.a,v(i,e.a),e.d=i.d=t.d,e=e.b,m(t.b,K(t.b)),m(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function d(t,e){var i=!1,r=p(t),n=r.b;return e.d!==t.d&&(i=!0,b(e.d,t.d)),m(r,t.e),m(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||y(r,t.d),r}function p(t){var e=new q,i=new q,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function m(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function v(t,e){var i=e.f,r=new J(e,i);i.e=r,e.f=r,i=r.c=t;do i.a=r,i=i.c;while(i!==t)}function y(t,e){var i=e.d,r=new Z(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do i.d=r,i=i.e;while(i!==t)}function g(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function x(t,e){var i=t.c,r=i;do r.a=e,r=r.c;while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function b(t,e){var i=t.a,r=i;do r.d=e,r=r.e;while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function T(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var E,_=4*1e150;function C(t,e){t.f+=e.f,t.b.f+=e.b.f}function S(t,e,a){return(t=t.a,e=e.a,a=a.a,e.b.a===t)?a.b.a===t?i(e.a,a.a)?0>=n(a.b.a,e.a,a.a):0<=n(e.b.a,a.a,e.a):0>=n(a.b.a,t,a.a):a.b.a===t?0<=n(e.b.a,t,e.a):(e=r(e.b.a,t,e.a))>=(t=r(a.b.a,t,a.a))}function A(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function w(t,e){c(t.a),t.c=!1,t.a=e,e.i=t}function R(t){var e=t.a.a;do t=tl(t);while(t.a.a===e);return t.c&&(e=d(th(t).a.b,t.a.e),w(t,e),t=tl(t)),t}function I(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function M(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function O(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,A(t)}function P(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=th(t),n=r.a;if(n.a!==e.a){if(!r.c){O(t);break}w(r,n=d(e.c.b,n.b))}e.c!==n&&(l(K(n),n),l(e,n)),O(t),e=r.a,t=r}return e}function N(t,e,i,r,n,a){var o=!0;do I(t,e,i.b),i=i.c;while(i!==r);for(null===n&&(n=th(e).a.b.c);(i=(r=th(e)).a.b).a===n.a;)i.c!==n&&(l(K(i),i),l(K(n),i)),r.f=e.f-i.f,r.d=M(t,r.f),e.b=!0,!o&&D(t,e)&&(C(i,n),A(e),c(n)),o=!1,e=r,n=i;e.b=!0,a&&z(t,e)}function F(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(Y(t,100156),t.n=!0):e.d=i[0])}function L(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,F(t,e.a,r,[.5,.5,0,0],!1),l(e,i)}function V(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),o=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),s=n+1;r[n]=.5*o/(a+o),r[s]=.5*a/(a+o),t.g[0]+=r[n]*e.g[0]+r[s]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[s]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[s]*i.g[2]}function D(t,r){var a=th(r),o=r.a,s=a.a;if(i(o.a,s.a)){if(0<n(s.b.a,o.a,s.a))return!1;if(e(o.a,s.a)){if(o.a!==s.a){var a=t.e,u=o.a.h;if(0<=u){var a=a.b,h=a.d,c=a.e,d=a.c,p=d[u];h[p]=h[a.a],d[h[p]]=p,p<=--a.a&&(1>=p?to(a,p):i(c[h[p>>1]],c[h[p]])?to(a,p):ts(a,p)),c[u]=null,d[u]=a.b,a.b=u}else for(a.c[-(u+1)]=null;0<a.a&&null===a.c[a.d[a.a-1]];)--a.a;L(t,K(s),o)}}else f(s.b),l(o,K(s)),r.b=a.b=!0}else{if(0>n(o.b.a,s.a,o.a))return!1;tl(r).b=r.b=!0,f(o.b),l(K(s),o)}return!0}function k(t,h){var c=th(h),d=h.a,p=c.a,m=d.a,v=p.a,y=d.b.a,g=p.b.a,x=new J;if(n(y,t.a,m),n(g,t.a,v),m===v||Math.min(m.a,y.a)>Math.max(v.a,g.a))return!1;if(i(m,v)){if(0<n(g,m,v))return!1}else if(0>n(y,v,m))return!1;var b,T,E=y,_=m,C=g,S=v;if(i(E,_)||(b=E,E=_,_=b),i(C,S)||(b=C,C=S,S=b),i(E,C)||(b=E,E=C,C=b,b=_,_=S,S=b),i(C,_)?i(_,S)?(0>(b=r(E,C,_))+(T=r(C,_,S))&&(b=-b,T=-T),x.b=u(b,C.b,T,_.b)):(0>(b=n(E,C,_))+(T=-n(E,S,_))&&(b=-b,T=-T),x.b=u(b,C.b,T,S.b)):x.b=(C.b+_.b)/2,a(E,_)||(b=E,E=_,_=b),a(C,S)||(b=C,C=S,S=b),a(E,C)||(b=E,E=C,C=b,b=_,_=S,S=b),a(C,_)?a(_,S)?(0>(b=o(E,C,_))+(T=o(C,_,S))&&(b=-b,T=-T),x.a=u(b,C.a,T,_.a)):(0>(b=s(E,C,_))+(T=-s(E,S,_))&&(b=-b,T=-T),x.a=u(b,C.a,T,S.a)):x.a=(C.a+_.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=i(m,v)?m:v,i(E,x)&&(x.b=E.b,x.a=E.a),e(x,m)||e(x,v))return D(t,h),!1;if(!e(y,t.a)&&0<=n(y,t.a,x)||!e(g,t.a)&&0>=n(g,t.a,x)){if(g===t.a)return f(d.b),l(p.b,d),d=th(h=R(h)).a,P(t,th(h),c),N(t,h,K(d),d,d,!0),!0;if(y===t.a){f(p.b),l(d.e,K(p)),v=(m=c=h).a.b.a;do m=tl(m);while(m.a.b.a===v);return m=th(h=m).a.b.c,c.a=K(p),p=P(t,c,null),N(t,h,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(tl(h).b=h.b=!0,f(d.b),d.a.b=t.a.b,d.a.a=t.a.a),0>=n(g,t.a,x)&&(h.b=c.b=!0,f(p.b),p.a.b=t.a.b,p.a.a=t.a.a),!1}return f(d.b),f(p.b),l(K(p),d),d.a.b=x.b,d.a.a=x.a,d.a.h=tt(t.e,d.a),d=d.a,p=[0,0,0,0],x=[m.d,y.d,v.d,g.d],d.g[0]=d.g[1]=d.g[2]=0,V(d,m,y,p,0),V(d,v,g,p,2),F(t,d,x,p,!0),tl(h).b=h.b=c.b=!0,!1}function z(t,e){for(var r=th(e);;){for(;r.b;)e=r,r=th(r);if(!e.b&&(r=e,null===(e=tl(e))||!e.b))break;e.b=!1;var a,o=e.a,s=r.a;if(a=o.b.a!==s.b.a)t:{var u=th(a=e),h=a.a,d=u.a,p=void 0;if(i(h.b.a,d.b.a)){if(0>n(h.b.a,d.b.a,h.a)){a=!1;break t}tl(a).b=a.b=!0,p=f(h),l(d.b,p),p.d.c=a.d}else{if(0<n(d.b.a,h.b.a,d.a)){a=!1;break t}a.b=u.b=!0,p=f(d),l(h.e,d.b),p.b.d.c=a.d}a=!0}if(a&&(r.c?(A(r),c(s),s=(r=th(e)).a):e.c&&(A(e),c(o),o=(e=tl(r)).a)),o.a!==s.a){if(o.b.a===s.b.a||e.c||r.c||o.b.a!==t.a&&s.b.a!==t.a)D(t,e);else if(k(t,e))break}o.a===s.a&&o.b.a===s.b.a&&(C(s,o),A(e),c(o),e=tl(r))}}function U(t,e){var i=new tu,r=h(t.b);r.a.b=_,r.a.a=e,r.b.a.b=-_,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=G(r=t.f,r.a,i),i.e=r}function B(t){this.a=new j,this.b=t,this.c=S}function G(t,e,i){do e=e.c;while(null!==e.b&&!t.c(t.b,e.b,i));return t=new j(i,e.a,e),e.a.c=t,e.a=t}function j(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function X(){this.d=H,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var H=0;function W(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case H:Y(t,100151),t.u(null);break;case 1:Y(t,100152),t.t()}else switch(t.d){case 2:Y(t,100154),t.v();break;case 1:Y(t,100153),t.w()}}function Y(t,e){t.p&&t.p(e,t.c)}function Z(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function q(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function K(t){return t.b.e}function Q(){this.c=new J,this.a=new Z,this.b=new q,this.d=new q,this.b.b=this.d,this.d.b=this.b}function J(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function $(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ti}function tt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=tr(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&ts(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function te(t){if(0===t.a)return ta(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&i(tn(t.b),e))return ta(t.b);do--t.a;while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function ti(){this.d=tr([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function tr(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function tn(t){return t.e[t.d[1]]}function ta(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&to(t,1)),a}function to(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[s],n[h])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function ts(t,e){for(var r=t.d,n=t.e,a=t.c,o=e,s=r[o];;){var u=o>>1,h=r[u];if(0===u||i(n[h],n[s])){r[o]=s,a[s]=o;break}r[o]=h,a[h]=o,o=u}}function tu(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function th(t){return t.e.c.b}function tl(t){return t.e.a.b}(E=X.prototype).x=function(){W(this,H)},E.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:this.s=e;return}break;case 100141:this.m=!!e;return;default:Y(this,100900);return}Y(this,100901)},E.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:Y(this,100900)}return!1},E.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},E.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:Y(this,100900)}},E.C=function(t,e){var i=!1,r=[0,0,0];W(this,2);for(var n=0;3>n;++n){var a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}i&&Y(this,100155),null===(i=this.q)?l(i=h(this.b),i.b):(f(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},E.u=function(t){W(this,H),this.d=1,this.b=new Q,this.c=t},E.t=function(){W(this,1),this.d=2,this.q=null},E.v=function(){W(this,2),this.d=1},E.w=function(){W(this,1),this.d=H;var t,r,a=this.j[0],o=this.j[1],s=this.j[2],u=!1,h=[a,o,s];if(0===a&&0===o&&0===s){for(var o=[-2*1e150,-2*1e150,-2*1e150],p=[2*1e150,2*1e150,2*1e150],s=[],v=[],u=this.b.c,a=u.e;a!==u;a=a.e)for(var y=0;3>y;++y){var b=a.g[y];b<p[y]&&(p[y]=b,v[y]=a),b>o[y]&&(o[y]=b,s[y]=a)}if(a=0,o[1]-p[1]>o[0]-p[0]&&(a=1),o[2]-p[2]>o[a]-p[a]&&(a=2),p[a]>=o[a])h[0]=0,h[1]=0,h[2]=1;else{for(o=0,p=v[a],s=s[a],v=[0,0,0],p=[p.g[0]-s.g[0],p.g[1]-s.g[1],p.g[2]-s.g[2]],y=[0,0,0],a=u.e;a!==u;a=a.e)y[0]=a.g[0]-s.g[0],y[1]=a.g[1]-s.g[1],y[2]=a.g[2]-s.g[2],v[0]=p[1]*y[2]-p[2]*y[1],v[1]=p[2]*y[0]-p[0]*y[2],v[2]=p[0]*y[1]-p[1]*y[0],(b=v[0]*v[0]+v[1]*v[1]+v[2]*v[2])>o&&(o=b,h[0]=v[0],h[1]=v[1],h[2]=v[2]);0>=o&&(h[0]=h[1]=h[2]=0,h[T(p)]=1)}u=!0}for(v=T(h),a=this.b.c,o=(v+1)%3,s=(v+2)%3,v=0<h[v]?1:-1,h=a.e;h!==a;h=h.e)h.b=h.g[o],h.a=v*h.g[s];if(u){for(h=0,a=(u=this.b.a).b;a!==u;a=a.b)if(!(0>=(o=a.a).f))do h+=(o.a.b-o.b.a.b)*(o.a.a+o.b.a.a),o=o.e;while(o!==a.a);if(0>h)for(u=(h=this.b.c).e;u!==h;u=u.e)u.a=-u.a}for(this.n=!1,a=(h=this.b.b).h;a!==h;a=u)u=a.h,o=a.e,e(a.a,a.b.a)&&a.e.e!==a&&(L(this,o,a),c(a),o=(a=o).e),o.e===a&&(o!==a&&((o===u||o===u.b)&&(u=u.h),c(o)),(a===u||a===u.b)&&(u=u.h),c(a));for(this.e=h=new $,a=(u=this.b.c).e;a!==u;a=a.e)a.h=tt(h,a);for(function(t){t.d=[];for(var e,r=0;r<t.a;r++)t.d[r]=r;t.d.sort((e=t.c,function(t,r){return i(e[t],e[r])?1:-1})),t.e=!0,function(t){for(var e=t.a;1<=e;--e)to(t,e);t.h=!0}(t.b)}(h),this.f=new B(this),U(this,-_),U(this,_);null!==(h=te(this.e));){for(;;){t:if(0===(a=this.e).a)u=tn(a.b);else if(u=a.c[a.d[a.a-1]],0!==a.b.a&&i(a=tn(a.b),u)){u=a;break t}if(null===u||!e(u,h))break;u=te(this.e),L(this,h.c,u.c)}!function t(r,a){r.a=a;for(var o=a.c;null===o.i;)if((o=o.c)===a.c){var o=r,s=a,u=new tu;u.a=s.c.b;var h=o.f,p=h.a;do p=p.a;while(null!==p.b&&!h.c(h.b,u,p.b));var h=p.b,m=th(h),u=h.a,p=m.a;if(0===n(u.b.a,s,u.a))e((u=h.a).a,s)||e(u.b.a,s)||(f(u.b),h.c&&(c(u.c),h.c=!1),l(s.c,u),t(o,s));else{var v=i(p.b.a,u.b.a)?h:m,m=void 0;h.d||v.c?(m=v===h?d(s.c.b,u.e):d(p.b.c.b,s.c).b,v.c?w(v,m):(u=o,(h=I(o,h,m)).f=tl(h).f+h.a.f,h.d=M(u,h.f)),t(o,s)):N(o,h,s.c,s.c,null,!0)}return}if(h=(u=th(o=R(o.i))).a,(u=P(r,u,null)).c===h){var h=u,u=h.c,p=th(o),m=o.a,v=p.a,y=!1;m.b.a!==v.b.a&&k(r,o),e(m.a,r.a)&&(l(K(u),m),u=th(o=R(o)).a,P(r,th(o),p),y=!0),e(v.a,r.a)&&(l(h,K(v)),h=P(r,p,null),y=!0),y?N(r,o,h.c,u,u,!0):(s=i(v.a,m.a)?K(v):m,N(r,o,s=d(h.c.b,s),s.c,s.c,!1),s.b.i.c=!0,z(r,o))}else N(r,o,u.c,h,h,!0)}(this,h)}for(h=0,this.a=this.f.a.a.b.a.a;null!==(u=this.f.a.a.b);)u.h||++h,A(u);for(this.f=null,(h=this.e).b=null,h.d=null,this.e=h.c=null,a=(h=this.b).a.b;a!==h.a;a=u)u=a.b,(a=a.a).e.e===a&&(C(a.c,a),c(a));if(!this.n){if(h=this.b,this.m)for(a=h.b.h;a!==h.b;a=u)u=a.h,a.b.d.c!==a.d.c?a.f=a.d.c?1:-1:c(a);else for(a=h.a.b;a!==h.a;a=u)if(u=a.b,a.c){for(a=a.a;i(a.b.a,a.a);a=a.c.b);for(;i(a.a,a.b.a);a=a.e);for(o=a.c.b,s=void 0;a.e!==o;)if(i(a.b.a,o.a)){for(;o.e!==a&&(i((t=o.e).b.a,t.a)||0>=n(o.a,o.b.a,o.e.b.a));)o=(s=d(o.e,o)).b;o=o.c.b}else{for(;o.e!==a&&(i((r=a.c.b).a,r.b.a)||0<=n(a.b.a,a.a,a.c.b.a));)a=(s=d(a,a.c.b)).b;a=a.e}for(;o.e.e!==a;)o=(s=d(o.e,o)).b}if(this.h||this.i||this.k||this.l){if(this.m){for(u=(h=this.b).a.b;u!==h.a;u=u.b)if(u.c){this.h&&this.h(2,this.c),a=u.a;do this.k&&this.k(a.a.d,this.c),a=a.e;while(a!==u.a);this.i&&this.i(this.c)}}else{for(h=this.b,u=!!this.l,a=!1,o=-1,s=h.a.d;s!==h.a;s=s.d)if(s.c){a||(this.h&&this.h(4,this.c),a=!0),v=s.a;do u&&o!==(p=v.b.d.c?0:1)&&(o=p,this.l&&this.l(!!o,this.c)),this.k&&this.k(v.a.d,this.c),v=v.e;while(v!==s.a)}a&&this.i&&this.i(this.c)}}if(this.r){for(a=(h=this.b).a.b;a!==h.a;a=u)if(u=a.b,!a.c){s=(o=a.a).e,v=void 0;do s=(v=s).e,v.d=null,null===v.b.d&&(v.c===v?x(v.a,null):(v.a.c=v.c,m(v,K(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,K(p))),g(v));while(v!==o);o=a.d,(a=a.b).d=o,o.b=a}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null},s8.libtess={GluTesselator:X,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},X.prototype.gluDeleteTess=X.prototype.x,X.prototype.gluTessProperty=X.prototype.B,X.prototype.gluGetTessProperty=X.prototype.y,X.prototype.gluTessNormal=X.prototype.A,X.prototype.gluTessCallback=X.prototype.z,X.prototype.gluTessVertex=X.prototype.C,X.prototype.gluTessBeginPolygon=X.prototype.u,X.prototype.gluTessBeginContour=X.prototype.t,X.prototype.gluTessEndContour=X.prototype.v,X.prototype.gluTessEndPolygon=X.prototype.w,t.exports=s8.libtess}(s9);var s7=((tR=new s9.exports.GluTesselator).gluTessCallback(s9.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),tR.gluTessCallback(s9.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==s9.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),tR.gluTessCallback(s9.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),tR.gluTessCallback(s9.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),tR.gluTessCallback(s9.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),tR);function ut(t){s7.gluTessNormal(0,0,1);var e=[];s7.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){s7.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];s7.gluTessVertex(a,a)}s7.gluTessEndContour()}return s7.gluTessEndPolygon(),e}var ue=function(t){function e(){for(var e,i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];(e=t.call(this)||this).points=[],e.closePath=!1;var a=Array.isArray(r[0])?r[0]:r;if("number"!=typeof a[0]){for(var o=[],s=0,u=a.length;s<u;s++)o.push(a[s].x,a[s].y);a=o}return e.points=a,e.closePath=!0,e}ib(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,a=r-1;n<r;a=n++){var o=this.points[2*n],s=this.points[2*n+1],u=this.points[2*a],h=this.points[2*a+1];s>e!=h>e&&t<(e-s)/(h-s)*(u-o)+o&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){var a=ut([t]),o=e.length/2;0===a.length&&this.getLineEndPointsTriangle(t,a);for(var s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw Error("Invalid points array");if(2===t.length){e.push(t[0],t[1],t[0],t[1],t[0],t[1]);return}var i=t[2]-t[0],r=t[3]-t[1],n=t[0],a=t[1],o=t[0],s=t[1];if(Math.abs(i)>=Math.abs(r))for(var u=0;u<t.length;u+=2){var h=t[u],l=t[u+1];h<n&&(n=h,a=l),h>o&&(o=h,s=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<a&&(n=f,a=d),d>s&&(o=f,s=d)}e.push(n,a,o,s,o,s)},rv(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(s6);function ui(t,e,i,r,n,a,o,s,u,h){var l=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function t(e,i,r,n,a,o,s,u,h,l,c){if(!(c>8)){var f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+o)/2,v=(a+s)/2,y=(o+u)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(m+y)/2,E=(g+b)/2,_=(x+T)/2;if(c>0){var C=s-e,S=u-i,A=Math.abs((r-s)*S-(n-u)*C),w=Math.abs((a-s)*S-(o-u)*C);if(A>11920929e-14&&w>11920929e-14){if((A+w)*(A+w)<=l*(C*C+S*S)){h.push(E,_);return}}else if(A>11920929e-14){if(A*A<=l*(C*C+S*S)){h.push(E,_);return}}else if(w>11920929e-14){if(w*w<=l*(C*C+S*S)){h.push(E,_);return}}else if((C=E-(e+s)/2)*C+(S=_-(i+u)/2)*S<=l){h.push(E,_);return}}t(e,i,f,d,g,x,E,_,h,l,c+1),t(E,_,b,T,v,y,s,u,h,l,c+1)}}(e,i,r,n,a,o,s,u,t,l*=l,0),t.push(s,u),t}var ur=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}ib(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return i*=i,r*=r,i+r<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var a=i/2,o=r-a,s=n-a,u=r+a,h=n+a,l=t-this.x,c=e-this.y;return l*l/(o*o)+c*c/(s*s)>1&&l*l/(u*u)+c*c/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var a=Math.ceil(5*Math.sqrt(r+n)),o=8*a+0+0;if(0===o)return t;if(0===a)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var s=0,u=4*a+0+2,h=u,l=o,c=0+r,f=0,d=e+c,p=e-c,m=i+0;t[s++]=d,t[s++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<a;v++){var y=Math.PI/2*(v/a),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,_=i-x;t[s++]=b,t[s++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--l]=_,t[--l]=b}c=0,f=0+n,d=e+c,p=e-c,m=i+f;var C=i-f;return t[s++]=d,t[s++]=m,t[--l]=C,t[--l]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(s6);t.StarType=void 0,(tI=t.StarType||(t.StarType={}))[tI.Star=0]="Star",tI[tI.Polygon=1]="Polygon";var un=function(t){function e(e,i,r,n,a,o){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0),(s=t.call(this)||this).pointCount=e,s.outerRadius=i,s.innerRadius=r,s.outerRoundness=n,s.innerRoundness=a,s.starType=o,s.v=[],s.in=[],s.out=[],s}ib(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)ui(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var i=this.v.length-1;ui(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var a=ut([t]),o=e.length/2,s=0;s<a.length;s++)e[2*i+s]=a[s];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=o+h},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),a=2*Math.PI/n,o=!0,s=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*s/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){e=o?s:u,i=o?h:l,r=o?c:f;var p=e*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,o=!o,d+=1*a}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,a=2*Math.PI*r/(4*e),o=-(.5*Math.PI);for(t=0;t<e;t++){var s=r*Math.cos(o),u=r*Math.sin(o),h=0===s&&0===u?0:u/Math.sqrt(s*s+u*u),l=0===s&&0===u?0:-s/Math.sqrt(s*s+u*u),c=2*t;this.v[c]=s,this.v[c+1]=u,this.in[c]=s+h*a*n*1,this.in[c+1]=u+l*a*n*1,this.out[c]=s-h*a*n*1,this.out[c+1]=u-l*a*n*1,o+=1*i}},e}(s6),ua=function(t){function e(e,i,r,n,a){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=20),(o=t.call(this)||this).x=e,o.y=i,o.width=r,o.height=n,o.roundness=a,o}ib(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t){var e,i=this.width/2,r=this.height/2,n=this.x+i,a=this.y+r,o=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(i,r)),s=i-o,u=r-e;if(o>=0&&e>=0&&s>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(o+e)),l=8*h+(s?4:0)+(u?4:0);if(0!==l){if(0===h){t[0]=t[6]=n+s,t[1]=t[3]=a+u,t[2]=t[4]=n-s,t[5]=t[7]=a-u;return}var c=0,f=4*h+(s?2:0)+2,d=f,p=l,m=s+o,v=u,y=n+m,g=n-m,x=a+v;if(t[c++]=y,t[c++]=x,t[--f]=x,t[--f]=g,u){var b=a-v;t[d++]=g,t[d++]=b,t[--p]=b,t[--p]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),_=s+Math.cos(E)*o,C=u+Math.sin(E)*e,S=n+_,A=n-_,w=a+C,R=a-C;t[c++]=S,t[c++]=w,t[--f]=w,t[--f]=A,t[d++]=A,t[d++]=R,t[--p]=R,t[--p]=S}m=s,v=u+e,y=n+m,g=n-m,x=a+v;var I=a-v;t[c++]=y,t[c++]=x,t[--p]=I,t[--p]=y,s&&(t[c++]=g,t[c++]=x,t[--p]=I,t[--p]=g)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,o=0,s=0;s<t.length;s+=2)a+=t[s],o+=t[s+1];a/=t.length/2,o/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=o;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(s6),uo=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=this.graphicsPath,i=n(e.instructions);!(t=i()).done;){var r=t.value,a=r.action,o=r.data;switch(a){case"bezierCurveTo":this.bezierCurveTo(o[0],o[1],o[2],o[3],o[4],o[5],o[6]);break;case"moveTo":this.moveTo(o[0],o[1]);break;case"ellipse":this.ellipse(o[0],o[1],o[2],o[3],o[4]);break;case"polyStar":this.polyStar(o[0],o[1],o[2],o[3],o[4],o[5],o[6]);break;case"rect":this.rect(o[0],o[1],o[2],o[3],o[4]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,o){this.ensurePoly();var s=this.currentPoly;return ui(s.points,s.lastX,s.lastY,t,e,i,r,n,a,o),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new ur(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,a,o){return this.drawShape(new un(t,e,i,r,n,a),o),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new ua(t,e,i,r,n),a),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new ue).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new ue,this.currentPoly.points.push(0,0))},t}(),us=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,o]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,a){return this.instructions.push({action:"rect",data:[t,e,i,r,n,a]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,a,o){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,a,o]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},rv(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new uo(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function uu(t,e){return e&&("object"===o(e)||"function"==typeof e)?e:oB(t)}var uh=new(function(){function t(){this.elements=[]}var e=t.prototype;return e.dispose=function(){this.elements.forEach(function(t){return t.remove()}),this.elements.length=0},e.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return e4(t),t}if(oJ[oQ])return window._createOffscreenCanvas(10,10);var e=document.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?eD(this.elements,t):t.remove()},t}()),ul=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?t6.clip:r,a=t.textBaseline,o=void 0===a?t8.top:a,s=t.textAlign,u=void 0===s?t9.left:s,h=t.text,l=t.letterSpace,c=void 0===l?0:l,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=(void 0===h?" ":h).length*(d+c),this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.letterSpace=c,this.overflow=n,this.textBaseline=o,this.textAlign=u,this.lineHeight=void 0===p?d:p}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,a=t.fontScale,o=(i-r)/3,s=r+n*a,u=i*(e-1),h=0;switch(this.textBaseline){case t8.top:h=s+o;break;case t8.middle:h=(this.height*a-u+s)/2;break;case t8.bottom:h=this.height*a-u-o}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case t9.left:i=t.outlineWidth*t.fontScale;break;case t9.middle:i=(this.width*t.fontScale-e)/2;break;case t9.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),uc=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,a,o,s=t.textColor,u=t.fontSize,h=t.outline,l=t.shadow,c=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,this.textWeight=void 0===c?"normal":c,this.fontStyle=void 0===f?"normal":f,this.fontFamily=void 0===d?"sans-serif":d,this.fontSize=void 0===u?40:u,h&&(this.isOutlined=!0,this.outlineColor=null!=(e=h.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=h.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),l&&(this.hasShadow=!0,this.shadowBlur=null!=(r=l.shadowBlur)?r:2,this.shadowColor=null!=(n=l.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(a=l.shadowOffsetX)?a:0,this.shadowOffsetY=null!=(o=l.shadowOffsetY)?o:0),this.fontStyle!==et.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},uf=["serif","sans-serif","monospace","courier"],ud=0;t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.maxLineWidth=0,r.SCALE_FACTOR=.1,r.ALPHA_FIX_VALUE=1/255,r.name="MText"+ud++,i&&r.fromData(i),r.canvas=uh.getCanvas(),uh.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return uu(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}ib(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new rE(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(aL),t.TextComponent=s([iA(es.TextComponent)],t.TextComponent);var up=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new uc(t),this.textLayout=new ul(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var i=this.context,r=this.textLayout,n=r.letterSpace,a=r.overflow,o=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,s=this.textLayout.width+this.textStyle.fontOffset,u=1,h=0,l=0;l<t.length;l++){var c,f,d=t[l],p=(null!=(f=null==i?void 0:null==(c=i.measureText(d))?void 0:c.width)?f:0)*o;h+=n,a===t6.display?"\n"===d?(u++,h=0):(h+=p,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+p>s&&l>0||"\n"===d)&&(u++,this.maxLineWidth=Math.max(this.maxLineWidth,h),h=0),"\n"!==d&&(h+=p))}return u},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){if(this.textStyle.fontFamily===t&&!e5(t)){console.warn("The font is either the current font or an risky font family.");return}this.textStyle.fontFamily=t,this.isDirty=!0},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,i=this.textStyle,r=this.textLayout,n=i.fontScale,a=(r.width+i.fontOffset)*n,o=r.lineHeight*this.lineCount,s=i.fontSize*n,u=r.lineHeight*n;i.fontDesc=this.getFontDesc(s),this.char=(this.text||"").split(""),this.canvas.width=a,r.autoWidth?(this.canvas.height=o*n,this.item.transform.size.set(1,o/r.height)):this.canvas.height=r.height*n;var h=this.canvas.height;e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),this.maxLineWidth>a&&r.overflow===t6.display?e.font=this.getFontDesc(s*a/this.maxLineWidth):e.font=i.fontDesc,e.clearRect(0,0,a,h),i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var l=[],c=0,f=r.getOffsetY(i,this.lineCount,u,s),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((c+=r.letterSpace*n)+y.width>a&&m>0||"\n"===v)&&(l.push({y:f,width:c,chars:d,charOffsetX:p}),c=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(c),c+=y.width)}l.push({y:f,width:c,chars:d,charOffsetX:p}),l.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,a){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[a],t.y),e.fillText(r,n+t.charOffsetX[a],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=r4.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:rw.LINEAR,minFilter:rw.LINEAR,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE});this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontScale,n=e.fontFamily,a=e.textWeight,o=e.fontStyle,s=""+(t||i*r).toString()+"px ";return uf.includes(n)?s+=n:s+='"'+n+'"',a!==t7.normal&&(s=a+" "+s),o!==et.normal&&(s=o+" "+s),s},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],a=i[1],o=i[2],s=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*a+", "+255*o+", "+s+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,o=i[0],s=i[1],u=i[2],h=i[3];t&&(t.shadowColor="rgba("+255*o+", "+255*s+", "+255*u+", "+h+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-a)},t}();il(t.TextComponent,[up]);var um=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(ig),uv=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iI);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return ib(e,t),e}(iI),s([iR(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=s([iA(es.BinaryAsset)],t.BinaryAsset);var uy=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=iw(e);if(r)for(var a,o=n(Object.keys(r));!(a=o()).done;){var s=a.value,u=e[s];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(u)?i[s]=u:it(u)?(i[s]||(i[s]=[]),t.serializeArrayProperty(u,i[s],0)):iI.is(u)?i[s]={id:u.getInstanceId()}:ii(u)&&(i[s]||(i[s]={}),t.serializeObjectProperty(u,i[s],0))}for(var h,l=n(Object.keys(e.defination));!(h=l()).done;){var c=h.value,f=e.defination[c];"number"==typeof f||"string"==typeof f||"boolean"==typeof f||t.checkTypedArray(f)?i[c]=f:it(f)?(i[c]||(i[c]=[]),t.serializeArrayProperty(f,i[c],0)):iI.is(f)?i[c]={id:f.getInstanceId()}:ii(f)&&(i[c]||(i[c]={}),t.serializeObjectProperty(f,i[c],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=iw(i),a=i.engine;if(r)for(var o,s=n(Object.keys(r));!(o=s()).done;){var u=o.value,h=e[u];if(void 0!==h){var l=r[u].type;i[u]=t.deserializeProperty(h,a,0,l)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return a(t,Int8Array)||a(t,Uint8Array)||a(t,Uint8ClampedArray)||a(t,Int16Array)||a(t,Uint16Array)||a(t,Int32Array)||a(t,Uint32Array)||a(t,Float32Array)||a(t,Float64Array)||a(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(ii(t)&&1===Object.keys(t).length&&"id"in t&&e7(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return ii(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return ia(t)||a(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,a,o){if(void 0===o&&(o=!0),r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(it(e)){for(var s,u=[],h=n(e);!(s=h()).done;){var l=s.value;u.push(t.deserializeProperty(l,i,r+1,a,o))}return u}if(t.checkDataPath(e)){var c=i.findObject(e);return o?c:e}if(!ir(e))return e;f=a?new a:{};for(var f,d,p=n(Object.keys(e));!(d=p()).done;){var m=d.value;f[m]=t.deserializeProperty(e[m],i,r+1,void 0,o)}return f},t.serializeObjectProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i={});for(var a,o=n(Object.keys(e));!(a=o()).done;){var s=a.value,u=e[s];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(e)?i[s]=u:it(u)?(i[s]||(i[s]=[]),t.serializeArrayProperty(u,i[s],r+1)):iI.is(u)?i[s]={id:u.getInstanceId()}:ii(u)&&(i[s]||(i[s]={}),t.serializeObjectProperty(u,i[s],r+1))}},t.serializeArrayProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i=[]);for(var n=0;n<e.length;n++){var a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:it(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):iI.is(a)?i[n]={id:a.getInstanceId()}:ii(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}},t}(),ug=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(!r){console.error("Object data with uuid: "+i+" not found.");return}switch(r.dataType){case es.Material:e=no.create(this.engine);break;case es.Geometry:e=nx.create(this.engine);break;case es.Texture:e=r4.create(this.engine);break;default:var n=iS[r.dataType];n&&(e=new n(this.engine))}if(!e){console.error("Constructor for DataType: "+r.dataType+" not found.");return}return e.setInstanceId(r.id),this.engine.addInstance(e),uy.deserialize(r,e),e},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),ux=function(){function t(){}return t.prototype.loadGUID=function(t){return i(function(){return u(this,function(t){return[2,void 0]})})()},t}();function ub(t,e){if(!t.includes(e))return t.push(e),!0}function uT(t){if(Number.isFinite(t))return[tq.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tq.CONSTANT)return[tq.CONSTANT,t[1]];if("lines"===e)return[tq.LINE,t[1]];if(e===tq.LINE){var r=i.map(function(t){return[tK.LINE,t]});return[tq.BEZIER_CURVE,r]}return"curve"===e||e===tq.CURVE?[tq.BEZIER_CURVE,uk(i)]:t}}function uE(t,e){return Array.isArray(t)&&"random"===t[0]?[tq.CONSTANT,t[1][e]]:uT(t)}function u_(t){return t&&"color"===t[0]?uA(t[1],!0):[1,1,1,1]}function uC(t){return t&&"random"===t[0]?[tq.RANDOM,t[1]]:uT(t)}function uS(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,a=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,o=uA(t[r],e);i.push([a,o[0],o[1],o[2],o[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tq.GRADIENT_COLOR,i]}}function uA(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else a(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=uw(i)),i}function uw(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function uR(t,e){return Array.isArray(t)?t[0]===tq.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&uS(t[1],e):uS(t,e)}function uI(t){if(t){if(3===t.length)return[tq.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tq.BEZIER_PATH||e===tq.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=uk(r);if(!a){a=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&a.push(u),a.push(u)}}return[tq.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function uM(t){for(var e,i=n(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function uO(t){for(var e,i=n(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var uP=Math.cos,uN=Math.sin,uF=Math.PI/180,uL=180/Math.PI;function uV(t,e){return t?[t[0]-.5,.5-t[1]]:e?uD[e]:[0,0]}var uD=((e_={})[tH.PARTICLE_ORIGIN_CENTER]=[0,0],e_[tH.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],e_[tH.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],e_[tH.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],e_[tH.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],e_[tH.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],e_[tH.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],e_[tH.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],e_[tH.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],e_);function uk(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],a=0;a<t.length-1;a++){var o=t[a][3]*(e-i),s=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],h=[t[a+1][0],t[a+1][1]];if(u[0]!=h[0]){var l=function(t,e,i,r){var n=i[0],a=i[1],o=r[0],s=r[1],u=o-n;return[[n+(o-n)/3,a+(t*=u)/3],[o-(o-n)/3,s-(e*=u)/3]]}(o,s,u,h),c=l[0],f=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map(function(t,e){return 0===e?[tK.EASE_OUT,t]:e===n.length-1?[tK.EASE_IN,t]:[tK.EASE,t]})}function uz(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tj.null&&t.endBehavior===tQ.destroy&&(t.endBehavior=tQ.freeze)})}),t.version=tF["2_1"],t}var uU=new Map,uB=new Map;function uG(t){for(var e,i=n(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===es.ShapeComponent&&r.type===ee.Custom){(null==(a=r.shapes)?void 0:a.length)>0&&r.shapes[0].fill&&(r.fill=r.shapes[0].fill);for(var a,o,s=Array(r.easingIns.length),u=Array(r.easingOuts.length).fill(!1),h=n(r.shapes);!(o=h()).done;)for(var l,c=o.value,f=n(c.indexes);!(l=f()).done;){var d=l.value,p=r.points[d.point],m=r.easingIns[d.easingIn],v=r.easingOuts[d.easingOut];s[d.easingIn]||(m.x-=p.x,m.y-=p.y,s[d.easingIn]=!0),u[d.easingOut]||(v.x-=p.x,v.y-=p.y,u[d.easingOut]=!0)}}}return t.version=tF["3_2"],t}function uj(e){uU.clear(),uB.clear();for(var i,r=e.compositions,a=e.items,o=e.components,s=n(o);!(i=s()).done;){var u=i.value;uU.set(u.id,u)}for(var h,l=n(a);!(h=l()).done;){var c=h.value;uB.set(c.id,c)}for(var f,d=n(r);!(f=d()).done;)!function(e){for(var i,r=n(e.items);!(i=r()).done;){var a=i.value,o=uB.get(a.id);if(!o)return;if(o.type===tj.sprite||o.type===tj.particle||o.type===tj.spine||o.type===tj.text||o.type===tj.richtext||o.type===tj.video||o.type===tj.shape){var s=uU.get(o.components[0].id);s&&function(e){var i=e.renderer,r=null==i?void 0:i.maskMode;r&&r!==t.MaskMode.NONE&&(r===t.MaskMode.MASK?(e.mask={isMask:!0},eC=e.id):(r===tk.OBSCURED||r===tk.REVERSE_OBSCURED)&&(e.mask={inverted:r===tk.REVERSE_OBSCURED,reference:{id:eC}}))}(s)}}}(f.value);return e.version=tF["3_3"],e}function uX(t){null==(e=t.plugins)||e.forEach(function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")});for(var e,i,r=n(t.items);!(i=r()).done;){var a=i.value;if(a.type===tj.sprite){var o=uU.get(a.components[0].id);if(o){var s=o.renderer.shape,u=void 0;u=Number.isInteger(s)?t.shapes[s]:s,o.renderer.shape=u}}}for(var h,l=t.compositionId,c={},f=n(t.compositions);!(h=f()).done;){var d=h.value,p=iu();c[d.id]=p,d.id===l&&(t.compositionId=p),d.id=p;var m={id:iu(),dataType:"CompositionComponent",items:d.items,timelineAsset:d.timelineAsset,sceneBindings:d.sceneBindings};d.timelineAsset=void 0,d.sceneBindings=void 0,d.components=[{id:m.id}],t.components.push(m)}for(var v,y=n(t.items);!(v=y()).done;){var g=v.value;if(g.content){var x=g.content.options;x&&void 0!==x.refId&&(x.refId=c[x.refId])}}return t.version=tF["3_4"],t}function uH(t){for(var e,i=iB({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=n(i.images);!(e=r()).done;)e.value.id=iu();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=iu(),t.dataType=es.Texture,t.source={id:null==(e=i.images[t.source])?void 0:e.id}}),i.textures.length<i.images.length)for(var a=i.textures.length;a<i.images.length;a++)i.textures.push({id:iu(),dataType:es.Texture,source:{id:i.images[a].id},flipY:!0});t.bins&&(o=t.bins,i.bins=o.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:iu()}}));for(var o,s,u={},h={},l=n(t.compositions);!(s=l()).done;)!function(){var t=s.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=tQ.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tj.particle&&t.content.filter&&delete t.content.filter});for(var e,r=n(t.items);!(e=r()).done;){var a=e.value;u[a.id]=iu(),a.oldId=a.id,a.id=u[a.id],h[a.id]=a}t.items.forEach(function(e,r){if(e.parentId){if(e.parentId.includes("^")){var n=e.parentId.split("^")[0],a=e.parentId.split("^")[1];e.parentId=u[n]+"^"+a}else e.parentId=u[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var o=iB({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(o),function(t,e,i){for(var r,a=[],o=[],s=[],u={tracks:[],id:iu(),dataType:"TimelineAsset"},h=n(t.items);!(r=h()).done;){var l=e[r.value.id],c=[],f={id:iu(),dataType:"ActivationPlayableAsset"};s.push(f);var d={id:iu(),dataType:"ActivationTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:f.id}}]};if(c.push({id:d.id}),o.push(d),l.type!==tj.particle){var p={id:iu(),dataType:"TransformPlayableAsset",sizeOverLifetime:l.content.sizeOverLifetime,rotationOverLifetime:l.content.rotationOverLifetime,positionOverLifetime:l.content.positionOverLifetime};s.push(p);var m={id:iu(),dataType:"TransformTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:p.id}}]};c.push({id:m.id}),o.push(m)}if(l.type===tj.sprite||l.type===tj.text){var v={id:iu(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:l.content.colorOverLifetime};s.push(v);var y={id:iu(),dataType:"SpriteColorTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:v.id}}]};c.push({id:y.id}),o.push(y)}if(l.type===tj.composition){var g={id:iu(),dataType:"SubCompositionPlayableAsset"};s.push(g);var x={id:iu(),dataType:"SubCompositionTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:g.id}}]};c.push({id:x.id}),o.push(x)}var b={id:iu(),dataType:"ObjectBindingTrack",children:c,clips:[]};o.push(b),u.tracks.push({id:b.id}),a.push({key:{id:b.id},value:{id:l.id}})}for(var T,E=[],_=n(o);!(T=_()).done;){var C=T.value;E.push({id:C.id})}t.timelineAsset={id:u.id},t.sceneBindings=a,i.miscs.push(u);for(var S,A=n(o);!(S=A()).done;){var w=S.value;i.miscs.push(w)}for(var R,I=n(s);!(R=I()).done;){var M=R.value;i.miscs.push(M)}}(o,h,i)}();for(var c,f=n(i.items);!(c=f()).done;){var d=c.value;if(d.content){if(d.content.renderer&&void 0!==d.content.renderer.texture){var p=d.content.renderer.texture;d.content.renderer.texture={id:i.textures[p].id}}if(d.content.trails&&void 0!==d.content.trails.texture){var m=d.content.trails.texture;d.content.trails.texture={id:i.textures[m].id}}}if(d.transform){var v=[].concat(null!=(x=d.transform.position)?x:[0,0,0]),y=[].concat(null!=(b=d.transform.rotation)?b:[0,0,0]),g=[].concat(null!=(T=d.transform.scale)?T:[1,1,1]);if(Object.assign(d,{transform:{position:{x:v[0],y:v[1],z:v[2]},eulerHint:{x:y[0],y:y[1],z:y[2]},scale:{x:g[0],y:g[1],z:g[0]}}}),d.type===tj.sprite&&(d.transform.size={x:g[0],y:g[1]},d.transform.scale={x:1,y:1,z:1}),d.type===tj.sprite){var x,b,T,E,_,C,S,A=d.content;A.renderer||(A.renderer={});var w=A.renderer,R=uV(w.anchor,w.particleOrigin),I=d.transform.size;w.anchor||void 0===w.particleOrigin||(d.transform.position.x+=-R[0]*(null!=(E=null==I?void 0:I.x)?E:1),d.transform.position.y+=-R[1]*(null!=(_=null==I?void 0:I.y)?_:1)),d.transform.anchor={x:R[0]*(null!=(C=null==I?void 0:I.x)?C:1),y:R[1]*(null!=(S=null==I?void 0:I.y)?S:1)}}}if(d.type===tj.particle){var M=d.content;M.renderer||(M.renderer={});var O=M.renderer;M.renderer.anchor=uV(O.anchor,O.particleOrigin)}if(d.type===tj.camera&&d.content.positionOverLifetime&&0!==Object.keys(d.content.positionOverLifetime).length&&(d.content.positionOverLifetime.asMovement=!0),void 0!==d.pn){var P=d.pn,N=t.plugins,F=void 0===N?[]:N;void 0!==P&&Number.isInteger(P)&&(d.pluginName=F[P])}switch("editor-gizmo"===d.pluginName&&(d.type="editor-gizmo"),"orientation-transformer"===d.pluginName&&(d.type="orientation-transformer"),d.content.options.target&&"editor-gizmo"===d.pluginName&&(d.content.options.target=u[d.content.options.target]),d.type===tj.spine&&t.spines&&0!==t.spines.length&&function(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:i.textures[t].id}})}}(t.spines[d.content.options.spine],d.content,i),(d.type===tj.sprite||d.type===tj.particle||d.type===tj.mesh||d.type===tj.skybox||d.type===tj.light||"camera"===d.type||d.type===tj.tree||d.type===tj.interact||d.type===tj.camera||d.type===tj.text||d.type===tj.spine||"editor-gizmo"===d.type||"orientation-transformer"===d.type)&&(d.components=[],i.components.push(d.content),d.content.id=iu(),d.content.item={id:d.id},d.dataType=es.VFXItemData,d.components.push({id:d.content.id})),(d.type===tj.null||d.type===tj.composition)&&(d.components=[],d.dataType=es.VFXItemData),d.type){case tj.sprite:d.content.dataType=es.SpriteComponent;break;case tj.particle:d.content.dataType=es.ParticleSystem;break;case tj.mesh:d.content.dataType=es.MeshComponent;break;case tj.skybox:d.content.dataType=es.SkyboxComponent;break;case tj.light:d.content.dataType=es.LightComponent;break;case"camera":d.content.dataType=es.CameraComponent;break;case"editor-gizmo":d.content.dataType="GizmoComponent";break;case"orientation-transformer":d.content.dataType="OrientationComponent";break;case tj.tree:d.content.dataType=es.TreeComponent;break;case tj.interact:d.content.dataType=es.InteractComponent;break;case tj.camera:d.content.dataType=es.CameraController;break;case tj.text:d.content.dataType=es.TextComponent;break;case tj.spine:d.content.dataType=es.SpineComponent}}return i.version=tF["3_0"],i}function uW(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:uI(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:uT(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:uT(n.linearX),linearY:uT(n.linearY),linearZ:uT(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:uT(n.orbitalX),orbitalY:uT(n.orbitalY),orbitalZ:uT(n.orbitalZ),speedOverLifetime:uT(n.speedOverLifetime)};uO(a);var o={options:{startColor:u_(r.startColor)},positionOverLifetime:a};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var s=t.rotationOverLifetime;if(s){var u=o.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=uT(s.x),u.y=uT(s.y),u.z=uT(s.z)):u.z=uT(s.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=o.colorOverLifetime={opacity:uT(h.opacity)};h.color&&(l.color=uR(h.color))}var c=t.sizeOverLifetime;return c&&(o.sizeOverLifetime={separateAxes:c.separateAxes,size:uT(c.size),x:uT(c.x),y:uT(c.y),z:uT(c.z)}),o}var uY="2.6.5",uZ=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,uq=/^(\d+)\.(\d+)$/,uK=!1;function uQ(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(function(t){var e=(t.playerVersion||{}).web,i=void 0===e?"":e;if(i){var r,n,a=null!=(r=uZ.exec(i))?r:[],o=null!=(n=uZ.exec(uY))?n:[],s=a[1],u=a[2],h=o[1],l=o[2];return Number(h)<Number(s)||Number(h)===Number(s)&&Number(l)<Number(u)}return!1}(t)&&console.warn("The JSON need higher than "+(null==(p=t.playerVersion)?void 0:p.web)+" runtime version(current: "+uY+"). Some features may not work as expected."),!(d=null==(f=(c=t).version)?void 0:f.split("."))||Number(d[0])>2||2===Number(d[0])&&Number(d[1])>=2||c.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tj.mesh||t.type===tj.light)&&(t.endBehavior=1===t.endBehavior?tQ.destroy:t.endBehavior)})}),uZ.test(t.version)){var e,i,r,a,o,s,u,h;return uK=(null==(m=/^(\d+)/.exec(t.version))?void 0:m[0])==="0",uX(uj(uG(uH(uz((e=t,uJ=tF["1_0"],a=e.plugins||[],(null==(i=e.bins)?void 0:i.length)&&(uJ=tF["1_3"]),o=(e.requires||[]).slice(),s=e.images.map(function(t,i){return u$(t,i,e.imageTags||[])}),u=e.textures||s.map(function(t,e){return{source:e,flipY:!0}}),h={plugins:a,shapes:e.shapes||[],type:"ge",version:uJ,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return u0(t,{plugins:a,requires:o})}),images:s,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:u,bins:(e.bins||[]).slice()},e._textures&&(h._textures=e._textures),h))))))}uK=!1;var l,c,f,d,p,m,v=uq.exec(t.version)||[],y=Number(v[1]),g=Number(v[2]);if(y)return(y<2||2===y&&g<4)&&((l=t).compositions.map(function(t){for(var e,i=n(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=n(Object.keys(e));!(i=r()).done;){var a=i.value,o=e[a],s=Array.isArray(o);s&&2===o.length&&Array.isArray(o[1])?"path"===a?e[a]=uI(o):e[a]=uT(o):s||"object"!=typeof o||t(o)}})(e.value.content)}),t=l),y<3&&(t=uH(uz(t))),y=Number((v=uq.exec(t.version)||[])[1]),g=Number(v[2]),y<4&&(g<2&&(t=uG(t)),g<3&&(t=uj(t)),g<4&&(t=uX(t))),t;throw Error("Invalid JSON version: "+t.version+".")}var uJ=tF["1_0"];function u$(t,e,i){var r=i[e];if("string"==typeof t)return{id:iu(),renderLevel:r,url:t};if(t.template)return{id:iu(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:iu(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:iu(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function u0(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iB({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return u2(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var u1=[0,0,0,1];function u2(t,e){void 0===e&&(e={});var i=tj.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tj.plugin,m=t.pn,p=t.pluginName,f=t.content,c=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),l=t.transform||b(c.transform)):t.particle?(i=tj.particle,l=b((c=t.particle).transform,uK,!0),f=function(t){var e=t.options,i=t.transform,r={type:tz.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iB({},t.shape,{type:tz[a]}),t.shape.upDirection){var o=t.shape.upDirection,s=o[0],u=o[1],h=o[2];0===s&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=uC(e.turbulenceX),r.turbulenceY=uC(e.turbulenceY),r.turbulenceZ=uC(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map(function(t){return uM(t)})),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map(function(t){return uM(t)})),l.rateOverTime&&(l.rateOverTime=uC(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:uC(e.startLifetime),start3DSize:!!e.start3DSize,startSize:uC(e.startSize),startSizeX:uC(e.startSizeX),startSizeY:uC(e.startSizeY),sizeAspect:uC(e.sizeAspect),maxCount:e.maxCount,startDelay:uC(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tq.COLORS,t[1].map(function(t){return uA(t,e)})]:"gradient"===t[0]?uS(t[1],e):"color"===t[0]?[tq.RGBA_COLOR,uA(t[1],e)]:t}(e.startColor,!0),startRotationZ:uC(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=uC(e.startRotationX),c.options.startRotationY=uC(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:uI(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:uC(f.x),y:uC(f.y)}:c.sizeOverLifetime={size:uC(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?uT(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:uT(e.gravityModifier),startSpeed:uC(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:uC(d.linearX),linearY:uC(d.linearY),linearZ:uC(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:uC(d.orbitalX),orbitalY:uC(d.orbitalY),orbitalZ:uC(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:uT(d.forceCurve)},uO(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:uC(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=uT(m.y),c.rotationOverLifetime.x=uT(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:uT(v.opacity)};v.color&&(y.color=uR(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:uT(g.cycles),animationDelay:uE(g.animationDelay,0),animationDuration:uE(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:uC(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:uT(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&uR(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&uR(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:uC(x.opacityOverLifetime)}),c.trails&&uO(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(c)):t.sprite?(i=tj.sprite,l=b((c=t.sprite).transform,!1,!0),s=uW(o=c,l),(u=o.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=o.renderer,o.splits&&(s.splits=o.splits),o.interaction&&(s.interaction=o.interaction),f=s):t.cal?(i=tj.null,l=b((c=t.cal).transform,!1,!0),f=uW(c,l)):t.ui?(i=tj.interact,l=b((c=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tB.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&u_(i.previewColor),behavior:i.behavior||tG.NOTIFY};break;case"drag":e={type:tB.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tB.MESSAGE}}return{options:e}}(c),l.scale=[c.options.width||1,c.options.height||1,1]):t.model&&(c=t.model,1===t.model.options.type&&(i=tj.camera,l=b(c.transform),f=function(t){var e=t.options,i={options:{fov:e.fov,far:e.far,near:e.near,clipMode:e.clipMode}},r=t.velocityOverLifetime;if(r||(null==(n=t.transform)?void 0:n.path)){var n,a,o={path:uI(null==(a=t.transform)?void 0:a.path),linearX:uT(null==r?void 0:r.translateX),linearY:uT(null==r?void 0:r.translateY),linearZ:uT(null==r?void 0:r.translateZ)};uO(o),i.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:uT(null==s?void 0:s.rotateX),y:uT(null==s?void 0:s.rotateY),z:s.separateAxes?uT(null==s?void 0:s.rotateZ):uT(s.rotation)};uO(u),i.rotationOverLifetime=u}return i}(c))),null==(h=f.renderer)?void 0:h.anchor){var a=new Float32Array(f.renderer.anchor);.5==a[0]&&.5==a[1]?delete f.renderer.anchor:e.requires&&ub(e.requires,"anchor")}if(c){var o,s,u,h,l,c,f,d,p,m,v,y,g=null==(v=c.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tQ.restart:tQ.destroy:tQ.restart:r||(null==c?void 0:null==(y=c.options)?void 0:y.endBehavior)||tQ.destroy,c.options.renderLevel&&(d=c.options.renderLevel),isNaN(n)&&(n=c.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:l,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(ub(e.plugins,p),x.pn=e.plugins.indexOf(p)):x.pluginName=p:Number.isInteger(m)&&(x.pn=m),t.parentId&&(x.parentId=t.parentId+""),x;function b(t,e,i){if(t){var r={},n=t.rotation;if(n&&(e?r.rotation=[-n[0],-n[1],-n[2]]:r.rotation=[n[0],n[1],n[2]],i)){var a,o,s,u,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,C,S,A,w,R,I=(a=r.rotation[0],o=r.rotation[1],s=r.rotation[2],u=uP(a*uF/2),h=uP(o*uF/2),l=uP(s*uF/2),c=uN(a*uF/2),f=uN(o*uF/2),d=uN(s*uF/2),u1[0]=c*h*l+u*f*d,u1[1]=u*f*l-c*h*d,u1[2]=u*h*d+c*f*l,u1[3]=u*h*l-c*f*d,u1);r.rotation=(p=[],m=I[0],v=I[1],y=I[2],g=I[3],x=m+m,b=v+v,T=y+y,E=m*x,_=v*x,C=v*b,S=y*T,A=g*T,w=y*x-g*b,p[1]=Math.asin((R=-w)>1?1:R<-1?-1:R)*uL,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*b+g*x,1-E-C)*uL,p[2]=Math.atan2(_+A,1-C-S)*uL):(p[0]=0,p[2]=Math.atan2(-(_-A),1-E-S)*uL),p)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}return{}}}var u3=((eS={})[tL.S]=[tL.S,tL.BPlus,tL.APlus],eS[tL.A]=[tL.A,tL.BPlus,tL.APlus],eS[tL.B]=[tL.B,tL.BPlus],eS);function u4(t,e){if(!t||!e)return!0;var i=u3[e];return!!i&&i.includes(t)}function u5(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,o=n.url;return a&&(e&&e[a]?i=e[a]:o&&(i=o)),i}function u6(t,e,i){return u8.apply(this,arguments)}function u8(){return(u8=i(function(t,e,i){var r,n;return u(this,function(o){switch(o.label){case 0:if("string"!=typeof t)return[3,2];return[4,rX(t)];case 1:return r=o.sent(),[3,3];case 2:r=t,o.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=u5(e,i)){if(e7(n)&&n!==r.src)return[2,rX(n)];if(a(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}t.Scene=void 0,(tM=t.Scene||(t.Scene={})).isJSONObject=function(t){return ii(t)&&"jsonScene"in t},tM.isURL=function(t){return ii(t)&&"url"in t},tM.isWithOptions=function(t){return ii(t)&&"options"in t};var u9=1,u7=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new rD),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=u9++,this.timers=[],this.updateOptions(t)}var r=e.prototype;return r.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout;this.timeout=void 0===e?10:e},r.loadScene=function(e,r,n){var a=this;return i(function(){var o,s,h,l,c,f,d,p,m,v,y,g;return u(this,function(x){return s=e7(e)?e:a.id,h=performance.now(),l=[],d=null!=(f=null==(c=null==r?void 0:r.engine.gpuCapability)?void 0:c.detail.compressedTexture)?f:t.COMPRESSED_TEXTURE.NONE,p={},v=!1,y=new Promise(function(t,e){m=window.setTimeout(function(){v=!0,a.removeTimer(m),e(Error("Load time out: totalTime: "+(performance.now()-h).toFixed(4)+"ms "+l.join(" ")+", url: "+s+"."))},1e3*a.timeout),a.timers.push(m)}),g=i(function(t,e){var i,r,n;return u(this,function(a){switch(a.label){case 0:if(v)return[3,4];i=performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e()];case 2:return r=a.sent(),n=performance.now()-i,l.push("["+t+": "+n.toFixed(2)+"]"),p[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+a.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([y,i(function(){var i,r,c,f,v,y,x,b,T,E,_,C,S,A;return u(this,function(u){switch(u.label){case 0:if(!e7(e))return[3,2];return r=new URL(e,location.href).href,a.baseUrl=r,[4,g("loadJSON",function(){return a.loadJSON(r)})];case 1:return e7(o=u.sent())&&(o=JSON.parse(o)),[3,3];case 2:o=e,a.baseUrl=location.href,u.label=3;case 3:if(!t.Scene.isJSONObject(o))return[3,4];return i=iB({},o),[3,9];case 4:return[4,g("processJSON",function(){return a.processJSON(o)})];case 5:return f=(c=u.sent()).jsonScene,v=c.pluginSystem,x=void 0===(y=f.bins)?[]:y,b=f.images,T=f.fonts,[4,Promise.all([g("processBins",function(){return a.processBins(x)}),g("processImages",function(){return a.processImages(b,d)}),g("plugin:processAssets",function(){return a.processPluginAssets(f,v,n)}),g("processFontURL",function(){return a.processFontURL(T)})])];case 6:return _=(E=u.sent())[0],C=E[1],[4,g("processTextures",function(){return a.processTextures(C,_,f)})];case 7:return S=u.sent(),i={timeInfos:p,url:e,renderLevel:a.options.renderLevel,storage:{},pluginSystem:v,jsonScene:f,bins:_,textureOptions:S,textures:[],images:C,assets:a.assets},[4,g("plugin:prepareResource",function(){return v.loadResources(i,a.options)})];case 8:u.sent(),u.label=9;case 9:return A=performance.now()-h,e8.info("Load asset: totalTime: "+A.toFixed(4)+"ms "+l.join(" ")+", url: "+s+"."),window.clearTimeout(m),a.removeTimer(m),i.totalTime=A,i.startTime=h,i.timeInfos=p,[2,i]}})})()])]})})()},r.getAssets=function(){return this.assets},r.processJSON=function(t){var e=this;return i(function(){var i,r,n;return u(this,function(a){switch(a.label){case 0:return[4,(n=new iv(void 0===(r=(i=uQ(t)).plugins)?[]:r)).processRawJSON(i,e.options)];case 1:return a.sent(),[2,{jsonScene:i,pluginSystem:n}]}})})()},r.processBins=function(t){var e=this;return i(function(){var i,r;return u(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(a(n,ArrayBuffer))return n;if(u4(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},r.processFontURL=function(t){var r=this;return i(function(){return u(this,function(n){return t?[2,Promise.all(t.map(i(function(t){var i,n,a;return u(this,function(o){switch(o.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];e5(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),i=new URL(t.fontURL,r.baseUrl).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+i+")")).load()];case 2:return o.sent(),document.fonts.add(a),e.fontCache.add(t.fontFamily),[3,4];case 3:return o.sent(),e8.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},r.processImages=function(e,r){void 0===r&&(r=0);var n=this;return i(function(){var o,s,h,l,c,f,d;return u(this,function(p){switch(p.label){case 0:return s=(o=n.options).useCompressedTexture,h=o.variables,l=o.disableWebP,c=o.disableAVIF,f=n.baseUrl,[4,Promise.all(e.map(i(function(e,i){var o,d,p,m,v,y,g,x,b,T,E,_,C,S,A,w,R,I,M,O,P;return u(this,function(i){switch(i.label){case 0:if(o=e.url,d=e.webp,p=e.avif,m=new URL(o,f).href,v=!l&&d?new URL(d,f).href:void 0,y=!c&&p?new URL(p,f).href:void 0,g=e.id,!("template"in e))return[3,8];if(!(b=(x=e.template).background))return[3,7];T=u5(x,h),E=b.type===ea.video,_=b&&E?rq:rX,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,rQ(T,_)];case 2:if(!a(C=i.sent(),HTMLVideoElement))return[3,3];return n.sourceFrom[g]={url:C.src,type:t.TextureSourceType.video},[2,C];case 3:return b&&Array.isArray(T)&&h&&(h[b.name]=C.src),n.sourceFrom[g]={url:C.src,type:t.TextureSourceType.image},[4,u6(C,x,h)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw S=i.sent(),Error("Failed to load. Check the template or if the URL is "+(E?"video":"image")+" type, URL: "+T+", Error: "+(S.message||S)+".");case 7:return[3,9];case 8:if("compressed"in e&&s&&r){if(A=e.compressed,r===t.COMPRESSED_TEXTURE.ASTC?w=A.astc:r===t.COMPRESSED_TEXTURE.PVRTC&&(w=A.pvrtc),w)return R=new URL(w,f).href,n.sourceFrom[g]={url:R,type:t.TextureSourceType.compressed},[2,n.loadBins(R)]}else if(a(e,HTMLImageElement)||a(e,HTMLCanvasElement)||a(e,HTMLVideoElement)||a(e,r4))return[2,e];i.label=9;case 9:if(!y)return[3,11];return[4,rG(m,y)];case 10:return P=i.sent(),[3,13];case 11:return[4,rU(m,v)];case 12:P=i.sent(),i.label=13;case 13:return M=(I=P).url,O=I.image,n.sourceFrom[g]={url:M,type:t.TextureSourceType.image},[2,O]}})})))];case 1:return d=p.sent(),n.assignImagesToAssets(e,d),[2,d]}})})()},r.processPluginAssets=function(t,e,r){var n=this;return i(function(){var i,a,o,s;return u(this,function(u){switch(u.label){case 0:return[4,e.processAssets(t,r)];case 1:for(a=(i=u.sent().reduce(function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t},{assets:[],loadedAssets:[]})).assets,o=i.loadedAssets,s=0;s<a.length;s++)n.assets[a[s].id]=o[s];return[2]}})})()},r.processTextures=function(e,r,n){var o=this;return i(function(){var s;return u(this,function(h){return[2,Promise.all((null!=(s=n.textures)?s:e.map(function(t,e){return{source:e}})).map(i(function(e,i){var s,h,l,c,f;return u(this,function(u){switch(u.label){case 0:if(a(e,r4))return[2,e];if(!("mipmaps"in e))return[3,4];u.label=1;case 1:return u.trys.push([1,3,,4]),[4,r$(e,r,o.assets,n.bins)];case 2:return[2,u.sent()];case 3:throw Error("Load texture "+i+" fails, error message: "+u.sent()+".");case 4:if(s=e.source,h=e.id,c="",!ii(s))return[3,5];return l=o.assets[s.id],c=s.id,[3,7];case 5:if("string"!=typeof s)return[3,7];return[4,rX(ih(s))];case 6:l=u.sent(),u.label=7;case 7:if(l)return[2,(f=function(e,i,r){var n={id:r,dataType:es.Texture};if(a(e,r4))return iB({},e.source,n);if(a(e,HTMLImageElement)||ia(e))return iB({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:rw.LINEAR,magFilter:rw.LINEAR},n);if(a(e,HTMLVideoElement))return iB({sourceType:t.TextureSourceType.video,video:e,minFilter:rw.LINEAR,magFilter:rw.LINEAR},n);if(a(e,ArrayBuffer))return iB({},nt(e),{sourceFrom:i},n);if("width"in e&&"height"in e&&"data"in e)return iB({sourceType:t.TextureSourceType.data,data:e,wrapS:rw.CLAMP_TO_EDGE,wrapT:rw.CLAMP_TO_EDGE,minFilter:rw.NEAREST,magFilter:rw.NEAREST},n);throw Error("Invalid texture options.")}(l,o.sourceFrom[c],h)).sourceType===t.TextureSourceType.compressed?f:iB({},f,e)];throw Error("Invalid texture source: "+s+".")}})})))]})})()},r.loadJSON=function(t){var e=this;return i(function(){return u(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadJSON(t,i,function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},r.loadBins=function(t){var e=this;return i(function(){return u(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadBinary(t,i,function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},r.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},r.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},r.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e}();u7.fontCache=new Set;var ht=function(){function e(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(r8(t))}var i=e.prototype;return i.assembleSceneLoadOptions=function(e,i){void 0===i&&(i={});var r=e;return t.Scene.isURL(e)&&(t.Scene.isJSONObject(e)||(r=e.url),t.Scene.isWithOptions(e)&&(i=iB({},i,e.options))),{source:r,options:i}},i.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach(function(t){if(t.type===tj.text||t.type===tj.richtext){var r=e[t.name];r&&t.components.forEach(function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);((null==n?void 0:n.dataType)===es.TextComponent||(null==n?void 0:n.dataType)===es.RichTextComponent)&&(n.options.text=r)})}})},i.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++)t.textures[e]=this.engine.findObject({id:t.textureOptions[e].id}),t.textures[e].initialize()},i.prepareAssets=function(t,e){this.engine.clearResources();for(var i,r=n(Object.keys(e));!(i=r()).done;){var a=i.value,o=e[a],s=new uv(this.engine);s.data=o,s.setInstanceId(a)}this.engine.addPackageDatas(t);for(var u,h=n(this.builtinObjects);!(u=h()).done;){var l=u.value;this.engine.addInstance(l)}},i.createShaderVariant=function(){for(var t,e=n(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];a(r,no)&&r.createShaderVariant()}},i.destroyBuiltinObjects=function(){for(var t,e=n(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},i.dispose=function(){this.destroyBuiltinObjects()},e}(),he=new Int32Array(2),hi=new Float32Array(he.buffer),hr=new Float64Array(he.buffer),hn=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tO=eA||(eA={}))[tO.UTF8_BYTES=1]="UTF8_BYTES",tO[tO.UTF16_STRING=2]="UTF16_STRING";var ha=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return he[0]=this.readInt32(t),hi[0]},e.readFloat64=function(t){return he[hn?0:1]=this.readInt32(t),he[hn?1:0]=this.readInt32(t+4),hr[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){hi[0]=e,this.writeInt32(t,he[0])},e.writeFloat64=function(t,e){hr[0]=e,this.writeInt32(t,he[hn?0:1]),this.writeInt32(t+4,he[hn?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===eA.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),ho=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=ha.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=~(this.bb.capacity()-this.space+i)+1&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=(i+2)*2;this.addInt16(r);var n=0,a=this.space;e:for(e=0;e<this.vtables.length;e++){var o=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(o)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(a+s)!=this.bb.readInt16(o+s))continue e;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){if(this.prep(this.minalign,8+r),4!=e.length)throw TypeError("FlatBuffers: file identifier must be length 4");for(var n=3;n>=0;n--)this.writeInt8(e.charCodeAt(n))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){var e;return null==t?0:(a(t,Uint8Array)?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null!==r)e.push(this.createObjectOffset(r));else throw TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=ha.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),hs=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new hu(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),hu=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=hs.createDataVector(t,this.data);return hs.createFBEffectsObjectData(t,e,i)},t}(),hh=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new hs).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new hl(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),hl=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=hh.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return hh.createFBEffectsPackageData(t,e)},t}(),hc=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new hf(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),hf=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return hc.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),hd=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new hp(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,a,o){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,o),t.endFBVertexChannel(e)},t}(),hp=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return hd.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),hm=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new hd).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new hv(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),hv=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=hm.createChannelsVector(t,t.createObjectOffsetList(this.channels));return hm.createFBVertexData(t,this.vertexCount,e)},t}(),hy=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new hm).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new hc).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new hg(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),hg=function(){function t(t,e,i,r,n,a,o,s,u,h,l,c){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=[]),void 0===o&&(o=0),void 0===s&&(s=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===l&&(l=null),void 0===c&&(c=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=a,this.mode=o,this.buffer=s,this.binaryData=u,this.boneNames=h,this.rootBoneName=l,this.inverseBindMatrices=c}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=hy.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=hy.createBinaryDataVector(t,this.binaryData),s=hy.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=hy.createInverseBindMatricesVector(t,this.inverseBindMatrices);return hy.startFBGeometryData(t),hy.addId(t,e),hy.addName(t,i),hy.addVertexData(t,r),hy.addIndexFormat(t,this.indexFormat),hy.addIndexOffset(t,this.indexOffset),hy.addSubMeshes(t,n),hy.addMode(t,this.mode),hy.addBuffer(t,a),hy.addBinaryData(t,o),hy.addBoneNames(t,s),hy.addRootBoneName(t,u),hy.addInverseBindMatrices(t,h),hy.endFBGeometryData(t)},t}(),hx=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new ho(1),i=new hl,r=[],a=n(this.exportObjectDatas);!(t=a()).done;){var o=t.value,s=void 0;o.dataType===es.Geometry&&(s=new hu("Geometry",this.geometryDataToBinary(o))),s&&r.push(s)}return i.exportObjects=r,hh.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new ha(t),i=hh.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),o=n.dataType();if(a){var s=void 0;o===es.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new ho(1),i=new hg,r=t.indexFormat,a=t.indexOffset,o=t.mode,s=t.id,u=t.vertexData,h=t.boneNames,l=t.rootBoneName,c=t.inverseBindMatrices,f=t.binaryData;i.indexFormat=r,i.indexOffset=a,i.mode=o,i.id=s,i.boneNames=void 0===h?[]:h,i.rootBoneName=void 0===l?"":l,i.inverseBindMatrices=void 0===c?[]:c,i.binaryData=void 0===f?[]:f;var d=new hv;d.vertexCount=u.vertexCount,d.channels=[];for(var p,m=n(u.channels);!(p=m()).done;){var v=p.value,y=new hp(v.semantic,v.offset,v.format,v.dimension,v.normalize);d.channels.push(y)}i.vertexData=d;for(var g,x=[],b=n(t.subMeshes);!(g=b()).done;){var T=g.value,E=new hf(T.offset,T.indexCount,T.vertexCount);x.push(E)}return i.subMeshes=x,hh.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,a=new ha(t),o=hy.getRootAsFBGeometryData(a),s={vertexCount:0,channels:[]},u=o.vertexData();if(u){s.vertexCount=u.vertexCount();for(var h=0;h<u.channelsLength();h++){var l,c=u.channels(h);if(c){var f={semantic:null!=(l=c.semantic())?l:"",offset:c.offset(),format:c.format(),dimension:c.dimension(),normalize:c.normalize()};s.channels.push(f)}}}for(var d=[],p=0;p<o.subMeshesLength();p++){var m=o.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<o.boneNamesLength();g++){var x=o.boneNames(g);y.push(x)}var b=o.inverseBindMatricesArray();return{vertexData:s,indexFormat:o.indexFormat(),indexOffset:o.indexOffset(),subMeshes:d,mode:o.mode(),buffer:null!=(e=o.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=o.rootBoneName())?i:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(r=o.binaryDataArray())?r:void 0,id:null!=(n=o.id())?n:"",dataType:es.Geometry}},t}(),hb=function(){function t(){this.renderErrors=new Set,this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new ug(this),this.emptyTexture=r8(this),this.transparentTexture=r9(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.findObject=function(t){return ir(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,a=i.items,o=i.materials,s=i.shaders,u=i.geometries,h=i.components,l=i.animations,c=i.bins,f=void 0===c?[]:c,d=i.miscs,p=i.compositions,m=n(p);!(e=m()).done;){var v=e.value;this.addEffectsObjectData(v)}for(var y,g=n(void 0===a?[]:a);!(y=g()).done;){var x=y.value;u4(x.renderLevel,t.renderLevel)||(x.components=[],x.type=tj.null),this.addEffectsObjectData(x)}for(var b,T=n(void 0===o?[]:o);!(b=T()).done;){var E=b.value;this.addEffectsObjectData(E)}for(var _,C=n(void 0===s?[]:s);!(_=C()).done;){var S=_.value;this.addEffectsObjectData(S)}for(var A,w=n(void 0===u?[]:u);!(A=w()).done;){var R=A.value;this.addEffectsObjectData(R)}for(var I,M=n(void 0===h?[]:h);!(I=M()).done;){var O=I.value;this.addEffectsObjectData(O)}for(var P,N=n(void 0===l?[]:l);!(P=N()).done;){var F=P.value;this.addEffectsObjectData(F)}for(var L,V=n(void 0===d?[]:d);!(L=V()).done;){var D=L.value;this.addEffectsObjectData(D)}for(var k=0;k<f.length;k++){var z=f[k],U=t.bins[k];if(z.dataType===es.BinaryAsset)z.buffer=U,z.id&&this.addEffectsObjectData(z);else{var B=new hx;B.deserializeFromBinary(new Uint8Array(U));for(var G,j=n(B.exportObjectDatas);!(G=j()).done;){var X=G.value;this.addEffectsObjectData(X)}}}for(var H,W=n(void 0===r?[]:r);!(H=W()).done;){var Y=H.value;this.addEffectsObjectData(Y)}},e.createVFXItems=function(t){var e=this;return i(function(){var i,r,a,o;return u(this,function(s){for(i=n(t.jsonScene.items);!(r=i()).done;)("ECS"===(o=(a=r.value).type)||"camera"===o||o===tj.sprite||o===tj.particle||o===tj.mesh||o===tj.skybox||o===tj.light||o===tj.tree||o===tj.interact||o===tj.camera)&&e.database&&e.assetLoader.loadGUID(a);return[2]})})()},e.addTexture=function(t){this.destroyed||eD(this.textures,t)},e.removeTexture=function(t){this.destroyed||ek(this.textures,t)},e.addMaterial=function(t){this.destroyed||eD(this.materials,t)},e.removeMaterial=function(t){this.destroyed||ek(this.materials,t)},e.addGeometry=function(t){this.destroyed||eD(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||ek(this.geometries,t)},e.addMesh=function(t){this.destroyed||eD(this.meshes,t)},e.removeMesh=function(t){this.destroyed||ek(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||eD(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||ek(this.renderPasses,t)},e.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass "+this.renderPasses.length),this.meshes.length>0&&t.push("Mesh "+this.meshes.length),this.geometries.length>0&&t.push("Geom "+this.geometries.length),this.textures.length>0&&t.push("Tex "+this.textures.length),t.length>0&&e8.warn("Release GPU memory: "+t.join(", ")+"."),this.renderPasses.forEach(function(t){return t.dispose()}),this.meshes.forEach(function(t){return t.dispose()}),this.geometries.forEach(function(t){return t.dispose()}),this.materials.forEach(function(t){return t.dispose()}),this.textures.forEach(function(t){return t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},rv(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),hT=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=iW(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e=0,i=this.tickers.length;e<i;e++)(0,this.tickers[e])(this.dt)}}},e.add=function(t){if("function"!=typeof t)throw Error("The tick object must implement the tick method.");this.tickers.push(t)},rv(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();im("camera",aV,t.VFXItem),im("text",um,t.VFXItem),im("sprite",oV,t.VFXItem),im("particle",sW,t.VFXItem),im("cal",sY,t.VFXItem),im("interact",aj,t.VFXItem),e8.info("Core version: 2.6.5.");var hE=((ew={})[rw.RGBA]=34842,ew[rw.RGB]=34843,ew[rw.ALPHA]=33325,ew[rw.RED]=33325,ew[rw.LUMINANCE_ALPHA]=33327,ew[rw.LUMINANCE]=33325,ew),h_=((eR={})[rw.RGBA]=34836,eR[rw.RGB]=34837,eR[rw.ALPHA]=33326,eR[rw.RED]=33326,eR[rw.LUMINANCE_ALPHA]=33328,eR[rw.LUMINANCE]=33326,eR),hC=function(e){function r(t,i){var r;return(r=e.call(this,t)||this).initialized=!1,i&&r.fromData(i),r}ib(r,e);var n=r.prototype;return n.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},n.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,i=this.source,r=i.target,n=void 0===r?e.TEXTURE_2D:r,a=i.name;this.textureBuffer=e.createTexture(),hI(this.textureBuffer,a),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},n.clone=function(){var t=new r(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},n.release=function(){switch(this.source.sourceType){case t.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case t.TextureSourceType.data:delete this.source.data;break;case t.TextureSourceType.compressed:case t.TextureSourceType.mipmaps:delete this.source.mipmaps}},n.update=function(e){var i,r,n,a,o,s=this;if(!this.pipelineContext||!this.textureBuffer){this.width=0,this.height=0;return}var u=this.target,h=this.source,l=this.pipelineContext.gl,c=this.engine.gpuCapability.detail,f=h.sourceType,d=h.data,p=h.cube,m=h.image,v=h.video,y=h.mipmaps,g=h.mipmaps,x=e.data,b=e.cube,T=e.generateMipmap,E=e.mipmaps,_=h.format,C=h.type,S=h.internalFormat,A=0,w=0;(this.bind(f===t.TextureSourceType.video),C===rw.HALF_FLOAT?((C=c.halfFloatTexture)||e8.error("Half float texture is not support."),rM(l)&&S===_&&(_===rw.LUMINANCE&&(_=rw.RED),S=hE[_]),c.halfFloatLinear||(h.minFilter=h.magFilter=l.NEAREST,e8.warn("Half float linear not support, change to NEAREST."))):C!==l.FLOAT||((C=c.floatTexture)||e8.error("Float texture is not support."),rM(l)&&S===_&&(_===rw.LUMINANCE&&(_=rw.RED),S=h_[_]),c.floatLinear||(h.minFilter=l.NEAREST,h.magFilter=l.NEAREST,e8.warn("Float linear not support, change to NEAREST."))),void 0===h.premultiplyAlpha&&(h.premultiplyAlpha=!1),l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,h.premultiplyAlpha),void 0===h.flipY&&(h.flipY=!1),l.pixelStorei(l.UNPACK_FLIP_Y_WEBGL,h.flipY),f===t.TextureSourceType.framebuffer)?x&&(A=null!=(i=x.width)?i:0,w=null!=(r=x.height)?r:0,A&&w&&(this.width!==A||this.height!==w)&&l.texImage2D(u,0,S,A,w,0,_,C,null)):f===t.TextureSourceType.data?u===l.TEXTURE_CUBE_MAP?b.forEach(function(t,e){var i=s.texImage2DData(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,C,t),r=i[0],n=i[1];A=Math.max(r,A),w=Math.max(n,w)}):(A=(n=this.texImage2DData(l,u,0,S,_,C,d))[0],w=n[1]):f===t.TextureSourceType.image||f===t.TextureSourceType.video?(u===l.TEXTURE_CUBE_MAP?p.forEach(function(t,e){var i=s.texImage2D(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,C,t),r=i[0],n=i[1];A=Math.max(r,A),w=Math.max(n,w)}):u===l.TEXTURE_2D&&(A=(a=this.texImage2D(l,u,0,S,_,C,null!=m?m:v))[0],w=a[1]),T&&(hS(A)&&hS(w)||rM(l))&&l.generateMipmap(u)):f===t.TextureSourceType.mipmaps?u===l.TEXTURE_2D?y.forEach(function(t,e){if(o="data"in t?s.texImage2DData(l,u,e,S,_,C,t):s.texImage2D(l,u,e,S,_,C,t),0===e){var i;A=(i=o)[0],w=i[1]}}):u===l.TEXTURE_CUBE_MAP&&g.forEach(function(t,e){t.forEach(function(t,i){if(o="data"in t?s.texImage2DData(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,S,_,C,t):s.texImage2D(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,S,_,C,t),0===e){var r;A=(r=o)[0],w=r[1]}})}):f===t.TextureSourceType.compressed&&E&&0!==E.length&&(A=E[0].width,w=E[0].height,E.forEach(function(t,e){l.compressedTexImage2D(u,e,S,t.width,t.height,0,t.data)})),this.width=A,this.height=w,this.setTextureFilters(l,u,h)},n.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=i.wrapS,a=void 0===n?t.CLAMP_TO_EDGE:n,o=i.wrapT,s=void 0===o?t.CLAMP_TO_EDGE:o,u=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&u.setTextureAnisotropic(t,this.target,void 0===r?4:r);var h=rM(t)||hS(this.width)&&hS(this.height),l=i.magFilter?i.magFilter:t.NEAREST,c=i.minFilter?i.minFilter:t.NEAREST;h||c!==t.LINEAR_MIPMAP_LINEAR&&c!==t.LINEAR_MIPMAP_NEAREST&&c!==t.NEAREST_MIPMAP_LINEAR&&c!==t.NEAREST_MIPMAP_NEAREST||(c=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,c),t.texParameteri(e,t.TEXTURE_MAG_FILTER,l),t.texParameteri(e,t.TEXTURE_WRAP_S,h?a:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,h?s:t.CLAMP_TO_EDGE)},n.fromData=function(t){e.prototype.fromData.call(this,t);var i=this.assembleOptions(t),r=i.sourceType,n=i.sourceFrom,a=i.name;this.source=i,this.sourceType=r,this.sourceFrom=n,this.name=void 0===a?"":a,this.guid=t.id},n.texImage2D=function(e,i,r,n,a,o,s){var u,h=this,l=this.source,c=l.sourceType,f=l.minFilter,d=l.magFilter,p=l.wrapS,m=l.wrapT,v=null!=(u=this.engine.gpuCapability.detail.maxTextureSize)?u:2048,y=s;if(c!==t.TextureSourceType.video){var g=f!==e.NEAREST||d!==e.NEAREST||p!==e.CLAMP_TO_EDGE||m!==e.CLAMP_TO_EDGE;(g=g||s.width>v||s.height>v)&&setTimeout(function(){y=h.resizeImage(s)})}e.texImage2D(i,r,n,a,o,y);var x=[y.width,y.height];return c===t.TextureSourceType.video?[s.videoWidth,s.videoHeight]:x},n.texImage2DData=function(t,e,i,r,n,a,o){var s=o.data,u=o.width,h=o.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return t.texImage2D(e,i,r,u,h,0,n,a,l),[u,h]},n.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;return rM(this.pipelineContext.gl)&&t.width<n&&t.height<n?t:function(t,e,i,r){var n=t.width,a=t.height,o=Math.min(e,i||a$(n)),s=Math.min(e,r||a$(a));if(s!==a||o!==n){var u=uh.getCanvas(),h=u.getContext("2d");return u.width=o,u.height=s,null==h||h.drawImage(t,0,0,n,a,0,0,o,s),e8.warn("Image resize from "+n+"x"+a+" to "+o+"x"+s+"."),u}}(t,n,e,i)||t},n.reloadData=function(){var t=this;return i(function(){return u(this,function(e){switch(e.label){case 0:if(!t.offloaded)return[3,2];return[4,ni().reload(t)];case 1:e.sent(),e.label=2;case 2:return[2]}})})()},n.offloadData=function(){if(this.initialized&&ni().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},n.uploadCurrentVideoFrame=function(){var e=this;return i(function(){return u(this,function(i){return e.source.sourceType===t.TextureSourceType.video&&e.source.video&&e.initialized?(e.update({video:e.source.video}),[2,!0]):[2,!1]})})()},n.updateSource=function(t){this.source=this.assembleOptions(iB({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},n.restore=function(){},n.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){e8.error("This texture has been destroyed.")},this.initialize=is,void 0!==this.engine&&this.engine.removeTexture(this)},r}(r4);function hS(t){return(t&t-1)==0&&0!==t}var hA=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return rM(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),hI(e,t),e},e.bindVertexArray=function(t){if(rM(this.gl))this.gl.bindVertexArray(t);else{var e;null==(e=this.vaoExt)||e.bindVertexArrayOES(t)}},e.dispose=function(){if(rM(this.gl))this.gl.deleteVertexArray(this.vao);else{var t;null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)}},t}(),hw=1,hR=function(){function e(e){this.engine=e,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var i={width:1,height:1,data:new Uint8Array([255])},r=e.getGLPipelineContext(),n=r.gl;this.gl=n,this.pipelineContext=r,this.emptyTexture2D=new hC(e,{data:i,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new hC(e,{target:n.TEXTURE_CUBE_MAP,cube:[i,i,i,i,i,i],sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+hw,hw++}var i=e.prototype;return i.copy2=function(t,e){var i=this.gl;if(i){this.sourceFbo||(this.sourceFbo=i.createFramebuffer()),this.targetFbo||(this.targetFbo=i.createFramebuffer());var r=this.pipelineContext;r.bindFramebuffer(i.FRAMEBUFFER,this.sourceFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t.textureBuffer,0),r.bindFramebuffer(i.FRAMEBUFFER,this.targetFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.textureBuffer,0),r.bindFramebuffer(i.READ_FRAMEBUFFER,this.sourceFbo),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?i.NEAREST:i.LINEAR;i.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),i.COLOR_BUFFER_BIT,n),r.bindFramebuffer(i.FRAMEBUFFER,null),r.bindFramebuffer(i.READ_FRAMEBUFFER,null),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,null)}},i.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},i.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&eD(this.renderbuffers,t),e},i.resize=function(t,e){var i=this.gl;(i&&i.drawingBufferWidth!==t||i.drawingBufferHeight!==e)&&(i.canvas.width=t,i.canvas.height=e,i.viewport(0,0,t,e),this.framebuffers.forEach(function(i){var r=i.viewport;i.isCustomViewport||i.resize(r[0],r[1],t*i.viewportScale,e*i.viewportScale)}))},i.drawGeometry=function(t,e,i){if(!this.gl){console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.");return}var r=e.shaderVariant.program;if(r){var n=r.setupAttributes(t),a=this.gl,o=t.indicesBuffer,s=t.drawStart,u=t.drawCount,h=t.mode,l=t.subMeshes;if(l&&l.length){var c,f=l[i];if(u<0)return;s=f.offset,u=o?null!=(c=f.indexCount)?c:0:f.vertexCount}o?a.drawElements(h,u,o.type,null!=s?s:0):a.drawArrays(h,s,u),null==n||n.unbind()}},i.createGLFramebuffer=function(t,e){var i=this.gl.createFramebuffer();if(i)eD(this.framebuffers,t),hI(i,e,e);else throw Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return i},i.createVAO=function(t){return new hA(this.engine,t)},i.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),ek(this.textures,t),delete t.textureBuffer)},i.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},i.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),ek(this.framebuffers,t),delete t.fbo)},i.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),ek(this.renderbuffers,t),delete t.buffer)},i.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.framebuffers.forEach(function(e){return t.deleteGLFramebuffer(e)}),this.framebuffers.length=0,this.renderbuffers.forEach(function(e){return t.deleteGLRenderbuffer(e)}),this.renderbuffers.length=0,this.textures.forEach(function(e){return t.deleteGLTexture(e)}),this.textures.length=0)},i.lost=function(t){e8.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},i.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},rv(e,[{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function hI(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var hM=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var i,r,n=e.name,a=e.data,o=e.elementCount,s=e.target,u=void 0===s?rw.ARRAY_BUFFER:s,h=e.type,l=void 0===h?rw.FLOAT:h,c=e.usage,f=void 0===c?rw.STATIC_DRAW:c,d=null!=(r=null==(i=hO[l])?void 0:i.BYTES_PER_ELEMENT)?r:0;this.target=u,this.type=l,this.usage=f,this.glBuffer=this.createGLBuffer(n),this.bytesPerElement=d,a?this.bufferData(a):o&&this.bufferData(d*o)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return hI(e,t),e},e.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var i=this.pipelineContext.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var i=this.pipelineContext.gl,r=this.target,n=t*this.bytesPerElement,a=n+e.byteLength;i.bindBuffer(r,this.glBuffer),a>this.byteLength&&(this.byteLength=a,i.bufferData(r,a,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!rM(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},rv(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),hO=((eI={})[rw.INT]=Int32Array,eI[rw.FLOAT]=Float32Array,eI[rw.SHORT]=Int16Array,eI[rw.BYTE]=Int8Array,eI[rw.UNSIGNED_BYTE]=Uint8Array,eI[rw.UNSIGNED_INT]=Uint32Array,eI[rw.UNSIGNED_SHORT]=Uint16Array,eI),hP=((eM={})[Uint8Array.BYTES_PER_ELEMENT]=rw.UNSIGNED_BYTE,eM[Uint16Array.BYTES_PER_ELEMENT]=rw.UNSIGNED_SHORT,eM[Uint32Array.BYTES_PER_ELEMENT]=rw.UNSIGNED_INT,eM),hN=1,hF=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}ib(e,t);var i=e.prototype;return i.getOptions=function(){return iB({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;e4(e),e.addGeometry(this);var i=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach(function(e){t.buffers[e]=new hM(i,t.bufferProps[e])}),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(i,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(void 0!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,a=i.target;this.bufferProps[r]={data:e,usage:n,target:a,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(void 0!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(void 0!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&void 0!=r.data){var n=e+i.length;if(r.data.length<n){var a=new i.constructor(n);a.set(r.data),r.data=a,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var o=this.dirtyFlags[t];void 0!==o.start&&(o.start=Math.min(o.start,e)),void 0!==o.end&&(o.end=Math.max(o.end,n-1))}r.data.set(i,e),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(a(t,Uint8Array)||a(t,Uint16Array)||a(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t+e.length;if(this.indices.length<r){var n=new e.constructor(r);n.set(this.indices),this.indices=n,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var a=this.dirtyFlags.index;void 0!==a.start&&(a.start=Math.min(a.start,t)),void 0!==a.end&&(a.end=Math.max(a.end,r-1))}null==(i=this.indices)||i.set(e,t),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*ng[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t,e){var i=hP[e.BYTES_PER_ELEMENT];return new hM(t,{data:e,target:rw.ELEMENT_ARRAY_BUFFER,type:i,name:""+this.name+"##index"})},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach(function(n){var a,o,s=t.dirtyFlags[n];if("index"==n)a=t.indicesBuffer,o=r;else{var u=e[n].dataSource;a=t.buffers[u],o=i[u].data}if((s.dirty||s.discard)&&a&&o){if(s.discard)a.bufferData(o);else if(void 0!==s.start&&void 0!==s.end){var h=s.start*o.BYTES_PER_ELEMENT+o.byteOffset,l=s.end-s.start+1,c=new o.constructor(o.buffer,h,l);a.bufferSubData(s.start,c)}s.start=Number.POSITIVE_INFINITY,s.end=0,s.dirty=s.discard=!1}}),Object.keys(this.attributesReleasable).forEach(function(r){var n=t.attributesReleasable[r],a=e[r].dataSource;i[a]&&n&&(i[a].data=void 0)}),this.indicesReleasable}},i.processProps=function(t){var e=t.drawStart,i=t.drawCount,r=t.mode,n=t.indices,o=t.name,s=void 0===o?"effectsGeometry:"+hN++:o,u=t.bufferUsage,h=void 0===u?rw.STATIC_DRAW:u;this.name=s;var l={},c=[],f={},d={},p={};this.drawStart=void 0===e?0:e,void 0!==i&&(this.drawCount=i),this.mode=isNaN(r)?rw.TRIANGLES:r,Object.keys(t.attributes).forEach(function(e){var i=t.attributes[e],r=i.size,n=i.stride,o=i.offset,s=i.normalize,u=i.type,m=void 0===u?rw.FLOAT:u,v=i.releasable,y=i.data;if(!m||"dataSource"in i||y||(y=nb(m)),y){var g=a(y,Float32Array)?rw.FLOAT:rw.INT;l[e]={data:y,usage:h,target:rw.ARRAY_BUFFER,name:e},f[e]={size:r,stride:n,offset:o,type:null!=m?m:g,normalize:!!s,dataSource:e},p[e]=null!=v&&v,d[e]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=i.dataSource;x&&(f[e]={size:r,stride:n,offset:o,type:m,dataSource:x,normalize:!!s})}c.push(e)}),d.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==n?void 0:n.data,this.indicesReleasable=(null==n?void 0:n.releasable)===!0,this.bufferProps=l,this.attributes=f,this.attributesName=c,this.attributesReleasable=p,this.dirtyFlags=d,this.options=t,this.initialized=!1},i.fromData=function(e){var i,r=this;if(t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes,e.buffer?i=new Uint8Array(function(t){for(var e=atob(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return i.buffer}(e.buffer)):e.binaryData&&(i=e.binaryData),i){var n=e.vertexData.vertexCount;if(this.hasSemantic(e)){var a={mode:rw.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach(function(t){var e,o=null!=(e=hL[t.semantic])?e:t.semantic,s=r.createVertexTypedArray(t,i,n);a.attributes[o]={type:rP(t.format),size:t.dimension,data:s,normalize:t.normalize}}),e.indexFormat!==el.None){var o=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset);a.indices={data:o},a.drawCount=o.length}else a.drawCount=n;this.processProps(a)}else{var s=e.vertexData.channels[0],u=e.vertexData.channels[1],h=e.vertexData.channels[2],l=this.createVertexTypedArray(s,i,n),c=this.createVertexTypedArray(u,i,n),f=this.createVertexTypedArray(h,i,n),d=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset),p={mode:rw.TRIANGLES,attributes:{aPos:{type:rP(s.format),size:3,data:l,normalize:s.normalize},aUV:{type:rP(u.format),size:2,data:c,normalize:u.normalize},aNormal:{type:rP(h.format),size:3,data:f,normalize:h.normalize}}};p.indices={data:d},p.drawCount=d.length,this.processProps(p)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},i.dispose=function(){var t,e=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach(function(t){e.buffers[t].dispose()}),this.buffers={},null==(t=this.indicesBuffer)||t.dispose(),Object.keys(this.vaos).forEach(function(t){var i;null==(i=e.vaos[t])||i.dispose(),e.vaos[t]=void 0}),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},i.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case eh.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case eh.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case eh.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case eh.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case eh.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},i.createIndexTypedArray=function(t,e,i){var r=e.buffer;switch(t){case el.UInt16:return new Uint16Array(r,e.byteOffset+i);case el.UInt32:return new Uint32Array(r,e.byteOffset+i);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,e.byteOffset+i)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach(function(t){t.semantic&&t.semantic.length>0&&(e=!0)}),e},rv(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(nx),hL={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"},hV=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendColor[0]!==e||this.blendColor[1]!==i||this.blendColor[2]!==r||this.blendColor[3]!==n)&&(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendFunctionParameters[0]!==e||this.blendFunctionParameters[1]!==i||this.blendFunctionParameters[2]!==r||this.blendFunctionParameters[3]!==n)&&(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];(this.blendEquationParameters[0]!==e||this.blendEquationParameters[1]!==i)&&(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){(this.depthRange[0]!==t[0]||this.depthRange[1]!==t[1])&&(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){(this.polygonOffset[0]!==t[0]||this.polygonOffset[1]!==t[1])&&(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){(this.stencilMask[0]!==t[0]||this.stencilMask[1]!==t[1])&&(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){(this.stencilRef[0]!==t[0]||this.stencilRef[1]!==t[1])&&(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){(this.stencilFunc[0]!==t[0]||this.stencilFunc[1]!==t[1])&&(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){(this.stencilOpFail[0]!==t[0]||this.stencilOpFail[1]!==t[1])&&(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){(this.stencilOpZFail[0]!==t[0]||this.stencilOpZFail[1]!==t[1])&&(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){(this.stencilOpZPass[0]!==t[0]||this.stencilOpZPass[1]!==t[1])&&(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[rw.ONE,rw.ONE_MINUS_SRC_ALPHA,rw.ONE,rw.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[rw.FUNC_ADD,rw.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=rw.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[rw.ALWAYS,rw.ALWAYS],this.stencilOpFail=[rw.KEEP,rw.KEEP],this.stencilOpZFail=[rw.KEEP,rw.KEEP],this.stencilOpZPass=[rw.KEEP,rw.KEEP],this.culling=!1,this.frontFace=rw.CCW,this.cullFace=rw.FRONT},e.apply=function(t){if(t.toggle(rw.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(rw.BLEND,this.blending),t.toggle(rw.DEPTH_TEST,this.depthTest),t.toggle(rw.STENCIL_TEST,this.stencilTest),t.toggle(rw.CULL_FACE,this.culling),t.toggle(rw.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(rw.BACK,this.stencilMask[1]),t.stencilMaskSeparate(rw.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(rw.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(rw.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(rw.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(rw.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this.blendColor,i=this.blendEquationParameters,r=this.blendFunctionParameters;t.blendColor(e[0],e[1],e[2],e[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(r[0],r[1],r[2],r[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),hD=function(e){function i(i,r){var n;return(n=e.call(this,i,r)||this).floats={},n.ints={},n.vector2s={},n.vector3s={},n.vector4s={},n.colors={},n.quaternions={},n.matrices={},n.matrice3s={},n.textures={},n.floatArrays={},n.vector4Arrays={},n.matrixArrays={},n.samplers=[],n.uniforms=[],n.uniformDirty=!0,n.macrosDirty=!0,n.glMaterialState=new hV,r&&(n.shader=new t.Shader(i),n.shader.shaderData=iB({},r.shader,{id:iu(),dataType:es.Shader})),n}ib(i,e);var r=i.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach(function(e){var i=t.textures[e];if(!ie(i.initialize)){e8.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.");return}i.initialize()}),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.glMaterialState.apply(t)},r.use=function(t,e){var i=t.engine.getGLPipelineContext(),r=this.shaderVariant;if(!r.program){null==(a=this.engine)||a.renderErrors.add(Error("Shader program is not initialized."));return}if(r.program.bind(),this.setupStates(i),e){for(var a,o,s,u=n(e.uniforms);!(s=u()).done;)o=s.value,this.checkUniform(o);for(var h,l=n(e.samplers);!(h=l()).done;)o=h.value,this.samplers.includes(o)||(this.samplers.push(o),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(o in e.floats)r.setFloat(o,e.floats[o]);for(o in e.ints)r.setInt(o,e.ints[o]);for(o in e.vector4s)r.setVector4(o,e.vector4s[o]);for(o in e.vector3s)r.setVector3(o,e.vector3s[o]);for(o in e.matrices)r.setMatrix(o,e.matrices[o])}for(o in this.textures)this.textures[o].textureBuffer||this.textures[o].initialize();for(o in this.floats)r.setFloat(o,this.floats[o]);for(o in this.ints)r.setInt(o,this.ints[o]);for(o in this.floatArrays)r.setFloats(o,this.floatArrays[o]);for(o in this.textures)r.setTexture(o,this.textures[o]);for(o in this.vector2s)r.setVector2(o,this.vector2s[o]);for(o in this.vector3s)r.setVector3(o,this.vector3s[o]);for(o in this.vector4s)r.setVector4(o,this.vector4s[o]);for(o in this.colors)r.setColor(o,this.colors[o]);for(o in this.quaternions)r.setQuaternion(o,this.quaternions[o]);for(o in this.matrices)r.setMatrix(o,this.matrices[o]);for(o in this.matrice3s)r.setMatrix3(o,this.matrice3s[o]);for(o in this.vector4Arrays)r.setVector4Array(o,this.vector4Arrays[o]);for(o in this.matrixArrays)r.setMatrixArray(o,this.matrixArrays[o])},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=n(e);!(i=r()).done;){var a=i.value;this.vector4Arrays[t].push(a.x,a.y,a.z,a.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=n(e);!(i=r()).done;)for(var a=i.value,o=0;o<16;o++)this.matrixArrays[t].push(a.elements[o])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var e=t||this.props,r=this.engine;e4(r);var n=new i(r,e);return n.glMaterialState=Object.assign(new hV,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},r.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i,r,n=iB({},t);void 0!==t.stringTags.RenderType&&(this.blending=t.stringTags.RenderType===tW.Transparent),void 0!==t.floats.ZTest&&(this.depthTest=0!==t.floats.ZTest),void 0!==t.floats.ZWrite&&(this.depthMask=0!==t.floats.ZWrite);var a=t.stringTags.RenderFace;for(i in a===tY.Front?(this.culling=!0,this.cullFace=rw.BACK):a===tY.Back?(this.culling=!0,this.cullFace=rw.FRONT):this.culling=!1,n.floats)this.setFloat(i,n.floats[i]);for(i in n.ints)this.setInt(i,n.ints[i]);for(i in n.vector4s){var o=n.vector4s[i];this.setVector4(i,new rb(o.x,o.y,o.z,o.w))}for(i in n.colors){var s=n.colors[i];this.setColor(i,new rE(s.r,s.g,s.b,s.a))}for(i in n.textures){var u=n.textures[i],h=this.engine.findObject(u.texture);this.setTexture(i,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(i+"_ST",new rb(c.x,c.y,l.x,l.y))}if(t.shader){var f=this.engine.findObject(t.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(r=t.stringTags)?r:{},this.initialized=!1},r.toData=function(){var t=this.defination;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=es.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var a in this.textures){t.textures[a]||(t.textures[a]={texture:this.textures[a]});var o=t.textures[a],s=this.getVector4(a+"_ST");s&&(o.scale={x:s.x,y:s.y},o.offset={x:s.z,y:s.w},delete t.vector4s[a+"_ST"])}return t},r.cloneUniforms=function(t){var e;for(e in t.floats)this.setFloat(e,t.floats[e]);for(e in t.ints)this.setInt(e,t.ints[e]);for(e in t.floatArrays)this.setFloats(e,t.floatArrays[e]);for(e in t.textures)this.setTexture(e,t.textures[e]);for(e in t.vector2s)this.setVector2(e,t.vector2s[e]);for(e in t.vector3s)this.setVector3(e,t.vector3s[e]);for(e in t.vector4s)this.setVector4(e,t.vector4s[e]);for(e in t.colors)this.setColor(e,t.colors[e]);for(e in t.quaternions)this.setQuaternion(e,t.quaternions[e]);for(e in t.matrices)this.setMatrix(e,t.matrices[e]);for(e in t.vector4Arrays){for(var i=[],r=0;r<t.vector4Arrays[e].length;r+=4)i.push(new rb(t.vector4Arrays[e][r],t.vector4Arrays[e][r+1],t.vector4Arrays[e][r+2],t.vector4Arrays[e][r+3]));this.setVector4Array(e,i)}for(e in t.matrixArrays){for(var n=[],a=0;a<t.matrixArrays[e].length;a+=16){for(var o=r_.fromIdentity(),s=0;s<16;s++)o.elements[s]=t.matrixArrays[e][a+s];n.push(o)}this.setMatrixArray(e,n)}},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(e){var i,r=this;this.destroyed||(null==(i=this.shaderVariant)||i.dispose(),(null==e?void 0:e.textures)!==t.DestroyOptions.keep&&Object.keys(this.textures).forEach(function(t){var e=r.textures[t];e!==r.engine.emptyTexture&&e.dispose()}),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=is,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},rv(i,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask[0]},set:function(t){this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(no),hk=function(){function e(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}var i=e.prototype;return i.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},i.copyTexture=function(e,i){this.renderer&&(e.initialize(),i.initialize(),i.updateSource({sourceType:t.TextureSourceType.framebuffer,data:{width:i.getWidth()||e.getWidth(),height:i.getHeight()||e.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(e,i):this.copy1(e,i))},i.copy2=function(t,e){var i=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(i)},i.copy1=function(t,e){var i=this.copyRenderPass;if(i){var r=this.renderer;if(r){var n=i.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),r.glRenderer.resetColorAttachments(n,[e]),i.meshes[0].material.setTexture("uTex",t),r.renderRenderPass(i)}}},i.createCopyRenderPass=function(){var e="mri-copy-mesh",i={texture:{format:rw.RGBA}},r=this.renderer.engine,n=new hF(r,{name:e,mode:rw.TRIANGLE_STRIP,attributes:{aPos:{type:rw.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=r.gpuCapability.level,o=new hD(r,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===a?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1}});o.blending=!1,o.depthTest=!1,o.culling=!1;var s=new nR(r,{name:e,geometry:n,material:o,priority:0});return new hz(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[i],meshes:[s]})},i.dispose=function(){if(this.renderer){var t;null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0}},e}(),hz=function(t){function e(){return t.apply(this,arguments)}ib(e,t);var i=e.prototype;return i.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},i.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(nO),hU=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],e4(t),this.gl=rC(t,e,i),this.contextLostListener=function(t){for(var e,i,a=n(r.lostHandlers);!(i=a()).done;)i.value.lost(t);null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,a=n(r.restoreHandlers);!(i=a()).done;)i.value.restore();null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),hB=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new n3(e),i}ib(e,t);var i=e.prototype;return i.dispose=function(){this.destroyed||t.prototype.dispose.call(this)},i.getGLRenderer=function(){return this.renderer},i.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},i.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(hb),hG=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}ib(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},i.setSize=function(t,e){if(!this.initialized){e8.error("Can't set size for uninitialized render buffer.");return}if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer,r=i.gl;i.pipelineContext.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):e8.error("Invalid render buffer size: "+t+"x"+e+".")}},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=is},e}(n1),hj=1,hX=function(e){function i(i,r){(n=e.call(this)||this).attachmentTextures=[];var n,a,o=i.depthStencilAttachment,s=i.viewport,u=i.isCustomViewport,h=i.storeAction,l=i.viewportScale,c=i.name,f=void 0===c?"GLFramebuffer"+hj++:c;return n.renderer=r,n.engine=r.engine,n.depthStencilStorageType=null!=(a=null==o?void 0:o.storageType)?a:t.RenderPassAttachmentStorageType.none,n.viewport=s,n.isCustomViewport=!!u,n.viewportScale=void 0===l?1:l,n.name=f,n.storeAction=h,n.updateProps(i),n}ib(i,e);var r=i.prototype;return r.getDepthTexture=function(){return this.depthTexture},r.getStencilTexture=function(){return this.stencilTexture},r.getColorTextures=function(){return this.colorTextures},r.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach(function(e){e.initialize(),eD(t.attachmentTextures,e.textureBuffer)}),this.stencilTexture&&eD(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&eD(this.attachmentTextures,this.depthTexture.textureBuffer)},r.updateProps=function(e){var i,r,n=this.renderer,o=this.engine.gpuCapability,s=null!=(r=e.depthStencilAttachment)?r:{storageType:t.RenderPassAttachmentStorageType.none},u=e.attachments.length>0,h=!0;if(this.externalStorage=!1,e.attachments.length>1&&!o.detail.drawBuffers)throw Error("Multiple color attachments not support.");var l=null==(i=e.depthStencilAttachment)?void 0:i.texture,c=o.detail.readableDepthStencilTextures,f=s.storageType,d=s.storage;if(this.colorTextures=e.attachments.slice(),!u&&f!==t.RenderPassAttachmentStorageType.none)throw Error("Use depth stencil attachment without color attachments.");switch(u&&(this.fbo=n.glRenderer.createGLFramebuffer(this,this.name)),f){case t.RenderPassAttachmentStorageType.depth_stencil_opaque:if(d){if(a(d,hG))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth stencil attachment storage.")}else this.depthStencilRenderbuffer=new hG({format:rw.DEPTH_STENCIL,attachment:rw.DEPTH_STENCIL_ATTACHMENT,storageType:f},n.glRenderer);h=!1;break;case t.RenderPassAttachmentStorageType.depth_16_opaque:if(d){if(a(d,hG))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth attachment storage.")}else this.depthStencilRenderbuffer=new hG({attachment:rw.DEPTH_ATTACHMENT,format:rw.DEPTH_COMPONENT16,storageType:f},n.glRenderer);break;case t.RenderPassAttachmentStorageType.stencil_8_opaque:if(d){if(a(d,hG))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid stencil attachment storage.")}else this.depthStencilRenderbuffer=new hG({attachment:rw.STENCIL_ATTACHMENT,format:rw.STENCIL_INDEX8,storageType:f},n.glRenderer);break;case t.RenderPassAttachmentStorageType.depth_16_texture:if(!c)throw Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=l?l:new hC(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:rw.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:rw.UNSIGNED_SHORT,name:""+this.name+"##depthTex"}),this.depthTexture.initialize();break;case t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!c)throw Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=l?l:new hC(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:rw.DEPTH_STENCIL,internalFormat:o.internalFormatDepth24_stencil8,type:o.UNSIGNED_INT_24_8,name:""+this.name+"##dpthStclTex"}),this.depthTexture.initialize(),h=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,h),this.updateAttachmentTextures()},r.getStoreAttachments=function(e,i){var r=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(e&&rM(r)&&n>0){var a=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&eD(a,i?r.DEPTH_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&eD(a,i?r.STENCIL_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var o=0;o<n;o++)eD(a,r["COLOR_ATTACHMENT"+o]);return a}},r.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;rM(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},r.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,i=this.renderer.pipelineContext,r=this.viewport,n=r[0],a=r[1],o=r[2],s=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,a,o,s);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(i.textureUnitDict).forEach(function(e){var r=i.textureUnitDict[e];r&&r!==u&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())});for(var h=0;h<4;h++)i.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var l=this.depthStencilRenderbuffer,c=this.depthTexture,f=this.stencilTexture;if(i.activeTexture(e.TEXTURE0),l)l.setSize(o,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,l.attachment,e.RENDERBUFFER,l.buffer);else if(c){c.source.data={width:o,height:s},c.update({data:{width:o,height:s,data:new Uint16Array(0)}});var d=c&&f?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,d,e.TEXTURE_2D,c.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var p=e.checkFramebufferStatus(e.FRAMEBUFFER);if(p!==e.FRAMEBUFFER_COMPLETE)throw Error("Framebuffer failed. gl status="+p+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+".");this.ready=!0}}},r.resetColorTextures=function(t){var e=this.renderer.glRenderer.gl,i=this.engine.gpuCapability,r=this.viewport,a=[];if(t){for(var o,s=n(t);!(o=s()).done;)o.value.initialize();this.colorTextures=t.slice()}this.renderer.pipelineContext.activeTexture(e.TEXTURE0),this.colorTextures.forEach(function(t,n){var o={width:r[2],height:r[3],data:new Uint8Array(0)};t.update({data:o}),i.framebufferTexture2D(e,e.FRAMEBUFFER,n,e.TEXTURE_2D,t.textureBuffer),a.push(!0)}),i.drawBuffers(e,a),this.updateAttachmentTextures()},r.resize=function(t,e,i,r){var n=this.viewport,a=n[0],o=n[1],s=n[2],u=n[3];(a!==t||o!==e||s!==i||u!==r)&&(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},r.dispose=function(e){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force;n!==t.RenderPassDestroyAttachmentType.force&&(n!==t.RenderPassDestroyAttachmentType.keepExternal||this.externalStorage)||(null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose()),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},rv(i,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),i}(n5),hH=((eO={})[rw.FLOAT]=1,eO[rw.INT]=1,eO[rw.UNSIGNED_INT]=1,eO[rw.SHORT]=1,eO[rw.BOOL]=1,eO[rw.UNSIGNED_SHORT]=1,eO[rw.FLOAT_VEC2]=2,eO[rw.FLOAT_VEC3]=3,eO[rw.FLOAT_VEC4]=4,eO[rw.FLOAT_MAT2]=4,eO[rw.FLOAT_MAT3]=9,eO[rw.FLOAT_MAT4]=16,eO[rw.FLOAT_MAT2x3]=6,eO[rw.FLOAT_MAT2x4]=8,eO[rw.FLOAT_MAT4x3]=12,eO[rw.FLOAT_MAT4x2]=8,eO[rw.FLOAT_MAT3x4]=12,eO[rw.FLOAT_MAT3x2]=6,eO[rw.INT_VEC2]=2,eO[rw.INT_VEC3]=3,eO[rw.INT_VEC4]=4,eO[rw.UNSIGNED_INT_VEC2]=2,eO[rw.UNSIGNED_INT_VEC3]=3,eO[rw.UNSIGNED_INT_VEC4]=4,eO[rw.BOOL_VEC2]=2,eO[rw.BOOL_VEC3]=3,eO[rw.BOOL_VEC4]=4,eO),hW=hK(Float32Array),hY=hK(Int32Array),hZ=hK(Uint8Array);function hq(t){return function(e,i,r,n){var a={start:i[1],dirty:!0};if(i[2]>1){if(e.length){for(var o=n[1]||e.length,s=i[4]/t.BYTES_PER_ELEMENT,u=a.buffer=new t(o*s),h=n[0]||0,l=0;l<o;l++)u[l*s]=e[l+h];a.start+=h*s}}else a.buffer=new t([e]);return a}}function hK(t){return function(e,i,r,n){for(var a=i[8],o=i[2],s=i[5],u=1===o?a:i[4],h=s?u/s:1,l=u/t.BYTES_PER_ELEMENT/h,c=a/t.BYTES_PER_ELEMENT/l,f=hH[i[0]],d=f/h,p=(n[0]||0)*f,m=n[1]?h*n[1]:c,v=new t(l*m),y={start:i[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=p;g<m;g++){for(var T=0;T<d;T++)v[x+T]=e[b+T];x+=l,b+=d}return y}}function hQ(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var a=e[n],o=0;o<a.length;o++)r=Math.imul(31,r)+a.charCodeAt(o)|0;return r}(eP={})[rw.FLOAT]=hq(Float32Array),eP[rw.INT]=hq(Int32Array),eP[rw.UNSIGNED_INT]=hq(Uint32Array),eP[rw.SHORT]=hq(Int16Array),eP[rw.BOOL]=hq(Uint8Array),eP[rw.UNSIGNED_SHORT]=hq(Uint16Array),eP[rw.FLOAT_VEC2]=hW,eP[rw.FLOAT_VEC3]=hW,eP[rw.FLOAT_VEC4]=hW,eP[rw.FLOAT_MAT2]=hW,eP[rw.FLOAT_MAT3]=hW,eP[rw.FLOAT_MAT4]=hW,eP[rw.FLOAT_MAT2x3]=hW,eP[rw.FLOAT_MAT2x4]=hW,eP[rw.FLOAT_MAT4x3]=hW,eP[rw.FLOAT_MAT4x2]=hW,eP[rw.FLOAT_MAT3x4]=hW,eP[rw.FLOAT_MAT3x2]=hW,eP[rw.INT_VEC2]=hY,eP[rw.INT_VEC3]=hY,eP[rw.INT_VEC4]=hY,eP[rw.UNSIGNED_INT_VEC2]=hY,eP[rw.UNSIGNED_INT_VEC3]=hY,eP[rw.UNSIGNED_INT_VEC4]=hY,eP[rw.BOOL_VEC2]=hZ,eP[rw.BOOL_VEC3]=hZ,eP[rw.BOOL_VEC4]=hZ;var hJ=function(){function t(t,e,i){var r=this;this.engine=t,this.program=e,this.id=i,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),rM(n)&&(function(t,e){for(var i=[],r=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),a=0;a<n;++a)!function(n){var a=t.getActiveUniformBlockName(e,n);e4(a);var o={index:t.getUniformBlockIndex(e,a),usedByVertexShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:a,id:""};o.used=o.usedByVertexShader||o.usedByFragmentShader,i[n]=o;for(var s=o.uniformIndices,u=[],h=0;h<s.length;h++){var l=t.getActiveUniform(e,s[h]).name.replace("[0]","");o.uniforms[l]=[0,0,0,0,0,0,0,h,0],u[h]=l,r.push(l)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach(function(i,r){t.getActiveUniforms(e,s,i).forEach(function(t,e){var i=u[e];o.uniforms[i][r]=+t})});for(var c=0;c<u.length;c++){var f=o.uniforms[u[c]],d=o.uniforms[u[c+1]],p=d?d[1]:o.size;f[8]=p-f[1]}o.id=function(t){var e=t.name,i=t.size,r=t.uniforms,n=t.uniformIndices,a=Object.keys(r).map(function(t){return t+"["+r[t].join(":")+"]"}).join("+");return hQ(""+e+"+",""+i+"+",""+n.length+"+",a)}(o)+""}(a);return{blockSpecs:i,blockUniformNames:r}})(n,e).blockSpecs.forEach(function(t){return r.uniformBlockMap[t.name]=t}),this.pipelineContext.useProgram(null)}var e=t.prototype;return e.bind=function(){this.pipelineContext.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,a=this.pipelineContext.gl;return t.vaos[n]?i=t.vaos[n]:(i=new hA(this.engine,t.name+"-"+n),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach(function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var o=t.buffers[n.dataSource];if(!o)throw Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");o.bind(),a.enableVertexAttribArray(i.loc),a.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}}),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var a=t.getActiveAttrib(e,n);if(a){var o=a.name,s=a.type,u=a.size,h=t.getAttribLocation(e,o);i[o]={type:s,name:o,size:u,loc:h}}}return i},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),h$=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}ib(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i,r=e.slice();t=t.concat(r);for(var n=this.pipelineContext.getUniforms(this.program.program,t),a=0;a<t.length;a++)this.uniformLocations[t[a]]=n[a];for(i=0;i<r.length;i++)null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--);for(i=0;i<r.length;i++){var o=r[i];this.samplerChannels[o]=i}},i.toData=function(){var t=this.defination;t.dataType=es.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(nu),h0=0,h1=function(){function e(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var i=e.prototype;return i.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],a=n(Object.keys(this.cachedShaders));!(i=a()).done;){var o=i.value;this.cachedShaders[o].initialized||r.push(o)}t?r.length?Promise.all(r.map(function(t){return new Promise(function(i){return e.compileShader(e.cachedShaders[t],i)})})).then(t).catch(function(){return 0}):t([]):r.map(function(t){return e.compileShader(e.cachedShaders[t])}),this.shaderAllDone=!0}},i.addShader=function(e,i){var r=[];e.macros&&r.push.apply(r,[].concat(e.macros)),i&&r.push.apply(r,[].concat(i));var n=iB({},e,{vertex:nX.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:e.vertex,macros:r}),fragment:nX.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:e.fragment,macros:r})}),a=this.computeShaderCacheId(n);if(this.cachedShaders[a])return a;this.shaderAllDone=!1;var o=!1;return(n.shared||n.cacheId)&&(o=!0),this.cachedShaders[a]=new h$(this.engine,iB({},n,{vertex:n.vertex,fragment:n.fragment,name:n.name||a,shared:o})),this.cachedShaders[a].id=a,a},i.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},i.compileShader=function(e,i){var r=this,n=e.source,a=n.shared,o=n.vertex,s=n.fragment,u=n.name,h=e.source.cacheId,l=!1;(a||h)&&(l=!0);var c=this.pipelineContext.gl,f={shared:l,status:t.ShaderCompileResultStatus.compiling},d=this.createProgram(c,o,s,f),p=this.glAsyncCompileExt,m=performance.now(),v=function(i){f.status=t.ShaderCompileResultStatus.success,f.compileTime=performance.now()-m,e.program=i,e.initialized=!0,e.pipelineContext=r.pipelineContext,void 0!==r.programMap[e.id]&&console.warn("Find duplicated shader id: "+e.id+"."),r.programMap[e.id]=i},y=function(){if(r.engine.isDestroyed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==i?void 0:i(f);if(e.initialized)return null==i?void 0:i(f);var n=(!i||!p||p&&!0==c.getProgramParameter(f.program,p.COMPLETION_STATUS_KHR))&&d();if(n){if(f.status!==t.ShaderCompileResultStatus.fail){hI(n,u);var a=new hJ(r.engine,n,e.id);if(c.validateProgram(n),c.getProgramParameter(n,c.VALIDATE_STATUS))v(a);else{var h=c.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))||(null==h?void 0:h.includes("Two textures of different types use the same sampler"))?v(a):(f.status=t.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",o,"\nfragment:\n",s),c.deleteProgram(n))}}null==i||i(f)}else i&&requestAnimationFrame(y)};e.compileResult=f,y()},i.computeShaderCacheId=function(t){var e=t.vertex,i=t.fragment,r=t.shared,n=t.cacheId;return r||n?n||"shared_"+hQ(void 0===e?"":e,void 0===i?"":i):"instanced_"+h0++},i.createProgram=function(e,i,r,n){var a=e.createProgram(),o=this.createGLShader(e,e.VERTEX_SHADER,i),s=this.createGLShader(e,e.FRAGMENT_SHADER,r);return a&&o&&s?(e.attachShader(a,o),e.attachShader(a,s),e.linkProgram(a),n.program=a,n.status=t.ShaderCompileResultStatus.compiling,function(){if(n.program=void 0,!e.getProgramParameter(a,e.LINK_STATUS)){console.error("Failed to link program: "+e.getProgramInfoLog(a)+".");var u=h2(e,o,"vertex",i),h=h2(e,s,"fragment",r);n.status=t.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),h&&(n.error=h.error,n.status=h.status)}return a}):(n.status=t.ShaderCompileResultStatus.fail,function(){return null})},i.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=hQ(null!=i?i:""),a=r.get(n);if(a)return a;var o=t.createShader(e);return o&&(t.shaderSource(o,i),t.compileShader(o),r.set(n,o)),o},i.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},i.restore=function(){},i.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach(function(e){t.programMap[e].dispose()}),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},e}();function h2(e,i,r,n){if(!e.getShaderParameter(i,e.COMPILE_STATUS)){var a=e.getShaderInfoLog(i);return console.error("compile "+r+" error: "+a,(null!=n?n:"").split("\n").map(function(t,e){return e+1+" "+t}).join("\n")),{error:a,status:t.ShaderCompileResultStatus.fail}}}var h3=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new h1(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}var e=t.prototype;return e.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=rw.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},e.toggle=function(t,e){e?this.enable(t):this.disable(t)},e.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},e.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},e.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},e.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},e.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.useProgram=function(t){this.set1("useProgram",t)},e.clear=function(t){this.gl.clear(t)},e.clearDepth=function(t){this.set1("clearDepth",t)},e.depthFunc=function(t){this.set1("depthFunc",t)},e.depthMask=function(t){this.set1("depthMask",t)},e.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},e.depthRange=function(t,e){this.set2("depthRange",t,e)},e.clearStencil=function(t){this.set1("clearStencil",t)},e.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},e.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},e.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},e.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},e.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},e.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},e.blendEquation=function(t){this.set1("blendEquation",t)},e.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},e.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},e.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},e.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},e.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},e.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},e.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),(r.x!==e||r.y!==i)&&this.gl[t](r.x=e,r.y=i)},e.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),(n.x!==e||n.y!==i||n.z!==r)&&this.gl[t](n.x=e,n.y=i,n.z=r)},e.set4=function(t,e,i,r,n){var a=this.glCapabilityCache[t];a||(a=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),(a.x!==e||a.y!==i||a.z!==r||a.w!==n)&&this.gl[t](a.x=e,a.y=i,a.z=r,a.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},e.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},e.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},e.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},t}(),h4=function(e){function i(i,r,n){(a=e.call(this)||this).canvas=i,a.temporaryRTs={};var a,o=iB({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},n);a.context=new hU(i,r,o);var s=a.context.gl;return e4(s),a.engine=new hB(s),a.engine.renderer=oB(a),a.pipelineContext=new h3(a.engine,s),a.glRenderer=new hR(a.engine),a.extension=new hk(oB(a)),a.renderingData={currentFrame:{}},a.framebuffer=new hX({storeAction:{},viewport:[0,0,a.width,a.height],attachments:[new hC(a.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:a.width,height:a.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},oB(a)),a}ib(i,e);var r=i.prototype;return r.renderRenderFrame=function(t){t.resource&&t.resource.color_b.initialize(),t.emptyTexture.initialize(),t.transparentTexture.initialize();var e=t._renderPasses;if(this.isDestroyed){console.error("Renderer is destroyed, target: GLRenderer.");return}null==(r=t.renderer.getShaderLibrary())||r.compileAllShaders(),this.setFramebuffer(null),this.clear(t.clearAction);var i=t.camera;this.renderingData.currentFrame=t,this.renderingData.currentCamera=i,this.setGlobalMatrix("effects_MatrixInvV",i.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",i.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",i.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",i.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",i.position),e1(e);for(var r,a,o=n(e);!(a=o()).done;){var s=a.value,u=s.delegate;null==u.willBeginRenderPass||u.willBeginRenderPass.call(u,s,this.renderingData),this.renderRenderPass(s),null==u.didEndRenderPass||u.didEndRenderPass.call(u,s,this.renderingData)}for(var h,l=n(e);!(h=l()).done;)h.value.frameCleanup(this)},r.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},r.renderMeshes=function(t){for(var e,i=this.renderingData.currentPass.delegate,r=n(t);!(e=r()).done;){var a=e.value;null==i.willRenderMesh||i.willRenderMesh.call(i,a,this.renderingData),a.render(this),null==i.didRenderMesh||i.didRenderMesh.call(i,a,this.renderingData)}},r.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},r.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},r.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},r.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},r.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},r.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},r.drawGeometry=function(t,e,i){if(void 0===i&&(i=0),t&&e){e.initialize(),t.initialize(),t.flush();var r=this.renderingData;r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){console.error(t);return}this.glRenderer.drawGeometry(t,e,i)}},r.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.getFramebuffer=function(){return this.framebuffer},r.getTemporaryRT=function(e,i,r,n,a,o){if(this.temporaryRTs[e])return this.temporaryRTs[e];var s,u,h=t.RenderPassAttachmentStorageType.none;a===t.FilterMode.Linear?s=rw.LINEAR:a===t.FilterMode.Nearest&&(s=rw.NEAREST),o===t.RenderTextureFormat.RGBA32?u=rw.UNSIGNED_BYTE:o===t.RenderTextureFormat.RGBAHalf&&(u=rw.HALF_FLOAT),0===n?h=t.RenderPassAttachmentStorageType.none:16===n?h=t.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(h=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var l=new hX({name:e,storeAction:{},viewport:[0,0,i,r],viewportScale:1,isCustomViewport:!0,attachments:[new hC(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:rw.RGBA,format:rw.RGBA,type:u})],depthStencilAttachment:{storageType:h}},this);return this.temporaryRTs[e]=l,l},r.setViewport=function(t,e,i,r){this.pipelineContext.viewport(t,e,i,r)},r.clear=function(e){var i=this.pipelineContext,r=0;if(e.colorAction===t.TextureLoadAction.clear){var n=e.clearColor;n&&i.clearColor(n[0],n[1],n[2],n[3]),i.colorMask(!0,!0,!0,!0),r=rw.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(i.stencilMask(255),i.clearStencil(e.clearStencil||0),r|=rw.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var a=e.clearDepth;i.depthMask(!0),i.clearDepth(Number.isFinite(a)?a:1),r|=rw.DEPTH_BUFFER_BIT}r&&i.clear(r)},r.addLostHandler=function(t){this.context.addLostHandler(t)},r.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},r.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.getWidth=function(){return this.width},r.getHeight=function(){return this.height},r.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},r.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},r.restore=function(){var t=this.context.gl;if(!t)throw Error("Can not restore automatically because losing gl context.");this.engine.gpuCapability=new n3(t),this.engine.renderer=this,this.pipelineContext=new h3(this.engine,t),this.glRenderer=new hR(this.engine),this.extension=new hk(this)},r.resize=function(t,e){var i=this.glRenderer;i&&(this.width!==t||this.height!==e)&&i.resize(t,e)},r.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},rv(i,[{key:"isDestroyed",get:function(){var t=this.glRenderer;return!t||t.isDestroyed}},{key:"height",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.height)?e:0}},{key:"width",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.width)?e:0}}]),i}(n6),h5={"Container size overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY","DPI overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT","Invalid container size":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW","Container is not an HTMLElement":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Never use destroyed player again":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr","Current running player count":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ","Create player with different WebGL version":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg"},h6=new Map,h8=!1,h9=1,h7=function(e){function r(t){(a=e.call(this)||this).compositions=[],a.displayScale=1,a.resumePending=!1,a.disposed=!1,a.assetManagers=[],a.speed=1,a.baseCompositionIndex=0,a.useExternalCanvas=!1,a.lost=function(t){var e;null==(e=a.ticker)||e.pause(),a.compositions.forEach(function(e){return e.lost(t)}),a.renderer.lost(t),a.handleEmitEvent("webglcontextlost",t),lt(oB(a),!1)};var r,a,o=oB(a);a.restore=i(function(){var t;return u(this,function(e){switch(e.label){case 0:return o.renderer.restore(),[4,Promise.all(o.compositions.map(i(function(t){var e,i,r,n,a,s,h,l,c,f,d,p;return u(this,function(u){switch(u.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.keepResource,a=t.reusable,s=t.renderOrder,h=t.transform,l=t.videoState,[4,o.loadScene(i)];case 1:(c=u.sent()).speed=r,c.reusable=a,c.keepResource=n,c.renderOrder=s,c.transform.setPosition(h.position.x,h.position.y,h.position.z),c.transform.setRotation(h.rotation.x,h.rotation.y,h.rotation.z),c.transform.setScale(h.scale.x,h.scale.y,h.scale.z),f=0,u.label=2;case 2:if(!(f<l.length))return[3,5];if(!l[f])return[3,4];return(d=c.textures[f].source.video).currentTime=null!=(p=l[f])?p:0,[4,d.play()];case 3:u.sent(),u.label=4;case 4:return f++,[3,2];case 5:return c.isEnded=!1,c.gotoAndPlay(e),[2,c]}})})))];case 1:return o.compositions=e.sent(),o.emit("webglcontextrestored"),null==(t=o.ticker)||t.resume(),eY()&&o.canvas&&(o.canvas.style.display="none",window.setTimeout(function(){o.canvas.style.display=""},0)),[2]}})}),a.handleClick=function(t){var e=t.x,i=t.y,r=[];a.compositions.forEach(function(t){for(var o,s=t.hitTest(e,i),u=n(s);!(o=u()).done;){var h=o.value;r.push(iB({},h,{player:oB(a),composition:t}))}});for(var o=0;o<r.length;o++){var s=r[o],u=s.behavior||tG.NOTIFY;u===tG.NOTIFY?(a.emit("click",iB({},s,{compositionId:s.composition.id,compositionName:s.composition.name})),s.composition.emit("click",iB({},s,{compositionId:s.composition.id,compositionName:s.composition.name}))):u===tG.RESUME_PLAYER&&a.resume()}};var s=t.container,h=t.canvas,l=t.fps,c=t.name,f=t.pixelRatio,d=t.manualRender,p=t.reportGPUTime,m=t.renderFramework,v=t.notifyTouch,y=t.onError,g=t.interactive,x=t.renderOptions,b=void 0===x?{}:x,T=t.env,E=void 0===T?"":T,_=b.willCaptureImage,C=b.premultipliedAlpha;if(a.onError=y,h8||"debug-disable"===m)return uu(a);var S=(r=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===r[1]||"16"===r[1]&&"5"===r[2])?"webgl":"webgl2";m&&(S="webgl"===m?"webgl":"webgl2"),a.reportGPUTime=p,a.pixelRatio=Number.isFinite(f)?f:eH(),a.offscreenMode=!0,a.env=E,a.name=c||""+h9++;try{if(rA.length)throw Error("Errors before player create: "+rA.map(function(t,e){return"\n "+(e+1)+": "+t})+".",{cause:"webgliniterror"});h?(a.canvas=h,a.useExternalCanvas=!0):(le(s),a.canvas=document.createElement("canvas"),s.appendChild(a.canvas)),a.container=a.canvas.parentElement,a.renderer=n6.create(a.canvas,S,{preserveDrawingBuffer:_,premultipliedAlpha:C}),a.renderer.env=E,a.renderer.addLostHandler({lost:a.lost}),a.renderer.addRestoreHandler({restore:a.restore}),a.gpuCapability=a.renderer.engine.gpuCapability,a.assetService=new ht(a.renderer.engine),d||(a.ticker=new hT(l),a.ticker.add(a.tick.bind(oB(a)))),a.event=new aB(a.canvas,!!v),a.event.bindListeners(),a.event.addEventListener(aD,a.handleClick),a.interactive=void 0!==g&&g,a.resize(),sH(a.gpuCapability.detail)}catch(t){a.canvas&&!a.useExternalCanvas&&a.canvas.remove(),a.handleThrowError(t)}return h6.forEach(function(t){t.gpuCapability.type!==a.gpuCapability.type&&e8.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+a.gpuCapability.type+".\nsee "+h5["Create player with different WebGL version"]+".")}),h6.set(a.canvas,oB(a)),!function(){for(var t,e=[],i=n(h6.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&e8.error("Current running player count: "+e.length+", see "+h5["Current running player count"]+".",e)}(),lt(oB(a),!0),a}ib(r,e);var o=r.prototype;return o.setSpeed=function(t){isNaN(t)||(this.speed=t)},o.getSpeed=function(){return this.speed},o.getCompositionByName=function(t){return this.compositions.find(function(e){return e.name===t})},o.getCompositions=function(){return this.compositions.sort(function(t,e){return t.getIndex()-e.getIndex()})},o.getAssetManager=function(){return this.assetManagers},o.loadScene=function(t,e){var r=this;return i(function(){var a,o,s,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,C,S;return u(this,function(A){switch(A.label){case 0:return e4(r.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),h=performance.now(),l=[],c=[],d=null==(f=null==e?void 0:e.autoplay)||f,p=null==(o=r.renderer.engine.gpuCapability)?void 0:null==(a=o.detail)?void 0:a.asyncShaderCompile,m=r.baseCompositionIndex,it(t)?(v=l).push.apply(v,[].concat(t)):l.push(t),r.baseCompositionIndex+=l.length,d&&(r.autoPlaying=!0),y=[],[4,Promise.all(l.map(i(function(t,i){var n,a,o,s,h,l,f,p;return u(this,function(u){switch(u.label){case 0:return a=(n=r.assetService.assembleSceneLoadOptions(t,iB({autoplay:d},e))).source,h=null!=(s=null==(o=n.options)?void 0:o.autoplay)?s:d,l=new u7(o),r.assetManagers.push(l),[4,l.loadScene(a,r.renderer,{env:r.env})];case 1:if(f=u.sent(),r.disposed)return c.length=0,[2];return r.assetService.prepareAssets(f,f.assets),r.assetService.updateTextVariables(f,l.options.variables),r.assetService.initializeTexture(f),f.pluginSystem.precompile(f.jsonScene.compositions,r.renderer),(p=r.createComposition(f,o)).setIndex(m+i),c[i]=p,y[i]=h,[2]}})})))];case 1:return A.sent(),g=performance.now(),[4,new Promise(function(t){var e;null==(e=r.renderer.getShaderLibrary())||e.compileAllShaders(function(){return t(null)})})];case 2:for(A.sent(),x=performance.now()-g,b=0;b<c.length;b++)y[b]?c[b].play():c[b].pause(),r.compositions.push(c[b]);for(null==(s=r.ticker)||s.start(),c.some(function(t){return!t.getPaused()})&&r.emit("play",{time:0}),T=c.map(function(t){return t.name}),E=performance.now()-h,_=n(c);!(C=_()).done;)(S=C.value).statistic.compileTime=x,S.statistic.firstFrameTime=E;return e8.info("First frame ["+T+"]: "+E.toFixed(4)+"ms."),e8.info("Shader "+(p?"async":"sync")+" compile ["+T+"]: "+x.toFixed(4)+"ms."),[2,it(t)?c:c[0]]}})})()},o.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=this.renderer,n=new sk(iB({},e,{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,handleItemMessage:function(t){i.emit("message",t)}}),t);return this.ticker&&e.renderLevel===tL.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==aI&&this.assetService.createShaderVariant(),n},o.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(t){t.play()}),null==(t=this.ticker)||t.start(),this.emit("play",{time:0})},o.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(e){e.gotoAndPlay(t)}),this.ticker?this.ticker.start():this.doTick(0,!0),this.emit("play",{time:t})},o.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map(function(e){e.gotoAndStop(t)}),(!this.ticker||(null==(e=this.ticker)?void 0:e.getPaused()))&&this.doTick(0,!0),this.emit("pause")},o.playSequence=function(t){for(var e,i=function(e){t[e].on("end",function(){t[e+1].play()})},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},o.pause=function(t){var e;!this.paused&&(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},o.resume=function(){var t=this;return i(function(){var e;return u(this,function(i){switch(i.label){case 0:if(t.resumePending)return[2];if(!t.paused)return[3,2];return t.resumePending=!0,[4,Promise.all(t.compositions.map(function(t){return t.reloadTexture()}))];case 1:i.sent(),t.resumePending=!1,t.emit("resume"),i.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}})})()},o.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},o.doTick=function(e,i){var r,n,a=this,o=this.renderer.engine.renderErrors;o.size>0&&(this.handleEmitEvent("rendererror",o.values().next().value),null==(r=this.ticker)||r.pause()),e=Math.min(e,33)*this.speed;var s=this.compositions,u=!1;s.sort(function(t,e){return t.getIndex()-e.getIndex()});for(var h=[],l=0;l<s.length;l++){var c=s[l];if(c.textureOffloaded){u=!0,e8.error("Composition "+c.name+" texture offloaded, skip render."),h.push(c);continue}!c.isDestroyed&&c.renderer&&c.update(e),c.isDestroyed||h.push(c)}if(this.compositions=h,this.baseCompositionIndex=this.compositions.length,u)return this.handleEmitEvent("rendererror",Error("Play when texture offloaded.")),null==(n=this.ticker)?void 0:n.pause();if(!this.paused||i){var f=this.gpuCapability.level,d=this.renderer.context.gl,p=2===f&&this.reportGPUTime?rS(d):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<s.length||i){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var m=0;m<s.length;m++)s[m].renderFrame.isDestroyed||this.renderer.renderRenderFrame(s[m].renderFrame)}null==p||p.end(),null==p||p.getTime().then(function(t){return null==a.reportGPUTime?void 0:a.reportGPUTime.call(a,null!=t?t:0)}).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},o.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},o.resize=function(){var t=this.canvas.parentElement;if(t){var e=this.getTargetSize(t);r=e[0],n=e[1],a=e[2],o=e[3]}else r=a=this.canvas.width,n=o=this.canvas.height;var i=r/n;if(r&&n){var r,n,a,o,s,u=document.documentElement.clientWidth;a>2*u&&e8.error("DPI overflowed, width "+a+" is more than 2x document width "+u+", see "+h5["DPI overflowed"]+".");var h=this.env?this.gpuCapability.detail.maxTextureSize:2048;(a>h||o>h)&&(e8.error("Container size overflowed "+a+"x"+o+", see "+h5["Container size overflowed"]+"."),i>1?(a=Math.round(h),o=Math.round(h/i)):(o=Math.round(h),a=Math.round(h*i))),this.renderer.resize(a,o),this.canvas.style.width=r+"px",this.canvas.style.height=n+"px",e8.info("Resize player "+this.name+" ["+a+","+o+","+r+","+n+"]."),null==(s=this.compositions)||s.forEach(function(t){t.camera.aspect=i})}},o.clearCanvas=function(e){e?this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},o.destroyCurrentCompositions=function(){this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.baseCompositionIndex=0},o.dispose=function(t){if(e8.info("Call player destroyed: "+this.name+"."),!this.disposed){h6.delete(this.canvas),this.pause(),null==(e=this.ticker)||e.stop(),this.assetManagers.forEach(function(t){return t.dispose()}),this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.renderer&&(this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.renderer.dispose(!t)),this.event&&this.event.dispose(),this.assetService.dispose(),lt(this,!1),a(this.canvas,HTMLCanvasElement)&&!t&&this.renderer.context&&(uh.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var e,i="Never use destroyed player: "+this.name+" again, see "+h5["Never use destroyed player again"]+".",r=function(){return function(t){throw Error(t)}(i)},n=function(){return Promise.reject(i)};this.tick=r,this.resize=r,this.loadScene=n,this.play=n,this.gotoAndPlay=n,this.gotoAndStop=n,this.playSequence=r,this.destroyCurrentCompositions=r,this.resume=n,this.disposed=!0}},o.offloadTexture=function(){this.compositions.forEach(function(t){return t.offloadTexture()})},o.getTargetSize=function(t){le(t);var e,i,r=this.displayAspect,n=null==window.getComputedStyle?void 0:window.getComputedStyle.call(window,t),a=0,o=0;n?(a=parseInt(n.width,10),o=parseInt(n.height,10)):(a=t.clientWidth,o=t.clientHeight),r?a/o>r?e=(i=o*this.displayScale)*r:i=(e=a*this.displayScale)/r:(e=a,i=o);var s=this.pixelRatio,u=e,h=i;if(e=Math.round(e*s),(i=Math.round(i*s))<1||i<1){if(this.offscreenMode)e=i=u=h=1;else throw Error("Invalid container size "+e+"x"+i+", see "+h5["Invalid container size"]+".")}return[u,h,e,i]},o.handleThrowError=function(t){if(this.onError)this.onError(t);else throw t},o.handleEmitEvent=function(t,e){this.onError?a(e,Event)?this.onError(Error(e.type,{cause:t}),e):a(e,Error)?this.onError(Error(e.message,{cause:t}),e):this.onError(Error("Unknown error.",{cause:t}),e):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,e))},rv(r,[{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),r}(sN);function lt(t,e){Object.keys(ic).forEach(function(i){var r=ic[i],n=e?r.onPlayerCreated:r.onPlayerDestroy;null==n||n(t)})}function le(t){if(null==t)throw Error("Container is not an HTMLElement, see "+h5["Container is not an HTMLElement"]+".")}s([function(t,e,r){var n=r.value;return r.value=i(function(){var e,i,r,a,o=arguments;return u(this,function(s){switch(s.label){case 0:for(i=Array(e=o.length),r=0;r<e;r++)i[r]=o[r];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.apply(this,i)];case 2:return[2,s.sent()];case 3:return a=s.sent(),t.handleThrowError.call(this,a),[3,4];case 4:return[2]}})}),r}],h7.prototype,"loadScene",null),r4.create=function(t,e){return new hC(t,e)},r4.createWithData=function(e,i,r){void 0===i&&(i=e$("#fff")),void 0===r&&(r={});var n=r.type,a=void 0===n?rw.UNSIGNED_BYTE:n,o=r.format,s=void 0===o?rw.RGBA:o,u=r.internalFormat,h=r.wrapS,l=void 0===h?rw.MIRRORED_REPEAT:h,c=r.wrapT,f=void 0===c?rw.MIRRORED_REPEAT:c,d=r.minFilter,p=void 0===d?rw.NEAREST:d,m=r.magFilter,v=void 0===m?rw.NEAREST:m,y=r.flipY;return new hC(e,{data:i,type:a,sourceType:t.TextureSourceType.data,format:s,internalFormat:u||s,wrapS:l,wrapT:f,minFilter:p,magFilter:v,flipY:void 0!==y&&y})},no.create=function(t,e){return new hD(t,e)},nx.create=function(t,e){return new hF(t,e)},nR.create=function(t,e){return new nR(t,e)},n1.create=function(t){return new hG(t)},n5.create=function(t,e){return new hX(t,e)},n6.create=function(t,e,i){return new h4(t,e,i)},hb.create=function(t){return new hB(t)};var li="2.6.5";e8.info("Player version: "+li+"."),t.AbstractPlugin=ig,t.ActivationPlayable=s0,t.AndNode=i9,t.Animatable=iZ,t.AnimationClipNode=iY,t.ApplyAdditiveNode=i6,t.Asset=uv,t.AssetLoader=ug,t.AssetManager=u7,t.AssetService=ht,t.BYTES_TYPE_MAP=ng,t.BaseRenderComponent=aL,t.Behaviour=rg,t.BezierCurve=ow,t.BezierCurvePath=ov,t.BezierCurveQuat=oy,t.BlendNode=i8,t.BoolValueNode=ik,t.COPY_FRAGMENT_SHADER=nf,t.COPY_MESH_SHADER_ID=nl,t.COPY_VERTEX_SHADER=nc,t.CalculateLoader=sY,t.Camera=oW,t.CameraVFXItemLoader=aV,t.ColorCurve=oO,t.Component=ry,t.ComponentTimePlayable=sX,t.ComponentTimePlayableAsset=sj,t.ComponentTimeTrack=sG,t.Composition=sk,t.ConstBoolNode=ri,t.ConstFloatNode=re,t.ControlParameterBoolNode=rn,t.ControlParameterFloatNode=rr,t.ControlParameterTriggerNode=ra,t.DEFAULT_FONTS=uf,t.DEFAULT_FPS=60,t.Database=ux,t.Deferred=function(){var t=this;this.promise=new Promise(function(e,i){t.resolve=e,t.reject=i})},t.Downloader=rD,t.EFFECTS_COPY_MESH_NAME=nh,t.EVENT_TYPE_CLICK=aD,t.EVENT_TYPE_TOUCH_END=aU,t.EVENT_TYPE_TOUCH_MOVE=az,t.EVENT_TYPE_TOUCH_START=ak,t.EffectsObject=iI,t.EffectsPackage=hx,t.Ellipse=ur,t.Engine=hb,t.EventEmitter=sN,t.EventSystem=aB,t.Float16ArrayWrapper=aH,t.FloatComparisonNode=rh,t.FloatComparisonNodeData=ru,t.FloatValueNode=iD,t.Framebuffer=n5,t.GLEngine=hB,t.GLGeometry=hF,t.GLRenderer=h4,t.GPUCapability=n3,t.Geometry=nx,t.GlobalUniforms=n0,t.GradientValue=od,t.GraphInstance=rp,t.GraphNode=iN,t.GraphNodeData=iF,t.GraphicsPath=us,t.HELP_LINK=aM,t.InteractLoader=aj,t.InteractMesh=oN,t.InvalidIndex=-1,t.KTXTexture=r7,t.LayerBlendNode=ro,t.LineSegments=op,t.LinearValue=of,t.MaskProcessor=ns,t.Material=no,t.MaterialDataBlock=nr,t.Mesh=nR,t.MeshCollider=oL,t.NodeTransform=i3,t.NotNode=rt,t.OrNode=i7,t.PLAYER_OPTIONS_ENV_EDITOR=aI,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=o6,t.ParticleBehaviourPlayableAsset=o8,t.ParticleLoader=sW,t.ParticleMesh=o7,t.ParticleSystemRenderer=si,t.ParticleTrack=sR,t.PassTextureCache=nv,t.PathSegments=om,t.Player=h7,t.PluginSystem=iv,t.PolyStar=un,t.Polygon=ue,t.Pose=i4,t.PoseNode=iL,t.PropertyTrack=sw,t.RENDER_PASS_NAME_PREFIX=nq,t.RENDER_PREFER_LOOKUP_TEXTURE=oK,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=oh,t.RandomValue=ol,t.RandomVectorValue=oc,t.RenderFrame=nQ,t.RenderPass=nO,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=nI,t.Renderbuffer=n1,t.Renderer=n6,t.RendererComponent=rx,t.RuntimeClip=sA,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",t.SPRITE_VERTEX_STRIDE=6,t.SemanticMap=ny,t.SerializationHelper=uy,t.ShaderFactory=nX,t.ShaderVariant=nu,t.ShapePath=uo,t.SpriteLoader=oV,t.StateMachineNode=rl,t.StateNode=rc,t.StaticValue=ou,t.TEMPLATE_USE_OFFSCREEN_CANVAS=oQ,t.TextComponentBase=up,t.TextLayout=ul,t.TextLoader=um,t.TextStyle=uc,t.Texture=r4,t.TextureFactory=ne,t.Ticker=hT,t.TimelineClip=sS,t.TimelinePlayable=sM,t.TrackSortWrapper=sO,t.Transform=oX,t.TransformAnimationPlayable=s$,t.TransitionNode=rf,t.ValueGetter=os,t.ValueNode=iV,t.Vector2Curve=oA,t.Vector3Curve=oS,t.Vector4Curve=oC,t.addByOrder=e2,t.addItem=eD,t.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}},t.applyMixins=il,t.assertExist=e4,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=ih,t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",t.buildLine=s5,t.calculateTranslation=aZ,t.canUseBOM=eW,t.canvasPool=uh,t.closePointEps=1e-4,t.colorGradingFrag=nk,t.colorStopsFromGradient=eG,t.colorToArr=eU,t.combineImageTemplate=u6,t.createCopyShader=nd,t.createGLContext=rC,t.createKeyFrameMeta=oT,t.createShape=ac,t.createValueGetter=oM,t.curveEps=1e-4,t.decimalEqual=a2,t.defaultPlugins=id,t.deserializeMipmapTexture=r$,t.disableAllPlayer=function(t){h8=!!t},t.earcut=aR,t.effectsClass=iA,t.effectsClassStore=iS,t.enlargeBuffer=ez,t.ensureFixedNumber=uT,t.ensureVec3=aq,t.findPreviousRenderPass=function(t,e){var i=t.indexOf(e);return t[i-1]},t.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",t.gaussianDownHFrag=nz,t.gaussianDownVFrag=nU,t.gaussianUpFrag=nB,t.generateEmptyTypedArray=nb,t.generateGUID=iu,t.generateHalfFloatTexture=r5,t.generateTransparentTexture=r9,t.generateWhiteTexture=r8,t.getActivePlayers=function(){return Array.from(h6.values())},t.getBackgroundImage=u5,t.getClass=function(t){return iS[t]},t.getColorFromGradientStops=eB,t.getConfig=function(t){return oJ[t]},t.getDefaultTextureFactory=ni,t.getGeometryByShape=aP,t.getGeometryTriangles=aO,t.getKTXTextureOptions=nt,t.getKeyFrameMetaByRawValue=ob,t.getMergedStore=iw,t.getNodeDataClass=function(t){return iO[t]},t.getParticleMeshShader=function(t,e,i){void 0===i&&(i="");var r,n,a,o=t.content,s=+((null==(r=o.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===aI]],h=e.level,l=e.detail,c=oT(),f=oT(),d=l.maxVertexUniforms>0,p=(null!=(n=o.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,ob(c,p));var y=o.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=o.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&ob(c,x);var b=o.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[r])&&(ob(c,b[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==b?void 0:b[n])&&(ob(c,b[n]),o=1,v|=1<<10+e,a=!0),u.push(["ORB_VEL_"+t.toUpperCase(),o])}),(null==b?void 0:b.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),a&&(null==b?void 0:b.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),o.sizeOverLifetime){var T=o.sizeOverLifetime;T.separateAxes?(ob(c,T.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,ob(c,T.y)):ob(c,T.size)}if(o.rotationOverLifetime){var E=o.rotationOverLifetime;E.z&&(ob(c,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(ob(c,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(ob(c,E.y),v|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),v|=262144)}ob(c,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,ob(c,b.forceCurve));var _=l.halfFloatTexture;_&&f.max&&(v|=1048576);var C=l.maxVertexUniforms,S=c.max+c.curves.length-32>C;oJ[oK]&&(S=!0),2===h&&(c.max=-1,f.index>0&&(f.max=-1)),S&&_&&d&&(m=1);var A={fragment:nF,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+nL,shared:!0,cacheId:["-p:",s,v,c.index,c.max,f.index,f.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:A,vertex:c.index,fragment:f.index}},t.getPixelRatio=eH,t.getPlayerByCanvas=function(t){return h6.get(t)},t.getPreMultiAlpha=rN,t.getStandardComposition=u0,t.getStandardImage=u$,t.getStandardItem=u2,t.getStandardJSON=uQ,t.getTextureSize=nJ,t.glContext=rw,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return eh.Float32;case WebGLRenderingContext.SHORT:return eh.Int16;case WebGLRenderingContext.BYTE:return eh.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return eh.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return eh.UInt8;default:return eh.Float32}},t.gpuTimer=rS,t.imageDataFromColor=e$,t.imageDataFromGradient=e0,t.initErrors=rA,t.initGLContext=rI,t.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",t.interpolateColor=ej,t.isAlipayMiniApp=eQ,t.isAndroid=eZ,t.isArray=it,t.isCanvas=ia,t.isCanvasUsedByPlayer=function(t){return h6.has(t)},t.isFunction=ie,t.isIOS=eY,t.isIOSByUA=function(){var t=navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},t.isMiniProgram=function(){return eQ()||eJ()},t.isObject=ii,t.isOpenHarmony=eq,t.isPlainObject=ir,t.isSimulatorCellPhone=eK,t.isString=e7,t.isUniformStruct=nn,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&nn(t[0])},t.isValidFontFamily=e5,t.isWebGL2=rM,t.isWechatMiniApp=eJ,t.itemFrag=nN,t.itemFrameFrag="#version 100\nprecision highp float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}",t.itemVert=nP,t.loadAVIFOptional=rG,t.loadBinary=rW,t.loadBlob=function(t){return rZ.apply(this,arguments)},t.loadImage=rX,t.loadMedia=rQ,t.loadVideo=rq,t.loadWebPOptional=rU,t.logger=e8,t.math=nA,t.modifyMaxKeyframeShader=function(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var a=0;a<t.macros.length;a++){var o=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===o[0])o[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===o[0]){o[1]=i;break}}},t.nearestPowerOfTwo=a$,t.nodeDataClass=iP,t.noop=e9,t.normalizeColor=uw,t.numberToFix=a3,t.oldBezierKeyFramesToNew=oR,t.parsePercent=eX,t.particleFrag=nF,t.particleOriginTranslateMap=aJ,t.particleUniformTypeMap=o9,t.particleVert=nL,t.passRenderLevel=u4,t.pluginLoaderMap=ic,t.randomInRange=io,t.registerPlugin=im,t.removeItem=ek,t.rotateVec2=aN,t.screenMeshVert=nD,t.serialize=function(t,e){return iR(t,e)},t.setBlendMode=rF,t.setConfig=function(t,e){return oJ[t]=e},t.setDefaultTextureFactory=function(t){ev=t},t.setMaskMode=rV,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=a0,t.setSideMode=rL,t.setSpriteMeshMaxItemCountByGPU=sH,t.sortByOrder=e1,t.spec=iE,t.thresholdFrag=nG,t.throwDestroyedError=is,t.trailVert=nV,t.translatePoint=function(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i},t.trianglesFromRect=a1,t.unregisterPlugin=function(t){delete ip[t],delete ic[t],ek(id,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecFill=aK,t.vecMulCombine=aQ,t.version=li,t.vertexFormatType2GLType=rP,Object.defineProperty(t,"__esModule",{value:!0})});
8
8
  //# sourceMappingURL=index.min.js.map