@galacean/effects-threejs 2.4.2 → 2.4.4

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 threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.4.2
7
- */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.three={}),t.THREE)}(this,function(t,e){"use strict";var i,r,n,a,o,s,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E,_,C,A,S,w,O,M,R,I,P,L,V,F,D,k,N,z,U,B,G,j,X,W,H,Y,Z,q,Q,K,J,$,tt,te,ti,tr,tn,ta,to,ts,tu,th,tc,tl,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tE,t_,tC,tA,tS,tw,tO,tM,tR,tI,tP,tL,tV,tF,tD,tk,tN,tz,tU,tB,tG,tj,tX,tW,tH,tY,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,ea,eo,es,eu,eh,ec=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}(e);function el(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 ef(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var a=t.apply(e,i);function o(t){el(a,r,n,o,s,"next",t)}function s(t){el(a,r,n,o,s,"throw",t)}o(void 0)})}}function ed(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 ep(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 ed(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 ed(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function em(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):em(t,e)}function ev(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function ey(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 eg(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 ex=new Uint8Array(16),eb=[],eT=0;eT<256;++eT)eb.push((eT+256).toString(16).slice(1));var eE={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function e_(t,e){return t.includes(e)||t.push(e),t}function eC(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function eA(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 eS(t,e){var i=[0,0,0,0];if(eX(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 em(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function ew(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=eM(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 eO(t){var e=[];if(em(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:eR(i),color:[r,n,a,o]})}):Object.keys(t).forEach(function(i){var r=eS(t[i]);e.push({stop:eR(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 eM(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 eR(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eI(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function eP(){return eI()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eL(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eV(){return"miniprogram"===window.__wxjs_environment}function eF(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=eO(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=eM(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 eD(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++)eN(t,r,e);return t}function ek(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&eN(t,t.length-1,i)),t}function eN(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 ez(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eU(t){return/^[^\d.][\w-]*$/.test(t)}function eB(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(i=t.OrderType||(t.OrderType={}))[i.none=1]="none",i[i.ascending=2]="ascending",i[i.descending=3]="descending";var eG={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(eB(t),[r])),null==ty||ty("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(eB(t))),null==ty||ty("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(eB(t))),null==ty||ty("warn",t,r)},register:function(t){t&&eH(t)&&(ty=t)}};function ej(){}function eX(t){return"string"==typeof t}t.DestroyOptions=void 0,(r=t.DestroyOptions||(t.DestroyOptions={}))[r.destroy=0]="destroy",r[r.keep=1]="keep",r[r.force=0]="force";var eW=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eH(t){return"[object Function]"===Object.prototype.toString.call(t)}function eY(t){return"[object Object]"===Object.prototype.toString.call(t)}function eZ(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eq(t,e){return t+Math.random()*(e-t)}function eQ(){throw Error("Destroyed item cannot be used again.")}function eK(){return(function(t,e,i){if(eE.randomUUID&&!t)return eE.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tv&&!(tv="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 tv(ex)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),eb[n[r+0]]+eb[n[r+1]]+eb[n[r+2]]+eb[n[r+3]]+"-"+eb[n[r+4]]+eb[n[r+5]]+"-"+eb[n[r+6]]+eb[n[r+7]]+"-"+eb[n[r+8]]+eb[n[r+9]]+"-"+eb[n[r+10]]+eb[n[r+11]]+eb[n[r+12]]+eb[n[r+13]]+eb[n[r+14]]+eb[n[r+15]]})().replace(/-/g,"")}function eJ(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 e$(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 e0={},e1=[],e2={};function e3(t,e,i){e2[t]&&eG.error("Duplicate registration for plugin "+t+"."),e2[t]=i,e0[t]=e,e_(e1,t)}var e4=function(){function t(t){var e={},i=[];e1.forEach(function(t){var r=e0[t];i.includes(r)||(i.push(r),e[t]=r)});for(var r,n=ep(t);!(r=n()).done;){var a=r.value;if(!e0[a])throw Error("The plugin '"+a+"' not found."+function(t){var e=e5[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+"'":""}(a))}this.plugins=Object.keys(e).map(function(t){var e=new e0[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 i=this;return ef(function(){return eg(this,function(r){return[2,i.callStatic("processRawJSON",t,e)]})})()},e.processAssets=function(t,e){var i=this;return ef(function(){return eg(this,function(r){return[2,i.callStatic("processAssets",t,e)]})})()},e.precompile=function(t,e){for(var i,r=ep(this.plugins);!(i=r()).done;)i.value.precompile(t,e)},e.loadResources=function(t,e){var i=this;return ef(function(){return eg(this,function(r){return[2,i.callStatic("prepareResource",t,e)]})})()},e.callStatic=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n=this;return ef(function(){var e,r,a,o,s,u;return eg(this,function(h){for(a=0,e=[],r=n.plugins;a<r.length;a++)t in(o=e0[r[a].name])&&e.push(Promise.resolve(null==(u=o[t])?void 0:(s=u).call.apply(s,[].concat([o],i))));return[2,Promise.all(e)]})})()},t}(),e5={"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"},e6=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 e8(t,e){return(e8=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function e9(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&&e8(t,e)}(n=tg||(tg={}))["1_0"]="1.0",n["1_1"]="1.1",n["1_2"]="1.2",n["1_3"]="1.3",n["1_5"]="1.5",n["1_8"]="1.8",n["2_0"]="2.0",n["2_1"]="2.1",n["2_2"]="2.2",n["2_3"]="2.3",n["2_4"]="2.4",n["3_0"]="3.0",n["3_1"]="3.1",n["3_2"]="3.2",n["3_3"]="3.3",n.LATEST="3.3",(a=tx||(tx={})).S="S",a.APlus="A+",a.A="A",a.BPlus="B+",a.B="B",(o=tb||(tb={}))[o.ALPHA=0]="ALPHA",o[o.ADD=1]="ADD",o[o.MULTIPLY=2]="MULTIPLY",o[o.BRIGHTNESS=3]="BRIGHTNESS",o[o.SUBTRACTION=4]="SUBTRACTION",o[o.STRONG_LIGHT=5]="STRONG_LIGHT",o[o.WEAK_LIGHT=6]="WEAK_LIGHT",o[o.SUPERPOSITION=7]="SUPERPOSITION",(s=tT||(tT={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=tE||(tE={}))[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(h=t_||(t_={}))[h.NONE=0]="NONE",h[h.SPHERE=1]="SPHERE",h[h.CONE=2]="CONE",h[h.HEMISPHERE=3]="HEMISPHERE",h[h.CIRCLE=4]="CIRCLE",h[h.DONUT=5]="DONUT",h[h.RECTANGLE=6]="RECTANGLE",h[h.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",h[h.EDGE=8]="EDGE",h[h.TEXTURE=9]="TEXTURE",(c=tC||(tC={}))[c.GYROSCOPE=0]="GYROSCOPE",c[c.SPINE=1]="SPINE",(l=tA||(tA={}))[l.CLICK=0]="CLICK",l[l.MESSAGE=1]="MESSAGE",l[l.DRAG=2]="DRAG",(f=tS||(tS={}))[f.NONE=0]="NONE",f[f.NOTIFY=1]="NOTIFY",f[f.RESUME_PLAYER=2]="RESUME_PLAYER",f[f.REMOVE=3]="REMOVE",f[f.PAUSE=4]="PAUSE",(d=tw||(tw={})).base="0",d.sprite="1",d.particle="2",d.null="3",d.interact="4",d.plugin="5",d.camera="6",d.composition="7",d.spine="spine",d.mesh="mesh",d.tree="tree",d.text="text",d.light="light",d.skybox="skybox",d.effect="effect",d.shape="shape",d.postProcessVolume="postProcessVolume",d.node="node",d.video="video",d.audio="audio",d.richtext="richtext",(p=tO||(tO={}))[p.BILLBOARD=0]="BILLBOARD",p[p.MESH=1]="MESH",p[p.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",p[p.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(m=tM||(tM={}))[m.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",m[m.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",m[m.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",m[m.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",m[m.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",m[m.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",m[m.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",m[m.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",m[m.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(v=tR||(tR={})).Opaque="Opaque",v.Transparent="Transparent",(y=tI||(tI={})).Both="Both",y.Back="Back",y.Front="Front",(g=tP||(tP={}))[g.portrait=1]="portrait",g[g.landscape=0]="landscape",(x=tL||(tL={}))[x.CONSTANT=0]="CONSTANT",x[x.CONSTANT_VEC2=1]="CONSTANT_VEC2",x[x.CONSTANT_VEC3=2]="CONSTANT_VEC3",x[x.CONSTANT_VEC4=3]="CONSTANT_VEC4",x[x.RANDOM=4]="RANDOM",x[x.LINE=5]="LINE",x[x.CURVE=6]="CURVE",x[x.BEZIER_PATH=7]="BEZIER_PATH",x[x.RGBA_COLOR=8]="RGBA_COLOR",x[x.GRADIENT_COLOR=9]="GRADIENT_COLOR",x[x.SHAPE_POINTS=10]="SHAPE_POINTS",x[x.SHAPE_SPLITS=11]="SHAPE_SPLITS",x[x.LINEAR_PATH=12]="LINEAR_PATH",x[x.COLORS=13]="COLORS",x[x.BINARY=20]="BINARY",x[x.BEZIER_CURVE=21]="BEZIER_CURVE",x[x.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",x[x.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",x[x.COLOR_CURVE=24]="COLOR_CURVE",x[x.VECTOR4_CURVE=25]="VECTOR4_CURVE",x[x.VECTOR2_CURVE=26]="VECTOR2_CURVE",(b=tV||(tV={}))[b.AUTO=0]="AUTO",b[b.EASE=1]="EASE",b[b.EASE_IN=2]="EASE_IN",b[b.EASE_OUT=3]="EASE_OUT",b[b.LINE=4]="LINE",b[b.HOLD=5]="HOLD",b[b.LINE_OUT=6]="LINE_OUT",(T=tF||(tF={}))[T.destroy=0]="destroy",T[T.restart=5]="restart",T[T.forward=2]="forward",T[T.freeze=4]="freeze",(E=tD||(tD={}))[E.none=0]="none",E[E.removeParticle=1]="removeParticle",(_=tk||(tk={}))[_.RANDOM=0]="RANDOM",_[_.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",_[_.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",_[_.UNIFORM_BURST=3]="UNIFORM_BURST",(C=tN||(tN={})).point="point",C.spot="spot",C.directional="directional",C.ambient="ambient",(A=tz||(tz={}))[A.box=2]="box",A[A.sphere=3]="sphere",(S=tU||(tU={})).orthographic="orthographic",S.perspective="perspective",(w=tB||(tB={})).unlit="unlit",w.pbr="pbr",w.hair="hair",(O=tG||(tG={}))[O.opaque=100]="opaque",O[O.masked=101]="masked",O[O.translucent=102]="translucent",O[O.additive=103]="additive",(M=tj||(tj={})).none="none",M.uv="uv",M.normal="normal",M.basecolor="basecolor",M.alpha="alpha",M.metallic="metallic",M.roughness="roughness",M.ao="ao",M.emissive="emissive",M.diffuse="diffuse",(R=tX||(tX={}))[R.display=0]="display",R[R.clip=1]="clip",R[R.ellipsis=2]="ellipsis",(I=tW||(tW={}))[I.top=0]="top",I[I.middle=1]="middle",I[I.bottom=2]="bottom",(P=tH||(tH={}))[P.left=0]="left",P[P.middle=1]="middle",P[P.right=2]="right",(L=tY||(tY={})).normal="normal",L.bold="bold",L.lighter="lighter",(V=tZ||(tZ={})).normal="normal",V.italic="italic",V.oblique="oblique";var e7={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(F=tq||(tq={}))[F.Custom=0]="Custom",F[F.Rectangle=1]="Rectangle",F[F.Ellipse=2]="Ellipse",F[F.Polygon=3]="Polygon",F[F.Star=4]="Star",(D=tQ||(tQ={}))[D.Butt=0]="Butt",D[D.Round=1]="Round",D[D.Square=2]="Square",(k=tK||(tK={}))[k.Round=0]="Round",k[k.Bevel=1]="Bevel",k[k.Miter=2]="Miter",(N=tJ||(tJ={})).video="video",N.image="image",(z=t$||(t$={})).video="video",z.audio="audio",(U=t0||(t0={})).VFXItemData="VFXItemData",U.Material="Material",U.Shader="Shader",U.Geometry="Geometry",U.Texture="Texture",U.Image="Image",U.AnimationClip="AnimationClip",U.BinaryAsset="BinaryAsset",U.TrackAsset="TrackAsset",U.TimelineAsset="TimelineAsset",U.ObjectBindingTrack="ObjectBindingTrack",U.TransformTrack="TransformTrack",U.SpriteColorTrack="SpriteColorTrack",U.ActivationTrack="ActivationTrack",U.SubCompositionTrack="SubCompositionTrack",U.FloatPropertyTrack="FloatPropertyTrack",U.ColorPropertyTrack="ColorPropertyTrack",U.Vector2PropertyTrack="Vector2PropertyTrack",U.Vector4PropertyTrack="Vector4PropertyTrack",U.TransformPlayableAsset="TransformPlayableAsset",U.SpriteColorPlayableAsset="SpriteColorPlayableAsset",U.ActivationPlayableAsset="ActivationPlayableAsset",U.SubCompositionPlayableAsset="SubCompositionPlayableAsset",U.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",U.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",U.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",U.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",U.MeshComponent="MeshComponent",U.SkyboxComponent="SkyboxComponent",U.LightComponent="LightComponent",U.CameraComponent="CameraComponent",U.ModelPluginComponent="ModelPluginComponent",U.TreeComponent="TreeComponent",U.AnimationComponent="AnimationComponent",U.SpineComponent="SpineComponent",U.VideoComponent="VideoComponent",U.AudioComponent="AudioComponent",U.RichTextComponent="RichTextComponent",U.OrientationComponent="OrientationComponent",U.ShapeComponent="ShapeComponent",U.SpriteComponent="SpriteComponent",U.ParticleSystem="ParticleSystem",U.InteractComponent="InteractComponent",U.CameraController="CameraController",U.PostProcessVolume="PostProcessVolume",U.EffectComponent="EffectComponent",U.TextComponent="TextComponent",U.TimelineClip="TimelineClip",(B=t1||(t1={}))[B.POINTS=0]="POINTS",B[B.LINES=1]="LINES",B[B.LINE_LOOP=2]="LINE_LOOP",B[B.LINE_STRIP=3]="LINE_STRIP",B[B.TRIANGLES=4]="TRIANGLES",B[B.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",B[B.TRIANGLE_FAN=6]="TRIANGLE_FAN",(G=t2||(t2={}))[G.Float16=0]="Float16",G[G.Float32=1]="Float32",G[G.Int8=2]="Int8",G[G.Int16=3]="Int16",G[G.Int32=4]="Int32",G[G.UInt8=5]="UInt8",G[G.UInt16=6]="UInt16",G[G.UInt32=7]="UInt32",(j=t3||(t3={}))[j.None=-1]="None",j[j.UInt8=0]="UInt8",j[j.UInt16=1]="UInt16",j[j.UInt32=2]="UInt32",(X=t4||(t4={})).Position="POSITION",X.Uv="TEXCOORD0",X.Uv2="TEXCOORD1",X.Normal="NORMAL",X.Tangent="TANGENT",X.Color="COLOR",X.Joints="JOINTS",X.Weights="WEIGHTS",X.PositionBS0="POSITION_BS0",X.PositionBS1="POSITION_BS1",X.PositionBS2="POSITION_BS2",X.PositionBS3="POSITION_BS3",X.PositionBS4="POSITION_BS4",X.PositionBS5="POSITION_BS5",X.PositionBS6="POSITION_BS6",X.PositionBS7="POSITION_BS7",X.NormalBS0="NORMAL_BS0",X.NormalBS1="NORMAL_BS1",X.NormalBS2="NORMAL_BS2",X.NormalBS3="NORMAL_BS3",X.TangentBS0="TANGENT_BS0",X.TangentBS1="TANGENT_BS1",X.TangentBS2="TANGENT_BS2",X.TangentBS3="TANGENT_BS3";var it=Object.freeze({__proto__:null,LATEST_VERSION:tg.LATEST,get RenderLevel(){return tx},get BlendingMode(){return tb},get SideMode(){return tT},get ObscuredMode(){return tE},get ParticleEmitterShapeType(){return t_},get PluginType(){return tC},get InteractType(){return tA},get InteractBehavior(){return tS},get ItemType(){return tw},get RenderMode(){return tO},get ParticleOrigin(){return tM},get RenderType(){return tR},get RenderFace(){return tI},get CameraClipMode(){return tP},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 tL},get BezierKeyframeType(){return tV},get JSONSceneVersion(){return tg},get EndBehavior(){return tF},get ParticleInteractionBehavior(){return tD},get ShapeArcMode(){return tk},get LightType(){return tN},get ModelBoundingType(){return tz},get CameraType(){return tU},get MaterialType(){return tB},get MaterialBlending(){return tG},get RenderMode3D(){return tj},get TextOverflow(){return tX},get TextBaseline(){return tW},get TextAlignment(){return tH},get TextWeight(){return tY},get FontStyle(){return tZ},BuiltinObjectGUID:e7,get ShapePrimitiveType(){return tq},get LineCap(){return tQ},get LineJoin(){return tK},get BackgroundType(){return tJ},get MultimediaType(){return t$},get DataType(){return t0},get GeometryType(){return t1},get VertexFormatType(){return t2},get IndexFormatType(){return t3},get VertexBufferSemantic(){return t4}});function ie(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 ii(t,e,i){return e&&ie(t.prototype,e),i&&ie(t,i),t}var ir=new Map,ia=new Map,io={};function is(t){return function(e,i){io[t]&&console.warn("Class "+t+" is already registered."),io[t]=e}}function iu(t){var e=t.constructor;if(ia.get(e))return ia.get(e);var i={};ia.set(e,i);for(var r=t,n=e;n;){var a=ir.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 ih(t,e){return function(i,r){var n,a=(n=i.constructor,ir.get(n)||ir.set(n,{}),ir.get(n));a&&(a[r]||(a[r]={type:t,sourceName:e}))}}var ic=function(){function t(t){this.engine=t,this.guid=eK(),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 em(e,t)&&"guid"in e},t}(),il=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}e9(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&&eC(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},ii(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}(ic);ey([ih(void 0,void 0)],il.prototype,"item",void 0),ey([ih(void 0,void 0)],il.prototype,"_enabled",void 0);var id=function(t){function e(){return t.apply(this,arguments)}e9(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}(il),ip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e._priority=0,e}e9(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)},ii(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}(il);ey([ih(void 0,void 0)],ip.prototype,"materials",void 0),ey([ih(void 0,void 0)],ip.prototype,"_priority",void 0);var im=Math.PI/180,iv=180/Math.PI;function iy(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var ig=function(t,e,i){return(1-i)*t+i*e};function ix(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))}var ib=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):em(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):em(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):em(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):em(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}();ib.ONE=new ib(1,1),ib.ZERO=new ib(0,0);var iT=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):em(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):em(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):em(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):em(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 ib(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}();iT.X=new iT(1,0,0),iT.Y=new iT(0,1,0),iT.Z=new iT(0,0,1),iT.ONE=new iT(1,1,1),iT.ZERO=new iT(0,0,0);var iE=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):em(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):em(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):em(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):em(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 iT(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}();iE.ONE=new iE(1,1,1,1),iE.ZERO=new iE(0,0,0,0);var i_=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.meshCollider=new aO,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}e9(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}(ip);ey([ih(void 0,void 0)],i_.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="EffectComponent",i}e9(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.item.time,r=null!=(e=this.material.getVector4("_Time"))?e:new iE;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i))},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(i_),t.EffectComponent=ey([is(t0.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 e9(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(il),ey([ih(void 0,void 0)],t.PostProcessVolume.prototype,"bloom",void 0),ey([ih(void 0,void 0)],t.PostProcessVolume.prototype,"vignette",void 0),ey([ih(void 0,void 0)],t.PostProcessVolume.prototype,"tonemapping",void 0),ey([ih(void 0,void 0)],t.PostProcessVolume.prototype,"colorAdjustments",void 0),t.PostProcessVolume=ey([is(t0.PostProcessVolume)],t.PostProcessVolume);var iC=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 c=i-n;return this.set(s+c,u+c,h+c,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):em(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):em(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):em(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):em(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 iE(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}();iC.BLACK=new iC(0,0,0,1),iC.BLUE=new iC(0,0,1,1),iC.CLEAR=new iC(0,0,0,0),iC.CYAN=new iC(0,1,1,1),iC.GRAY=new iC(.5,.5,.5,1),iC.GREEN=new iC(0,1,0,1),iC.MAGENTA=new iC(1,0,1,1),iC.RED=new iC(1,0,0,1),iC.WHITE=new iC(1,1,1,1),iC.YELLOW=new iC(1,.92,.016,1);var iA=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],c=e[10],l=i+o+c;if(l>0){var f=.5/Math.sqrt(l+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>c){var d=2*Math.sqrt(1+i-o-c);this.w=(h-s)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(o>c){var p=2*Math.sqrt(1+o-i-c);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+c-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(ix(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),c=Math.atan2(h,o),l=Math.sin((1-e)*c)/h,f=Math.sin(e*c)/h;return this.w=a*l+this.w*f,this.x=i*l+this.x*f,this.y=r*l+this.y*f,this.z=n*l+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,c=a*s+n*o-i*u,l=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)+-(c*n)- -(l*r),d.y=c*a+-(f*r)+-(l*i)- -(h*n),d.z=l*a+-(f*n)+-(h*r)- -(c*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(iT.ZERO,this,iT.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}();iA.tempVec0=new iT;var iS=function(){function t(t,e,i,r,n,a,o,s,u,h,c,l,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===c&&(c=1),void 0===l&&(l=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,c,l,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u,h,c,l,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]=c,v[11]=l,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,c,l,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]=c,v[14]=l,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,c=o*s,l=o*u;return this.set(c*s+n,c*u+a*h,c*h-a*u,0,c*u-a*h,l*u+n,l*h+a*s,0,c*h+a*u,l*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(iT.ZERO,t,iT.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],c=i[5],l=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],A=r[1],S=r[5],w=r[9],O=r[13],M=r[2],R=r[6],I=r[10],P=r[14],L=r[3],V=r[7],F=r[11],D=r[15];return n[0]=a*T+o*A+s*M+u*L,n[4]=a*E+o*S+s*R+u*V,n[8]=a*_+o*w+s*I+u*F,n[12]=a*C+o*O+s*P+u*D,n[1]=h*T+c*A+l*M+f*L,n[5]=h*E+c*S+l*R+f*V,n[9]=h*_+c*w+l*I+f*F,n[13]=h*C+c*O+l*P+f*D,n[2]=d*T+p*A+m*M+v*L,n[6]=d*E+p*S+m*R+v*V,n[10]=d*_+p*w+m*I+v*F,n[14]=d*C+p*O+m*P+v*D,n[3]=y*T+g*A+x*M+b*L,n[7]=y*E+g*S+x*R+b*V,n[11]=y*_+g*w+x*I+b*F,n[15]=y*C+g*O+x*P+b*D,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],c=t[6],l=t[10],f=t[14];return t[3]*(+n*s*c-r*u*c-n*o*l+i*u*l+r*o*f-i*s*f)+t[7]*(+e*s*f-e*u*l+n*a*l-r*a*f+r*u*h-n*s*h)+t[11]*(+e*u*c-e*o*f-n*a*c+i*a*f+n*o*h-i*u*h)+t[15]*(-r*o*h-e*s*c+e*o*l+r*a*c-i*a*l+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],c=t[9],l=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=c*m*u-p*l*u+p*s*f-o*m*f-c*s*v+o*l*v,g=d*l*u-h*m*u-d*s*f+a*m*f+h*s*v-a*l*v,x=h*p*u-d*c*u+d*o*f-a*p*f-h*o*v+a*c*v,b=d*c*s-h*p*s-d*o*l+a*p*l+h*o*m-a*c*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*l*n-c*m*n-p*r*f+i*m*f+c*r*v-i*l*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]=(c*s*n-o*l*n-c*r*u+i*l*u+o*r*f-i*s*f)*E,t[4]=g*E,t[5]=(h*m*n-d*l*n+d*r*f-e*m*f-h*r*v+e*l*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*l*n-h*s*n+h*r*u-e*l*u-a*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*c*n-h*p*n-d*i*f+e*p*f+h*i*v-e*c*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*c*n-h*i*u+e*c*u+a*i*f-e*o*f)*E,t[12]=b*E,t[13]=(h*p*r-d*c*r+d*i*l-e*p*l-h*i*m+e*c*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*c*r-h*o*r+h*i*s-e*c*s-a*i*l+e*o*l)*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=iT.ZERO);var n=this.elements,a=e.x,o=e.y,s=e.z,u=e.w,h=-r.x,c=-r.y,l=-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,A=i.y,S=i.z;return n[0]=(1-(g+b))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*A,n[5]=(1-(m+b))*A,n[6]=(x+T)*A,n[7]=0,n[8]=(y+E)*S,n[9]=(x-T)*S,n[10]=(1-(m+g))*S,n[11]=0,n[12]=h*n[0]+c*n[4]+l*n[8]-h+t.x,n[13]=h*n[1]+c*n[5]+l*n[9]-c+t.y,n[14]=h*n[2]+c*n[6]+l*n[10]-l+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 c=1/o,l=1/s,f=1/u;return h.elements[0]*=c,h.elements[1]*=c,h.elements[2]*=c,h.elements[4]*=l,h.elements[5]*=l,h.elements[6]*=l,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 iT,e=new iA,i=new iT;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,c=-(i+r)*s,l=-(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]=c,f[14]=l,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(!iy(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,c,l,f,d,p,m,v){return new t(e,a,h,d,i,o,c,p,r,s,l,m,n,u,f,v)},t}();iS.IDENTITY=new iS(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),iS.ZERO=new iS(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),iS.tempVec0=new iT,iS.tempVec1=new iT,iS.tempVec2=new iT,iS.tempMat0=new iS;var iw=[],iO={};function iM(){"function"==typeof WebGL2RenderingContext?iR(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iR(WebGLRenderingContext),iR(WebGLRenderingContext.prototype)):iw.push("iOS16 lockdown mode, WebGL Constants not in global"),iw.length||"HALF_FLOAT"in iO||(iO.HALF_FLOAT=5131)}function iR(t){for(var e in t)/^[A-Z_]/.test(e)&&(iO[e]=t[e])}function iI(t){switch(t){case tb.ALPHA:case tb.ADD:case tb.SUBTRACTION:case tb.STRONG_LIGHT:case tb.WEAK_LIGHT:return 1;case tb.SUPERPOSITION:return 2;case tb.BRIGHTNESS:return 3;case tb.MULTIPLY:return 0;default:return 1}}function iP(t,e){switch(e){case void 0:case tb.ALPHA:t.blendFunction=[iO.ONE,iO.ONE_MINUS_SRC_ALPHA,iO.ONE,iO.ONE_MINUS_SRC_ALPHA];break;case tb.ADD:t.blendFunction=[iO.ONE,iO.ONE,iO.ONE,iO.ONE];break;case tb.SUBTRACTION:t.blendFunction=[iO.ONE,iO.ONE,iO.ZERO,iO.ONE],t.blendEquation=[iO.FUNC_REVERSE_SUBTRACT,iO.FUNC_REVERSE_SUBTRACT];break;case tb.SUPERPOSITION:t.blendFunction=[iO.ONE,iO.ONE,iO.ONE,iO.ONE];break;case tb.MULTIPLY:t.blendFunction=[iO.DST_COLOR,iO.ONE_MINUS_SRC_ALPHA,iO.DST_COLOR,iO.ONE_MINUS_SRC_ALPHA];break;case tb.BRIGHTNESS:t.blendFunction=[iO.ONE,iO.ONE_MINUS_SRC_ALPHA,iO.ONE,iO.ONE_MINUS_SRC_ALPHA];break;case tb.STRONG_LIGHT:t.blendFunction=[iO.DST_COLOR,iO.DST_ALPHA,iO.ZERO,iO.ONE];break;case tb.WEAK_LIGHT:t.blendFunction=[iO.DST_COLOR,iO.ZERO,iO.ZERO,iO.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iL(t,e){e===tT.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=iO.CW,t.cullFace=e===tT.BACK?iO.BACK:iO.FRONT)}function iV(e,i){switch(i){case void 0:e.stencilTest=!1;break;case t.MaskMode.MASK:e.stencilTest=!0,e.stencilFunc=[iO.ALWAYS,iO.ALWAYS],e.stencilOpZPass=[iO.REPLACE,iO.REPLACE];break;case t.MaskMode.OBSCURED:e.stencilTest=!0,e.stencilFunc=[iO.EQUAL,iO.EQUAL];break;case t.MaskMode.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[iO.NOTEQUAL,iO.NOTEQUAL];break;case t.MaskMode.NONE:e.stencilTest=!1;break;default:console.warn("MaskMode "+i+" not in specification, please set stencil params seperately.")}}function iF(){return(iF=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)}iw.length||iM(),t.ShaderType=void 0,(W=t.ShaderType||(t.ShaderType={}))[W.vertex=0]="vertex",W[W.fragment=1]="fragment",t.MaskMode=void 0,(H=t.MaskMode||(t.MaskMode={}))[H.NONE=0]="NONE",H[H.MASK=1]="MASK",H[H.OBSCURED=2]="OBSCURED",H[H.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",t.TextureLoadAction=void 0,(Y=t.TextureLoadAction||(t.TextureLoadAction={}))[Y.whatever=0]="whatever",Y[Y.clear=2]="clear",t.TextureSourceType=void 0,(Z=t.TextureSourceType||(t.TextureSourceType={}))[Z.none=0]="none",Z[Z.data=1]="data",Z[Z.image=2]="image",Z[Z.compressed=3]="compressed",Z[Z.video=4]="video",Z[Z.canvas=5]="canvas",Z[Z.framebuffer=6]="framebuffer",Z[Z.mipmaps=7]="mipmaps";var iD=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}(),ik=!1,iN=!1;function iz(t,e){return iU.apply(this,arguments)}function iU(){return(iU=ef(function(t,e){return eg(this,function(i){switch(i.label){case 0:if(!(ik||!e))return[3,2];return[4,ij(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,ij(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),ik=!0,[4,ij(t)];case 6:return[2]}})})).apply(this,arguments)}function iB(t,e){return iG.apply(this,arguments)}function iG(){return(iG=ef(function(t,e){return eg(this,function(i){switch(i.label){case 0:if(!(iN||!e))return[3,2];return[4,ij(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,ij(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iN=!0,[4,ij(t)];case 6:return[2]}})})).apply(this,arguments)}function ij(t){return iX.apply(this,arguments)}function iX(){return(iX=ef(function(t){var e,i;return eg(this,function(r){if(e="",em(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else em(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 iW(t){return iH.apply(this,arguments)}function iH(){return(iH=ef(function(t){return eg(this,function(e){return[2,new Promise(function(e,i){new iD().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iY(){return(iY=ef(function(t){return eg(this,function(e){return[2,new Promise(function(e,i){new iD().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iZ(t){return iq.apply(this,arguments)}function iq(){return(iq=ef(function(t){var e;return eg(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eI()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=e.play();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 iQ(t,e){return iK.apply(this,arguments)}function iK(){return(iK=ef(function(t,e){return eg(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 iJ(t,e,i){return i$.apply(this,arguments)}function i$(){return(i$=ef(function(e,i,r,n){var a,o,s,u,h,c,l;return eg(this,function(f){switch(f.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]:i0(t,i)}))}))];case 1:return s=f.sent(),[2,iF({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return u=e.mipmaps,h=e.target,[4,Promise.all(u.map(function(t){return i0(t,i)}))];case 3:return c=f.sent(),l=n[u[0][1][0]].url,[2,iF({keepImageSource:!1},e,{mipmaps:c,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:h,bin:l,type:t.TextureSourceType.mipmaps,mipmaps:u.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function i0(t,e){return i1.apply(this,arguments)}function i1(){return(i1=ef(function(t,e){var i,r,n,a,o;return eg(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,ij(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var i2=1,i3=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+i2++,i}e9(i,e);var r=i.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(e){var i=e.target,r=void 0===i?iO.TEXTURE_2D:i,n=e.format,a=void 0===n?iO.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),iF({minFilter:iO.NEAREST,magFilter:iO.NEAREST,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.CLAMP_TO_EDGE,target:r,format:iO.RGBA,internalFormat:a,type:iO.UNSIGNED_BYTE},e)},i.fromImage=function(e,r,n){return ef(function(){var a,o;return eg(this,function(s){switch(s.label){case 0:return[4,ij(e)];case 1:return a=s.sent(),(o=i.create(r,iF({sourceType:t.TextureSourceType.image,image:a,target:iO.TEXTURE_2D,id:eK(),flipY:!0},n))).initialize(),[2,o]}})})()},i.fromVideo=function(e,r,n){return ef(function(){var a,o;return eg(this,function(s){switch(s.label){case 0:return[4,iZ(e)];case 1:return a=s.sent(),(o=i.create(r,iF({sourceType:t.TextureSourceType.video,video:a,id:eK(),flipY:!0},n))).initialize(),[2,o]}})})()},ii(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ic);function i4(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?iO.RGBA:3===o?iO.RGB:2===o?iO.LUMINANCE_ALPHA:iO.LUMINANCE,i3.createWithData(t,{data:e,width:i,height:r},{type:iO.HALF_FLOAT,format:n,internalFormat:a,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.CLAMP_TO_EDGE})}var i5={type:iO.UNSIGNED_BYTE,format:iO.RGBA,internalFormat:iO.RGBA,wrapS:iO.MIRRORED_REPEAT,wrapT:iO.MIRRORED_REPEAT,minFilter:iO.NEAREST,magFilter:iO.NEAREST};function i6(e){return i3.create(e,iF({id:e7.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},i5))}function i8(e){return i3.create(e,iF({id:e7.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},i5))}var i9=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){eG.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){eG.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){eG.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 i7(e){var i=new i9(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?iO.TEXTURE_CUBE_MAP:iO.TEXTURE_2D,internalFormat:u,format:h,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,a))+1))}}var rt=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return ef(function(){var i,r;return eg(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]}})})()},i.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===iO.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:eX(a)&&a.length>0}if(i===t.TextureSourceType.mipmaps){var o=e.bin,s=e.mipmaps,u=e.target,h=e.maps,c=e.urls;return o?s.length>0:u===iO.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):c.every(function(t){return eX(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return ef(function(){var n,a,o,s,u,h,c,l,f,d,p,m,v,y,g,x,b,T;return eg(this,function(E){switch(E.label){case 0:if(n=e.type,a=e.target,o=e.map,s=e.url,u=e.bin,h=e.mipmaps,c=e.urls,l=e.maps,!(a===iO.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(o)];case 1:return f=E.sent(),[2,iF({},i,{cube:f,target:iO.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iF({},o),target:iO.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,ij(s)];case 3:return d=E.sent(),[2,iF({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:iO.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,iZ(s)];case 5:return p=E.sent(),[2,iF({},i,{video:p,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,iW(s)];case 7:return m=E.sent(),[2,iF({},i7(m),i,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(n!==t.TextureSourceType.mipmaps)return[3,17];if(!u)return[3,13];return[4,iW(u)];case 9:if(v=E.sent(),g=(y=null!=a?a:iO.TEXTURE_2D)===iO.TEXTURE_2D?h.slice():h.map(function(t){return t.slice()}),a!==iO.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(h.map(function(t){return r.loadMipmapImages(t,v)}))];case 10:return x=E.sent(),[3,12];case 11:x=r.loadMipmapImages(h,v),E.label=12;case 12:return[2,iF({},i,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(a===iO.TEXTURE_2D||!a))return[3,15];return[4,Promise.all(c.map(function(t){return ij(t)}))];case 14:return b=E.sent(),[2,iF({},i,{mipmaps:b,target:iO.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:c.slice(),target:iO.TEXTURE_2D}})];case 15:if(a!==iO.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(l.map(function(t){return r.loadCubeMap(t)}))];case 16:return T=E.sent(),[2,iF({},i,{mipmaps:T,target:iO.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:l.map(function(t){return iF({},t)}),target:iO.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return ef(function(){return eg(this,function(i){return[2,Promise.all(t.map(function(t){return ij(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return ef(function(){return eg(this,function(e){return[2,Promise.all(t.map(function(t){return ij(t)}))]})})()},e}(),re=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 ri(t){return"object"==typeof t&&t&&void 0===t.length&&em(t,i3)}t.MaterialRenderType=void 0,(q=t.MaterialRenderType||(t.MaterialRenderType={}))[q.normal=0]="normal",q[q.transformFeedback=1]="transformFeedback";var rr=1,rn=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"+rr++: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=iF({},u)}else r.name="Material"+rr++,r.renderType=0;return r}e9(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},ii(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}(ic),ra=function(){function e(e){this.engine=e,this.maskable=null,this.stencilClearAction={stencilAction:t.TextureLoadAction.clear}}var i=e.prototype;return i.getRefValue=function(){return 1},i.getMaskMode=function(e){var i=t.MaskMode.NONE;if(e.mask){var r=e.mask,n=r.mask,a=r.mode,o=void 0===a?t.MaskMode.NONE:a,s=r.ref;void 0!==n&&n?i=t.MaskMode.MASK:(o===tE.OBSCURED||o===tE.REVERSE_OBSCURED)&&(i=o===tE.OBSCURED?t.MaskMode.OBSCURED:t.MaskMode.REVERSE_OBSCURED,s&&(this.maskable=s))}return i},i.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},e}();t.ShaderCompileResultStatus=void 0,(Q=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[Q.noShader=0]="noShader",Q[Q.success=1]="success",Q[Q.fail=2]="fail",Q[Q.compiling=3]="compiling",t.GLSLVersion=void 0,(K=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",K.GLSL3="300 es";var ro=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return e9(e,t),e}(ic);t.Shader=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=ep(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(ic),t.Shader=ey([is(t0.Shader)],t.Shader);var rs="effects-internal-copy",ru="effects-internal-copy-mesh",rh="\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}",rc="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 rl(e,i){return{name:rs,vertex:rh,fragment:rc,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:ru+ +i}}var rf={format:iO.RGBA,type:iO.UNSIGNED_BYTE,minFilter:iO.LINEAR,magFilter:iO.LINEAR,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.CLAMP_TO_EDGE},rd=Symbol("dispose"),rp=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(rf).forEach(function(t){var i,r=null!=(i=e[t])?i:rf[t];o[t]=r,s.push(t,r)});var u=s.join(":"),h=this.textureCache[u];if(h)this.textureRef[u]++;else{var c=this.engine;ez(c),h=i3.create(c,o),this.textureCache[u]=h,this.textureRef[u]=1,h[rd]=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[rd](),i.dispose=i[rd]),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[rd](),i.dispose=i[rd]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),rm=function(){function t(t){void 0===t&&(t={}),this.semantics=iF({},t)}var e=t.prototype;return e.toObject=function(){return iF({},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 eH(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}(),rv=((t6={})[iO.FLOAT]=Float32Array.BYTES_PER_ELEMENT,t6[iO.INT]=Int32Array.BYTES_PER_ELEMENT,t6[iO.SHORT]=Int16Array.BYTES_PER_ELEMENT,t6[iO.BYTE]=Int8Array.BYTES_PER_ELEMENT,t6),ry=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="",e.subMeshes=[],e}e9(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(ic);function rg(t){return t===iO.INT?new Int32Array(0):t===iO.SHORT?new Int16Array(0):new Float32Array(0)}(J=t8||(t8={}))[J.XYZ=0]="XYZ",J[J.XZY=1]="XZY",J[J.YXZ=2]="YXZ",J[J.YZX=3]="YZX",J[J.ZXY=4]="ZXY",J[J.ZYX=5]="ZYX";var rx=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],c=i[6],l=i[10];switch(e){case t8.XYZ:this.y=Math.asin(ix(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(c,s),this.z=0);break;case t8.YXZ:this.x=Math.asin(-ix(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(a,l),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-h,r),this.z=0);break;case t8.ZXY:this.x=Math.asin(ix(c,-1,1)),.9999999>Math.abs(c)?(this.y=Math.atan2(-h,l),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case t8.ZYX:this.y=Math.asin(-ix(h,-1,1)),.9999999>Math.abs(h)?(this.x=Math.atan2(c,l),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case t8.YZX:this.z=Math.asin(ix(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,l));break;case t8.XZY:this.z=Math.asin(-ix(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(c,s),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=iv,this.y*=iv,this.z*=iv,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 iA;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*im*.5),o=Math.cos(i*im*.5),s=Math.cos(r*im*.5),u=Math.sin(e*im*.5),h=Math.sin(i*im*.5),c=Math.sin(r*im*.5);switch(n){case t8.XYZ:t.set(u*o*s+a*h*c,a*h*s-u*o*c,a*o*c+u*h*s,a*o*s-u*h*c);break;case t8.YXZ:t.set(u*o*s+a*h*c,a*h*s-u*o*c,a*o*c-u*h*s,a*o*s+u*h*c);break;case t8.ZXY:t.set(u*o*s-a*h*c,a*h*s+u*o*c,a*o*c+u*h*s,a*o*s-u*h*c);break;case t8.ZYX:t.set(u*o*s-a*h*c,a*h*s+u*o*c,a*o*c-u*h*s,a*o*s+u*h*c);break;case t8.YZX:t.set(u*o*s+a*h*c,a*h*s+u*o*c,a*o*c-u*h*s,a*o*s-u*h*c);break;case t8.XZY:t.set(u*o*s-a*h*c,a*h*s-u*o*c,a*o*c+u*h*s,a*o*s+u*h*c);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*im),s=Math.sin(i*im),u=Math.cos(r*im),h=Math.sin(r*im),c=Math.cos(n*im),l=Math.sin(n*im);if(a===t8.XYZ){var f=o*c,d=o*l,p=s*c,m=s*l;e[0]=u*c,e[4]=-u*l,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===t8.YXZ){var v=u*c,y=u*l,g=h*c,x=h*l;e[0]=v+x*s,e[4]=g*s-y,e[8]=o*h,e[1]=o*l,e[5]=o*c,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=o*u}else if(a===t8.ZXY){var b=u*c,T=u*l,E=h*c,_=h*l;e[0]=b-_*s,e[4]=-o*l,e[8]=E+T*s,e[1]=T+E*s,e[5]=o*c,e[9]=_-b*s,e[2]=-o*h,e[6]=s,e[10]=o*u}else if(a===t8.ZYX){var C=o*c,A=o*l,S=s*c,w=s*l;e[0]=u*c,e[4]=S*h-A,e[8]=C*h+w,e[1]=u*l,e[5]=w*h+C,e[9]=A*h-S,e[2]=-h,e[6]=s*u,e[10]=o*u}else if(a===t8.YZX){var O=o*u,M=o*h,R=s*u,I=s*h;e[0]=u*c,e[4]=I-O*l,e[8]=R*l+M,e[1]=l,e[5]=o*c,e[9]=-s*c,e[2]=-h*c,e[6]=M*l+R,e[10]=O-I*l}else if(a===t8.XZY){var P=o*u,L=o*h,V=s*u,F=s*h;e[0]=u*c,e[4]=-l,e[8]=h*c,e[1]=P*l+F,e[5]=o*c,e[9]=L*l-V,e[2]=V*l-L,e[6]=s*c,e[10]=F*l+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}();rx.DEFAULT_ORDER=t8.ZYX,rx.tempQuat0=new iA,rx.tempMat0=new iS;var rb=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,c=e*s,l=i*o,f=i*s,d=r*s,p=n*a,m=n*o,v=n*s,y=this.elements;return y[0]=1-(l+d),y[1]=h+v,y[2]=c-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=c+m,y[7]=f-p,y[8]=1-(u+l),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],c=i[7],l=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+c*b,n[4]=u*m+h*g+c*T,n[7]=u*v+h*x+c*E,n[2]=l*p+f*y+d*b,n[5]=l*m+f*g+d*T,n[8]=l*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],c=h*a-u*o,l=u*r-h*i,f=o*i-a*r,d=e*c+n*l+s*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=c*p,t[1]=(s*o-h*n)*p,t[2]=(u*n-s*a)*p,t[3]=l*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(!iy(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}(),rT=function(){function t(t,e){void 0===t&&(t=iT.ZERO),void 0===e&&(e=iT.X),this.origin=new iT,this.direction=new iT,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 iT;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,c=u.y,l=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,A=1/p,S=1/m;if(C>=0?(i=(y-h)*C,r=(T-h)*C):(i=(T-h)*C,r=(y-h)*C),A>=0?(n=(g-c)*A,a=(E-c)*A):(n=(E-c)*A,a=(g-c)*A),!(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),S>=0?(o=(x-l)*S,s=(_-l)*S):(o=(_-l)*S,s=(x-l)*S),!(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 iT).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,c=a+u;if(!(c<0))return h>=0?this.at(h,i):this.at(c,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),c=t.tempVec2.subtractVectors(this.origin,a),l=t.tempVec3.crossVectors(u,h),f=this.direction.dot(l);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(c,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(c);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*c.dot(l);if(!(m<0))return this.at(m/f,i)}}},t}();rT.tempVec0=new iT,rT.tempVec1=new iT,rT.tempVec2=new iT,rT.tempVec3=new iT;var rE=function(){function t(t,e){void 0===t&&(t=new iT(1/0,1/0,1/0)),void 0===e&&(e=new iT(-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],c=t[s+1],l=t[s+2];h<e&&(e=h),c<i&&(i=c),l<r&&(r=l),h>n&&(n=h),c>a&&(a=c),l>o&&(o=l)}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 iT),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 iT),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 iT),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 iT;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 iT),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 iT),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 iT),this.isEmpty())return[];var i=[];return i[0]=new iT(this.min.x,this.min.y,this.min.z),i[1]=new iT(this.min.x,this.min.y,this.max.z),i[2]=new iT(this.min.x,this.max.y,this.min.z),i[3]=new iT(this.min.x,this.max.y,this.max.z),i[4]=new iT(this.max.x,this.min.y,this.min.z),i[5]=new iT(this.max.x,this.min.y,this.max.z),i[6]=new iT(this.max.x,this.max.y,this.min.z),i[7]=new iT(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 iT;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}(),r_=function(){function t(t,e){void 0===t&&(t=iT.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 rE().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 iT),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 rE),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 iT().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 iT,i=new iT;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 iT().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}(),rC=Object.freeze({__proto__:null,get EulerOrder(){return t8},Euler:rx,Quaternion:iA,Vector2:ib,Vector3:iT,Vector4:iE,Matrix3:rb,Matrix4:iS,Ray:rT,PI2:2*Math.PI,DEG2RAD:im,RAD2DEG:iv,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:iy,damp:function(t,e,i,r){return ig(t,e,1-Math.exp(-i*r))},lerp:ig,degToRad:function(t){return t*im},radToDeg:function(t){return t*iv},clamp:ix,Color:iC,Box3:rE,Sphere:r_}),rA=1,rS=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?iS.fromIdentity():u;r.id="Mesh"+rA++,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"+rA++,r.name="<unnamed>",r.worldMatrix=iS.fromIdentity(),r._priority=0;return r}e9(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)}},ii(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ip);t.RenderPassAttachmentStorageType=void 0,($=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[$.none=0]="none",$[$.color=1]="color",$[$.stencil_8_opaque=2]="stencil_8_opaque",$[$.depth_16_opaque=3]="depth_16_opaque",$[$.depth_stencil_opaque=4]="depth_stencil_opaque",$[$.depth_16_texture=5]="depth_16_texture",$[$.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(tt=t.TextureStoreAction||(t.TextureStoreAction={}))[tt.store=0]="store",tt[tt.clear=2]="clear";var rw=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(em(r,i3))this.texture=r,this.externalTexture=!0;else if(r){var a=r.wrapT,o=r.wrapS,s=r.minFilter,u=r.magFilter,h=r.internalFormat,c=r.format,l=void 0===c?iO.RGBA:c,f=r.type,d=void 0===f?iO.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:l,type:d,internalFormat:h||l,wrapT:a,wrapS:o,minFilter:s,magFilter:u,name:i.name},this.texture=i3.create(e,iF({},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)},ii(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,(te=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[te.force=0]="force",te[te.keep=1]="keep",te[te.keepExternal=2]="keepExternal",te[te.destroy=0]="destroy";var rO=1,rM=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+rO++:r,a=i.clearAction,o=i.semantics,s=i.depthStencilAttachment,u=i.storeAction,h=i.priority,c=i.meshOrder,l=void 0===c?t.OrderType.ascending:c,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===h?0:h,this.meshOrder=l,this.meshes=eD((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=iF({},a),this.storeAction=iF({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new rm(o),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){ek(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){eC(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),eD(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 rw(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 rw(i.renderer.engine,iF({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=h;var c=r3.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);c.bind(),c.unbind(),this.framebuffer=c}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=eQ}},ii(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}(),rR="precision highp float;attribute vec2 atlasOffset;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(atlasOffset.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}",rI="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;}",rP="#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",rL="#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}}",rV="#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}",rF="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",rD="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);}",rk="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);}",rN="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);}",rz="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);}",rU="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);}",rB={},rG=function(){function e(){}return e.registerInclude=function(t,e){rB[t]&&eG.warn('The "'+t+'" shader include already exist.'),rB[t]=e},e.unRegisterInclude=function(t){delete rB[t]},e.unRegisterAllIncludes=function(){Object.keys(rB).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),c=e.parseIncludes(a),l=e.isVersion300(c);return(c=e.removeWebGLVersion(c),2!==r||l||(c=e.convertTo300(c,n===t.ShaderType.fragment)),s)?u+c:h+u+c},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=rB[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}(),rj=function(e){function i(i,r){var n,a=(n=e.call(this,i,r)||this).renderer.engine,o=ry.create(a,{mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=rn.create(a,{shader:{vertex:rF,fragment:rU,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=rS.create(a,{geometry:o,material:s,priority:0}),n.priority=5e3,n}e9(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}(rM),rX=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=ry.create(o,{name:s,mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),h={vertex:rF,fragment:"H"==r?rk:rN,glslVersion:t.GLSLVersion.GLSL1},c=rn.create(o,{name:s,shader:h});return c.blending=!1,c.depthTest=!1,c.culling=!1,a.screenMesh=rS.create(o,{name:s,geometry:u,material:c,priority:0}),a.priority=5e3,a}e9(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",rQ(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(rM),rW=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",a=r.renderer.engine,o=ry.create(a,{name:n,mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=rn.create(a,{name:n,shader:{vertex:rF,fragment:rz}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=rS.create(a,{name:n,geometry:o,material:s,priority:0}),r.priority=5e3,r}e9(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",rQ(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(rM),rH=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,a="PostProcess",o=n.renderer.engine;n.sceneTextureHandle=r||new rw(o);var s=ry.create(o,{name:a,mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=rn.create(o,{name:a,shader:{vertex:rF,fragment:rD,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=rS.create(o,{name:a,geometry:s,material:u,priority:0}),n.priority=5e3,n}e9(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=iF({threshold:0,intensity:0,active:!1},null==i?void 0:i.bloom),n=iF({intensity:0,smoothness:0,roundness:0,active:!1},null==i?void 0:i.vignette),a=iF({brightness:0,saturation:0,contrast:0,active:!1},null==i?void 0:i.colorAdjustments),o=iF({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 ib(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new iT(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(o.active)),e.renderMeshes([this.screenMesh])},i}(rM),rY="_effects_default_",rZ=1,rq=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,c=void 0!==h&&h,l=e.clearAction,f=void 0===l?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:l,d=o.engine;u&&(this.globalVolume=u),this.globalUniforms=new rJ;var p=[],m={};if(this.renderer=o,c){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw Error("Half float texture is not supported.");var v=iO.HALF_FLOAT;p=[{texture:{format:iO.RGBA,type:v,magFilter:iO.LINEAR,minFilter:iO.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}this.drawObjectPass=new rM(o,{name:rY,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),c){var g=new rw(d),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=Array(7),T=iO.HALF_FLOAT,E=new rj(o,{name:"BloomThresholdPass",attachments:[{texture:{format:iO.RGBA,type:T,minFilter:iO.LINEAR,magFilter:iO.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new rw(d);var C=new rX(o,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:iO.RGBA,type:T,minFilter:iO.LINEAR,magFilter:iO.LINEAR}}]}),A=new rX(o,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:iO.RGBA,type:T,minFilter:iO.LINEAR,magFilter:iO.LINEAR}}]});A.gaussianResult=b[_],this.addRenderPass(C),this.addRenderPass(A),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var S=0;S<6;S++){var w=new rW(o,{name:"GaussianUpPass"+S,viewport:x,attachments:[{texture:{format:iO.RGBA,type:T,minFilter:iO.LINEAR,magFilter:iO.LINEAR}}]});w.gaussianDownSampleResult=b[5-S],this.addRenderPass(w),x[2]*=2,x[3]*=2}var O=new rH(o,g);this.addRenderPass(O)}this.semantics=new rm(e.semantics),this.clearAction=f,this.name="RenderFrame"+rZ++;var M=y[0];this.emptyTexture=i6(d),this.transparentTexture=i8(d),this.camera=n,this.keepColorBuffer=a,this.renderPassInfoMap.set(M,{listStart:0,listEnd:0,renderPass:M,intermedia:!1}),this.editorTransform=iE.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new rp(d);var R=d.gpuCapability,I=R.detail,P=rl(R.level,I.readableDepthStencilTextures&&I.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],c=null==(s=h.attachments[0])?void 0:s.texture;if(c&&o===c){var l=c===r?n:r;h.resetColorAttachments([l])}(c=null==(u=h.attachments[0])?void 0:u.texture)&&(o=c)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(rY)&&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===iO.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?iO.LINEAR:iO.NEAREST,h=i3.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iO.RGBA,name:"frame_a",minFilter:u,magFilter:u}),c=i3.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iO.RGBA,data:{width:o,height:s},minFilter:u,magFilter:u,name:"frame_b"}),l=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new rM(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:h}]}).initialize(this.renderer),d=new rK(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:c,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=ry.create(i,{name:rs,mode:iO.TRIANGLE_STRIP,attributes:{aPos:{type:iO.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=rl(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var a=rn.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:rs,shader:n});return a.blending=!1,a.depthTest=!1,a.culling=!1,(null==t?void 0:t.blend)&&(a.blending=!0,a.blendFunction=[iO.SRC_ALPHA,iO.ONE_MINUS_SRC_ALPHA,iO.SRC_ALPHA,iO.ONE_MINUS_SRC_ALPHA]),rS.create(i,{name:rs,geometry:r,material:a,priority:0})},i.removeRenderPass=function(t){eC(this._renderPasses,t)},ii(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function rQ(t){return t?new ib(t.getWidth(),t.getHeight()):new ib}var rK=function(t){function e(){return t.apply(this,arguments)}e9(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",rQ(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(rM),rJ=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},r$=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 ii(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),r0="function"==typeof WebGL2RenderingContext,r1=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=r0&&em(t,WebGL2RenderingContext)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),o=!!t.getExtension("OES_texture_half_float_linear"),s=!!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"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),r&&!o&&(o=r2(t,t.HALF_FLOAT)),r&&!s&&(s=r2(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=r||t.getExtension("OES_texture_float")?t.FLOAT:0,h=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,c={floatTexture:u,halfFloatTexture:h,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"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>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:o,floatLinear:s,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||!!a,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 r2(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,(ti=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[ti.NONE=0]="NONE",ti[ti.PVRTC=1]="PVRTC",ti[ti.ASTC=2]="ASTC",t.FilterMode=void 0,(tr=t.FilterMode||(t.FilterMode={}))[tr.Nearest=0]="Nearest",tr[tr.Linear=1]="Linear",t.RenderTextureFormat=void 0,(tn=t.RenderTextureFormat||(t.RenderTextureFormat={}))[tn.RGBA32=0]="RGBA32",tn[tn.RGBAHalf=1]="RGBAHalf";var r3=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){},ii(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),r4=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}(),r5=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=r6(this.arc,this.arcMode,t)*im,i=new iT(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*im),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eq(0,1)),direction:n.normalize()}},t}();function r6(t,e,i){if(e===tk.RANDOM)t=eq(0,t);else if(e===tk.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tk.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===tk.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var r8=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=r6(this.arc,this.arcMode,t)*im,i=new iT(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),r9=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eq(-this._d,this._d),i=eq(-this._h,this._h);return{direction:new iT(0,0,1),position:new iT(e,i,0)}},t}(),r7=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=r6(this.arc,this.arcMode,t)*im,i=new iT(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new iT;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}(),nt=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tk.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eq(0,1);return{direction:new iT(0,1,0),position:new iT(this._d*(e-.5),0,0)}},t}(),ne=new iS,ni=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=eq(0,2*Math.PI),n=r6(this.arc,this.arcMode,t)*im,a=ne.setFromRotationZ(n),o=new iT(Math.cos(r),Math.sin(r),0),s=new iT(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),nr=new iS,nn=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 eq(-90,90)},e.generate=function(t){var e=r6(this.arc,this.arcMode,t)*im,i=this.getHorizontalAngle()*im,r=this.radius,n=new iT(Math.cos(i),0,Math.sin(i)),a=nr.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),na=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.getHorizontalAngle=function(){return eq(0,90)},e}(nn),no=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=ix(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(r6(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 iT(r,n,0);return{position:new iT(r*this.width,n*this.height,0),direction:a.normalize()}},t}(),ns=function(){function t(){}return t.prototype.generate=function(){return{position:new iT,direction:new iT}},t}(),nu=((t9={})[t_.NONE]=ns,t9[t_.CONE]=r5,t9[t_.SPHERE]=nn,t9[t_.HEMISPHERE]=na,t9[t_.CIRCLE]=r8,t9[t_.DONUT]=ni,t9[t_.RECTANGLE]=r9,t9[t_.EDGE]=nt,t9[t_.RECTANGLE_EDGE]=r7,t9[t_.TEXTURE]=no,t9);function nh(t){if(!t)return new ns;var e=iF({radius:1,arc:360,angle:0,arcMode:tk.RANDOM},t),i=t.type,r=nu[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==t_.NONE){var a=t.alignSpeedDirection,o=t.upDirection;n.alignSpeedDirection=a,n.upDirection=iT.fromArray(void 0===o?[0,0,1]:o).normalize()}return n}function nc(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=nE(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=nE(a,t[a],t[a+1],o);return o&&nv(o,o.next)&&(n_(o),o=o.next),o}function nl(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(nv(r,r.next)||0===nm(r.prev,r,r.next))){if(n_(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function nf(t,e){return t.x-e.x}function nd(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 np(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 nm(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function nv(t,e){return t.x===e.x&&t.y===e.y}function ny(t,e,i,r){var n=nx(nm(t,e,i)),a=nx(nm(t,e,r)),o=nx(nm(i,r,t)),s=nx(nm(i,r,e));return!!(n!==a&&o!==s||0===n&&ng(t,i,e)||0===a&&ng(t,r,e)||0===o&&ng(i,t,r)||0===s&&ng(i,e,r))}function ng(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 nx(t){return t>0?1:t<0?-1:0}function nb(t,e){return 0>nm(t.prev,t,t.next)?nm(t,e,t.next)>=0&&nm(t,t.prev,e)>=0:0>nm(t,e,t.prev)||0>nm(t,t.next,e)}function nT(t,e){var i=new nC(t.i,t.x,t.y),r=new nC(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 nE(t,e,i,r){var n=new nC(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 n_(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 nC(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 nA=0;function nS(t,e,i,r){i=i||2,nA=r||0;var n,a,o,s,u,h,c,l=e&&e.length,f=l?e[0]*i:t.length,d=nc(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(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=nc(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(nf),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 c,l=n,f=n.x,d=n.y,p=1/0;a=n;do o>=a.x&&a.x>=f&&o!==a.x&&np(s<d?o:u,s,f,d,s<d?u:o,s,a.x,a.y)&&(c=Math.abs(s-a.y)/(o-a.x),nb(a,t)&&(c<p||c===p&&(a.x>n.x||a.x===n.x&&(i=n,r=a,0>nm(i.prev,i,r.prev)&&0>nm(r.next,i,i.next))))&&(n=a,p=c)),a=a.next;while(a!==l);return n}(t,e)){var i=nT(e,t);nl(e,e.next),nl(i,i.next)}})(h[n],i),i=nl(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);c=0!==(c=Math.max(o-n,s-a))?1/c: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=nd(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,c=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(nm(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,c=nd(o,s,e,i,r),l=nd(u,h,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=c&&d&&d.z<=l;){if(f!==t.prev&&f!==t.next&&np(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&nm(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&np(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&nm(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&np(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&nm(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&np(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&nm(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(nm(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(np(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&nm(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+nA),i.push(e.i/r+nA),i.push(h.i/r+nA),n_(e),e=h.next,c=h.next;continue}if((e=h)===c){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!nv(n,a)&&ny(n,r,r.next,a)&&nb(n,a)&&nb(a,n)&&(e.push(n.i/i+nA),e.push(r.i/i+nA),e.push(a.i/i+nA),n_(r),n_(r.next),r=t=a),r=r.next}while(r!==t);return nl(r)}(nl(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,c=s.next.next;c!==s.prev;){if(s.i!==c.i&&(u=s,h=c,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&&ny(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,h)&&(nb(u,h)&&nb(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)&&(nm(u.prev,u,h.prev)||nm(u,h.prev,h))||nv(u,h)&&nm(u.prev,u,u.next)>0&&nm(h.prev,h,h.next)>0))){var l=nT(s,c);s=nl(s,s.next),l=nl(l,l.next),t(s,i,r,n,a,o),t(l,i,r,n,a,o);return}c=c.next}s=s.next}while(s!==e)}(e,i,r,n,a,o):t(nl(e),i,r,n,a,o,1);break}}}}(d,p,i,n,a,c),p}var nw="editor",nO={"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 nM(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 c,l=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=(c=d[4])?d[3]:d[2],g=c?d[2]:d[3]);for(var x=[0,0],b=0===c?0:-Math.PI/2,T=0;T<o.length;T++)for(var E=o[T],_=s[T],C=s[T+1]||s[0],A=[0,0],S=0;S<E.length-1;S++)(function(t,e,i,r,n,a,o,s){var u=1-e,h=u*u*u,c=3*e*u*u,l=3*e*e*u,f=e*e*e;t[0]=h*i[0]+c*n+l*o+f*r[0],t[1]=h*i[1]+c*a+l*s+f*r[1]})(A,E[S],_,C,_[4],_[5],C[2],C[3]),i=A[0],r=A[1],l[p++]=i/2,l[p++]=r/2,d?(x[0]=i,x[1]=r,nI(x,x,b),l[p++]=m+(x[0]+1)/2*y,l[p++]=v+(x[1]+1)/2*g):(l[p++]=(i+1)/2,l[p++]=(r+1)/2),p+=2;var w=nS(Array.from(l),null,6,void 0===f?0:f);return{aPoint:l,index:new Uint16Array(w)}}function nR(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[tL.SHAPE_POINTS,t.p],s:[tL.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[tL.SHAPE_POINTS,t.g.p],s:[tL.SHAPE_SPLITS,t.g.s]}):i.push(t),i),a=0,o=0,s=0,u=0;u<n.length;u++){var h=nM(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 c=new Float32Array(o),l=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];c.set(m.aPoint,d),d+=m.aPoint.length,l.set(m.index,p),p+=m.index.length}return{aPoint:c,index:l}}function nI(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 nP=function(e){function i(i){(r=e.call(this,i)||this).color=new iC(1,1,1,1),r.visible=!0,r.meshCollider=new aO,r.getHitTestParams=function(t){var e=iS.fromScale(r.transform.size.x,r.transform.size.y,1).premultiply(r.transform.getWorldMatrix()),i=r.interaction;if(t||i){r.meshCollider.setGeometry(r.geometry,e);var n,a=r.meshCollider.getBoundingBoxData();if(a)return{behavior:(null==(n=r.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:r.renderer.side===tT.FRONT}}},r.renderer={renderMode:tO.MESH,blending:tb.ALPHA,texture:r.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:tT.DOUBLE,maskMode:t.MaskMode.NONE,mask:0};var r,n=rn.create(r.engine,{shader:{fragment:rI,vertex:rR,shared:!0}});return r.material=n,r.material.setColor("_Color",new iC().setFromArray([1,1,1,1])),r.maskManager=new ra(i),r}e9(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){em(t,iC)?this.color.copyFrom(t):this.color.setFromArray(t),this.material.setColor("_Color",this.color)},r.setTexture=function(t){var e=this;return ef(function(){var i;return eg(this,function(r){switch(r.label){case 0:if("string"!=typeof t)return[3,2];return[4,i3.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]}})})()},r.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},r.getItemGeometryData=function(t){var e=this.renderer;if(!e.shape)return t.setAttributeData("aPos",new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])),{index:[0,1,2,2,1,3],atlasOffset:[0,1,0,0,1,1,1,0]};for(var i=e.shape,r=i.index,n=i.aPoint,a=void 0===n?[]:n,o=new Float32Array(a),s=[],u=[],h=0;h<o.length;h+=6)u.push(a[h+2],a[h+3]),s.push(o[h],o[h+1],0);return t.setAttributeData("aPos",new Float32Array(s)),{index:void 0===r?[]:r,atlasOffset:u}},r.createGeometry=function(){var t=ry.create(this.engine,{attributes:{aPos:{type:iO.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:iO.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:iO.TRIANGLES}),e=this.getItemGeometryData(t),i=e.index,r=e.atlasOffset;return t.setIndexData(new Uint16Array(i)),t.setAttributeData("atlasOffset",new Float32Array(r)),t.setDrawCount(i.length),t},r.configureMaterial=function(e){var i=e.side,r=e.occlusion,n=e.blending,a=e.maskMode,o=e.mask,s=e.texture,u=this.material;u.blending=!0,u.depthTest=!0,u.depthMask=r,u.stencilRef=void 0!==o?[o,o]:void 0,iP(u,n),iV(u,a),iL(u,i),u.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',u.setColor("_Color",new iC(0,0,0,1)),u.setVector4("_TexOffset",new iE(0,0,1,1)),u.setTexture("_MainTex",s),this.preMultiAlpha=iI(n);var h=new iE;return h.x=e.occlusion?+e.transparentOcclusion:1,h.y=+this.preMultiAlpha,h.z=e.renderMode,h.w=e.maskMode,u.setVector4("_TexParams",h),0!==h.x&&(e.maskMode!==t.MaskMode.MASK||e.shape)?u.disableMacro("ALPHA_CLIP"):u.enableMacro("ALPHA_CLIP"),u},r.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===tO.BILLBOARD||this.renderer.renderMode===tO.VERTICAL_BILLBOARD||this.renderer.renderMode===tO.HORIZONTAL_BILLBOARD)&&i.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,i,e)}},r.fromData=function(i){e.prototype.fromData.call(this,i);var r,n,a,o,s=null!=(r=i.renderer)?r:{},u=i.mask;u&&u.ref&&(u.ref=this.engine.findObject(u.ref));var h=this.maskManager.getMaskMode(i),c=s.shape,l=i.splits&&!i.textureSheetAnimation?i.splits[0]:void 0,f=void 0;null==c||"aPoint"in c&&"index"in c||(f=nR(c,l)),this.renderer={renderMode:null!=(n=s.renderMode)?n:tO.MESH,blending:null!=(a=s.blending)?a:tb.ALPHA,texture:s.texture?this.engine.findObject(s.texture):this.engine.emptyTexture,occlusion:!!s.occlusion,transparentOcclusion:!!s.transparentOcclusion||h===t.MaskMode.MASK,side:null!=(o=s.side)?o:tT.DOUBLE,mask:this.maskManager.getRefValue(),shape:f,maskMode:h},this.configureMaterial(this.renderer)},i}(ip);t.ShapeComponent=function(e){function i(i){(r=e.call(this,i)||this).hasStroke=!1,r.hasFill=!1,r.shapeDirty=!0,r.graphicsPath=new o7,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=ry.create(i,{attributes:{aPos:{type:iO.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{type:iO.FLOAT,size:2,data:new Float32Array}},mode:iO.TRIANGLES,drawCount:4}),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=rn.create(i,n),o=rn.create(i,n);return a.color=new iC(1,1,1,1),a.depthMask=!1,a.depthTest=!0,a.blending=!0,r.material=a,o.color=new iC(.25,.25,.25,1),o.depthMask=!1,o.depthTest=!0,o.blending=!0,r.materials[1]=o,r.strokeAttributes={width:1,alignment:.5,cap:tQ.Butt,join:tK.Miter,miterLimit:10,color:new iC(1,1,1,1)},r.fillAttribute={color:new iC(1,1,1,1)},r.shapeAttribute={type:tq.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},r}e9(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 n,a=ep(e);!(n=a()).done;){var o=n.value.shape,s=[],u=r.length,h=i.length/2;o.build(s),o.triangulate(s,i,h,r,u)}var c=r.length;if(this.hasStroke)for(var l,f=ep(e);!(l=f()).done;){var d=l.value.shape,p=[];r.length;var m=i.length/2,v=this.strokeAttributes,y=!0;this.shapeAttribute.type===tq.Custom&&(y=d.closePath),d.build(p),oK(p,v,!1,y,i,2,m,r)}var g=r.length-c,x=i.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<r.length)&&(E=new Uint16Array(r.length));for(var _=0;_<x;_++){var C=3*_,A=2*_,S=2*_;b[C]=i[A],b[C+1]=i[A+1],b[C+2]=0,T[S]=b[C],T[S+1]=b[C+1]}E.set(r),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(r.length);var w=this.geometry.subMeshes[0],O=this.geometry.subMeshes[1];w.indexCount=c,O.offset=2*c,O.indexCount=g},r.buildPath=function(e){switch(this.graphicsPath.clear(),e.type){case tq.Custom:for(var i,r=this.shapeAttribute,n=r.points,a=r.easingIns,o=r.easingOuts,s=ep(r.shapes);!(i=s()).done;){var u=i.value,h=u.indexes,c=n[h[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var l=1;l<h.length;l++){var f=h[l],d=h[l-1],p=n[f.point],m=n[d.point],v=o[d.easingOut],y=a[f.easingIn];this.graphicsPath.bezierCurveTo(v.x+m.x,v.y+m.y,y.x+p.x,y.y+p.y,p.x,p.y,1)}if(u.close){var g=h[0],x=h[h.length-1],b=n[g.point],T=n[x.point],E=o[x.easingOut],_=a[g.easingIn];this.graphicsPath.bezierCurveTo(E.x+T.x,E.y+T.y,_.x+b.x,_.y+b.y,b.x,b.y,1),this.graphicsPath.closePath()}}break;case tq.Ellipse:this.graphicsPath.ellipse(0,0,e.xRadius,e.yRadius);break;case tq.Rectangle:this.graphicsPath.rect(-e.width/2,-e.height/2,e.width,e.height,e.roundness);break;case tq.Star:this.graphicsPath.polyStar(e.pointCount,e.outerRadius,e.innerRadius,e.outerRoundness,e.innerRoundness,t.StarType.Star);break;case tq.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 tq.Custom:for(var n,a={type:tq.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:t.fill},o=ep(t.points);!(n=o()).done;){var s=n.value;a.points.push(new ib(s.x,s.y))}for(var u,h=ep(t.easingIns);!(u=h()).done;){var c=u.value;a.easingIns.push(new ib(c.x,c.y))}for(var l,f=ep(t.easingOuts);!(l=f()).done;){var d=l.value;a.easingOuts.push(new ib(d.x,d.y))}a.shapes=t.shapes,this.shapeAttribute=a;break;case tq.Ellipse:var p={type:tq.Ellipse,xRadius:t.xRadius,yRadius:t.yRadius,fill:t.fill};this.shapeAttribute=p;break;case tq.Rectangle:var m={type:tq.Rectangle,width:t.width,height:t.height,roundness:t.roundness,fill:t.fill};this.shapeAttribute=m;break;case tq.Star:var v={type:tq.Star,pointCount:t.pointCount,innerRadius:t.innerRadius,outerRadius:t.outerRadius,innerRoundness:t.innerRoundness,outerRoundness:t.outerRoundness,fill:t.fill};this.shapeAttribute=v;break;case tq.Polygon:var y={type:tq.Polygon,pointCount:t.pointCount,radius:t.radius,roundness:t.roundness,fill:t.fill};this.shapeAttribute=y}var g=t.mask;g&&g.ref&&(g.ref=this.engine.findObject(g.ref));var x=this.maskManager.getMaskMode(t),b=this.maskManager.getRefValue();this.material.stencilRef=void 0!==b?[b,b]:void 0,iV(this.material,x)},ii(i,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),i}(nP),t.ShapeComponent=ey([is("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}e9(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}(il),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"loop",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amountOfMotion",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"animationLength",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"mode",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionX",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionY",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionZ",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionX",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionY",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionZ",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeX",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeY",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeZ",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"phaseX",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"phaseY",void 0),ey([ih(void 0,void 0)],t.Fake3DComponent.prototype,"phaseZ",void 0),t.Fake3DComponent=ey([is("Fake3DComponent")],t.Fake3DComponent),t.Fake3DAnimationMode=void 0,(ta=t.Fake3DAnimationMode||(t.Fake3DAnimationMode={}))[ta.Circular=0]="Circular",ta[ta.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}e9(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}(il),t.CameraController=ey([is(t0.CameraController)],t.CameraController);var nL=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6);t.HitTestType=void 0,(to=t.HitTestType||(t.HitTestType={}))[to.triangle=1]="triangle",to[to.box=2]="box",to[to.sphere=3]="sphere",to[to.custom=4]="custom";var nV="click",nF="touchstart",nD="touchmove",nk="touchend",nN=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",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 eG.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 c=o.target,l=c.width,f=c.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:l,height:f,origin:t}};eP()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",h="touchend"),this.nativeHandlers=((a={})[s]=function(a){if(o.enabled){var s=n(a),u=nz(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},o.dispatchEvent(nF,c(a,t,e))}},a[u]=function(r){if(i&&o.enabled){var a=nz(n(r));t=a.x,e=a.y,o.dispatchEvent(nD,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=nz(a),u=Math.abs(i.clientX-a.clientX)+Math.abs(i.clientY-a.clientY);t=s.x,e=s.y,u<4&&o.dispatchEvent(nV,c(r,t,e)),o.dispatchEvent(nk,c(r,t,e,t-i.x,e-i.y))}i=0},a),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]=[]),e_(i,e),function(){eC(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&eC(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 nz(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 nU=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),nB=(tu=new Int32Array((ts=new Float32Array(1)).buffer),function(t){ts[0]=t;var e=tu[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)}),nG=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]=nB(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=nB(t[i])},t}(),nj=new rx,nX=new iS;function nW(t,e,i,r,n,a,o){var s=r/n,u=r,h=e.speedOverLifetime;h&&(u=h.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(a),t.addScaledVector(o,u),t.addScaledVector(i,c);var l=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new iT;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});nj.setFromArray(v).negate(),nX.setFromEuler(nj);var y=nX.transformPoint(p);t.addVectors(d,y)}if(l.enabled){var g=l.asMovement,x=l.x,b=l.y,T=l.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 nH(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function nY(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function nZ(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 nq=((t7={})[tM.PARTICLE_ORIGIN_CENTER]=[0,0],t7[tM.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t7[tM.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t7[tM.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t7[tM.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t7[tM.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t7[tM.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t7[tM.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t7[tM.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t7);function nQ(t,e,i){var r=i.position,n=new iT(t,e,0),a=new iT;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new rT(r,a)}function nK(t,e,i){var r=t.x,n=t.y,a=t.z,o=new iT(r-e,n+i,a),s=new iT(r-e,n-i,a),u=new iT(r+e,n-i,a),h=new iT(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function nJ(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function n$(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var n0={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 ib(e[r],e[n])},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===tV.LINE?0:i===tV.EASE_OUT?0:i===tV.EASE_IN?2:i===tV.EASE?2:i===tV.HOLD&&r===tV.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===tV.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tV.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tV.EASE,tV.EASE_IN,tV.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tV.EASE,tV.EASE_OUT,tV.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tV.HOLD&&[tV.HOLD,tV.LINE_OUT,tV.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tV.HOLD&&[tV.HOLD,tV.LINE,tV.EASE_IN].includes(i)}},n1=function(t,e){this.points=t,this.totalLength=e},n2={},n3={};function n4(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function n5(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var n6=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=n$(e.x-t.x,3)+"_"+n$(e.y-t.y,3)+"_"+n$(e.z-t.z,3)+"&"+(n$(i.x-t.x,3)+"_"+n$(i.y-t.y,3))+"_"+n$(i.z-t.z,3)+"&"+(n$(r.x-t.x,3)+"_"+n$(r.y-t.y,3))+"_"+n$(r.z-t.z,3);if(n3[n])return{data:n3[n],interval:t};for(var a=[],o=null,s=0,u=0,h=0;h<300;h+=1){var c=new iT,l=h/299;u=0,c.x=3*Math.pow(1-l,2)*l*(i.x-t.x)+3*(1-l)*Math.pow(l,2)*(r.x-t.x)+Math.pow(l,3)*(e.x-t.x),c.y=3*Math.pow(1-l,2)*l*(i.y-t.y)+3*(1-l)*Math.pow(l,2)*(r.y-t.y)+Math.pow(l,3)*(e.y-t.y),c.z=3*Math.pow(1-l,2)*l*(i.z-t.z)+3*(1-l)*Math.pow(l,2)*(r.z-t.z)+Math.pow(l,3)*(e.z-t.z),null!==o&&(u+=Math.pow(c.x-o.x,2)+Math.pow(c.y-o.y,2)+Math.pow(c.z-o.z,2)),o=c,s+=u=Math.sqrt(u),a[h]={partialLength:u,point:c}}var f=new n1(a,s);return n3[n]=f,{data:f,interval:new iT(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(nJ(1-t,0))return e.points[299].point.clone().add(this.interval);if(nJ(e.totalLength,0))return this.p1.clone();var i=new iT,r=n$(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(nJ(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+=n$(e.points[a].partialLength,5)):s<0&&a>0?(n-=n$(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),n8=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new iA,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):nJ(1-t,0)?this.temp.copyFrom(this.p2):(at.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),n9=function(){function t(t,e,i,r){this.mX1=t,this.mY1=e,this.mX2=i,this.mY2=r,this.precomputed=!1,this.mSampleValues=Array(11)}var e=t.prototype;return e.precompute=function(){this.precomputed=!0,(this.mX1!==this.mY1||this.mX2!==this.mY2)&&this.calcSampleValues()},e.getValue=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:isNaN(this.mY1)||isNaN(this.mY2)?0:0===t||1===t?t:(this.precomputed||this.precompute(),n4(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=n4(.1*t,this.mX1,this.mX2)},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=n5(n,this.mX1,this.mX2);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=n5(e,i,r);if(0===a)break;var o=n4(e,i,r)-t;e-=o/a}return e}(t,n,this.mX1,this.mX2):0===a?n:function(t,e,i,r,n){var a,o,s=0;do(a=n4(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.mX1,this.mX2)},t}();function n7(t,e){var i,r,n,a=function(t,e,i){var r=t[1],n=n0.isHoldOutKeyframe(t),a=n0.isHoldInKeyframe(e),o=!a&&n0.isRightSideEase(t),s=!n&&n0.isLeftSideEase(e);if(o&&!s&&!a){var u=new ib(r[r.length-4],r[r.length-3]),h=new ib(r[r.length-2],r[r.length-1]),c=n0.getPointInCurve(e),l=new ib(c.x,c.y),f=new ib(l.x-(l.x-u.x)/10,l.y);return{type:"ease",p0:u,p1:h,p2:f,p3:l}}if(!o&&s&&!n){var d=e[1],p=n0.getPointInCurve(t),m=new ib(p.x,p.y),v=new ib(d[0],d[1]),y=new ib(d[2],d[3]),g=new ib(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 ib(r[r.length-4],r[r.length-3]),p1:new ib(r[r.length-2],r[r.length-1]),p2:new ib(x[0],x[1]),p3:new ib(x[2],x[3])}}var b=n0.getPointInCurve(t),T=n0.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 ib((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),_=new ib((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}}(t,e,!0),o=a.p0,s=a.p1,u=a.p2,h=a.p3;ez(u),ez(h);var c=h.x-o.x,l=h.y-o.y,f=n$((s.x-o.x)/c,5),d=n$((u.x-o.x)/c,5);nJ(l,0)?i=r=NaN:(i=n$((s.y-o.y)/l,5),r=n$((u.y-o.y)/l,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 n2[p]?n=n2[p]:(n=new n9(f,i,d,r),n2[p]=n),{points:[o,s,u,h],timeInterval:c,valueInterval:l,curve:n}}var at=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,c=i.z,l=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=c,t.w=l;return}if(s!==l||n!==u||a!==h||o!==c){var f=1-r,d=n*u+a*h+o*c+s*l,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+c*g,s=s*f+l*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}(),ae="not_implement",ai=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(ae)},e.getIntegrateValue=function(t,e,i){throw Error(ae)},e.getIntegrateByTime=function(t,e){throw Error(ae)},e.getValue=function(t){throw Error(ae)},e.getMaxTime=function(){throw Error(ae)},e.toUniform=function(t){throw Error(ae)},e.map=function(t){throw Error(ae)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(ae)},t.getAllData=function(t,e){for(var i=new(e?nG: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}(),ar=function(t){function e(){return t.apply(this,arguments)}e9(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}(ai),an=function(t){function e(){return t.apply(this,arguments)}e9(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}(ai),aa=function(t){function e(){return t.apply(this,arguments)}e9(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}(ai),ao=function(t){function e(){return t.apply(this,arguments)}e9(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}(ai),as=function(t){function e(){return t.apply(this,arguments)}e9(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 am(e,0,this.xCoord,this.min,this.max)-am(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}(ai),au=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=eO(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 eM(n.color,a.color,o,!0)}}return e[i].color.slice()},e}(ai),ah=function(t){function e(){return t.apply(this,arguments)}e9(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?am:ap,o=0;o<n;o++){var s=i[o],u=i[o+1],h=s[0],c=u[0];if(t>h&&t<=c)return r+a(t,h,c,s[1],u[1]);r+=a(c,h,c,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}(ai),ac=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.curveMap={},this.keys=[];for(var e=0;e<t.length-1;e++){var i=n7(t[e],t[e+1]),r=i.points,n=i.curve,a=i.timeInterval,o=i.valueInterval,s=r[0],u=r[r.length-1];this.keys.push([].concat(s.toArray(),r[1].toArray())),this.keys.push([].concat(u.toArray(),r[2].toArray())),this.curveMap[s.x+"&"+u.x]={points:r,timeInterval:a,valueInterval:o,curve:n,timeStart:Number(s.x),timeEnd:Number(u.x)}}this.startKeyframe=t[0],this.endKeyframe=t[t.length-1],this.keyTimeData=Object.keys(this.curveMap)},i.getValue=function(t){var e=0,i=this.keyTimeData,r=this.curveMap[i[0]].timeStart,n=this.curveMap[i[i.length-1]].timeEnd;if(t<=r)return n0.getPointIndexInCurve(this.startKeyframe,n0.pointIndexCache),this.startKeyframe[1][n0.pointIndexCache.yIndex];if(t>=n)return n0.getPointIndexInCurve(this.endKeyframe,n0.pointIndexCache),this.endKeyframe[1][n0.pointIndexCache.yIndex];for(var a=0;a<i.length;a++){var o=this.curveMap[i[a]].timeStart,s=this.curveMap[i[a]].timeEnd;if(t>=Number(o)&&t<Number(s)){e=this.getCurveValue(i[a],t);break}}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,c=r.y+a*i.curve.getValue(h);0===u||20===u?o+=c:u%2==1?o+=4*c:o+=2*c}return s/3*o},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,o=(e-r.x)/n,s=i.curve.getValue(o);return r.y+a*s},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(){var t=this.keyTimeData;return this.curveMap[t[t.length-1]].timeEnd},e}(ai),al=function(t){function e(){return t.apply(this,arguments)}e9(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}(ai),af=function(t){function e(){return t.apply(this,arguments)}e9(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 iT(i[n][0],i[n][1],i[n][2]),u=new iT(i[n+1][0],i[n+1][1],i[n+1][2]),h=new iT(r[2*n][0],r[2*n][1],r[2*n][2]),c=new iT(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),l=n7(a,o),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new n6(s,u,h,c);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=n$(t,5),i=0,r=new iT,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 c=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=c.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=n$((e-r.x)/n,4);return ix(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(ai),ad=function(t){function e(){return t.apply(this,arguments)}e9(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=iA.fromArray(i[n]),u=iA.fromArray(i[n+1]),h=iA.fromArray(r[2*n]),c=iA.fromArray(r[2*n+1]),l=n7(a,o),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new n8(s,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=n$(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 c=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),c.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=n$((e-r.x)/n,4);return ix(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(ai);function ap(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function am(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 av(t,e){if(e){var i=e[0],r=e[1];if(i===tL.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===tL.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===tL.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 ay(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function ag(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ag=function(){return!!t})()}function ax(t,e,i){return(ax=ag()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&e8(n,i.prototype),n}).apply(null,arguments)}var ab=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iE,e}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=a_(t[0]),this.yCurve=a_(t[1]),this.zCurve=a_(t[2]),this.wCurve=a_(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},e}(ai),aT=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new ib,e}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=a_(t[0]),this.yCurve=a_(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},e}(ai),aE=((et={})[tL.RANDOM]=function(t){return em(t[0],Array)?new ao(t):new aa(t)},et[tL.CONSTANT]=function(t){return new ar(t)},et[tL.CONSTANT_VEC2]=function(t){return new ar(t)},et[tL.CONSTANT_VEC3]=function(t){return new ar(t)},et[tL.CONSTANT_VEC4]=function(t){return new ar(t)},et[tL.RGBA_COLOR]=function(t){return new ar(t)},et[tL.COLORS]=function(t){return new an(t.map(function(t){return eS(t,!1)}))},et[tL.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new as([t[0][1],t[1][1]]):new ah(t)},et[tL.GRADIENT_COLOR]=function(t){return new au(t)},et[tL.LINEAR_PATH]=function(t){return new al(t)},et[tL.BEZIER_CURVE]=function(t){return 1===t.length?new ar(t[0][1][1]):new ac(t)},et[tL.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new ar(ax(iT,[].concat(t[1][0]))):new af(t)},et[tL.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new ar(ax(iA,[].concat(t[1][0]))):new ad(t)},et[tL.COLOR_CURVE]=function(t){return new aC(t)},et[tL.VECTOR4_CURVE]=function(t){return new ab(t)},et[tL.VECTOR2_CURVE]=function(t){return new aT(t)},et);function a_(t){if(!t||!isNaN(+t))return new ar(t||0);if(em(t,ai))return t;if(eH(aE[t[0]]))return aE[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+nO["ValueType: 21/22 is not supported"]+".")}var aC=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iC,e}e9(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=a_(t[0]),this.gCurve=a_(t[1]),this.bCurve=a_(t[2]),this.aCurve=a_(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},e}(ai),aA=1,aS=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 iT,n=new iA,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)===nw]],n=a_(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=rn.create(this.engine,a);return o.blending=!0,o.depthTest=!1,o.setVector4("uPos",new iE(0,0,0,0)),o.setVector2("uSize",new ib(1,1)),o.setVector4("uColor",new iE(n[0]/255,n[1]/255,n[2]/255,n[3])),o.setQuaternion("uQuat",new iA(0,0,0,0)),o},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return ry.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:iO.LINES,maxVertex:4})},i.createMesh=function(t,e){return rS.create(this.engine,{name:"Interact_preview"+aA++,priority:0,worldMatrix:iS.fromIdentity(),geometry:t,material:e})},e}();function aw(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.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},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}e9(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.props.content.options,e=this.item.engine.renderer.env,i=this.item.composition,r=this.interactData.options,n=r.type,a=r.showPreview;if(n===tA.CLICK&&(this.clickable=!0,a&&e===nw)){var o=null==i?void 0:i.getRendererOptions();void 0!==o&&(this.previewContent=new aS(this.item.props.content,o,this.transform,this.engine))}t.type===tA.DRAG&&(e!==nw||t.enableInEditor)&&(null==i?void 0:i.event)&&this.beginDragTarget(t,i.event),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.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===tA.CLICK)this.clickable=!0;else if(t===tA.DRAG){var r,n=this.interactData.options,a=n.enableInEditor;(i!==nw||a)&&(null==(r=this.item.composition)?void 0:r.event)&&this.beginDragTarget(n,this.item.composition.event)}},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){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,aw(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],c=Math.tan(o*Math.PI/180/2)*Math.abs(h),l=this.dragRange,f=l.dxRange,d=l.dyRange,p=a[0]-this.dragRatio[0]*(u*c),m=a[1]-this.dragRatio[1]*(s*c),v=f[0],y=f[1],g=d[0],x=d[1];p=ix(p,v,y),m=ix(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 iT(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.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.handleDragMove(r,t),n.bouncingArg=t},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!aw(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iF({},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=nK(iT.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===tA.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},ii(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(ip),t.InteractComponent=ey([is(t0.InteractComponent)],t.InteractComponent);var aO=function(){function e(){this.triangles=[],this.worldMatrix=new iS,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]},c={x:t[s],y:t[s+1],z:t[s+2]},l={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:c,p2:l})}}}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,n=Number.MAX_VALUE,a=Number.MAX_VALUE,o=ep(this.boundingBoxData.area);!(e=o()).done;){var s=e.value;i=Math.max(s.p0.x,s.p1.x,s.p2.x,i),r=Math.max(s.p0.y,s.p1.y,s.p2.y,r),n=Math.min(s.p0.x,s.p1.x,s.p2.x,n),a=Math.min(s.p0.y,s.p1.y,s.p2.y,a)}var u=[],h=new iT(n,r,0),c=new iT(i,r,0),l=new iT(i,a,0),f=new iT(n,a,0);return u.push({p0:h,p1:c,p2:l}),u.push({p0:h,p1:l,p2:f}),this.applyWorldMatrix(u),{type:t.HitTestType.triangle,area:u}},i.setGeometry=function(e,i){this.triangles=this.geometryToTriangles(e);for(var r,n=[],a=ep(this.triangles);!(r=a()).done;){var o=r.value;n.push({p0:o.p0,p1:o.p1,p2:o.p2})}i&&this.worldMatrix.copyFrom(i),this.boundingBoxData={type:t.HitTestType.triangle,area:n}},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 n,a=ep(t.subMeshes);!(n=a()).done;){var o=n.value;if(void 0!==o.indexCount){var s=e.BYTES_PER_ELEMENT,u=o.offset/s,h=u+o.indexCount;this.assemblyTriangles(i,e,u,h,r)}}return r},i.applyWorldMatrix=function(t){var e=this;return t.forEach(function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new iT),t.p1=e.worldMatrix.transformPoint(t.p1,new iT),t.p2=e.worldMatrix.transformPoint(t.p2,new iT)}),t},e}(),aM=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="sprite",e}return e9(e,t),e}(e6),aR=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=ep(this.playableOutputs);!(e=i()).done;)e.value.context.deltaTime=t;for(var r,n=ep(this.playableOutputs);!(r=n()).done;){var a=r.value;this.prepareFrameWithRoot(a)}for(var o,s=ep(this.playableOutputs);!(o=s()).done;){var u=o.value;this.processFrameWithRoot(u)}},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}(),aI=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}(),aP=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}(),aL=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(ic);function aV(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(th=ee||(ee={}))[th.Playing=0]="Playing",th[th.Paused=1]="Paused";var aF=new iA,aD=1,ak=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new iT(0,0,0),this.quat=new iA(0,0,0,1),this.rotation=new rx(0,0,0),this.scale=new iT(1,1,1),this.anchor=new iT(0,0,0),this.size=new ib(1,1),this.children=[],this.worldMatrix=iS.fromIdentity(),this.localMatrix=iS.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new iT(0,0,0),quat:new iA(0,0,0,1),scale:new iT(1,1,1)},this.name="transform_"+aD++,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,a=t.size,o=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(em(i,iT)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)em(o,iA)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(r){var h=e?-1:1;em(r,rx)?this.setRotation(r.x*h,r.y*h,r.z*h):this.setRotation(r[0]*h,r[1]*h,r[2]*h)}n&&(em(n,iT)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(em(u,ib)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){e_(this.children,t)},e.removeChild=function(t){eC(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new rx)},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 rx)},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={position:new iT().copyFrom(t.position),rotation:new rx(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new iT().copyFrom(t.scale)};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=aF.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},ii(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}(),aN=new iT(1,1,1),az=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new ak,this.viewportMatrix=iS.fromIdentity(),this.viewMatrix=iS.fromIdentity(),this.projectionMatrix=iS.fromIdentity(),this.viewProjectionMatrix=iS.fromIdentity(),this.inverseViewMatrix=iS.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,a=e.aspect,o=e.clipMode,s=void 0===o?tP.portrait:o,u=e.position,h=void 0===u?[0,0,8]:u,c=e.rotation,l=void 0===c?[0,0,0]:c,f=new rx(l[0],l[1],l[2]),d=new iA().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 iT(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 iT(1,1,a)),s=o.x,u=o.y,h=r.projectPoint(new iT(-1,-1,a));return new iT((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 iF({},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*im,r,n,a,o===tP.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),aN),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:iS.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},ii(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}(),aU=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=em(r,ai)?r:a_(r),this.cycles=+n||1/0,this.probability=isNaN(a)?1:+a,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}(),aB=function(t){this.content=t},aG=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 aB(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 aB(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}(),aj="lookup_texture",aX="offscreen_canvas",aW={},aH=new iT,aY=new iT,aZ=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,a=i.colorOverTrail,o=i.maxTrailCount,s=i.opacityOverLifetime,u=void 0===s?a_(1):s,h=i.widthOverTrail,c=i.name,l=i.occlusion,f=i.blending,d=i.maskMode,p=i.mask,m=i.textureMap,v=i.texture,y=i.transparentOcclusion,g=i.minimumVertexDistance,x=i.lifetime,b=i.matrix,T=e.gpuCapability,E=T.detail,_=T.level,C=Math.max(i.pointCountPerTrail,2),A=ay(),S=E.maxVertexTextures>0,w=(null!=(r=e.renderer)?r:{}).env,O={},M=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",w===nw]],R=o>64,I=0;n&&(M.push(["COLOR_OVER_LIFETIME",!0]),I|=1,O.uColorOverLifetime=i3.createWithData(e,eF(n))),a&&(M.push(["COLOR_OVER_TRAIL",!0]),I|=4,O.uColorOverTrail=i3.createWithData(e,eF(a))),R?(M.push(["ATTR_TRAIL_START",1]),I|=8):O.uTrailStart=new Float32Array(o),O.uOpacityOverLifetimeValue=u.toUniform(A);var P=h.toUniform(A);M.push(["VERT_CURVE_VALUE_COUNT",A.index],["VERT_MAX_KEY_FRAME_COUNT",A.max]),O.uVCurveValues=ai.getAllData(A);var L={shader:{vertex:rV,fragment:rP,macros:M,glslVersion:1===_?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+I+"+"+A.index+"+"+A.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},V=C*o*2,F=(C-1)*o,D=Float32Array.BYTES_PER_ELEMENT,k=12*D,N={attributes:{aColor:{size:4,stride:k,data:new Float32Array(12*V)},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(V)},aDir:{size:3,data:new Float32Array(3*V)}},indices:{data:new Uint16Array(6*V)},drawCount:6*F,name:"trail#"+c,bufferUsage:iO.DYNAMIC_DRAW};if(R)N.attributes.aTrailStart={size:1,data:new Float32Array(V)};else{var z=new Float32Array(V);N.attributes.aTrailStartIndex={size:1,data:z};for(var U=0;U<o;U++)for(var B=2*C,G=U*B,j=0;j<B;j++)z[G+j]=U}var X=iI(f),W=rn.create(e,L);W.blending=!0,W.depthMask=l,W.depthTest=!0,W.stencilRef=p?[p,p]:void 0,iV(W,d),iP(W,f);var H=this.mesh=rS.create(e,{name:"MTrail_"+c,material:W,geometry:ry.create(e,N)}),Y=null!=v?v:i3.createWithData(e);Object.keys(O).map(function(t){var e=O[t];if(em(e,i3))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 iE(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}W.setVector4Array(t,i)}else W.setVector4(t,iE.fromArray(e))}),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",iE.fromArray(P)),W.setVector2("uTexOffset",new ib(0,0)),W.setVector4("uTextureMap",iE.fromArray(void 0===m?[0,0,1,1]:m)),W.setVector4("uParams",new iE(0,C-1,0,0)),W.setTexture("uMaskTex",Y),W.setVector4("uColorParams",new iE(v?1:0,+X,0,+(l&&!y))),this.maxTrailCount=o,this.pointCountPerTrail=C,this.checkVertexDistance=g>0,this.minimumVertexDistance=Math.pow(g||.001,2),this.useAttributeTrailStart=R,this.lifetime=x,b&&(this.mesh.worldMatrix=b),this.geometry=H.firstGeometry(),this.trailCursors=new Uint16Array(o)}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,c=this.getTrailPosition(t,u,aH);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+s,f=aJ(c,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*l,v),a.setAttributeSubData("aTime",2*l,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*l,g),u>=0){var b=new Float32Array(aJ(this.getTrailPosition(t,h,aY),c,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 A=this.mesh.material,S=A.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var O=2*n,M=new Float32Array(O),R=0;R<O;R++)M[R]=w;a.setAttributeSubData("aTrailStart",t*M.length,M)}else{var I=A.getFloats("uTrailStart");void 0!=I&&(I[t]=w,A.setFloats("uTrailStart",I))}S&&(S.y=Math.max(S.y,r-1)-Math.max(0,r-n),A.setVector4("uParams",S))}},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 ez(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();ez(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");ez(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();ez(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){},ii(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}(),aq=new iT,aQ=new iT,aK=new iT;function aJ(t,e,i){return t||i?(t?i?(aQ.subtractVectors(e,t).normalize(),aQ.subtractVectors(i,e),aK.copyFrom(aQ).normalize(),aq.addVectors(aQ,aK)):aq.subtractVectors(e,t):aq.subtractVectors(i,e),aq.normalize().toArray()):[0,0,0]}var a$=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}e9(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&em(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){var i=t.deltaTime;this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),.001>Math.abs(this.time-this.lastTime)&&(i=0),e.update(i)}this.lastTime=this.time},i}(aI),a0=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){return new a$(t)},e}(aL),a1={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"},a2=function(){function e(e,i){this.particleCount=0,this.cachedRotationVector3=new iT,this.cachedRotationMatrix=new rb,this.cachedLinearMove=new iT,this.tempMatrix3=new rb,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,a,o,s,u,h,c,l,f=(null!=(h=e.renderer)?h:{}).env,d=i.speedOverLifetime,p=i.colorOverLifetime,m=i.linearVelOverLifetime,v=i.orbitalVelOverLifetime,y=i.sizeOverLifetime,g=i.rotationOverLifetime,x=i.sprite,b=i.gravityModifier,T=i.maxCount,E=i.textureFlip,_=i.useSprite,C=i.name,A=i.gravity,S=i.forceTarget,w=i.side,O=i.occlusion,M=i.anchor,R=i.blending,I=i.maskMode,P=i.mask,L=i.transparentOcclusion,V=i.meshSlots,F=i.renderMode,D=void 0===F?0:F,k=i.diffuse,N=void 0===k?i3.createWithData(e):k,z=e.gpuCapability.detail,U=z.halfFloatTexture,B=z.maxVertexUniforms,G=[["RENDER_MODE",+D],["ENV_EDITOR",f===nw]],j=e.gpuCapability.level,X=ay(),W=ay(),H=B>0,Y={},Z=0,q=0;this.useSprite=_,H&&G.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(G.push(["SPEED_OVER_LIFETIME",!0]),q|=2,Y.uSpeedLifetimeValue=d.toUniform(X)),(null==x?void 0:x.animate)&&(G.push(["USE_SPRITE",!0]),q|=4,Y.uFSprite=Y.uSprite=new Float32Array([x.col,x.row,x.total,x.blend?1:0]),this.useSprite=!0),(null==p?void 0:p.color)&&(G.push(["COLOR_OVER_LIFETIME",!0]),q|=16,Y.uColorOverLifetime=em(p.color,i3)?p.color:i3.createWithData(e,eF(p.color))),(null==p?void 0:p.opacity)?Y.uOpacityOverLifetimeValue=p.opacity.toUniform(X):Y.uOpacityOverLifetimeValue=a_(1).toUniform(X),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==m?void 0:m[t])&&(Y["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=m[t].toUniform(X),i=1,q|=1<<7+e,m.enabled=!0),G.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==v?void 0:v[t])&&(Y["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(X),r=1,q|=1<<10+e,c=!0,v.enabled=!0),G.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==m?void 0:m.asMovement)&&(G.push(["AS_LINEAR_MOVEMENT",!0]),q|=32),c&&((null==v?void 0:v.asRotation)&&(G.push(["AS_ORBITAL_MOVEMENT",!0]),q|=64),Y.uOrbCenter=new Float32Array((null==v?void 0:v.center)||[0,0,0])),Y.uSizeByLifetimeValue=null==y?void 0:y.x.toUniform(X),(null==y?void 0:y.separateAxes)&&(G.push(["SIZE_Y_BY_LIFE",1]),q|=16384,Y.uSizeYByLifetimeValue=null==y?void 0:null==(l=y.y)?void 0:l.toUniform(X)),(null==g?void 0:g.z)&&(Y.uRZByLifeTimeValue=g.z.toUniform(X),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(Y.uRXByLifeTimeValue=g.x.toUniform(X),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(Y.uRYByLifeTimeValue=g.y.toUniform(X),q|=131072,G.push(["ROT_Y_LIFETIME",1])),(null==g?void 0:g.asRotation)&&(G.push(["ROT_LIFETIME_AS_MOVEMENT",1]),q|=262144),Y.uGravityModifierValue=b.toUniform(X),S&&(G.push(["FINAL_TARGET",!0]),q|=524288,Y.uFinalTarget=new Float32Array(S.target||[0,0,0]),Y.uForceCurve=S.curve.toUniform(X)),U&&W.max?(q|=1048576,Y.uFCurveValueTexture=i4(e,ai.getAllData(W,!0),W.index,1)):Y.uFCurveValues=ai.getAllData(W);var Q=X.max+X.curves.length-32>B;if(2===j&&(X.max=-1,X.index=V?V[0]:a4(X.index),W.index>0&&(W.max=-1,W.index=V?V[1]:a4(W.index))),Q&&U&&H){var K=i4(e,ai.getAllData(X,!0),X.index,1);Y.uVCurveValueTexture=K,Z=1}else Y.uVCurveValues=ai.getAllData(X);var J=["-p:",D,q,X.index,X.max,W.index,W.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",X.index],["FRAG_CURVE_VALUE_COUNT",W.index],["VERT_MAX_KEY_FRAME_COUNT",X.max],["FRAG_MAX_KEY_FRAME_COUNT",W.max]),this.VERT_MAX_KEY_FRAME_COUNT=X.max;var $={fragment:rP,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+rL,glslVersion:1===j?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,macros:G,name:"particle#"+C},tt=iI(R);Y.uTexOffset=new Float32Array(N?[1/N.getWidth(),1/N.getHeight()]:[0,0]),Y.uMaskTex=N,Y.uColorParams=new Float32Array([N?1:0,+tt,0,+(!!O&&!L)]),Y.uParams=[0,0,0,0],Y.uAcceleration=[(null==A?void 0:A[0])||0,(null==A?void 0:A[1])||0,(null==A?void 0:A[2])||0,0];var te=rn.create(e,{shader:$,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});te.blending=!0,te.depthTest=!0,te.depthMask=!!O,te.stencilRef=P?[P,P]:void 0,iV(te,I),iP(te,R),iL(te,w),Object.keys(Y).map(function(t){var e=Y[t];if(em(e,i3)){te.setTexture(t,e);return}var i=[];switch(a1[t]){case"vec4":te.setVector4(t,iE.fromArray(e));break;case"vec3":te.setVector3(t,iT.fromArray(e));break;case"vec2":te.setVector2(t,ib.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new iE(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}te.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),te.setVector3("emissionColor",new iT(0,0,0)),te.setFloat("emissionIntensity",0);var ti=ry.create(e,(r=4*T,n=this.useSprite,a="particle#"+C,u={aPos:{size:3,offset:0,stride:s=12*(o=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*o,stride:s,dataSource:"aPos"},aDirX:{size:3,offset:6*o,stride:s,dataSource:"aPos"},aDirY:{size:3,offset:9*o,stride:s,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*o,data:new Float32Array(0)},aSeed:{size:1,offset:3*o,stride:8*o,dataSource:"aRot"},aColor:{size:4,offset:4*o,stride:8*o,dataSource:"aRot"},aOffset:{size:4,stride:4*o,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*o,data:new Float32Array(0)},aRotation1:{size:3,offset:3*o,stride:9*o,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*o,stride:9*o,dataSource:"aRotation0"}},n&&(u.aSprite={size:3,stride:3*o,data:new Float32Array(0)}),{attributes:u,indices:{data:new Uint16Array(0)},name:a,maxVertex:r})),tr=rS.create(e,{name:"MParticle_"+C,material:te,geometry:ti});this.anchor=M,this.mesh=tr,this.geometry=tr.firstGeometry(),this.forceTarget=S,this.sizeOverLifetime=y,this.speedOverLifetime=d,this.linearVelOverLifetime=m,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=b,this.rotationOverLifetime=g,this.maxCount=T,this.textureOffsets=E?[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 ez(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)},c=this.useSprite;c&&(h.aSprite=new Float32Array(12));var l=new iT,f=new iA,d=new iT(1,1,1);e.transform.assignWorldTRS(l,f,d);var p=ak.getRotation(f,new rx),m=l.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();c&&(r=e.sprite);for(var C=0;C<4;C++){var A=2*C,S=3*C,w=4*C,O=12*C,M=8*C;h.aPos.set(m,O),b.fill(h.aPos,O+3),h.aRot.set(v,M),h.aRot[M+3]=_,h.aRot.set(T,M+4),c&&h.aSprite.set(r,S);var R=e.uv||x;if(R){var I=c?1-y[A+1]:y[A+1];g[0]=R[0]+y[A]*R[2],g[1]=R[1]+I*R[3]}h.aOffset.set(g,w);for(var P=C+C,L=(E[P]-this.anchor.x)*d.x,V=(E[P+1]-this.anchor.y)*d.y,F=0;F<3;F++)h.aPos[O+6+F]=e.dirX.getElement(F)*L,h.aPos[O+9+F]=e.dirY.getElement(F)*V}var D=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var k=eA(o.getIndexData(),6*n,6*i,u);k.set(D,6*t),o.setIndexData(k),this.maxParticleBufferCount=k.length/6}else o.setIndexSubData(6*t,D);Object.keys(h).forEach(function(e){var r=h[e],n=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var c=o.getAttributeData(e);ez(c);var l=eA(c,a*n,4*i*n,u);l.set(r,r.length*t),o.setAttributeData(e,l)}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"),c=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;o=n[f],s=n[f+1],u=n[f+2];var d=i-a[4*l+2],p=a[4*l+3];if(h&&c){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*l;if(a[4*l+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"),a=this.geometry.getAttributeData("aSeed"),o=this.time,s=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var h=ix((o-r[4*u+2])/r[4*u+3],0,1),c=8*u,l=this.cachedRotationVector3.set(n[c],n[c+1],n[c+2]),f=a[8*u+3];this.rotationOverLifetime?(this.rotationOverLifetime.x&&(em(this.rotationOverLifetime.x,aa)?l.x+=this.rotationOverLifetime.x.getValue(h,f):l.x+=this.rotationOverLifetime.x.getValue(h)),this.rotationOverLifetime.y&&(em(this.rotationOverLifetime.y,aa)?l.y+=this.rotationOverLifetime.y.getValue(h,f):l.y+=this.rotationOverLifetime.y.getValue(h)),this.rotationOverLifetime.z&&(em(this.rotationOverLifetime.z,aa)?l.z+=this.rotationOverLifetime.z.getValue(h,f):l.z+=this.rotationOverLifetime.z.getValue(h))):s.setZero(),0===l.dot(l)&&s.identity();var d=Math.PI/180,p=l.x*d,m=l.y*d,v=l.z*d,y=Math.sin(p),g=Math.sin(m),x=Math.sin(v),b=Math.cos(p),T=Math.cos(m),E=Math.cos(v);s.set(E,-x,0,x,E,0,0,0,1),s.multiply(this.tempMatrix3.set(T,0,g,0,1,0,-g,0,T)),s.multiply(this.tempMatrix3.set(1,0,0,0,b,-y,0,y,b));var _=9*u,C=s.elements;i.set(C,_),u+4<=t&&(i.set(C,_+9),i.set(C,_+18),i.set(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"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var s=0;s<t;s+=4){var u=a-r[4*s+2],h=r[4*s+3],c=u/h,l=n[8*s+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(em(this.linearVelOverLifetime.x,aa)?o.x=this.linearVelOverLifetime.x.getValue(c,l):o.x=this.linearVelOverLifetime.x.getValue(c)),this.linearVelOverLifetime.y&&(em(this.linearVelOverLifetime.y,aa)?o.y=this.linearVelOverLifetime.y.getValue(c,l):o.y=this.linearVelOverLifetime.y.getValue(c)),this.linearVelOverLifetime.z&&(em(this.linearVelOverLifetime.z,aa)?o.z=this.linearVelOverLifetime.z.getValue(c,l):o.z=this.linearVelOverLifetime.z.getValue(c))):(this.linearVelOverLifetime.x&&(em(this.linearVelOverLifetime.x,aa)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,l):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.y&&(em(this.linearVelOverLifetime.y,aa)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,l):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.z&&(em(this.linearVelOverLifetime.z,aa)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,l):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,h)));var f=3*s;i[f]=o.x,i[f+1]=o.y,i[f+2]=o.z,i[f+3]=o.x,i[f+4]=o.y,i[f+5]=o.z,i[f+6]=o.x,i[f+7]=o.y,i[f+8]=o.z,i[f+9]=o.x,i[f+10]=o.y,i[f+11]=o.z}this.geometry.setAttributeData("aLinearMove",i)},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),a3=[10,32,64,160];function a4(t){for(var e=0;e<a3.length;e++){var i=a3[e];if(i>t)return i}return t||a3[0]}var a5=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new a2(e,i)),r&&(n.trailMesh=new aZ(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}e9(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=ep(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 iE;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=ep(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}(ip);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)===tD.removeParticle,ray:t})}}},n.maskManager=new ra(i),r&&n.fromData(r),n}e9(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]===tL.CONSTANT_VEC3?e.add(r[1]):t=a_(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.setOpacity=function(t){var e,i=this.renderer.particleMesh.mesh.material,r=this.renderer.particleMesh.mesh.geometry,n=(null==(e=i.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];i.setVector4("uOpacityOverLifetimeValue",new iE(n[0],n[1],n[2],t));for(var a=r.getAttributeData("aColor")||[],o=0;o<a.length;o+=32)a[8*o+7]=t},r.setColor=function(t,e,i,r){var n,a=this.renderer.particleMesh.mesh.material,o=this.renderer.particleMesh.mesh.geometry,s=(null==(n=a.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];a.setVector4("uOpacityOverLifetimeValue",new iE(s[0],s[1],s[2],r));for(var u=o.getAttributeData("aColor")||[],h=0;h<u.length;h+=32)u[8*h+4]=t,u[8*h+5]=e,u[8*h+6]=i,u[8*h+7]=r},r.setParentTransform=function(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.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new aG(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.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,h=!1,c=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!==tF.restart&&tF.destroy===this.item.endBehavior){var l=o.last;l&&l.content[0]<this.lastUpdate&&(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],A=!C.disabled&&C.getGeneratorOptions(u,d);if(A){var S=[0,0,0],w=a.burstOffsets[E],O=w&&w[A.cycleIndex]||S;C.once&&this.removeBurst(E);for(var M=0;M<A.count&&_<y&&!g();M++){var R,I=this.initPoint(this.shape.generate({total:A.total,index:A.index,burstIndex:M,burstCount:A.count}));I.delay+=i,_++,(R=I.transform).translate.apply(R,[].concat(O)),this.addParticle(I,y)}}}}else this.item.endBehavior===tF.restart?(c(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=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===tF.freeze&&(this.frozen=!0))}c()}},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 iT,o=!1;if(r&&r.content)do{var s=r.content,u=s[0],h=s[1];s[2];var c=s[3];if(u>this.timePassed){var l=this.getPointPosition(c),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:l,radius:t.radius},a)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),r.content=[0]),n.push(l),t.multiple||(o=!0))}else break}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,c=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(c*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&o.subtract(l)}n.addTrailPoint(t,o,{color:s,lifetime:c,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.lastUpdate-n,u=new iT,h=iT.fromArray(void 0===a?[]:a);e.assignWorldTRS(u);var c=nW(new iT,this.options,h,s,r,u,i);if(o){var l=o.target||[0,0,0],f=o.curve.getValue(s/r),d=1-f;c.x=c.x*d+l[0]*f,c.y=c.y*d+l[1]*f,c.z=c.z*d+l[2]*f}return c},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?iS.IDENTITY:this.transform.getWorldMatrix(),c=t.position,l=new ak({position:h.transformPoint(c,new iT),valid:!0}),f=t.direction;if(f=h.transformNormal(f,a6).normalize(),a.startTurbulence&&a.turbulence){for(var d=0;d<3;d++)oe.setElement(d,a.turbulence[d].getValue(o));oi.setFromVector3(oe.negate()),on.setFromEuler(oi).transformNormal(f).normalize()}s.alignSpeedDirection?(ot.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=iT.Z.clone(),h.transformNormal(this.upDirectionWorld)),a7.crossVectors(ot,this.upDirectionWorld).normalize(),a7.isZero()&&a7.set(1,0,0)):(a7.set(1,0,0),ot.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=or)[0]=p.animationDelay.getValue(o),n[1]=p.animationDuration.getValue(o),n[2]=p.cycles.getValue(o)),a.start3DRotation?a9.set(a.startRotationX.getValue(o),a.startRotationY.getValue(o),a.startRotationZ.getValue(o)):a.startRotation?a9.set(0,0,a.startRotation.getValue(o)):a9.set(0,0,0),l.setRotation(a9.x,a9.y,a9.z);var m=a.startColor.getValue(o);if(3===m.length&&(m[3]=1),a.start3DSize)a8.x=a.startSizeX.getValue(o),a8.y=a.startSizeY.getValue(o);else{var v=a.startSize.getValue(o),y=a.sizeAspect.getValue(o);a8.x=v,a8.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!a.particleFollowParent){var x=new iT;this.transform.assignWorldTRS(void 0,void 0,x),a8.x*=x.x,a8.y*=x.y}return l.setScale(a8.x,a8.y,1),{size:a8,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:ot,dirX:a7,transform:l}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&em(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,a,o,s,u,h,c,l,f,d,p,m=t.options,v=t.positionOverLifetime,y=void 0===v?{}:v,g=t.shape,x=null==y?void 0:y.gravityOverLifetime,b=nH(null==y?void 0:y.gravity),T=t.textureSheetAnimation,E=T?{animationDelay:a_(T.animationDelay||0),animationDuration:a_(T.animationDuration||1),cycles:a_(T.cycles||1),animate:T.animate,col:T.col,row:T.row,total:T.total||T.col*T.row}:void 0,_=!!(g&&g.turbulenceX||(null==g?void 0:g.turbulenceY)||(null==g?void 0:g.turbulenceZ));_&&(n=[a_(null!=(a=g.turbulenceX)?a:0),a_(null!=(o=g.turbulenceY)?o:0),a_(null!=(s=g.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=nh(g),this.emission={rateOverTime:a_(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=em(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 aU(t)})},this.textureSheetAnimation=E;var C=t.renderer||{},A=t.rotationOverLifetime;A&&((h={}).asRotation=!!A.asRotation,h.z=A.z?a_(A.z):a_(0),A.separateAxes&&(h.x=A.x&&a_(A.x),h.y=A.y&&a_(A.y))),(null==y?void 0:y.forceTarget)&&(c={target:y.target||[0,0,0],curve:a_(y.forceCurve||[tL.LINE,[[0,0],[1,1]]])});var S={x:y.linearX&&a_(y.linearX||0),y:y.linearY&&a_(y.linearY||0),z:y.linearZ&&a_(y.linearZ||0),asMovement:y.asMovement},w={x:y.orbitalX&&a_(y.orbitalX),y:y.orbitalY&&a_(y.orbitalY),z:y.orbitalZ&&a_(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},O=t.sizeOverLifetime||{},M=t.colorOverLifetime,R=(null==O?void 0:O.separateAxes)?{separateAxes:!0,x:a_(O.x),y:a_(O.y)}:{separateAxes:!1,x:a_(("size"in O?O.size:O.x)||1)};C.anchor=C.anchor||[0,0];var I=ib.fromArray(C.anchor);this.options={particleFollowParent:!!m.particleFollowParent,startLifetime:a_(m.startLifetime),startDelay:a_(m.startDelay||0),startSpeed:a_(y.startSpeed||0),startColor:a_(m.startColor),looping:!1,maxCount:null!=(l=m.maxCount)?l:0,gravityModifier:a_(x||0),gravity:b,start3DSize:!!m.start3DSize,startTurbulence:_,turbulence:n,speedOverLifetime:y.speedOverLifetime&&a_(y.speedOverLifetime),linearVelOverLifetime:S,orbitalVelOverLifetime:w,forceTarget:c},m.startRotationZ&&(this.options.startRotation=a_(m.startRotationZ||0)),(m.startRotationX||m.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=a_(m.startRotationX||0),this.options.startRotationY=a_(m.startRotationY||0),this.options.startRotationZ=a_(m.startRotationZ||0)),m.start3DSize?(this.options.startSizeX=a_(m.startSizeX),this.options.startSizeY=a_(m.startSizeY)):(this.options.startSize=a_(m.startSize),this.options.sizeAspect=a_(m.sizeAspect||1));var P=this.getMaskOptions(t),L={meshSlots:m.meshSlots,name:this.name,matrix:iS.IDENTITY,shaderCachePrefix:"",renderMode:C.renderMode||tO.BILLBOARD,side:C.side||tT.DOUBLE,gravity:b,blending:C.blending||tb.ALPHA,rotationOverLifetime:h,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:E,occlusion:!!C.occlusion,transparentOcclusion:!!C.transparentOcclusion,maxCount:m.maxCount,mask:P.maskRef,maskMode:P.maskMode,forceTarget:c,diffuse:C.texture?this.engine.findObject(C.texture):void 0,sizeOverLifetime:R,anchor:I};if(M){var V=M.color,F=M.opacity;L.colorOverLifetime={},F&&(L.colorOverLifetime.opacity=a_(M.opacity)),V&&(V[0]===tL.GRADIENT_COLOR?L.colorOverLifetime.color=M.color[1]:V[0]===tL.RGBA_COLOR?L.colorOverLifetime.color=i3.createWithData(this.engine,{data:new Uint8Array(V[1]),width:1,height:1}):em(V,i3)&&(L.colorOverLifetime.color=V))}var D=[],k=[0,0,1,1];if(t.splits){var N=t.splits[0];k=(f=N[4])?[N[0],N[1],N[3],N[2]]:[N[0],N[1],N[2],N[3]]}if(E&&!E.animate)for(var z=f?E.row:E.col,U=f?E.col:E.row,B=E.total||z*U,G=0,j=0;j<z;j++)for(var X=0;X<U&&G<B;X++,G++)D.push([j*k[2]/z+k[0],X*k[3]/U+k[1],k[2]/z,k[3]/U]);else D.push(k);this.uvs=D,L.textureFlip=f;var W=t.trails;W&&(this.trails={lifetime:a_(W.lifetime),dieWithParticles:!1!==W.dieWithParticles,sizeAffectsWidth:!!W.sizeAffectsWidth,sizeAffectsLifetime:!!W.sizeAffectsLifetime,inheritParticleColor:!!W.inheritParticleColor,parentAffectsPosition:!!W.parentAffectsPosition},P=this.getMaskOptions(W),d={name:"Trail",matrix:iS.IDENTITY,minimumVertexDistance:W.minimumVertexDistance||.02,maxTrailCount:m.maxCount,pointCountPerTrail:Math.round(W.maxPointPerTrail)||32,blending:W.blending,texture:W.texture?this.engine.findObject(W.texture):void 0,opacityOverLifetime:a_(W.opacityOverLifetime||1),widthOverTrail:a_(W.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!W.occlusion,transparentOcclusion:!!W.transparentOcclusion,textureMap:W.textureMap,mask:P.maskRef,maskMode:P.maskMode},W.colorOverLifetime&&W.colorOverLifetime[0]===tL.GRADIENT_COLOR&&(d.colorOverLifetime=W.colorOverLifetime[1]),W.colorOverTrail&&W.colorOverTrail[0]===tL.GRADIENT_COLOR&&(d.colorOverTrail=W.colorOverTrail[1])),this.renderer=new a5(this.engine,L,d),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var H=t.interaction;H&&(this.interaction={multiple:H.multiple,radius:null!=(p=H.radius)?p:.4,behavior:H.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},r.getMaskOptions=function(e){var i=t.MaskMode.NONE,r=0;if(e.mask){var n=e.mask;n&&n.ref&&(n.ref=this.engine.findObject(n.ref)),i=this.maskManager.getMaskMode(e),r=this.maskManager.getRefValue()}return{maskMode:i,maskRef:r}},ii(i,[{key:"timePassed",get:function(){return this.lastUpdate-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}(il),t.ParticleSystem=ey([is(t0.ParticleSystem)],t.ParticleSystem);var a6=new iT,a8=new ib,a9=new rx,a7=new iT,ot=new iT,oe=new iT,oi=new rx,or=[0,0,0],on=new iS,oa=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clipPlayables=[],e.clipWeights=[],e}e9(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=ep(this.clipPlayables);!(e=i()).done;)e.value.processFrame(t);this.evaluate(t)},i.setClipWeight=function(t,e){if(em(t,aI)){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}(aI),oo=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(em(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}(oa),os=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(aI),ou=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e9(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 a=this.getClipPlayable(r);if(!em(a,os)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var o=a.value;this.addWeightedValue(o,n),i=!0}}i&&(e[this.propertyName]=this.propertyValue)}}},e}(oa),oh=function(t){function e(){return t.apply(this,arguments)}e9(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}(ou),oc=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(ou),ol=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.evaluate=function(t){},e}(oa),of=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.evaluate=function(t){},e}(oa),od=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();em(i,t.CompositionComponent)&&(i.time=this.getTime())},i}(aI),op=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(em(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}(oa),om=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.evaluate=function(t){},e}(oa),ov=function(t){function e(){return t.apply(this,arguments)}e9(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}(ou),oy=function(t){function e(){return t.apply(this,arguments)}e9(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}(ou),og=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===tF.restart?e%=i:this.endBehavior===tF.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}e9(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new oa(t)},i.createOutput=function(){return new aP},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=ep(this.clips);!(i=n()).done;){var a=i.value;r.push(a)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),a=ep(e);!(r=a()).done;){var o=r.value,s=this.createClipPlayable(t,o);s.setDuration(o.duration);var u=new ox(o,s,n,this);i.push(u),n.clipPlayables.push(s),n.setClipWeight(s,0)}return n},i.createPlayable=function(t){return new aI(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 og;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=ep(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=ep(this.children);!(i=r()).done;)i.value.parent=this},e}(aL),ey([ih(og,void 0)],t.TrackAsset.prototype,"clips",void 0),ey([ih(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=ey([is(t0.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tc=t.TrackType||(t.TrackType={}))[tc.MasterTrack=0]="MasterTrack",tc[tc.ObjectTrack=1]="ObjectTrack";var ox=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,em(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,a=!1,o=this.track.boundObject;e>=i.start+i.duration&&i.endBehavior===tF.destroy?em(o,t.VFXItem)&&t.VFXItem.isParticle(o)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,a=!0):e<i.start&&(r=0),a&&this.playable.getPlayState()!==ee.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var s=parseFloat(i.toLocalTime(e).toFixed(3));this.playable.setTime(s),n&&this.playable.getPlayState()===ee.Playing&&this.playable.pause()},ii(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 e9(e,t),e.prototype.createTrackMixer=function(t){return new oo(t)},e}(t.TrackAsset),t.ActivationTrack=ey([is(t0.ActivationTrack)],t.ActivationTrack);var ob=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}e9(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);ey([ih(void 0,void 0)],ob.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new oc(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}(ob),t.FloatPropertyTrack=ey([is(t0.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){return new of(t)},e}(t.TrackAsset),t.SpriteColorTrack=ey([is(t0.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}e9(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!em(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 op(t)},i}(t.TrackAsset),t.SubCompositionTrack=ey([is(t0.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){return new om(t)},e}(t.TrackAsset),t.TransformTrack=ey([is(t0.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.updateAnimatedObject=function(){em(this.parent.boundObject,ip)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(t.TrackAsset),ey([ih(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=ey([is("MaterialTrack")],t.MaterialTrack);var oT=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){return new ol(t)},e}(t.TrackAsset);t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){var e=new ov(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(ob),t.Vector4PropertyTrack=ey([is(t0.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){var e=new oy(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(ob),t.Vector2PropertyTrack=ey([is("Vector2PropertyTrack")],t.Vector2PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createTrackMixer=function(t){var e=new oh(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(ob),t.ColorPropertyTrack=ey([is(t0.ColorPropertyTrack)],t.ColorPropertyTrack),t.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){var e=new os(t);return e.curve=a_(this.curveData),e.value=e.curve.getValue(0),e},e}(aL),ey([ih(void 0,void 0)],t.ColorPropertyPlayableAsset.prototype,"curveData",void 0),t.ColorPropertyPlayableAsset=ey([is(t0.ColorPropertyPlayableAsset)],t.ColorPropertyPlayableAsset),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){var e=new os(t);return e.curve=a_(this.curveData),e.value=e.curve.getValue(0),e},e}(aL),ey([ih(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=ey([is(t0.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){return new od(t)},e}(aL),t.SubCompositionPlayableAsset=ey([is(t0.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset),t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}e9(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){},r.create=function(e){if(em(this.boundObject,t.VFXItem)){var i=this.boundObject;if(i.getComponent(t.ParticleSystem)){var r=e.createTrack(oT,this,"ParticleTrack");r.boundObject=this.boundObject;var n=r.createClip(a0);n.start=i.start,n.duration=i.duration,n.endBehavior=i.endBehavior}}},i}(t.TrackAsset),t.ObjectBindingTrack=ey([is(t0.ObjectBindingTrack)],t.ObjectBindingTrack);var oE=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}e9(i,e);var r=i.prototype;return r.createPlayable=function(e){for(var i,r=new o_(e),n=ep(this.tracks);!(i=n()).done;){var a=i.value;em(a,t.ObjectBindingTrack)&&a.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=ep(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,o=ep(t.getChildTracks());!(a=o()).done;){var s=a.value;this.addSubTracksRecursive(s,e)}},r.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new oC(t[i],i));e.sort(oA),t.length=0;for(var r,n=ep(e);!(r=n()).done;){var a=r.value;t.push(a.track)}},r.fromData=function(t){},ii(i,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=ep(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),i}(aL),ey([ih(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=ey([is(t0.TimelineAsset)],t.TimelineAsset);var o_=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.masterTrackInstances=[],e}e9(e,t);var i=e.prototype;return i.prepareFrame=function(t){},i.evaluate=function(){for(var t,e=this.getTime(),i=ep(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){for(var i,r={},n=ep(e);!(i=n()).done;){var a=i.value,o=a.createPlayableGraph(t,this.clips),s=a.createOutput();s.setUserData(a.boundObject),t.addOutput(s),s.setSourcePlayable(o);var u=new oE(a,o,s);r[a.getInstanceId()]=u,a.parent||this.masterTrackInstances.push(u)}for(var h,c=ep(e);!(h=c()).done;)for(var l,f=h.value,d=r[f.getInstanceId()],p=ep(f.getChildTracks());!(l=p()).done;){var m=r[l.value.getInstanceId()];d.addChild(m)}},e}(aI),oC=function(t,e){this.track=t,this.originalIndex=e};function oA(e,i){var r=e.track.boundObject,n=i.track.boundObject;return em(r,t.VFXItem)&&em(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 e9(e,t),e.prototype.createPlayable=function(t){var e=new os(t);return e.curve=a_(this.curveData),e.value=e.curve.getValue(0),e},e}(aL),ey([ih(void 0,void 0)],t.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector4PropertyPlayableAsset=ey([is(t0.Vector4PropertyPlayableAsset)],t.Vector4PropertyPlayableAsset),t.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){var e=new os(t);return e.curve=a_(this.curveData),e.value=e.curve.getValue(0),e},e}(aL),ey([ih(void 0,void 0)],t.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector2PropertyPlayableAsset=ey([is(t0.Vector2PropertyPlayableAsset)],t.Vector2PropertyPlayableAsset),t.CompositionComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.startTime=0,t.items=[],t.state=ee.Playing,t.reusable=!1,t.sceneBindings=[],t.graph=new aR,t}e9(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!==tF.destroy&&this.setReusable(!0),null==(e=this.item.composition)||e.refContent.push(this.item)},r.setReusable=function(e){for(var r,n=ep(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value.boundObject;if(em(a,t.VFXItem)){var o=a.getComponent(i);o&&o.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=ep(this.items);!(t=e()).done;)t.value.setActive(!0)},r.onDisable=function(){for(var t,e=ep(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,o){for(var s,u=[],h=(null==o?void 0:o.stop)||ej,c=(null==o?void 0:o.skip)||ej,l=(null==o?void 0:o.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<l;f++){var d=(s=this,function(o){var l=s.items[o];if(l.isActive&&l.transform.getValid()&&!t.VFXItem.isComposition(l)&&!c(l)){var f=l.getHitTestParams(a);if(f){var d=!1,p=new iT;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,u.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,u.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,C=f.radius;e.intersectSphere({center:_,radius:C},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.custom){var A=f.collect(e,new ib(i,r));A&&A.length>0&&(A.forEach(function(t){u.push(t)}),d=!0)}if(d){var S={compContent:s.item,id:l.id,name:l.name,position:u[u.length-1],parentId:l.parentId,hitPositions:u,behavior:f.behavior};if(l.emit("click",S),n.push(S),h(S))return{v:n}}}}}(f));if("object"===ev(d))return d.v}return n},r.setChildrenRenderOrder=function(t){for(var e,r=ep(this.items);!(e=r()).done;){var n=e.value;n.renderOrder=t++;var a=n.getComponent(i);a&&(t=a.setChildrenRenderOrder(t))}return t},r.fromData=function(t){var i;e.prototype.fromData.call(this,t),this.startTime=null!=(i=t.startTime)?i:0},r.resolveBindings=function(){for(var t,e=ep(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,n=ep(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value;this.updateTrackAnimatedObject(a)}},r.updateTrackAnimatedObject=function(t){for(var e,i=ep(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},i}(il),ey([ih(void 0,void 0)],t.CompositionComponent.prototype,"items",void 0),ey([ih(void 0,void 0)],t.CompositionComponent.prototype,"sceneBindings",void 0),ey([ih(void 0,void 0)],t.CompositionComponent.prototype,"timelineAsset",void 0),t.CompositionComponent=ey([is("CompositionComponent")],t.CompositionComponent);var oS=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}))||[]}},ow=function(){function t(){this.update=new oM,this.lateUpdate=new oR}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==il.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==il.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==il.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==il.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),oO=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}(),oM=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=ep(t);!(i=r()).done;)i.value.onUpdate(e)},e}(oO),oR=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=ep(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(oO),oI=function(e){function i(r,n){(v=e.call(this)||this).sceneTicking=new ow,v.speed=1,v.isEnded=!1,v.loaderData={},v.refContent=[],v.postProcessingEnabled=!1,v.assigned=!1,v.destroyed=!1,v.postLoaders=[],v.paused=!1,v.lastVideoUpdateTime=0,v.isEndCalled=!1,v._textures=[];var a,o,s=r.reusable,u=void 0!==s&&s,h=r.speed,c=r.baseRenderOrder,l=r.renderer,f=r.event,d=r.width,p=r.height,m=r.handleItemMessage;v.renderer=l,v._textures=n.textureOptions,v.postProcessingEnabled=null!=(g=null==(y=n.jsonScene.renderSettings)?void 0:y.postProcessingEnabled)&&g,v.getEngine().renderLevel=n.renderLevel,u&&(v.keepResource=!0,n.textures=void 0,n.consumed=!0);for(var v,y,g,x,b=n.jsonScene.compositions[0],T=ep(n.jsonScene.compositions);!(x=T()).done;){var E=x.value;E.id===n.jsonScene.compositionId&&(b=E)}ez(b),v.rootItem=new t.VFXItem(v.getEngine()),v.rootItem.name="rootItem",v.rootItem.duration=b.duration,v.rootItem.endBehavior=b.endBehavior,v.rootItem.composition=aV(v);for(var _,C=b.components,A=ep(C);!(_=A()).done;){var S=_.value,w=v.getEngine().findObject(S);v.rootItem.components.push(w),w.item=v.rootItem}return v.rootComposition=v.rootItem.getComponent(t.CompositionComponent),v.width=d,v.height=p,v.renderOrder=void 0===c?0:c,v.id=b.id,v.renderer=l,v.event=f,v.statistic={loadStart:null!=(a=n.startTime)?a:0,loadTime:null!=(o=n.totalTime)?o:0,compileTime:0,firstFrameTime:0},v.reusable=u,v.speed=void 0===h?1:h,v.name=b.name,v.pluginSystem=n.pluginSystem,v.pluginSystem.initializeComposition(aV(v),n),v.camera=new az(v.name,iF({},null==b?void 0:b.camera,{aspect:d/p})),v.url=n.url,v.assigned=!0,v.interactive=!0,v.handleItemMessage=m,v.createRenderFrame(),v.rendererOptions=null,i.buildItemTree(v.rootItem),v.rootComposition.setChildrenRenderOrder(0),v.pluginSystem.resetComposition(aV(v),v.renderFrame),v}e9(i,e);var r=i.prototype;return r.getDuration=function(){return this.rootItem.duration},r.restart=function(){this.reset(),this.forwardTime(this.startTime)},r.setIndex=function(t){this.renderOrder=t},r.getIndex=function(){return this.renderOrder},r.setSpeed=function(t){this.speed=t},r.setVisible=function(t){this.rootItem.setVisible(t)},r.getSpeed=function(){return this.speed},r.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},r.pause=function(){this.paused=!0},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1},r.gotoAndPlay=function(t){this.setTime(t),this.resume()},r.gotoAndStop=function(t){this.setTime(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new rq({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},r.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.pause(),this.emit("goto",{time:t})},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.forwardTime=function(t){for(var e=1e3*t-1e3*this.rootComposition.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},r.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},r.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)})},r.update=function(t){if(!(!this.assigned||this.getPaused())){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=parseFloat(this.getUpdateTime(t*this.speed).toFixed(0));this.updateRootComposition(e/1e3),this.updateVideo(),this.updatePluginLoaders(t),this.sceneTicking.update.tick(e),this.sceneTicking.lateUpdate.tick(e),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},r.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===tF.destroy&&!this.reusable},r.getUpdateTime=function(t){var e=1e3*this.startTime,i=1e3*this.rootComposition.time;return t<0&&i+t<e?e-i:t},r.callAwake=function(t){for(var e,i=ep(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var n,a=ep(t.children);!(n=a()).done;){var o=n.value;this.callAwake(o)}},r.updateVideo=function(){var t,e=performance.now();e-this.lastVideoUpdateTime>33&&((null!=(t=this.textures)?t:[]).forEach(function(t){return null==t?void 0:t.uploadCurrentVideoFrame()}),this.lastVideoUpdateTime=e)},r.updateCamera=function(){this.camera.updateMatrix()},r.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},r.updateRootComposition=function(t){if(this.rootComposition.state!==ee.Paused&&this.rootComposition.isActiveAndEnabled){var e=parseFloat((this.time+t-this.rootItem.start).toFixed(3)),i=!1,r=this.rootItem.duration,n=this.rootItem.endBehavior;if(e-r>.001)switch(i=!0,n){case tF.restart:e%=r,this.restart();break;case tF.freeze:e=Math.min(r,e);case tF.forward:case tF.destroy:}this.rootComposition.time=e,this.isEnded!==i&&(i?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return nQ((t-i.z)/r,(e-i.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.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},r.addInteractiveItem=function(t,e){if(e===tA.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},r.removeInteractiveItem=function(t,e){e===tA.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}))},r.destroyItem=function(e){var i=this;e.type==tw.composition?e.endBehavior!==tF.freeze&&e.getComponent(t.CompositionComponent).items.forEach(function(t){return i.pluginSystem.plugins.forEach(function(e){return e.onCompositionItemRemoved(i,t)})}):(eC(this.items,e),this.pluginSystem.plugins.forEach(function(t){return t.onCompositionItemRemoved(i,e)}))},r.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()},r.dispose=function(){var e,i,r=this;if(!this.destroyed){this.destroyed=!0;var n={},a=this.textures;a&&this.keepResource&&a.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=ej)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){eG.error("Update disposed composition: "+r.name+".")},this.dispose=ej,a&&this.keepResource&&a.forEach(function(t){t.dispose=n[t.id],t.dispose()}),this.renderer.env!==nw&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},r.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},r.translate=function(t,e,i){this.rootItem.translate(t,e,i)},r.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},r.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},r.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},r.scale=function(t,e,i){this.rootItem.scale(t,e,i)},r.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},r.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},r.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},r.reloadTexture=function(){var t=this;return ef(function(){return eg(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]}})})()},i.buildItemTree=function(e){for(var i,r=new Map,n=e.getComponent(t.CompositionComponent).items,a=ep(n);!(i=a()).done;){var o=i.value;r.set(o.id,o)}for(var s,u=ep(n);!(s=u()).done;){var h=s.value;if(void 0===h.parentId)h.setParent(e);else{var c=r.get(h.parentId);if(c)h.setParent(c);else throw Error("The element references a non-existent element, please check the data.")}}},ii(i,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){return this.rootComposition.startTime}},{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)}}]),i}(oS);t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new ak,r.time=-1,r.duration=0,r.start=0,r.endBehavior=tF.forward,r.type=tw.base,r.components=[],r.isDuringPlay=!1,r.active=!0,r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new oS,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}e9(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=ep(this.components);!(i=r()).done;){var n=i.value;if(em(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=ep(this.components);!(e=r()).done;){var n=e.value;em(n,t)&&i.push(n)}return i},r.setParent=function(t){(t!==this||t)&&(this.parent&&eC(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){this.active!==t&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,i=ep(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 ak({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 rx(t,e,i),n=iA.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 iT;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=ep(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=ep(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=ep(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=ep(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 n=r.id,a=r.name,o=r.delay,s=r.parentId,u=r.endBehavior,h=r.transform,c=r.duration,l=void 0===c?0:c;this.props=r,this.type=r.type,this.id=n.toString(),this.name=a,this.start=o||this.start;var f={};if(h&&(f.position=new iT().copyFrom(h.position),h.quat?f.quat=new iA(h.quat.x,h.quat.y,h.quat.z,h.quat.w):f.rotation=new rx().copyFrom(null!=(d=h.eulerHint)?d:h.rotation),f.scale=new iT().copyFrom(h.scale),h.size&&(f.size=new ib().copyFrom(h.size)),h.anchor&&(f.anchor=new ib().copyFrom(h.anchor)),this.transform.setTransform(f)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=s,this.duration=l,this.endBehavior=u,r.content||(r.content={options:{}}),l<0)throw Error("Item duration can't be less than 0, see "+nO["Item duration can't be less than 0"]+".");if(r.components){this.components.length=0;for(var d,p,m=ep(r.components);!(p=m()).done;){var v=p.value,y=this.engine.findObject(v);this.components.push(y),em(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=t0.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,n=ep(this.components);!(r=n()).done;){var a=r.value;em(a,t.EffectComponent)&&this.defination.components.push(a)}}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=ep(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=ep(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&eC(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,n=i.components,a=ep(n);!(r=a()).done;){var o=r.value,s=this.engine.findObject(o);if(s.item=this,this.components.push(s),s.setInstanceId(eK()),em(s,t.CompositionComponent))for(var u,h=ep(s.items);!(u=h()).done;){var c=u.value;c.setInstanceId(eK());for(var l,f=ep(c.components);!(l=f()).done;)l.value.setInstanceId(eK())}}oI.buildItemTree(this)},r.resetGUID=function(t){var e=null!=(i=null==t?void 0:t.get(this))?i:eK();this.setInstanceId(e);for(var i,r,n=ep(this.components);!(r=n()).done;){var a,o=r.value,s=null!=(a=null==t?void 0:t.get(o))?a:eK();o.setInstanceId(s)}for(var u,h=ep(this.children);!(u=h()).done;)u.value.resetGUID(t)},r.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=ep(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=ep(this.children);!(n=a()).done;)n.value.gatherPreviousObjectID(t)},i.isComposition=function(t){return t.type===tw.composition},i.isSprite=function(t){return t.type===tw.sprite},i.isParticle=function(t){return t.type===tw.particle},i.isNull=function(t){return t.type===tw.null},i.isTree=function(t){return t.type===tw.tree},i.isCamera=function(t){return t.type===tw.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},ii(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=ep(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=ep(this.components);!(e=i()).done;){var r=e.value;em(r,ip)&&(r.priority=t)}}}},{key:"isActive",get:function(){return this.active}},{key:"isVisible",get:function(){return this.visible}}]),i}(ic),t.VFXItem=ey([is(t0.VFXItemData)],t.VFXItem),t.Item=void 0,(tl=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tl.isComposition=function(t){return t.type===tw.composition},tl.isParticle=function(t){return t.type===tw.particle},tl.isNull=function(t){return t.type===tw.null};var oP=[1,1,1,1],oL=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}e9(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n,a=e.output.getUserData();if(em(a,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(a)),!this.activeMaterial){this.activeMaterial=null==(o=this.activeComponent)?void 0:o.material;var o,s,u=null==(s=this.activeMaterial)?void 0:s.getColor("_Color");u&&(this.startColor=u.toArray())}var h=nY(oP,1),c=this.time/a.duration,l=this.opacityOverLifetime,f=this.colorOverLifetime;f&&(h=ew(f,c,!0),i=!0),l&&(h[3]*=l.getValue(c),i=!0),i&&(nZ(this.renderColor,h,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=a_(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tL.GRADIENT_COLOR&&(this.colorOverLifetime=eO(i.color[1]))),this},r.getActiveComponent=function(t){return t.getComponent(nP)},i}(aI),oV=[[0,0,1,1,void 0]],oF=0;function oD(e){t.maxSpriteMeshItemCount=e}t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new oL(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(aL),t.SpriteColorPlayableAsset=ey([is(t0.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset),t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).splits=oV,r.frameAnimationLoop=!1,r.name="MSprite"+oF++,r.geometry=r.createGeometry(),i&&r.fromData(i),r}e9(i,e);var r=i.prototype;return r.onUpdate=function(t){var e=this,i=this.item.time,r=this.item.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)})),a){var s,u,h,c,l,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,c=1/a.col*v):(h=1/a.col*m,c=1/a.row*v),a.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/a.col),b=g-x*a.col;l=u?[h*x,c*(a.col-b)]:[h*b,c*(1+x)]}else l=[0,c];null==(s=this.material.getVector4("_TexOffset"))||s.setFromArray([d+l[0],v+p-l[1],h,c])}},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.getItemGeometryData=function(t){var e=this.splits,i=this.textureSheetAnimation,r=this.renderer;if(r.shape){for(var n=r.shape,a=n.index,o=n.aPoint,s=void 0===o?[]:o,u=new Float32Array(s),h=[],c=[],l=0;l<u.length;l+=6)u[l]*=1,u[l+1]*=1,c.push(s[l+2],s[l+3]),h.push(u[l],u[l+1],0);return t.setAttributeData("aPos",new Float32Array(h)),{index:void 0===a?[]:a,atlasOffset:c}}var f=[],d=[],p=2,m=2;1===e.length&&(p=1,m=1);for(var v=[],y=0;y<p;y++)for(var g=0;g<m;g++){var x=(2*g+y)*4,b=i?[0,0,1,1,e[0][4]]:e[2*g+y],T=b[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],E=((y+y+1)/p-1)/2,_=((g+g+1)/m-1)/2,C=b[0],A=b[1],S=b[4]?b[3]:b[2],w=b[4]?b[2]:b[3],O=[-.5/p+E,.5/m+_,-.5/p+E,-.5/m+_,.5/p+E,.5/m+_,.5/p+E,-.5/m+_];f.push(T[0]*S+C,T[1]*w+A,T[2]*S+C,T[3]*w+A,T[4]*S+C,T[5]*w+A,T[6]*S+C,T[7]*w+A),v.push(1*O[0],1*O[1],0,1*O[2],1*O[3],0,1*O[4],1*O[5],0,1*O[6],1*O[7],0),d.push(x,1+x,2+x,2+x,1+x,3+x)}return t.setAttributeData("aPos",new Float32Array(v)),{index:d,atlasOffset:f}},r.fromData=function(t){e.prototype.fromData.call(this,t);var i=t.interaction,r=t.options;this.interaction=i,this.splits=t.splits||oV,this.textureSheetAnimation=t.textureSheetAnimation;var n=this.createGeometry();this.geometry=n;var a=r.startColor||[1,1,1,1];this.material.setColor("_Color",new iC().setFromArray(a))},i}(nP),t.SpriteComponent=ey([is(t0.SpriteComponent)],t.SpriteComponent),t.maxSpriteMeshItemCount=8;var ok=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),oN=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),oz=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}(),oU=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new oz(aV(i)),i}return e9(e,t),e}(aI),oB=new rx,oG=new iT(1,1,1),oj=new iT,oX=function(e){function i(){return e.apply(this,arguments)}e9(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 iT(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=a_(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&a_(r.linearX),y:r.linearY&&a_(r.linearY),z:r.linearZ&&a_(r.linearZ),asMovement:r.asMovement,enabled:!!o});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&a_(r.orbitalX),y:r.orbitalY&&a_(r.orbitalY),z:r.orbitalZ&&a_(r.orbitalZ),center:nH(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&a_(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=a_(a.x||1),this.sizeYOverLifetime=a_(a.y||1),this.sizeZOverLifetime=a_(a.z||1)):this.sizeXOverLifetime=a_(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:a_(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=a_(n.x||0),u.y=a_(n.y||0)}this.gravity=iT.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=a_(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?iT.fromArray(r.direction).normalize():new iT,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();em(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){oG.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(oG.y=this.sizeYOverLifetime.getValue(r),oG.z=this.sizeZOverLifetime.getValue(r)):oG.z=oG.y=oG.x;var n=this.originalTransform.scale;e.transform.setScale(oG.x*n.x,oG.y*n.y,oG.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;oB.x=s?a(this.rotationOverLifetime.x):0,oB.y=s?a(this.rotationOverLifetime.y):0,oB.z=o;var u=oB.addEulers(this.originalTransform.rotation,oB);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(nW(oj,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&oj.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(oj.x,oj.y,oj.z))},i}(oU);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new oX(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(aL),t.TransformPlayableAsset=ey([is(t0.TransformPlayableAsset)],t.TransformPlayableAsset);var oW=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();em(i,t.VFXItem)&&(i.time=this.time)},i}(aI);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e.prototype.createPlayable=function(t){return new oW(t)},e}(aL),t.ActivationPlayableAsset=ey([is(t0.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.scaleCurves=[],e.floatCurves=[],e}e9(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){var i=e/t.duration;i=i<0?0:i>1?1:i;for(var r,n=ep(this.positionCurves);!(r=n()).done;){var a=r.value,o=a.keyFrames.getValue(i),s=this.findTarget(t,a.path);null==s||s.transform.setPosition(o.x,o.y,o.z)}for(var u,h=ep(this.rotationCurves);!(u=h()).done;){var c=u.value,l=c.keyFrames.getValue(i),f=this.findTarget(t,c.path);null==f||f.transform.setQuaternion(l.x,l.y,l.z,l.w)}for(var d,p=ep(this.scaleCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(i),y=this.findTarget(t,m.path);null==y||y.transform.setScale(v.x,v.y,v.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,i=ep(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:a_(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var a,o=ep(t.rotationCurves);!(a=o()).done;){var s=a.value,u={path:s.path,keyFrames:a_(s.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var h,c=ep(t.scaleCurves);!(h=c()).done;){var l=h.value,f={path:l.path,keyFrames:a_(l.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=ep(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:a_(m.keyFrames),property:m.property,className:m.className};this.duration=Math.max(this.duration,v.keyFrames.getMaxTime()),this.floatCurves.push(v)}},i.findTarget=function(t,e){for(var i,r=t,n=ep(e);!(i=n()).done;){for(var a,o=i.value,s=!1,u=ep(r.children);!(a=u()).done;){var h=a.value;if(h.name===o){r=h,s=!0;break}}if(!s)return}return r},e}(ic),t.AnimationClip=ey([is(t0.AnimationClip)],t.AnimationClip);var oH=function(e){function i(){return e.apply(this,arguments)}return e9(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();em(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(aI),oY=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},ii(t,null,[{key:"shared",get:function(){return oZ.x=0,oZ.y=0,oZ}}]),t}(),oZ=new oY;function oq(t,e,i,r,n,a,o,s){o?(u=r,h=-i):(u=-r,h=i);var u,h,c=t-i*n+u,l=e-r*n+h,f=t+i*a+u,d=e+r*a+h;return s.push(c,l),s.push(f,d),2}function oQ(t,e,i,r,n,a,o,s){var u=i-t,h=r-e,c=Math.atan2(u,h),l=Math.atan2(n-t,a-e);s&&c<l?c+=2*Math.PI:!s&&c>l&&(l+=2*Math.PI);var f=c,d=l-c,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 oK(t,e,i,r,n,a,o,s,u){if(0!==t.length){var h=e.alignment;if(.5!==e.alignment){var c=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&&(c*=-1),h=(h-.5)*c+.5}var l=new oY(t[0],t[1]),f=new oY(t[t.length-2],t[t.length-1]),d=1e-4>Math.abs(l.x-f.x)&&1e-4>Math.abs(l.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=(l.x+f.x)*.5,m=(f.y+l.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],A=t[3],S=0,w=0,O=-(_-A),M=E-C,R=0,I=0,P=Math.sqrt(O*O+M*M)+1e-6;O/=P,M/=P,O*=x,M*=x;var L=h,V=(1-L)*2,F=2*L;r||(e.cap===tQ.Round?y+=oQ(E-O*(V-F)*.5,_-M*(V-F)*.5,E-O*V,_-M*V,E+O*F,_+M*F,n,!0)+2:e.cap===tQ.Square&&(y+=oq(E,_,O,M,V,F,!0,n))),n.push(E-O*V,_-M*V),n.push(E+O*F,_+M*F);for(var D=1;D<v-1;++D){E=t[(D-1)*2],_=t[(D-1)*2+1],C=t[2*D],A=t[2*D+1],S=t[(D+1)*2],w=t[(D+1)*2+1],P=Math.sqrt((O=-(_-A))*O+(M=E-C)*M)+1e-6,O/=P,M/=P,O*=x,M*=x,P=Math.sqrt((R=-(A-w))*R+(I=C-S)*I)+1e-6,R/=P,I/=P,R*=x,I*=x;var k=C-E,N=_-A,z=C-S,U=w-A,B=k*z+N*U,G=N*z-U*k,j=G<0;if(Math.abs(G)<.001*Math.abs(B)){n.push(C-O*V,A-M*V),n.push(C+O*F,A+M*F),B>=0&&(e.join===tK.Round?y+=oQ(C,A,C-O*V,A-M*V,C-R*V,A-I*V,n,!1)+4:y+=2,n.push(C-R*F,A-I*F),n.push(C+R*V,A+I*V));continue}var X=(-O+E)*(-M+A)-(-O+C)*(-M+_),W=(-R+S)*(-I+A)-(-R+C)*(-I+w),H=(k*W-z*X)/G,Y=(U*X-N*W)/G,Z=(H-C)*(H-C)+(Y-A)*(Y-A),q=C+(H-C)*V,Q=A+(Y-A)*V,K=C-(H-C)*F,J=A-(Y-A)*F,$=j?V:F;Z<=Math.min(k*k+N*N,z*z+U*U)+$*$*b?e.join===tK.Bevel||Z/b>T?(j?(n.push(q,Q),n.push(C+O*F,A+M*F),n.push(q,Q),n.push(C+R*F,A+I*F)):(n.push(C-O*V,A-M*V),n.push(K,J),n.push(C-R*V,A-I*V),n.push(K,J)),y+=2):e.join===tK.Round?j?(n.push(q,Q),n.push(C+O*F,A+M*F),y+=oQ(C,A,C+O*F,A+M*F,C+R*F,A+I*F,n,!0)+4,n.push(q,Q),n.push(C+R*F,A+I*F)):(n.push(C-O*V,A-M*V),n.push(K,J),y+=oQ(C,A,C-O*V,A-M*V,C-R*V,A-I*V,n,!1)+4,n.push(C-R*V,A-I*V),n.push(K,J)):(n.push(q,Q),n.push(K,J)):(n.push(C-O*V,A-M*V),n.push(C+O*F,A+M*F),e.join===tK.Round?j?y+=oQ(C,A,C+O*F,A+M*F,C+R*F,A+I*F,n,!0)+2:y+=oQ(C,A,C-O*V,A-M*V,C-R*V,A-I*V,n,!1)+2:e.join===tK.Miter&&Z/b<=T&&(j?(n.push(K,J),n.push(K,J)):(n.push(q,Q),n.push(q,Q)),y+=2),n.push(C-R*V,A-I*V),n.push(C+R*F,A+I*F),y+=2)}E=t[(v-2)*2],_=t[(v-2)*2+1],C=t[(v-1)*2],P=Math.sqrt((O=-(_-(A=t[(v-1)*2+1])))*O+(M=E-C)*M)+1e-6,O/=P,M/=P,O*=x,M*=x,n.push(C-O*V,A-M*V),n.push(C+O*F,A+M*F),r||(e.cap===tQ.Round?y+=oQ(C-O*(V-F)*.5,A-M*(V-F)*.5,C-O*V,A-M*V,C+O*F,A+M*F,n,!1)+2:e.cap===tQ.Square&&(y+=oq(C,A,O,M,V,F,!1,n)));for(var tt=g;tt<y+g-2;++tt)E=n[2*tt],_=n[2*tt+1],C=n[(tt+1)*2],A=n[(tt+1)*2+1],S=n[(tt+2)*2],1e-8>Math.abs(E*(A-(w=n[(tt+2)*2+1]))+C*(w-_)+S*(_-A))||s.push(tt,tt+1,tt+2)}}var oJ=function(){},o$="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o0={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 c(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 l(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=Q(t),t.a.c=t.c,m(t,Q(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=Q(e),e.a.c=e.c,m(e,Q(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,Q(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 A(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 S(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){l(t.a),t.c=!1,t.a=e,e.i=t}function O(t){var e=t.a.a;do t=tc(t);while(t.a.a===e);return t.c&&(e=d(th(t).a.b,t.a.e),w(t,e),t=tc(t)),t}function M(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function R(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 I(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,S(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){I(t);break}w(r,n=d(e.c.b,n.b))}e.c!==n&&(c(Q(n),n),c(e,n)),I(t),e=r.a,t=r}return e}function L(t,e,i,r,n,a){var o=!0;do M(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&&(c(Q(i),i),c(Q(n),i)),r.f=e.f-i.f,r.d=R(t,r.f),e.b=!0,!o&&k(t,e)&&(C(i,n),S(e),l(n)),o=!1,e=r,n=i;e.b=!0,a&&z(t,e)}function V(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 F(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),c(e,i)}function D(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 k(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,l=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(l[h[p>>1]],l[h[p]])?to(a,p):ts(a,p)),l[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;F(t,Q(s),o)}}else f(s.b),c(o,Q(s)),r.b=a.b=!0}else{if(0>n(o.b.a,s.a,o.a))return!1;tc(r).b=r.b=!0,f(o.b),c(Q(s),o)}return!0}function N(t,h){var l=th(h),d=h.a,p=l.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,A=v;if(i(E,_)||(b=E,E=_,_=b),i(C,A)||(b=C,C=A,A=b),i(E,C)||(b=E,E=C,C=b,b=_,_=A,A=b),i(C,_)?i(_,A)?(0>(b=r(E,C,_))+(T=r(C,_,A))&&(b=-b,T=-T),x.b=u(b,C.b,T,_.b)):(0>(b=n(E,C,_))+(T=-n(E,A,_))&&(b=-b,T=-T),x.b=u(b,C.b,T,A.b)):x.b=(C.b+_.b)/2,a(E,_)||(b=E,E=_,_=b),a(C,A)||(b=C,C=A,A=b),a(E,C)||(b=E,E=C,C=b,b=_,_=A,A=b),a(C,_)?a(_,A)?(0>(b=o(E,C,_))+(T=o(C,_,A))&&(b=-b,T=-T),x.a=u(b,C.a,T,_.a)):(0>(b=s(E,C,_))+(T=-s(E,A,_))&&(b=-b,T=-T),x.a=u(b,C.a,T,A.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 k(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),c(p.b,d),d=th(h=O(h)).a,P(t,th(h),l),L(t,h,Q(d),d,d,!0),!0;if(y===t.a){f(p.b),c(d.e,Q(p)),v=(m=l=h).a.b.a;do m=tc(m);while(m.a.b.a===v);return m=th(h=m).a.b.c,l.a=Q(p),p=P(t,l,null),L(t,h,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(tc(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=l.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),c(Q(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,D(d,m,y,p,0),D(d,v,g,p,2),V(t,d,x,p,!0),tc(h).b=h.b=l.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=tc(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}tc(a).b=a.b=!0,p=f(h),c(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),c(h.e,d.b),p.b.d.c=a.d}a=!0}if(a&&(r.c?(S(r),l(s),s=(r=th(e)).a):e.c&&(S(e),l(o),o=(e=tc(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)k(t,e);else if(N(t,e))break}o.a===s.a&&o.b.a===s.b.a&&(C(s,o),S(e),l(o),e=tc(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=A}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=W,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 W=0;function H(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case W: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 Q(t){return t.b.e}function K(){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 tc(t){return t.e.a.b}(E=X.prototype).x=function(){H(this,W)},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];H(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)?c(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){H(this,W),this.d=1,this.b=new K,this.c=t},E.t=function(){H(this,1),this.d=2,this.q=null},E.v=function(){H(this,2),this.d=1},E.w=function(){H(this,1),this.d=W;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&&(F(this,o,a),l(a),o=(a=o).e),o.e===a&&(o!==a&&((o===u||o===u.b)&&(u=u.h),l(o)),(a===u||a===u.b)&&(u=u.h),l(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),F(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&&(l(u.c),h.c=!1),c(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=M(o,h,m)).f=tc(h).f+h.a.f,h.d=R(u,h.f)),t(o,s)):L(o,h,s.c,s.c,null,!0)}return}if(h=(u=th(o=O(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&&N(r,o),e(m.a,r.a)&&(c(Q(u),m),u=th(o=O(o)).a,P(r,th(o),p),y=!0),e(v.a,r.a)&&(c(h,Q(v)),h=P(r,p,null),y=!0),y?L(r,o,h.c,u,u,!0):(s=i(v.a,m.a)?Q(v):m,L(r,o,s=d(h.c.b,s),s.c,s.c,!1),s.b.i.c=!0,z(r,o))}else L(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,S(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),l(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:l(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,Q(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,Q(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},o$.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=o$.libtess}(o0);var o1=((tf=new o0.exports.GluTesselator).gluTessCallback(o0.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),tf.gluTessCallback(o0.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==o0.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),tf.gluTessCallback(o0.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),tf.gluTessCallback(o0.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),tf.gluTessCallback(o0.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),tf);function o2(t){o1.gluTessNormal(0,0,1);var e=[];o1.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){o1.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];o1.gluTessVertex(a,a)}o1.gluTessEndContour()}return o1.gluTessEndPolygon(),e}var o3=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}e9(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=o2([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],c=t[u+1];h<n&&(n=h,a=c),h>o&&(o=h,s=c)}else for(var l=0;l<t.length;l+=2){var f=t[l],d=t[l+1];d<a&&(n=f,a=d),d>s&&(o=f,s=d)}e.push(n,a,o,s,o,s)},ii(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(oJ);function o4(t,e,i,r,n,a,o,s,u,h){var c=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function t(e,i,r,n,a,o,s,u,h,c,l){if(!(l>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(l>0){var C=s-e,A=u-i,S=Math.abs((r-s)*A-(n-u)*C),w=Math.abs((a-s)*A-(o-u)*C);if(S>11920929e-14&&w>11920929e-14){if((S+w)*(S+w)<=c*(C*C+A*A)){h.push(E,_);return}}else if(S>11920929e-14){if(S*S<=c*(C*C+A*A)){h.push(E,_);return}}else if(w>11920929e-14){if(w*w<=c*(C*C+A*A)){h.push(E,_);return}}else if((C=E-(e+s)/2)*C+(A=_-(i+u)/2)*A<=c){h.push(E,_);return}}t(e,i,f,d,g,x,E,_,h,c,l+1),t(E,_,b,T,v,y,s,u,h,c,l+1)}}(e,i,r,n,a,o,s,u,t,c*=c,0),t.push(s,u),t}var o5=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}e9(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,c=t-this.x,l=e-this.y;return c*c/(o*o)+l*l/(s*s)>1&&c*c/(u*u)+l*l/(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,c=o,l=0+r,f=0,d=e+l,p=e-l,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[--c]=_,t[--c]=b}l=0,f=0+n,d=e+l,p=e-l,m=i+f;var C=i-f;return t[s++]=d,t[s++]=m,t[--c]=C,t[--c]=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++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(oJ);t.StarType=void 0,(td=t.StarType||(t.StarType={}))[td.Star=0]="Star",td[td.Polygon=1]="Polygon";var o6=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}e9(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)o4(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;o4(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=o2([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,c=this.innerRoundness/100,l=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:c,r=o?l: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),c=0===s&&0===u?0:-s/Math.sqrt(s*s+u*u),l=2*t;this.v[l]=s,this.v[l+1]=u,this.in[l]=s+h*a*n*1,this.in[l+1]=u+c*a*n*1,this.out[l]=s-h*a*n*1,this.out[l+1]=u-c*a*n*1,o+=1*i}},e}(oJ),o8=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}e9(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)),c=8*h+(s?4:0)+(u?4:0);if(0!==c){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 l=0,f=4*h+(s?2:0)+2,d=f,p=c,m=s+o,v=u,y=n+m,g=n-m,x=a+v;if(t[l++]=y,t[l++]=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,A=n+_,S=n-_,w=a+C,O=a-C;t[l++]=A,t[l++]=w,t[--f]=w,t[--f]=S,t[d++]=S,t[d++]=O,t[--p]=O,t[--p]=A}m=s,v=u+e,y=n+m,g=n-m,x=a+v;var M=a-v;t[l++]=y,t[l++]=x,t[--p]=M,t[--p]=y,s&&(t[l++]=g,t[l++]=x,t[--p]=M,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++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(oJ),o9=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=ep(e.instructions);!(t=i()).done;){var r=t.value,n=r.action,a=r.data;switch(n){case"bezierCurveTo":this.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"moveTo":this.moveTo(a[0],a[1]);break;case"ellipse":this.ellipse(a[0],a[1],a[2],a[3],a[4]);break;case"polyStar":this.polyStar(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"rect":this.rect(a[0],a[1],a[2],a[3],a[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 o4(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 o5(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,a,o){return this.drawShape(new o6(t,e,i,r,n,a),o),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new o8(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 o3).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 o3,this.currentPoly.points.push(0,0))},t}(),o7=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},ii(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new o9(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function st(t,e){return e&&("object"===ev(e)||"function"==typeof e)?e:aV(t)}var se=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 ez(t),t}if(aW[aX])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?e_(this.elements,t):t.remove()},t}()),si=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tX.clip:r,a=t.textBaseline,o=void 0===a?tW.top:a,s=t.textAlign,u=void 0===s?tH.left:s,h=t.text,c=t.letterSpace,l=void 0===c?0:c,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=(void 0===h?" ":h).length*(d+l),this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.letterSpace=l,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 tW.top:h=s+o;break;case tW.middle:h=(this.height*a-u+s)/2;break;case tW.bottom:h=this.height*a-u-o}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tH.left:i=t.outlineWidth*t.fontScale;break;case tH.middle:i=(this.width*t.fontScale-e)/2;break;case tH.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),sr=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,c=t.shadow,l=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,this.textWeight=void 0===l?"normal":l,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),c&&(this.hasShadow=!0,this.shadowBlur=null!=(r=c.shadowBlur)?r:2,this.shadowColor=null!=(n=c.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(a=c.shadowOffsetX)?a:0,this.shadowOffsetY=null!=(o=c.shadowOffsetY)?o:0),this.fontStyle!==tZ.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},sn=["serif","sans-serif","monospace","courier"],sa=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"+sa++,r.geometry=r.createGeometry(),i&&r.fromData(i),r.canvas=se.getCanvas(),se.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return st(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}e9(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 iC(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(nP),t.TextComponent=ey([is(t0.TextComponent)],t.TextComponent);var so=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new sr(t),this.textLayout=new si(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,c=0;c<t.length;c++){var l,f,d=t[c],p=(null!=(f=null==i?void 0:null==(l=i.measureText(d))?void 0:l.width)?f:0)*o;h+=n,a===tX.display?"\n"===d?(u++,h=0):(h+=p,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+p>s&&c>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&&!eU(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===tX.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 c=[],l=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);((l+=r.letterSpace*n)+y.width>a&&m>0||"\n"===v)&&(c.push({y:f,width:l,chars:d,charOffsetX:p}),l=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(l),l+=y.width)}c.push({y:f,width:l,chars:d,charOffsetX:p}),c.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=i3.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:iO.LINEAR,minFilter:iO.LINEAR,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.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 sn.includes(n)?s+=n:s+='"'+n+'"',a!==tY.normal&&(s=a+" "+s),o!==tZ.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}();e$(t.TextComponent,[so]);var ss=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(e6),su=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(ic);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return e9(e,t),e}(ic),ey([ih(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=ey([is(t0.BinaryAsset)],t.BinaryAsset);var sh=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=iu(e);if(r)for(var n,a=ep(Object.keys(r));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[o]=s:eW(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],0)):ic.is(s)?i[o]={id:s.getInstanceId()}:eY(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],0))}for(var u,h=ep(Object.keys(e.defination));!(u=h()).done;){var c=u.value,l=e.defination[c];"number"==typeof l||"string"==typeof l||"boolean"==typeof l||t.checkTypedArray(l)?i[c]=l:eW(l)?(i[c]||(i[c]=[]),t.serializeArrayProperty(l,i[c],0)):ic.is(l)?i[c]={id:l.getInstanceId()}:eY(l)&&(i[c]||(i[c]={}),t.serializeObjectProperty(l,i[c],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=iu(i),n=i.engine;if(r)for(var a,o=ep(Object.keys(r));!(a=o()).done;){var s=a.value,u=e[s];if(void 0!==u){var h=r[s].type;i[s]=t.deserializeProperty(u,n,0,h)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return em(t,Int8Array)||em(t,Uint8Array)||em(t,Uint8ClampedArray)||em(t,Int16Array)||em(t,Uint16Array)||em(t,Int32Array)||em(t,Uint32Array)||em(t,Float32Array)||em(t,Float64Array)||em(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(eY(t)&&1===Object.keys(t).length&&"id"in t&&eX(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return eY(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return eZ(t)||em(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(eW(e)){for(var o,s=[],u=ep(e);!(o=u()).done;){var h=o.value;s.push(t.deserializeProperty(h,i,r+1,n,a))}return s}if(t.checkDataPath(e)){var c=i.findObject(e);return a?c:e}if(!eY(e)||e.constructor!==Object)return e;l=n?new n:{};for(var l,f,d=ep(Object.keys(e));!(f=d()).done;){var p=f.value;l[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return l},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 n,a=ep(Object.keys(e));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[o]=s:eW(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],r+1)):ic.is(s)?i[o]={id:s.getInstanceId()}:eY(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],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:eW(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):ic.is(a)?i[n]={id:a.getInstanceId()}:eY(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}},t}(),sc=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){var i,r=e.id;if(!e)return null;var n=this.findData(r);if(!n){console.error("Object data with uuid: "+r+" not found.");return}switch(n.dataType){case t0.Material:i=rn.create(this.engine);break;case t0.Geometry:i=ry.create(this.engine);break;case t0.Texture:i=i3.create(this.engine);break;default:var a=t.getClass(n.dataType);a&&(i=new a(this.engine))}if(!i){console.error("Constructor for DataType: "+n.dataType+" not found.");return}return i.setInstanceId(n.id),this.engine.addInstance(i),sh.deserialize(n,i),i},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return io[t]},t}(),sl=function(){function t(){}return t.prototype.loadGUID=function(t){return ef(function(){return eg(this,function(t){return[2,void 0]})})()},t}();function sf(t,e){if(!t.includes(e))return t.push(e),!0}function sd(t){if(Number.isFinite(t))return[tL.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tL.CONSTANT)return[tL.CONSTANT,t[1]];if("lines"===e)return[tL.LINE,t[1]];if(e===tL.LINE){var r=i.map(function(t){return[tV.LINE,t]});return[tL.BEZIER_CURVE,r]}return"curve"===e||e===tL.CURVE?[tL.BEZIER_CURVE,sR(i)]:t}}function sp(t,e){return Array.isArray(t)&&"random"===t[0]?[tL.CONSTANT,t[1][e]]:sd(t)}function sm(t){return t&&"color"===t[0]?sg(t[1],!0):[1,1,1,1]}function sv(t){return t&&"random"===t[0]?[tL.RANDOM,t[1]]:sd(t)}function sy(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=sg(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]}),[tL.GRADIENT_COLOR,i]}}function sg(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 em(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=sx(i)),i}function sx(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function sb(t,e){return Array.isArray(t)?t[0]===tL.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&sy(t[1],e):sy(t,e)}function sT(t){if(t){if(3===t.length)return[tL.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tL.BEZIER_PATH||e===tL.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=sR(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[tL.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function sE(t){for(var e,i=ep(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function s_(t){for(var e,i=ep(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var sC=Math.cos,sA=Math.sin,sS=Math.PI/180,sw=180/Math.PI;function sO(t,e){return t?[t[0]-.5,.5-t[1]]:e?sM[e]:[0,0]}var sM=((ei={})[tM.PARTICLE_ORIGIN_CENTER]=[0,0],ei[tM.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],ei[tM.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],ei[tM.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],ei[tM.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],ei[tM.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],ei[tM.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],ei[tM.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],ei[tM.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],ei);function sR(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 c=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),l=c[0],f=c[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[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?[tV.EASE_OUT,t]:e===n.length-1?[tV.EASE_IN,t]:[tV.EASE,t]})}function sI(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tw.null&&t.endBehavior===tF.destroy&&(t.endBehavior=tF.freeze)})}),t.version=tg["2_1"],t}var sP=new Map,sL=new Map,sV=new Map;function sF(t){for(var e,i=ep(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===t0.ShapeComponent&&r.type===tq.Custom){(null==(n=r.shapes)?void 0:n.length)>0&&r.shapes[0].fill&&(r.fill=r.shapes[0].fill);for(var n,a,o=Array(r.easingIns.length),s=Array(r.easingOuts.length).fill(!1),u=ep(r.shapes);!(a=u()).done;)for(var h,c=a.value,l=ep(c.indexes);!(h=l()).done;){var f=h.value,d=r.points[f.point],p=r.easingIns[f.easingIn],m=r.easingOuts[f.easingOut];o[f.easingIn]||(p.x-=d.x,p.y-=d.y,o[f.easingIn]=!0),s[f.easingOut]||(m.x-=d.x,m.y-=d.y,s[f.easingOut]=!0)}}}return t}function sD(e){sP.clear(),sL.clear(),sV.clear();for(var i,r=e.compositions,n=e.items,a=e.components,o=r[0],s=ep(a);!(i=s()).done;){var u=i.value;sP.set(u.id,u)}for(var h,c=ep(r);!(h=c()).done;){var l=h.value;l.id===e.compositionId?o=l:sV.set(l.id,l)}for(var f,d=ep(n);!(f=d()).done;){var p=f.value;sL.set(p.id,p)}return function e(i){for(var r,n=ep(i.items);!(r=n()).done;){var a=r.value,o=sL.get(a.id);if(!o)return;if(o.type===tw.sprite||o.type===tw.particle||o.type===tw.spine||o.type===tw.text||o.type===tw.richtext||o.type===tw.video||o.type===tw.shape){var s=sP.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={mask:!0},er=e.id):(r===tE.OBSCURED||r===tE.REVERSE_OBSCURED)&&(e.mask={mode:r,ref:{id:er}}))}(s)}if(o.type===tw.composition){var u=o.content.options.refId,h=sV.get(u);h&&e(h)}}}(o),e}function sk(t){null==(e=t.plugins)||e.forEach(function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")});for(var e,i,r=ep(t.items);!(i=r()).done;){var n=i.value;if(n.type===tw.sprite){var a=sP.get(n.components[0].id);if(a){var o=a.renderer.shape,s=void 0;s=Number.isInteger(o)?t.shapes[o]:o,a.renderer.shape=s}}}for(var u,h=t.compositionId,c={},l=ep(t.compositions);!(u=l()).done;){var f=u.value,d=eK();c[f.id]=d,f.id===h&&(t.compositionId=d),f.id=d;var p={id:eK(),dataType:"CompositionComponent",items:f.items,timelineAsset:f.timelineAsset,sceneBindings:f.sceneBindings,startTime:f.startTime};f.timelineAsset=void 0,f.sceneBindings=void 0,f.startTime=void 0,f.components=[{id:p.id}],t.components.push(p)}for(var m,v=ep(t.items);!(m=v()).done;){var y=m.value;if(y.content){var g=y.content.options;g&&void 0!==g.refId&&(g.refId=c[g.refId])}}return t}function sN(t){for(var e,i=iF({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=ep(i.images);!(e=r()).done;)e.value.id=eK();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=eK(),t.dataType=t0.Texture,t.source={id:null==(e=i.images[t.source])?void 0:e.id}}),i.textures.length<i.images.length)for(var n=i.textures.length;n<i.images.length;n++)i.textures.push({id:eK(),dataType:t0.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(a=t.bins,i.bins=a.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eK()}}));for(var a,o,s={},u={},h=ep(t.compositions);!(o=h()).done;)!function(){var t=o.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=tF.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tw.particle&&t.content.filter&&delete t.content.filter});for(var e,r=ep(t.items);!(e=r()).done;){var n=e.value;s[n.id]=eK(),n.oldId=n.id,n.id=s[n.id],u[n.id]=n}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=s[n]+"^"+a}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var a=iF({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(a),function(t,e,i){for(var r,n=[],a=[],o=[],s={tracks:[],id:eK(),dataType:"TimelineAsset"},u=ep(t.items);!(r=u()).done;){var h=e[r.value.id],c=[],l={id:eK(),dataType:"ActivationPlayableAsset"};o.push(l);var f={id:eK(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:l.id}}]};if(c.push({id:f.id}),a.push(f),h.type!==tw.particle){var d={id:eK(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};o.push(d);var p={id:eK(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};c.push({id:p.id}),a.push(p)}if(h.type===tw.sprite||h.type===tw.text){var m={id:eK(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};o.push(m);var v={id:eK(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};c.push({id:v.id}),a.push(v)}if(h.type===tw.composition){var y={id:eK(),dataType:"SubCompositionPlayableAsset"};o.push(y);var g={id:eK(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};c.push({id:g.id}),a.push(g)}var x={id:eK(),dataType:"ObjectBindingTrack",children:c,clips:[]};a.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],E=ep(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var C,A=ep(a);!(C=A()).done;){var S=C.value;i.miscs.push(S)}for(var w,O=ep(o);!(w=O()).done;){var M=w.value;i.miscs.push(M)}}(a,u,i)}();for(var c,l=ep(i.items);!(c=l()).done;){var f=c.value;if(f.content){if(f.content.renderer&&void 0!==f.content.renderer.texture){var d=f.content.renderer.texture;f.content.renderer.texture={id:i.textures[d].id}}if(f.content.trails&&void 0!==f.content.trails.texture){var p=f.content.trails.texture;f.content.trails.texture={id:i.textures[p].id}}}if(f.transform){var m=[].concat(null!=(g=f.transform.position)?g:[0,0,0]),v=[].concat(null!=(x=f.transform.rotation)?x:[0,0,0]),y=[].concat(null!=(b=f.transform.scale)?b:[1,1,1]);if(Object.assign(f,{transform:{position:{x:m[0],y:m[1],z:m[2]},eulerHint:{x:v[0],y:v[1],z:v[2]},scale:{x:y[0],y:y[1],z:y[0]}}}),f.type===tw.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tw.sprite){var g,x,b,T,E,_,C,A=f.content;A.renderer||(A.renderer={});var S=A.renderer,w=sO(S.anchor,S.particleOrigin),O=f.transform.size;S.anchor||void 0===S.particleOrigin||(f.transform.position.x+=-w[0]*(null!=(T=null==O?void 0:O.x)?T:1),f.transform.position.y+=-w[1]*(null!=(E=null==O?void 0:O.y)?E:1)),f.transform.anchor={x:w[0]*(null!=(_=null==O?void 0:O.x)?_:1),y:w[1]*(null!=(C=null==O?void 0:O.y)?C:1)}}}if(f.type===tw.particle){var M=f.content;M.renderer||(M.renderer={});var R=M.renderer;M.renderer.anchor=sO(R.anchor,R.particleOrigin)}if(f.type===tw.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),void 0!==f.pn){var I=f.pn,P=t.plugins,L=void 0===P?[]:P;void 0!==I&&Number.isInteger(I)&&(f.pluginName=L[I])}switch("editor-gizmo"===f.pluginName&&(f.type="editor-gizmo"),"orientation-transformer"===f.pluginName&&(f.type="orientation-transformer"),f.content.options.target&&"editor-gizmo"===f.pluginName&&(f.content.options.target=s[f.content.options.target]),f.type===tw.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[f.content.options.spine],f.content,i),(f.type===tw.sprite||f.type===tw.particle||f.type===tw.mesh||f.type===tw.skybox||f.type===tw.light||"camera"===f.type||f.type===tw.tree||f.type===tw.interact||f.type===tw.camera||f.type===tw.text||f.type===tw.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eK(),f.content.item={id:f.id},f.dataType=t0.VFXItemData,f.components.push({id:f.content.id})),(f.type===tw.null||f.type===tw.composition)&&(f.components=[],f.dataType=t0.VFXItemData),f.type){case tw.sprite:f.content.dataType=t0.SpriteComponent;break;case tw.particle:f.content.dataType=t0.ParticleSystem;break;case tw.mesh:f.content.dataType=t0.MeshComponent;break;case tw.skybox:f.content.dataType=t0.SkyboxComponent;break;case tw.light:f.content.dataType=t0.LightComponent;break;case"camera":f.content.dataType=t0.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tw.tree:f.content.dataType=t0.TreeComponent;break;case tw.interact:f.content.dataType=t0.InteractComponent;break;case tw.camera:f.content.dataType=t0.CameraController;break;case tw.text:f.content.dataType=t0.TextComponent;break;case tw.spine:f.content.dataType=t0.SpineComponent}}return i.version=tg["3_0"],i}function sz(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:sT(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:sd(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:sd(n.linearX),linearY:sd(n.linearY),linearZ:sd(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:sd(n.orbitalX),orbitalY:sd(n.orbitalY),orbitalZ:sd(n.orbitalZ),speedOverLifetime:sd(n.speedOverLifetime)};s_(a);var o={options:{startColor:sm(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=sd(s.x),u.y=sd(s.y),u.z=sd(s.z)):u.z=sd(s.angularVelocity)}var h=t.colorOverLifetime;if(h){var c=o.colorOverLifetime={opacity:sd(h.opacity)};h.color&&(c.color=sb(h.color))}var l=t.sizeOverLifetime;return l&&(o.sizeOverLifetime={separateAxes:l.separateAxes,size:sd(l.size),x:sd(l.x),y:sd(l.y),z:sd(l.z)}),o}var sU=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,sB=/^(\d+)\.(\d+)$/,sG=!1;function sj(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(l=null==(c=(h=t).version)?void 0:c.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||h.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tw.mesh||t.type===tw.light)&&(t.endBehavior=1===t.endBehavior?tF.destroy:t.endBehavior)})}),sU.test(t.version)){var e,i,r,n,a,o,s,u;return sG=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",sk(sD(sF(sN(sI((e=t,sX=tg["1_0"],n=e.plugins||[],(null==(i=e.bins)?void 0:i.length)&&(sX=tg["1_3"]),a=(e.requires||[]).slice(),o=e.images.map(function(t,i){return sW(t,i,e.imageTags||[])}),s=e.textures||o.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:sX,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return sH(t,{plugins:n,requires:a})}),images:o,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:s,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u))))))}sG=!1;var h,c,l,f,d,p=sB.exec(t.version)||[],m=Number(p[1]),v=Number(p[2]);if(m)return(m<2||2===m&&v<4)&&((d=t).compositions.map(function(t){for(var e,i=ep(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=ep(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=Array.isArray(a);o&&2===a.length&&Array.isArray(a[1])?"path"===n?e[n]=sT(a):e[n]=sd(a):o||"object"!=typeof a||t(a)}})(e.value.content)}),t=d),m<3&&(t=sN(sI(t))),m=Number((p=sB.exec(t.version)||[])[1]),v=Number(p[2]),m<4&&(v<2&&(t=sF(t)),v<3&&(t=sD(t)),v<4&&(t=sk(t))),t;throw Error("Invalid JSON version: "+t.version+".")}var sX=tg["1_0"];function sW(t,e,i){var r=i[e];if("string"==typeof t)return{id:eK(),renderLevel:r,url:t};if(t.template)return{id:eK(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:eK(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eK(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function sH(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iF({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return sZ(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 sY=[0,0,0,1];function sZ(t,e){void 0===e&&(e={});var i=tw.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tw.plugin,m=t.pn,p=t.pluginName,f=t.content,l=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),c=t.transform||b(l.transform)):t.particle?(i=tw.particle,c=b((l=t.particle).transform,sG,!0),f=function(t){var e=t.options,i=t.transform,r={type:t_.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iF({},t.shape,{type:t_[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=sv(e.turbulenceX),r.turbulenceY=sv(e.turbulenceY),r.turbulenceZ=sv(e.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map(function(t){return sE(t)})),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map(function(t){return sE(t)})),c.rateOverTime&&(c.rateOverTime=sv(c.rateOverTime));var l={renderer:t.renderer,shape:r,splits:t.splits,emission:c,options:{startLifetime:sv(e.startLifetime),start3DSize:!!e.start3DSize,startSize:sv(e.startSize),startSizeX:sv(e.startSizeX),startSizeY:sv(e.startSizeY),sizeAspect:sv(e.sizeAspect),maxCount:e.maxCount,startDelay:sv(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tL.COLORS,t[1].map(function(t){return sg(t,e)})]:"gradient"===t[0]?sy(t[1],e):"color"===t[0]?[tL.RGBA_COLOR,sg(t[1],e)]:t}(e.startColor,!0),startRotationZ:sv(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=sv(e.startRotationX),l.options.startRotationY=sv(e.startRotationY)),i&&i.path&&(l.emitterTransform={path:sT(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:sv(f.x),y:sv(f.y)}:l.sizeOverLifetime={size:sv(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?sd(p):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:sd(e.gravityModifier),startSpeed:sv(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:sv(d.linearX),linearY:sv(d.linearY),linearZ:sv(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:sv(d.orbitalX),orbitalY:sv(d.orbitalY),orbitalZ:sv(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:sd(d.forceCurve)},s_(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:sv(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=sd(m.y),l.rotationOverLifetime.x=sd(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:sd(v.opacity)};v.color&&(y.color=sb(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:sd(g.cycles),animationDelay:sp(g.animationDelay,0),animationDuration:sp(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:sv(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:sd(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&sb(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&sb(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:sv(x.opacityOverLifetime)}),l.trails&&s_(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(l)):t.sprite?(i=tw.sprite,c=b((l=t.sprite).transform,!1,!0),s=sz(o=l,c),(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=tw.null,c=b((l=t.cal).transform,!1,!0),f=sz(l,c)):t.ui?(i=tw.interact,c=b((l=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tA.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&sm(i.previewColor),behavior:i.behavior||tS.NOTIFY};break;case"drag":e={type:tA.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tA.MESSAGE}}return{options:e}}(l),c.scale=[l.options.width||1,l.options.height||1,1]):t.model&&(l=t.model,1===t.model.options.type&&(i=tw.camera,c=b(l.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:sT(null==(a=t.transform)?void 0:a.path),linearX:sd(null==r?void 0:r.translateX),linearY:sd(null==r?void 0:r.translateY),linearZ:sd(null==r?void 0:r.translateZ)};s_(o),i.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:sd(null==s?void 0:s.rotateX),y:sd(null==s?void 0:s.rotateY),z:s.separateAxes?sd(null==s?void 0:s.rotateZ):sd(s.rotation)};s_(u),i.rotationOverLifetime=u}return i}(l))),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&&sf(e.requires,"anchor")}if(l){var o,s,u,h,c,l,f,d,p,m,v,y,g=null==(v=l.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tF.restart:tF.destroy:tF.restart:r||(null==l?void 0:null==(y=l.options)?void 0:y.endBehavior)||tF.destroy,l.options.renderLevel&&(d=l.options.renderLevel),isNaN(n)&&(n=l.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:c,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(sf(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,c,l,f,d,p,m,v,y,g,x,b,T,E,_,C,A,S,w,O,M=(a=r.rotation[0],o=r.rotation[1],s=r.rotation[2],u=sC(a*sS/2),h=sC(o*sS/2),c=sC(s*sS/2),l=sA(a*sS/2),f=sA(o*sS/2),d=sA(s*sS/2),sY[0]=l*h*c+u*f*d,sY[1]=u*f*c-l*h*d,sY[2]=u*h*d+l*f*c,sY[3]=u*h*c-l*f*d,sY);r.rotation=(p=[],m=M[0],v=M[1],y=M[2],g=M[3],x=m+m,b=v+v,T=y+y,E=m*x,_=v*x,C=v*b,A=y*T,S=g*T,w=y*x-g*b,p[1]=Math.asin((O=-w)>1?1:O<-1?-1:O)*sw,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*b+g*x,1-E-C)*sw,p[2]=Math.atan2(_+S,1-C-A)*sw):(p[0]=0,p[2]=Math.atan2(-(_-S),1-E-A)*sw),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 sq=((en={})[tx.S]=[tx.S,tx.BPlus,tx.APlus],en[tx.A]=[tx.A,tx.BPlus,tx.APlus],en[tx.B]=[tx.B,tx.BPlus],en);function sQ(t,e){if(!t||!e)return!0;var i=sq[e];return!!i&&i.includes(t)}function sK(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 sJ(t,e,i){return s$.apply(this,arguments)}function s$(){return(s$=ef(function(t,e,i){var r,n;return eg(this,function(a){switch(a.label){case 0:if("string"!=typeof t)return[3,2];return[4,ij(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=sK(e,i)){if(eX(n)&&n!==r.src)return[2,ij(n)];if(em(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}t.Scene=void 0,(tp=t.Scene||(t.Scene={})).isJSONObject=function(t){return eY(t)&&"jsonScene"in t},tp.isURL=function(t){return eY(t)&&"url"in t},tp.isWithOptions=function(t){return eY(t)&&"options"in t};var s0=1,s1=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new iD),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=s0++,this.timers=[],this.updateOptions(t)}var i=e.prototype;return i.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},i.loadScene=function(e,i,r){var n=this;return ef(function(){var a,o,s,u,h,c,l,f,d,p,m,v;return eg(this,function(y){return o=eX(e)?e:n.id,s=performance.now(),u=[],l=null!=(c=null==(h=null==i?void 0:i.engine.gpuCapability)?void 0:h.detail.compressedTexture)?c:t.COMPRESSED_TEXTURE.NONE,f={},p=!1,m=new Promise(function(t,e){d=window.setTimeout(function(){p=!0,n.removeTimer(d),e(Error("Load time out: totalTime: "+(performance.now()-s).toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."))},1e3*n.timeout),n.timers.push(d)}),v=ef(function(t,e){var i,r,n;return eg(this,function(a){switch(a.label){case 0:if(p)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,u.push("["+t+": "+n.toFixed(2)+"]"),f[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+a.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([m,ef(function(){var i,h,c,p,m,y,g,x,b,T,E,_,C,A,S,w,O,M;return eg(this,function(R){switch(R.label){case 0:if(!eX(e))return[3,2];return h=new URL(e,location.href).href,n.baseUrl=h,[4,v("loadJSON",function(){return n.loadJSON(h)})];case 1:return a=R.sent(),[3,3];case 2:a=e,n.baseUrl=location.href,R.label=3;case 3:if(!t.Scene.isJSONObject(a))return[3,5];return c=(i=iF({},a)).jsonScene,p=i.pluginSystem,m=i.images,y=c.images,n.assignImagesToAssets(y,m),[4,Promise.all([v("plugin:processAssets",function(){return n.processPluginAssets(c,p,r)})])];case 4:return R.sent(),[3,10];case 5:return[4,v("processJSON",function(){return n.processJSON(a)})];case 6:return x=(g=R.sent()).jsonScene,b=g.pluginSystem,E=void 0===(T=x.bins)?[]:T,_=x.images,C=x.fonts,[4,Promise.all([v("processBins",function(){return n.processBins(E)}),v("processImages",function(){return n.processImages(_,l)}),v("plugin:processAssets",function(){return n.processPluginAssets(x,b,r)}),v("processFontURL",function(){return n.processFontURL(C)})])];case 7:return S=(A=R.sent())[0],w=A[1],[4,v("processTextures",function(){return n.processTextures(w,S,x)})];case 8:return O=R.sent(),i={timeInfos:f,url:e,renderLevel:n.options.renderLevel,storage:{},pluginSystem:b,jsonScene:x,bins:S,images:w,textureOptions:O},[4,v("plugin:prepareResource",function(){return b.loadResources(i,n.options)})];case 9:R.sent(),R.label=10;case 10:return M=performance.now()-s,eG.info("Load asset: totalTime: "+M.toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."),window.clearTimeout(d),n.removeTimer(d),i.totalTime=M,i.startTime=s,i.timeInfos=f,[2,i]}})})()])]})})()},i.getAssets=function(){return this.assets},i.processJSON=function(t){var e=this;return ef(function(){var i,r,n;return eg(this,function(a){switch(a.label){case 0:return[4,(n=new e4(void 0===(r=(i=sj(t)).plugins)?[]:r)).processRawJSON(i,e.options)];case 1:return a.sent(),[2,{jsonScene:i,pluginSystem:n}]}})})()},i.processBins=function(t){var e=this;return ef(function(){var i,r;return eg(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(em(n,ArrayBuffer))return n;if(sQ(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},i.processFontURL=function(t){var i=this;return ef(function(){return eg(this,function(r){return t?[2,Promise.all(t.map(ef(function(t){var r,n,a;return eg(this,function(o){switch(o.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];eU(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,i.baseUrl).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(a),e.fontCache.add(t.fontFamily),[3,4];case 3:return o.sent(),eG.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},i.processImages=function(e,i){void 0===i&&(i=0);var r=this;return ef(function(){var n,a,o,s,u,h,c;return eg(this,function(l){switch(l.label){case 0:return a=(n=r.options).useCompressedTexture,o=n.variables,s=n.disableWebP,u=n.disableAVIF,h=r.baseUrl,[4,Promise.all(e.map(ef(function(e,n){var c,l,f,d,p,m,v,y,g,x,b,T,E,_,C,A,S,w,O,M,R;return eg(this,function(n){switch(n.label){case 0:if(c=e.url,l=e.webp,f=e.avif,d=new URL(c,h).href,p=!s&&l?new URL(l,h).href:void 0,m=!u&&f?new URL(f,h).href:void 0,v=e.id,!("template"in e))return[3,8];if(!(g=(y=e.template).background))return[3,7];x=sK(y,o),b=g.type===tJ.video,T=g&&b?iZ:ij,n.label=1;case 1:return n.trys.push([1,6,,7]),[4,iQ(x,T)];case 2:if(!em(E=n.sent(),HTMLVideoElement))return[3,3];return r.sourceFrom[v]={url:E.src,type:t.TextureSourceType.video},[2,E];case 3:return g&&Array.isArray(x)&&o&&(o[g.name]=E.src),r.sourceFrom[v]={url:E.src,type:t.TextureSourceType.image},[4,sJ(E,y,o)];case 4:return[2,n.sent()];case 5:return[3,7];case 6:throw _=n.sent(),Error("Failed to load. Check the template or if the URL is "+(b?"video":"image")+" type, URL: "+x+", Error: "+(_.message||_)+".");case 7:return[3,9];case 8:if("compressed"in e&&a&&i){if(C=e.compressed,i===t.COMPRESSED_TEXTURE.ASTC?A=C.astc:i===t.COMPRESSED_TEXTURE.PVRTC&&(A=C.pvrtc),A)return S=new URL(A,h).href,r.sourceFrom[v]={url:S,type:t.TextureSourceType.compressed},[2,r.loadBins(S)]}else if(em(e,HTMLImageElement)||em(e,HTMLCanvasElement)||em(e,HTMLVideoElement)||em(e,i3))return[2,e];n.label=9;case 9:if(!m)return[3,11];return[4,iB(d,m)];case 10:return R=n.sent(),[3,13];case 11:return[4,iz(d,p)];case 12:R=n.sent(),n.label=13;case 13:return O=(w=R).url,M=w.image,r.sourceFrom[v]={url:O,type:t.TextureSourceType.image},[2,M]}})})))];case 1:return c=l.sent(),r.assignImagesToAssets(e,c),[2,c]}})})()},i.processPluginAssets=function(t,e,i){var r=this;return ef(function(){var n,a,o,s;return eg(this,function(u){switch(u.label){case 0:return[4,e.processAssets(t,i)];case 1:for(a=(n=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=n.loadedAssets,s=0;s<a.length;s++)r.assets[a[s].id]=o[s];return[2]}})})()},i.processTextures=function(e,i,r){var n=this;return ef(function(){var a;return eg(this,function(o){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(ef(function(e,a){var o,s,u,h,c;return eg(this,function(l){switch(l.label){case 0:if(em(e,i3))return[2,e];if(!("mipmaps"in e))return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,iJ(e,i,n.assets,r.bins)];case 2:return[2,l.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+l.sent()+".");case 4:if(o=e.source,s=e.id,h="",!eY(o))return[3,5];return u=n.assets[o.id],h=o.id,[3,7];case 5:if("string"!=typeof o)return[3,7];return[4,ij(eJ(o))];case 6:u=l.sent(),l.label=7;case 7:if(u)return[2,(c=function(e,i,r){var n={id:r,dataType:t0.Texture};if(em(e,i3))return iF({},e.source,n);if(em(e,HTMLImageElement)||eZ(e))return iF({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:iO.LINEAR,magFilter:iO.LINEAR},n);if(em(e,HTMLVideoElement))return iF({sourceType:t.TextureSourceType.video,video:e,minFilter:iO.LINEAR,magFilter:iO.LINEAR},n);if(em(e,ArrayBuffer))return iF({},i7(e),{sourceFrom:i},n);if("width"in e&&"height"in e&&"data"in e)return iF({sourceType:t.TextureSourceType.data,data:e,wrapS:iO.CLAMP_TO_EDGE,wrapT:iO.CLAMP_TO_EDGE,minFilter:iO.NEAREST,magFilter:iO.NEAREST},n);throw Error("Invalid texture options.")}(u,n.sourceFrom[h],s)).sourceType===t.TextureSourceType.compressed?c:iF({},c,e)];throw Error("Invalid texture source: "+o+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return ef(function(){return eg(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)})})]})})()},i.loadBins=function(t){var e=this;return ef(function(){return eg(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)})})]})})()},i.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},i.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e}();s1.fontCache=new Set;var s2=function(){function e(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(i6(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=iF({},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===tw.text||t.type===tw.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)===t0.TextComponent||(null==n?void 0:n.dataType)===t0.RichTextComponent)&&(n.options.text=r)})}})},i.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++){var i=t.textureOptions[e];em(i,i3)?this.engine.addInstance(i):(i=this.engine.findObject({id:t.textureOptions[e].id}),t.textureOptions[e]=i),i.initialize()}},i.prepareAssets=function(t,e){this.engine.clearResources();for(var i,r=ep(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=new su(this.engine);o.data=a,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var s,u=ep(this.builtinObjects);!(s=u()).done;){var h=s.value;this.engine.addInstance(h)}},i.createShaderVariant=function(){for(var t,e=ep(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];em(r,rn)&&r.createShaderVariant()}},i.destroyBuiltinObjects=function(){for(var t,e=ep(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},i.dispose=function(){this.destroyBuiltinObjects()},e}(),s3=new Int32Array(2),s4=new Float32Array(s3.buffer),s5=new Float64Array(s3.buffer),s6=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tm=ea||(ea={}))[tm.UTF8_BYTES=1]="UTF8_BYTES",tm[tm.UTF16_STRING=2]="UTF16_STRING";var s8=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 s3[0]=this.readInt32(t),s4[0]},e.readFloat64=function(t){return s3[s6?0:1]=this.readInt32(t),s3[s6?1:0]=this.readInt32(t+4),s5[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){s4[0]=e,this.writeInt32(t,s3[0])},e.writeFloat64=function(t,e){s5[0]=e,this.writeInt32(t,s3[s6?0:1]),this.writeInt32(t+4,s3[s6?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}(),s9=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=s8.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:(em(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=s8.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),s7=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 ut(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}(),ut=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=s7.createDataVector(t,this.data);return s7.createFBEffectsObjectData(t,e,i)},t}(),ue=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 s7).__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 ui(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}(),ui=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=ue.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return ue.createFBEffectsPackageData(t,e)},t}(),ur=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 un(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}(),un=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 ur.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),ua=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 uo(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}(),uo=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 ua.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),us=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 ua).__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 uu(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}(),uu=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=us.createChannelsVector(t,t.createObjectOffsetList(this.channels));return us.createFBVertexData(t,this.vertexCount,e)},t}(),uh=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 us).__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 ur).__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 uc(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}(),uc=function(){function t(t,e,i,r,n,a,o,s,u,h,c,l){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===c&&(c=null),void 0===l&&(l=[]),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=c,this.inverseBindMatrices=l}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=uh.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=uh.createBinaryDataVector(t,this.binaryData),s=uh.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=uh.createInverseBindMatricesVector(t,this.inverseBindMatrices);return uh.startFBGeometryData(t),uh.addId(t,e),uh.addName(t,i),uh.addVertexData(t,r),uh.addIndexFormat(t,this.indexFormat),uh.addIndexOffset(t,this.indexOffset),uh.addSubMeshes(t,n),uh.addMode(t,this.mode),uh.addBuffer(t,a),uh.addBinaryData(t,o),uh.addBoneNames(t,s),uh.addRootBoneName(t,u),uh.addInverseBindMatrices(t,h),uh.endFBGeometryData(t)},t}(),ul=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 s9(1),i=new ui,r=[],n=ep(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===t0.Geometry&&(o=new ut("Geometry",this.geometryDataToBinary(a))),o&&r.push(o)}return i.exportObjects=r,ue.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new s8(t),i=ue.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===t0.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new s9(1),i=new uc,r=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,s=t.vertexData,u=t.boneNames,h=t.rootBoneName,c=t.inverseBindMatrices,l=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=o,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===h?"":h,i.inverseBindMatrices=void 0===c?[]:c,i.binaryData=void 0===l?[]:l;var f=new uu;f.vertexCount=s.vertexCount,f.channels=[];for(var d,p=ep(s.channels);!(d=p()).done;){var m=d.value,v=new uo(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=ep(t.subMeshes);!(y=x()).done;){var b=y.value,T=new un(b.offset,b.indexCount,b.vertexCount);g.push(T)}return i.subMeshes=g,ue.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,a=new s8(t),o=uh.getRootAsFBGeometryData(a),s={vertexCount:0,channels:[]},u=o.vertexData();if(u){s.vertexCount=u.vertexCount();for(var h=0;h<u.channelsLength();h++){var c,l=u.channels(h);if(l){var f={semantic:null!=(c=l.semantic())?c:"",offset:l.offset(),format:l.format(),dimension:l.dimension(),normalize:l.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:t0.Geometry}},t}(),uf=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 sc(this),this.emptyTexture=i6(this),this.transparentTexture=i8(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 eY(t)&&t.constructor===Object?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,n=i.items,a=i.materials,o=i.shaders,s=i.geometries,u=i.components,h=i.animations,c=i.bins,l=void 0===c?[]:c,f=i.miscs,d=i.compositions,p=ep(d);!(e=p()).done;){var m=e.value;this.addEffectsObjectData(m)}for(var v,y=ep(void 0===n?[]:n);!(v=y()).done;){var g=v.value;sQ(g.renderLevel,t.renderLevel)||(g.components=[],g.type=tw.null),this.addEffectsObjectData(g)}for(var x,b=ep(void 0===a?[]:a);!(x=b()).done;){var T=x.value;this.addEffectsObjectData(T)}for(var E,_=ep(void 0===o?[]:o);!(E=_()).done;){var C=E.value;this.addEffectsObjectData(C)}for(var A,S=ep(void 0===s?[]:s);!(A=S()).done;){var w=A.value;this.addEffectsObjectData(w)}for(var O,M=ep(void 0===u?[]:u);!(O=M()).done;){var R=O.value;this.addEffectsObjectData(R)}for(var I,P=ep(void 0===h?[]:h);!(I=P()).done;){var L=I.value;this.addEffectsObjectData(L)}for(var V,F=ep(void 0===f?[]:f);!(V=F()).done;){var D=V.value;this.addEffectsObjectData(D)}for(var k=0;k<l.length;k++){var N=l[k],z=t.bins[k];if(N.dataType===t0.BinaryAsset)N.buffer=z,N.id&&this.addEffectsObjectData(N);else{var U=new ul;U.deserializeFromBinary(new Uint8Array(z));for(var B,G=ep(U.exportObjectDatas);!(B=G()).done;){var j=B.value;this.addEffectsObjectData(j)}}}for(var X,W=ep(void 0===r?[]:r);!(X=W()).done;){var H=X.value;this.addEffectsObjectData(H)}},e.createVFXItems=function(t){var e=this;return ef(function(){var i,r,n,a;return eg(this,function(o){for(i=ep(t.jsonScene.items);!(r=i()).done;)("ECS"===(a=(n=r.value).type)||"camera"===a||a===tw.sprite||a===tw.particle||a===tw.mesh||a===tw.skybox||a===tw.light||a===tw.tree||a===tw.interact||a===tw.camera)&&e.database&&e.assetLoader.loadGUID(n);return[2]})})()},e.addTexture=function(t){this.destroyed||e_(this.textures,t)},e.removeTexture=function(t){this.destroyed||eC(this.textures,t)},e.addMaterial=function(t){this.destroyed||e_(this.materials,t)},e.removeMaterial=function(t){this.destroyed||eC(this.materials,t)},e.addGeometry=function(t){this.destroyed||e_(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||eC(this.geometries,t)},e.addMesh=function(t){this.destroyed||e_(this.meshes,t)},e.removeMesh=function(t){this.destroyed||eC(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||e_(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||eC(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&&eG.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}},ii(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),ud=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=ix(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)},ii(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();e3("camera",nL,t.VFXItem),e3("text",ss,t.VFXItem),e3("sprite",aM,t.VFXItem),e3("particle",ok,t.VFXItem),e3("cal",oN,t.VFXItem),e3("interact",nU,t.VFXItem),eG.info("Core version: 2.4.2.");var up=((eo={})[iO.ONE]=ec.OneFactor,eo[iO.ZERO]=ec.ZeroFactor,eo[iO.SRC_COLOR]=ec.SrcColorFactor,eo[iO.SRC_ALPHA]=ec.SrcAlphaFactor,eo[iO.ONE_MINUS_SRC_COLOR]=ec.OneMinusSrcColorFactor,eo[iO.ONE_MINUS_SRC_ALPHA]=ec.OneMinusSrcAlphaFactor,eo[iO.DST_COLOR]=ec.DstColorFactor,eo[iO.DST_ALPHA]=ec.DstAlphaFactor,eo[iO.ONE_MINUS_DST_COLOR]=ec.OneMinusDstColorFactor,eo[iO.ONE_MINUS_DST_ALPHA]=ec.OneMinusDstAlphaFactor,eo),um=((es={})[iO.NEVER]=ec.NeverStencilFunc,es[iO.EQUAL]=ec.EqualStencilFunc,es[iO.LESS]=ec.LessStencilFunc,es[iO.LEQUAL]=ec.LessEqualStencilFunc,es[iO.ALWAYS]=ec.AlwaysStencilFunc,es[iO.NOTEQUAL]=ec.NotEqualStencilFunc,es[iO.GREATER]=ec.GreaterStencilFunc,es[iO.GEQUAL]=ec.GreaterEqualStencilFunc,es),uv=((eu={})[iO.KEEP]=ec.KeepStencilOp,eu[iO.ZERO]=ec.ZeroStencilOp,eu[iO.REPLACE]=ec.ReplaceStencilOp,eu[iO.INCR]=ec.IncrementStencilOp,eu[iO.DECR]=ec.DecrementStencilOp,eu[iO.INCR_WRAP]=ec.IncrementWrapStencilOp,eu[iO.DECR_WRAP]=ec.IncrementWrapStencilOp,eu[iO.INVERT]=ec.InvertStencilOp,eu),uy=((eh={})[iO.NEVER]=ec.NeverDepth,eh[iO.ALWAYS]=ec.AlwaysDepth,eh[iO.EQUAL]=ec.EqualDepth,eh[iO.LESS]=ec.LessDepth,eh[iO.LEQUAL]=ec.LessEqualDepth,eh[iO.GREATER]=ec.GreaterDepth,eh[iO.GEQUAL]=ec.GreaterEqualDepth,eh[iO.NOTEQUAL]=ec.NotEqualDepth,eh),ug=["uMaskTex","_MainTex","uColorOverLifetime","uColorOverTrail"],ux=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new ec.RawShaderMaterial,n.uniforms={},n.macrosDirty=!0;var n,a,o,s,u,h=null==r?void 0:r.shader,c=i.gpuCapability.level;return n.shader=new t.Shader(i),n.shader.shaderData=iF({},h,{id:eK(),dataType:t0.Shader,vertex:null!=(a=null==h?void 0:h.vertex)?a:"",fragment:null!=(o=null==h?void 0:h.fragment)?o:""}),n.uniforms._MainTex=new ec.Uniform(null),n.uniforms.uEditorTransform=new ec.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new ec.Uniform(new ec.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new ec.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new ec.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new ec.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new ec.RawShaderMaterial({vertexShader:rG.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:null!=(s=null==h?void 0:h.vertex)?s:"",macros:null==h?void 0:h.macros,removeVersion:!0}),fragmentShader:rG.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:null!=(u=null==h?void 0:h.fragment)?u:"",macros:null==h?void 0:h.macros,removeVersion:!0}),alphaToCoverage:!1,depthFunc:ec.LessDepth,polygonOffsetFactor:ec.ZeroFactor,polygonOffsetUnits:ec.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===c?n.material.glslVersion=ec.GLSL1:n.material.glslVersion=ec.GLSL3,n}e9(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;ug.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new ec.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var a=new ec.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",a)}else{var o=r.camera;this.setMatrix("effects_MatrixVP",o.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",o.getViewMatrix())}},r.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.getVector4Array=function(t){return this.uniforms[t].value},r.setVector4Array=function(t,e){for(var i,r=[],n=ep(e);!(i=n()).done;){var a=i.value;r=r.concat(a.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.uniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=ep(e);!(i=n()).done;){var a=i.value;r=r.concat(a.elements)}this.setUniform(t,r)},r.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.getMatrix=function(t){return this.uniforms[t].value},r.setMatrix=function(t,e){this.setUniform(t,e)},r.setMatrix3=function(t,e){this.setUniform(t,e)},r.getVector2=function(t){return this.uniforms[t].value},r.setVector2=function(t,e){this.setUniform(t,e)},r.getVector3=function(t){return this.uniforms[t].value},r.setVector3=function(t,e){this.setUniform(t,e)},r.getVector4=function(t){return this.uniforms[t].value},r.setVector4=function(t,e){this.setUniform(t,e)},r.getColor=function(t){var e=this.uniforms[t].value;return new iC(e.x,e.y,e.z,e.w)},r.setColor=function(t,e){this.setUniform(t,new ec.Vector4(e.r,e.g,e.b,e.a))},r.getQuaternion=function(t){return this.uniforms[t].value},r.setQuaternion=function(t,e){this.setUniform(t,e)},r.getFloat=function(t){return this.uniforms[t].value},r.setFloat=function(t,e){this.setUniform(t,e)},r.getFloats=function(t){return this.uniforms[t].value},r.setFloats=function(t,e){this.setUniform(t,e)},r.getInt=function(t){return this.uniforms[t].value},r.setInt=function(t,e){this.setUniform(t,e)},r.hasUniform=function(t){return!!this.uniforms[t]},r.setUniform=function(t,e){var i=new ec.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=i},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.clone=function(t){throw Error("Method not implemented.")},r.cloneUniforms=function(t){throw Error("Method not implemented.")},r.fromData=function(t){throw Error("Method not implemented.")},r.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},ii(i,[{key:"blending",get:function(){return this.material.blending!==ec.NoBlending},set:function(t){this.material.blending=t?ec.CustomBlending:ec.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,i=t.blendDst;return[e,i,t.blendSrcAlpha||e,t.blendDstAlpha||i]},set:function(t){if(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.material.blendSrc=up[e],this.material.blendDst=up[i],this.material.blendSrcAlpha=up[r],this.material.blendDstAlpha=up[n]}}},{key:"blendEquation",get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=t[0],i=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=i}}},{key:"depthTest",get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t}},{key:"depthMask",get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t}},{key:"depthFunc",get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=uy[t])}},{key:"polygonOffsetFill",get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t}},{key:"polygonOffset",get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=t[0],i=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=i}}},{key:"sampleAlphaToCoverage",get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t}},{key:"stencilTest",get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t}},{key:"stencilMask",get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])}},{key:"stencilRef",get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])}},{key:"stencilFunc",get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=um[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=uv[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=uv[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=uv[t[0]])}},{key:"culling",get:function(){return this.material.side!==ec.DoubleSide},set:function(t){this.material.side=t?ec.FrontSide:ec.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tT.FRONT?this.material.side=ec.FrontSide:t===tT.BACK&&(this.material.side=ec.BackSide)}},{key:"colorMask",get:function(){return this.material.colorWrite},set:function(t){this.material.colorWrite=t}}]),i}(rn),ub=1,uT=function(t){function e(e,i){if((r=t.call(this,e)||this).attributes={},r.destroyed=!1,r.attributesName=[],!i)return st(r);var r,n=i.drawStart,a=i.drawCount,o=i.indices,s=i.mode,u=i.name,h=void 0===u?"effectsGeometry:"+ub++:u;r.name=h,r.mode=null!=s?s:iO.TRIANGLES;var c=[],l={},f=new ec.BufferGeometry;return Object.keys(i.attributes).forEach(function(t){var e=i.attributes[t];if("dataSource"in e){var n=e.dataSource;if(n){void 0===l[n]&&r.setAttributeType(n,e,f,l,i.maxVertex);var a=e.size,o=e.offset,s=e.normalize,u=l[n],h=u.buffer,d=u.dataLength,p=new ec.InterleavedBufferAttribute(h,a,(null!=o?o:0)/d,s);f.setAttribute(t,p),l[t]={buffer:h,attribute:p,type:u.type,dataLength:d}}}else r.setAttributeType(t,e,f,l,i.maxVertex);c.push(t)}),o&&o.data&&f.setIndex(new ec.BufferAttribute(o.data,1)),r.geometry=f,r.attributes=l,r.attributesName=c,r.drawStart=void 0===n?0:n,r.drawCount=null!=a?a:0,r}e9(e,t);var i=e.prototype;return i.getAttributeData=function(t){if(void 0!=this.attributes[t])return this.attributes[t].buffer.array},i.setAttributeData=function(t,e){if(void 0!=this.attributes[t]){var i=this.attributes[t].buffer;if(e.length>i.array.length){var r=new ec.InterleavedBuffer(e,i.stride);i=this.attributes[t].attribute.data=r,this.attributes[t].buffer=r,this.geometry.setAttribute(t,this.attributes[t].attribute)}else i.set(e,0),i.updateRange.count=e.length,i.updateRange.offset=0;this.geometry.attributes[t].needsUpdate=!0}},i.setAttributeSubData=function(t,e,i){void 0!=this.attributes[t]&&(this.attributes[t].buffer.set(i,e),this.geometry.attributes[t].needsUpdate=!0)},i.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*rv[e.type]},i.getAttributeNames=function(){return this.attributesName},i.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},i.setIndexData=function(t){t&&(this.geometry.setIndex(new ec.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},i.setIndexSubData=function(t,e){var i=this.geometry.getIndex();if(null!==i){var r=t+e.length;if(i.count<r){var n=new e.constructor(end);n.set(i.array),i.array=n}i.array.set(e,t),this.geometry.index.needsUpdate=!0}},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{}},i.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},i.setAttributeType=function(t,e,i,r,n){var a=e.stride,o=e.size,s=e.offset,u=e.normalize,h=e.type,c=void 0===h?iO.FLOAT:h,l=e.data;if(c&&!l&&(l=rg(c)),l){var f=em(l,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,d=(void 0===a?0:a)/f,p=(n=(null!=n?n:0)*d)||o*f;p&&0===l.length&&(l=em(l,Float32Array)?new Float32Array(p):new Uint16Array(p));var m=new ec.InterleavedBuffer(l,d),v=new ec.InterleavedBufferAttribute(m,o,(null!=s?s:0)/f,u);i.setAttribute(t,v),r[t]={buffer:m,attribute:v,type:c,dataLength:f}}},ii(e,[{key:"drawCount",get:function(){return this.geometry.drawRange.count},set:function(t){this.geometry.drawRange.count=t}},{key:"drawStart",get:function(){return this.geometry.drawRange.start},set:function(t){this.geometry.drawRange.start=t}}]),e}(ry),uE=function(e){function i(t,i){if(!i)return st(r);var r,n=i.material,a=i.geometry,o=i.priority;return(r=e.call(this,t,i)||this).geometry=a,r.material=n,a.mode===iO.LINES?r.mesh=new ec.LineSegments(a.geometry,n.material):r.mesh=new ec.Mesh(a.geometry,n.material),r.priority=void 0===o?0:o,r}e9(i,e);var r=i.prototype;return r.setVisible=function(t){this.mesh.visible=t},r.getVisible=function(){return this.mesh.visible},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e,this.mesh.material=e.material},r.onStart=function(){e.prototype.onStart.call(this),this.engine.threeGroup.add(this.mesh)},r.restore=function(){},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},r.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},ii(i,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),i}(rS),u_=function(e){function i(i,r,n){if(void 0===n&&(n={}),a=e.call(this,i)||this,r){var a,o=r.width,s=r.height;a.texture=a.createTextureByType(iF({},n,{sourceType:t.TextureSourceType.data,data:r})),a.width=void 0===o?1:o,a.height=void 0===s?1:s}else a.texture=a.createTextureByType(n);return a.texture.needsUpdate=!0,a.source={},a}e9(i,e);var r=i.prototype;return r.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.assembleOptions=function(e){var r=e.target,n=void 0===r?iO.TEXTURE_2D:r;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=t.TextureSourceType.none),iF({},e,{target:n,format:ec.RGBAFormat,type:ec.UnsignedByteType,minFilter:i.toThreeJsTextureFilter(e.minFilter),magFilter:i.toThreeJsTextureFilter(e.magFilter),wrapS:i.toThreeJsTextureWrap(e.wrapS),wrapT:i.toThreeJsTextureWrap(e.wrapT)})},r.dispose=function(){this.texture.dispose()},r.fromData=function(t){e.prototype.fromData.call(this,t),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.createTextureByType=function(e){var i=this.assembleOptions(e),r=i.flipY,n=i.type,a=i.wrapS,o=i.wrapT,s=i.minFilter,u=i.magFilter,h=i.sourceType,c=ec.UVMapping,l=i.format,f=void 0;if(this.sourceType=h,h===t.TextureSourceType.data){var d=e.data;f=new ec.DataTexture(d.data,d.width,d.height,l,n,c,a,o,u,s),this.width=d.width,this.height=d.height}else if(h===t.TextureSourceType.image){var p=e.image;f=new ec.Texture(p,c,a,o,u,s,l,n),this.width=p.width,this.height=p.height}else if(h===t.TextureSourceType.compressed){var m=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,i=t.width,r=t.height;return m=m<i?i:m,v=v<r?r:v,{data:e,width:i,height:r,colorSpace:"srgb"}});l=ec.RGBA_ASTC_4x4_Format,f=new ec.CompressedTexture(y,m,v,l,n,c,a,o,u,s),this.width=m,this.height=v}else if(h===t.TextureSourceType.video)f=new ec.VideoTexture(e.video,c,a,o,u,s,l,n);else if(h===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,b,T=null!=(x=g.width)?x:0,E=null!=(b=g.height)?b:0;f=new ec.FramebufferTexture(T,E,l),this.width=T,this.height=E}}else h===t.TextureSourceType.none&&((f=new ec.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=ec.MirroredRepeatWrapping,f.wrapT=ec.MirroredRepeatWrapping,this.width=this.height=1);if(this.source=e,f)return f.flipY=!!r,f;throw Error("Create a texture using an unknown data type.")},i.toThreeJsTextureFilter=function(t){return t===iO.LINEAR?ec.LinearFilter:ec.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case iO.MIRRORED_REPEAT:return ec.MirroredRepeatWrapping;case iO.REPEAT:return ec.RepeatWrapping;default:return ec.ClampToEdgeWrapping}},i}(i3),uC=function(e){function i(t,i){return e.call(this,t,i)}e9(i,e);var r=i.prototype;return r.prepareRender=function(){var e=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var i,r=ep(this.rootComposition.items);!(i=r()).done;)for(var n,a=i.value.getComponents(ip),o=ep(a);!(n=o()).done;){var s=n.value;s.isActiveAndEnabled&&s.render(e)}for(var u,h=ep(this.refContent);!(u=h()).done;)for(var c,l=u.value,f=ep(l.getComponent(t.CompositionComponent).items);!(c=f()).done;)for(var d,p=c.value.getComponents(ip),m=ep(p);!(d=m()).done;){var v=d.value;v.isActiveAndEnabled&&v.render(e)}},r.getRendererOptions=function(){var t=u_.createWithData(this.renderer.engine,{data:new Uint8Array(4).fill(255),width:1,height:1});return t.texture.needsUpdate=!0,this.rendererOptions||(this.rendererOptions={emptyTexture:t,cachePrefix:"-"}),this.rendererOptions},i}(oI);uC.shape={};var uA=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new r1(e),i}return e9(e,t),e.prototype.setOptions=function(t){var e=t.threeCamera,i=t.threeGroup,r=t.composition;this.threeCamera=e,this.threeGroup=i,this.composition=r},e}(uf),uS=function(t){function e(e){var i;return(i=t.call(this)||this).engine=new uA(e),i.engine.renderer=aV(i),i.env="",i.renderingData={currentFrame:{}},i}return e9(e,t),e}(r4),uw=function(t){function e(e,i){(r=t.call(this)||this).compositions=[],r.env="",r.baseCompositionIndex=0;var r,n=i.width,a=i.height,o=i.camera;return r.renderer=new uS(e),r.assetService=new s2(r.renderer.engine),r.width=n,r.height=a,r.camera=o,r}e9(e,t);var i=e.prototype;return i.loadScene=function(t,e){var i=this;return ef(function(){var r,n,a,o,s,u,h,c,l,f,d,p;return eg(this,function(m){switch(m.label){case 0:return ez(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),r=performance.now(),n=[],a=[],s=null==(o=null==e?void 0:e.autoplay)||o,u=i.baseCompositionIndex,eW(t)?(h=n).push.apply(h,[].concat(t)):n.push(t),[4,Promise.all(n.map(ef(function(t,r){var n,o,h,c,l,f;return eg(this,function(d){switch(d.label){case 0:return o=(n=i.assetService.assembleSceneLoadOptions(t,iF({autoplay:s},e))).source,[4,(c=new s1(h=n.options)).loadScene(o,i.renderer,{env:i.env})];case 1:return l=d.sent(),i.assetService.prepareAssets(l,c.getAssets()),i.assetService.updateTextVariables(l,c.options.variables),i.assetService.initializeTexture(l),l.pluginSystem.precompile(l.jsonScene.compositions,i.renderer),f=i.createComposition(l,h),i.baseCompositionIndex+=1,f.setIndex(u+r),a[r]=f,[2]}})})))];case 1:for(m.sent(),c=0;c<a.length;c++)s?a[c].play():a[c].pause();for(l=a.map(function(t){return t.name}),f=performance.now()-r,d=ep(a);!(p=d()).done;)p.value.statistic.firstFrameTime=f;return eG.info("First frame ["+l+"]: "+f.toFixed(4)+"ms."),[2,eW(t)?a:a[0]]}})})()},i.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=new uC(iF({},e,{width:this.width,height:this.height,renderer:this.renderer,handleItemMessage:function(t){i.dispatchEvent({type:"message",message:t})}}),t);return r.on("end",function(){i.dispatchEvent({type:"end",composition:r})}),this.renderer.engine.setOptions({threeCamera:this.camera,threeGroup:this,composition:r}),this.compositions.push(r),r},i.pause=function(){this.dispatchEvent({type:"pause"}),this.compositions.forEach(function(t){t.pause()})},i.resume=function(){this.compositions.forEach(function(t){t.resume()})},i.update=function(t){this.compositions.forEach(function(e){e.update(t)})},ii(e,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(ec.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}e9(e,t);var i=e.prototype;return i.setVisible=function(t){this.threeMesh.visible=t},i.getVisible=function(){return this.threeMesh.visible},i.dispose=function(){t.prototype.dispose.call(this),this.isActiveAndEnabled||this.threeMesh.clear()},i.fromData=function(e){t.prototype.fromData.call(this,e),this.threeMesh||(this.geometry.mode===iO.LINES?this.threeMesh=new ec.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new ec.Mesh(this.geometry.geometry,this.material.material))},i.onStart=function(){t.prototype.onStart.call(this),this.engine.threeGroup.add(this.threeMesh)},i.render=function(t){this.isActiveAndEnabled&&(this.material.setVector2("_Size",this.transform.size),this.material.setMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.onDestroy=function(){this.threeMesh.clear()},ii(e,[{key:"priority",get:function(){return this.threeMesh.renderOrder},set:function(t){this.threeMesh&&(this.threeMesh.renderOrder=t)}},{key:"enabled",get:function(){return this.threeMesh.visible},set:function(t){this.threeMesh.visible=t,t&&this.onEnable()}}]),e}(t.SpriteComponent),t.ThreeSpriteComponent=ey([is(t0.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.canvas=se.getCanvas(),se.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return st(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}e9(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.options;this.updateWithOptions(i),this.updateTexture(),this.material.setColor("_Color",new iC(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=ey([is(t0.TextComponent)],t.ThreeTextComponent),e$(t.ThreeTextComponent,[so]),oD(8),i3.create=function(t,e){return new u_(t,void 0,e)},i3.createWithData=function(t,e,i){return new u_(t,e,i)},rn.create=function(t,e){return new ux(t,e)},ry.create=function(t,e){return new uT(t,e)},rS.create=function(t,e){return new uE(t,e)};var uO="2.4.2";eG.info("THREEJS plugin version: "+uO+"."),t.AbstractPlugin=e6,t.ActivationPlayable=oW,t.AnimationClipPlayable=oH,t.Asset=su,t.AssetLoader=sc,t.AssetManager=s1,t.AssetService=s2,t.BYTES_TYPE_MAP=rv,t.BaseRenderComponent=nP,t.Behaviour=id,t.BezierCurve=ac,t.BezierCurvePath=af,t.BezierCurveQuat=ad,t.CONSTANT_MAP_BLEND=up,t.CONSTANT_MAP_DEPTH=uy,t.CONSTANT_MAP_STENCIL_FUNC=um,t.CONSTANT_MAP_STENCIL_OP=uv,t.COPY_FRAGMENT_SHADER=rc,t.COPY_MESH_SHADER_ID=ru,t.COPY_VERTEX_SHADER=rh,t.CalculateLoader=oN,t.Camera=az,t.CameraVFXItemLoader=nL,t.ColorCurve=aC,t.Component=il,t.Composition=oI,t.DEFAULT_FONTS=sn,t.DEFAULT_FPS=60,t.Database=sl,t.Downloader=iD,t.EFFECTS_COPY_MESH_NAME=rs,t.EVENT_TYPE_CLICK=nV,t.EVENT_TYPE_TOUCH_END=nk,t.EVENT_TYPE_TOUCH_MOVE=nD,t.EVENT_TYPE_TOUCH_START=nF,t.EffectsObject=ic,t.EffectsPackage=ul,t.Ellipse=o5,t.Engine=uf,t.EventEmitter=oS,t.EventSystem=nN,t.Float16ArrayWrapper=nG,t.Framebuffer=r3,t.GPUCapability=r1,t.Geometry=ry,t.GlobalUniforms=rJ,t.GradientValue=au,t.GraphicsPath=o7,t.HELP_LINK=nO,t.InteractLoader=nU,t.InteractMesh=aS,t.KTXTexture=i9,t.LineSegments=ah,t.LinearValue=as,t.MaskProcessor=ra,t.Material=rn,t.MaterialDataBlock=re,t.Mesh=rS,t.MeshCollider=aO,t.PLAYER_OPTIONS_ENV_EDITOR=nw,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=a$,t.ParticleBehaviourPlayableAsset=a0,t.ParticleLoader=ok,t.ParticleMesh=a2,t.ParticleSystemRenderer=a5,t.ParticleTrack=oT,t.PassTextureCache=rp,t.PathSegments=al,t.PluginSystem=e4,t.PolyStar=o6,t.Polygon=o3,t.PropertyTrack=ob,t.RENDER_PASS_NAME_PREFIX=rY,t.RENDER_PREFER_LOOKUP_TEXTURE=aj,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=an,t.RandomValue=aa,t.RandomVectorValue=ao,t.RenderFrame=rq,t.RenderPass=rM,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=rw,t.Renderbuffer=r$,t.Renderer=r4,t.RendererComponent=ip,t.RuntimeClip=ox,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=rm,t.SerializationHelper=sh,t.ShaderFactory=rG,t.ShaderVariant=ro,t.ShapePath=o9,t.SpriteLoader=aM,t.StaticValue=ar,t.TEMPLATE_USE_OFFSCREEN_CANVAS=aX,t.TEXTURE_UNIFORM_MAP=ug,t.TextComponentBase=so,t.TextLayout=si,t.TextLoader=ss,t.TextStyle=sr,t.Texture=i3,t.TextureFactory=rt,t.ThreeComposition=uC,t.ThreeDisplayObject=uw,t.ThreeEngine=uA,t.ThreeMaterial=ux,t.ThreeTexture=u_,t.Ticker=ud,t.TimelineClip=og,t.TimelinePlayable=o_,t.TrackSortWrapper=oC,t.Transform=ak,t.TransformAnimationPlayable=oX,t.ValueGetter=ai,t.Vector2Curve=aT,t.Vector4Curve=ab,t.addByOrder=ek,t.addItem=e_,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=e$,t.assertExist=ez,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=eJ,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=oK,t.calculateTranslation=nW,t.canvasPool=se,t.closePointEps=1e-4,t.colorGradingFrag=rD,t.colorStopsFromGradient=eO,t.colorToArr=eS,t.combineImageTemplate=sJ,t.createCopyShader=rl,t.createGLContext=function(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},t.createKeyFrameMeta=ay,t.createShape=nh,t.createValueGetter=a_,t.curveEps=1e-4,t.decimalEqual=nJ,t.defaultPlugins=e1,t.deserializeMipmapTexture=iJ,t.earcut=nS,t.effectsClass=is,t.effectsClassStore=io,t.enlargeBuffer=eA,t.ensureFixedNumber=sd,t.ensureVec3=nH,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=rk,t.gaussianDownVFrag=rN,t.gaussianUpFrag=rz,t.generateEmptyTypedArray=rg,t.generateGUID=eK,t.generateHalfFloatTexture=i4,t.generateTransparentTexture=i8,t.generateWhiteTexture=i6,t.getBackgroundImage=sK,t.getColorFromGradientStops=ew,t.getConfig=function(t){return aW[t]},t.getDefaultTextureFactory=function(){return t5||(t5=new rt),t5},t.getGeometryByShape=nR,t.getGeometryTriangles=nM,t.getKTXTextureOptions=i7,t.getKeyFrameMetaByRawValue=av,t.getMergedStore=iu,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===nw]],h=e.level,c=e.detail,l=ay(),f=ay(),d=c.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,av(l,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&&av(l,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])&&(av(l,b[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==b?void 0:b[n])&&(av(l,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?(av(l,T.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,av(l,T.y)):av(l,T.size)}if(o.rotationOverLifetime){var E=o.rotationOverLifetime;E.z&&(av(l,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(av(l,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(av(l,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)}av(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,av(l,b.forceCurve));var _=c.halfFloatTexture;_&&f.max&&(v|=1048576);var C=c.maxVertexUniforms,A=l.max+l.curves.length-32>C;aW[aj]&&(A=!0),2===h&&(l.max=-1,f.index>0&&(f.max=-1)),A&&_&&d&&(m=1);var S={fragment:rP,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+rL,shared:!0,cacheId:["-p:",s,v,l.index,l.max,f.index,f.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:S,vertex:l.index,fragment:f.index}},t.getPixelRatio=function(){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},t.getPreMultiAlpha=iI,t.getStandardComposition=sH,t.getStandardImage=sW,t.getStandardItem=sZ,t.getStandardJSON=sj,t.getTextureSize=rQ,t.glContext=iO,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return t2.Float32;case WebGLRenderingContext.SHORT:return t2.Int16;case WebGLRenderingContext.BYTE:return t2.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return t2.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return t2.UInt8;default:return t2.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=ef(function(){return eg(this,function(n){return[2,new Promise(function(n,a){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);o&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(o||s)&&(t.deleteQuery(i),i=null),null!==o&&i&&window.setTimeout(function(){r().then(n).catch},1)}})]})});if(!i)return;return{begin:function(){i&&t.beginQuery(e.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:r}}},t.imageDataFromColor=function(t){eX(t)&&(t=eS(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},t.imageDataFromGradient=eF,t.initErrors=iw,t.initGLContext=iM,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=eM,t.isAlipayMiniApp=eL,t.isAndroid=eI,t.isArray=eW,t.isCanvas=eZ,t.isFunction=eH,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},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 eL()||eV()},t.isObject=eY,t.isSimulatorCellPhone=eP,t.isString=eX,t.isUniformStruct=ri,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&ri(t[0])},t.isValidFontFamily=eU,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.isWechatMiniApp=eV,t.itemFrag=rI,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=rR,t.loadAVIFOptional=iB,t.loadBinary=iW,t.loadBlob=function(t){return iY.apply(this,arguments)},t.loadImage=ij,t.loadMedia=iQ,t.loadVideo=iZ,t.loadWebPOptional=iz,t.logger=eG,t.math=rC,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=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=ej,t.normalizeColor=sx,t.numberToFix=n$,t.parsePercent=eR,t.particleFrag=rP,t.particleOriginTranslateMap=nq,t.particleUniformTypeMap=a1,t.particleVert=rL,t.passRenderLevel=sQ,t.pluginLoaderMap=e0,t.randomInRange=eq,t.registerPlugin=e3,t.removeItem=eC,t.rotateVec2=nI,t.screenMeshVert=rF,t.serialize=function(t,e){return ih(t,e)},t.setBlendMode=iP,t.setConfig=function(t,e){return aW[t]=e},t.setDefaultTextureFactory=function(t){t5=t},t.setMaskMode=iV,t.setMaxSpriteMeshItemCount=oD,t.setRayFromCamera=nQ,t.setSideMode=iL,t.setSpriteMeshMaxItemCountByGPU=function(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0},t.setUniformValue=function(t,e,i){t[e]?t[e].value=i:t[e]=new ec.Uniform(i)},t.sortByOrder=eD,t.spec=it,t.thresholdFrag=rU,t.throwDestroyedError=eQ,t.trailVert=rV,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=nK,t.unregisterPlugin=function(t){delete e2[t],delete e0[t],eC(e1,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=nY,t.vecMulCombine=nZ,t.version=uO,t.vertexFormatType2GLType=function(t){switch(t){case t2.Float32:return WebGLRenderingContext.FLOAT;case t2.Int16:return WebGLRenderingContext.SHORT;case t2.Int8:return WebGLRenderingContext.BYTE;case t2.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case t2.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
6
+ * Version: v2.4.4
7
+ */function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.three={}),t.THREE)}(this,function(t,e){"use strict";var i,r,n,a,o,s,u,h,c,l,f,d,p,m,v,y,g,x,b,T,E,_,C,A,S,w,O,M,R,I,P,L,V,F,D,k,N,z,U,B,G,j,X,H,W,Y,Z,q,Q,K,J,$,tt,te,ti,tr,tn,ta,to,ts,tu,th,tc,tl,tf,td,tp,tm,tv,ty,tg,tx,tb,tT,tE,t_,tC,tA,tS,tw,tO,tM,tR,tI,tP,tL,tV,tF,tD,tk,tN,tz,tU,tB,tG,tj,tX,tH,tW,tY,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,ea,eo,es,eu,eh,ec=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}),e.default=t,Object.freeze(e)}(e);function el(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 ef(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var a=t.apply(e,i);function o(t){el(a,r,n,o,s,"next",t)}function s(t){el(a,r,n,o,s,"throw",t)}o(void 0)})}}function ed(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 ep(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 ed(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 ed(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function em(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):em(t,e)}function ev(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function ey(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 eg(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 ex=new Uint8Array(16),eb=[],eT=0;eT<256;++eT)eb.push((eT+256).toString(16).slice(1));var eE={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function e_(t,e){return t.includes(e)||t.push(e),t}function eC(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function eA(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 eS(t,e){var i=[0,0,0,0];if(eH(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 em(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function ew(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=eM(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 eO(t){var e=[];if(em(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:eR(i),color:[r,n,a,o]})}):Object.keys(t).forEach(function(i){var r=eS(t[i]);e.push({stop:eR(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 eM(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 eR(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function eI(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function eP(){return/\bOpenHarmony\b/.test(navigator.userAgent)}function eL(){return eI()||eP()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eV(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eF(){return"miniprogram"===window.__wxjs_environment}function eD(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=eO(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=eM(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 ek(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++)ez(t,r,e);return t}function eN(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&ez(t,t.length-1,i)),t}function ez(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 eU(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eB(t){return/^[^\d.][\w-]*$/.test(t)}function eG(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(i=t.OrderType||(t.OrderType={}))[i.none=1]="none",i[i.ascending=2]="ascending",i[i.descending=3]="descending";var ej={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(eG(t),[r])),null==ty||ty("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(eG(t))),null==ty||ty("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(eG(t))),null==ty||ty("warn",t,r)},register:function(t){t&&eY(t)&&(ty=t)}};function eX(){}function eH(t){return"string"==typeof t}t.DestroyOptions=void 0,(r=t.DestroyOptions||(t.DestroyOptions={}))[r.destroy=0]="destroy",r[r.keep=1]="keep",r[r.force=0]="force";var eW=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eY(t){return"[object Function]"===Object.prototype.toString.call(t)}function eZ(t){return"[object Object]"===Object.prototype.toString.call(t)}function eq(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eQ(t,e){return t+Math.random()*(e-t)}function eK(){throw Error("Destroyed item cannot be used again.")}function eJ(){return(function(t,e,i){if(eE.randomUUID&&!t)return eE.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tv&&!(tv="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 tv(ex)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),eb[n[r+0]]+eb[n[r+1]]+eb[n[r+2]]+eb[n[r+3]]+"-"+eb[n[r+4]]+eb[n[r+5]]+"-"+eb[n[r+6]]+eb[n[r+7]]+"-"+eb[n[r+8]]+eb[n[r+9]]+"-"+eb[n[r+10]]+eb[n[r+11]]+eb[n[r+12]]+eb[n[r+13]]+eb[n[r+14]]+eb[n[r+15]]})().replace(/-/g,"")}function e$(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 e0(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 e1={},e2=[],e3={};function e4(t,e,i){e3[t]&&ej.error("Duplicate registration for plugin "+t+"."),e3[t]=i,e1[t]=e,e_(e2,t)}var e5=function(){function t(t){var e={},i=[];e2.forEach(function(t){var r=e1[t];i.includes(r)||(i.push(r),e[t]=r)});for(var r,n=ep(t);!(r=n()).done;){var a=r.value;if(!e1[a])throw Error("The plugin '"+a+"' not found."+function(t){var e=e6[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+"'":""}(a))}this.plugins=Object.keys(e).map(function(t){var e=new e1[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 i=this;return ef(function(){return eg(this,function(r){return[2,i.callStatic("processRawJSON",t,e)]})})()},e.processAssets=function(t,e){var i=this;return ef(function(){return eg(this,function(r){return[2,i.callStatic("processAssets",t,e)]})})()},e.precompile=function(t,e){for(var i,r=ep(this.plugins);!(i=r()).done;)i.value.precompile(t,e)},e.loadResources=function(t,e){var i=this;return ef(function(){return eg(this,function(r){return[2,i.callStatic("prepareResource",t,e)]})})()},e.callStatic=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n=this;return ef(function(){var e,r,a,o,s,u;return eg(this,function(h){for(a=0,e=[],r=n.plugins;a<r.length;a++)t in(o=e1[r[a].name])&&e.push(Promise.resolve(null==(u=o[t])?void 0:(s=u).call.apply(s,[].concat([o],i))));return[2,Promise.all(e)]})})()},t}(),e6={"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"},e8=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 e9(t,e){return(e9=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function e7(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&&e9(t,e)}(n=tg||(tg={}))["1_0"]="1.0",n["1_1"]="1.1",n["1_2"]="1.2",n["1_3"]="1.3",n["1_5"]="1.5",n["1_8"]="1.8",n["2_0"]="2.0",n["2_1"]="2.1",n["2_2"]="2.2",n["2_3"]="2.3",n["2_4"]="2.4",n["3_0"]="3.0",n["3_1"]="3.1",n["3_2"]="3.2",n["3_3"]="3.3",n.LATEST="3.3",(a=tx||(tx={})).S="S",a.APlus="A+",a.A="A",a.BPlus="B+",a.B="B",(o=tb||(tb={}))[o.ALPHA=0]="ALPHA",o[o.ADD=1]="ADD",o[o.MULTIPLY=2]="MULTIPLY",o[o.BRIGHTNESS=3]="BRIGHTNESS",o[o.SUBTRACTION=4]="SUBTRACTION",o[o.STRONG_LIGHT=5]="STRONG_LIGHT",o[o.WEAK_LIGHT=6]="WEAK_LIGHT",o[o.SUPERPOSITION=7]="SUPERPOSITION",(s=tT||(tT={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=tE||(tE={}))[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(h=t_||(t_={}))[h.NONE=0]="NONE",h[h.SPHERE=1]="SPHERE",h[h.CONE=2]="CONE",h[h.HEMISPHERE=3]="HEMISPHERE",h[h.CIRCLE=4]="CIRCLE",h[h.DONUT=5]="DONUT",h[h.RECTANGLE=6]="RECTANGLE",h[h.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",h[h.EDGE=8]="EDGE",h[h.TEXTURE=9]="TEXTURE",(c=tC||(tC={}))[c.GYROSCOPE=0]="GYROSCOPE",c[c.SPINE=1]="SPINE",(l=tA||(tA={}))[l.CLICK=0]="CLICK",l[l.MESSAGE=1]="MESSAGE",l[l.DRAG=2]="DRAG",(f=tS||(tS={}))[f.NONE=0]="NONE",f[f.NOTIFY=1]="NOTIFY",f[f.RESUME_PLAYER=2]="RESUME_PLAYER",f[f.REMOVE=3]="REMOVE",f[f.PAUSE=4]="PAUSE",(d=tw||(tw={})).base="0",d.sprite="1",d.particle="2",d.null="3",d.interact="4",d.plugin="5",d.camera="6",d.composition="7",d.spine="spine",d.mesh="mesh",d.tree="tree",d.text="text",d.light="light",d.skybox="skybox",d.effect="effect",d.shape="shape",d.postProcessVolume="postProcessVolume",d.node="node",d.video="video",d.audio="audio",d.richtext="richtext",(p=tO||(tO={}))[p.BILLBOARD=0]="BILLBOARD",p[p.MESH=1]="MESH",p[p.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",p[p.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(m=tM||(tM={}))[m.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",m[m.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",m[m.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",m[m.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",m[m.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",m[m.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",m[m.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",m[m.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",m[m.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(v=tR||(tR={})).Opaque="Opaque",v.Transparent="Transparent",(y=tI||(tI={})).Both="Both",y.Back="Back",y.Front="Front",(g=tP||(tP={}))[g.portrait=1]="portrait",g[g.landscape=0]="landscape",(x=tL||(tL={}))[x.CONSTANT=0]="CONSTANT",x[x.CONSTANT_VEC2=1]="CONSTANT_VEC2",x[x.CONSTANT_VEC3=2]="CONSTANT_VEC3",x[x.CONSTANT_VEC4=3]="CONSTANT_VEC4",x[x.RANDOM=4]="RANDOM",x[x.LINE=5]="LINE",x[x.CURVE=6]="CURVE",x[x.BEZIER_PATH=7]="BEZIER_PATH",x[x.RGBA_COLOR=8]="RGBA_COLOR",x[x.GRADIENT_COLOR=9]="GRADIENT_COLOR",x[x.SHAPE_POINTS=10]="SHAPE_POINTS",x[x.SHAPE_SPLITS=11]="SHAPE_SPLITS",x[x.LINEAR_PATH=12]="LINEAR_PATH",x[x.COLORS=13]="COLORS",x[x.BINARY=20]="BINARY",x[x.BEZIER_CURVE=21]="BEZIER_CURVE",x[x.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",x[x.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",x[x.COLOR_CURVE=24]="COLOR_CURVE",x[x.VECTOR4_CURVE=25]="VECTOR4_CURVE",x[x.VECTOR2_CURVE=26]="VECTOR2_CURVE",(b=tV||(tV={}))[b.AUTO=0]="AUTO",b[b.EASE=1]="EASE",b[b.EASE_IN=2]="EASE_IN",b[b.EASE_OUT=3]="EASE_OUT",b[b.LINE=4]="LINE",b[b.HOLD=5]="HOLD",b[b.LINE_OUT=6]="LINE_OUT",(T=tF||(tF={}))[T.destroy=0]="destroy",T[T.restart=5]="restart",T[T.forward=2]="forward",T[T.freeze=4]="freeze",(E=tD||(tD={}))[E.none=0]="none",E[E.removeParticle=1]="removeParticle",(_=tk||(tk={}))[_.RANDOM=0]="RANDOM",_[_.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",_[_.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",_[_.UNIFORM_BURST=3]="UNIFORM_BURST",(C=tN||(tN={})).point="point",C.spot="spot",C.directional="directional",C.ambient="ambient",(A=tz||(tz={}))[A.box=2]="box",A[A.sphere=3]="sphere",(S=tU||(tU={})).orthographic="orthographic",S.perspective="perspective",(w=tB||(tB={})).unlit="unlit",w.pbr="pbr",w.hair="hair",(O=tG||(tG={}))[O.opaque=100]="opaque",O[O.masked=101]="masked",O[O.translucent=102]="translucent",O[O.additive=103]="additive",(M=tj||(tj={})).none="none",M.uv="uv",M.normal="normal",M.basecolor="basecolor",M.alpha="alpha",M.metallic="metallic",M.roughness="roughness",M.ao="ao",M.emissive="emissive",M.diffuse="diffuse",(R=tX||(tX={}))[R.display=0]="display",R[R.clip=1]="clip",R[R.ellipsis=2]="ellipsis",(I=tH||(tH={}))[I.top=0]="top",I[I.middle=1]="middle",I[I.bottom=2]="bottom",(P=tW||(tW={}))[P.left=0]="left",P[P.middle=1]="middle",P[P.right=2]="right",(L=tY||(tY={})).normal="normal",L.bold="bold",L.lighter="lighter",(V=tZ||(tZ={})).normal="normal",V.italic="italic",V.oblique="oblique";var it={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};(F=tq||(tq={}))[F.Custom=0]="Custom",F[F.Rectangle=1]="Rectangle",F[F.Ellipse=2]="Ellipse",F[F.Polygon=3]="Polygon",F[F.Star=4]="Star",(D=tQ||(tQ={}))[D.Butt=0]="Butt",D[D.Round=1]="Round",D[D.Square=2]="Square",(k=tK||(tK={}))[k.Round=0]="Round",k[k.Bevel=1]="Bevel",k[k.Miter=2]="Miter",(N=tJ||(tJ={})).video="video",N.image="image",(z=t$||(t$={})).video="video",z.audio="audio",(U=t0||(t0={})).VFXItemData="VFXItemData",U.Material="Material",U.Shader="Shader",U.Geometry="Geometry",U.Texture="Texture",U.Image="Image",U.AnimationClip="AnimationClip",U.BinaryAsset="BinaryAsset",U.TrackAsset="TrackAsset",U.TimelineAsset="TimelineAsset",U.ObjectBindingTrack="ObjectBindingTrack",U.TransformTrack="TransformTrack",U.SpriteColorTrack="SpriteColorTrack",U.ActivationTrack="ActivationTrack",U.SubCompositionTrack="SubCompositionTrack",U.FloatPropertyTrack="FloatPropertyTrack",U.ColorPropertyTrack="ColorPropertyTrack",U.Vector2PropertyTrack="Vector2PropertyTrack",U.Vector4PropertyTrack="Vector4PropertyTrack",U.TransformPlayableAsset="TransformPlayableAsset",U.SpriteColorPlayableAsset="SpriteColorPlayableAsset",U.ActivationPlayableAsset="ActivationPlayableAsset",U.SubCompositionPlayableAsset="SubCompositionPlayableAsset",U.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",U.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",U.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",U.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",U.MeshComponent="MeshComponent",U.SkyboxComponent="SkyboxComponent",U.LightComponent="LightComponent",U.CameraComponent="CameraComponent",U.ModelPluginComponent="ModelPluginComponent",U.TreeComponent="TreeComponent",U.AnimationComponent="AnimationComponent",U.SpineComponent="SpineComponent",U.VideoComponent="VideoComponent",U.AudioComponent="AudioComponent",U.RichTextComponent="RichTextComponent",U.OrientationComponent="OrientationComponent",U.ShapeComponent="ShapeComponent",U.SpriteComponent="SpriteComponent",U.ParticleSystem="ParticleSystem",U.InteractComponent="InteractComponent",U.CameraController="CameraController",U.PostProcessVolume="PostProcessVolume",U.EffectComponent="EffectComponent",U.TextComponent="TextComponent",U.TimelineClip="TimelineClip",(B=t1||(t1={}))[B.POINTS=0]="POINTS",B[B.LINES=1]="LINES",B[B.LINE_LOOP=2]="LINE_LOOP",B[B.LINE_STRIP=3]="LINE_STRIP",B[B.TRIANGLES=4]="TRIANGLES",B[B.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",B[B.TRIANGLE_FAN=6]="TRIANGLE_FAN",(G=t2||(t2={}))[G.Float16=0]="Float16",G[G.Float32=1]="Float32",G[G.Int8=2]="Int8",G[G.Int16=3]="Int16",G[G.Int32=4]="Int32",G[G.UInt8=5]="UInt8",G[G.UInt16=6]="UInt16",G[G.UInt32=7]="UInt32",(j=t3||(t3={}))[j.None=-1]="None",j[j.UInt8=0]="UInt8",j[j.UInt16=1]="UInt16",j[j.UInt32=2]="UInt32",(X=t4||(t4={})).Position="POSITION",X.Uv="TEXCOORD0",X.Uv2="TEXCOORD1",X.Normal="NORMAL",X.Tangent="TANGENT",X.Color="COLOR",X.Joints="JOINTS",X.Weights="WEIGHTS",X.PositionBS0="POSITION_BS0",X.PositionBS1="POSITION_BS1",X.PositionBS2="POSITION_BS2",X.PositionBS3="POSITION_BS3",X.PositionBS4="POSITION_BS4",X.PositionBS5="POSITION_BS5",X.PositionBS6="POSITION_BS6",X.PositionBS7="POSITION_BS7",X.NormalBS0="NORMAL_BS0",X.NormalBS1="NORMAL_BS1",X.NormalBS2="NORMAL_BS2",X.NormalBS3="NORMAL_BS3",X.TangentBS0="TANGENT_BS0",X.TangentBS1="TANGENT_BS1",X.TangentBS2="TANGENT_BS2",X.TangentBS3="TANGENT_BS3";var ie=Object.freeze({__proto__:null,LATEST_VERSION:tg.LATEST,get RenderLevel(){return tx},get BlendingMode(){return tb},get SideMode(){return tT},get ObscuredMode(){return tE},get ParticleEmitterShapeType(){return t_},get PluginType(){return tC},get InteractType(){return tA},get InteractBehavior(){return tS},get ItemType(){return tw},get RenderMode(){return tO},get ParticleOrigin(){return tM},get RenderType(){return tR},get RenderFace(){return tI},get CameraClipMode(){return tP},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 tL},get BezierKeyframeType(){return tV},get JSONSceneVersion(){return tg},get EndBehavior(){return tF},get ParticleInteractionBehavior(){return tD},get ShapeArcMode(){return tk},get LightType(){return tN},get ModelBoundingType(){return tz},get CameraType(){return tU},get MaterialType(){return tB},get MaterialBlending(){return tG},get RenderMode3D(){return tj},get TextOverflow(){return tX},get TextBaseline(){return tH},get TextAlignment(){return tW},get TextWeight(){return tY},get FontStyle(){return tZ},BuiltinObjectGUID:it,get ShapePrimitiveType(){return tq},get LineCap(){return tQ},get LineJoin(){return tK},get BackgroundType(){return tJ},get MultimediaType(){return t$},get DataType(){return t0},get GeometryType(){return t1},get VertexFormatType(){return t2},get IndexFormatType(){return t3},get VertexBufferSemantic(){return t4}});function ii(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 ir(t,e,i){return e&&ii(t.prototype,e),i&&ii(t,i),t}var ia=new Map,io=new Map,is={};function iu(t){return function(e,i){is[t]&&console.warn("Class "+t+" is already registered."),is[t]=e}}function ih(t){var e=t.constructor;if(io.get(e))return io.get(e);var i={};io.set(e,i);for(var r=t,n=e;n;){var a=ia.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 ic(t,e){return function(i,r){var n,a=(n=i.constructor,ia.get(n)||ia.set(n,{}),ia.get(n));a&&(a[r]||(a[r]={type:t,sourceName:e}))}}var il=function(){function t(t){this.engine=t,this.guid=eJ(),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 em(e,t)&&"guid"in e},t}(),id=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}e7(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&&eC(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},ir(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}(il);ey([ic(void 0,void 0)],id.prototype,"item",void 0),ey([ic(void 0,void 0)],id.prototype,"_enabled",void 0);var ip=function(t){function e(){return t.apply(this,arguments)}e7(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}(id),im=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.materials=[],e._priority=0,e}e7(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)},ir(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}(id);ey([ic(void 0,void 0)],im.prototype,"materials",void 0),ey([ic(void 0,void 0)],im.prototype,"_priority",void 0);var iv=Math.PI/180,iy=180/Math.PI;function ig(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var ix=function(t,e,i){return(1-i)*t+i*e};function ib(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))}var iT=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):em(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):em(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):em(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):em(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}();iT.ONE=new iT(1,1),iT.ZERO=new iT(0,0);var iE=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):em(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):em(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):em(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):em(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 iT(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}();iE.X=new iE(1,0,0),iE.Y=new iE(0,1,0),iE.Z=new iE(0,0,1),iE.ONE=new iE(1,1,1),iE.ZERO=new iE(0,0,0);var i_=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):em(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):em(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):em(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):em(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 iE(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}();i_.ONE=new i_(1,1,1,1),i_.ZERO=new i_(0,0,0,0);var iC=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.meshCollider=new aM,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}e7(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}(im);ey([ic(void 0,void 0)],iC.prototype,"geometry",void 0),t.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="EffectComponent",i}e7(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.item.time,r=null!=(e=this.material.getVector4("_Time"))?e:new i_;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i))},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(iC),t.EffectComponent=ey([iu(t0.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 e7(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(id),ey([ic(void 0,void 0)],t.PostProcessVolume.prototype,"bloom",void 0),ey([ic(void 0,void 0)],t.PostProcessVolume.prototype,"vignette",void 0),ey([ic(void 0,void 0)],t.PostProcessVolume.prototype,"tonemapping",void 0),ey([ic(void 0,void 0)],t.PostProcessVolume.prototype,"colorAdjustments",void 0),t.PostProcessVolume=ey([iu(t0.PostProcessVolume)],t.PostProcessVolume);var iA=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 c=i-n;return this.set(s+c,u+c,h+c,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):em(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):em(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):em(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):em(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 i_(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}();iA.BLACK=new iA(0,0,0,1),iA.BLUE=new iA(0,0,1,1),iA.CLEAR=new iA(0,0,0,0),iA.CYAN=new iA(0,1,1,1),iA.GRAY=new iA(.5,.5,.5,1),iA.GREEN=new iA(0,1,0,1),iA.MAGENTA=new iA(1,0,1,1),iA.RED=new iA(1,0,0,1),iA.WHITE=new iA(1,1,1,1),iA.YELLOW=new iA(1,.92,.016,1);var iS=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],c=e[10],l=i+o+c;if(l>0){var f=.5/Math.sqrt(l+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>c){var d=2*Math.sqrt(1+i-o-c);this.w=(h-s)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(o>c){var p=2*Math.sqrt(1+o-i-c);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+c-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(ib(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),c=Math.atan2(h,o),l=Math.sin((1-e)*c)/h,f=Math.sin(e*c)/h;return this.w=a*l+this.w*f,this.x=i*l+this.x*f,this.y=r*l+this.y*f,this.z=n*l+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,c=a*s+n*o-i*u,l=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)+-(c*n)- -(l*r),d.y=c*a+-(f*r)+-(l*i)- -(h*n),d.z=l*a+-(f*n)+-(h*r)- -(c*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(iE.ZERO,this,iE.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}();iS.tempVec0=new iE;var iw=function(){function t(t,e,i,r,n,a,o,s,u,h,c,l,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===c&&(c=1),void 0===l&&(l=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,c,l,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,o,s,u,h,c,l,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]=c,v[11]=l,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,c,l,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]=c,v[14]=l,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,c=o*s,l=o*u;return this.set(c*s+n,c*u+a*h,c*h-a*u,0,c*u-a*h,l*u+n,l*h+a*s,0,c*h+a*u,l*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(iE.ZERO,t,iE.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],c=i[5],l=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],A=r[1],S=r[5],w=r[9],O=r[13],M=r[2],R=r[6],I=r[10],P=r[14],L=r[3],V=r[7],F=r[11],D=r[15];return n[0]=a*T+o*A+s*M+u*L,n[4]=a*E+o*S+s*R+u*V,n[8]=a*_+o*w+s*I+u*F,n[12]=a*C+o*O+s*P+u*D,n[1]=h*T+c*A+l*M+f*L,n[5]=h*E+c*S+l*R+f*V,n[9]=h*_+c*w+l*I+f*F,n[13]=h*C+c*O+l*P+f*D,n[2]=d*T+p*A+m*M+v*L,n[6]=d*E+p*S+m*R+v*V,n[10]=d*_+p*w+m*I+v*F,n[14]=d*C+p*O+m*P+v*D,n[3]=y*T+g*A+x*M+b*L,n[7]=y*E+g*S+x*R+b*V,n[11]=y*_+g*w+x*I+b*F,n[15]=y*C+g*O+x*P+b*D,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],c=t[6],l=t[10],f=t[14];return t[3]*(+n*s*c-r*u*c-n*o*l+i*u*l+r*o*f-i*s*f)+t[7]*(+e*s*f-e*u*l+n*a*l-r*a*f+r*u*h-n*s*h)+t[11]*(+e*u*c-e*o*f-n*a*c+i*a*f+n*o*h-i*u*h)+t[15]*(-r*o*h-e*s*c+e*o*l+r*a*c-i*a*l+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],c=t[9],l=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=c*m*u-p*l*u+p*s*f-o*m*f-c*s*v+o*l*v,g=d*l*u-h*m*u-d*s*f+a*m*f+h*s*v-a*l*v,x=h*p*u-d*c*u+d*o*f-a*p*f-h*o*v+a*c*v,b=d*c*s-h*p*s-d*o*l+a*p*l+h*o*m-a*c*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*l*n-c*m*n-p*r*f+i*m*f+c*r*v-i*l*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]=(c*s*n-o*l*n-c*r*u+i*l*u+o*r*f-i*s*f)*E,t[4]=g*E,t[5]=(h*m*n-d*l*n+d*r*f-e*m*f-h*r*v+e*l*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*l*n-h*s*n+h*r*u-e*l*u-a*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*c*n-h*p*n-d*i*f+e*p*f+h*i*v-e*c*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*c*n-h*i*u+e*c*u+a*i*f-e*o*f)*E,t[12]=b*E,t[13]=(h*p*r-d*c*r+d*i*l-e*p*l-h*i*m+e*c*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*c*r-h*o*r+h*i*s-e*c*s-a*i*l+e*o*l)*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=iE.ZERO);var n=this.elements,a=e.x,o=e.y,s=e.z,u=e.w,h=-r.x,c=-r.y,l=-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,A=i.y,S=i.z;return n[0]=(1-(g+b))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*A,n[5]=(1-(m+b))*A,n[6]=(x+T)*A,n[7]=0,n[8]=(y+E)*S,n[9]=(x-T)*S,n[10]=(1-(m+g))*S,n[11]=0,n[12]=h*n[0]+c*n[4]+l*n[8]-h+t.x,n[13]=h*n[1]+c*n[5]+l*n[9]-c+t.y,n[14]=h*n[2]+c*n[6]+l*n[10]-l+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 c=1/o,l=1/s,f=1/u;return h.elements[0]*=c,h.elements[1]*=c,h.elements[2]*=c,h.elements[4]*=l,h.elements[5]*=l,h.elements[6]*=l,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 iE,e=new iS,i=new iE;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,c=-(i+r)*s,l=-(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]=c,f[14]=l,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(!ig(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,c,l,f,d,p,m,v){return new t(e,a,h,d,i,o,c,p,r,s,l,m,n,u,f,v)},t}();iw.IDENTITY=new iw(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),iw.ZERO=new iw(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),iw.tempVec0=new iE,iw.tempVec1=new iE,iw.tempVec2=new iE,iw.tempMat0=new iw;var iO=[],iM={};function iR(){"function"==typeof WebGL2RenderingContext?iI(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iI(WebGLRenderingContext),iI(WebGLRenderingContext.prototype)):iO.push("iOS16 lockdown mode, WebGL Constants not in global"),iO.length||"HALF_FLOAT"in iM||(iM.HALF_FLOAT=5131)}function iI(t){for(var e in t)/^[A-Z_]/.test(e)&&(iM[e]=t[e])}function iP(t){switch(t){case tb.ALPHA:case tb.ADD:case tb.SUBTRACTION:case tb.STRONG_LIGHT:case tb.WEAK_LIGHT:return 1;case tb.SUPERPOSITION:return 2;case tb.BRIGHTNESS:return 3;case tb.MULTIPLY:return 0;default:return 1}}function iL(t,e){switch(e){case void 0:case tb.ALPHA:t.blendFunction=[iM.ONE,iM.ONE_MINUS_SRC_ALPHA,iM.ONE,iM.ONE_MINUS_SRC_ALPHA];break;case tb.ADD:t.blendFunction=[iM.ONE,iM.ONE,iM.ONE,iM.ONE];break;case tb.SUBTRACTION:t.blendFunction=[iM.ONE,iM.ONE,iM.ZERO,iM.ONE],t.blendEquation=[iM.FUNC_REVERSE_SUBTRACT,iM.FUNC_REVERSE_SUBTRACT];break;case tb.SUPERPOSITION:t.blendFunction=[iM.ONE,iM.ONE,iM.ONE,iM.ONE];break;case tb.MULTIPLY:t.blendFunction=[iM.DST_COLOR,iM.ONE_MINUS_SRC_ALPHA,iM.DST_COLOR,iM.ONE_MINUS_SRC_ALPHA];break;case tb.BRIGHTNESS:t.blendFunction=[iM.ONE,iM.ONE_MINUS_SRC_ALPHA,iM.ONE,iM.ONE_MINUS_SRC_ALPHA];break;case tb.STRONG_LIGHT:t.blendFunction=[iM.DST_COLOR,iM.DST_ALPHA,iM.ZERO,iM.ONE];break;case tb.WEAK_LIGHT:t.blendFunction=[iM.DST_COLOR,iM.ZERO,iM.ZERO,iM.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iV(t,e){e===tT.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=iM.CW,t.cullFace=e===tT.BACK?iM.BACK:iM.FRONT)}function iF(e,i){switch(i){case void 0:e.stencilTest=!1;break;case t.MaskMode.MASK:e.stencilTest=!0,e.stencilFunc=[iM.ALWAYS,iM.ALWAYS],e.stencilOpZPass=[iM.REPLACE,iM.REPLACE];break;case t.MaskMode.OBSCURED:e.stencilTest=!0,e.stencilFunc=[iM.EQUAL,iM.EQUAL];break;case t.MaskMode.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[iM.NOTEQUAL,iM.NOTEQUAL];break;case t.MaskMode.NONE:e.stencilTest=!1;break;default:console.warn("MaskMode "+i+" not in specification, please set stencil params seperately.")}}function iD(){return(iD=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)}iO.length||iR(),t.ShaderType=void 0,(H=t.ShaderType||(t.ShaderType={}))[H.vertex=0]="vertex",H[H.fragment=1]="fragment",t.MaskMode=void 0,(W=t.MaskMode||(t.MaskMode={}))[W.NONE=0]="NONE",W[W.MASK=1]="MASK",W[W.OBSCURED=2]="OBSCURED",W[W.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",t.TextureLoadAction=void 0,(Y=t.TextureLoadAction||(t.TextureLoadAction={}))[Y.whatever=0]="whatever",Y[Y.clear=2]="clear",t.TextureSourceType=void 0,(Z=t.TextureSourceType||(t.TextureSourceType={}))[Z.none=0]="none",Z[Z.data=1]="data",Z[Z.image=2]="image",Z[Z.compressed=3]="compressed",Z[Z.video=4]="video",Z[Z.canvas=5]="canvas",Z[Z.framebuffer=6]="framebuffer",Z[Z.mipmaps=7]="mipmaps";var ik=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}(),iN=!1,iz=!1;function iU(t,e){return iB.apply(this,arguments)}function iB(){return(iB=ef(function(t,e){return eg(this,function(i){switch(i.label){case 0:if(!(iN||!e))return[3,2];return[4,iX(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,iX(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iN=!0,[4,iX(t)];case 6:return[2]}})})).apply(this,arguments)}function iG(t,e){return ij.apply(this,arguments)}function ij(){return(ij=ef(function(t,e){return eg(this,function(i){switch(i.label){case 0:if(!(iz||!e))return[3,2];return[4,iX(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,iX(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iz=!0,[4,iX(t)];case 6:return[2]}})})).apply(this,arguments)}function iX(t){return iH.apply(this,arguments)}function iH(){return(iH=ef(function(t){var e,i;return eg(this,function(r){if(e="",em(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else em(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 iW(t){return iY.apply(this,arguments)}function iY(){return(iY=ef(function(t){return eg(this,function(e){return[2,new Promise(function(e,i){new ik().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iZ(){return(iZ=ef(function(t){return eg(this,function(e){return[2,new Promise(function(e,i){new ik().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iq(t){return iQ.apply(this,arguments)}function iQ(){return(iQ=ef(function(t){var e;return eg(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eI()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=e.play();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 iK(t,e){return iJ.apply(this,arguments)}function iJ(){return(iJ=ef(function(t,e){return eg(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 i$(t,e,i){return i0.apply(this,arguments)}function i0(){return(i0=ef(function(e,i,r,n){var a,o,s,u,h,c,l;return eg(this,function(f){switch(f.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]:i1(t,i)}))}))];case 1:return s=f.sent(),[2,iD({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 2:return u=e.mipmaps,h=e.target,[4,Promise.all(u.map(function(t){return i1(t,i)}))];case 3:return c=f.sent(),l=n[u[0][1][0]].url,[2,iD({keepImageSource:!1},e,{mipmaps:c,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:h,bin:l,type:t.TextureSourceType.mipmaps,mipmaps:u.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function i1(t,e){return i2.apply(this,arguments)}function i2(){return(i2=ef(function(t,e){var i,r,n,a,o;return eg(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,iX(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var i3=1,i4=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+i3++,i}e7(i,e);var r=i.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(e){var i=e.target,r=void 0===i?iM.TEXTURE_2D:i,n=e.format,a=void 0===n?iM.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),iD({minFilter:iM.NEAREST,magFilter:iM.NEAREST,wrapS:iM.CLAMP_TO_EDGE,wrapT:iM.CLAMP_TO_EDGE,target:r,format:iM.RGBA,internalFormat:a,type:iM.UNSIGNED_BYTE},e)},i.fromImage=function(e,r,n){return ef(function(){var a,o;return eg(this,function(s){switch(s.label){case 0:return[4,iX(e)];case 1:return a=s.sent(),(o=i.create(r,iD({sourceType:t.TextureSourceType.image,image:a,target:iM.TEXTURE_2D,id:eJ(),flipY:!0},n))).initialize(),[2,o]}})})()},i.fromVideo=function(e,r,n){return ef(function(){var a,o;return eg(this,function(s){switch(s.label){case 0:return[4,iq(e)];case 1:return a=s.sent(),(o=i.create(r,iD({sourceType:t.TextureSourceType.video,video:a,id:eJ(),flipY:!0},n))).initialize(),[2,o]}})})()},ir(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(il);function i5(t,e,i,r){var n,a,o=e.length/i/r;return a=n=4===o||0===o?iM.RGBA:3===o?iM.RGB:2===o?iM.LUMINANCE_ALPHA:iM.LUMINANCE,i4.createWithData(t,{data:e,width:i,height:r},{type:iM.HALF_FLOAT,format:n,internalFormat:a,wrapS:iM.CLAMP_TO_EDGE,wrapT:iM.CLAMP_TO_EDGE})}var i6={type:iM.UNSIGNED_BYTE,format:iM.RGBA,internalFormat:iM.RGBA,wrapS:iM.MIRRORED_REPEAT,wrapT:iM.MIRRORED_REPEAT,minFilter:iM.NEAREST,magFilter:iM.NEAREST};function i8(e){return i4.create(e,iD({id:it.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},i6))}function i9(e){return i4.create(e,iD({id:it.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},i6))}var i7=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){ej.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){ej.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){ej.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 rt(e){var i=new i7(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?iM.TEXTURE_CUBE_MAP:iM.TEXTURE_2D,internalFormat:u,format:h,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,a))+1))}}var re=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return ef(function(){var i,r;return eg(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]}})})()},i.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===iM.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:eH(a)&&a.length>0}if(i===t.TextureSourceType.mipmaps){var o=e.bin,s=e.mipmaps,u=e.target,h=e.maps,c=e.urls;return o?s.length>0:u===iM.TEXTURE_CUBE_MAP?h.every(function(t){return"object"==typeof t&&t}):c.every(function(t){return eH(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return ef(function(){var n,a,o,s,u,h,c,l,f,d,p,m,v,y,g,x,b,T;return eg(this,function(E){switch(E.label){case 0:if(n=e.type,a=e.target,o=e.map,s=e.url,u=e.bin,h=e.mipmaps,c=e.urls,l=e.maps,!(a===iM.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(o)];case 1:return f=E.sent(),[2,iD({},i,{cube:f,target:iM.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iD({},o),target:iM.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,iX(s)];case 3:return d=E.sent(),[2,iD({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:iM.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,iq(s)];case 5:return p=E.sent(),[2,iD({},i,{video:p,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,iW(s)];case 7:return m=E.sent(),[2,iD({},rt(m),i,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(n!==t.TextureSourceType.mipmaps)return[3,17];if(!u)return[3,13];return[4,iW(u)];case 9:if(v=E.sent(),g=(y=null!=a?a:iM.TEXTURE_2D)===iM.TEXTURE_2D?h.slice():h.map(function(t){return t.slice()}),a!==iM.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(h.map(function(t){return r.loadMipmapImages(t,v)}))];case 10:return x=E.sent(),[3,12];case 11:x=r.loadMipmapImages(h,v),E.label=12;case 12:return[2,iD({},i,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(a===iM.TEXTURE_2D||!a))return[3,15];return[4,Promise.all(c.map(function(t){return iX(t)}))];case 14:return b=E.sent(),[2,iD({},i,{mipmaps:b,target:iM.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:c.slice(),target:iM.TEXTURE_2D}})];case 15:if(a!==iM.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(l.map(function(t){return r.loadCubeMap(t)}))];case 16:return T=E.sent(),[2,iD({},i,{mipmaps:T,target:iM.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:l.map(function(t){return iD({},t)}),target:iM.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return ef(function(){return eg(this,function(i){return[2,Promise.all(t.map(function(t){return iX(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return ef(function(){return eg(this,function(e){return[2,Promise.all(t.map(function(t){return iX(t)}))]})})()},e}(),ri=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 rr(t){return"object"==typeof t&&t&&void 0===t.length&&em(t,i4)}t.MaterialRenderType=void 0,(q=t.MaterialRenderType||(t.MaterialRenderType={}))[q.normal=0]="normal",q[q.transformFeedback=1]="transformFeedback";var rn=1,ra=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"+rn++: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=iD({},u)}else r.name="Material"+rn++,r.renderType=0;return r}e7(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},ir(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}(il),ro=function(){function e(e){this.engine=e,this.maskable=null,this.stencilClearAction={stencilAction:t.TextureLoadAction.clear}}var i=e.prototype;return i.getRefValue=function(){return 1},i.getMaskMode=function(e){var i=t.MaskMode.NONE;if(e.mask){var r=e.mask,n=r.mask,a=r.mode,o=void 0===a?t.MaskMode.NONE:a,s=r.ref;void 0!==n&&n?i=t.MaskMode.MASK:(o===tE.OBSCURED||o===tE.REVERSE_OBSCURED)&&(i=o===tE.OBSCURED?t.MaskMode.OBSCURED:t.MaskMode.REVERSE_OBSCURED,s&&(this.maskable=s))}return i},i.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},e}();t.ShaderCompileResultStatus=void 0,(Q=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[Q.noShader=0]="noShader",Q[Q.success=1]="success",Q[Q.fail=2]="fail",Q[Q.compiling=3]="compiling",t.GLSLVersion=void 0,(K=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",K.GLSL3="300 es";var rs=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return e7(e,t),e}(il);t.Shader=function(t){function e(){return t.apply(this,arguments)}e7(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=ep(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(il),t.Shader=ey([iu(t0.Shader)],t.Shader);var ru="effects-internal-copy",rh="effects-internal-copy-mesh",rc="\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}",rl="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 rf(e,i){return{name:ru,vertex:rc,fragment:rl,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:rh+ +i}}var rd={format:iM.RGBA,type:iM.UNSIGNED_BYTE,minFilter:iM.LINEAR,magFilter:iM.LINEAR,wrapS:iM.CLAMP_TO_EDGE,wrapT:iM.CLAMP_TO_EDGE},rp=Symbol("dispose"),rm=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(rd).forEach(function(t){var i,r=null!=(i=e[t])?i:rd[t];o[t]=r,s.push(t,r)});var u=s.join(":"),h=this.textureCache[u];if(h)this.textureRef[u]++;else{var c=this.engine;eU(c),h=i4.create(c,o),this.textureCache[u]=h,this.textureRef[u]=1,h[rp]=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[rp](),i.dispose=i[rp]),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[rp](),i.dispose=i[rp]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),rv=function(){function t(t){void 0===t&&(t={}),this.semantics=iD({},t)}var e=t.prototype;return e.toObject=function(){return iD({},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 eY(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}(),ry=((t6={})[iM.FLOAT]=Float32Array.BYTES_PER_ELEMENT,t6[iM.INT]=Int32Array.BYTES_PER_ELEMENT,t6[iM.SHORT]=Int16Array.BYTES_PER_ELEMENT,t6[iM.BYTE]=Int8Array.BYTES_PER_ELEMENT,t6),rg=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="",e.subMeshes=[],e}e7(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(il);function rx(t){return t===iM.INT?new Int32Array(0):t===iM.SHORT?new Int16Array(0):new Float32Array(0)}(J=t8||(t8={}))[J.XYZ=0]="XYZ",J[J.XZY=1]="XZY",J[J.YXZ=2]="YXZ",J[J.YZX=3]="YZX",J[J.ZXY=4]="ZXY",J[J.ZYX=5]="ZYX";var rb=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],c=i[6],l=i[10];switch(e){case t8.XYZ:this.y=Math.asin(ib(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(c,s),this.z=0);break;case t8.YXZ:this.x=Math.asin(-ib(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(a,l),this.z=Math.atan2(o,s)):(this.y=Math.atan2(-h,r),this.z=0);break;case t8.ZXY:this.x=Math.asin(ib(c,-1,1)),.9999999>Math.abs(c)?(this.y=Math.atan2(-h,l),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(o,r));break;case t8.ZYX:this.y=Math.asin(-ib(h,-1,1)),.9999999>Math.abs(h)?(this.x=Math.atan2(c,l),this.z=Math.atan2(o,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case t8.YZX:this.z=Math.asin(ib(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,l));break;case t8.XZY:this.z=Math.asin(-ib(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(c,s),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=iy,this.y*=iy,this.z*=iy,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 iS;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*iv*.5),o=Math.cos(i*iv*.5),s=Math.cos(r*iv*.5),u=Math.sin(e*iv*.5),h=Math.sin(i*iv*.5),c=Math.sin(r*iv*.5);switch(n){case t8.XYZ:t.set(u*o*s+a*h*c,a*h*s-u*o*c,a*o*c+u*h*s,a*o*s-u*h*c);break;case t8.YXZ:t.set(u*o*s+a*h*c,a*h*s-u*o*c,a*o*c-u*h*s,a*o*s+u*h*c);break;case t8.ZXY:t.set(u*o*s-a*h*c,a*h*s+u*o*c,a*o*c+u*h*s,a*o*s-u*h*c);break;case t8.ZYX:t.set(u*o*s-a*h*c,a*h*s+u*o*c,a*o*c-u*h*s,a*o*s+u*h*c);break;case t8.YZX:t.set(u*o*s+a*h*c,a*h*s+u*o*c,a*o*c-u*h*s,a*o*s-u*h*c);break;case t8.XZY:t.set(u*o*s-a*h*c,a*h*s-u*o*c,a*o*c+u*h*s,a*o*s+u*h*c);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*iv),s=Math.sin(i*iv),u=Math.cos(r*iv),h=Math.sin(r*iv),c=Math.cos(n*iv),l=Math.sin(n*iv);if(a===t8.XYZ){var f=o*c,d=o*l,p=s*c,m=s*l;e[0]=u*c,e[4]=-u*l,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===t8.YXZ){var v=u*c,y=u*l,g=h*c,x=h*l;e[0]=v+x*s,e[4]=g*s-y,e[8]=o*h,e[1]=o*l,e[5]=o*c,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=o*u}else if(a===t8.ZXY){var b=u*c,T=u*l,E=h*c,_=h*l;e[0]=b-_*s,e[4]=-o*l,e[8]=E+T*s,e[1]=T+E*s,e[5]=o*c,e[9]=_-b*s,e[2]=-o*h,e[6]=s,e[10]=o*u}else if(a===t8.ZYX){var C=o*c,A=o*l,S=s*c,w=s*l;e[0]=u*c,e[4]=S*h-A,e[8]=C*h+w,e[1]=u*l,e[5]=w*h+C,e[9]=A*h-S,e[2]=-h,e[6]=s*u,e[10]=o*u}else if(a===t8.YZX){var O=o*u,M=o*h,R=s*u,I=s*h;e[0]=u*c,e[4]=I-O*l,e[8]=R*l+M,e[1]=l,e[5]=o*c,e[9]=-s*c,e[2]=-h*c,e[6]=M*l+R,e[10]=O-I*l}else if(a===t8.XZY){var P=o*u,L=o*h,V=s*u,F=s*h;e[0]=u*c,e[4]=-l,e[8]=h*c,e[1]=P*l+F,e[5]=o*c,e[9]=L*l-V,e[2]=V*l-L,e[6]=s*c,e[10]=F*l+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}();rb.DEFAULT_ORDER=t8.ZYX,rb.tempQuat0=new iS,rb.tempMat0=new iw;var rT=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,c=e*s,l=i*o,f=i*s,d=r*s,p=n*a,m=n*o,v=n*s,y=this.elements;return y[0]=1-(l+d),y[1]=h+v,y[2]=c-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=c+m,y[7]=f-p,y[8]=1-(u+l),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],c=i[7],l=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+c*b,n[4]=u*m+h*g+c*T,n[7]=u*v+h*x+c*E,n[2]=l*p+f*y+d*b,n[5]=l*m+f*g+d*T,n[8]=l*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],c=h*a-u*o,l=u*r-h*i,f=o*i-a*r,d=e*c+n*l+s*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=c*p,t[1]=(s*o-h*n)*p,t[2]=(u*n-s*a)*p,t[3]=l*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(!ig(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}(),rE=function(){function t(t,e){void 0===t&&(t=iE.ZERO),void 0===e&&(e=iE.X),this.origin=new iE,this.direction=new iE,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 iE;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,c=u.y,l=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,A=1/p,S=1/m;if(C>=0?(i=(y-h)*C,r=(T-h)*C):(i=(T-h)*C,r=(y-h)*C),A>=0?(n=(g-c)*A,a=(E-c)*A):(n=(E-c)*A,a=(g-c)*A),!(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),S>=0?(o=(x-l)*S,s=(_-l)*S):(o=(_-l)*S,s=(x-l)*S),!(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 iE).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,c=a+u;if(!(c<0))return h>=0?this.at(h,i):this.at(c,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),c=t.tempVec2.subtractVectors(this.origin,a),l=t.tempVec3.crossVectors(u,h),f=this.direction.dot(l);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(c,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(c);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*c.dot(l);if(!(m<0))return this.at(m/f,i)}}},t}();rE.tempVec0=new iE,rE.tempVec1=new iE,rE.tempVec2=new iE,rE.tempVec3=new iE;var r_=function(){function t(t,e){void 0===t&&(t=new iE(1/0,1/0,1/0)),void 0===e&&(e=new iE(-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],c=t[s+1],l=t[s+2];h<e&&(e=h),c<i&&(i=c),l<r&&(r=l),h>n&&(n=h),c>a&&(a=c),l>o&&(o=l)}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 iE),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 iE),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 iE),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 iE;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 iE),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 iE),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 iE),this.isEmpty())return[];var i=[];return i[0]=new iE(this.min.x,this.min.y,this.min.z),i[1]=new iE(this.min.x,this.min.y,this.max.z),i[2]=new iE(this.min.x,this.max.y,this.min.z),i[3]=new iE(this.min.x,this.max.y,this.max.z),i[4]=new iE(this.max.x,this.min.y,this.min.z),i[5]=new iE(this.max.x,this.min.y,this.max.z),i[6]=new iE(this.max.x,this.max.y,this.min.z),i[7]=new iE(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 iE;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}(),rC=function(){function t(t,e){void 0===t&&(t=iE.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 r_().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 iE),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 r_),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 iE().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 iE,i=new iE;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 iE().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}(),rA=Object.freeze({__proto__:null,get EulerOrder(){return t8},Euler:rb,Quaternion:iS,Vector2:iT,Vector3:iE,Vector4:i_,Matrix3:rT,Matrix4:iw,Ray:rE,PI2:2*Math.PI,DEG2RAD:iv,RAD2DEG:iy,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:ig,damp:function(t,e,i,r){return ix(t,e,1-Math.exp(-i*r))},lerp:ix,degToRad:function(t){return t*iv},radToDeg:function(t){return t*iy},clamp:ib,Color:iA,Box3:r_,Sphere:rC}),rS=1,rw=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?iw.fromIdentity():u;r.id="Mesh"+rS++,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"+rS++,r.name="<unnamed>",r.worldMatrix=iw.fromIdentity(),r._priority=0;return r}e7(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)}},ir(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(im);t.RenderPassAttachmentStorageType=void 0,($=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[$.none=0]="none",$[$.color=1]="color",$[$.stencil_8_opaque=2]="stencil_8_opaque",$[$.depth_16_opaque=3]="depth_16_opaque",$[$.depth_stencil_opaque=4]="depth_stencil_opaque",$[$.depth_16_texture=5]="depth_16_texture",$[$.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(tt=t.TextureStoreAction||(t.TextureStoreAction={}))[tt.store=0]="store",tt[tt.clear=2]="clear";var rO=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(em(r,i4))this.texture=r,this.externalTexture=!0;else if(r){var a=r.wrapT,o=r.wrapS,s=r.minFilter,u=r.magFilter,h=r.internalFormat,c=r.format,l=void 0===c?iM.RGBA:c,f=r.type,d=void 0===f?iM.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:l,type:d,internalFormat:h||l,wrapT:a,wrapS:o,minFilter:s,magFilter:u,name:i.name},this.texture=i4.create(e,iD({},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)},ir(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,(te=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[te.force=0]="force",te[te.keep=1]="keep",te[te.keepExternal=2]="keepExternal",te[te.destroy=0]="destroy";var rM=1,rR=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+rM++:r,a=i.clearAction,o=i.semantics,s=i.depthStencilAttachment,u=i.storeAction,h=i.priority,c=i.meshOrder,l=void 0===c?t.OrderType.ascending:c,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===h?0:h,this.meshOrder=l,this.meshes=ek((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=iD({},a),this.storeAction=iD({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new rv(o),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){eN(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){eC(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),ek(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 rO(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 rO(i.renderer.engine,iD({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=h;var c=r4.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);c.bind(),c.unbind(),this.framebuffer=c}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=eK}},ir(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}(),rI="precision highp float;attribute vec2 atlasOffset;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(atlasOffset.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}",rP="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;}",rL="#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",rV="#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}}",rF="#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}",rD="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",rk="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);}",rN="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);}",rz="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);}",rU="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);}",rB="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);}",rG={},rj=function(){function e(){}return e.registerInclude=function(t,e){rG[t]&&ej.warn('The "'+t+'" shader include already exist.'),rG[t]=e},e.unRegisterInclude=function(t){delete rG[t]},e.unRegisterAllIncludes=function(){Object.keys(rG).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),c=e.parseIncludes(a),l=e.isVersion300(c);return(c=e.removeWebGLVersion(c),2!==r||l||(c=e.convertTo300(c,n===t.ShaderType.fragment)),s)?u+c:h+u+c},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=rG[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}(),rX=function(e){function i(i,r){var n,a=(n=e.call(this,i,r)||this).renderer.engine,o=rg.create(a,{mode:iM.TRIANGLE_STRIP,attributes:{aPos:{type:iM.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=ra.create(a,{shader:{vertex:rD,fragment:rB,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=rw.create(a,{geometry:o,material:s,priority:0}),n.priority=5e3,n}e7(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}(rR),rH=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=rg.create(o,{name:s,mode:iM.TRIANGLE_STRIP,attributes:{aPos:{type:iM.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),h={vertex:rD,fragment:"H"==r?rN:rz,glslVersion:t.GLSLVersion.GLSL1},c=ra.create(o,{name:s,shader:h});return c.blending=!1,c.depthTest=!1,c.culling=!1,a.screenMesh=rw.create(o,{name:s,geometry:u,material:c,priority:0}),a.priority=5e3,a}e7(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",rK(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(rR),rW=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",a=r.renderer.engine,o=rg.create(a,{name:n,mode:iM.TRIANGLE_STRIP,attributes:{aPos:{type:iM.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=ra.create(a,{name:n,shader:{vertex:rD,fragment:rU}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=rw.create(a,{name:n,geometry:o,material:s,priority:0}),r.priority=5e3,r}e7(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",rK(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(rR),rY=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,a="PostProcess",o=n.renderer.engine;n.sceneTextureHandle=r||new rO(o);var s=rg.create(o,{name:a,mode:iM.TRIANGLE_STRIP,attributes:{aPos:{type:iM.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=ra.create(o,{name:a,shader:{vertex:rD,fragment:rk,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=rw.create(o,{name:a,geometry:s,material:u,priority:0}),n.priority=5e3,n}e7(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=iD({threshold:0,intensity:0,active:!1},null==i?void 0:i.bloom),n=iD({intensity:0,smoothness:0,roundness:0,active:!1},null==i?void 0:i.vignette),a=iD({brightness:0,saturation:0,contrast:0,active:!1},null==i?void 0:i.colorAdjustments),o=iD({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 iT(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new iE(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(o.active)),e.renderMeshes([this.screenMesh])},i}(rR),rZ="_effects_default_",rq=1,rQ=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,c=void 0!==h&&h,l=e.clearAction,f=void 0===l?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:l,d=o.engine;u&&(this.globalVolume=u),this.globalUniforms=new r$;var p=[],m={};if(this.renderer=o,c){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw Error("Half float texture is not supported.");var v=iM.HALF_FLOAT;p=[{texture:{format:iM.RGBA,type:v,magFilter:iM.LINEAR,minFilter:iM.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}this.drawObjectPass=new rR(o,{name:rZ,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),c){var g=new rO(d),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=Array(7),T=iM.HALF_FLOAT,E=new rX(o,{name:"BloomThresholdPass",attachments:[{texture:{format:iM.RGBA,type:T,minFilter:iM.LINEAR,magFilter:iM.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new rO(d);var C=new rH(o,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:iM.RGBA,type:T,minFilter:iM.LINEAR,magFilter:iM.LINEAR}}]}),A=new rH(o,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:iM.RGBA,type:T,minFilter:iM.LINEAR,magFilter:iM.LINEAR}}]});A.gaussianResult=b[_],this.addRenderPass(C),this.addRenderPass(A),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var S=0;S<6;S++){var w=new rW(o,{name:"GaussianUpPass"+S,viewport:x,attachments:[{texture:{format:iM.RGBA,type:T,minFilter:iM.LINEAR,magFilter:iM.LINEAR}}]});w.gaussianDownSampleResult=b[5-S],this.addRenderPass(w),x[2]*=2,x[3]*=2}var O=new rY(o,g);this.addRenderPass(O)}this.semantics=new rv(e.semantics),this.clearAction=f,this.name="RenderFrame"+rq++;var M=y[0];this.emptyTexture=i8(d),this.transparentTexture=i9(d),this.camera=n,this.keepColorBuffer=a,this.renderPassInfoMap.set(M,{listStart:0,listEnd:0,renderPass:M,intermedia:!1}),this.editorTransform=i_.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new rm(d);var R=d.gpuCapability,I=R.detail,P=rf(R.level,I.readableDepthStencilTextures&&I.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],c=null==(s=h.attachments[0])?void 0:s.texture;if(c&&o===c){var l=c===r?n:r;h.resetColorAttachments([l])}(c=null==(u=h.attachments[0])?void 0:u.texture)&&(o=c)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(rZ)&&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===iM.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?iM.LINEAR:iM.NEAREST,h=i4.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iM.RGBA,name:"frame_a",minFilter:u,magFilter:u}),c=i4.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iM.RGBA,data:{width:o,height:s},minFilter:u,magFilter:u,name:"frame_b"}),l=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new rR(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:h}]}).initialize(this.renderer),d=new rJ(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:c,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=rg.create(i,{name:ru,mode:iM.TRIANGLE_STRIP,attributes:{aPos:{type:iM.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=rf(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var a=ra.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:ru,shader:n});return a.blending=!1,a.depthTest=!1,a.culling=!1,(null==t?void 0:t.blend)&&(a.blending=!0,a.blendFunction=[iM.SRC_ALPHA,iM.ONE_MINUS_SRC_ALPHA,iM.SRC_ALPHA,iM.ONE_MINUS_SRC_ALPHA]),rw.create(i,{name:ru,geometry:r,material:a,priority:0})},i.removeRenderPass=function(t){eC(this._renderPasses,t)},ir(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function rK(t){return t?new iT(t.getWidth(),t.getHeight()):new iT}var rJ=function(t){function e(){return t.apply(this,arguments)}e7(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",rK(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(rR),r$=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},r0=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 ir(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),r1="function"==typeof WebGL2RenderingContext,r2=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=r1&&em(t,WebGL2RenderingContext)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),o=!!t.getExtension("OES_texture_half_float_linear"),s=!!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"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),r&&!o&&(o=r3(t,t.HALF_FLOAT)),r&&!s&&(s=r3(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=r||t.getExtension("OES_texture_float")?t.FLOAT:0,h=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,c={floatTexture:u,halfFloatTexture:h,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"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>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:o,floatLinear:s,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||!!a,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 r3(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,(ti=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[ti.NONE=0]="NONE",ti[ti.PVRTC=1]="PVRTC",ti[ti.ASTC=2]="ASTC",t.FilterMode=void 0,(tr=t.FilterMode||(t.FilterMode={}))[tr.Nearest=0]="Nearest",tr[tr.Linear=1]="Linear",t.RenderTextureFormat=void 0,(tn=t.RenderTextureFormat||(t.RenderTextureFormat={}))[tn.RGBA32=0]="RGBA32",tn[tn.RGBAHalf=1]="RGBAHalf";var r4=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){},ir(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),r5=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}(),r6=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=r8(this.arc,this.arcMode,t)*iv,i=new iE(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*iv),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eQ(0,1)),direction:n.normalize()}},t}();function r8(t,e,i){if(e===tk.RANDOM)t=eQ(0,t);else if(e===tk.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tk.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===tk.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var r9=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=r8(this.arc,this.arcMode,t)*iv,i=new iE(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),r7=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eQ(-this._d,this._d),i=eQ(-this._h,this._h);return{direction:new iE(0,0,1),position:new iE(e,i,0)}},t}(),nt=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=r8(this.arc,this.arcMode,t)*iv,i=new iE(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),o=Math.tan(e),s=new iE;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}(),ne=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tk.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eQ(0,1);return{direction:new iE(0,1,0),position:new iE(this._d*(e-.5),0,0)}},t}(),ni=new iw,nr=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=eQ(0,2*Math.PI),n=r8(this.arc,this.arcMode,t)*iv,a=ni.setFromRotationZ(n),o=new iE(Math.cos(r),Math.sin(r),0),s=new iE(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(o),position:a.transformPoint(s)}},t}(),nn=new iw,na=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 eQ(-90,90)},e.generate=function(t){var e=r8(this.arc,this.arcMode,t)*iv,i=this.getHorizontalAngle()*iv,r=this.radius,n=new iE(Math.cos(i),0,Math.sin(i)),a=nn.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),no=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.getHorizontalAngle=function(){return eQ(0,90)},e}(na),ns=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=ib(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(r8(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 iE(r,n,0);return{position:new iE(r*this.width,n*this.height,0),direction:a.normalize()}},t}(),nu=function(){function t(){}return t.prototype.generate=function(){return{position:new iE,direction:new iE}},t}(),nh=((t9={})[t_.NONE]=nu,t9[t_.CONE]=r6,t9[t_.SPHERE]=na,t9[t_.HEMISPHERE]=no,t9[t_.CIRCLE]=r9,t9[t_.DONUT]=nr,t9[t_.RECTANGLE]=r7,t9[t_.EDGE]=ne,t9[t_.RECTANGLE_EDGE]=nt,t9[t_.TEXTURE]=ns,t9);function nc(t){if(!t)return new nu;var e=iD({radius:1,arc:360,angle:0,arcMode:tk.RANDOM},t),i=t.type,r=nh[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==t_.NONE){var a=t.alignSpeedDirection,o=t.upDirection;n.alignSpeedDirection=a,n.upDirection=iE.fromArray(void 0===o?[0,0,1]:o).normalize()}return n}function nl(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=n_(a,t[a],t[a+1],o);else for(a=i-r;a>=e;a-=r)o=n_(a,t[a],t[a+1],o);return o&&ny(o,o.next)&&(nC(o),o=o.next),o}function nf(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(ny(r,r.next)||0===nv(r.prev,r,r.next))){if(nC(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function nd(t,e){return t.x-e.x}function np(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 nm(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 nv(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ny(t,e){return t.x===e.x&&t.y===e.y}function ng(t,e,i,r){var n=nb(nv(t,e,i)),a=nb(nv(t,e,r)),o=nb(nv(i,r,t)),s=nb(nv(i,r,e));return!!(n!==a&&o!==s||0===n&&nx(t,i,e)||0===a&&nx(t,r,e)||0===o&&nx(i,t,r)||0===s&&nx(i,e,r))}function nx(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 nb(t){return t>0?1:t<0?-1:0}function nT(t,e){return 0>nv(t.prev,t,t.next)?nv(t,e,t.next)>=0&&nv(t,t.prev,e)>=0:0>nv(t,e,t.prev)||0>nv(t,t.next,e)}function nE(t,e){var i=new nA(t.i,t.x,t.y),r=new nA(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 n_(t,e,i,r){var n=new nA(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 nC(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 nA(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 nS=0;function nw(t,e,i,r){i=i||2,nS=r||0;var n,a,o,s,u,h,c,l=e&&e.length,f=l?e[0]*i:t.length,d=nl(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(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=nl(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(nd),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 c,l=n,f=n.x,d=n.y,p=1/0;a=n;do o>=a.x&&a.x>=f&&o!==a.x&&nm(s<d?o:u,s,f,d,s<d?u:o,s,a.x,a.y)&&(c=Math.abs(s-a.y)/(o-a.x),nT(a,t)&&(c<p||c===p&&(a.x>n.x||a.x===n.x&&(i=n,r=a,0>nv(i.prev,i,r.prev)&&0>nv(r.next,i,i.next))))&&(n=a,p=c)),a=a.next;while(a!==l);return n}(t,e)){var i=nE(e,t);nf(e,e.next),nf(i,i.next)}})(h[n],i),i=nf(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);c=0!==(c=Math.max(o-n,s-a))?1/c: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=np(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,c=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(nv(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,c=np(o,s,e,i,r),l=np(u,h,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=c&&d&&d.z<=l;){if(f!==t.prev&&f!==t.next&&nm(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&nv(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&nm(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&nv(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&nm(n.x,n.y,t.x,t.y,a.x,a.y,f.x,f.y)&&nv(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&nm(n.x,n.y,t.x,t.y,a.x,a.y,d.x,d.y)&&nv(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(nv(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(nm(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&nv(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+nS),i.push(e.i/r+nS),i.push(h.i/r+nS),nC(e),e=h.next,c=h.next;continue}if((e=h)===c){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!ny(n,a)&&ng(n,r,r.next,a)&&nT(n,a)&&nT(a,n)&&(e.push(n.i/i+nS),e.push(r.i/i+nS),e.push(a.i/i+nS),nC(r),nC(r.next),r=t=a),r=r.next}while(r!==t);return nf(r)}(nf(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,c=s.next.next;c!==s.prev;){if(s.i!==c.i&&(u=s,h=c,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&&ng(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,h)&&(nT(u,h)&&nT(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)&&(nv(u.prev,u,h.prev)||nv(u,h.prev,h))||ny(u,h)&&nv(u.prev,u,u.next)>0&&nv(h.prev,h,h.next)>0))){var l=nE(s,c);s=nf(s,s.next),l=nf(l,l.next),t(s,i,r,n,a,o),t(l,i,r,n,a,o);return}c=c.next}s=s.next}while(s!==e)}(e,i,r,n,a,o):t(nf(e),i,r,n,a,o,1);break}}}}(d,p,i,n,a,c),p}var nO="editor",nM={"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 nR(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 c,l=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=(c=d[4])?d[3]:d[2],g=c?d[2]:d[3]);for(var x=[0,0],b=0===c?0:-Math.PI/2,T=0;T<o.length;T++)for(var E=o[T],_=s[T],C=s[T+1]||s[0],A=[0,0],S=0;S<E.length-1;S++)(function(t,e,i,r,n,a,o,s){var u=1-e,h=u*u*u,c=3*e*u*u,l=3*e*e*u,f=e*e*e;t[0]=h*i[0]+c*n+l*o+f*r[0],t[1]=h*i[1]+c*a+l*s+f*r[1]})(A,E[S],_,C,_[4],_[5],C[2],C[3]),i=A[0],r=A[1],l[p++]=i/2,l[p++]=r/2,d?(x[0]=i,x[1]=r,nP(x,x,b),l[p++]=m+(x[0]+1)/2*y,l[p++]=v+(x[1]+1)/2*g):(l[p++]=(i+1)/2,l[p++]=(r+1)/2),p+=2;var w=nw(Array.from(l),null,6,void 0===f?0:f);return{aPoint:l,index:new Uint16Array(w)}}function nI(t,e){for(var i,r=[],n=(i=[],("gs"in t)?t.gs.forEach(function(t){i.push({p:[tL.SHAPE_POINTS,t.p],s:[tL.SHAPE_SPLITS,t.s]})}):("g"in t)?i.push({p:[tL.SHAPE_POINTS,t.g.p],s:[tL.SHAPE_SPLITS,t.g.s]}):i.push(t),i),a=0,o=0,s=0,u=0;u<n.length;u++){var h=nR(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 c=new Float32Array(o),l=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];c.set(m.aPoint,d),d+=m.aPoint.length,l.set(m.index,p),p+=m.index.length}return{aPoint:c,index:l}}function nP(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 nL=function(e){function i(i){(r=e.call(this,i)||this).color=new iA(1,1,1,1),r.visible=!0,r.meshCollider=new aM,r.getHitTestParams=function(t){var e=iw.fromScale(r.transform.size.x,r.transform.size.y,1).premultiply(r.transform.getWorldMatrix()),i=r.interaction;if(t||i){r.meshCollider.setGeometry(r.geometry,e);var n,a=r.meshCollider.getBoundingBoxData();if(a)return{behavior:(null==(n=r.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:r.renderer.side===tT.FRONT}}},r.renderer={renderMode:tO.MESH,blending:tb.ALPHA,texture:r.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:tT.DOUBLE,maskMode:t.MaskMode.NONE,mask:0,alphaMask:!1};var r,n=ra.create(r.engine,{shader:{fragment:rP,vertex:rI,shared:!0}});return r.material=n,r.material.setColor("_Color",new iA().setFromArray([1,1,1,1])),r.maskManager=new ro(i),r}e7(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){em(t,iA)?this.color.copyFrom(t):this.color.setFromArray(t),this.material.setColor("_Color",this.color)},r.setTexture=function(t){var e=this;return ef(function(){var i;return eg(this,function(r){switch(r.label){case 0:if("string"!=typeof t)return[3,2];return[4,i4.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]}})})()},r.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},r.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},r.getItemGeometryData=function(t){var e=this.renderer;if(!e.shape)return t.setAttributeData("aPos",new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])),{index:[0,1,2,2,1,3],atlasOffset:[0,1,0,0,1,1,1,0]};for(var i=e.shape,r=i.index,n=i.aPoint,a=void 0===n?[]:n,o=new Float32Array(a),s=[],u=[],h=0;h<o.length;h+=6)u.push(a[h+2],a[h+3]),s.push(o[h],o[h+1],0);return t.setAttributeData("aPos",new Float32Array(s)),{index:void 0===r?[]:r,atlasOffset:u}},r.createGeometry=function(){var t=rg.create(this.engine,{attributes:{aPos:{type:iM.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:iM.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:iM.TRIANGLES}),e=this.getItemGeometryData(t),i=e.index,r=e.atlasOffset;return t.setIndexData(new Uint16Array(i)),t.setAttributeData("atlasOffset",new Float32Array(r)),t.setDrawCount(i.length),t},r.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.maskMode,a=t.mask,o=t.texture,s=this.material;s.blending=!0,s.depthTest=!0,s.depthMask=i,s.stencilRef=void 0!==a?[a,a]:void 0,iL(s,r),iF(s,n),iV(s,e),s.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',s.setColor("_Color",new iA(0,0,0,1)),s.setVector4("_TexOffset",new i_(0,0,1,1)),s.setTexture("_MainTex",o),this.preMultiAlpha=iP(r);var u=new i_;return u.x=t.occlusion?+t.transparentOcclusion:1,u.y=+this.preMultiAlpha,u.z=t.renderMode,u.w=t.maskMode,s.setVector4("_TexParams",u),0===u.x||t.alphaMask?s.enableMacro("ALPHA_CLIP"):s.disableMacro("ALPHA_CLIP"),s},r.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===tO.BILLBOARD||this.renderer.renderMode===tO.VERTICAL_BILLBOARD||this.renderer.renderMode===tO.HORIZONTAL_BILLBOARD)&&i.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,i,e)}},r.fromData=function(i){e.prototype.fromData.call(this,i);var r,n,a,o,s,u=null!=(r=i.renderer)?r:{},h=i.mask;h&&h.ref&&(h.ref=this.engine.findObject(h.ref));var c=this.maskManager.getMaskMode(i),l=u.shape,f=i.splits&&!i.textureSheetAnimation?i.splits[0]:void 0,d=void 0;null==l||"aPoint"in l&&"index"in l||(d=nI(l,f)),this.renderer={renderMode:null!=(n=u.renderMode)?n:tO.MESH,blending:null!=(a=u.blending)?a:tb.ALPHA,texture:u.texture?this.engine.findObject(u.texture):this.engine.emptyTexture,occlusion:!!u.occlusion,transparentOcclusion:!!u.transparentOcclusion||c===t.MaskMode.MASK,side:null!=(o=u.side)?o:tT.DOUBLE,mask:this.maskManager.getRefValue(),shape:d,maskMode:c,alphaMask:null!=(s=u.alphaMask)&&s},this.configureMaterial(this.renderer)},i}(im);t.ShapeComponent=function(e){function i(i){(r=e.call(this,i)||this).hasStroke=!1,r.hasFill=!1,r.shapeDirty=!0,r.graphicsPath=new st,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=rg.create(i,{attributes:{aPos:{type:iM.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{type:iM.FLOAT,size:2,data:new Float32Array}},mode:iM.TRIANGLES,drawCount:4}),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=ra.create(i,n),o=ra.create(i,n);return a.color=new iA(1,1,1,1),a.depthMask=!1,a.depthTest=!0,a.blending=!0,r.material=a,o.color=new iA(.25,.25,.25,1),o.depthMask=!1,o.depthTest=!0,o.blending=!0,r.materials[1]=o,r.strokeAttributes={width:1,alignment:.5,cap:tQ.Butt,join:tK.Miter,miterLimit:10,color:new iA(1,1,1,1)},r.fillAttribute={color:new iA(1,1,1,1)},r.shapeAttribute={type:tq.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},r}e7(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 n,a=ep(e);!(n=a()).done;){var o=n.value.shape,s=[],u=r.length,h=i.length/2;o.build(s),o.triangulate(s,i,h,r,u)}var c=r.length;if(this.hasStroke)for(var l,f=ep(e);!(l=f()).done;){var d=l.value.shape,p=[];r.length;var m=i.length/2,v=this.strokeAttributes,y=!0;this.shapeAttribute.type===tq.Custom&&(y=d.closePath),d.build(p),oJ(p,v,!1,y,i,2,m,r)}var g=r.length-c,x=i.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<r.length)&&(E=new Uint16Array(r.length));for(var _=0;_<x;_++){var C=3*_,A=2*_,S=2*_;b[C]=i[A],b[C+1]=i[A+1],b[C+2]=0,T[S]=b[C],T[S+1]=b[C+1]}E.set(r),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(r.length);var w=this.geometry.subMeshes[0],O=this.geometry.subMeshes[1];w.indexCount=c,O.offset=2*c,O.indexCount=g},r.buildPath=function(e){switch(this.graphicsPath.clear(),e.type){case tq.Custom:for(var i,r=this.shapeAttribute,n=r.points,a=r.easingIns,o=r.easingOuts,s=ep(r.shapes);!(i=s()).done;){var u=i.value,h=u.indexes,c=n[h[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var l=1;l<h.length;l++){var f=h[l],d=h[l-1],p=n[f.point],m=n[d.point],v=o[d.easingOut],y=a[f.easingIn];this.graphicsPath.bezierCurveTo(v.x+m.x,v.y+m.y,y.x+p.x,y.y+p.y,p.x,p.y,1)}if(u.close){var g=h[0],x=h[h.length-1],b=n[g.point],T=n[x.point],E=o[x.easingOut],_=a[g.easingIn];this.graphicsPath.bezierCurveTo(E.x+T.x,E.y+T.y,_.x+b.x,_.y+b.y,b.x,b.y,1),this.graphicsPath.closePath()}}break;case tq.Ellipse:this.graphicsPath.ellipse(0,0,e.xRadius,e.yRadius);break;case tq.Rectangle:this.graphicsPath.rect(-e.width/2,-e.height/2,e.width,e.height,e.roundness);break;case tq.Star:this.graphicsPath.polyStar(e.pointCount,e.outerRadius,e.innerRadius,e.outerRoundness,e.innerRoundness,t.StarType.Star);break;case tq.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 tq.Custom:for(var n,a={type:tq.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:t.fill},o=ep(t.points);!(n=o()).done;){var s=n.value;a.points.push(new iT(s.x,s.y))}for(var u,h=ep(t.easingIns);!(u=h()).done;){var c=u.value;a.easingIns.push(new iT(c.x,c.y))}for(var l,f=ep(t.easingOuts);!(l=f()).done;){var d=l.value;a.easingOuts.push(new iT(d.x,d.y))}a.shapes=t.shapes,this.shapeAttribute=a;break;case tq.Ellipse:var p={type:tq.Ellipse,xRadius:t.xRadius,yRadius:t.yRadius,fill:t.fill};this.shapeAttribute=p;break;case tq.Rectangle:var m={type:tq.Rectangle,width:t.width,height:t.height,roundness:t.roundness,fill:t.fill};this.shapeAttribute=m;break;case tq.Star:var v={type:tq.Star,pointCount:t.pointCount,innerRadius:t.innerRadius,outerRadius:t.outerRadius,innerRoundness:t.innerRoundness,outerRoundness:t.outerRoundness,fill:t.fill};this.shapeAttribute=v;break;case tq.Polygon:var y={type:tq.Polygon,pointCount:t.pointCount,radius:t.radius,roundness:t.roundness,fill:t.fill};this.shapeAttribute=y}var g=t.mask;g&&g.ref&&(g.ref=this.engine.findObject(g.ref));var x=this.maskManager.getMaskMode(t),b=this.maskManager.getRefValue();this.material.stencilRef=void 0!==b?[b,b]:void 0,iF(this.material,x)},ir(i,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),i}(nL),t.ShapeComponent=ey([iu("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}e7(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}(id),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"loop",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"amountOfMotion",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"animationLength",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"mode",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionX",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionY",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"startPositionZ",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionX",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionY",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"endPositionZ",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeX",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeY",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"amplitudeZ",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"phaseX",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"phaseY",void 0),ey([ic(void 0,void 0)],t.Fake3DComponent.prototype,"phaseZ",void 0),t.Fake3DComponent=ey([iu("Fake3DComponent")],t.Fake3DComponent),t.Fake3DAnimationMode=void 0,(ta=t.Fake3DAnimationMode||(t.Fake3DAnimationMode={}))[ta.Circular=0]="Circular",ta[ta.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}e7(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}(id),t.CameraController=ey([iu(t0.CameraController)],t.CameraController);var nV=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e}(e8);t.HitTestType=void 0,(to=t.HitTestType||(t.HitTestType={}))[to.triangle=1]="triangle",to[to.box=2]="box",to[to.sphere=3]="sphere",to[to.custom=4]="custom";var nF="click",nD="touchstart",nk="touchmove",nN="touchend",nz=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",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 ej.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 c=o.target,l=c.width,f=c.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:l,height:f,origin:t}};eL()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",h="touchend"),this.nativeHandlers=((a={})[s]=function(a){if(o.enabled){var s=n(a),u=nU(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},o.dispatchEvent(nD,c(a,t,e))}},a[u]=function(r){if(i&&o.enabled){var a=nU(n(r));t=a.x,e=a.y,o.dispatchEvent(nk,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=nU(a),u=Math.abs(i.clientX-a.clientX)+Math.abs(i.clientY-a.clientY);t=s.x,e=s.y,u<4&&o.dispatchEvent(nF,c(r,t,e)),o.dispatchEvent(nN,c(r,t,e,t-i.x,e-i.y))}i=0},a),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]=[]),e_(i,e),function(){eC(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&eC(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 nU(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 nB=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e}(e8),nG=(tu=new Int32Array((ts=new Float32Array(1)).buffer),function(t){ts[0]=t;var e=tu[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)}),nj=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]=nG(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=nG(t[i])},t}(),nX=new rb,nH=new iw;function nW(t,e,i,r,n,a,o){var s=r/n,u=r,h=e.speedOverLifetime;h&&(u=h.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(a),t.addScaledVector(o,u),t.addScaledVector(i,c);var l=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new iE;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});nX.setFromArray(v).negate(),nH.setFromEuler(nX);var y=nH.transformPoint(p);t.addVectors(d,y)}if(l.enabled){var g=l.asMovement,x=l.x,b=l.y,T=l.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 nY(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function nZ(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function nq(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 nQ=((t7={})[tM.PARTICLE_ORIGIN_CENTER]=[0,0],t7[tM.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t7[tM.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t7[tM.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t7[tM.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t7[tM.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t7[tM.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t7[tM.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t7[tM.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t7);function nK(t,e,i){var r=i.position,n=new iE(t,e,0),a=new iE;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new rE(r,a)}function nJ(t,e,i){var r=t.x,n=t.y,a=t.z,o=new iE(r-e,n+i,a),s=new iE(r-e,n-i,a),u=new iE(r+e,n-i,a),h=new iE(r+e,n+i,a);return[{p0:o,p1:s,p2:u},{p0:o.clone(),p1:u.clone(),p2:h}]}function n$(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function n0(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var n1={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 iT(e[r],e[n])},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===tV.LINE?0:i===tV.EASE_OUT?0:i===tV.EASE_IN?2:i===tV.EASE?2:i===tV.HOLD&&r===tV.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===tV.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tV.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tV.EASE,tV.EASE_IN,tV.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tV.EASE,tV.EASE_OUT,tV.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tV.HOLD&&[tV.HOLD,tV.LINE_OUT,tV.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tV.HOLD&&[tV.HOLD,tV.LINE,tV.EASE_IN].includes(i)}},n2=function(t,e){this.points=t,this.totalLength=e},n3={},n4={};function n5(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function n6(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var n8=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=n0(e.x-t.x,3)+"_"+n0(e.y-t.y,3)+"_"+n0(e.z-t.z,3)+"&"+(n0(i.x-t.x,3)+"_"+n0(i.y-t.y,3))+"_"+n0(i.z-t.z,3)+"&"+(n0(r.x-t.x,3)+"_"+n0(r.y-t.y,3))+"_"+n0(r.z-t.z,3);if(n4[n])return{data:n4[n],interval:t};for(var a=[],o=null,s=0,u=0,h=0;h<300;h+=1){var c=new iE,l=h/299;u=0,c.x=3*Math.pow(1-l,2)*l*(i.x-t.x)+3*(1-l)*Math.pow(l,2)*(r.x-t.x)+Math.pow(l,3)*(e.x-t.x),c.y=3*Math.pow(1-l,2)*l*(i.y-t.y)+3*(1-l)*Math.pow(l,2)*(r.y-t.y)+Math.pow(l,3)*(e.y-t.y),c.z=3*Math.pow(1-l,2)*l*(i.z-t.z)+3*(1-l)*Math.pow(l,2)*(r.z-t.z)+Math.pow(l,3)*(e.z-t.z),null!==o&&(u+=Math.pow(c.x-o.x,2)+Math.pow(c.y-o.y,2)+Math.pow(c.z-o.z,2)),o=c,s+=u=Math.sqrt(u),a[h]={partialLength:u,point:c}}var f=new n2(a,s);return n4[n]=f,{data:f,interval:new iE(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(n$(1-t,0))return e.points[299].point.clone().add(this.interval);if(n$(e.totalLength,0))return this.p1.clone();var i=new iE,r=n0(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(n$(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+=n0(e.points[a].partialLength,5)):s<0&&a>0?(n-=n0(e.points[a].partialLength,5),a+=s):o=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),n9=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new iS,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):n$(1-t,0)?this.temp.copyFrom(this.p2):(ae.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),n7=function(){function t(t,e,i,r){this.mX1=t,this.mY1=e,this.mX2=i,this.mY2=r,this.precomputed=!1,this.mSampleValues=Array(11)}var e=t.prototype;return e.precompute=function(){this.precomputed=!0,(this.mX1!==this.mY1||this.mX2!==this.mY2)&&this.calcSampleValues()},e.getValue=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:isNaN(this.mY1)||isNaN(this.mY2)?0:0===t||1===t?t:(this.precomputed||this.precompute(),n5(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=n5(.1*t,this.mX1,this.mX2)},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=n6(n,this.mX1,this.mX2);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=n6(e,i,r);if(0===a)break;var o=n5(e,i,r)-t;e-=o/a}return e}(t,n,this.mX1,this.mX2):0===a?n:function(t,e,i,r,n){var a,o,s=0;do(a=n5(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.mX1,this.mX2)},t}();function at(t,e){var i,r,n,a=function(t,e,i){var r=t[1],n=n1.isHoldOutKeyframe(t),a=n1.isHoldInKeyframe(e),o=!a&&n1.isRightSideEase(t),s=!n&&n1.isLeftSideEase(e);if(o&&!s&&!a){var u=new iT(r[r.length-4],r[r.length-3]),h=new iT(r[r.length-2],r[r.length-1]),c=n1.getPointInCurve(e),l=new iT(c.x,c.y),f=new iT(l.x-(l.x-u.x)/10,l.y);return{type:"ease",p0:u,p1:h,p2:f,p3:l}}if(!o&&s&&!n){var d=e[1],p=n1.getPointInCurve(t),m=new iT(p.x,p.y),v=new iT(d[0],d[1]),y=new iT(d[2],d[3]),g=new iT(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 iT(r[r.length-4],r[r.length-3]),p1:new iT(r[r.length-2],r[r.length-1]),p2:new iT(x[0],x[1]),p3:new iT(x[2],x[3])}}var b=n1.getPointInCurve(t),T=n1.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 iT((T.x-b.x)/3+b.x,(T.y-b.y)/3+b.y),_=new iT((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}}(t,e,!0),o=a.p0,s=a.p1,u=a.p2,h=a.p3;eU(u),eU(h);var c=h.x-o.x,l=h.y-o.y,f=n0((s.x-o.x)/c,5),d=n0((u.x-o.x)/c,5);n$(l,0)?i=r=NaN:(i=n0((s.y-o.y)/l,5),r=n0((u.y-o.y)/l,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 n3[p]?n=n3[p]:(n=new n7(f,i,d,r),n3[p]=n),{points:[o,s,u,h],timeInterval:c,valueInterval:l,curve:n}}var ae=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,c=i.z,l=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=c,t.w=l;return}if(s!==l||n!==u||a!==h||o!==c){var f=1-r,d=n*u+a*h+o*c+s*l,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+c*g,s=s*f+l*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}(),ai="not_implement",ar=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(ai)},e.getIntegrateValue=function(t,e,i){throw Error(ai)},e.getIntegrateByTime=function(t,e){throw Error(ai)},e.getValue=function(t){throw Error(ai)},e.getMaxTime=function(){throw Error(ai)},e.toUniform=function(t){throw Error(ai)},e.map=function(t){throw Error(ai)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(ai)},t.getAllData=function(t,e){for(var i=new(e?nj: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}(),an=function(t){function e(){return t.apply(this,arguments)}e7(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}(ar),aa=function(t){function e(){return t.apply(this,arguments)}e7(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}(ar),ao=function(t){function e(){return t.apply(this,arguments)}e7(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}(ar),as=function(t){function e(){return t.apply(this,arguments)}e7(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}(ar),au=function(t){function e(){return t.apply(this,arguments)}e7(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 av(e,0,this.xCoord,this.min,this.max)-av(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}(ar),ah=function(t){function e(){return t.apply(this,arguments)}e7(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=eO(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 eM(n.color,a.color,o,!0)}}return e[i].color.slice()},e}(ar),ac=function(t){function e(){return t.apply(this,arguments)}e7(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?av:am,o=0;o<n;o++){var s=i[o],u=i[o+1],h=s[0],c=u[0];if(t>h&&t<=c)return r+a(t,h,c,s[1],u[1]);r+=a(c,h,c,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}(ar),al=function(t){function e(){return t.apply(this,arguments)}e7(e,t);var i=e.prototype;return i.onCreate=function(t){this.curveMap={},this.keys=[];for(var e=0;e<t.length-1;e++){var i=at(t[e],t[e+1]),r=i.points,n=i.curve,a=i.timeInterval,o=i.valueInterval,s=r[0],u=r[r.length-1];this.keys.push([].concat(s.toArray(),r[1].toArray())),this.keys.push([].concat(u.toArray(),r[2].toArray())),this.curveMap[s.x+"&"+u.x]={points:r,timeInterval:a,valueInterval:o,curve:n,timeStart:Number(s.x),timeEnd:Number(u.x)}}this.startKeyframe=t[0],this.endKeyframe=t[t.length-1],this.keyTimeData=Object.keys(this.curveMap)},i.getValue=function(t){var e=0,i=this.keyTimeData,r=this.curveMap[i[0]].timeStart,n=this.curveMap[i[i.length-1]].timeEnd;if(t<=r)return n1.getPointIndexInCurve(this.startKeyframe,n1.pointIndexCache),this.startKeyframe[1][n1.pointIndexCache.yIndex];if(t>=n)return n1.getPointIndexInCurve(this.endKeyframe,n1.pointIndexCache),this.endKeyframe[1][n1.pointIndexCache.yIndex];for(var a=0;a<i.length;a++){var o=this.curveMap[i[a]].timeStart,s=this.curveMap[i[a]].timeEnd;if(t>=Number(o)&&t<Number(s)){e=this.getCurveValue(i[a],t);break}}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,c=r.y+a*i.curve.getValue(h);0===u||20===u?o+=c:u%2==1?o+=4*c:o+=2*c}return s/3*o},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,o=(e-r.x)/n,s=i.curve.getValue(o);return r.y+a*s},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(){var t=this.keyTimeData;return this.curveMap[t[t.length-1]].timeEnd},e}(ar),af=function(t){function e(){return t.apply(this,arguments)}e7(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}(ar),ad=function(t){function e(){return t.apply(this,arguments)}e7(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 iE(i[n][0],i[n][1],i[n][2]),u=new iE(i[n+1][0],i[n+1][1],i[n+1][2]),h=new iE(r[2*n][0],r[2*n][1],r[2*n][2]),c=new iE(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),l=at(a,o),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new n8(s,u,h,c);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=n0(t,5),i=0,r=new iE,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 c=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=c.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=n0((e-r.x)/n,4);return ib(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(ar),ap=function(t){function e(){return t.apply(this,arguments)}e7(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=iS.fromArray(i[n]),u=iS.fromArray(i[n+1]),h=iS.fromArray(r[2*n]),c=iS.fromArray(r[2*n+1]),l=at(a,o),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new n9(s,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=n0(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 c=this.curveSegments[r[o]].pathCurve;return e=this.getPercValue(r[o],i),c.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=n0((e-r.x)/n,4);return ib(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(ar);function am(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function av(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 ay(t,e){if(e){var i=e[0],r=e[1];if(i===tL.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===tL.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===tL.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 ag(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function ax(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ax=function(){return!!t})()}function ab(t,e,i){return(ab=ax()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&e9(n,i.prototype),n}).apply(null,arguments)}var aT=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new i_,e}e7(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=aC(t[0]),this.yCurve=aC(t[1]),this.zCurve=aC(t[2]),this.wCurve=aC(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},e}(ar),aE=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iT,e}e7(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=aC(t[0]),this.yCurve=aC(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},e}(ar),a_=((et={})[tL.RANDOM]=function(t){return em(t[0],Array)?new as(t):new ao(t)},et[tL.CONSTANT]=function(t){return new an(t)},et[tL.CONSTANT_VEC2]=function(t){return new an(t)},et[tL.CONSTANT_VEC3]=function(t){return new an(t)},et[tL.CONSTANT_VEC4]=function(t){return new an(t)},et[tL.RGBA_COLOR]=function(t){return new an(t)},et[tL.COLORS]=function(t){return new aa(t.map(function(t){return eS(t,!1)}))},et[tL.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new au([t[0][1],t[1][1]]):new ac(t)},et[tL.GRADIENT_COLOR]=function(t){return new ah(t)},et[tL.LINEAR_PATH]=function(t){return new af(t)},et[tL.BEZIER_CURVE]=function(t){return 1===t.length?new an(t[0][1][1]):new al(t)},et[tL.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new an(ab(iE,[].concat(t[1][0]))):new ad(t)},et[tL.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new an(ab(iS,[].concat(t[1][0]))):new ap(t)},et[tL.COLOR_CURVE]=function(t){return new aA(t)},et[tL.VECTOR4_CURVE]=function(t){return new aT(t)},et[tL.VECTOR2_CURVE]=function(t){return new aE(t)},et);function aC(t){if(!t||!isNaN(+t))return new an(t||0);if(em(t,ar))return t;if(eY(a_[t[0]]))return a_[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+nM["ValueType: 21/22 is not supported"]+".")}var aA=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.value=new iA,e}e7(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=aC(t[0]),this.gCurve=aC(t[1]),this.bCurve=aC(t[2]),this.aCurve=aC(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},e}(ar),aS=1,aw=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 iE,n=new iS,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)===nO]],n=aC(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=ra.create(this.engine,a);return o.blending=!0,o.depthTest=!1,o.setVector4("uPos",new i_(0,0,0,0)),o.setVector2("uSize",new iT(1,1)),o.setVector4("uColor",new i_(n[0]/255,n[1]/255,n[2]/255,n[3])),o.setQuaternion("uQuat",new iS(0,0,0,0)),o},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return rg.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:iM.LINES,maxVertex:4})},i.createMesh=function(t,e){return rw.create(this.engine,{name:"Interact_preview"+aS++,priority:0,worldMatrix:iw.fromIdentity(),geometry:t,material:e})},e}();function aO(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.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},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}e7(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.props.content.options,e=this.item.engine.renderer.env,i=this.item.composition,r=this.interactData.options,n=r.type,a=r.showPreview;if(n===tA.CLICK&&(this.clickable=!0,a&&e===nO)){var o=null==i?void 0:i.getRendererOptions();void 0!==o&&(this.previewContent=new aw(this.item.props.content,o,this.transform,this.engine))}t.type===tA.DRAG&&(e!==nO||t.enableInEditor)&&(null==i?void 0:i.event)&&this.beginDragTarget(t,i.event),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.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===tA.CLICK)this.clickable=!0;else if(t===tA.DRAG){var r,n=this.interactData.options,a=n.enableInEditor;(i!==nO||a)&&(null==(r=this.item.composition)?void 0:r.event)&&this.beginDragTarget(n,this.item.composition.event)}},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){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,aO(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],c=Math.tan(o*Math.PI/180/2)*Math.abs(h),l=this.dragRange,f=l.dxRange,d=l.dyRange,p=a[0]-this.dragRatio[0]*(u*c),m=a[1]-this.dragRatio[1]*(s*c),v=f[0],y=f[1],g=d[0],x=d[1];p=ib(p,v,y),m=ib(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 iE(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.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.handleDragMove(r,t),n.bouncingArg=t},touchend:function(t){if(n.canInteract()){var e=n.bouncingArg;!aO(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iD({},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=nJ(iE.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===tA.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},ir(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(im),t.InteractComponent=ey([iu(t0.InteractComponent)],t.InteractComponent);var aM=function(){function e(){this.triangles=[],this.worldMatrix=new iw,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]},c={x:t[s],y:t[s+1],z:t[s+2]},l={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:c,p2:l})}}}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,n=Number.MAX_VALUE,a=Number.MAX_VALUE,o=ep(this.boundingBoxData.area);!(e=o()).done;){var s=e.value;i=Math.max(s.p0.x,s.p1.x,s.p2.x,i),r=Math.max(s.p0.y,s.p1.y,s.p2.y,r),n=Math.min(s.p0.x,s.p1.x,s.p2.x,n),a=Math.min(s.p0.y,s.p1.y,s.p2.y,a)}var u=[],h=new iE(n,r,0),c=new iE(i,r,0),l=new iE(i,a,0),f=new iE(n,a,0);return u.push({p0:h,p1:c,p2:l}),u.push({p0:h,p1:l,p2:f}),this.applyWorldMatrix(u),{type:t.HitTestType.triangle,area:u}},i.setGeometry=function(e,i){this.triangles=this.geometryToTriangles(e);for(var r,n=[],a=ep(this.triangles);!(r=a()).done;){var o=r.value;n.push({p0:o.p0,p1:o.p1,p2:o.p2})}i&&this.worldMatrix.copyFrom(i),this.boundingBoxData={type:t.HitTestType.triangle,area:n}},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 n,a=ep(t.subMeshes);!(n=a()).done;){var o=n.value;if(void 0!==o.indexCount){var s=e.BYTES_PER_ELEMENT,u=o.offset/s,h=u+o.indexCount;this.assemblyTriangles(i,e,u,h,r)}}return r},i.applyWorldMatrix=function(t){var e=this;return t.forEach(function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new iE),t.p1=e.worldMatrix.transformPoint(t.p1,new iE),t.p2=e.worldMatrix.transformPoint(t.p2,new iE)}),t},e}(),aR=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.name="sprite",e}return e7(e,t),e}(e8),aI=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=ep(this.playableOutputs);!(e=i()).done;)e.value.context.deltaTime=t;for(var r,n=ep(this.playableOutputs);!(r=n()).done;){var a=r.value;this.prepareFrameWithRoot(a)}for(var o,s=ep(this.playableOutputs);!(o=s()).done;){var u=o.value;this.processFrameWithRoot(u)}},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}(),aP=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}(),aL=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}(),aV=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e}(il);function aF(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(th=ee||(ee={}))[th.Playing=0]="Playing",th[th.Paused=1]="Paused";var aD=new iS,ak=1,aN=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new iE(0,0,0),this.quat=new iS(0,0,0,1),this.rotation=new rb(0,0,0),this.scale=new iE(1,1,1),this.anchor=new iE(0,0,0),this.size=new iT(1,1),this.children=[],this.worldMatrix=iw.fromIdentity(),this.localMatrix=iw.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new iE(0,0,0),quat:new iS(0,0,0,1),scale:new iE(1,1,1)},this.name="transform_"+ak++,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,a=t.size,o=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(em(i,iE)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)em(o,iS)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(r){var h=e?-1:1;em(r,rb)?this.setRotation(r.x*h,r.y*h,r.z*h):this.setRotation(r[0]*h,r[1]*h,r[2]*h)}n&&(em(n,iE)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(em(u,iT)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){e_(this.children,t)},e.removeChild=function(t){eC(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new rb)},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 rb)},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={position:new iE().copyFrom(t.position),rotation:new rb(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new iE().copyFrom(t.scale)};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=aD.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},ir(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}(),az=new iE(1,1,1),aU=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new aN,this.viewportMatrix=iw.fromIdentity(),this.viewMatrix=iw.fromIdentity(),this.projectionMatrix=iw.fromIdentity(),this.viewProjectionMatrix=iw.fromIdentity(),this.inverseViewMatrix=iw.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,a=e.aspect,o=e.clipMode,s=void 0===o?tP.portrait:o,u=e.position,h=void 0===u?[0,0,8]:u,c=e.rotation,l=void 0===c?[0,0,0]:c,f=new rb(l[0],l[1],l[2]),d=new iS().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 iE(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 iE(1,1,a)),s=o.x,u=o.y,h=r.projectPoint(new iE(-1,-1,a));return new iE((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 iD({},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*iv,r,n,a,o===tP.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),az),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:iw.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},ir(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}(),aB=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=em(r,ar)?r:aC(r),this.cycles=+n||1/0,this.probability=isNaN(a)?1:+a,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}(),aG=function(t){this.content=t},aj=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 aG(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 aG(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}(),aX="lookup_texture",aH="offscreen_canvas",aW={},aY=new iE,aZ=new iE,aq=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,a=i.colorOverTrail,o=i.maxTrailCount,s=i.opacityOverLifetime,u=void 0===s?aC(1):s,h=i.widthOverTrail,c=i.name,l=i.occlusion,f=i.blending,d=i.maskMode,p=i.mask,m=i.textureMap,v=i.texture,y=i.transparentOcclusion,g=i.minimumVertexDistance,x=i.lifetime,b=i.matrix,T=e.gpuCapability,E=T.detail,_=T.level,C=Math.max(i.pointCountPerTrail,2),A=ag(),S=E.maxVertexTextures>0,w=(null!=(r=e.renderer)?r:{}).env,O={},M=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",w===nO]],R=o>64,I=0;n&&(M.push(["COLOR_OVER_LIFETIME",!0]),I|=1,O.uColorOverLifetime=i4.createWithData(e,eD(n))),a&&(M.push(["COLOR_OVER_TRAIL",!0]),I|=4,O.uColorOverTrail=i4.createWithData(e,eD(a))),R?(M.push(["ATTR_TRAIL_START",1]),I|=8):O.uTrailStart=new Float32Array(o),O.uOpacityOverLifetimeValue=u.toUniform(A);var P=h.toUniform(A);M.push(["VERT_CURVE_VALUE_COUNT",A.index],["VERT_MAX_KEY_FRAME_COUNT",A.max]),O.uVCurveValues=ar.getAllData(A);var L={shader:{vertex:rF,fragment:rL,macros:M,glslVersion:1===_?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+I+"+"+A.index+"+"+A.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},V=C*o*2,F=(C-1)*o,D=Float32Array.BYTES_PER_ELEMENT,k=12*D,N={attributes:{aColor:{size:4,stride:k,data:new Float32Array(12*V)},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(V)},aDir:{size:3,data:new Float32Array(3*V)}},indices:{data:new Uint16Array(6*V)},drawCount:6*F,name:"trail#"+c,bufferUsage:iM.DYNAMIC_DRAW};if(R)N.attributes.aTrailStart={size:1,data:new Float32Array(V)};else{var z=new Float32Array(V);N.attributes.aTrailStartIndex={size:1,data:z};for(var U=0;U<o;U++)for(var B=2*C,G=U*B,j=0;j<B;j++)z[G+j]=U}var X=iP(f),H=ra.create(e,L);H.blending=!0,H.depthMask=l,H.depthTest=!0,H.stencilRef=p?[p,p]:void 0,iF(H,d),iL(H,f);var W=this.mesh=rw.create(e,{name:"MTrail_"+c,material:H,geometry:rg.create(e,N)}),Y=null!=v?v:i4.createWithData(e);Object.keys(O).map(function(t){var e=O[t];if(em(e,i4))H.setTexture(t,e);else if("uTrailStart"===t)H.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new i_(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}H.setVector4Array(t,i)}else H.setVector4(t,i_.fromArray(e))}),H.setFloat("uTime",0),H.setVector4("uWidthOverTrail",i_.fromArray(P)),H.setVector2("uTexOffset",new iT(0,0)),H.setVector4("uTextureMap",i_.fromArray(void 0===m?[0,0,1,1]:m)),H.setVector4("uParams",new i_(0,C-1,0,0)),H.setTexture("uMaskTex",Y),H.setVector4("uColorParams",new i_(v?1:0,+X,0,+(l&&!y))),this.maxTrailCount=o,this.pointCountPerTrail=C,this.checkVertexDistance=g>0,this.minimumVertexDistance=Math.pow(g||.001,2),this.useAttributeTrailStart=R,this.lifetime=x,b&&(this.mesh.worldMatrix=b),this.geometry=W.firstGeometry(),this.trailCursors=new Uint16Array(o)}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,c=this.getTrailPosition(t,u,aY);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+s,f=a$(c,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*l,v),a.setAttributeSubData("aTime",2*l,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*l,g),u>=0){var b=new Float32Array(a$(this.getTrailPosition(t,h,aZ),c,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 A=this.mesh.material,S=A.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var O=2*n,M=new Float32Array(O),R=0;R<O;R++)M[R]=w;a.setAttributeSubData("aTrailStart",t*M.length,M)}else{var I=A.getFloats("uTrailStart");void 0!=I&&(I[t]=w,A.setFloats("uTrailStart",I))}S&&(S.y=Math.max(S.y,r-1)-Math.max(0,r-n),A.setVector4("uParams",S))}},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 eU(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();eU(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");eU(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();eU(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){},ir(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}(),aQ=new iE,aK=new iE,aJ=new iE;function a$(t,e,i){return t||i?(t?i?(aK.subtractVectors(e,t).normalize(),aK.subtractVectors(i,e),aJ.copyFrom(aK).normalize(),aQ.addVectors(aK,aJ)):aQ.subtractVectors(e,t):aQ.subtractVectors(i,e),aQ.normalize().toArray()):[0,0,0]}var a0=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}e7(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&em(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){var i=t.deltaTime;this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),.001>Math.abs(this.time-this.lastTime)&&(i=0),e.update(i)}this.lastTime=this.time},i}(aP),a1=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createPlayable=function(t){return new a0(t)},e}(aV),a2={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"},a3=function(){function e(e,i){this.particleCount=0,this.cachedRotationVector3=new iE,this.cachedRotationMatrix=new rT,this.cachedLinearMove=new iE,this.tempMatrix3=new rT,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,a,o,s,u,h,c,l,f=(null!=(h=e.renderer)?h:{}).env,d=i.speedOverLifetime,p=i.colorOverLifetime,m=i.linearVelOverLifetime,v=i.orbitalVelOverLifetime,y=i.sizeOverLifetime,g=i.rotationOverLifetime,x=i.sprite,b=i.gravityModifier,T=i.maxCount,E=i.textureFlip,_=i.useSprite,C=i.name,A=i.gravity,S=i.forceTarget,w=i.side,O=i.occlusion,M=i.anchor,R=i.blending,I=i.maskMode,P=i.mask,L=i.transparentOcclusion,V=i.meshSlots,F=i.renderMode,D=void 0===F?0:F,k=i.diffuse,N=void 0===k?i4.createWithData(e):k,z=e.gpuCapability.detail,U=z.halfFloatTexture,B=z.maxVertexUniforms,G=[["RENDER_MODE",+D],["ENV_EDITOR",f===nO]],j=e.gpuCapability.level,X=ag(),H=ag(),W=B>0,Y={},Z=0,q=0;this.useSprite=_,W&&G.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(G.push(["SPEED_OVER_LIFETIME",!0]),q|=2,Y.uSpeedLifetimeValue=d.toUniform(X)),(null==x?void 0:x.animate)&&(G.push(["USE_SPRITE",!0]),q|=4,Y.uFSprite=Y.uSprite=new Float32Array([x.col,x.row,x.total,x.blend?1:0]),this.useSprite=!0),(null==p?void 0:p.color)&&(G.push(["COLOR_OVER_LIFETIME",!0]),q|=16,Y.uColorOverLifetime=em(p.color,i4)?p.color:i4.createWithData(e,eD(p.color))),(null==p?void 0:p.opacity)?Y.uOpacityOverLifetimeValue=p.opacity.toUniform(X):Y.uOpacityOverLifetimeValue=aC(1).toUniform(X),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==m?void 0:m[t])&&(Y["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=m[t].toUniform(X),i=1,q|=1<<7+e,m.enabled=!0),G.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==v?void 0:v[t])&&(Y["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(X),r=1,q|=1<<10+e,c=!0,v.enabled=!0),G.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==m?void 0:m.asMovement)&&(G.push(["AS_LINEAR_MOVEMENT",!0]),q|=32),c&&((null==v?void 0:v.asRotation)&&(G.push(["AS_ORBITAL_MOVEMENT",!0]),q|=64),Y.uOrbCenter=new Float32Array((null==v?void 0:v.center)||[0,0,0])),Y.uSizeByLifetimeValue=null==y?void 0:y.x.toUniform(X),(null==y?void 0:y.separateAxes)&&(G.push(["SIZE_Y_BY_LIFE",1]),q|=16384,Y.uSizeYByLifetimeValue=null==y?void 0:null==(l=y.y)?void 0:l.toUniform(X)),(null==g?void 0:g.z)&&(Y.uRZByLifeTimeValue=g.z.toUniform(X),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(Y.uRXByLifeTimeValue=g.x.toUniform(X),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(Y.uRYByLifeTimeValue=g.y.toUniform(X),q|=131072,G.push(["ROT_Y_LIFETIME",1])),(null==g?void 0:g.asRotation)&&(G.push(["ROT_LIFETIME_AS_MOVEMENT",1]),q|=262144),Y.uGravityModifierValue=b.toUniform(X),S&&(G.push(["FINAL_TARGET",!0]),q|=524288,Y.uFinalTarget=new Float32Array(S.target||[0,0,0]),Y.uForceCurve=S.curve.toUniform(X)),U&&H.max?(q|=1048576,Y.uFCurveValueTexture=i5(e,ar.getAllData(H,!0),H.index,1)):Y.uFCurveValues=ar.getAllData(H);var Q=X.max+X.curves.length-32>B;if(2===j&&(X.max=-1,X.index=V?V[0]:a5(X.index),H.index>0&&(H.max=-1,H.index=V?V[1]:a5(H.index))),Q&&U&&W){var K=i5(e,ar.getAllData(X,!0),X.index,1);Y.uVCurveValueTexture=K,Z=1}else Y.uVCurveValues=ar.getAllData(X);var J=["-p:",D,q,X.index,X.max,H.index,H.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",X.index],["FRAG_CURVE_VALUE_COUNT",H.index],["VERT_MAX_KEY_FRAME_COUNT",X.max],["FRAG_MAX_KEY_FRAME_COUNT",H.max]),this.VERT_MAX_KEY_FRAME_COUNT=X.max;var $={fragment:rL,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+rV,glslVersion:1===j?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,macros:G,name:"particle#"+C},tt=iP(R);Y.uTexOffset=new Float32Array(N?[1/N.getWidth(),1/N.getHeight()]:[0,0]),Y.uMaskTex=N,Y.uColorParams=new Float32Array([N?1:0,+tt,0,+(!!O&&!L)]),Y.uParams=[0,0,0,0],Y.uAcceleration=[(null==A?void 0:A[0])||0,(null==A?void 0:A[1])||0,(null==A?void 0:A[2])||0,0];var te=ra.create(e,{shader:$,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});te.blending=!0,te.depthTest=!0,te.depthMask=!!O,te.stencilRef=P?[P,P]:void 0,iF(te,I),iL(te,R),iV(te,w),Object.keys(Y).map(function(t){var e=Y[t];if(em(e,i4)){te.setTexture(t,e);return}var i=[];switch(a2[t]){case"vec4":te.setVector4(t,i_.fromArray(e));break;case"vec3":te.setVector3(t,iE.fromArray(e));break;case"vec2":te.setVector2(t,iT.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new i_(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}te.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),te.setVector3("emissionColor",new iE(0,0,0)),te.setFloat("emissionIntensity",0);var ti=rg.create(e,(r=4*T,n=this.useSprite,a="particle#"+C,u={aPos:{size:3,offset:0,stride:s=12*(o=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*o,stride:s,dataSource:"aPos"},aDirX:{size:3,offset:6*o,stride:s,dataSource:"aPos"},aDirY:{size:3,offset:9*o,stride:s,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*o,data:new Float32Array(0)},aSeed:{size:1,offset:3*o,stride:8*o,dataSource:"aRot"},aColor:{size:4,offset:4*o,stride:8*o,dataSource:"aRot"},aOffset:{size:4,stride:4*o,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*o,data:new Float32Array(0)},aRotation1:{size:3,offset:3*o,stride:9*o,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*o,stride:9*o,dataSource:"aRotation0"}},n&&(u.aSprite={size:3,stride:3*o,data:new Float32Array(0)}),{attributes:u,indices:{data:new Uint16Array(0)},name:a,maxVertex:r})),tr=rw.create(e,{name:"MParticle_"+C,material:te,geometry:ti});this.anchor=M,this.mesh=tr,this.geometry=tr.firstGeometry(),this.forceTarget=S,this.sizeOverLifetime=y,this.speedOverLifetime=d,this.linearVelOverLifetime=m,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=b,this.rotationOverLifetime=g,this.maxCount=T,this.textureOffsets=E?[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 eU(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)},c=this.useSprite;c&&(h.aSprite=new Float32Array(12));var l=new iE,f=new iS,d=new iE(1,1,1);e.transform.assignWorldTRS(l,f,d);var p=aN.getRotation(f,new rb),m=l.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();c&&(r=e.sprite);for(var C=0;C<4;C++){var A=2*C,S=3*C,w=4*C,O=12*C,M=8*C;h.aPos.set(m,O),b.fill(h.aPos,O+3),h.aRot.set(v,M),h.aRot[M+3]=_,h.aRot.set(T,M+4),c&&h.aSprite.set(r,S);var R=e.uv||x;if(R){var I=c?1-y[A+1]:y[A+1];g[0]=R[0]+y[A]*R[2],g[1]=R[1]+I*R[3]}h.aOffset.set(g,w);for(var P=C+C,L=(E[P]-this.anchor.x)*d.x,V=(E[P+1]-this.anchor.y)*d.y,F=0;F<3;F++)h.aPos[O+6+F]=e.dirX.getElement(F)*L,h.aPos[O+9+F]=e.dirY.getElement(F)*V}var D=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var k=eA(o.getIndexData(),6*n,6*i,u);k.set(D,6*t),o.setIndexData(k),this.maxParticleBufferCount=k.length/6}else o.setIndexSubData(6*t,D);Object.keys(h).forEach(function(e){var r=h[e],n=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var c=o.getAttributeData(e);eU(c);var l=eA(c,a*n,4*i*n,u);l.set(r,r.length*t),o.setAttributeData(e,l)}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"),c=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;o=n[f],s=n[f+1],u=n[f+2];var d=i-a[4*l+2],p=a[4*l+3];if(h&&c){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*l;if(a[4*l+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"),a=this.geometry.getAttributeData("aSeed"),o=this.time,s=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var h=ib((o-r[4*u+2])/r[4*u+3],0,1),c=8*u,l=this.cachedRotationVector3.set(n[c],n[c+1],n[c+2]),f=a[8*u+3];this.rotationOverLifetime?(this.rotationOverLifetime.x&&(em(this.rotationOverLifetime.x,ao)?l.x+=this.rotationOverLifetime.x.getValue(h,f):l.x+=this.rotationOverLifetime.x.getValue(h)),this.rotationOverLifetime.y&&(em(this.rotationOverLifetime.y,ao)?l.y+=this.rotationOverLifetime.y.getValue(h,f):l.y+=this.rotationOverLifetime.y.getValue(h)),this.rotationOverLifetime.z&&(em(this.rotationOverLifetime.z,ao)?l.z+=this.rotationOverLifetime.z.getValue(h,f):l.z+=this.rotationOverLifetime.z.getValue(h))):s.setZero(),0===l.dot(l)&&s.identity();var d=Math.PI/180,p=l.x*d,m=l.y*d,v=l.z*d,y=Math.sin(p),g=Math.sin(m),x=Math.sin(v),b=Math.cos(p),T=Math.cos(m),E=Math.cos(v);s.set(E,-x,0,x,E,0,0,0,1),s.multiply(this.tempMatrix3.set(T,0,g,0,1,0,-g,0,T)),s.multiply(this.tempMatrix3.set(1,0,0,0,b,-y,0,y,b));var _=9*u,C=s.elements;i.set(C,_),u+4<=t&&(i.set(C,_+9),i.set(C,_+18),i.set(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"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var s=0;s<t;s+=4){var u=a-r[4*s+2],h=r[4*s+3],c=u/h,l=n[8*s+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(em(this.linearVelOverLifetime.x,ao)?o.x=this.linearVelOverLifetime.x.getValue(c,l):o.x=this.linearVelOverLifetime.x.getValue(c)),this.linearVelOverLifetime.y&&(em(this.linearVelOverLifetime.y,ao)?o.y=this.linearVelOverLifetime.y.getValue(c,l):o.y=this.linearVelOverLifetime.y.getValue(c)),this.linearVelOverLifetime.z&&(em(this.linearVelOverLifetime.z,ao)?o.z=this.linearVelOverLifetime.z.getValue(c,l):o.z=this.linearVelOverLifetime.z.getValue(c))):(this.linearVelOverLifetime.x&&(em(this.linearVelOverLifetime.x,ao)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,l):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.y&&(em(this.linearVelOverLifetime.y,ao)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,l):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.z&&(em(this.linearVelOverLifetime.z,ao)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,l):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,h)));var f=3*s;i[f]=o.x,i[f+1]=o.y,i[f+2]=o.z,i[f+3]=o.x,i[f+4]=o.y,i[f+5]=o.z,i[f+6]=o.x,i[f+7]=o.y,i[f+8]=o.z,i[f+9]=o.x,i[f+10]=o.y,i[f+11]=o.z}this.geometry.setAttributeData("aLinearMove",i)},i.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},e}(),a4=[10,32,64,160];function a5(t){for(var e=0;e<a4.length;e++){var i=a4[e];if(i>t)return i}return t||a4[0]}var a6=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new a3(e,i)),r&&(n.trailMesh=new aq(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}e7(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=ep(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 i_;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=ep(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}(im);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)===tD.removeParticle,ray:t})}}},n.maskManager=new ro(i),r&&n.fromData(r),n}e7(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]===tL.CONSTANT_VEC3?e.add(r[1]):t=aC(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.setOpacity=function(t){var e,i=this.renderer.particleMesh.mesh.material,r=this.renderer.particleMesh.mesh.geometry,n=(null==(e=i.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];i.setVector4("uOpacityOverLifetimeValue",new i_(n[0],n[1],n[2],t));for(var a=r.getAttributeData("aColor")||[],o=0;o<a.length;o+=32)a[8*o+7]=t},r.setColor=function(t,e,i,r){var n,a=this.renderer.particleMesh.mesh.material,o=this.renderer.particleMesh.mesh.geometry,s=(null==(n=a.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];a.setVector4("uOpacityOverLifetimeValue",new i_(s[0],s[1],s[2],r));for(var u=o.getAttributeData("aColor")||[],h=0;h<u.length;h+=32)u[8*h+4]=t,u[8*h+5]=e,u[8*h+6]=i,u[8*h+7]=r},r.setParentTransform=function(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.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new aj(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.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var o=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,h=!1,c=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!==tF.restart&&tF.destroy===this.item.endBehavior){var l=o.last;l&&l.content[0]<this.lastUpdate&&(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],A=!C.disabled&&C.getGeneratorOptions(u,d);if(A){var S=[0,0,0],w=a.burstOffsets[E],O=w&&w[A.cycleIndex]||S;C.once&&this.removeBurst(E);for(var M=0;M<A.count&&_<y&&!g();M++){var R,I=this.initPoint(this.shape.generate({total:A.total,index:A.index,burstIndex:M,burstCount:A.count}));I.delay+=i,_++,(R=I.transform).translate.apply(R,[].concat(O)),this.addParticle(I,y)}}}}else this.item.endBehavior===tF.restart?(c(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=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===tF.freeze&&(this.frozen=!0))}c()}},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 iE,o=!1;if(r&&r.content)do{var s=r.content,u=s[0],h=s[1];s[2];var c=s[3];if(u>this.timePassed){var l=this.getPointPosition(c),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:l,radius:t.radius},a)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),r.content=[0]),n.push(l),t.multiple||(o=!0))}else break}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,c=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(c*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){o.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&o.subtract(l)}n.addTrailPoint(t,o,{color:s,lifetime:c,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.lastUpdate-n,u=new iE,h=iE.fromArray(void 0===a?[]:a);e.assignWorldTRS(u);var c=nW(new iE,this.options,h,s,r,u,i);if(o){var l=o.target||[0,0,0],f=o.curve.getValue(s/r),d=1-f;c.x=c.x*d+l[0]*f,c.y=c.y*d+l[1]*f,c.z=c.z*d+l[2]*f}return c},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?iw.IDENTITY:this.transform.getWorldMatrix(),c=t.position,l=new aN({position:h.transformPoint(c,new iE),valid:!0}),f=t.direction;if(f=h.transformNormal(f,a8).normalize(),a.startTurbulence&&a.turbulence){for(var d=0;d<3;d++)oi.setElement(d,a.turbulence[d].getValue(o));or.setFromVector3(oi.negate()),oa.setFromEuler(or).transformNormal(f).normalize()}s.alignSpeedDirection?(oe.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=iE.Z.clone(),h.transformNormal(this.upDirectionWorld)),ot.crossVectors(oe,this.upDirectionWorld).normalize(),ot.isZero()&&ot.set(1,0,0)):(ot.set(1,0,0),oe.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=on)[0]=p.animationDelay.getValue(o),n[1]=p.animationDuration.getValue(o),n[2]=p.cycles.getValue(o)),a.start3DRotation?a7.set(a.startRotationX.getValue(o),a.startRotationY.getValue(o),a.startRotationZ.getValue(o)):a.startRotation?a7.set(0,0,a.startRotation.getValue(o)):a7.set(0,0,0),l.setRotation(a7.x,a7.y,a7.z);var m=a.startColor.getValue(o);if(3===m.length&&(m[3]=1),a.start3DSize)a9.x=a.startSizeX.getValue(o),a9.y=a.startSizeY.getValue(o);else{var v=a.startSize.getValue(o),y=a.sizeAspect.getValue(o);a9.x=v,a9.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!a.particleFollowParent){var x=new iE;this.transform.assignWorldTRS(void 0,void 0,x),a9.x*=x.x,a9.y*=x.y}return l.setScale(a9.x,a9.y,1),{size:a9,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:oe,dirX:ot,transform:l}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&em(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,a,o,s,u,h,c,l,f,d,p,m=t.options,v=t.positionOverLifetime,y=void 0===v?{}:v,g=t.shape,x=null==y?void 0:y.gravityOverLifetime,b=nY(null==y?void 0:y.gravity),T=t.textureSheetAnimation,E=T?{animationDelay:aC(T.animationDelay||0),animationDuration:aC(T.animationDuration||1),cycles:aC(T.cycles||1),animate:T.animate,col:T.col,row:T.row,total:T.total||T.col*T.row}:void 0,_=!!(g&&g.turbulenceX||(null==g?void 0:g.turbulenceY)||(null==g?void 0:g.turbulenceZ));_&&(n=[aC(null!=(a=g.turbulenceX)?a:0),aC(null!=(o=g.turbulenceY)?o:0),aC(null!=(s=g.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=nc(g),this.emission={rateOverTime:aC(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=em(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 aB(t)})},this.textureSheetAnimation=E;var C=t.renderer||{},A=t.rotationOverLifetime;A&&((h={}).asRotation=!!A.asRotation,h.z=A.z?aC(A.z):aC(0),A.separateAxes&&(h.x=A.x&&aC(A.x),h.y=A.y&&aC(A.y))),(null==y?void 0:y.forceTarget)&&(c={target:y.target||[0,0,0],curve:aC(y.forceCurve||[tL.LINE,[[0,0],[1,1]]])});var S={x:y.linearX&&aC(y.linearX||0),y:y.linearY&&aC(y.linearY||0),z:y.linearZ&&aC(y.linearZ||0),asMovement:y.asMovement},w={x:y.orbitalX&&aC(y.orbitalX),y:y.orbitalY&&aC(y.orbitalY),z:y.orbitalZ&&aC(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},O=t.sizeOverLifetime||{},M=t.colorOverLifetime,R=(null==O?void 0:O.separateAxes)?{separateAxes:!0,x:aC(O.x),y:aC(O.y)}:{separateAxes:!1,x:aC(("size"in O?O.size:O.x)||1)};C.anchor=C.anchor||[0,0];var I=iT.fromArray(C.anchor);this.options={particleFollowParent:!!m.particleFollowParent,startLifetime:aC(m.startLifetime),startDelay:aC(m.startDelay||0),startSpeed:aC(y.startSpeed||0),startColor:aC(m.startColor),looping:!1,maxCount:null!=(l=m.maxCount)?l:0,gravityModifier:aC(x||0),gravity:b,start3DSize:!!m.start3DSize,startTurbulence:_,turbulence:n,speedOverLifetime:y.speedOverLifetime&&aC(y.speedOverLifetime),linearVelOverLifetime:S,orbitalVelOverLifetime:w,forceTarget:c},m.startRotationZ&&(this.options.startRotation=aC(m.startRotationZ||0)),(m.startRotationX||m.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=aC(m.startRotationX||0),this.options.startRotationY=aC(m.startRotationY||0),this.options.startRotationZ=aC(m.startRotationZ||0)),m.start3DSize?(this.options.startSizeX=aC(m.startSizeX),this.options.startSizeY=aC(m.startSizeY)):(this.options.startSize=aC(m.startSize),this.options.sizeAspect=aC(m.sizeAspect||1));var P=this.getMaskOptions(t),L={meshSlots:m.meshSlots,name:this.name,matrix:iw.IDENTITY,shaderCachePrefix:"",renderMode:C.renderMode||tO.BILLBOARD,side:C.side||tT.DOUBLE,gravity:b,blending:C.blending||tb.ALPHA,rotationOverLifetime:h,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:E,occlusion:!!C.occlusion,transparentOcclusion:!!C.transparentOcclusion,maxCount:m.maxCount,mask:P.maskRef,maskMode:P.maskMode,forceTarget:c,diffuse:C.texture?this.engine.findObject(C.texture):void 0,sizeOverLifetime:R,anchor:I};if(M){var V=M.color,F=M.opacity;L.colorOverLifetime={},F&&(L.colorOverLifetime.opacity=aC(M.opacity)),V&&(V[0]===tL.GRADIENT_COLOR?L.colorOverLifetime.color=M.color[1]:V[0]===tL.RGBA_COLOR?L.colorOverLifetime.color=i4.createWithData(this.engine,{data:new Uint8Array(V[1]),width:1,height:1}):em(V,i4)&&(L.colorOverLifetime.color=V))}var D=[],k=[0,0,1,1];if(t.splits){var N=t.splits[0];k=(f=N[4])?[N[0],N[1],N[3],N[2]]:[N[0],N[1],N[2],N[3]]}if(E&&!E.animate)for(var z=f?E.row:E.col,U=f?E.col:E.row,B=E.total||z*U,G=0,j=0;j<z;j++)for(var X=0;X<U&&G<B;X++,G++)D.push([j*k[2]/z+k[0],X*k[3]/U+k[1],k[2]/z,k[3]/U]);else D.push(k);this.uvs=D,L.textureFlip=f;var H=t.trails;H&&(this.trails={lifetime:aC(H.lifetime),dieWithParticles:!1!==H.dieWithParticles,sizeAffectsWidth:!!H.sizeAffectsWidth,sizeAffectsLifetime:!!H.sizeAffectsLifetime,inheritParticleColor:!!H.inheritParticleColor,parentAffectsPosition:!!H.parentAffectsPosition},P=this.getMaskOptions(H),d={name:"Trail",matrix:iw.IDENTITY,minimumVertexDistance:H.minimumVertexDistance||.02,maxTrailCount:m.maxCount,pointCountPerTrail:Math.round(H.maxPointPerTrail)||32,blending:H.blending,texture:H.texture?this.engine.findObject(H.texture):void 0,opacityOverLifetime:aC(H.opacityOverLifetime||1),widthOverTrail:aC(H.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!H.occlusion,transparentOcclusion:!!H.transparentOcclusion,textureMap:H.textureMap,mask:P.maskRef,maskMode:P.maskMode},H.colorOverLifetime&&H.colorOverLifetime[0]===tL.GRADIENT_COLOR&&(d.colorOverLifetime=H.colorOverLifetime[1]),H.colorOverTrail&&H.colorOverTrail[0]===tL.GRADIENT_COLOR&&(d.colorOverTrail=H.colorOverTrail[1])),this.renderer=new a6(this.engine,L,d),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!=(p=W.radius)?p:.4,behavior:W.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},r.getMaskOptions=function(e){var i=t.MaskMode.NONE,r=0;if(e.mask){var n=e.mask;n&&n.ref&&(n.ref=this.engine.findObject(n.ref)),i=this.maskManager.getMaskMode(e),r=this.maskManager.getRefValue()}return{maskMode:i,maskRef:r}},ir(i,[{key:"timePassed",get:function(){return this.lastUpdate-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}(id),t.ParticleSystem=ey([iu(t0.ParticleSystem)],t.ParticleSystem);var a8=new iE,a9=new iT,a7=new rb,ot=new iE,oe=new iE,oi=new iE,or=new rb,on=[0,0,0],oa=new iw,oo=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clipPlayables=[],e.clipWeights=[],e}e7(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=ep(this.clipPlayables);!(e=i()).done;)e.value.processFrame(t);this.evaluate(t)},i.setClipWeight=function(t,e){if(em(t,aP)){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}(aP),os=function(e){function i(){return e.apply(this,arguments)}return e7(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(em(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}(oo),ou=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(aP),oh=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyName="",e}return e7(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 a=this.getClipPlayable(r);if(!em(a,ou)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var o=a.value;this.addWeightedValue(o,n),i=!0}}i&&(e[this.propertyName]=this.propertyValue)}}},e}(oo),oc=function(t){function e(){return t.apply(this,arguments)}e7(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}(oh),ol=function(t){function e(){return t.apply(this,arguments)}e7(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(oh),of=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.evaluate=function(t){},e}(oo),od=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.evaluate=function(t){},e}(oo),op=function(e){function i(){return e.apply(this,arguments)}return e7(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();em(i,t.CompositionComponent)&&(i.time=this.getTime())},i}(aP),om=function(e){function i(){return e.apply(this,arguments)}return e7(i,e),i.prototype.evaluate=function(e){var i=e.output.getUserData();if(em(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}(oo),ov=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.evaluate=function(t){},e}(oo),oy=function(t){function e(){return t.apply(this,arguments)}e7(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}(oh),og=function(t){function e(){return t.apply(this,arguments)}e7(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}(oh),ox=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===tF.restart?e%=i:this.endBehavior===tF.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}e7(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new oo(t)},i.createOutput=function(){return new aL},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=ep(this.clips);!(i=n()).done;){var a=i.value;r.push(a)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),a=ep(e);!(r=a()).done;){var o=r.value,s=this.createClipPlayable(t,o);s.setDuration(o.duration);var u=new ob(o,s,n,this);i.push(u),n.clipPlayables.push(s),n.setClipWeight(s,0)}return n},i.createPlayable=function(t){return new aP(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 ox;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=ep(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=ep(this.children);!(i=r()).done;)i.value.parent=this},e}(aV),ey([ic(ox,void 0)],t.TrackAsset.prototype,"clips",void 0),ey([ic(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=ey([iu(t0.TrackAsset)],t.TrackAsset),t.TrackType=void 0,(tc=t.TrackType||(t.TrackType={}))[tc.MasterTrack=0]="MasterTrack",tc[tc.ObjectTrack=1]="ObjectTrack";var ob=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,em(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,a=!1,o=this.track.boundObject;e>=i.start+i.duration&&i.endBehavior===tF.destroy?em(o,t.VFXItem)&&t.VFXItem.isParticle(o)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,a=!0):e<i.start&&(r=0),a&&this.playable.getPlayState()!==ee.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var s=parseFloat(i.toLocalTime(e).toFixed(3));this.playable.setTime(s),n&&this.playable.getPlayState()===ee.Playing&&this.playable.pause()},ir(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 e7(e,t),e.prototype.createTrackMixer=function(t){return new os(t)},e}(t.TrackAsset),t.ActivationTrack=ey([iu(t0.ActivationTrack)],t.ActivationTrack);var oT=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.propertyNames=[],e.path="",e}e7(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);ey([ic(void 0,void 0)],oT.prototype,"path",void 0),t.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}e7(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new ol(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}(oT),t.FloatPropertyTrack=ey([iu(t0.FloatPropertyTrack)],t.FloatPropertyTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createTrackMixer=function(t){return new od(t)},e}(t.TrackAsset),t.SpriteColorTrack=ey([iu(t0.SpriteColorTrack)],t.SpriteColorTrack),t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}e7(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!em(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 om(t)},i}(t.TrackAsset),t.SubCompositionTrack=ey([iu(t0.SubCompositionTrack)],t.SubCompositionTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createTrackMixer=function(t){return new ov(t)},e}(t.TrackAsset),t.TransformTrack=ey([iu(t0.TransformTrack)],t.TransformTrack),t.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.updateAnimatedObject=function(){em(this.parent.boundObject,im)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(t.TrackAsset),ey([ic(void 0,void 0)],t.MaterialTrack.prototype,"index",void 0),t.MaterialTrack=ey([iu("MaterialTrack")],t.MaterialTrack);var oE=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createTrackMixer=function(t){return new of(t)},e}(t.TrackAsset);t.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createTrackMixer=function(t){var e=new oy(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(oT),t.Vector4PropertyTrack=ey([iu(t0.Vector4PropertyTrack)],t.Vector4PropertyTrack),t.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createTrackMixer=function(t){var e=new og(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(oT),t.Vector2PropertyTrack=ey([iu("Vector2PropertyTrack")],t.Vector2PropertyTrack),t.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createTrackMixer=function(t){var e=new oc(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(oT),t.ColorPropertyTrack=ey([iu(t0.ColorPropertyTrack)],t.ColorPropertyTrack),t.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createPlayable=function(t){var e=new ou(t);return e.curve=aC(this.curveData),e.value=e.curve.getValue(0),e},e}(aV),ey([ic(void 0,void 0)],t.ColorPropertyPlayableAsset.prototype,"curveData",void 0),t.ColorPropertyPlayableAsset=ey([iu(t0.ColorPropertyPlayableAsset)],t.ColorPropertyPlayableAsset),t.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createPlayable=function(t){var e=new ou(t);return e.curve=aC(this.curveData),e.value=e.curve.getValue(0),e},e}(aV),ey([ic(void 0,void 0)],t.FloatPropertyPlayableAsset.prototype,"curveData",void 0),t.FloatPropertyPlayableAsset=ey([iu(t0.FloatPropertyPlayableAsset)],t.FloatPropertyPlayableAsset),t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createPlayable=function(t){return new op(t)},e}(aV),t.SubCompositionPlayableAsset=ey([iu(t0.SubCompositionPlayableAsset)],t.SubCompositionPlayableAsset),t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}e7(i,e);var r=i.prototype;return r.updateAnimatedObject=function(){},r.create=function(e){if(em(this.boundObject,t.VFXItem)){var i=this.boundObject;if(i.getComponent(t.ParticleSystem)){var r=e.createTrack(oE,this,"ParticleTrack");r.boundObject=this.boundObject;var n=r.createClip(a1);n.start=i.start,n.duration=i.duration,n.endBehavior=i.endBehavior}}},i}(t.TrackAsset),t.ObjectBindingTrack=ey([iu(t0.ObjectBindingTrack)],t.ObjectBindingTrack);var o_=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}e7(i,e);var r=i.prototype;return r.createPlayable=function(e){for(var i,r=new oC(e),n=ep(this.tracks);!(i=n()).done;){var a=i.value;em(a,t.ObjectBindingTrack)&&a.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=ep(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,o=ep(t.getChildTracks());!(a=o()).done;){var s=a.value;this.addSubTracksRecursive(s,e)}},r.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new oA(t[i],i));e.sort(oS),t.length=0;for(var r,n=ep(e);!(r=n()).done;){var a=r.value;t.push(a.track)}},r.fromData=function(t){},ir(i,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=ep(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),i}(aV),ey([ic(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=ey([iu(t0.TimelineAsset)],t.TimelineAsset);var oC=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.masterTrackInstances=[],e}e7(e,t);var i=e.prototype;return i.prepareFrame=function(t){},i.evaluate=function(){for(var t,e=this.getTime(),i=ep(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){for(var i,r={},n=ep(e);!(i=n()).done;){var a=i.value,o=a.createPlayableGraph(t,this.clips),s=a.createOutput();s.setUserData(a.boundObject),t.addOutput(s),s.setSourcePlayable(o);var u=new o_(a,o,s);r[a.getInstanceId()]=u,a.parent||this.masterTrackInstances.push(u)}for(var h,c=ep(e);!(h=c()).done;)for(var l,f=h.value,d=r[f.getInstanceId()],p=ep(f.getChildTracks());!(l=p()).done;){var m=r[l.value.getInstanceId()];d.addChild(m)}},e}(aP),oA=function(t,e){this.track=t,this.originalIndex=e};function oS(e,i){var r=e.track.boundObject,n=i.track.boundObject;return em(r,t.VFXItem)&&em(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 e7(e,t),e.prototype.createPlayable=function(t){var e=new ou(t);return e.curve=aC(this.curveData),e.value=e.curve.getValue(0),e},e}(aV),ey([ic(void 0,void 0)],t.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector4PropertyPlayableAsset=ey([iu(t0.Vector4PropertyPlayableAsset)],t.Vector4PropertyPlayableAsset),t.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createPlayable=function(t){var e=new ou(t);return e.curve=aC(this.curveData),e.value=e.curve.getValue(0),e},e}(aV),ey([ic(void 0,void 0)],t.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),t.Vector2PropertyPlayableAsset=ey([iu(t0.Vector2PropertyPlayableAsset)],t.Vector2PropertyPlayableAsset),t.CompositionComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.startTime=0,t.items=[],t.state=ee.Playing,t.reusable=!1,t.sceneBindings=[],t.graph=new aI,t}e7(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!==tF.destroy&&this.setReusable(!0),null==(e=this.item.composition)||e.refContent.push(this.item)},r.setReusable=function(e){for(var r,n=ep(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value.boundObject;if(em(a,t.VFXItem)){var o=a.getComponent(i);o&&o.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=ep(this.items);!(t=e()).done;)t.value.setActive(!0)},r.onDisable=function(){for(var t,e=ep(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,o){for(var s,u=[],h=(null==o?void 0:o.stop)||eX,c=(null==o?void 0:o.skip)||eX,l=(null==o?void 0:o.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<l;f++){var d=(s=this,function(o){var l=s.items[o];if(l.isActive&&l.transform.getValid()&&!t.VFXItem.isComposition(l)&&!c(l)){var f=l.getHitTestParams(a);if(f){var d=!1,p=new iE;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,u.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,u.push(p))}else if(f.type===t.HitTestType.sphere){var _=f.center,C=f.radius;e.intersectSphere({center:_,radius:C},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.custom){var A=f.collect(e,new iT(i,r));A&&A.length>0&&(A.forEach(function(t){u.push(t)}),d=!0)}if(d){var S={compContent:s.item,id:l.id,name:l.name,position:u[u.length-1],parentId:l.parentId,hitPositions:u,behavior:f.behavior};if(l.emit("click",S),n.push(S),h(S))return{v:n}}}}}(f));if("object"===ev(d))return d.v}return n},r.setChildrenRenderOrder=function(t){for(var e,r=ep(this.items);!(e=r()).done;){var n=e.value;n.renderOrder=t++;var a=n.getComponent(i);a&&(t=a.setChildrenRenderOrder(t))}return t},r.fromData=function(t){var i;e.prototype.fromData.call(this,t),this.startTime=null!=(i=t.startTime)?i:0},r.resolveBindings=function(){for(var t,e=ep(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,n=ep(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value;this.updateTrackAnimatedObject(a)}},r.updateTrackAnimatedObject=function(t){for(var e,i=ep(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},i}(id),ey([ic(void 0,void 0)],t.CompositionComponent.prototype,"items",void 0),ey([ic(void 0,void 0)],t.CompositionComponent.prototype,"sceneBindings",void 0),ey([ic(void 0,void 0)],t.CompositionComponent.prototype,"timelineAsset",void 0),t.CompositionComponent=ey([iu("CompositionComponent")],t.CompositionComponent);var ow=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}))||[]}},oO=function(){function t(){this.update=new oR,this.lateUpdate=new oI}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==id.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==id.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==id.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==id.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),oM=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}(),oR=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=ep(t);!(i=r()).done;)i.value.onUpdate(e)},e}(oM),oI=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=ep(t);!(i=r()).done;)i.value.onLateUpdate(e)},e}(oM),oP=function(e){function i(r,n){(v=e.call(this)||this).sceneTicking=new oO,v.speed=1,v.isEnded=!1,v.loaderData={},v.refContent=[],v.postProcessingEnabled=!1,v.assigned=!1,v.destroyed=!1,v.postLoaders=[],v.paused=!1,v.lastVideoUpdateTime=0,v.isEndCalled=!1,v._textures=[];var a,o,s=r.reusable,u=void 0!==s&&s,h=r.speed,c=r.baseRenderOrder,l=r.renderer,f=r.event,d=r.width,p=r.height,m=r.handleItemMessage;v.renderer=l,v._textures=n.textureOptions,v.postProcessingEnabled=null!=(g=null==(y=n.jsonScene.renderSettings)?void 0:y.postProcessingEnabled)&&g,v.getEngine().renderLevel=n.renderLevel,u&&(v.keepResource=!0,n.textures=void 0,n.consumed=!0);for(var v,y,g,x,b=n.jsonScene.compositions[0],T=ep(n.jsonScene.compositions);!(x=T()).done;){var E=x.value;E.id===n.jsonScene.compositionId&&(b=E)}eU(b),v.rootItem=new t.VFXItem(v.getEngine()),v.rootItem.name="rootItem",v.rootItem.duration=b.duration,v.rootItem.endBehavior=b.endBehavior,v.rootItem.composition=aF(v);for(var _,C=b.components,A=ep(C);!(_=A()).done;){var S=_.value,w=v.getEngine().findObject(S);v.rootItem.components.push(w),w.item=v.rootItem}return v.rootComposition=v.rootItem.getComponent(t.CompositionComponent),v.width=d,v.height=p,v.renderOrder=void 0===c?0:c,v.id=b.id,v.renderer=l,v.event=f,v.statistic={loadStart:null!=(a=n.startTime)?a:0,loadTime:null!=(o=n.totalTime)?o:0,compileTime:0,firstFrameTime:0},v.reusable=u,v.speed=void 0===h?1:h,v.name=b.name,v.pluginSystem=n.pluginSystem,v.pluginSystem.initializeComposition(aF(v),n),v.camera=new aU(v.name,iD({},null==b?void 0:b.camera,{aspect:d/p})),v.url=n.url,v.assigned=!0,v.interactive=!0,v.handleItemMessage=m,v.createRenderFrame(),v.rendererOptions=null,i.buildItemTree(v.rootItem),v.rootComposition.setChildrenRenderOrder(0),v.pluginSystem.resetComposition(aF(v),v.renderFrame),v}e7(i,e);var r=i.prototype;return r.getDuration=function(){return this.rootItem.duration},r.restart=function(){this.reset(),this.forwardTime(this.startTime)},r.setIndex=function(t){this.renderOrder=t},r.getIndex=function(){return this.renderOrder},r.setSpeed=function(t){this.speed=t},r.setVisible=function(t){this.rootItem.setVisible(t)},r.getSpeed=function(){return this.speed},r.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},r.pause=function(){this.paused=!0},r.getPaused=function(){return this.paused},r.resume=function(){this.paused=!1},r.gotoAndPlay=function(t){this.setTime(t),this.resume()},r.gotoAndStop=function(t){this.setTime(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new rQ({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},r.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.pause(),this.emit("goto",{time:t})},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.forwardTime=function(t){for(var e=1e3*t-1e3*this.rootComposition.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},r.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},r.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)})},r.update=function(t){if(!(!this.assigned||this.getPaused())){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=parseFloat(this.getUpdateTime(t*this.speed).toFixed(0));this.updateRootComposition(e/1e3),this.updateVideo(),this.updatePluginLoaders(t),this.sceneTicking.update.tick(e),this.sceneTicking.lateUpdate.tick(e),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},r.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===tF.destroy&&!this.reusable},r.getUpdateTime=function(t){var e=1e3*this.startTime,i=1e3*this.rootComposition.time;return t<0&&i+t<e?e-i:t},r.callAwake=function(t){for(var e,i=ep(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var n,a=ep(t.children);!(n=a()).done;){var o=n.value;this.callAwake(o)}},r.updateVideo=function(){var t,e=performance.now();e-this.lastVideoUpdateTime>33&&((null!=(t=this.textures)?t:[]).forEach(function(t){return null==t?void 0:t.uploadCurrentVideoFrame()}),this.lastVideoUpdateTime=e)},r.updateCamera=function(){this.camera.updateMatrix()},r.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},r.updateRootComposition=function(t){if(this.rootComposition.state!==ee.Paused&&this.rootComposition.isActiveAndEnabled){var e=parseFloat((this.time+t-this.rootItem.start).toFixed(3)),i=!1,r=this.rootItem.duration,n=this.rootItem.endBehavior;if(e-r>.001)switch(i=!0,n){case tF.restart:e%=r,this.restart();break;case tF.freeze:e=Math.min(r,e);case tF.forward:case tF.destroy:}this.rootComposition.time=e,this.isEnded!==i&&(i?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return nK((t-i.z)/r,(e-i.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.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},r.addInteractiveItem=function(t,e){if(e===tA.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},r.removeInteractiveItem=function(t,e){e===tA.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}))},r.destroyItem=function(e){var i=this;e.type==tw.composition?e.endBehavior!==tF.freeze&&e.getComponent(t.CompositionComponent).items.forEach(function(t){return i.pluginSystem.plugins.forEach(function(e){return e.onCompositionItemRemoved(i,t)})}):(eC(this.items,e),this.pluginSystem.plugins.forEach(function(t){return t.onCompositionItemRemoved(i,e)}))},r.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()},r.dispose=function(){var e,i,r=this;if(!this.destroyed){this.destroyed=!0;var n={},a=this.textures;a&&this.keepResource&&a.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=eX)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){ej.error("Update disposed composition: "+r.name+".")},this.dispose=eX,a&&this.keepResource&&a.forEach(function(t){t.dispose=n[t.id],t.dispose()}),this.renderer.env!==nO&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},r.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},r.translate=function(t,e,i){this.rootItem.translate(t,e,i)},r.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},r.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},r.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},r.scale=function(t,e,i){this.rootItem.scale(t,e,i)},r.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},r.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},r.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},r.reloadTexture=function(){var t=this;return ef(function(){return eg(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]}})})()},i.buildItemTree=function(e){for(var i,r=new Map,n=e.getComponent(t.CompositionComponent).items,a=ep(n);!(i=a()).done;){var o=i.value;r.set(o.id,o)}for(var s,u=ep(n);!(s=u()).done;){var h=s.value;if(void 0===h.parentId)h.setParent(e);else{var c=r.get(h.parentId);if(c)h.setParent(c);else throw Error("The element references a non-existent element, please check the data.")}}},ir(i,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){return this.rootComposition.startTime}},{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)}}]),i}(ow);t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new aN,r.time=-1,r.duration=0,r.start=0,r.endBehavior=tF.forward,r.type=tw.base,r.components=[],r.isDuringPlay=!1,r.active=!0,r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new ow,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}e7(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=ep(this.components);!(i=r()).done;){var n=i.value;if(em(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=ep(this.components);!(e=r()).done;){var n=e.value;em(n,t)&&i.push(n)}return i},r.setParent=function(t){(t!==this||t)&&(this.parent&&eC(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){this.active!==t&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,i=ep(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 aN({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 rb(t,e,i),n=iS.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 iE;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=ep(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=ep(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=ep(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=ep(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 n=r.id,a=r.name,o=r.delay,s=r.parentId,u=r.endBehavior,h=r.transform,c=r.duration,l=void 0===c?0:c;this.props=r,this.type=r.type,this.id=n.toString(),this.name=a,this.start=o||this.start;var f={};if(h&&(f.position=new iE().copyFrom(h.position),h.quat?f.quat=new iS(h.quat.x,h.quat.y,h.quat.z,h.quat.w):f.rotation=new rb().copyFrom(null!=(d=h.eulerHint)?d:h.rotation),f.scale=new iE().copyFrom(h.scale),h.size&&(f.size=new iT().copyFrom(h.size)),h.anchor&&(f.anchor=new iT().copyFrom(h.anchor)),this.transform.setTransform(f)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=s,this.duration=l,this.endBehavior=u,r.content||(r.content={options:{}}),l<0)throw Error("Item duration can't be less than 0, see "+nM["Item duration can't be less than 0"]+".");if(r.components){this.components.length=0;for(var d,p,m=ep(r.components);!(p=m()).done;){var v=p.value,y=this.engine.findObject(v);this.components.push(y),em(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=t0.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,n=ep(this.components);!(r=n()).done;){var a=r.value;em(a,t.EffectComponent)&&this.defination.components.push(a)}}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=ep(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=ep(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&eC(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,n=i.components,a=ep(n);!(r=a()).done;){var o=r.value,s=this.engine.findObject(o);if(s.item=this,this.components.push(s),s.setInstanceId(eJ()),em(s,t.CompositionComponent))for(var u,h=ep(s.items);!(u=h()).done;){var c=u.value;c.setInstanceId(eJ());for(var l,f=ep(c.components);!(l=f()).done;)l.value.setInstanceId(eJ())}}oP.buildItemTree(this)},r.resetGUID=function(t){var e=null!=(i=null==t?void 0:t.get(this))?i:eJ();this.setInstanceId(e);for(var i,r,n=ep(this.components);!(r=n()).done;){var a,o=r.value,s=null!=(a=null==t?void 0:t.get(o))?a:eJ();o.setInstanceId(s)}for(var u,h=ep(this.children);!(u=h()).done;)u.value.resetGUID(t)},r.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=ep(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=ep(this.children);!(n=a()).done;)n.value.gatherPreviousObjectID(t)},i.isComposition=function(t){return t.type===tw.composition},i.isSprite=function(t){return t.type===tw.sprite},i.isParticle=function(t){return t.type===tw.particle},i.isNull=function(t){return t.type===tw.null},i.isTree=function(t){return t.type===tw.tree},i.isCamera=function(t){return t.type===tw.camera},i.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},ir(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=ep(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=ep(this.components);!(e=i()).done;){var r=e.value;em(r,im)&&(r.priority=t)}}}},{key:"isActive",get:function(){return this.active}},{key:"isVisible",get:function(){return this.visible}}]),i}(il),t.VFXItem=ey([iu(t0.VFXItemData)],t.VFXItem),t.Item=void 0,(tl=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tl.isComposition=function(t){return t.type===tw.composition},tl.isParticle=function(t){return t.type===tw.particle},tl.isNull=function(t){return t.type===tw.null};var oL=[1,1,1,1],oV=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}e7(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n,a=e.output.getUserData();if(em(a,t.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(a)),!this.activeMaterial){this.activeMaterial=null==(o=this.activeComponent)?void 0:o.material;var o,s,u=null==(s=this.activeMaterial)?void 0:s.getColor("_Color");u&&(this.startColor=u.toArray())}var h=nZ(oL,1),c=this.time/a.duration,l=this.opacityOverLifetime,f=this.colorOverLifetime;f&&(h=ew(f,c,!0),i=!0),l&&(h[3]*=l.getValue(c),i=!0),i&&(nq(this.renderColor,h,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=aC(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tL.GRADIENT_COLOR&&(this.colorOverLifetime=eO(i.color[1]))),this},r.getActiveComponent=function(t){return t.getComponent(nL)},i}(aP),oF=[[0,0,1,1,void 0]],oD=0;function ok(e){t.maxSpriteMeshItemCount=e}t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e7(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new oV(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(aV),t.SpriteColorPlayableAsset=ey([iu(t0.SpriteColorPlayableAsset)],t.SpriteColorPlayableAsset),t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).splits=oF,r.frameAnimationLoop=!1,r.name="MSprite"+oD++,r.geometry=r.createGeometry(),i&&r.fromData(i),r}e7(i,e);var r=i.prototype;return r.onUpdate=function(t){var e=this,i=this.item.time,r=this.item.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)})),a){var s,u,h,c,l,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,c=1/a.col*v):(h=1/a.col*m,c=1/a.row*v),a.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/a.col),b=g-x*a.col;l=u?[h*x,c*(a.col-b)]:[h*b,c*(1+x)]}else l=[0,c];null==(s=this.material.getVector4("_TexOffset"))||s.setFromArray([d+l[0],v+p-l[1],h,c])}},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.getItemGeometryData=function(t){var e=this.splits,i=this.textureSheetAnimation,r=this.renderer;if(r.shape){for(var n=r.shape,a=n.index,o=n.aPoint,s=void 0===o?[]:o,u=new Float32Array(s),h=[],c=[],l=0;l<u.length;l+=6)u[l]*=1,u[l+1]*=1,c.push(s[l+2],s[l+3]),h.push(u[l],u[l+1],0);return t.setAttributeData("aPos",new Float32Array(h)),{index:void 0===a?[]:a,atlasOffset:c}}var f=[],d=[],p=2,m=2;1===e.length&&(p=1,m=1);for(var v=[],y=0;y<p;y++)for(var g=0;g<m;g++){var x=(2*g+y)*4,b=i?[0,0,1,1,e[0][4]]:e[2*g+y],T=b[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],E=((y+y+1)/p-1)/2,_=((g+g+1)/m-1)/2,C=b[0],A=b[1],S=b[4]?b[3]:b[2],w=b[4]?b[2]:b[3],O=[-.5/p+E,.5/m+_,-.5/p+E,-.5/m+_,.5/p+E,.5/m+_,.5/p+E,-.5/m+_];f.push(T[0]*S+C,T[1]*w+A,T[2]*S+C,T[3]*w+A,T[4]*S+C,T[5]*w+A,T[6]*S+C,T[7]*w+A),v.push(1*O[0],1*O[1],0,1*O[2],1*O[3],0,1*O[4],1*O[5],0,1*O[6],1*O[7],0),d.push(x,1+x,2+x,2+x,1+x,3+x)}return t.setAttributeData("aPos",new Float32Array(v)),{index:d,atlasOffset:f}},r.fromData=function(t){e.prototype.fromData.call(this,t);var i=t.interaction,r=t.options;this.interaction=i,this.splits=t.splits||oF,this.textureSheetAnimation=t.textureSheetAnimation;var n=this.createGeometry();this.geometry=n;var a=r.startColor||[1,1,1,1];this.material.setColor("_Color",new iA().setFromArray(a))},i}(nL),t.SpriteComponent=ey([iu(t0.SpriteComponent)],t.SpriteComponent),t.maxSpriteMeshItemCount=8;var oN=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e}(e8),oz=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e}(e8),oU=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}(),oB=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new oU(aF(i)),i}return e7(e,t),e}(aP),oG=new rb,oj=new iE(1,1,1),oX=new iE,oH=function(e){function i(){return e.apply(this,arguments)}e7(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 iE(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=aC(r.path));var o=r.linearX||r.linearY||r.linearZ;o&&(this.linearVelOverLifetime={x:r.linearX&&aC(r.linearX),y:r.linearY&&aC(r.linearY),z:r.linearZ&&aC(r.linearZ),asMovement:r.asMovement,enabled:!!o});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&aC(r.orbitalX),y:r.orbitalY&&aC(r.orbitalY),z:r.orbitalZ&&aC(r.orbitalZ),center:nY(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&aC(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=aC(a.x||1),this.sizeYOverLifetime=aC(a.y||1),this.sizeZOverLifetime=aC(a.z||1)):this.sizeXOverLifetime=aC(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:aC(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=aC(n.x||0),u.y=aC(n.y||0)}this.gravity=iE.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=aC(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?iE.fromArray(r.direction).normalize():new iE,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();em(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){oj.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(oj.y=this.sizeYOverLifetime.getValue(r),oj.z=this.sizeZOverLifetime.getValue(r)):oj.z=oj.y=oj.x;var n=this.originalTransform.scale;e.transform.setScale(oj.x*n.x,oj.y*n.y,oj.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;oG.x=s?a(this.rotationOverLifetime.x):0,oG.y=s?a(this.rotationOverLifetime.y):0,oG.z=o;var u=oG.addEulers(this.originalTransform.rotation,oG);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(nW(oX,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&oX.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(oX.x,oX.y,oX.z))},i}(oB);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}e7(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new oH(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(aV),t.TransformPlayableAsset=ey([iu(t0.TransformPlayableAsset)],t.TransformPlayableAsset);var oW=function(e){function i(){return e.apply(this,arguments)}return e7(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();em(i,t.VFXItem)&&(i.time=this.time)},i}(aP);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e.prototype.createPlayable=function(t){return new oW(t)},e}(aV),t.ActivationPlayableAsset=ey([iu(t0.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.scaleCurves=[],e.floatCurves=[],e}e7(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){var i=e/t.duration;i=i<0?0:i>1?1:i;for(var r,n=ep(this.positionCurves);!(r=n()).done;){var a=r.value,o=a.keyFrames.getValue(i),s=this.findTarget(t,a.path);null==s||s.transform.setPosition(o.x,o.y,o.z)}for(var u,h=ep(this.rotationCurves);!(u=h()).done;){var c=u.value,l=c.keyFrames.getValue(i),f=this.findTarget(t,c.path);null==f||f.transform.setQuaternion(l.x,l.y,l.z,l.w)}for(var d,p=ep(this.scaleCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(i),y=this.findTarget(t,m.path);null==y||y.transform.setScale(v.x,v.y,v.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,i=ep(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:aC(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var a,o=ep(t.rotationCurves);!(a=o()).done;){var s=a.value,u={path:s.path,keyFrames:aC(s.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var h,c=ep(t.scaleCurves);!(h=c()).done;){var l=h.value,f={path:l.path,keyFrames:aC(l.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=ep(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:aC(m.keyFrames),property:m.property,className:m.className};this.duration=Math.max(this.duration,v.keyFrames.getMaxTime()),this.floatCurves.push(v)}},i.findTarget=function(t,e){for(var i,r=t,n=ep(e);!(i=n()).done;){for(var a,o=i.value,s=!1,u=ep(r.children);!(a=u()).done;){var h=a.value;if(h.name===o){r=h,s=!0;break}}if(!s)return}return r},e}(il),t.AnimationClip=ey([iu(t0.AnimationClip)],t.AnimationClip);var oY=function(e){function i(){return e.apply(this,arguments)}return e7(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();em(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(aP),oZ=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},ir(t,null,[{key:"shared",get:function(){return oq.x=0,oq.y=0,oq}}]),t}(),oq=new oZ;function oQ(t,e,i,r,n,a,o,s){o?(u=r,h=-i):(u=-r,h=i);var u,h,c=t-i*n+u,l=e-r*n+h,f=t+i*a+u,d=e+r*a+h;return s.push(c,l),s.push(f,d),2}function oK(t,e,i,r,n,a,o,s){var u=i-t,h=r-e,c=Math.atan2(u,h),l=Math.atan2(n-t,a-e);s&&c<l?c+=2*Math.PI:!s&&c>l&&(l+=2*Math.PI);var f=c,d=l-c,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 oJ(t,e,i,r,n,a,o,s,u){if(0!==t.length){var h=e.alignment;if(.5!==e.alignment){var c=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&&(c*=-1),h=(h-.5)*c+.5}var l=new oZ(t[0],t[1]),f=new oZ(t[t.length-2],t[t.length-1]),d=1e-4>Math.abs(l.x-f.x)&&1e-4>Math.abs(l.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=(l.x+f.x)*.5,m=(f.y+l.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],A=t[3],S=0,w=0,O=-(_-A),M=E-C,R=0,I=0,P=Math.sqrt(O*O+M*M)+1e-6;O/=P,M/=P,O*=x,M*=x;var L=h,V=(1-L)*2,F=2*L;r||(e.cap===tQ.Round?y+=oK(E-O*(V-F)*.5,_-M*(V-F)*.5,E-O*V,_-M*V,E+O*F,_+M*F,n,!0)+2:e.cap===tQ.Square&&(y+=oQ(E,_,O,M,V,F,!0,n))),n.push(E-O*V,_-M*V),n.push(E+O*F,_+M*F);for(var D=1;D<v-1;++D){E=t[(D-1)*2],_=t[(D-1)*2+1],C=t[2*D],A=t[2*D+1],S=t[(D+1)*2],w=t[(D+1)*2+1],P=Math.sqrt((O=-(_-A))*O+(M=E-C)*M)+1e-6,O/=P,M/=P,O*=x,M*=x,P=Math.sqrt((R=-(A-w))*R+(I=C-S)*I)+1e-6,R/=P,I/=P,R*=x,I*=x;var k=C-E,N=_-A,z=C-S,U=w-A,B=k*z+N*U,G=N*z-U*k,j=G<0;if(Math.abs(G)<.001*Math.abs(B)){n.push(C-O*V,A-M*V),n.push(C+O*F,A+M*F),B>=0&&(e.join===tK.Round?y+=oK(C,A,C-O*V,A-M*V,C-R*V,A-I*V,n,!1)+4:y+=2,n.push(C-R*F,A-I*F),n.push(C+R*V,A+I*V));continue}var X=(-O+E)*(-M+A)-(-O+C)*(-M+_),H=(-R+S)*(-I+A)-(-R+C)*(-I+w),W=(k*H-z*X)/G,Y=(U*X-N*H)/G,Z=(W-C)*(W-C)+(Y-A)*(Y-A),q=C+(W-C)*V,Q=A+(Y-A)*V,K=C-(W-C)*F,J=A-(Y-A)*F,$=j?V:F;Z<=Math.min(k*k+N*N,z*z+U*U)+$*$*b?e.join===tK.Bevel||Z/b>T?(j?(n.push(q,Q),n.push(C+O*F,A+M*F),n.push(q,Q),n.push(C+R*F,A+I*F)):(n.push(C-O*V,A-M*V),n.push(K,J),n.push(C-R*V,A-I*V),n.push(K,J)),y+=2):e.join===tK.Round?j?(n.push(q,Q),n.push(C+O*F,A+M*F),y+=oK(C,A,C+O*F,A+M*F,C+R*F,A+I*F,n,!0)+4,n.push(q,Q),n.push(C+R*F,A+I*F)):(n.push(C-O*V,A-M*V),n.push(K,J),y+=oK(C,A,C-O*V,A-M*V,C-R*V,A-I*V,n,!1)+4,n.push(C-R*V,A-I*V),n.push(K,J)):(n.push(q,Q),n.push(K,J)):(n.push(C-O*V,A-M*V),n.push(C+O*F,A+M*F),e.join===tK.Round?j?y+=oK(C,A,C+O*F,A+M*F,C+R*F,A+I*F,n,!0)+2:y+=oK(C,A,C-O*V,A-M*V,C-R*V,A-I*V,n,!1)+2:e.join===tK.Miter&&Z/b<=T&&(j?(n.push(K,J),n.push(K,J)):(n.push(q,Q),n.push(q,Q)),y+=2),n.push(C-R*V,A-I*V),n.push(C+R*F,A+I*F),y+=2)}E=t[(v-2)*2],_=t[(v-2)*2+1],C=t[(v-1)*2],P=Math.sqrt((O=-(_-(A=t[(v-1)*2+1])))*O+(M=E-C)*M)+1e-6,O/=P,M/=P,O*=x,M*=x,n.push(C-O*V,A-M*V),n.push(C+O*F,A+M*F),r||(e.cap===tQ.Round?y+=oK(C-O*(V-F)*.5,A-M*(V-F)*.5,C-O*V,A-M*V,C+O*F,A+M*F,n,!1)+2:e.cap===tQ.Square&&(y+=oQ(C,A,O,M,V,F,!1,n)));for(var tt=g;tt<y+g-2;++tt)E=n[2*tt],_=n[2*tt+1],C=n[(tt+1)*2],A=n[(tt+1)*2+1],S=n[(tt+2)*2],1e-8>Math.abs(E*(A-(w=n[(tt+2)*2+1]))+C*(w-_)+S*(_-A))||s.push(tt,tt+1,tt+2)}}var o$=function(){},o0="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o1={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 c(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 l(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=Q(t),t.a.c=t.c,m(t,Q(t)),i||y(t,t.d)),e.c===e?(x(e.a,null),b(e.d,null)):(t.d.a=Q(e),e.a.c=e.c,m(e,Q(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,Q(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 A(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 S(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){l(t.a),t.c=!1,t.a=e,e.i=t}function O(t){var e=t.a.a;do t=tc(t);while(t.a.a===e);return t.c&&(e=d(th(t).a.b,t.a.e),w(t,e),t=tc(t)),t}function M(t,e,i){var r=new tu;return r.a=i,r.e=G(t.f,e.e,r),i.i=r}function R(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 I(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,S(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){I(t);break}w(r,n=d(e.c.b,n.b))}e.c!==n&&(c(Q(n),n),c(e,n)),I(t),e=r.a,t=r}return e}function L(t,e,i,r,n,a){var o=!0;do M(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&&(c(Q(i),i),c(Q(n),i)),r.f=e.f-i.f,r.d=R(t,r.f),e.b=!0,!o&&k(t,e)&&(C(i,n),S(e),l(n)),o=!1,e=r,n=i;e.b=!0,a&&z(t,e)}function V(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 F(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),c(e,i)}function D(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 k(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,l=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(l[h[p>>1]],l[h[p]])?to(a,p):ts(a,p)),l[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;F(t,Q(s),o)}}else f(s.b),c(o,Q(s)),r.b=a.b=!0}else{if(0>n(o.b.a,s.a,o.a))return!1;tc(r).b=r.b=!0,f(o.b),c(Q(s),o)}return!0}function N(t,h){var l=th(h),d=h.a,p=l.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,A=v;if(i(E,_)||(b=E,E=_,_=b),i(C,A)||(b=C,C=A,A=b),i(E,C)||(b=E,E=C,C=b,b=_,_=A,A=b),i(C,_)?i(_,A)?(0>(b=r(E,C,_))+(T=r(C,_,A))&&(b=-b,T=-T),x.b=u(b,C.b,T,_.b)):(0>(b=n(E,C,_))+(T=-n(E,A,_))&&(b=-b,T=-T),x.b=u(b,C.b,T,A.b)):x.b=(C.b+_.b)/2,a(E,_)||(b=E,E=_,_=b),a(C,A)||(b=C,C=A,A=b),a(E,C)||(b=E,E=C,C=b,b=_,_=A,A=b),a(C,_)?a(_,A)?(0>(b=o(E,C,_))+(T=o(C,_,A))&&(b=-b,T=-T),x.a=u(b,C.a,T,_.a)):(0>(b=s(E,C,_))+(T=-s(E,A,_))&&(b=-b,T=-T),x.a=u(b,C.a,T,A.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 k(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),c(p.b,d),d=th(h=O(h)).a,P(t,th(h),l),L(t,h,Q(d),d,d,!0),!0;if(y===t.a){f(p.b),c(d.e,Q(p)),v=(m=l=h).a.b.a;do m=tc(m);while(m.a.b.a===v);return m=th(h=m).a.b.c,l.a=Q(p),p=P(t,l,null),L(t,h,p.c,d.b.c,m,!0),!0}return 0<=n(y,t.a,x)&&(tc(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=l.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),c(Q(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,D(d,m,y,p,0),D(d,v,g,p,2),V(t,d,x,p,!0),tc(h).b=h.b=l.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=tc(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}tc(a).b=a.b=!0,p=f(h),c(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),c(h.e,d.b),p.b.d.c=a.d}a=!0}if(a&&(r.c?(S(r),l(s),s=(r=th(e)).a):e.c&&(S(e),l(o),o=(e=tc(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)k(t,e);else if(N(t,e))break}o.a===s.a&&o.b.a===s.b.a&&(C(s,o),S(e),l(o),e=tc(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=A}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 Q(t){return t.b.e}function K(){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 tc(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)?c(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 K,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&&(F(this,o,a),l(a),o=(a=o).e),o.e===a&&(o!==a&&((o===u||o===u.b)&&(u=u.h),l(o)),(a===u||a===u.b)&&(u=u.h),l(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),F(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&&(l(u.c),h.c=!1),c(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=M(o,h,m)).f=tc(h).f+h.a.f,h.d=R(u,h.f)),t(o,s)):L(o,h,s.c,s.c,null,!0)}return}if(h=(u=th(o=O(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&&N(r,o),e(m.a,r.a)&&(c(Q(u),m),u=th(o=O(o)).a,P(r,th(o),p),y=!0),e(v.a,r.a)&&(c(h,Q(v)),h=P(r,p,null),y=!0),y?L(r,o,h.c,u,u,!0):(s=i(v.a,m.a)?Q(v):m,L(r,o,s=d(h.c.b,s),s.c,s.c,!1),s.b.i.c=!0,z(r,o))}else L(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,S(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),l(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:l(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,Q(v))),(p=v.b).c===p?x(p.a,null):(p.a.c=p.c,m(p,Q(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},o0.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=o0.libtess}(o1);var o2=((tf=new o1.exports.GluTesselator).gluTessCallback(o1.exports.gluEnum.GLU_TESS_VERTEX_DATA,function(t,e){e[e.length]=t[0],e[e.length]=t[1]}),tf.gluTessCallback(o1.exports.gluEnum.GLU_TESS_BEGIN,function(t){t!==o1.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)}),tf.gluTessCallback(o1.exports.gluEnum.GLU_TESS_ERROR,function(t){console.error("error callback, error number: "+t)}),tf.gluTessCallback(o1.exports.gluEnum.GLU_TESS_COMBINE,function(t,e,i){return[t[0],t[1],t[2]]}),tf.gluTessCallback(o1.exports.gluEnum.GLU_TESS_EDGE_FLAG,function(t){}),tf);function o3(t){o2.gluTessNormal(0,0,1);var e=[];o2.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){o2.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];o2.gluTessVertex(a,a)}o2.gluTessEndContour()}return o2.gluTessEndPolygon(),e}var o4=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}e7(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=o3([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],c=t[u+1];h<n&&(n=h,a=c),h>o&&(o=h,s=c)}else for(var l=0;l<t.length;l+=2){var f=t[l],d=t[l+1];d<a&&(n=f,a=d),d>s&&(o=f,s=d)}e.push(n,a,o,s,o,s)},ir(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(o$);function o5(t,e,i,r,n,a,o,s,u,h){var c=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function t(e,i,r,n,a,o,s,u,h,c,l){if(!(l>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(l>0){var C=s-e,A=u-i,S=Math.abs((r-s)*A-(n-u)*C),w=Math.abs((a-s)*A-(o-u)*C);if(S>11920929e-14&&w>11920929e-14){if((S+w)*(S+w)<=c*(C*C+A*A)){h.push(E,_);return}}else if(S>11920929e-14){if(S*S<=c*(C*C+A*A)){h.push(E,_);return}}else if(w>11920929e-14){if(w*w<=c*(C*C+A*A)){h.push(E,_);return}}else if((C=E-(e+s)/2)*C+(A=_-(i+u)/2)*A<=c){h.push(E,_);return}}t(e,i,f,d,g,x,E,_,h,c,l+1),t(E,_,b,T,v,y,s,u,h,c,l+1)}}(e,i,r,n,a,o,s,u,t,c*=c,0),t.push(s,u),t}var o6=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}e7(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,c=t-this.x,l=e-this.y;return c*c/(o*o)+l*l/(s*s)>1&&c*c/(u*u)+l*l/(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,c=o,l=0+r,f=0,d=e+l,p=e-l,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[--c]=_,t[--c]=b}l=0,f=0+n,d=e+l,p=e-l,m=i+f;var C=i-f;return t[s++]=d,t[s++]=m,t[--c]=C,t[--c]=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++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(o$);t.StarType=void 0,(td=t.StarType||(t.StarType={}))[td.Star=0]="Star",td[td.Polygon=1]="Polygon";var o8=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}e7(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)o5(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;o5(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=o3([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,c=this.innerRoundness/100,l=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:c,r=o?l: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),c=0===s&&0===u?0:-s/Math.sqrt(s*s+u*u),l=2*t;this.v[l]=s,this.v[l+1]=u,this.in[l]=s+h*a*n*1,this.in[l+1]=u+c*a*n*1,this.out[l]=s-h*a*n*1,this.out[l+1]=u-c*a*n*1,o+=1*i}},e}(o$),o9=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}e7(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)),c=8*h+(s?4:0)+(u?4:0);if(0!==c){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 l=0,f=4*h+(s?2:0)+2,d=f,p=c,m=s+o,v=u,y=n+m,g=n-m,x=a+v;if(t[l++]=y,t[l++]=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,A=n+_,S=n-_,w=a+C,O=a-C;t[l++]=A,t[l++]=w,t[--f]=w,t[--f]=S,t[d++]=S,t[d++]=O,t[--p]=O,t[--p]=A}m=s,v=u+e,y=n+m,g=n-m,x=a+v;var M=a-v;t[l++]=y,t[l++]=x,t[--p]=M,t[--p]=y,s&&(t[l++]=g,t[l++]=x,t[--p]=M,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++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(o$),o7=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=ep(e.instructions);!(t=i()).done;){var r=t.value,n=r.action,a=r.data;switch(n){case"bezierCurveTo":this.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"moveTo":this.moveTo(a[0],a[1]);break;case"ellipse":this.ellipse(a[0],a[1],a[2],a[3],a[4]);break;case"polyStar":this.polyStar(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"rect":this.rect(a[0],a[1],a[2],a[3],a[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 o5(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 o6(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,a,o){return this.drawShape(new o8(t,e,i,r,n,a),o),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new o9(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 o4).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 o4,this.currentPoly.points.push(0,0))},t}(),st=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},ir(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new o7(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function se(t,e){return e&&("object"===ev(e)||"function"==typeof e)?e:aF(t)}var si=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 eU(t),t}if(aW[aH])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?e_(this.elements,t):t.remove()},t}()),sr=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tX.clip:r,a=t.textBaseline,o=void 0===a?tH.top:a,s=t.textAlign,u=void 0===s?tW.left:s,h=t.text,c=t.letterSpace,l=void 0===c?0:c,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=(void 0===h?" ":h).length*(d+l),this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.letterSpace=l,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 tH.top:h=s+o;break;case tH.middle:h=(this.height*a-u+s)/2;break;case tH.bottom:h=this.height*a-u-o}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tW.left:i=t.outlineWidth*t.fontScale;break;case tW.middle:i=(this.width*t.fontScale-e)/2;break;case tW.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),sn=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,c=t.shadow,l=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,this.textWeight=void 0===l?"normal":l,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),c&&(this.hasShadow=!0,this.shadowBlur=null!=(r=c.shadowBlur)?r:2,this.shadowColor=null!=(n=c.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(a=c.shadowOffsetX)?a:0,this.shadowOffsetY=null!=(o=c.shadowOffsetY)?o:0),this.fontStyle!==tZ.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},sa=["serif","sans-serif","monospace","courier"],so=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"+so++,r.geometry=r.createGeometry(),i&&r.fromData(i),r.canvas=si.getCanvas(),si.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return se(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}e7(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 iA(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(nL),t.TextComponent=ey([iu(t0.TextComponent)],t.TextComponent);var ss=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new sn(t),this.textLayout=new sr(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,c=0;c<t.length;c++){var l,f,d=t[c],p=(null!=(f=null==i?void 0:null==(l=i.measureText(d))?void 0:l.width)?f:0)*o;h+=n,a===tX.display?"\n"===d?(u++,h=0):(h+=p,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+p>s&&c>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&&!eB(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===tX.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 c=[],l=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);((l+=r.letterSpace*n)+y.width>a&&m>0||"\n"===v)&&(c.push({y:f,width:l,chars:d,charOffsetX:p}),l=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(l),l+=y.width)}c.push({y:f,width:l,chars:d,charOffsetX:p}),c.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=i4.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:iM.LINEAR,minFilter:iM.LINEAR,wrapS:iM.CLAMP_TO_EDGE,wrapT:iM.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 sa.includes(n)?s+=n:s+='"'+n+'"',a!==tY.normal&&(s=a+" "+s),o!==tZ.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}();e0(t.TextComponent,[ss]);var su=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e}(e8),sh=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e}(il);t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return e7(e,t),e}(il),ey([ic(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=ey([iu(t0.BinaryAsset)],t.BinaryAsset);var sc=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=ih(e);if(r)for(var n,a=ep(Object.keys(r));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[o]=s:eW(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],0)):il.is(s)?i[o]={id:s.getInstanceId()}:eZ(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],0))}for(var u,h=ep(Object.keys(e.defination));!(u=h()).done;){var c=u.value,l=e.defination[c];"number"==typeof l||"string"==typeof l||"boolean"==typeof l||t.checkTypedArray(l)?i[c]=l:eW(l)?(i[c]||(i[c]=[]),t.serializeArrayProperty(l,i[c],0)):il.is(l)?i[c]={id:l.getInstanceId()}:eZ(l)&&(i[c]||(i[c]={}),t.serializeObjectProperty(l,i[c],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=ih(i),n=i.engine;if(r)for(var a,o=ep(Object.keys(r));!(a=o()).done;){var s=a.value,u=e[s];if(void 0!==u){var h=r[s].type;i[s]=t.deserializeProperty(u,n,0,h)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return em(t,Int8Array)||em(t,Uint8Array)||em(t,Uint8ClampedArray)||em(t,Int16Array)||em(t,Uint16Array)||em(t,Int32Array)||em(t,Uint32Array)||em(t,Float32Array)||em(t,Float64Array)||em(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(eZ(t)&&1===Object.keys(t).length&&"id"in t&&eH(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return eZ(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return eq(t)||em(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(eW(e)){for(var o,s=[],u=ep(e);!(o=u()).done;){var h=o.value;s.push(t.deserializeProperty(h,i,r+1,n,a))}return s}if(t.checkDataPath(e)){var c=i.findObject(e);return a?c:e}if(!eZ(e)||e.constructor!==Object)return e;l=n?new n:{};for(var l,f,d=ep(Object.keys(e));!(f=d()).done;){var p=f.value;l[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return l},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 n,a=ep(Object.keys(e));!(n=a()).done;){var o=n.value,s=e[o];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[o]=s:eW(s)?(i[o]||(i[o]=[]),t.serializeArrayProperty(s,i[o],r+1)):il.is(s)?i[o]={id:s.getInstanceId()}:eZ(s)&&(i[o]||(i[o]={}),t.serializeObjectProperty(s,i[o],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:eW(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):il.is(a)?i[n]={id:a.getInstanceId()}:eZ(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}},t}(),sl=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){var i,r=e.id;if(!e)return null;var n=this.findData(r);if(!n){console.error("Object data with uuid: "+r+" not found.");return}switch(n.dataType){case t0.Material:i=ra.create(this.engine);break;case t0.Geometry:i=rg.create(this.engine);break;case t0.Texture:i=i4.create(this.engine);break;default:var a=t.getClass(n.dataType);a&&(i=new a(this.engine))}if(!i){console.error("Constructor for DataType: "+n.dataType+" not found.");return}return i.setInstanceId(n.id),this.engine.addInstance(i),sc.deserialize(n,i),i},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return is[t]},t}(),sf=function(){function t(){}return t.prototype.loadGUID=function(t){return ef(function(){return eg(this,function(t){return[2,void 0]})})()},t}();function sd(t,e){if(!t.includes(e))return t.push(e),!0}function sp(t){if(Number.isFinite(t))return[tL.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tL.CONSTANT)return[tL.CONSTANT,t[1]];if("lines"===e)return[tL.LINE,t[1]];if(e===tL.LINE){var r=i.map(function(t){return[tV.LINE,t]});return[tL.BEZIER_CURVE,r]}return"curve"===e||e===tL.CURVE?[tL.BEZIER_CURVE,sI(i)]:t}}function sm(t,e){return Array.isArray(t)&&"random"===t[0]?[tL.CONSTANT,t[1][e]]:sp(t)}function sv(t){return t&&"color"===t[0]?sx(t[1],!0):[1,1,1,1]}function sy(t){return t&&"random"===t[0]?[tL.RANDOM,t[1]]:sp(t)}function sg(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=sx(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]}),[tL.GRADIENT_COLOR,i]}}function sx(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 em(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=sb(i)),i}function sb(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function sT(t,e){return Array.isArray(t)?t[0]===tL.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&sg(t[1],e):sg(t,e)}function sE(t){if(t){if(3===t.length)return[tL.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tL.BEZIER_PATH||e===tL.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],o=sI(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[tL.BEZIER_CURVE_PATH,[o,n,a]]}return t}}function s_(t){for(var e,i=ep(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function sC(t){for(var e,i=ep(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var sA=Math.cos,sS=Math.sin,sw=Math.PI/180,sO=180/Math.PI;function sM(t,e){return t?[t[0]-.5,.5-t[1]]:e?sR[e]:[0,0]}var sR=((ei={})[tM.PARTICLE_ORIGIN_CENTER]=[0,0],ei[tM.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],ei[tM.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],ei[tM.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],ei[tM.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],ei[tM.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],ei[tM.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],ei[tM.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],ei[tM.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],ei);function sI(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 c=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),l=c[0],f=c[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[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?[tV.EASE_OUT,t]:e===n.length-1?[tV.EASE_IN,t]:[tV.EASE,t]})}function sP(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tw.null&&t.endBehavior===tF.destroy&&(t.endBehavior=tF.freeze)})}),t.version=tg["2_1"],t}var sL=new Map,sV=new Map,sF=new Map;function sD(t){for(var e,i=ep(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===t0.ShapeComponent&&r.type===tq.Custom){(null==(n=r.shapes)?void 0:n.length)>0&&r.shapes[0].fill&&(r.fill=r.shapes[0].fill);for(var n,a,o=Array(r.easingIns.length),s=Array(r.easingOuts.length).fill(!1),u=ep(r.shapes);!(a=u()).done;)for(var h,c=a.value,l=ep(c.indexes);!(h=l()).done;){var f=h.value,d=r.points[f.point],p=r.easingIns[f.easingIn],m=r.easingOuts[f.easingOut];o[f.easingIn]||(p.x-=d.x,p.y-=d.y,o[f.easingIn]=!0),s[f.easingOut]||(m.x-=d.x,m.y-=d.y,s[f.easingOut]=!0)}}}return t}function sk(e){sL.clear(),sV.clear(),sF.clear();for(var i,r=e.compositions,n=e.items,a=e.components,o=r[0],s=ep(a);!(i=s()).done;){var u=i.value;sL.set(u.id,u)}for(var h,c=ep(r);!(h=c()).done;){var l=h.value;l.id===e.compositionId?o=l:sF.set(l.id,l)}for(var f,d=ep(n);!(f=d()).done;){var p=f.value;sV.set(p.id,p)}return function e(i){for(var r,n=ep(i.items);!(r=n()).done;){var a=r.value,o=sV.get(a.id);if(!o)return;if(o.type===tw.sprite||o.type===tw.particle||o.type===tw.spine||o.type===tw.text||o.type===tw.richtext||o.type===tw.video||o.type===tw.shape){var s=sL.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={mask:!0},er=e.id):(r===tE.OBSCURED||r===tE.REVERSE_OBSCURED)&&(e.mask={mode:r,ref:{id:er}}))}(s)}if(o.type===tw.composition){var u=o.content.options.refId,h=sF.get(u);h&&e(h)}}}(o),e}function sN(t){null==(e=t.plugins)||e.forEach(function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")});for(var e,i,r=ep(t.items);!(i=r()).done;){var n=i.value;if(n.type===tw.sprite){var a=sL.get(n.components[0].id);if(a){var o=a.renderer.shape,s=void 0;s=Number.isInteger(o)?t.shapes[o]:o,a.renderer.shape=s}}}for(var u,h=t.compositionId,c={},l=ep(t.compositions);!(u=l()).done;){var f=u.value,d=eJ();c[f.id]=d,f.id===h&&(t.compositionId=d),f.id=d;var p={id:eJ(),dataType:"CompositionComponent",items:f.items,timelineAsset:f.timelineAsset,sceneBindings:f.sceneBindings,startTime:f.startTime};f.timelineAsset=void 0,f.sceneBindings=void 0,f.startTime=void 0,f.components=[{id:p.id}],t.components.push(p)}for(var m,v=ep(t.items);!(m=v()).done;){var y=m.value;if(y.content){var g=y.content.options;g&&void 0!==g.refId&&(g.refId=c[g.refId])}}return t}function sz(t){for(var e,i=iD({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=ep(i.images);!(e=r()).done;)e.value.id=eJ();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=eJ(),t.dataType=t0.Texture,t.source={id:null==(e=i.images[t.source])?void 0:e.id}}),i.textures.length<i.images.length)for(var n=i.textures.length;n<i.images.length;n++)i.textures.push({id:eJ(),dataType:t0.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(a=t.bins,i.bins=a.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eJ()}}));for(var a,o,s={},u={},h=ep(t.compositions);!(o=h()).done;)!function(){var t=o.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=tF.freeze),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tw.particle&&t.content.filter&&delete t.content.filter});for(var e,r=ep(t.items);!(e=r()).done;){var n=e.value;s[n.id]=eJ(),n.oldId=n.id,n.id=s[n.id],u[n.id]=n}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=s[n]+"^"+a}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var a=iD({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(a),function(t,e,i){for(var r,n=[],a=[],o=[],s={tracks:[],id:eJ(),dataType:"TimelineAsset"},u=ep(t.items);!(r=u()).done;){var h=e[r.value.id],c=[],l={id:eJ(),dataType:"ActivationPlayableAsset"};o.push(l);var f={id:eJ(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:l.id}}]};if(c.push({id:f.id}),a.push(f),h.type!==tw.particle){var d={id:eJ(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};o.push(d);var p={id:eJ(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};c.push({id:p.id}),a.push(p)}if(h.type===tw.sprite||h.type===tw.text){var m={id:eJ(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};o.push(m);var v={id:eJ(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};c.push({id:v.id}),a.push(v)}if(h.type===tw.composition){var y={id:eJ(),dataType:"SubCompositionPlayableAsset"};o.push(y);var g={id:eJ(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};c.push({id:g.id}),a.push(g)}var x={id:eJ(),dataType:"ObjectBindingTrack",children:c,clips:[]};a.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],E=ep(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var C,A=ep(a);!(C=A()).done;){var S=C.value;i.miscs.push(S)}for(var w,O=ep(o);!(w=O()).done;){var M=w.value;i.miscs.push(M)}}(a,u,i)}();for(var c,l=ep(i.items);!(c=l()).done;){var f=c.value;if(f.content){if(f.content.renderer&&void 0!==f.content.renderer.texture){var d=f.content.renderer.texture;f.content.renderer.texture={id:i.textures[d].id}}if(f.content.trails&&void 0!==f.content.trails.texture){var p=f.content.trails.texture;f.content.trails.texture={id:i.textures[p].id}}}if(f.transform){var m=[].concat(null!=(g=f.transform.position)?g:[0,0,0]),v=[].concat(null!=(x=f.transform.rotation)?x:[0,0,0]),y=[].concat(null!=(b=f.transform.scale)?b:[1,1,1]);if(Object.assign(f,{transform:{position:{x:m[0],y:m[1],z:m[2]},eulerHint:{x:v[0],y:v[1],z:v[2]},scale:{x:y[0],y:y[1],z:y[0]}}}),f.type===tw.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tw.sprite){var g,x,b,T,E,_,C,A=f.content;A.renderer||(A.renderer={});var S=A.renderer,w=sM(S.anchor,S.particleOrigin),O=f.transform.size;S.anchor||void 0===S.particleOrigin||(f.transform.position.x+=-w[0]*(null!=(T=null==O?void 0:O.x)?T:1),f.transform.position.y+=-w[1]*(null!=(E=null==O?void 0:O.y)?E:1)),f.transform.anchor={x:w[0]*(null!=(_=null==O?void 0:O.x)?_:1),y:w[1]*(null!=(C=null==O?void 0:O.y)?C:1)}}}if(f.type===tw.particle){var M=f.content;M.renderer||(M.renderer={});var R=M.renderer;M.renderer.anchor=sM(R.anchor,R.particleOrigin)}if(f.type===tw.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),void 0!==f.pn){var I=f.pn,P=t.plugins,L=void 0===P?[]:P;void 0!==I&&Number.isInteger(I)&&(f.pluginName=L[I])}switch("editor-gizmo"===f.pluginName&&(f.type="editor-gizmo"),"orientation-transformer"===f.pluginName&&(f.type="orientation-transformer"),f.content.options.target&&"editor-gizmo"===f.pluginName&&(f.content.options.target=s[f.content.options.target]),f.type===tw.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[f.content.options.spine],f.content,i),(f.type===tw.sprite||f.type===tw.particle||f.type===tw.mesh||f.type===tw.skybox||f.type===tw.light||"camera"===f.type||f.type===tw.tree||f.type===tw.interact||f.type===tw.camera||f.type===tw.text||f.type===tw.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eJ(),f.content.item={id:f.id},f.dataType=t0.VFXItemData,f.components.push({id:f.content.id})),(f.type===tw.null||f.type===tw.composition)&&(f.components=[],f.dataType=t0.VFXItemData),f.type){case tw.sprite:f.content.dataType=t0.SpriteComponent;break;case tw.particle:f.content.dataType=t0.ParticleSystem;break;case tw.mesh:f.content.dataType=t0.MeshComponent;break;case tw.skybox:f.content.dataType=t0.SkyboxComponent;break;case tw.light:f.content.dataType=t0.LightComponent;break;case"camera":f.content.dataType=t0.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tw.tree:f.content.dataType=t0.TreeComponent;break;case tw.interact:f.content.dataType=t0.InteractComponent;break;case tw.camera:f.content.dataType=t0.CameraController;break;case tw.text:f.content.dataType=t0.TextComponent;break;case tw.spine:f.content.dataType=t0.SpineComponent}}return i.version=tg["3_0"],i}function sU(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:sE(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:sp(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:sp(n.linearX),linearY:sp(n.linearY),linearZ:sp(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:sp(n.orbitalX),orbitalY:sp(n.orbitalY),orbitalZ:sp(n.orbitalZ),speedOverLifetime:sp(n.speedOverLifetime)};sC(a);var o={options:{startColor:sv(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=sp(s.x),u.y=sp(s.y),u.z=sp(s.z)):u.z=sp(s.angularVelocity)}var h=t.colorOverLifetime;if(h){var c=o.colorOverLifetime={opacity:sp(h.opacity)};h.color&&(c.color=sT(h.color))}var l=t.sizeOverLifetime;return l&&(o.sizeOverLifetime={separateAxes:l.separateAxes,size:sp(l.size),x:sp(l.x),y:sp(l.y),z:sp(l.z)}),o}var sB=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,sG=/^(\d+)\.(\d+)$/,sj=!1;function sX(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(l=null==(c=(h=t).version)?void 0:c.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||h.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tw.mesh||t.type===tw.light)&&(t.endBehavior=1===t.endBehavior?tF.destroy:t.endBehavior)})}),sB.test(t.version)){var e,i,r,n,a,o,s,u;return sj=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",sN(sk(sD(sz(sP((e=t,sH=tg["1_0"],n=e.plugins||[],(null==(i=e.bins)?void 0:i.length)&&(sH=tg["1_3"]),a=(e.requires||[]).slice(),o=e.images.map(function(t,i){return sW(t,i,e.imageTags||[])}),s=e.textures||o.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:sH,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return sY(t,{plugins:n,requires:a})}),images:o,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:s,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u))))))}sj=!1;var h,c,l,f,d,p=sG.exec(t.version)||[],m=Number(p[1]),v=Number(p[2]);if(m)return(m<2||2===m&&v<4)&&((d=t).compositions.map(function(t){for(var e,i=ep(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=ep(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=Array.isArray(a);o&&2===a.length&&Array.isArray(a[1])?"path"===n?e[n]=sE(a):e[n]=sp(a):o||"object"!=typeof a||t(a)}})(e.value.content)}),t=d),m<3&&(t=sz(sP(t))),m=Number((p=sG.exec(t.version)||[])[1]),v=Number(p[2]),m<4&&(v<2&&(t=sD(t)),v<3&&(t=sk(t)),v<4&&(t=sN(t))),t;throw Error("Invalid JSON version: "+t.version+".")}var sH=tg["1_0"];function sW(t,e,i){var r=i[e];if("string"==typeof t)return{id:eJ(),renderLevel:r,url:t};if(t.template)return{id:eJ(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:eJ(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eJ(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function sY(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iD({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return sq(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 sZ=[0,0,0,1];function sq(t,e){void 0===e&&(e={});var i=tw.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tw.plugin,m=t.pn,p=t.pluginName,f=t.content,l=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),c=t.transform||b(l.transform)):t.particle?(i=tw.particle,c=b((l=t.particle).transform,sj,!0),f=function(t){var e=t.options,i=t.transform,r={type:t_.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iD({},t.shape,{type:t_[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=sy(e.turbulenceX),r.turbulenceY=sy(e.turbulenceY),r.turbulenceZ=sy(e.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map(function(t){return s_(t)})),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map(function(t){return s_(t)})),c.rateOverTime&&(c.rateOverTime=sy(c.rateOverTime));var l={renderer:t.renderer,shape:r,splits:t.splits,emission:c,options:{startLifetime:sy(e.startLifetime),start3DSize:!!e.start3DSize,startSize:sy(e.startSize),startSizeX:sy(e.startSizeX),startSizeY:sy(e.startSizeY),sizeAspect:sy(e.sizeAspect),maxCount:e.maxCount,startDelay:sy(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tL.COLORS,t[1].map(function(t){return sx(t,e)})]:"gradient"===t[0]?sg(t[1],e):"color"===t[0]?[tL.RGBA_COLOR,sx(t[1],e)]:t}(e.startColor,!0),startRotationZ:sy(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=sy(e.startRotationX),l.options.startRotationY=sy(e.startRotationY)),i&&i.path&&(l.emitterTransform={path:sE(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:sy(f.x),y:sy(f.y)}:l.sizeOverLifetime={size:sy(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?sp(p):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:sp(e.gravityModifier),startSpeed:sy(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:sy(d.linearX),linearY:sy(d.linearY),linearZ:sy(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:sy(d.orbitalX),orbitalY:sy(d.orbitalY),orbitalZ:sy(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:sp(d.forceCurve)},sC(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:sy(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=sp(m.y),l.rotationOverLifetime.x=sp(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:sp(v.opacity)};v.color&&(y.color=sT(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:sp(g.cycles),animationDelay:sm(g.animationDelay,0),animationDuration:sm(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:sy(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:sp(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&sT(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&sT(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:sy(x.opacityOverLifetime)}),l.trails&&sC(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(l)):t.sprite?(i=tw.sprite,c=b((l=t.sprite).transform,!1,!0),s=sU(o=l,c),(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=tw.null,c=b((l=t.cal).transform,!1,!0),f=sU(l,c)):t.ui?(i=tw.interact,c=b((l=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tA.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&sv(i.previewColor),behavior:i.behavior||tS.NOTIFY};break;case"drag":e={type:tA.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tA.MESSAGE}}return{options:e}}(l),c.scale=[l.options.width||1,l.options.height||1,1]):t.model&&(l=t.model,1===t.model.options.type&&(i=tw.camera,c=b(l.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:sE(null==(a=t.transform)?void 0:a.path),linearX:sp(null==r?void 0:r.translateX),linearY:sp(null==r?void 0:r.translateY),linearZ:sp(null==r?void 0:r.translateZ)};sC(o),i.positionOverLifetime=o}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:sp(null==s?void 0:s.rotateX),y:sp(null==s?void 0:s.rotateY),z:s.separateAxes?sp(null==s?void 0:s.rotateZ):sp(s.rotation)};sC(u),i.rotationOverLifetime=u}return i}(l))),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&&sd(e.requires,"anchor")}if(l){var o,s,u,h,c,l,f,d,p,m,v,y,g=null==(v=l.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tF.restart:tF.destroy:tF.restart:r||(null==l?void 0:null==(y=l.options)?void 0:y.endBehavior)||tF.destroy,l.options.renderLevel&&(d=l.options.renderLevel),isNaN(n)&&(n=l.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:c,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(sd(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,c,l,f,d,p,m,v,y,g,x,b,T,E,_,C,A,S,w,O,M=(a=r.rotation[0],o=r.rotation[1],s=r.rotation[2],u=sA(a*sw/2),h=sA(o*sw/2),c=sA(s*sw/2),l=sS(a*sw/2),f=sS(o*sw/2),d=sS(s*sw/2),sZ[0]=l*h*c+u*f*d,sZ[1]=u*f*c-l*h*d,sZ[2]=u*h*d+l*f*c,sZ[3]=u*h*c-l*f*d,sZ);r.rotation=(p=[],m=M[0],v=M[1],y=M[2],g=M[3],x=m+m,b=v+v,T=y+y,E=m*x,_=v*x,C=v*b,A=y*T,S=g*T,w=y*x-g*b,p[1]=Math.asin((O=-w)>1?1:O<-1?-1:O)*sO,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*b+g*x,1-E-C)*sO,p[2]=Math.atan2(_+S,1-C-A)*sO):(p[0]=0,p[2]=Math.atan2(-(_-S),1-E-A)*sO),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 sQ=((en={})[tx.S]=[tx.S,tx.BPlus,tx.APlus],en[tx.A]=[tx.A,tx.BPlus,tx.APlus],en[tx.B]=[tx.B,tx.BPlus],en);function sK(t,e){if(!t||!e)return!0;var i=sQ[e];return!!i&&i.includes(t)}function sJ(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 s$(t,e,i){return s0.apply(this,arguments)}function s0(){return(s0=ef(function(t,e,i){var r,n;return eg(this,function(a){switch(a.label){case 0:if("string"!=typeof t)return[3,2];return[4,iX(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=sJ(e,i)){if(eH(n)&&n!==r.src)return[2,iX(n)];if(em(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}t.Scene=void 0,(tp=t.Scene||(t.Scene={})).isJSONObject=function(t){return eZ(t)&&"jsonScene"in t},tp.isURL=function(t){return eZ(t)&&"url"in t},tp.isWithOptions=function(t){return eZ(t)&&"options"in t};var s1=1,s2=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new ik),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=s1++,this.timers=[],this.updateOptions(t)}var i=e.prototype;return i.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},i.loadScene=function(e,i,r){var n=this;return ef(function(){var a,o,s,u,h,c,l,f,d,p,m,v;return eg(this,function(y){return o=eH(e)?e:n.id,s=performance.now(),u=[],l=null!=(c=null==(h=null==i?void 0:i.engine.gpuCapability)?void 0:h.detail.compressedTexture)?c:t.COMPRESSED_TEXTURE.NONE,f={},p=!1,m=new Promise(function(t,e){d=window.setTimeout(function(){p=!0,n.removeTimer(d),e(Error("Load time out: totalTime: "+(performance.now()-s).toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."))},1e3*n.timeout),n.timers.push(d)}),v=ef(function(t,e){var i,r,n;return eg(this,function(a){switch(a.label){case 0:if(p)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,u.push("["+t+": "+n.toFixed(2)+"]"),f[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+a.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([m,ef(function(){var i,h,c,p,m,y,g,x,b,T,E,_,C,A,S,w,O,M;return eg(this,function(R){switch(R.label){case 0:if(!eH(e))return[3,2];return h=new URL(e,location.href).href,n.baseUrl=h,[4,v("loadJSON",function(){return n.loadJSON(h)})];case 1:return a=R.sent(),[3,3];case 2:a=e,n.baseUrl=location.href,R.label=3;case 3:if(!t.Scene.isJSONObject(a))return[3,5];return c=(i=iD({},a)).jsonScene,p=i.pluginSystem,m=i.images,y=c.images,n.assignImagesToAssets(y,m),[4,Promise.all([v("plugin:processAssets",function(){return n.processPluginAssets(c,p,r)})])];case 4:return R.sent(),[3,10];case 5:return[4,v("processJSON",function(){return n.processJSON(a)})];case 6:return x=(g=R.sent()).jsonScene,b=g.pluginSystem,E=void 0===(T=x.bins)?[]:T,_=x.images,C=x.fonts,[4,Promise.all([v("processBins",function(){return n.processBins(E)}),v("processImages",function(){return n.processImages(_,l)}),v("plugin:processAssets",function(){return n.processPluginAssets(x,b,r)}),v("processFontURL",function(){return n.processFontURL(C)})])];case 7:return S=(A=R.sent())[0],w=A[1],[4,v("processTextures",function(){return n.processTextures(w,S,x)})];case 8:return O=R.sent(),i={timeInfos:f,url:e,renderLevel:n.options.renderLevel,storage:{},pluginSystem:b,jsonScene:x,bins:S,images:w,textureOptions:O},[4,v("plugin:prepareResource",function(){return b.loadResources(i,n.options)})];case 9:R.sent(),R.label=10;case 10:return M=performance.now()-s,ej.info("Load asset: totalTime: "+M.toFixed(4)+"ms "+u.join(" ")+", url: "+o+"."),window.clearTimeout(d),n.removeTimer(d),i.totalTime=M,i.startTime=s,i.timeInfos=f,[2,i]}})})()])]})})()},i.getAssets=function(){return this.assets},i.processJSON=function(t){var e=this;return ef(function(){var i,r,n;return eg(this,function(a){switch(a.label){case 0:return[4,(n=new e5(void 0===(r=(i=sX(t)).plugins)?[]:r)).processRawJSON(i,e.options)];case 1:return a.sent(),[2,{jsonScene:i,pluginSystem:n}]}})})()},i.processBins=function(t){var e=this;return ef(function(){var i,r;return eg(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(em(n,ArrayBuffer))return n;if(sK(n.renderLevel,i))return e.loadBins(new URL(n.url,r).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},i.processFontURL=function(t){var i=this;return ef(function(){return eg(this,function(r){return t?[2,Promise.all(t.map(ef(function(t){var r,n,a;return eg(this,function(o){switch(o.label){case 0:if(!(t.fontURL&&!e.fontCache.has(t.fontFamily)))return[3,4];eB(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,i.baseUrl).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(a),e.fontCache.add(t.fontFamily),[3,4];case 3:return o.sent(),ej.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},i.processImages=function(e,i){void 0===i&&(i=0);var r=this;return ef(function(){var n,a,o,s,u,h,c;return eg(this,function(l){switch(l.label){case 0:return a=(n=r.options).useCompressedTexture,o=n.variables,s=n.disableWebP,u=n.disableAVIF,h=r.baseUrl,[4,Promise.all(e.map(ef(function(e,n){var c,l,f,d,p,m,v,y,g,x,b,T,E,_,C,A,S,w,O,M,R;return eg(this,function(n){switch(n.label){case 0:if(c=e.url,l=e.webp,f=e.avif,d=new URL(c,h).href,p=!s&&l?new URL(l,h).href:void 0,m=!u&&f?new URL(f,h).href:void 0,v=e.id,!("template"in e))return[3,8];if(!(g=(y=e.template).background))return[3,7];x=sJ(y,o),b=g.type===tJ.video,T=g&&b?iq:iX,n.label=1;case 1:return n.trys.push([1,6,,7]),[4,iK(x,T)];case 2:if(!em(E=n.sent(),HTMLVideoElement))return[3,3];return r.sourceFrom[v]={url:E.src,type:t.TextureSourceType.video},[2,E];case 3:return g&&Array.isArray(x)&&o&&(o[g.name]=E.src),r.sourceFrom[v]={url:E.src,type:t.TextureSourceType.image},[4,s$(E,y,o)];case 4:return[2,n.sent()];case 5:return[3,7];case 6:throw _=n.sent(),Error("Failed to load. Check the template or if the URL is "+(b?"video":"image")+" type, URL: "+x+", Error: "+(_.message||_)+".");case 7:return[3,9];case 8:if("compressed"in e&&a&&i){if(C=e.compressed,i===t.COMPRESSED_TEXTURE.ASTC?A=C.astc:i===t.COMPRESSED_TEXTURE.PVRTC&&(A=C.pvrtc),A)return S=new URL(A,h).href,r.sourceFrom[v]={url:S,type:t.TextureSourceType.compressed},[2,r.loadBins(S)]}else if(em(e,HTMLImageElement)||em(e,HTMLCanvasElement)||em(e,HTMLVideoElement)||em(e,i4))return[2,e];n.label=9;case 9:if(!m)return[3,11];return[4,iG(d,m)];case 10:return R=n.sent(),[3,13];case 11:return[4,iU(d,p)];case 12:R=n.sent(),n.label=13;case 13:return O=(w=R).url,M=w.image,r.sourceFrom[v]={url:O,type:t.TextureSourceType.image},[2,M]}})})))];case 1:return c=l.sent(),r.assignImagesToAssets(e,c),[2,c]}})})()},i.processPluginAssets=function(t,e,i){var r=this;return ef(function(){var n,a,o,s;return eg(this,function(u){switch(u.label){case 0:return[4,e.processAssets(t,i)];case 1:for(a=(n=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=n.loadedAssets,s=0;s<a.length;s++)r.assets[a[s].id]=o[s];return[2]}})})()},i.processTextures=function(e,i,r){var n=this;return ef(function(){var a;return eg(this,function(o){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(ef(function(e,a){var o,s,u,h,c;return eg(this,function(l){switch(l.label){case 0:if(em(e,i4))return[2,e];if(!("mipmaps"in e))return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,i$(e,i,n.assets,r.bins)];case 2:return[2,l.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+l.sent()+".");case 4:if(o=e.source,s=e.id,h="",!eZ(o))return[3,5];return u=n.assets[o.id],h=o.id,[3,7];case 5:if("string"!=typeof o)return[3,7];return[4,iX(e$(o))];case 6:u=l.sent(),l.label=7;case 7:if(u)return[2,(c=function(e,i,r){var n={id:r,dataType:t0.Texture};if(em(e,i4))return iD({},e.source,n);if(em(e,HTMLImageElement)||eq(e))return iD({image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:iM.LINEAR,magFilter:iM.LINEAR},n);if(em(e,HTMLVideoElement))return iD({sourceType:t.TextureSourceType.video,video:e,minFilter:iM.LINEAR,magFilter:iM.LINEAR},n);if(em(e,ArrayBuffer))return iD({},rt(e),{sourceFrom:i},n);if("width"in e&&"height"in e&&"data"in e)return iD({sourceType:t.TextureSourceType.data,data:e,wrapS:iM.CLAMP_TO_EDGE,wrapT:iM.CLAMP_TO_EDGE,minFilter:iM.NEAREST,magFilter:iM.NEAREST},n);throw Error("Invalid texture options.")}(u,n.sourceFrom[h],s)).sourceType===t.TextureSourceType.compressed?c:iD({},c,e)];throw Error("Invalid texture source: "+o+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return ef(function(){return eg(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)})})]})})()},i.loadBins=function(t){var e=this;return ef(function(){return eg(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)})})]})})()},i.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},i.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},e}();s2.fontCache=new Set;var s3=function(){function e(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(i8(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=iD({},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===tw.text||t.type===tw.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)===t0.TextComponent||(null==n?void 0:n.dataType)===t0.RichTextComponent)&&(n.options.text=r)})}})},i.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++){var i=t.textureOptions[e];em(i,i4)?this.engine.addInstance(i):(i=this.engine.findObject({id:t.textureOptions[e].id}),t.textureOptions[e]=i),i.initialize()}},i.prepareAssets=function(t,e){this.engine.clearResources();for(var i,r=ep(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],o=new sh(this.engine);o.data=a,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var s,u=ep(this.builtinObjects);!(s=u()).done;){var h=s.value;this.engine.addInstance(h)}},i.createShaderVariant=function(){for(var t,e=ep(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];em(r,ra)&&r.createShaderVariant()}},i.destroyBuiltinObjects=function(){for(var t,e=ep(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},i.dispose=function(){this.destroyBuiltinObjects()},e}(),s4=new Int32Array(2),s5=new Float32Array(s4.buffer),s6=new Float64Array(s4.buffer),s8=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(tm=ea||(ea={}))[tm.UTF8_BYTES=1]="UTF8_BYTES",tm[tm.UTF16_STRING=2]="UTF16_STRING";var s9=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 s4[0]=this.readInt32(t),s5[0]},e.readFloat64=function(t){return s4[s8?0:1]=this.readInt32(t),s4[s8?1:0]=this.readInt32(t+4),s6[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){s5[0]=e,this.writeInt32(t,s4[0])},e.writeFloat64=function(t,e){s6[0]=e,this.writeInt32(t,s4[s8?0:1]),this.writeInt32(t+4,s4[s8?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}(),s7=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=s9.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:(em(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=s9.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),ut=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 ue(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}(),ue=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=ut.createDataVector(t,this.data);return ut.createFBEffectsObjectData(t,e,i)},t}(),ui=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 ut).__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 ur(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}(),ur=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=ui.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return ui.createFBEffectsPackageData(t,e)},t}(),un=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 ua(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}(),ua=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 un.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),uo=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 us(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}(),us=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 uo.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),uu=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 uo).__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 uh(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}(),uh=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=uu.createChannelsVector(t,t.createObjectOffsetList(this.channels));return uu.createFBVertexData(t,this.vertexCount,e)},t}(),uc=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 uu).__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 un).__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 ul(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}(),ul=function(){function t(t,e,i,r,n,a,o,s,u,h,c,l){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===c&&(c=null),void 0===l&&(l=[]),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=c,this.inverseBindMatrices=l}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=uc.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,o=uc.createBinaryDataVector(t,this.binaryData),s=uc.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=uc.createInverseBindMatricesVector(t,this.inverseBindMatrices);return uc.startFBGeometryData(t),uc.addId(t,e),uc.addName(t,i),uc.addVertexData(t,r),uc.addIndexFormat(t,this.indexFormat),uc.addIndexOffset(t,this.indexOffset),uc.addSubMeshes(t,n),uc.addMode(t,this.mode),uc.addBuffer(t,a),uc.addBinaryData(t,o),uc.addBoneNames(t,s),uc.addRootBoneName(t,u),uc.addInverseBindMatrices(t,h),uc.endFBGeometryData(t)},t}(),uf=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 s7(1),i=new ur,r=[],n=ep(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===t0.Geometry&&(o=new ue("Geometry",this.geometryDataToBinary(a))),o&&r.push(o)}return i.exportObjects=r,ui.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new s9(t),i=ui.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===t0.Geometry&&(s=this.binaryToGeometryData(a)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new s7(1),i=new ul,r=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,s=t.vertexData,u=t.boneNames,h=t.rootBoneName,c=t.inverseBindMatrices,l=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=o,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===h?"":h,i.inverseBindMatrices=void 0===c?[]:c,i.binaryData=void 0===l?[]:l;var f=new uh;f.vertexCount=s.vertexCount,f.channels=[];for(var d,p=ep(s.channels);!(d=p()).done;){var m=d.value,v=new us(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=ep(t.subMeshes);!(y=x()).done;){var b=y.value,T=new ua(b.offset,b.indexCount,b.vertexCount);g.push(T)}return i.subMeshes=g,ui.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,a=new s9(t),o=uc.getRootAsFBGeometryData(a),s={vertexCount:0,channels:[]},u=o.vertexData();if(u){s.vertexCount=u.vertexCount();for(var h=0;h<u.channelsLength();h++){var c,l=u.channels(h);if(l){var f={semantic:null!=(c=l.semantic())?c:"",offset:l.offset(),format:l.format(),dimension:l.dimension(),normalize:l.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:t0.Geometry}},t}(),ud=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 sl(this),this.emptyTexture=i8(this),this.transparentTexture=i9(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 eZ(t)&&t.constructor===Object?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,n=i.items,a=i.materials,o=i.shaders,s=i.geometries,u=i.components,h=i.animations,c=i.bins,l=void 0===c?[]:c,f=i.miscs,d=i.compositions,p=ep(d);!(e=p()).done;){var m=e.value;this.addEffectsObjectData(m)}for(var v,y=ep(void 0===n?[]:n);!(v=y()).done;){var g=v.value;sK(g.renderLevel,t.renderLevel)||(g.components=[],g.type=tw.null),this.addEffectsObjectData(g)}for(var x,b=ep(void 0===a?[]:a);!(x=b()).done;){var T=x.value;this.addEffectsObjectData(T)}for(var E,_=ep(void 0===o?[]:o);!(E=_()).done;){var C=E.value;this.addEffectsObjectData(C)}for(var A,S=ep(void 0===s?[]:s);!(A=S()).done;){var w=A.value;this.addEffectsObjectData(w)}for(var O,M=ep(void 0===u?[]:u);!(O=M()).done;){var R=O.value;this.addEffectsObjectData(R)}for(var I,P=ep(void 0===h?[]:h);!(I=P()).done;){var L=I.value;this.addEffectsObjectData(L)}for(var V,F=ep(void 0===f?[]:f);!(V=F()).done;){var D=V.value;this.addEffectsObjectData(D)}for(var k=0;k<l.length;k++){var N=l[k],z=t.bins[k];if(N.dataType===t0.BinaryAsset)N.buffer=z,N.id&&this.addEffectsObjectData(N);else{var U=new uf;U.deserializeFromBinary(new Uint8Array(z));for(var B,G=ep(U.exportObjectDatas);!(B=G()).done;){var j=B.value;this.addEffectsObjectData(j)}}}for(var X,H=ep(void 0===r?[]:r);!(X=H()).done;){var W=X.value;this.addEffectsObjectData(W)}},e.createVFXItems=function(t){var e=this;return ef(function(){var i,r,n,a;return eg(this,function(o){for(i=ep(t.jsonScene.items);!(r=i()).done;)("ECS"===(a=(n=r.value).type)||"camera"===a||a===tw.sprite||a===tw.particle||a===tw.mesh||a===tw.skybox||a===tw.light||a===tw.tree||a===tw.interact||a===tw.camera)&&e.database&&e.assetLoader.loadGUID(n);return[2]})})()},e.addTexture=function(t){this.destroyed||e_(this.textures,t)},e.removeTexture=function(t){this.destroyed||eC(this.textures,t)},e.addMaterial=function(t){this.destroyed||e_(this.materials,t)},e.removeMaterial=function(t){this.destroyed||eC(this.materials,t)},e.addGeometry=function(t){this.destroyed||e_(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||eC(this.geometries,t)},e.addMesh=function(t){this.destroyed||e_(this.meshes,t)},e.removeMesh=function(t){this.destroyed||eC(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||e_(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||eC(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&&ej.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}},ir(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),up=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=ib(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)},ir(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();e4("camera",nV,t.VFXItem),e4("text",su,t.VFXItem),e4("sprite",aR,t.VFXItem),e4("particle",oN,t.VFXItem),e4("cal",oz,t.VFXItem),e4("interact",nB,t.VFXItem),ej.info("Core version: 2.4.4.");var um=((eo={})[iM.ONE]=ec.OneFactor,eo[iM.ZERO]=ec.ZeroFactor,eo[iM.SRC_COLOR]=ec.SrcColorFactor,eo[iM.SRC_ALPHA]=ec.SrcAlphaFactor,eo[iM.ONE_MINUS_SRC_COLOR]=ec.OneMinusSrcColorFactor,eo[iM.ONE_MINUS_SRC_ALPHA]=ec.OneMinusSrcAlphaFactor,eo[iM.DST_COLOR]=ec.DstColorFactor,eo[iM.DST_ALPHA]=ec.DstAlphaFactor,eo[iM.ONE_MINUS_DST_COLOR]=ec.OneMinusDstColorFactor,eo[iM.ONE_MINUS_DST_ALPHA]=ec.OneMinusDstAlphaFactor,eo),uv=((es={})[iM.NEVER]=ec.NeverStencilFunc,es[iM.EQUAL]=ec.EqualStencilFunc,es[iM.LESS]=ec.LessStencilFunc,es[iM.LEQUAL]=ec.LessEqualStencilFunc,es[iM.ALWAYS]=ec.AlwaysStencilFunc,es[iM.NOTEQUAL]=ec.NotEqualStencilFunc,es[iM.GREATER]=ec.GreaterStencilFunc,es[iM.GEQUAL]=ec.GreaterEqualStencilFunc,es),uy=((eu={})[iM.KEEP]=ec.KeepStencilOp,eu[iM.ZERO]=ec.ZeroStencilOp,eu[iM.REPLACE]=ec.ReplaceStencilOp,eu[iM.INCR]=ec.IncrementStencilOp,eu[iM.DECR]=ec.DecrementStencilOp,eu[iM.INCR_WRAP]=ec.IncrementWrapStencilOp,eu[iM.DECR_WRAP]=ec.IncrementWrapStencilOp,eu[iM.INVERT]=ec.InvertStencilOp,eu),ug=((eh={})[iM.NEVER]=ec.NeverDepth,eh[iM.ALWAYS]=ec.AlwaysDepth,eh[iM.EQUAL]=ec.EqualDepth,eh[iM.LESS]=ec.LessDepth,eh[iM.LEQUAL]=ec.LessEqualDepth,eh[iM.GREATER]=ec.GreaterDepth,eh[iM.GEQUAL]=ec.GreaterEqualDepth,eh[iM.NOTEQUAL]=ec.NotEqualDepth,eh),ux=["uMaskTex","_MainTex","uColorOverLifetime","uColorOverTrail"],ub=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new ec.RawShaderMaterial,n.uniforms={},n.macrosDirty=!0;var n,a,o,s,u,h=null==r?void 0:r.shader,c=i.gpuCapability.level;return n.shader=new t.Shader(i),n.shader.shaderData=iD({},h,{id:eJ(),dataType:t0.Shader,vertex:null!=(a=null==h?void 0:h.vertex)?a:"",fragment:null!=(o=null==h?void 0:h.fragment)?o:""}),n.uniforms._MainTex=new ec.Uniform(null),n.uniforms.uEditorTransform=new ec.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new ec.Uniform(new ec.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new ec.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new ec.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new ec.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new ec.RawShaderMaterial({vertexShader:rj.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:null!=(s=null==h?void 0:h.vertex)?s:"",macros:null==h?void 0:h.macros,removeVersion:!0}),fragmentShader:rj.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:null!=(u=null==h?void 0:h.fragment)?u:"",macros:null==h?void 0:h.macros,removeVersion:!0}),alphaToCoverage:!1,depthFunc:ec.LessDepth,polygonOffsetFactor:ec.ZeroFactor,polygonOffsetUnits:ec.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===c?n.material.glslVersion=ec.GLSL1:n.material.glslVersion=ec.GLSL3,n}e7(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;ux.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new ec.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var a=new ec.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",a)}else{var o=r.camera;this.setMatrix("effects_MatrixVP",o.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",o.getViewMatrix())}},r.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.getVector4Array=function(t){return this.uniforms[t].value},r.setVector4Array=function(t,e){for(var i,r=[],n=ep(e);!(i=n()).done;){var a=i.value;r=r.concat(a.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.uniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=ep(e);!(i=n()).done;){var a=i.value;r=r.concat(a.elements)}this.setUniform(t,r)},r.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.getMatrix=function(t){return this.uniforms[t].value},r.setMatrix=function(t,e){this.setUniform(t,e)},r.setMatrix3=function(t,e){this.setUniform(t,e)},r.getVector2=function(t){return this.uniforms[t].value},r.setVector2=function(t,e){this.setUniform(t,e)},r.getVector3=function(t){return this.uniforms[t].value},r.setVector3=function(t,e){this.setUniform(t,e)},r.getVector4=function(t){return this.uniforms[t].value},r.setVector4=function(t,e){this.setUniform(t,e)},r.getColor=function(t){var e=this.uniforms[t].value;return new iA(e.x,e.y,e.z,e.w)},r.setColor=function(t,e){this.setUniform(t,new ec.Vector4(e.r,e.g,e.b,e.a))},r.getQuaternion=function(t){return this.uniforms[t].value},r.setQuaternion=function(t,e){this.setUniform(t,e)},r.getFloat=function(t){return this.uniforms[t].value},r.setFloat=function(t,e){this.setUniform(t,e)},r.getFloats=function(t){return this.uniforms[t].value},r.setFloats=function(t,e){this.setUniform(t,e)},r.getInt=function(t){return this.uniforms[t].value},r.setInt=function(t,e){this.setUniform(t,e)},r.hasUniform=function(t){return!!this.uniforms[t]},r.setUniform=function(t,e){var i=new ec.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=i},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.clone=function(t){throw Error("Method not implemented.")},r.cloneUniforms=function(t){throw Error("Method not implemented.")},r.fromData=function(t){throw Error("Method not implemented.")},r.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},ir(i,[{key:"blending",get:function(){return this.material.blending!==ec.NoBlending},set:function(t){this.material.blending=t?ec.CustomBlending:ec.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,i=t.blendDst;return[e,i,t.blendSrcAlpha||e,t.blendDstAlpha||i]},set:function(t){if(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.material.blendSrc=um[e],this.material.blendDst=um[i],this.material.blendSrcAlpha=um[r],this.material.blendDstAlpha=um[n]}}},{key:"blendEquation",get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=t[0],i=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=i}}},{key:"depthTest",get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t}},{key:"depthMask",get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t}},{key:"depthFunc",get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=ug[t])}},{key:"polygonOffsetFill",get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t}},{key:"polygonOffset",get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=t[0],i=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=i}}},{key:"sampleAlphaToCoverage",get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t}},{key:"stencilTest",get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t}},{key:"stencilMask",get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])}},{key:"stencilRef",get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])}},{key:"stencilFunc",get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=uv[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=uy[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=uy[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=uy[t[0]])}},{key:"culling",get:function(){return this.material.side!==ec.DoubleSide},set:function(t){this.material.side=t?ec.FrontSide:ec.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tT.FRONT?this.material.side=ec.FrontSide:t===tT.BACK&&(this.material.side=ec.BackSide)}},{key:"colorMask",get:function(){return this.material.colorWrite},set:function(t){this.material.colorWrite=t}}]),i}(ra),uT=1,uE=function(t){function e(e,i){if((r=t.call(this,e)||this).attributes={},r.destroyed=!1,r.attributesName=[],!i)return se(r);var r,n=i.drawStart,a=i.drawCount,o=i.indices,s=i.mode,u=i.name,h=void 0===u?"effectsGeometry:"+uT++:u;r.name=h,r.mode=null!=s?s:iM.TRIANGLES;var c=[],l={},f=new ec.BufferGeometry;return Object.keys(i.attributes).forEach(function(t){var e=i.attributes[t];if("dataSource"in e){var n=e.dataSource;if(n){void 0===l[n]&&r.setAttributeType(n,e,f,l,i.maxVertex);var a=e.size,o=e.offset,s=e.normalize,u=l[n],h=u.buffer,d=u.dataLength,p=new ec.InterleavedBufferAttribute(h,a,(null!=o?o:0)/d,s);f.setAttribute(t,p),l[t]={buffer:h,attribute:p,type:u.type,dataLength:d}}}else r.setAttributeType(t,e,f,l,i.maxVertex);c.push(t)}),o&&o.data&&f.setIndex(new ec.BufferAttribute(o.data,1)),r.geometry=f,r.attributes=l,r.attributesName=c,r.drawStart=void 0===n?0:n,r.drawCount=null!=a?a:0,r}e7(e,t);var i=e.prototype;return i.getAttributeData=function(t){if(void 0!=this.attributes[t])return this.attributes[t].buffer.array},i.setAttributeData=function(t,e){if(void 0!=this.attributes[t]){var i=this.attributes[t].buffer;if(e.length>i.array.length){var r=new ec.InterleavedBuffer(e,i.stride);i=this.attributes[t].attribute.data=r,this.attributes[t].buffer=r,this.geometry.setAttribute(t,this.attributes[t].attribute)}else i.set(e,0),i.updateRange.count=e.length,i.updateRange.offset=0;this.geometry.attributes[t].needsUpdate=!0}},i.setAttributeSubData=function(t,e,i){void 0!=this.attributes[t]&&(this.attributes[t].buffer.set(i,e),this.geometry.attributes[t].needsUpdate=!0)},i.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*ry[e.type]},i.getAttributeNames=function(){return this.attributesName},i.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},i.setIndexData=function(t){t&&(this.geometry.setIndex(new ec.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},i.setIndexSubData=function(t,e){var i=this.geometry.getIndex();if(null!==i){var r=t+e.length;if(i.count<r){var n=new e.constructor(end);n.set(i.array),i.array=n}i.array.set(e,t),this.geometry.index.needsUpdate=!0}},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{}},i.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},i.setAttributeType=function(t,e,i,r,n){var a=e.stride,o=e.size,s=e.offset,u=e.normalize,h=e.type,c=void 0===h?iM.FLOAT:h,l=e.data;if(c&&!l&&(l=rx(c)),l){var f=em(l,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,d=(void 0===a?0:a)/f,p=(n=(null!=n?n:0)*d)||o*f;p&&0===l.length&&(l=em(l,Float32Array)?new Float32Array(p):new Uint16Array(p));var m=new ec.InterleavedBuffer(l,d),v=new ec.InterleavedBufferAttribute(m,o,(null!=s?s:0)/f,u);i.setAttribute(t,v),r[t]={buffer:m,attribute:v,type:c,dataLength:f}}},ir(e,[{key:"drawCount",get:function(){return this.geometry.drawRange.count},set:function(t){this.geometry.drawRange.count=t}},{key:"drawStart",get:function(){return this.geometry.drawRange.start},set:function(t){this.geometry.drawRange.start=t}}]),e}(rg),u_=function(e){function i(t,i){if(!i)return se(r);var r,n=i.material,a=i.geometry,o=i.priority;return(r=e.call(this,t,i)||this).geometry=a,r.material=n,a.mode===iM.LINES?r.mesh=new ec.LineSegments(a.geometry,n.material):r.mesh=new ec.Mesh(a.geometry,n.material),r.priority=void 0===o?0:o,r}e7(i,e);var r=i.prototype;return r.setVisible=function(t){this.mesh.visible=t},r.getVisible=function(){return this.mesh.visible},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e,this.mesh.material=e.material},r.onStart=function(){e.prototype.onStart.call(this),this.engine.threeGroup.add(this.mesh)},r.restore=function(){},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},r.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},ir(i,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),i}(rw),uC=function(e){function i(i,r,n){if(void 0===n&&(n={}),a=e.call(this,i)||this,r){var a,o=r.width,s=r.height;a.texture=a.createTextureByType(iD({},n,{sourceType:t.TextureSourceType.data,data:r})),a.width=void 0===o?1:o,a.height=void 0===s?1:s}else a.texture=a.createTextureByType(n);return a.texture.needsUpdate=!0,a.source={},a}e7(i,e);var r=i.prototype;return r.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.assembleOptions=function(e){var r=e.target,n=void 0===r?iM.TEXTURE_2D:r;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=t.TextureSourceType.none),iD({},e,{target:n,format:ec.RGBAFormat,type:ec.UnsignedByteType,minFilter:i.toThreeJsTextureFilter(e.minFilter),magFilter:i.toThreeJsTextureFilter(e.magFilter),wrapS:i.toThreeJsTextureWrap(e.wrapS),wrapT:i.toThreeJsTextureWrap(e.wrapT)})},r.dispose=function(){this.texture.dispose()},r.fromData=function(t){e.prototype.fromData.call(this,t),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.createTextureByType=function(e){var i=this.assembleOptions(e),r=i.flipY,n=i.type,a=i.wrapS,o=i.wrapT,s=i.minFilter,u=i.magFilter,h=i.sourceType,c=ec.UVMapping,l=i.format,f=void 0;if(this.sourceType=h,h===t.TextureSourceType.data){var d=e.data;f=new ec.DataTexture(d.data,d.width,d.height,l,n,c,a,o,u,s),this.width=d.width,this.height=d.height}else if(h===t.TextureSourceType.image){var p=e.image;f=new ec.Texture(p,c,a,o,u,s,l,n),this.width=p.width,this.height=p.height}else if(h===t.TextureSourceType.compressed){var m=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,i=t.width,r=t.height;return m=m<i?i:m,v=v<r?r:v,{data:e,width:i,height:r,colorSpace:"srgb"}});l=ec.RGBA_ASTC_4x4_Format,f=new ec.CompressedTexture(y,m,v,l,n,c,a,o,u,s),this.width=m,this.height=v}else if(h===t.TextureSourceType.video)f=new ec.VideoTexture(e.video,c,a,o,u,s,l,n);else if(h===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,b,T=null!=(x=g.width)?x:0,E=null!=(b=g.height)?b:0;f=new ec.FramebufferTexture(T,E,l),this.width=T,this.height=E}}else h===t.TextureSourceType.none&&((f=new ec.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=ec.MirroredRepeatWrapping,f.wrapT=ec.MirroredRepeatWrapping,this.width=this.height=1);if(this.source=e,f)return f.flipY=!!r,f;throw Error("Create a texture using an unknown data type.")},i.toThreeJsTextureFilter=function(t){return t===iM.LINEAR?ec.LinearFilter:ec.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case iM.MIRRORED_REPEAT:return ec.MirroredRepeatWrapping;case iM.REPEAT:return ec.RepeatWrapping;default:return ec.ClampToEdgeWrapping}},i}(i4),uA=function(e){function i(t,i){return e.call(this,t,i)}e7(i,e);var r=i.prototype;return r.prepareRender=function(){var e=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var i,r=ep(this.rootComposition.items);!(i=r()).done;)for(var n,a=i.value.getComponents(im),o=ep(a);!(n=o()).done;){var s=n.value;s.isActiveAndEnabled&&s.render(e)}for(var u,h=ep(this.refContent);!(u=h()).done;)for(var c,l=u.value,f=ep(l.getComponent(t.CompositionComponent).items);!(c=f()).done;)for(var d,p=c.value.getComponents(im),m=ep(p);!(d=m()).done;){var v=d.value;v.isActiveAndEnabled&&v.render(e)}},r.getRendererOptions=function(){var t=uC.createWithData(this.renderer.engine,{data:new Uint8Array(4).fill(255),width:1,height:1});return t.texture.needsUpdate=!0,this.rendererOptions||(this.rendererOptions={emptyTexture:t,cachePrefix:"-"}),this.rendererOptions},i}(oP);uA.shape={};var uS=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new r2(e),i}return e7(e,t),e.prototype.setOptions=function(t){var e=t.threeCamera,i=t.threeGroup,r=t.composition;this.threeCamera=e,this.threeGroup=i,this.composition=r},e}(ud),uw=function(t){function e(e){var i;return(i=t.call(this)||this).engine=new uS(e),i.engine.renderer=aF(i),i.env="",i.renderingData={currentFrame:{}},i}return e7(e,t),e}(r5),uO=function(t){function e(e,i){(r=t.call(this)||this).compositions=[],r.env="",r.baseCompositionIndex=0;var r,n=i.width,a=i.height,o=i.camera;return r.renderer=new uw(e),r.assetService=new s3(r.renderer.engine),r.width=n,r.height=a,r.camera=o,r}e7(e,t);var i=e.prototype;return i.loadScene=function(t,e){var i=this;return ef(function(){var r,n,a,o,s,u,h,c,l,f,d,p;return eg(this,function(m){switch(m.label){case 0:return eU(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),r=performance.now(),n=[],a=[],s=null==(o=null==e?void 0:e.autoplay)||o,u=i.baseCompositionIndex,eW(t)?(h=n).push.apply(h,[].concat(t)):n.push(t),[4,Promise.all(n.map(ef(function(t,r){var n,o,h,c,l,f;return eg(this,function(d){switch(d.label){case 0:return o=(n=i.assetService.assembleSceneLoadOptions(t,iD({autoplay:s},e))).source,[4,(c=new s2(h=n.options)).loadScene(o,i.renderer,{env:i.env})];case 1:return l=d.sent(),i.assetService.prepareAssets(l,c.getAssets()),i.assetService.updateTextVariables(l,c.options.variables),i.assetService.initializeTexture(l),l.pluginSystem.precompile(l.jsonScene.compositions,i.renderer),f=i.createComposition(l,h),i.baseCompositionIndex+=1,f.setIndex(u+r),a[r]=f,[2]}})})))];case 1:for(m.sent(),c=0;c<a.length;c++)s?a[c].play():a[c].pause();for(l=a.map(function(t){return t.name}),f=performance.now()-r,d=ep(a);!(p=d()).done;)p.value.statistic.firstFrameTime=f;return ej.info("First frame ["+l+"]: "+f.toFixed(4)+"ms."),[2,eW(t)?a:a[0]]}})})()},i.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=new uA(iD({},e,{width:this.width,height:this.height,renderer:this.renderer,handleItemMessage:function(t){i.dispatchEvent({type:"message",message:t})}}),t);return r.on("end",function(){i.dispatchEvent({type:"end",composition:r})}),this.renderer.engine.setOptions({threeCamera:this.camera,threeGroup:this,composition:r}),this.compositions.push(r),r},i.pause=function(){this.dispatchEvent({type:"pause"}),this.compositions.forEach(function(t){t.pause()})},i.resume=function(){this.compositions.forEach(function(t){t.resume()})},i.update=function(t){this.compositions.forEach(function(e){e.update(t)})},ir(e,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(ec.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}e7(e,t);var i=e.prototype;return i.setVisible=function(t){this.threeMesh.visible=t},i.getVisible=function(){return this.threeMesh.visible},i.dispose=function(){t.prototype.dispose.call(this),this.isActiveAndEnabled||this.threeMesh.clear()},i.fromData=function(e){t.prototype.fromData.call(this,e),this.threeMesh||(this.geometry.mode===iM.LINES?this.threeMesh=new ec.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new ec.Mesh(this.geometry.geometry,this.material.material))},i.onStart=function(){t.prototype.onStart.call(this),this.engine.threeGroup.add(this.threeMesh)},i.render=function(t){this.isActiveAndEnabled&&(this.material.setVector2("_Size",this.transform.size),this.material.setMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.onDestroy=function(){this.threeMesh.clear()},ir(e,[{key:"priority",get:function(){return this.threeMesh.renderOrder},set:function(t){this.threeMesh&&(this.threeMesh.renderOrder=t)}},{key:"enabled",get:function(){return this.threeMesh.visible},set:function(t){this.threeMesh.visible=t,t&&this.onEnable()}}]),e}(t.SpriteComponent),t.ThreeSpriteComponent=ey([iu(t0.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.canvas=si.getCanvas(),si.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return se(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}e7(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.options;this.updateWithOptions(i),this.updateTexture(),this.material.setColor("_Color",new iA(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=ey([iu(t0.TextComponent)],t.ThreeTextComponent),e0(t.ThreeTextComponent,[ss]),ok(8),i4.create=function(t,e){return new uC(t,void 0,e)},i4.createWithData=function(t,e,i){return new uC(t,e,i)},ra.create=function(t,e){return new ub(t,e)},rg.create=function(t,e){return new uE(t,e)},rw.create=function(t,e){return new u_(t,e)};var uM="2.4.4";ej.info("THREEJS plugin version: "+uM+"."),t.AbstractPlugin=e8,t.ActivationPlayable=oW,t.AnimationClipPlayable=oY,t.Asset=sh,t.AssetLoader=sl,t.AssetManager=s2,t.AssetService=s3,t.BYTES_TYPE_MAP=ry,t.BaseRenderComponent=nL,t.Behaviour=ip,t.BezierCurve=al,t.BezierCurvePath=ad,t.BezierCurveQuat=ap,t.CONSTANT_MAP_BLEND=um,t.CONSTANT_MAP_DEPTH=ug,t.CONSTANT_MAP_STENCIL_FUNC=uv,t.CONSTANT_MAP_STENCIL_OP=uy,t.COPY_FRAGMENT_SHADER=rl,t.COPY_MESH_SHADER_ID=rh,t.COPY_VERTEX_SHADER=rc,t.CalculateLoader=oz,t.Camera=aU,t.CameraVFXItemLoader=nV,t.ColorCurve=aA,t.Component=id,t.Composition=oP,t.DEFAULT_FONTS=sa,t.DEFAULT_FPS=60,t.Database=sf,t.Downloader=ik,t.EFFECTS_COPY_MESH_NAME=ru,t.EVENT_TYPE_CLICK=nF,t.EVENT_TYPE_TOUCH_END=nN,t.EVENT_TYPE_TOUCH_MOVE=nk,t.EVENT_TYPE_TOUCH_START=nD,t.EffectsObject=il,t.EffectsPackage=uf,t.Ellipse=o6,t.Engine=ud,t.EventEmitter=ow,t.EventSystem=nz,t.Float16ArrayWrapper=nj,t.Framebuffer=r4,t.GPUCapability=r2,t.Geometry=rg,t.GlobalUniforms=r$,t.GradientValue=ah,t.GraphicsPath=st,t.HELP_LINK=nM,t.InteractLoader=nB,t.InteractMesh=aw,t.KTXTexture=i7,t.LineSegments=ac,t.LinearValue=au,t.MaskProcessor=ro,t.Material=ra,t.MaterialDataBlock=ri,t.Mesh=rw,t.MeshCollider=aM,t.PLAYER_OPTIONS_ENV_EDITOR=nO,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=a0,t.ParticleBehaviourPlayableAsset=a1,t.ParticleLoader=oN,t.ParticleMesh=a3,t.ParticleSystemRenderer=a6,t.ParticleTrack=oE,t.PassTextureCache=rm,t.PathSegments=af,t.PluginSystem=e5,t.PolyStar=o8,t.Polygon=o4,t.PropertyTrack=oT,t.RENDER_PASS_NAME_PREFIX=rZ,t.RENDER_PREFER_LOOKUP_TEXTURE=aX,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=aa,t.RandomValue=ao,t.RandomVectorValue=as,t.RenderFrame=rQ,t.RenderPass=rR,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=rO,t.Renderbuffer=r0,t.Renderer=r5,t.RendererComponent=im,t.RuntimeClip=ob,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=rv,t.SerializationHelper=sc,t.ShaderFactory=rj,t.ShaderVariant=rs,t.ShapePath=o7,t.SpriteLoader=aR,t.StaticValue=an,t.TEMPLATE_USE_OFFSCREEN_CANVAS=aH,t.TEXTURE_UNIFORM_MAP=ux,t.TextComponentBase=ss,t.TextLayout=sr,t.TextLoader=su,t.TextStyle=sn,t.Texture=i4,t.TextureFactory=re,t.ThreeComposition=uA,t.ThreeDisplayObject=uO,t.ThreeEngine=uS,t.ThreeMaterial=ub,t.ThreeTexture=uC,t.Ticker=up,t.TimelineClip=ox,t.TimelinePlayable=oC,t.TrackSortWrapper=oA,t.Transform=aN,t.TransformAnimationPlayable=oH,t.ValueGetter=ar,t.Vector2Curve=aE,t.Vector4Curve=aT,t.addByOrder=eN,t.addItem=e_,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=e0,t.assertExist=eU,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=e$,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=oJ,t.calculateTranslation=nW,t.canvasPool=si,t.closePointEps=1e-4,t.colorGradingFrag=rk,t.colorStopsFromGradient=eO,t.colorToArr=eS,t.combineImageTemplate=s$,t.createCopyShader=rf,t.createGLContext=function(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},t.createKeyFrameMeta=ag,t.createShape=nc,t.createValueGetter=aC,t.curveEps=1e-4,t.decimalEqual=n$,t.defaultPlugins=e2,t.deserializeMipmapTexture=i$,t.earcut=nw,t.effectsClass=iu,t.effectsClassStore=is,t.enlargeBuffer=eA,t.ensureFixedNumber=sp,t.ensureVec3=nY,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=rN,t.gaussianDownVFrag=rz,t.gaussianUpFrag=rU,t.generateEmptyTypedArray=rx,t.generateGUID=eJ,t.generateHalfFloatTexture=i5,t.generateTransparentTexture=i9,t.generateWhiteTexture=i8,t.getBackgroundImage=sJ,t.getColorFromGradientStops=ew,t.getConfig=function(t){return aW[t]},t.getDefaultTextureFactory=function(){return t5||(t5=new re),t5},t.getGeometryByShape=nI,t.getGeometryTriangles=nR,t.getKTXTextureOptions=rt,t.getKeyFrameMetaByRawValue=ay,t.getMergedStore=ih,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===nO]],h=e.level,c=e.detail,l=ag(),f=ag(),d=c.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,ay(l,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&&ay(l,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])&&(ay(l,b[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==b?void 0:b[n])&&(ay(l,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?(ay(l,T.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,ay(l,T.y)):ay(l,T.size)}if(o.rotationOverLifetime){var E=o.rotationOverLifetime;E.z&&(ay(l,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(ay(l,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(ay(l,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)}ay(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,ay(l,b.forceCurve));var _=c.halfFloatTexture;_&&f.max&&(v|=1048576);var C=c.maxVertexUniforms,A=l.max+l.curves.length-32>C;aW[aX]&&(A=!0),2===h&&(l.max=-1,f.index>0&&(f.max=-1)),A&&_&&d&&(m=1);var S={fragment:rL,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+rV,shared:!0,cacheId:["-p:",s,v,l.index,l.max,f.index,f.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:S,vertex:l.index,fragment:f.index}},t.getPixelRatio=function(){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},t.getPreMultiAlpha=iP,t.getStandardComposition=sY,t.getStandardImage=sW,t.getStandardItem=sq,t.getStandardJSON=sX,t.getTextureSize=rK,t.glContext=iM,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return t2.Float32;case WebGLRenderingContext.SHORT:return t2.Int16;case WebGLRenderingContext.BYTE:return t2.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return t2.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return t2.UInt8;default:return t2.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=ef(function(){return eg(this,function(n){return[2,new Promise(function(n,a){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);o&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(o||s)&&(t.deleteQuery(i),i=null),null!==o&&i&&window.setTimeout(function(){r().then(n).catch},1)}})]})});if(!i)return;return{begin:function(){i&&t.beginQuery(e.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:r}}},t.imageDataFromColor=function(t){eH(t)&&(t=eS(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},t.imageDataFromGradient=eD,t.initErrors=iO,t.initGLContext=iR,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=eM,t.isAlipayMiniApp=eV,t.isAndroid=eI,t.isArray=eW,t.isCanvas=eq,t.isFunction=eY,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},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 eV()||eF()},t.isObject=eZ,t.isOpenHarmony=eP,t.isSimulatorCellPhone=eL,t.isString=eH,t.isUniformStruct=rr,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&rr(t[0])},t.isValidFontFamily=eB,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.isWechatMiniApp=eF,t.itemFrag=rP,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=rI,t.loadAVIFOptional=iG,t.loadBinary=iW,t.loadBlob=function(t){return iZ.apply(this,arguments)},t.loadImage=iX,t.loadMedia=iK,t.loadVideo=iq,t.loadWebPOptional=iU,t.logger=ej,t.math=rA,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=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=eX,t.normalizeColor=sb,t.numberToFix=n0,t.parsePercent=eR,t.particleFrag=rL,t.particleOriginTranslateMap=nQ,t.particleUniformTypeMap=a2,t.particleVert=rV,t.passRenderLevel=sK,t.pluginLoaderMap=e1,t.randomInRange=eQ,t.registerPlugin=e4,t.removeItem=eC,t.rotateVec2=nP,t.screenMeshVert=rD,t.serialize=function(t,e){return ic(t,e)},t.setBlendMode=iL,t.setConfig=function(t,e){return aW[t]=e},t.setDefaultTextureFactory=function(t){t5=t},t.setMaskMode=iF,t.setMaxSpriteMeshItemCount=ok,t.setRayFromCamera=nK,t.setSideMode=iV,t.setSpriteMeshMaxItemCountByGPU=function(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0},t.setUniformValue=function(t,e,i){t[e]?t[e].value=i:t[e]=new ec.Uniform(i)},t.sortByOrder=ek,t.spec=ie,t.thresholdFrag=rB,t.throwDestroyedError=eK,t.trailVert=rF,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=nJ,t.unregisterPlugin=function(t){delete e3[t],delete e1[t],eC(e2,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=nZ,t.vecMulCombine=nq,t.version=uM,t.vertexFormatType2GLType=function(t){switch(t){case t2.Float32:return WebGLRenderingContext.FLOAT;case t2.Int16:return WebGLRenderingContext.SHORT;case t2.Int8:return WebGLRenderingContext.BYTE;case t2.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case t2.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
8
8
  //# sourceMappingURL=index.min.js.map