@galacean/effects-threejs 2.0.0-beta.2 → 2.0.1
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.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +6 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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.0.
|
|
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,o,a,s,u,c,h,l,f,d,p,m,v,y,g,x,T,b,E,_,C,S,A,w,O,R,I,M,L,P,V,F,N,D,z,k,U,B,G,X,j,H,W,Y,Z,q,Q,K,J,$,tt,te,ti,tr,tn,to,ta,ts,tu,tc,th,tl,tf,td,tp,tm,tv,ty,tg,tx,tT,tb,tE,t_,tC,tS,tA,tw,tO,tR,tI,tM,tL,tP,tV,tF,tN,tD,tz,tk,tU,tB,tG,tX,tj,tH,tW,tY,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9=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 t7(t,e,i,r,n,o,a){try{var s=t[o](a),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function et(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var o=t.apply(e,i);function a(t){t7(o,r,n,a,s,"next",t)}function s(t){t7(o,r,n,a,s,"throw",t)}a(void 0)})}}function ee(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):ee(t,e)}function ei(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function er(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a}function en(t,e){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),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 eo=new Uint8Array(16),ea=[],es=0;es<256;++es)ea.push((es+256).toString(16).slice(1));var eu={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ec(t,e){return t.includes(e)||t.push(e),t}function eh(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function el(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 o=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(o);return a.set(t),a}return t}function ef(t,e){var i=[0,0,0,0];if(eI(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 ee(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)i[o]/=255;return i}function ed(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){r=em(o.color,a.color,(e-o.stop)/(a.stop-o.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 ep(t){var e=[];if(ee(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4];e.push({stop:ev(i),color:[r,n,o,a]})}):Object.keys(t).forEach(function(i){var r=ef(t[i]);e.push({stop:ev(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=[],o=1-i;if(r)for(var a=0;a<4;a++)n[a]=t[a]*o+e[a]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*o+e[s]*e[s]*i));n[3]=Math.round(t[3]*o+e[3]*i)}return n}function ev(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function ey(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function eg(){return ey()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function ex(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eT(){return"miniprogram"===window.__wxjs_environment}function eb(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=ep(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var o=n/128,a=void 0,s=void 0,u=0;u<r.length&&(a=r[u],s=r[u+1],!(a.stop<=o)||!(s.stop>o));u++);var c=em(a.color,s.color,(o-a.stop)/(s.stop-a.stop));i.set(c,4*n)}i.set(r[r.length-1].color,508)}return e}function eE(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 o,a,s=e[r],u=r,c=n;u<c;){if(2===i){for(;e[c].priority>s.priority&&c>=u;)c--;for(;e[u].priority<=s.priority&&u<c;)u++}else{for(;e[c].priority<s.priority&&c>=u;)c--;for(;e[u].priority>=s.priority&&u<c;)u++}o=[e[c],e[u]],e[u]=o[0],e[c]=o[1]}return a=[e[u],e[r]],e[r]=a[0],e[u]=a[1],t(e,i,r,u-1),t(e,i,c+1,n),e}(t,e);for(var r=1;r<i;r++)eC(t,r,e);return t}function e_(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&eC(t,t.length-1,i)),t}function eC(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 eS(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eA(t){return/^[^\d.][\w-]*$/.test(t)}function ew(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 eO={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(ew(t),[r])),null==tc||tc("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(ew(t))),null==tc||tc("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(ew(t))),null==tc||tc("warn",t,r)},register:function(t){t&&eL(t)&&(tc=t)}};function eR(){}function eI(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 eM=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eL(t){return"[object Function]"===Object.prototype.toString.call(t)}function eP(t){return"[object Object]"===Object.prototype.toString.call(t)}function eV(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eF(t,e){return t+Math.random()*(e-t)}function eN(){throw Error("Destroyed item cannot be used again.")}function eD(){return(function(t,e,i){if(eu.randomUUID&&!t)return eu.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tu&&!(tu="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 tu(eo)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),ea[n[r+0]]+ea[n[r+1]]+ea[n[r+2]]+ea[n[r+3]]+"-"+ea[n[r+4]]+ea[n[r+5]]+"-"+ea[n[r+6]]+ea[n[r+7]]+"-"+ea[n[r+8]]+ea[n[r+9]]+"-"+ea[n[r+10]]+ea[n[r+11]]+ea[n[r+12]]+ea[n[r+13]]+ea[n[r+14]]+ea[n[r+15]]})().replace(/-/g,"")}function ez(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],o=0;o<r.length;o+=512){for(var a=r.slice(o,o+512),s=Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);var c=new Uint8Array(s);n.push(c)}return new File([new Blob(n,{type:i})],e,{type:i})}function ek(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)})})}function eU(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 eB(t,e,i){return e&&eU(t.prototype,e),i&&eU(t,i),t}function eG(t,e){return(eG=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function eX(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&&eG(t,e)}function ej(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 eH(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 ej(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 ej(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.")}var eW=Math.PI/180,eY=180/Math.PI;function eZ(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var eq=function(t,e,i){return(1-i)*t+i*e};function eQ(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 eK=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):ee(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):ee(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):ee(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):ee(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}();eK.ONE=new eK(1,1),eK.ZERO=new eK(0,0);var eJ=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):ee(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):ee(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):ee(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):ee(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,o=e.x,a=e.y,s=e.z;return this.x=r*s-n*a,this.y=n*o-i*s,this.z=i*a-r*o,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 eK(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}();eJ.X=new eJ(1,0,0),eJ.Y=new eJ(0,1,0),eJ.Z=new eJ(0,0,1),eJ.ONE=new eJ(1,1,1),eJ.ZERO=new eJ(0,0,0);var e$=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),o=t.tempVec0;return o.copyFrom(e).normalize(),this.x=o.x*n,this.y=o.y*n,this.z=o.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],o=e[1],a=e[5],s=e[9],u=e[2],c=e[6],h=e[10],l=i+a+h;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(c-s)*f,this.y=(n-u)*f,this.z=(o-r)*f}else if(i>a&&i>h){var d=2*Math.sqrt(1+i-a-h);this.w=(c-s)/d,this.x=.25*d,this.y=(r+o)/d,this.z=(n+u)/d,this.negate()}else if(a>h){var p=2*Math.sqrt(1+a-i-h);this.w=(n-u)/p,this.x=(r+o)/p,this.y=.25*p,this.z=(s+c)/p,this.negate()}else{var m=2*Math.sqrt(1+h-i-a);this.w=(o-r)/m,this.x=(n+u)/m,this.y=(s+c)/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(eQ(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,o=t.w,a=e.x,s=e.y,u=e.z,c=e.w;return this.x=i*c+o*a+r*u-n*s,this.y=r*c+o*s+n*a-i*u,this.z=n*c+o*u+i*s-r*a,this.w=o*c-i*a-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,o=this.w,a=o*t.w+i*t.x+r*t.y+n*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=o,this.x=i,this.y=r,this.z=n,this;var s=1-a*a;if(s<=Number.EPSILON){var u=1-e;return this.w=u*o+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 c=Math.sqrt(s),h=Math.atan2(c,a),l=Math.sin((1-e)*h)/c,f=Math.sin(e*h)/c;return this.w=o*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,o=this.w,a=t.x,s=t.y,u=t.z,c=o*a+r*u-n*s,h=o*s+n*a-i*u,l=o*u+i*s-r*a,f=-i*a-r*s-n*u,d=null!=e?e:t;return d.x=c*o+-(f*i)+-(h*n)- -(l*r),d.y=h*o+-(f*r)+-(l*i)- -(c*n),d.z=l*o+-(f*n)+-(c*r)- -(h*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(eJ.ZERO,this,eJ.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}();e$.tempVec0=new eJ;var e0=function(){function t(t,e,i,r,n,o,a,s,u,c,h,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===o&&(o=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===h&&(h=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,o,a,s,u,c,h,l,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,a,s,u,c,h,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]=o,v[6]=a,v[7]=s,v[8]=u,v[9]=c,v[10]=h,v[11]=l,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,o,a,s,u,c,h,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]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=c,v[10]=h,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),o=Math.sin(i),a=1-n,s=r.x,u=r.y,c=r.z,h=a*s,l=a*u;return this.set(h*s+n,h*u+o*c,h*c-o*u,0,h*u-o*c,l*u+n,l*c+o*s,0,h*c+o*u,l*c-o*s,a*c*c+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(eJ.ZERO,t,eJ.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,o=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,i),a.normalize(),n.crossVectors(r,a),n.normalize(),o.crossVectors(a,n);var s=this.elements;return s[0]=n.x,s[1]=o.x,s[2]=a.x,s[3]=0,s[4]=n.y,s[5]=o.y,s[6]=a.y,s[7]=0,s[8]=n.z,s[9]=o.z,s[10]=a.z,s[11]=0,s[12]=-n.dot(e),s[13]=-o.dot(e),s[14]=-a.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,o=i[0],a=i[4],s=i[8],u=i[12],c=i[1],h=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],T=i[15],b=r[0],E=r[4],_=r[8],C=r[12],S=r[1],A=r[5],w=r[9],O=r[13],R=r[2],I=r[6],M=r[10],L=r[14],P=r[3],V=r[7],F=r[11],N=r[15];return n[0]=o*b+a*S+s*R+u*P,n[4]=o*E+a*A+s*I+u*V,n[8]=o*_+a*w+s*M+u*F,n[12]=o*C+a*O+s*L+u*N,n[1]=c*b+h*S+l*R+f*P,n[5]=c*E+h*A+l*I+f*V,n[9]=c*_+h*w+l*M+f*F,n[13]=c*C+h*O+l*L+f*N,n[2]=d*b+p*S+m*R+v*P,n[6]=d*E+p*A+m*I+v*V,n[10]=d*_+p*w+m*M+v*F,n[14]=d*C+p*O+m*L+v*N,n[3]=y*b+g*S+x*R+T*P,n[7]=y*E+g*A+x*I+T*V,n[11]=y*_+g*w+x*M+T*F,n[15]=y*C+g*O+x*L+T*N,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],o=t[1],a=t[5],s=t[9],u=t[13],c=t[2],h=t[6],l=t[10],f=t[14];return t[3]*(+n*s*h-r*u*h-n*a*l+i*u*l+r*a*f-i*s*f)+t[7]*(+e*s*f-e*u*l+n*o*l-r*o*f+r*u*c-n*s*c)+t[11]*(+e*u*h-e*a*f-n*o*h+i*o*f+n*a*c-i*u*c)+t[15]*(-r*a*c-e*s*h+e*a*l+r*o*h-i*o*l+i*s*c)},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],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],h=t[9],l=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=h*m*u-p*l*u+p*s*f-a*m*f-h*s*v+a*l*v,g=d*l*u-c*m*u-d*s*f+o*m*f+c*s*v-o*l*v,x=c*p*u-d*h*u+d*a*f-o*p*f-c*a*v+o*h*v,T=d*h*s-c*p*s-d*a*l+o*p*l+c*a*m-o*h*m,b=e*y+i*g+r*x+n*T;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/b;return t[0]=y*E,t[1]=(p*l*n-h*m*n-p*r*f+i*m*f+h*r*v-i*l*v)*E,t[2]=(a*m*n-p*s*n+p*r*u-i*m*u-a*r*v+i*s*v)*E,t[3]=(h*s*n-a*l*n-h*r*u+i*l*u+a*r*f-i*s*f)*E,t[4]=g*E,t[5]=(c*m*n-d*l*n+d*r*f-e*m*f-c*r*v+e*l*v)*E,t[6]=(d*s*n-o*m*n-d*r*u+e*m*u+o*r*v-e*s*v)*E,t[7]=(o*l*n-c*s*n+c*r*u-e*l*u-o*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*h*n-c*p*n-d*i*f+e*p*f+c*i*v-e*h*v)*E,t[10]=(o*p*n-d*a*n+d*i*u-e*p*u-o*i*v+e*a*v)*E,t[11]=(c*a*n-o*h*n-c*i*u+e*h*u+o*i*f-e*a*f)*E,t[12]=T*E,t[13]=(c*p*r-d*h*r+d*i*l-e*p*l-c*i*m+e*h*m)*E,t[14]=(d*a*r-o*p*r-d*i*s+e*p*s+o*i*m-e*a*m)*E,t[15]=(o*h*r-c*a*r+c*i*s-e*h*s-o*i*l+e*a*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=eJ.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,u=e.w,c=-r.x,h=-r.y,l=-r.z,f=o+o,d=a+a,p=s+s,m=o*f,v=o*d,y=o*p,g=a*d,x=a*p,T=s*p,b=u*f,E=u*d,_=u*p,C=i.x,S=i.y,A=i.z;return n[0]=(1-(g+T))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+T))*S,n[6]=(x+b)*S,n[7]=0,n[8]=(y+E)*A,n[9]=(x-b)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=c*n[0]+h*n[4]+l*n[8]-c+t.x,n[13]=c*n[1]+h*n[5]+l*n[9]-h+t.y,n[14]=c*n[2]+h*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,o=this.elements,a=n.set(o[0],o[1],o[2]).length(),s=n.set(o[4],o[5],o[6]).length(),u=n.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),e.x=o[12],e.y=o[13],e.z=o[14];var c=t.tempMat0;c.copyFrom(this);var h=1/a,l=1/s,f=1/u;return c.elements[0]*=h,c.elements[1]*=h,c.elements[2]*=h,c.elements[4]*=l,c.elements[5]*=l,c.elements[6]*=l,c.elements[8]*=f,c.elements[9]*=f,c.elements[10]*=f,i.setFromRotationMatrix(c),r.x=a,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 eJ,e=new e$,i=new eJ;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,o){var a=1/(e-t),s=1/(i-r),u=1/(o-n),c=-(e+t)*a,h=-(i+r)*s,l=-(o+n)*u;a*=2,s*=2,u*=-2;var f=this.elements;return f[0]=a,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]=c,f[13]=h,f[14]=l,f[15]=1,this},e.perspective=function(t,e,i,r,n){var o=1/Math.tan(.5*t),a=1/(i-r),s=this.elements;return s[0]=n?o:o/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?o*e:o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*a,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,o=this.elements,a=null!=e?e:t;a.x=o[0]*i+o[4]*r+o[8]*n+o[12],a.y=o[1]*i+o[5]*r+o[9]*n+o[13],a.z=o[2]*i+o[6]*r+o[10]*n+o[14];var s=o[3]*i+o[7]*r+o[11]*n+o[15];return a.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[4]*r+o[8]*n+o[12],a.y=o[1]*i+o[5]*r+o[9]*n+o[13],a.z=o[2]*i+o[6]*r+o[10]*n+o[14],a},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[4]*r+o[8]*n,a.y=o[1]*i+o[5]*r+o[9]*n,a.z=o[2]*i+o[6]*r+o[10]*n,a.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,o=t.w,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n+a[12]*o,s.y=a[1]*i+a[5]*r+a[9]*n+a[13]*o,s.z=a[2]*i+a[6]*r+a[10]*n+a[14]*o,s.w=a[3]*i+a[7]*r+a[11]*n+a[15]*o,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!eZ(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,o){return new t().perspective(e,i,r,n,o)},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,o,a,s,u,c,h,l,f,d,p,m,v){return new t(e,o,c,d,i,a,h,p,r,s,l,m,n,u,f,v)},t}();e0.IDENTITY=new e0(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),e0.ZERO=new e0(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),e0.tempVec0=new eJ,e0.tempVec1=new eJ,e0.tempVec2=new eJ,e0.tempMat0=new e0,(n=th||(th={}))[n.XYZ=0]="XYZ",n[n.XZY=1]="XZY",n[n.YXZ=2]="YXZ",n[n.YZX=3]="YZX",n[n.ZXY=4]="ZXY",n[n.ZYX=5]="ZYX";var e1=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],o=i[8],a=i[1],s=i[5],u=i[9],c=i[2],h=i[6],l=i[10];switch(e){case th.XYZ:this.y=Math.asin(eQ(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(h,s),this.z=0);break;case th.YXZ:this.x=Math.asin(-eQ(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(o,l),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-c,r),this.z=0);break;case th.ZXY:this.x=Math.asin(eQ(h,-1,1)),.9999999>Math.abs(h)?(this.y=Math.atan2(-c,l),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,r));break;case th.ZYX:this.y=Math.asin(-eQ(c,-1,1)),.9999999>Math.abs(c)?(this.x=Math.atan2(h,l),this.z=Math.atan2(a,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case th.YZX:this.z=Math.asin(eQ(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-c,r)):(this.x=0,this.y=Math.atan2(o,l));break;case th.XZY:this.z=Math.asin(-eQ(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(h,s),this.y=Math.atan2(o,r)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=eY,this.y*=eY,this.z*=eY,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,o,a;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!=(o=t[e+2])?o:0,this.order=null!=(a=t[e+3])?a: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 e$;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,o=Math.cos(e*eW*.5),a=Math.cos(i*eW*.5),s=Math.cos(r*eW*.5),u=Math.sin(e*eW*.5),c=Math.sin(i*eW*.5),h=Math.sin(r*eW*.5);switch(n){case th.XYZ:t.set(u*a*s+o*c*h,o*c*s-u*a*h,o*a*h+u*c*s,o*a*s-u*c*h);break;case th.YXZ:t.set(u*a*s+o*c*h,o*c*s-u*a*h,o*a*h-u*c*s,o*a*s+u*c*h);break;case th.ZXY:t.set(u*a*s-o*c*h,o*c*s+u*a*h,o*a*h+u*c*s,o*a*s-u*c*h);break;case th.ZYX:t.set(u*a*s-o*c*h,o*c*s+u*a*h,o*a*h-u*c*s,o*a*s+u*c*h);break;case th.YZX:t.set(u*a*s+o*c*h,o*c*s+u*a*h,o*a*h-u*c*s,o*a*s-u*c*h);break;case th.XZY:t.set(u*a*s-o*c*h,o*c*s-u*a*h,o*a*h+u*c*s,o*a*s+u*c*h);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,o=this.order,a=Math.cos(i*eW),s=Math.sin(i*eW),u=Math.cos(r*eW),c=Math.sin(r*eW),h=Math.cos(n*eW),l=Math.sin(n*eW);if(o===th.XYZ){var f=a*h,d=a*l,p=s*h,m=s*l;e[0]=u*h,e[4]=-u*l,e[8]=c,e[1]=d+p*c,e[5]=f-m*c,e[9]=-s*u,e[2]=m-f*c,e[6]=p+d*c,e[10]=a*u}else if(o===th.YXZ){var v=u*h,y=u*l,g=c*h,x=c*l;e[0]=v+x*s,e[4]=g*s-y,e[8]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=a*u}else if(o===th.ZXY){var T=u*h,b=u*l,E=c*h,_=c*l;e[0]=T-_*s,e[4]=-a*l,e[8]=E+b*s,e[1]=b+E*s,e[5]=a*h,e[9]=_-T*s,e[2]=-a*c,e[6]=s,e[10]=a*u}else if(o===th.ZYX){var C=a*h,S=a*l,A=s*h,w=s*l;e[0]=u*h,e[4]=A*c-S,e[8]=C*c+w,e[1]=u*l,e[5]=w*c+C,e[9]=S*c-A,e[2]=-c,e[6]=s*u,e[10]=a*u}else if(o===th.YZX){var O=a*u,R=a*c,I=s*u,M=s*c;e[0]=u*h,e[4]=M-O*l,e[8]=I*l+R,e[1]=l,e[5]=a*h,e[9]=-s*h,e[2]=-c*h,e[6]=R*l+I,e[10]=O-M*l}else if(o===th.XZY){var L=a*u,P=a*c,V=s*u,F=s*c;e[0]=u*h,e[4]=-l,e[8]=c*h,e[1]=L*l+F,e[5]=a*h,e[9]=P*l-V,e[2]=V*l-P,e[6]=s*h,e[10]=F*l+L}else console.error("toMatrix4: Invalid order "+o);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}();e1.DEFAULT_ORDER=th.ZYX,e1.tempQuat0=new e$,e1.tempMat0=new e0,(o=tl||(tl={})).S="S",o.APlus="A+",o.A="A",o.BPlus="B+",o.B="B",(a=tf||(tf={}))[a.ALPHA=0]="ALPHA",a[a.ADD=1]="ADD",a[a.MULTIPLY=2]="MULTIPLY",a[a.BRIGHTNESS=3]="BRIGHTNESS",a[a.SUBTRACTION=4]="SUBTRACTION",a[a.STRONG_LIGHT=5]="STRONG_LIGHT",a[a.WEAK_LIGHT=6]="WEAK_LIGHT",a[a.SUPERPOSITION=7]="SUPERPOSITION",(s=td||(td={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=tp||(tp={}))[u.NONE=0]="NONE",u[u.MASK=1]="MASK",u[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(c=tm||(tm={}))[c.NONE=0]="NONE",c[c.SPHERE=1]="SPHERE",c[c.CONE=2]="CONE",c[c.HEMISPHERE=3]="HEMISPHERE",c[c.CIRCLE=4]="CIRCLE",c[c.DONUT=5]="DONUT",c[c.RECTANGLE=6]="RECTANGLE",c[c.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",c[c.EDGE=8]="EDGE",c[c.TEXTURE=9]="TEXTURE",(h=tv||(tv={}))[h.GYROSCOPE=0]="GYROSCOPE",h[h.SPINE=1]="SPINE",(l=ty||(ty={}))[l.CLICK=0]="CLICK",l[l.MESSAGE=1]="MESSAGE",l[l.DRAG=2]="DRAG",(f=tg||(tg={}))[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=tx||(tx={})).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.node="node",(p=tT||(tT={}))[p.BILLBOARD=0]="BILLBOARD",p[p.MESH=1]="MESH",p[p.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",p[p.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(m=tb||(tb={}))[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=tE||(tE={})).Opaque="Opaque",v.Transparent="Transparent",(y=t_||(t_={})).Both="Both",y.Back="Back",y.Front="Front",(g=tC||(tC={}))[g.portrait=1]="portrait",g[g.landscape=0]="landscape",(x=tS||(tS={})).video="video",x.image="image",(T=tA||(tA={}))[T.CONSTANT=0]="CONSTANT",T[T.CONSTANT_VEC2=1]="CONSTANT_VEC2",T[T.CONSTANT_VEC3=2]="CONSTANT_VEC3",T[T.CONSTANT_VEC4=3]="CONSTANT_VEC4",T[T.RANDOM=4]="RANDOM",T[T.LINE=5]="LINE",T[T.CURVE=6]="CURVE",T[T.BEZIER_PATH=7]="BEZIER_PATH",T[T.RGBA_COLOR=8]="RGBA_COLOR",T[T.GRADIENT_COLOR=9]="GRADIENT_COLOR",T[T.SHAPE_POINTS=10]="SHAPE_POINTS",T[T.SHAPE_SPLITS=11]="SHAPE_SPLITS",T[T.LINEAR_PATH=12]="LINEAR_PATH",T[T.COLORS=13]="COLORS",T[T.BINARY=20]="BINARY",T[T.BEZIER_CURVE=21]="BEZIER_CURVE",T[T.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",T[T.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",(b=tw||(tw={}))[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",(E=tO||(tO={}))[E.destroy=0]="destroy",E[E.restart=5]="restart",E[E.forward=2]="forward",E[E.freeze=4]="freeze",(_=tR||(tR={}))[_.destroyChildren=6]="destroyChildren",(C=tI||(tI={}))[C.none=0]="none",C[C.removeParticle=1]="removeParticle",(S=tM||(tM={}))[S.RANDOM=0]="RANDOM",S[S.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",S[S.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",S[S.UNIFORM_BURST=3]="UNIFORM_BURST",(A=tL||(tL={})).point="point",A.spot="spot",A.directional="directional",A.ambient="ambient",(w=tP||(tP={}))[w.box=2]="box",w[w.sphere=3]="sphere",(O=tV||(tV={})).orthographic="orthographic",O.perspective="perspective",(R=tF||(tF={})).unlit="unlit",R.pbr="pbr",R.hair="hair",(I=tN||(tN={}))[I.opaque=100]="opaque",I[I.masked=101]="masked",I[I.translucent=102]="translucent",I[I.additive=103]="additive",(M=tD||(tD={})).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",(L=tz||(tz={}))[L.display=0]="display",L[L.clip=1]="clip",L[L.ellipsis=2]="ellipsis",(P=tk||(tk={}))[P.top=0]="top",P[P.middle=1]="middle",P[P.bottom=2]="bottom",(V=tU||(tU={}))[V.left=0]="left",V[V.middle=1]="middle",V[V.right=2]="right",(F=tB||(tB={})).normal="normal",F.bold="bold",F.lighter="lighter",(N=tG||(tG={})).normal="normal",N.italic="italic",N.oblique="oblique",(D=tX||(tX={})).VFXItemData="VFXItemData",D.EffectComponent="EffectComponent",D.Material="Material",D.Shader="Shader",D.SpriteComponent="SpriteComponent",D.ParticleSystem="ParticleSystem",D.InteractComponent="InteractComponent",D.CameraController="CameraController",D.Geometry="Geometry",D.Texture="Texture",D.AnimationClip="AnimationClip",D.TextComponent="TextComponent",D.BinaryAsset="BinaryAsset",D.TrackAsset="TrackAsset",D.TimelineAsset="TimelineAsset",D.ObjectBindingTrack="ObjectBindingTrack",D.TransformTrack="TransformTrack",D.SpriteColorTrack="SpriteColorTrack",D.ActivationTrack="ActivationTrack",D.SubCompositionTrack="SubCompositionTrack",D.TransformPlayableAsset="TransformPlayableAsset",D.SpriteColorPlayableAsset="SpriteColorPlayableAsset",D.ActivationPlayableAsset="ActivationPlayableAsset",D.SubCompositionPlayableAsset="SubCompositionPlayableAsset",D.MeshComponent="MeshComponent",D.SkyboxComponent="SkyboxComponent",D.LightComponent="LightComponent",D.CameraComponent="CameraComponent",D.ModelPluginComponent="ModelPluginComponent",D.TreeComponent="TreeComponent",D.AnimationComponent="AnimationComponent",D.SpineComponent="SpineComponent",D.TimelineClip="TimelineClip",(z=tj||(tj={}))[z.POINTS=0]="POINTS",z[z.LINES=1]="LINES",z[z.LINE_LOOP=2]="LINE_LOOP",z[z.LINE_STRIP=3]="LINE_STRIP",z[z.TRIANGLES=4]="TRIANGLES",z[z.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",z[z.TRIANGLE_FAN=6]="TRIANGLE_FAN",(k=tH||(tH={}))[k.Float16=0]="Float16",k[k.Float32=1]="Float32",k[k.Int8=2]="Int8",k[k.Int16=3]="Int16",k[k.Int32=4]="Int32",k[k.UInt8=5]="UInt8",k[k.UInt16=6]="UInt16",k[k.UInt32=7]="UInt32",(U=tW||(tW={}))[U.None=-1]="None",U[U.UInt8=0]="UInt8",U[U.UInt16=1]="UInt16",U[U.UInt32=2]="UInt32",(B=tY||(tY={})).Position="POSITION",B.Uv="TEXCOORD0",B.Uv2="TEXCOORD1",B.Normal="NORMAL",B.Tangent="TANGENT",B.Color="COLOR",B.Joints="JOINTS",B.Weights="WEIGHTS",B.PositionBS0="POSITION_BS0",B.PositionBS1="POSITION_BS1",B.PositionBS2="POSITION_BS2",B.PositionBS3="POSITION_BS3",B.PositionBS4="POSITION_BS4",B.PositionBS5="POSITION_BS5",B.PositionBS6="POSITION_BS6",B.PositionBS7="POSITION_BS7",B.NormalBS0="NORMAL_BS0",B.NormalBS1="NORMAL_BS1",B.NormalBS2="NORMAL_BS2",B.NormalBS3="NORMAL_BS3",B.TangentBS0="TANGENT_BS0",B.TangentBS1="TANGENT_BS1",B.TangentBS2="TANGENT_BS2",B.TangentBS3="TANGENT_BS3";var e2=Object.freeze({__proto__:null,get RenderLevel(){return tl},get BlendingMode(){return tf},get SideMode(){return td},get MaskMode(){return tp},get ShapeType(){return tm},get PluginType(){return tv},get InteractType(){return ty},get InteractBehavior(){return tg},get ItemType(){return tx},get RenderMode(){return tT},get ParticleOrigin(){return tb},get RenderType(){return tE},get RenderFace(){return t_},get CameraClipMode(){return tC},get BackgroundType(){return tS},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 tA},get BezierKeyframeType(){return tw},get EndBehavior(){return tO},get ParentItemEndBehavior(){return tR},get ParticleInteractionBehavior(){return tI},get ShapeArcMode(){return tM},get LightType(){return tL},get ModelBoundingType(){return tP},get CameraType(){return tV},get MaterialType(){return tF},get MaterialBlending(){return tN},get RenderMode3D(){return tD},get TextOverflow(){return tz},get TextBaseline(){return tk},get TextAlignment(){return tU},get TextWeight(){return tB},get FontStyle(){return tG},get DataType(){return tX},get GeometryType(){return tj},get VertexFormatType(){return tH},get IndexFormatType(){return tW},get VertexBufferSemantic(){return tY},BuiltinObjectGUID:{WhiteTexture:"whitetexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"}}),e3=new Map,e4=new Map,e5={};function e6(t){return function(e,i){e5[t]&&console.warn("Class "+t+" is already registered."),e5[t]=e}}function e8(t){var e=t.constructor;if(e4.get(e))return e4.get(e);var i={};e4.set(e,i);for(var r=t,n=e;n;){var o=e3.get(n);for(var a in o)i[a]=o[a];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function e9(t,e){return function(i,r){var n,o=(n=i.constructor,e3.get(n)||e3.set(n,{}),e3.get(n));o&&(o[r]||(o[r]={type:t,sourceName:e}))}}var e7=function(){function t(t){this.engine=t,this.guid=eD(),this.taggedProperties={},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){t.id&&this.setInstanceId(t.id)},e.dispose=function(){},t.is=function(e){return ee(e,t)&&"guid"in e},t}(),it=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onAttached=function(){},i.onDestroy=function(){},i.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},i.dispose=function(){this.onDestroy(),this.item&&eh(this.item.components,this)},eB(e,[{key:"transform",get:function(){return this.item.transform}}]),e}(e7),ie=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isAwakeCalled=!1,e.isStartCalled=!1,e._enabled=!0,e}eX(e,t);var i=e.prototype;return i.awake=function(){},i.onEnable=function(){},i.start=function(){},i.update=function(t){},i.lateUpdate=function(t){},i.onAttached=function(){this.item.itemBehaviours.push(this),this.isAwakeCalled||(this.awake(),this.isAwakeCalled=!0)},i.dispose=function(){this.item&&eh(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},eB(e,[{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&(this.isActiveAndEnabled&&this.onEnable(),this.isStartCalled||(this.start(),this.isStartCalled=!0))}}]),e}(it);er([e9(void 0,void 0)],ie.prototype,"_enabled",void 0);var ii=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isStartCalled=!1,e.materials=[],e._priority=0,e._enabled=!0,e}eX(e,t);var i=e.prototype;return i.onEnable=function(){},i.start=function(){},i.update=function(t){},i.lateUpdate=function(t){},i.render=function(t){},i.onAttached=function(){this.item.rendererComponents.push(this)},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.toData=function(){t.prototype.toData.call(this)},i.dispose=function(){this.item&&eh(this.item.rendererComponents,this),t.prototype.dispose.call(this)},eB(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onEnable()}},{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(it);er([e9(void 0,void 0)],ii.prototype,"materials",void 0),er([e9(void 0,void 0)],ii.prototype,"_priority",void 0),er([e9(void 0,void 0)],ii.prototype,"_enabled",void 0);var ir=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return 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.precompile=function(t,e){return Promise.resolve()},t}();t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}eX(e,t);var i=e.prototype;return i.update=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.position=this.transform.getWorldPosition(),t.rotation=this.transform.getWorldRotation()}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(ie),t.CameraController=er([e6(tX.CameraController)],t.CameraController);var io=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(ir);t.HitTestType=void 0,(G=t.HitTestType||(t.HitTestType={}))[G.triangle=1]="triangle",G[G.box=2]="box",G[G.sphere=3]="sphere",G[G.custom=4]="custom";var ia="click",is="touchstart",iu="touchmove",ic="touchend",ih=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,o,a=this;n=function(t){return t};var s="mousedown",u="mousemove",c="mouseup",h=function(t,e,i,n,o){void 0===n&&(n=0),void 0===o&&(o=0);var s=0,u=0,c=performance.now();if(!a.target)return eO.error("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:o,ts:c,width:0,height:0,origin:t};var h=a.target,l=h.width,f=h.height;if(r){var d=c-r.ts;s=(n-r.dx)/d||0,u=(o-r.dy)/d||0,r={dx:n,dy:o,ts:c}}return{x:e,y:i,vx:s,vy:u,dx:n,dy:o,ts:c,width:l,height:f,origin:t}};eg()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((o={})[s]=function(o){if(a.enabled){var s=n(o),u=il(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},a.dispatchEvent(is,h(o,t,e))}},o[u]=function(r){if(i&&a.enabled){var o=il(n(r));t=o.x,e=o.y,a.dispatchEvent(iu,h(r,t,e,t-i.x,e-i.y))}},o[c]=function(r){if(i&&a.enabled){!a.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var o=n(r),s=il(o),u=Math.abs(i.clientX-o.clientX)+Math.abs(i.clientY-o.clientY);t=s.x,e=s.y,u<4&&a.dispatchEvent(ia,h(r,t,e)),a.dispatchEvent(ic,h(r,t,e,t-i.x,e-i.y))}i=0},o),Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.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]=[]),ec(i,e),function(){eh(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&eh(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 il(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),o=n.left,a=n.top;return{x:(i-o)/n.width*2-1,y:1-(r-a)/n.height*2}}var id=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(ir),ip=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,o;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!=(o=t[e+3])?o: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):ee(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):ee(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):ee(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):ee(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 eJ(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}();ip.ONE=new ip(1,1,1,1),ip.ZERO=new ip(0,0,0,0);var im=function(){function t(t,e,i,r,n,o,a,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===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,o,a,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=r,c[6]=a,c[1]=e,c[4]=n,c[7]=s,c[2]=i,c[5]=o,c[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=e,c[6]=i,c[1]=r,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[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,o=e+e,a=i+i,s=r+r,u=e*o,c=e*a,h=e*s,l=i*a,f=i*s,d=r*s,p=n*o,m=n*a,v=n*s,y=this.elements;return y[0]=1-(l+d),y[1]=c+v,y[2]=h-m,y[3]=c-v,y[4]=1-(u+d),y[5]=f+p,y[6]=h+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],o=r[3],a=r[6],s=r[1],u=r[4],c=r[7];return r[0]=e*n+i*s,r[3]=e*o+i*u,r[6]=e*a+i*c,r[1]=-i*n+e*s,r[4]=-i*o+e*u,r[7]=-i*a+e*c,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,o=i[0],a=i[3],s=i[6],u=i[1],c=i[4],h=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],T=r[2],b=r[5],E=r[8];return n[0]=o*p+a*y+s*T,n[3]=o*m+a*g+s*b,n[6]=o*v+a*x+s*E,n[1]=u*p+c*y+h*T,n[4]=u*m+c*g+h*b,n[7]=u*v+c*x+h*E,n[2]=l*p+f*y+d*T,n[5]=l*m+f*g+d*b,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],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8];return e*(o*c-u*a)+n*(u*r-i*c)+s*(i*a-o*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8],h=c*o-u*a,l=u*r-c*i,f=a*i-o*r,d=e*h+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]=h*p,t[1]=(s*a-c*n)*p,t[2]=(u*n-s*o)*p,t[3]=l*p,t[4]=(c*e-s*r)*p,t[5]=(s*i-u*e)*p,t[6]=f*p,t[7]=(n*r-a*e)*p,t[8]=(o*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,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[3]*r+o[6]*n,a.y=o[1]*i+o[4]*r+o[7]*n,a.z=o[2]*i+o[5]*r+o[8]*n,a},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(!eZ(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,o,a,s,u,c){return new t(e,n,s,i,o,u,r,a,c)},t}(),iv=function(){function t(t,e){void 0===t&&(t=eJ.ZERO),void 0===e&&(e=eJ.X),this.origin=new eJ,this.direction=new eJ,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 eJ;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,o,a,s,u=this.origin,c=u.x,h=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,T=t.max,b=T.x,E=T.y,_=T.z,C=1/d,S=1/p,A=1/m;if(C>=0?(i=(y-c)*C,r=(b-c)*C):(i=(b-c)*C,r=(y-c)*C),S>=0?(n=(g-h)*S,o=(E-h)*S):(n=(E-h)*S,o=(g-h)*S),!(i>o)&&!(n>r)&&((n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),(n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),A>=0?(a=(x-l)*A,s=(_-l)*A):(a=(_-l)*A,s=(x-l)*A),!(i>s)&&!(a>r))&&((a>i||i!=i)&&(i=a),(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 eJ).copyFrom(this.origin):void 0;var o=-(this.origin.dot(i)+r)/n;return o>=0?this.at(o,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),o=n.dot(this.direction),a=n.dot(n)-o*o,s=e.radius*e.radius;if(!(a>s)){var u=Math.sqrt(s-a),c=o-u,h=o+u;if(!(h<0))return c>=0?this.at(c,i):this.at(h,i)}},e.intersectTriangle=function(e,i,r){var n,o=e.p0,a=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(a,o),c=t.tempVec1.subtractVectors(s,o),h=t.tempVec2.subtractVectors(this.origin,o),l=t.tempVec3.crossVectors(u,c),f=this.direction.dot(l);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}c.crossVectors(h,c);var d=n*this.direction.dot(c);if(!(d<0)){u.cross(h);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*h.dot(l);if(!(m<0))return this.at(m/f,i)}}},t}();iv.tempVec0=new eJ,iv.tempVec1=new eJ,iv.tempVec2=new eJ,iv.tempVec3=new eJ;var iy=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,o;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!=(o=t[e+3])?o:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,o=t/60,a=n*(1-Math.abs(o%2-1)),s=0,u=0,c=0;o>=0&&o<=1?(s=n,u=a):o>=1&&o<=2?(s=a,u=n):o>=2&&o<=3?(u=n,c=a):o>=3&&o<=4?(u=a,c=n):o>=4&&o<=5?(s=a,c=n):o>=5&&o<=6&&(s=n,c=a);var h=i-n;return this.set(s+h,u+h,c+h,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):ee(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):ee(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):ee(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):ee(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 ip(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,o=Math.max(e,i,r),a=Math.min(e,i,r),s=o-a,u=0,c=0;return 0!==o&&(c=s/o),o!=a&&(o==e?(u=(i-r)/s,i<r&&(u+=6)):o==i?u=(r-e)/s+2:o==r&&(u=(e-i)/s+4),u*=60),new t(u,c,o,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)),o=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+o:"#"+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}();iy.BLACK=new iy(0,0,0,1),iy.BLUE=new iy(0,0,1,1),iy.CLEAR=new iy(0,0,0,0),iy.CYAN=new iy(0,1,1,1),iy.GRAY=new iy(.5,.5,.5,1),iy.GREEN=new iy(0,1,0,1),iy.MAGENTA=new iy(1,0,1,1),iy.RED=new iy(1,0,0,1),iy.WHITE=new iy(1,1,1,1),iy.YELLOW=new iy(1,.92,.016,1);var ig=function(){function t(t,e){void 0===t&&(t=new eJ(1/0,1/0,1/0)),void 0===e&&(e=new eJ(-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,o=-1/0,a=-1/0,s=0,u=t.length;s<u;s+=3){var c=t[s],h=t[s+1],l=t[s+2];c<e&&(e=c),h<i&&(i=h),l<r&&(r=l),c>n&&(n=c),h>o&&(o=h),l>a&&(a=l)}return this.min.set(e,i,r),this.max.set(n,o,a),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 eJ),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 eJ),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,o=0,a=n.length;o<a;o++)this.expandByObject(n[o]);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 eJ),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 eJ;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 eJ),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 eJ),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 eJ),this.isEmpty())return[];var i=[];return i[0]=new eJ(this.min.x,this.min.y,this.min.z),i[1]=new eJ(this.min.x,this.min.y,this.max.z),i[2]=new eJ(this.min.x,this.max.y,this.min.z),i[3]=new eJ(this.min.x,this.max.y,this.max.z),i[4]=new eJ(this.max.x,this.min.y,this.min.z),i[5]=new eJ(this.max.x,this.min.y,this.max.z),i[6]=new eJ(this.max.x,this.max.y,this.min.z),i[7]=new eJ(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 eJ;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}(),ix=function(){function t(t,e){void 0===t&&(t=eJ.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 o=new ig().setFromPoints(t);o.getCenter(i),this.radius=o.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 eJ),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 ig),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 eJ().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 eJ,i=new eJ;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 eJ().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}(),iT=Object.freeze({__proto__:null,get EulerOrder(){return th},Euler:e1,Quaternion:e$,Vector2:eK,Vector3:eJ,Vector4:ip,Matrix3:im,Matrix4:e0,Ray:iv,PI2:2*Math.PI,DEG2RAD:eW,RAD2DEG:eY,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:eZ,damp:function(t,e,i,r){return eq(t,e,1-Math.exp(-i*r))},lerp:eq,degToRad:function(t){return t*eW},radToDeg:function(t){return t*eY},clamp:eQ,Color:iy,Box3:ig,Sphere:ix}),ib="editor",iE={"Item duration can't be less than 0":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"},i_=[],iC={};function iS(){"function"==typeof WebGL2RenderingContext?iA(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iA(WebGLRenderingContext),iA(WebGLRenderingContext.prototype)):i_.push("iOS16 lockdown mode, WebGL Constants not in global"),i_.length||"HALF_FLOAT"in iC||(iC.HALF_FLOAT=5131)}function iA(t){for(var e in t)/^[A-Z_]/.test(e)&&(iC[e]=t[e])}function iw(t){switch(t){case tf.ALPHA:case tf.ADD:case tf.SUBTRACTION:case tf.STRONG_LIGHT:case tf.WEAK_LIGHT:return 1;case tf.SUPERPOSITION:return 2;case tf.BRIGHTNESS:return 3;case tf.MULTIPLY:return 0;default:return 1}}function iO(t,e){switch(e){case void 0:case tf.ALPHA:t.blendFunction=[iC.ONE,iC.ONE_MINUS_SRC_ALPHA,iC.ONE,iC.ONE_MINUS_SRC_ALPHA];break;case tf.ADD:t.blendFunction=[iC.ONE,iC.ONE,iC.ONE,iC.ONE];break;case tf.SUBTRACTION:t.blendFunction=[iC.ONE,iC.ONE,iC.ZERO,iC.ONE],t.blendEquation=[iC.FUNC_REVERSE_SUBTRACT,iC.FUNC_REVERSE_SUBTRACT];break;case tf.SUPERPOSITION:t.blendFunction=[iC.ONE,iC.ONE,iC.ONE,iC.ONE];break;case tf.MULTIPLY:t.blendFunction=[iC.DST_COLOR,iC.ONE_MINUS_SRC_ALPHA,iC.DST_COLOR,iC.ONE_MINUS_SRC_ALPHA];break;case tf.BRIGHTNESS:t.blendFunction=[iC.ONE,iC.ONE_MINUS_SRC_ALPHA,iC.ONE,iC.ONE_MINUS_SRC_ALPHA];break;case tf.STRONG_LIGHT:t.blendFunction=[iC.DST_COLOR,iC.DST_ALPHA,iC.ZERO,iC.ONE];break;case tf.WEAK_LIGHT:t.blendFunction=[iC.DST_COLOR,iC.ZERO,iC.ZERO,iC.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iR(t,e){e===td.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=iC.CW,t.cullFace=e===td.BACK?iC.BACK:iC.FRONT)}function iI(t,e){switch(e){case void 0:t.stencilTest=!1;break;case tp.MASK:t.stencilTest=!0,t.stencilFunc=[iC.ALWAYS,iC.ALWAYS],t.stencilOpZPass=[iC.REPLACE,iC.REPLACE];break;case tp.OBSCURED:t.stencilTest=!0,t.stencilFunc=[iC.EQUAL,iC.EQUAL];break;case tp.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[iC.NOTEQUAL,iC.NOTEQUAL];break;case tp.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function iM(){return(iM=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)}i_.length||iS(),t.ShaderType=void 0,(X=t.ShaderType||(t.ShaderType={}))[X.vertex=0]="vertex",X[X.fragment=1]="fragment",t.TextureLoadAction=void 0,(j=t.TextureLoadAction||(t.TextureLoadAction={}))[j.whatever=0]="whatever",j[j.clear=2]="clear",t.TextureSourceType=void 0,(H=t.TextureSourceType||(t.TextureSourceType={}))[H.none=0]="none",H[H.data=1]="data",H[H.image=2]="image",H[H.compressed=3]="compressed",H[H.video=4]="video",H[H.canvas=5]="canvas",H[H.framebuffer=6]="framebuffer",H[H.mipmaps=7]="mipmaps";var iL=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 o=new XMLHttpRequest,a=function(){n.finish(t,o.status,o.response)};o.responseType=e,o.addEventListener("load",function(){200==o.status||0==o.status?n.finish(t,200,o.response):a()}),o.addEventListener("error",a),o.open("GET",t,!0),o.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||0==e?[i]:[e,i],o=n.length-1,a=r.length;o<a;o+=2)r[o].apply(null,n)},t}(),iP=!1,iV=!1;function iF(t,e){return iN.apply(this,arguments)}function iN(){return(iN=et(function(t,e){return en(this,function(i){switch(i.label){case 0:if(!(iP||!e))return[3,2];return[4,ik(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,ik(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iP=!0,[4,ik(t)];case 6:return[2]}})})).apply(this,arguments)}function iD(t,e){return iz.apply(this,arguments)}function iz(){return(iz=et(function(t,e){return en(this,function(i){switch(i.label){case 0:if(!(iV||!e))return[3,2];return[4,ik(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,ik(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iV=!0,[4,ik(t)];case 6:return[2]}})})).apply(this,arguments)}function ik(t){return iU.apply(this,arguments)}function iU(){return(iU=et(function(t){var e,i;return en(this,function(r){if(e="",ee(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else ee(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 iB(t){return iG.apply(this,arguments)}function iG(){return(iG=et(function(t){return en(this,function(e){return[2,new Promise(function(e,i){new iL().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iX(){return(iX=et(function(t){return en(this,function(e){return[2,new Promise(function(e,i){new iL().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function ij(t){return iH.apply(this,arguments)}function iH(){return(iH=et(function(t){var e;return en(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,ey()&&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(t)})})]})})).apply(this,arguments)}function iW(t,e){return iY.apply(this,arguments)}function iY(){return(iY=et(function(t,e){return en(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 iZ(t,e,i){return iq.apply(this,arguments)}function iq(){return(iq=et(function(e,i,r,n){var o,a,s,u,c,h,l;return en(this,function(f){switch(f.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return o=e.mipmaps,a=e.target,[4,Promise.all(o.map(function(t){return Promise.all(t.map(function(t){return t.id?r.assetLoader.loadGUID(t.id).data:iQ(t,i)}))}))];case 1:return s=f.sent(),[2,iM({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:a,type:t.TextureSourceType.mipmaps}})];case 2:return u=e.mipmaps,c=e.target,[4,Promise.all(u.map(function(t){return iQ(t,i)}))];case 3:return h=f.sent(),l=n[u[0][1][0]].url,[2,iM({keepImageSource:!1},e,{mipmaps:h,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:c,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 iQ(t,e){return iK.apply(this,arguments)}function iK(){return(iK=et(function(t,e){var i,r,n,o,a;return en(this,function(s){if(r=(i=t[1])[0],n=i[1],o=i[2],!(a=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,ik(new Blob([new Uint8Array(a,n,o)]))]})})).apply(this,arguments)}var iJ=1,i$=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+iJ++,i}eX(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?iC.TEXTURE_2D:i,n=e.format,o=void 0===n?iC.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),iM({minFilter:iC.NEAREST,magFilter:iC.NEAREST,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE,target:r,format:iC.RGBA,internalFormat:o,type:iC.UNSIGNED_BYTE},e)},i.fromImage=function(e,r){return et(function(){var n,o;return en(this,function(a){switch(a.label){case 0:return[4,ik(e)];case 1:return n=a.sent(),(o=i.create(r,{sourceType:t.TextureSourceType.image,image:n,id:eD(),flipY:!0})).initialize(),[2,o]}})})()},eB(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(e7);function i0(t,e,i,r){var n,o,a=e.length/i/r;return o=n=4===a||0===a?iC.RGBA:3===a?iC.RGB:2===a?iC.LUMINANCE_ALPHA:iC.LUMINANCE,i$.createWithData(t,{data:e,width:i,height:r},{type:iC.HALF_FLOAT,format:n,internalFormat:o,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE})}var i1={type:iC.UNSIGNED_BYTE,format:iC.RGBA,internalFormat:iC.RGBA,wrapS:iC.MIRRORED_REPEAT,wrapT:iC.MIRRORED_REPEAT,minFilter:iC.NEAREST,magFilter:iC.NEAREST};function i2(e){return i$.create(e,iM({id:"whitetexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},i1))}function i3(e){return i$.create(e,iM({id:"transparenttexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},i1))}var i4=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,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===o.getUint32(0,!0);if(this.glType=o.getUint32(1*n,a),this.glTypeSize=o.getUint32(2*n,a),this.glFormat=o.getUint32(3*n,a),this.glInternalFormat=o.getUint32(4*n,a),this.glBaseInternalFormat=o.getUint32(5*n,a),this.pixelWidth=o.getUint32(6*n,a),this.pixelHeight=o.getUint32(7*n,a),this.pixelDepth=o.getUint32(8*n,a),this.numberOfArrayElements=o.getUint32(9*n,a),this.numberOfFaces=o.getUint32(10*n,a),this.numberOfMipmapLevels=o.getUint32(11*n,a),this.bytesOfKeyValueData=o.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){eO.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){eO.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){eO.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,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,s);e.push({data:c,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 i5(e){var i=new i4(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,o=i.pixelHeight,a=i.glType,s=i.numberOfFaces,u=i.glInternalFormat,c=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?iC.TEXTURE_CUBE_MAP:iC.TEXTURE_2D,internalFormat:u,format:c,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,o))+1))}}var i6=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return et(function(){var i,r;return en(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,o=e.url;return r===iC.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:eI(o)&&o.length>0}if(i===t.TextureSourceType.mipmaps){var a=e.bin,s=e.mipmaps,u=e.target,c=e.maps,h=e.urls;return a?s.length>0:u===iC.TEXTURE_CUBE_MAP?c.every(function(t){return"object"==typeof t&&t}):h.every(function(t){return eI(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return et(function(){var n,o,a,s,u,c,h,l,f,d,p,m,v,y,g,x,T,b;return en(this,function(E){switch(E.label){case 0:if(n=e.type,o=e.target,a=e.map,s=e.url,u=e.bin,c=e.mipmaps,h=e.urls,l=e.maps,!(o===iC.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(a)];case 1:return f=E.sent(),[2,iM({},i,{cube:f,target:iC.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iM({},a),target:iC.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,ik(s)];case 3:return d=E.sent(),[2,iM({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:iC.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,ij(s)];case 5:return p=E.sent(),[2,iM({},i,{video:p,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,iB(s)];case 7:return m=E.sent(),[2,iM({},i5(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,iB(u)];case 9:if(v=E.sent(),g=(y=null!=o?o:iC.TEXTURE_2D)===iC.TEXTURE_2D?c.slice():c.map(function(t){return t.slice()}),o!==iC.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(c.map(function(t){return r.loadMipmapImages(t,v)}))];case 10:return x=E.sent(),[3,12];case 11:x=r.loadMipmapImages(c,v),E.label=12;case 12:return[2,iM({},i,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(o===iC.TEXTURE_2D||!o))return[3,15];return[4,Promise.all(h.map(function(t){return ik(t)}))];case 14:return T=E.sent(),[2,iM({},i,{mipmaps:T,target:iC.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:h.slice(),target:iC.TEXTURE_2D}})];case 15:if(o!==iC.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(l.map(function(t){return r.loadCubeMap(t)}))];case 16:return b=E.sent(),[2,iM({},i,{mipmaps:b,target:iC.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:l.map(function(t){return iM({},t)}),target:iC.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return et(function(){return en(this,function(i){return[2,Promise.all(t.map(function(t){return ik(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return et(function(){return en(this,function(e){return[2,Promise.all(t.map(function(t){return ik(t)}))]})})()},e}(),i8=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 i9(t){return"object"==typeof t&&t&&void 0===t.length&&ee(t,i$)}t.MaterialRenderType=void 0,(W=t.MaterialRenderType||(t.MaterialRenderType={}))[W.normal=0]="normal",W[W.transformFeedback=1]="transformFeedback";var i7=1,rt=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,i){var n=i.name,o=void 0===n?"Material"+i7++:n,a=i.renderType,s=i.shader,u=i.uniformSemantics;r.name=o,r.renderType=void 0===a?0:a,r.shaderSource=s,r.props=i,r.uniformSemantics=iM({},u)}else r.name="Material"+i7++,r.renderType=0;return r}eX(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},eB(e,[{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:"colorMask",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(e7),re=(Z=new Int32Array((Y=new Float32Array(1)).buffer),function(t){Y[0]=t;var e=Z[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)}),ri=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]=re(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=re(t[i])},t}(),rr=new e1,rn=new e0;function ro(t,e,i,r,n,o,a){var s=r/n,u=r,c=e.speedOverLifetime;c&&(u=c.getIntegrateValue(0,r,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(o),t.addScaledVector(a,u),t.addScaledVector(i,h);var l=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new eJ;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});rr.setFromArray(v).negate(),rn.setFromEuler(rr);var y=rn.transformPoint(p);t.addVectors(d,y)}if(l.enabled){var g=l.asMovement,x=l.x,T=l.y,b=l.z;if(x){var E=g?x.getValue(s):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(T){var _=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.y=t.y+_}if(b){var C=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.z=t.z+C}}return t}function ra(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function rs(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function ru(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 o=0;o<e.length;o++)t[o]=e[o]}else if(i&&t!==i)for(var a=0;a<i.length;a++)t[a]=i[a];return t}var rc=((tq={})[tb.PARTICLE_ORIGIN_CENTER]=[0,0],tq[tb.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],tq[tb.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],tq[tb.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],tq[tb.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],tq[tb.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],tq[tb.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],tq[tb.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],tq[tb.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],tq);function rh(t,e,i){var r=i.position,n=new eJ(t,e,0),o=new eJ;return i.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(r),new iv(r,o)}function rl(t,e,i){var r=t.x,n=t.y,o=t.z,a=new eJ(r-e,n+i,o),s=new eJ(r-e,n-i,o),u=new eJ(r+e,n-i,o),c=new eJ(r+e,n+i,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:c}]}function rf(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function rd(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function rp(t,e,i){return(rp=!function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}()?function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&eG(n,i.prototype),n}:Reflect.construct).apply(null,arguments)}var rm={getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t),r=i.xIndex,n=i.yIndex;return new eK(e[r],e[n])},getPointIndexInCurve:function(t){var e=t[0],i=t[2],r=e===tw.LINE?0:e===tw.EASE_OUT?0:e===tw.EASE_IN?2:e===tw.EASE?2:e===tw.HOLD&&i===tw.EASE_IN?2:0;return{xIndex:r,yIndex:r+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tw.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tw.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tw.EASE,tw.EASE_IN,tw.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tw.EASE,tw.EASE_OUT,tw.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tw.HOLD&&[tw.HOLD,tw.LINE_OUT,tw.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tw.HOLD&&[tw.HOLD,tw.LINE,tw.EASE_IN].includes(i)}},rv=function(t,e){this.points=t,this.totalLength=e},ry={},rg={};function rx(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function rT(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var rb=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=rd(e.x-t.x,3)+"_"+rd(e.y-t.y,3)+"_"+rd(e.z-t.z,3)+"&"+(rd(i.x-t.x,3)+"_"+rd(i.y-t.y,3))+"_"+rd(i.z-t.z,3)+"&"+(rd(r.x-t.x,3)+"_"+rd(r.y-t.y,3))+"_"+rd(r.z-t.z,3);if(rg[n])return{data:rg[n],interval:t};for(var o=[],a=null,s=0,u=0,c=0;c<300;c+=1){var h=new eJ,l=c/299;u=0,h.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),h.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),h.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!==a&&(u+=Math.pow(h.x-a.x,2)+Math.pow(h.y-a.y,2)+Math.pow(h.z-a.z,2)),a=h,s+=u=Math.sqrt(u),o[c]={partialLength:u,point:h}}var f=new rv(o,s);return rg[n]=f,{data:f,interval:new eJ(t.x,t.y,t.z)}}(t,e,i,r),o=n.data,a=n.interval;this.lengthData=o,this.interval=a,this.totalLength=o.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(rf(1-t,0))return e.points[299].point.clone().add(this.interval);if(rf(e.totalLength,0))return this.p1.clone();var i=new eJ,r=rd(e.totalLength*t,4),n=this.catching.lastAddedLength,o=this.catching.lastPoint;if(rf(n,r))return e.points[o].point.clone().add(this.interval);var a=!0,s=1;for(r<n&&(s=-1);a;){if(r>=n){if(299===o){i.x=e.points[o].point.x,i.y=e.points[o].point.y,i.z=e.points[o].point.z;break}if(r<n+e.points[o+1].partialLength){var u=(r-n)/e.points[o+1].partialLength;i.x=e.points[o].point.x+(e.points[o+1].point.x-e.points[o].point.x)*u,i.y=e.points[o].point.y+(e.points[o+1].point.y-e.points[o].point.y)*u,i.z=e.points[o].point.z+(e.points[o+1].point.z-e.points[o].point.z)*u;break}}s>0&&o<299?(o+=s,n+=rd(e.points[o].partialLength,5)):s<0&&o>0?(n-=rd(e.points[o].partialLength,5),o+=s):a=!1}return this.catching.lastPoint=o,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),rE=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new e$,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):rf(1-t,0)?this.temp.copyFrom(this.p2):(rS.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),r_=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(),rx(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=rx(.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,o=rT(n,this.mX1,this.mX2);return o>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var o=rT(e,i,r);if(0===o)break;var a=rx(e,i,r)-t;e-=a/o}return e}(t,n,this.mX1,this.mX2):0===o?n:function(t,e,i,r,n){var o,a,s=0;do(o=rx(a=e+(i-e)/2,r,n)-t)>0?i=a:e=a;while(Math.abs(o)>1e-7&&++s<10);return a}(t,i,i+.1,this.mX1,this.mX2)},t}();function rC(t,e){var i,r,n,o=function(t,e,i){var r=t[1],n=rm.isHoldOutKeyframe(t),o=rm.isHoldInKeyframe(e),a=!o&&rm.isRightSideEase(t),s=!n&&rm.isLeftSideEase(e);if(a&&!s&&!o){var u=new eK(r[r.length-4],r[r.length-3]),c=new eK(r[r.length-2],r[r.length-1]),h=rm.getPointInCurve(e),l=new eK(h.x,h.y),f=new eK(l.x-(l.x-u.x)/10,l.y);return{type:"ease",p0:u,p1:c,p2:f,p3:l}}if(!a&&s&&!n){var d=e[1],p=rm.getPointInCurve(t),m=new eK(p.x,p.y),v=new eK(d[0],d[1]),y=new eK(d[2],d[3]),g=new eK(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(a&&s){var x=e[1];return{type:"ease",p0:new eK(r[r.length-4],r[r.length-3]),p1:new eK(r[r.length-2],r[r.length-1]),p2:new eK(x[0],x[1]),p3:new eK(x[2],x[3])}}var T=rm.getPointInCurve(t),b=rm.getPointInCurve(e);if(n?b.y=T.y:o&&(T.y=b.y),!i)return{type:"line",p0:T,p1:b,isHold:n||o,leftHoldLine:n,rightHoldLine:o};var E=new eK((b.x-T.x)/3+T.x,(b.y-T.y)/3+T.y),_=new eK((b.x-T.x)/3*2+T.x,(b.y-T.y)/3*2+T.y);return{type:"ease",p0:T,p1:E,p2:_,p3:b,isHold:n||o,leftHoldLine:n,rightHoldLine:o}}(t,e,!0),a=o.p0,s=o.p1,u=o.p2,c=o.p3;eS(u),eS(c);var h=c.x-a.x,l=c.y-a.y,f=rd((s.x-a.x)/h,5),d=rd((u.x-a.x)/h,5);rf(l,0)?i=r=NaN:(i=rd((s.y-a.y)/l,5),r=rd((u.y-a.y)/l,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",a,s,u,c),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",a,s,u,c),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",a,s,u,c),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",a,s,u,c),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return ry[p]?n=ry[p]:(n=new r_(f,i,d,r),ry[p]=n),{points:[a,s,u,c],timeInterval:h,valueInterval:l,curve:n}}var rS=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,o=e.y,a=e.z,s=e.w,u=i.x,c=i.y,h=i.z,l=i.w;if(0===r){t.x=n,t.y=o,t.z=a,t.w=s;return}if(1===r){t.x=u,t.y=c,t.z=h,t.w=l;return}if(s!==l||n!==u||o!==c||a!==h){var f=1-r,d=n*u+o*c+a*h+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,o=o*f+c*g,a=a*f+h*g,s=s*f+l*g,f===1-r){var x=1/Math.sqrt(n*n+o*o+a*a+s*s);n*=x,o*=x,a*=x,s*=x}}t.x=n,t.y=o,t.z=a,t.w=s},t}(),rA="not_implement",rw=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(rA)},e.getIntegrateValue=function(t,e,i){throw Error(rA)},e.getIntegrateByTime=function(t,e){throw Error(rA)},e.getValue=function(t){throw Error(rA)},e.getMaxTime=function(){throw Error(rA)},e.toUniform=function(t){throw Error(rA)},e.map=function(t){throw Error(rA)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(rA)},t.getAllData=function(t,e){for(var i=new(e?ri:Float32Array)(4*t.index),r=0,n=0,o=t.curves;r<o.length;r++){var a=o[r].toData();i.set(a,n),n+=a.length}return e?i.data:i},t}(),rO=function(t){function e(){return t.apply(this,arguments)}eX(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}(rw),rR=function(t){function e(){return t.apply(this,arguments)}eX(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}(rw),rI=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){return eF(this.min,this.max)},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}(rw),rM=function(t){function e(){return t.apply(this,arguments)}eX(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 o=Math.random();r[n]=e[n]*(1-o)+i[n]*o}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(rw),rL=function(t){function e(){return t.apply(this,arguments)}eX(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,o=this.xCoord*i;return((r+e/o*(n-r)+r)*e-(r+t/o*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return rG(e,0,this.xCoord,this.min,this.max)-rG(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}(rw),rP=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=ep(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],o=e[r+1];if(n.stop<=t&&o.stop>t){var a=(t-n.stop)/(o.stop-n.stop);return em(n.color,o.color,a,!0)}}return e[i].color.slice()},e}(rw),rV=function(t){function e(){return t.apply(this,arguments)}eX(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],o=e[r+1],a=n[0],s=o[0];if(t>=a&&t<=s){var u=(t-a)/(s-a),c=n[1];return c+u*(o[1]-c)}}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,o=e?rG:rB,a=0;a<n;a++){var s=i[a],u=i[a+1],c=s[0],h=u[0];if(t>c&&t<=h)return r+o(t,c,h,s[1],u[1]);r+=o(h,c,h,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}(rw),rF=function(t){function e(){return t.apply(this,arguments)}eX(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=rC(t[e],t[e+1]),r=i.points,n=i.curve,o=i.timeInterval,a=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:o,valueInterval:a,curve:n}}},i.getValue=function(t){var e=0,i=Object.keys(this.curveMap),r=Number(i[0].split("&")[0]),n=Number(i[i.length-1].split("&")[1]);if(t<=r)return this.getCurveValue(i[0],r);if(t>=n)return this.getCurveValue(i[i.length-1],n);for(var o=0;o<i.length;o++){var a=i[o].split("&"),s=a[0],u=a[1];if(t>=Number(s)&&t<Number(u)){e=this.getCurveValue(i[o],t);break}}return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,o=Object.keys(this.curveMap);if(r<=Number(o[0].split("&")[0]))return 0;for(var a=0;a<o.length;a++){var s=o[a].split("&"),u=s[0],c=s[1];if(r>=Number(c)&&(n+=i*this.getCurveIntegrateValue(o[a],Number(c))),r>=Number(u)&&r<Number(c)){n+=i*this.getCurveIntegrateValue(o[a],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,o=i.valueInterval,a=0,s=(e-r.x)/20,u=0;u<=20;u++){var c=u*s/n,h=r.y+o*i.curve.getValue(c);0===u||20===u?a+=h:u%2==1?a+=4*h:a+=2*h}return s/3*a},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,o=i.valueInterval,a=(e-r.x)/n,s=i.curve.getValue(a);return r.y+o*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=Object.keys(this.curveMap);return Number(t[t.length-1].split("&")[1])},e}(rw),rN=function(t){function e(){return t.apply(this,arguments)}eX(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],o=e[r+1];if(n[0]<=t&&o[0]>=t){var a=o[1]-n[1],s=void 0;return s=0===a?(t-n[0])/(o[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,o=i[2]*r,a=(t-e[0])/r,s=a*a,u=s*a;return(2*u-3*s+1)*e[1]+(u-2*s+a)*n+(u-s)*o+(-2*u+3*s)*i[1]}(t,n,o)-n[1])/a,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],o=0;o<i.length;o++)n[o]=i[o]*(1-e)+r[o]*e;return n},e}(rw),rD=function(t){function e(){return t.apply(this,arguments)}eX(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 o=e[n],a=e[n+1],s=new eJ(i[n][0],i[n][1],i[n][2]),u=new eJ(i[n+1][0],i[n+1][1],i[n+1][2]),c=new eJ(r[2*n][0],r[2*n][1],r[2*n][2]),h=new eJ(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),l=rC(o,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new rb(s,u,c,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=rd(t,5),i=0,r=new eJ,n=Object.keys(this.curveSegments);if(!n.length)return r;var o=Number(n[0].split("&")[0]),a=Number(n[n.length-1].split("&")[1]);if(e<=o)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=n[s].split("&"),c=u[0],h=u[1];if(e>=Number(c)&&e<Number(h)){var l=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,o=rd((e-r.x)/n,4);return eQ(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(rw),rz=function(t){function e(){return t.apply(this,arguments)}eX(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 o=e[n],a=e[n+1],s=e$.fromArray(i[n]),u=e$.fromArray(i[n+1]),c=e$.fromArray(r[2*n]),h=e$.fromArray(r[2*n+1]),l=rC(o,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new rE(s,u,c,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=rd(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),o=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=o)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<r.length;a++){var s=r[a].split("&"),u=s[0],c=s[1];if(i>=Number(u)&&i<Number(c)){var h=this.curveSegments[r[a]].pathCurve;return e=this.getPercValue(r[a],i),h.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,o=rd((e-r.x)/n,4);return eQ(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(rw),rk=((tQ={})[tA.RANDOM]=function(t){return ee(t[0],Array)?new rM(t):new rI(t)},tQ[tA.CONSTANT]=function(t){return new rO(t)},tQ[tA.CONSTANT_VEC2]=function(t){return new rO(t)},tQ[tA.CONSTANT_VEC3]=function(t){return new rO(t)},tQ[tA.CONSTANT_VEC4]=function(t){return new rO(t)},tQ[tA.RGBA_COLOR]=function(t){return new rO(t)},tQ[tA.COLORS]=function(t){return new rR(t.map(function(t){return ef(t,!1)}))},tQ[tA.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new rL([t[0][1],t[1][1]]):new rV(t)},tQ[tA.GRADIENT_COLOR]=function(t){return new rP(t)},tQ[tA.LINEAR_PATH]=function(t){return new rN(t)},tQ[tA.BEZIER_CURVE]=function(t){return 1===t.length?new rO(t[0][1][1]):new rF(t)},tQ[tA.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new rO(rp(eJ,[].concat(t[1][0]))):new rD(t)},tQ[tA.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new rO(rp(e$,[].concat(t[1][0]))):new rz(t)},tQ);function rU(t){if(!t||!isNaN(+t))return new rO(t||0);if(ee(t,rw))return t;if(eL(rk[t[0]]))return rk[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+iE["ValueType: 21/22 is not supported"]+".")}function rB(t,e,i,r,n){var o=t-e;return(r+r+(n-r)*o/(i-e))*o/2}function rG(t,e,i,r,n){var o=t*t,a=e*e;return(o*t*2*(r-n)+3*o*(e*n-i*r)-a*e*(2*r+n)+3*a*i*r)/(6*(e-i))}function rX(t,e){if(e){var i=e[0],r=e[1];if(i===tA.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===tA.LINE){var o=r.length;if(2===o&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&o++,r[r.length-1][0]<1&&o++;var a=Math.ceil(o/2);t.lineSegCount+=a,t.curves.push(r),t.index+=a,t.max=Math.max(t.max,a)}else if(i===tA.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 rj(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}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,(Q=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",Q.GLSL3="300 es";var rH=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return eX(e,t),e}(e7);t.Shader=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=eH(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(e7),t.Shader=er([e6("Shader")],t.Shader);var rW="effects-internal-copy",rY="effects-internal-copy-mesh",rZ="\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}",rq="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 rQ(e,i){return{name:rW,vertex:rZ,fragment:rq,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:rY+ +i}}var rK={format:iC.RGBA,type:iC.UNSIGNED_BYTE,minFilter:iC.LINEAR,magFilter:iC.LINEAR,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE},rJ=Symbol("dispose"),r$=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,o=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:o},s=[o];Object.getOwnPropertyNames(rK).forEach(function(t){var i,r=null!=(i=e[t])?i:rK[t];a[t]=r,s.push(t,r)});var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var h=this.engine;eS(h),c=i$.create(h,a),this.textureCache[u]=c,this.textureRef[u]=1,c[rJ]=c.dispose,c.dispose=function(){return i.removeTexture(u)}}return c},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[rJ](),i.dispose=i[rJ]),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[rJ](),i.dispose=i[rJ]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),r0=function(){function t(t){void 0===t&&(t={}),this.semantics=iM({},t)}var e=t.prototype;return e.toObject=function(){return iM({},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 eL(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}(),r1=((tK={})[iC.FLOAT]=Float32Array.BYTES_PER_ELEMENT,tK[iC.INT]=Int32Array.BYTES_PER_ELEMENT,tK[iC.SHORT]=Int16Array.BYTES_PER_ELEMENT,tK[iC.BYTE]=Int8Array.BYTES_PER_ELEMENT,tK),r2=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(e7);function r3(t){return t===iC.INT?new Int32Array(0):t===iC.SHORT?new Int16Array(0):new Float32Array(0)}var r4=1,r5=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,o=i.geometry,a=i.name,s=i.priority,u=i.worldMatrix,c=void 0===u?e0.fromIdentity():u;r.id="Mesh"+r4++,r.name=void 0===a?"<unnamed>":a,r.geometry=o,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=c}else r.id="Mesh"+r4++,r.name="<unnamed>",r.worldMatrix=e0.fromIdentity(),r._priority=0;return r}eX(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)}},eB(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ii);t.RenderPassAttachmentStorageType=void 0,(K=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[K.none=0]="none",K[K.color=1]="color",K[K.stencil_8_opaque=2]="stencil_8_opaque",K[K.depth_16_opaque=3]="depth_16_opaque",K[K.depth_stencil_opaque=4]="depth_stencil_opaque",K[K.depth_16_texture=5]="depth_16_texture",K[K.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(J=t.TextureStoreAction||(t.TextureStoreAction={}))[J.store=0]="store",J[J.clear=2]="clear";var r6=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(ee(r,i$))this.texture=r,this.externalTexture=!0;else if(r){var o=r.wrapT,a=r.wrapS,s=r.minFilter,u=r.magFilter,c=r.internalFormat,h=r.format,l=void 0===h?iC.RGBA:h,f=r.type,d=void 0===f?iC.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:l,type:d,internalFormat:c||l,wrapT:o,wrapS:a,minFilter:s,magFilter:u,name:i.name},this.texture=i$.create(e,iM({},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)},eB(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,($=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[$.force=0]="force",$[$.keep=1]="keep",$[$.keepExternal=2]="keepExternal",$[$.destroy=0]="destroy";var r8=1,r9=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+r8++:r,o=i.clearAction,a=i.semantics,s=i.depthStencilAttachment,u=i.storeAction,c=i.priority,h=i.meshOrder,l=void 0===h?t.OrderType.ascending:h,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===c?0:c,this.meshOrder=l,this.meshes=eE((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=iM({},o),this.storeAction=iM({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new r0(a),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){e_(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){eh(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),eE(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],o=e[3];t.setViewport(i,r,n,o)}},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 r6(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 o=this.viewportScale,a=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*o,r.getHeight()*o],s=[a[2],a[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var c=n.attachments.map(function(t,e){var r;return new r6(i.renderer.engine,iM({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=c;var h=nw.create({storeAction:this.storeAction,name:u,viewport:a,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:c.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);h.bind(),h.unbind(),this.framebuffer=h}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 o=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===o||1===o||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,s=this.framebuffer;s&&(s.dispose({depthStencilAttachment:a}),s.externalStorage&&2===a||1===a||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=eN}},eB(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}(),r7="#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);}",nt="precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\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(0.0,texParams.y,texParams.x);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",ne="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;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.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",ni="#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",nr="#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 vec3 aVel;attribute vec3 aRot;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;\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 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform 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;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}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\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void 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\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\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}}",nn="#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}",no="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",na="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*=hdrColor.a;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));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",ns="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",nu="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",nc="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);}",nh="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);}",nl={},nf=function(){function e(){}return e.registerInclude=function(t,e){nl[t]&&eO.warn('The "'+t+'" shader include already exist.'),nl[t]=e},e.unRegisterInclude=function(t){delete nl[t]},e.unRegisterAllIncludes=function(){Object.keys(nl).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,o=i.shader,a=i.macros,s=i.removeVersion,u=e.genMacroString(r,a),c=e.genShaderVersion(r),h=e.parseIncludes(o),l=e.isVersion300(h);return(h=e.removeWebGLVersion(h),2!==r||l||(h=e.convertTo300(h,n===t.ShaderType.fragment)),s)?u+h:c+u+h},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=nl[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 o=e[n].match(/\bgl_FragData\[(.+?)\]/);o&&i.add(o[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}(),nd=function(e){function i(i,r){var n,o=(n=e.call(this,i,r)||this).renderer.engine,a=r2.create(o,{mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=rt.create(o,{shader:{vertex:no,fragment:nh,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=r5.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}eX(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=e.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",i),e.renderMeshes([this.screenMesh])},i}(r9),np=function(e){function i(i,r,n){(o=e.call(this,i,n)||this).type=r;var o,a=o.renderer.engine,s="PostProcess",u=r2.create(a,{name:s,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:no,fragment:"H"==r?ns:nu,glslVersion:t.GLSLVersion.GLSL1},h=rt.create(a,{name:s,shader:c});return h.blending=!1,h.depthTest=!1,h.culling=!1,o.screenMesh=r5.create(a,{name:s,geometry:u,material:h,priority:0}),o.priority=5e3,o}eX(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",nT(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(r9),nm=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",o=r.renderer.engine,a=r2.create(o,{name:n,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=rt.create(o,{name:n,shader:{vertex:no,fragment:nc}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=r5.create(o,{name:n,geometry:a,material:s,priority:0}),r.priority=5e3,r}eX(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",nT(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(r9),nv=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=r||new r6(a);var s=r2.create(a,{name:o,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=rt.create(a,{name:o,shader:{vertex:no,fragment:na,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=r5.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}eX(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=i.useBloom,n=i.bloomIntensity,o=i.brightness,a=i.saturation,s=i.contrast,u=i.useToneMapping,c=i.vignetteIntensity,h=i.vignetteSmoothness,l=i.vignetteRoundness;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",o),this.screenMesh.material.setFloat("_Saturation",a),this.screenMesh.material.setFloat("_Contrast",s),this.screenMesh.material.setInt("_UseBloom",Number(r)),r&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",n)),c>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",c),this.screenMesh.material.setFloat("_VignetteSmoothness",h),this.screenMesh.material.setFloat("_VignetteRoundness",l),this.screenMesh.material.setVector2("_VignetteCenter",new eK(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new eJ(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(u)),e.renderMeshes([this.screenMesh])},i}(r9),ny="_effects_default_",ng=1,nx=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i,r,n=e.camera,o=e.keepColorBuffer,a=e.renderer,s=e.editorTransform,u=e.globalVolume,c=e.clearAction,h=void 0===c?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:c,l=a.engine;u&&(this.globalVolume=u),this.globalUniforms=new nE;var f=[],d={};if(this.renderer=a,this.globalVolume){var p=this.globalVolume.useHDR?iC.HALF_FLOAT:iC.UNSIGNED_BYTE;f=[{texture:{format:iC.RGBA,type:p,magFilter:iC.LINEAR,minFilter:iC.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},d={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var m=[new r9(a,{name:ny,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:f,clearAction:d})];if(this.setRenderPasses(m),this.globalVolume){var v=new r6(l),y=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],g=Array(7),x=this.globalVolume.useHDR?iC.HALF_FLOAT:iC.UNSIGNED_BYTE,T=new nd(a,{name:"BloomThresholdPass",attachments:[{texture:{format:iC.RGBA,type:x,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]});T.sceneTextureHandle=v,this.addRenderPass(T);for(var b=0;b<7;b++){g[b]=new r6(l);var E=new np(a,"H",{name:"GaussianDownPassH"+b,viewport:y,attachments:[{texture:{format:iC.RGBA,type:x,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]}),_=new np(a,"V",{name:"GaussianDownPassV"+b,viewport:y,attachments:[{texture:{format:iC.RGBA,type:x,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]});_.gaussianResult=g[b],this.addRenderPass(E),this.addRenderPass(_),y[2]/=2,y[3]/=2}y[2]*=4,y[3]*=4;for(var C=0;C<6;C++){var S=new nm(a,{name:"GaussianUpPass"+C,viewport:y,attachments:[{texture:{format:iC.RGBA,type:x,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]});S.gaussianDownSampleResult=g[5-C],this.addRenderPass(S),y[2]*=2,y[3]*=2}var A=new nv(a,v);this.addRenderPass(A)}this.semantics=new r0(e.semantics),this.clearAction=h,this.name="RenderFrame"+ng++;var w=m[0];this.emptyTexture=i2(l),this.transparentTexture=i3(l),this.camera=n,this.keepColorBuffer=o,this.renderPassInfoMap.set(w,{listStart:0,listEnd:0,renderPass:w,intermedia:!1}),this.editorTransform=ip.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new r$(l);var O=l.gpuCapability,R=O.detail,I=rQ(O.level,R.readableDepthStencilTextures&&R.writableFragDepth);null==(i=this.renderer.getShaderLibrary())||i.addShader(I)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},i.removeMeshFromDefaultRenderPass=function(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,o=e;o<t.length;o++){var a,s,u,c=t[o],h=null==(s=c.attachments[0])?void 0:s.texture;if(h&&a===h){var l=h===r?n:r;c.resetColorAttachments([l])}(h=null==(u=c.attachments[0])?void 0:u.texture)&&(a=h)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(ny)&&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,o=r.persistent,a=n.format,s=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(a===iC.RGBA&&!o){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,o=r.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?iC.LINEAR:iC.NEAREST,c=i$.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iC.RGBA,name:"frame_a",minFilter:u,magFilter:u}),h=i$.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iC.RGBA,data:{width:a,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 r9(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:c}]}).initialize(this.renderer),d=new nb(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:h,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=r2.create(i,{name:rW,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=rQ(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var o=rt.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:rW,shader:n});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==t?void 0:t.blend)&&(o.blending=!0,o.blendFunction=[iC.SRC_ALPHA,iC.ONE_MINUS_SRC_ALPHA,iC.SRC_ALPHA,iC.ONE_MINUS_SRC_ALPHA]),r5.create(i,{name:rW,geometry:r,material:o,priority:0})},i.removeRenderPass=function(t){eh(this._renderPasses,t)},eB(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function nT(t){return t?new eK(t.getWidth(),t.getHeight()):new eK}var nb=function(t){function e(){return t.apply(this,arguments)}eX(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",nT(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(r9),nE=function(){this.floats={},this.ints={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},n_=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 eB(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),nC="function"==typeof WebGL2RenderingContext,nS=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=nC&&ee(t,WebGL2RenderingContext)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),a=!!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"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),r&&!a&&(a=nA(t,t.HALF_FLOAT)),r&&!s&&(s=nA(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,c=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,h={floatTexture:u,halfFloatTexture:c,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"):c>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:a,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:!!t.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!o,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=h,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&i>0)throw Error("Draw multiple color buffers not available.");var a=o?o["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];a?t.framebufferTexture2D(e,a,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 nA(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,(tt=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[tt.NONE=0]="NONE",tt[tt.PVRTC=1]="PVRTC",tt[tt.ASTC=2]="ASTC",t.FilterMode=void 0,(te=t.FilterMode||(t.FilterMode={}))[te.Nearest=0]="Nearest",te[te.Linear=1]="Linear",t.RenderTextureFormat=void 0,(ti=t.RenderTextureFormat||(t.RenderTextureFormat={}))[ti.RGBA32=0]="RGBA32",ti[ti.RGBAHalf=1]="RGBAHalf";var nw=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){},eB(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),nO=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=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,o){return null},e.dispose=function(t){},t}(),nR=1,nI=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),o=this.createGeometry();this.mesh=this.createMesh(o,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 eJ,n=new e$,o=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,o),e.x=o.x,e.y=o.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)===ib]],n=rU(this.color).getValue(0),o={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"}},a=rt.create(this.engine,o);return a.blending=!0,a.depthTest=!1,a.setVector4("uPos",new ip(0,0,0,0)),a.setVector2("uSize",new eK(1,1)),a.setVector4("uColor",new ip(n[0]/255,n[1]/255,n[2]/255,n[3])),a.setQuaternion("uQuat",new e$(0,0,0,0)),a},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return r2.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:iC.LINES,maxVertex:4})},i.createMesh=function(t,e){return r5.create(this.engine,{name:"Interact_preview"+nR++,priority:0,worldMatrix:e0.fromIdentity(),geometry:t,material:e})},e}();function nM(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}function nL(t){var e=t.renderer,i=e.blending,r=e.side,n=e.occlusion,o=e.mask,a=e.maskMode,s=e.order,u=t.cachePrefix||"-";return{side:r,occlusion:n,blending:i,mask:o,maskMode:a,cachePrefix:u,cacheId:u+"."+ +r+"+"+ +n+"+"+ +i+"+"+s+"+"+a+"."+o}}function nP(e,i){var r=null!=i?i:{},n=r.env,o=r.wireframe,a=[["ENV_EDITOR",(void 0===n?"":n)===ib]];return{fragment:o?r7:ne,vertex:nt,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,macros:a,shared:!0}}function nV(t,e){return t.cachePrefix+"_effects_sprite_"+e}function nF(t,e,i,r){var n=t.wireframe,o=nP(i,{wireframe:n,env:r});return o.shared=!0,n||(o.cacheId=nV(t,e)),o}function nN(e){t.maxSpriteMeshItemCount=e}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.dragRatio=[1,1],t._interactive=!0,t.hasBeenAddedToComposition=!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}eX(i,e);var r=i.prototype;return r.start=function(){var t=this,e=this.item.props.content.options,i=this.item.engine.renderer.env,r=this.item.composition,n=this.interactData.options,o=n.type,a=n.showPreview;if(o===ty.CLICK&&(this.clickable=!0,a&&i===ib)){var s=null==r?void 0:r.getRendererOptions();void 0!==s&&(this.previewContent=new nI(this.item.props.content,s,this.transform,this.engine))}e.type===ty.DRAG&&(i!==ib||e.enableInEditor)&&(null==r?void 0:r.event)&&this.beginDragTarget(e,r.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams,this.item.onEnd=function(){if(t.item&&t.item.composition){var e;t.item.composition.removeInteractiveItem(t.item,t.item.props.content.options.type),t.clickable=!1,t.hasBeenAddedToComposition=!1,null==(e=t.previewContent)||e.mesh.dispose(),t.endDragTarget()}}},r.update=function(t){var e;if(null==(e=this.previewContent)||e.updateMesh(),!this.hasBeenAddedToComposition&&this.item.composition){var i=this.item.props.content.options;this.item.composition.addInteractiveItem(this.item,i.type),this.hasBeenAddedToComposition=!0}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,nM(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(){},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i=this.item.props.content.options,r=t.cameraParam,n=r.position,o=r.fov,a=e.dy,s=e.dx*e.width/e.height,u=n[2],c=Math.tan(o*Math.PI/180/2)*Math.abs(u),h=n[0]-this.dragRatio[0]*(s*c),l=n[1]-this.dragRatio[1]*(a*c);if(i.dxRange){var f,d=i.dxRange,p=d[0],m=d[1];(h=eQ(h,p,m))!==p&&h!==m&&p!==m&&(null==(f=e.origin)||f.preventDefault())}if(i.dyRange){var v,y=i.dyRange,g=y[0],x=y[1];(l=eQ(l,g,x))!==g&&l!==x&&g!==x&&(null==(v=e.origin)||v.preventDefault())}this.item.composition.camera.position=new eJ(h,l,u)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var o={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;!nM(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iM({},r)),r=null}}};Object.keys(o).forEach(function(t){e.addEventListener(t,o[t])}),o.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(o).forEach(function(t){e.removeEventListener(t,o[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=rl(eJ.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){e.prototype.fromData.call(this,t),this.interactData=t},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},eB(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(ii),t.InteractComponent=er([e6(tX.InteractComponent)],t.InteractComponent),t.maxSpriteMeshItemCount=8;var nD={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},nz=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return eX(i,e),i.precompile=function(e,i,r){var n=i.getShaderLibrary(),o=i.engine.gpuCapability,a=o.level,s=o.detail,u=(null!=r?r:{}).env;return(null==n?void 0:n.shaderResults[nV(nD,2)])||(null==n||n.addShader(nF(nD,2,1,u)),null==n||n.addShader(nF(nD,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&(null==n||n.addShader(rQ(a,!0)))),Promise.resolve()},i}(ir);function nk(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var nU=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=eH(this.playables);!(e=i()).done;){var r=e.value;this.updatePlayableTime(r,t)}for(var n,o=eH(this.playableOutputs);!(n=o()).done;)n.value.context.deltaTime=t;for(var a,s=eH(this.playableOutputs);!(a=s()).done;){var u=a.value;this.prepareFrameWithRoot(u)}for(var c,h=eH(this.playableOutputs);!(c=h()).done;){var l=c.value;this.processFrameWithRoot(l)}},e.connect=function(t,e,i,r){i.connectInput(r,t,e)},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrameRecursive(t.context,t.getSourceOutputPort()),t.processFrame()},e.prepareFrameWithRoot=function(t){t.sourcePlayable.prepareFrameRecursive(t.context,t.getSourceOutputPort()),t.prepareFrame()},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&(t.overrideTimeNextEvaluation?t.overrideTimeNextEvaluation=!1:t.setTime(t.getTime()+e))},t}(),nB=function(){function t(t,e){void 0===e&&(e=0),this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.overrideTimeNextEvaluation=!1,this.destroyed=!1,this.inputs=[],this.inputOuputPorts=[],this.inputWeight=[],this.outputs=[],this.playState=0,this.traversalMode=0,t.addPlayable(this),this.inputs=Array(e),this.inputOuputPorts=Array(e),this.inputWeight=Array(e)}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.connectInput=function(t,e,i,r){void 0===r&&(r=1),this.setInput(e,t),this.setInputWeight(t,r),e.setOutput(this,i),this.inputOuputPorts.length<t+1&&(this.inputOuputPorts.length=t+1),this.inputOuputPorts[t]=i},e.addInput=function(t,e,i){void 0===i&&(i=1),this.connectInput(this.getInputCount(),t,e,i)},e.getInputCount=function(){return this.inputs.length},e.getInputs=function(){return this.inputs},e.getInput=function(t){return this.inputs[t]},e.getOutputCount=function(){return this.outputs.length},e.getOutputs=function(){return this.outputs},e.getOutput=function(t){return this.outputs[t]},e.getInputWeight=function(t){return this.inputWeight[t]},e.setInputWeight=function(e,i){if(ee(e,t)){for(var r=0;r<this.inputs.length;r++)if(this.inputs[r]===e){this.inputWeight[r]=i;return}}else this.inputWeight.length<e+1&&(this.inputWeight.length=e+1),this.inputWeight[e]=i},e.setTime=function(t){this.time=t,this.overrideTimeNextEvaluation=!0},e.getTime=function(){return this.time},e.getPlayState=function(){return this.playState},e.setTraversalMode=function(t){this.traversalMode=t},e.getTraversalMode=function(){return this.traversalMode},e.onPlayablePlay=function(t){},e.onPlayablePause=function(t){},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},e.prepareFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState)switch(this.onPlayablePlayFlag&&(this.onPlayablePlay(t),this.onPlayablePlayFlag=!1),this.onPlayablePauseFlag&&(this.onPlayablePause(t),this.onPlayablePauseFlag=!1),0===e&&this.prepareFrame(t),this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).prepareFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).prepareFrameRecursive(t,this.inputOuputPorts[e])}},e.processFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState){switch(this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).processFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).processFrameRecursive(t,this.inputOuputPorts[e])}this.processFrame(t)}},e.setOutput=function(t,e){this.outputs.length<e+1&&(this.outputs.length=e+1),this.outputs[e]=t},e.setInput=function(t,e){this.inputs.length<e+1&&(this.inputs.length=e+1),this.inputs[e]=t},t}(),nG=function(){function t(){this.sourceOutputPort=0,this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayeble=function(t,e){void 0===e&&(e=0),this.sourcePlayable=t,this.sourceOutputPort=e},e.getSourceOutputPort=function(){return this.sourceOutputPort},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),nX=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(e7);(tr=tJ||(tJ={}))[tr.Playing=0]="Playing",tr[tr.Paused=1]="Paused",(tn=t$||(t$={}))[tn.Mix=0]="Mix",tn[tn.Passthrough=1]="Passthrough";var nj=[[0,0,1,1,void 0]],nH=[1,1,1,1],nW=0,nY=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}eX(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n=e.output.getUserData();if(ee(n,t.VFXItem)){if(!this.spriteMaterial){this.spriteMaterial=n.getComponent(t.SpriteComponent).material;var o=this.spriteMaterial.getVector4("_Color");o&&(this.startColor=o.toArray())}var a=rs(nH,1),s=this.time/n.duration,u=this.opacityOverLifetime,c=this.colorOverLifetime;c&&(a=ed(c,s,!0),i=!0),u&&(a[3]*=u.getValue(s),i=!0),i&&(ru(this.renderColor,a,this.startColor),null==(r=this.spriteMaterial.getVector4("_Color"))||r.setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=rU(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tA.GRADIENT_COLOR&&(this.colorOverLifetime=ep(i.color[1]))),this},i}(nB);t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new nY(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(nX),t.SpriteColorPlayableAsset=er([e6("SpriteColorPlayableAsset")],t.SpriteColorPlayableAsset),t.SpriteComponent=function(e){function i(t,i){(r=e.call(this,t)||this).cachePrefix="-",r.frameAnimationLoop=!1,r.frameAnimationTime=0,r.color=[1,1,1,1],r.visible=!0,r.getHitTestParams=function(t){var e=r.interaction;if(t||e){var i,n=r.getBoundingBox();if(n)return{behavior:(null==(i=r.interaction)?void 0:i.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:r.renderer.side===td.FRONT}}},r.name="MSprite"+nW++,r.renderer={renderMode:tT.BILLBOARD,blending:tf.ALPHA,texture:r.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:td.DOUBLE,mask:0,maskMode:tp.NONE,order:0},r.emptyTexture=r.engine.emptyTexture,r.splits=nj,r.renderInfo=nL(nk(r));var r,n=r.createGeometry(iC.TRIANGLES),o=r.createMaterial(r.renderInfo,2);return r.worldMatrix=e0.fromIdentity(),r.material=o,r.geometry=n,r.material.setVector4("_Color",new ip().setFromArray([1,1,1,1])),r.material.setVector4("_TexOffset",new ip().setFromArray([0,0,1,1])),r.setItem(),i&&r.fromData(i),r}eX(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){this.color=t,this.material.setVector4("_Color",new ip().setFromArray(t))},r.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("uSampler0",t)},r.render=function(t){if(this.getVisible()){var e=this.material,i=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),t.drawGeometry(i,e)}},r.start=function(){this.item.getHitTestParams=this.getHitTestParams},r.update=function(t){this.frameAnimationTime+=t/1e3;var e=this.frameAnimationTime,i=this.item.duration;e>i&&this.frameAnimationLoop&&(e%=i);var r=Math.min(Math.max(e/i,0),1),n=this.textureSheetAnimation;if(n){var o,a,s,u,c,h=n.total||n.row*n.col,l=0,f=0,d=1,p=1;if(this.splits){var m=this.splits[0];a=m[4],l=m[0],f=m[1],a?(d=m[3],p=m[2]):(d=m[2],p=m[3])}if(a?(s=1/n.row*d,u=1/n.col*p):(s=1/n.col*d,u=1/n.row*p),n.animate){var v=Math.round(r*(h-1)),y=Math.floor(v/n.col),g=v-y*n.col;c=a?[s*y,u*(n.col-g)]:[s*g,u*(1+y)]}else c=[0,u];null==(o=this.material.getVector4("_TexOffset"))||o.setFromArray([l+c[0],p+f-c[1],s,u])}},r.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},r.getItemInitData=function(){this.geoData=this.getItemGeometryData();var t=this.geoData,e=t.index,i=t.atlasOffset,r=e.length,n=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new e.constructor(r);if(!this.wireframe)for(var o=0;o<r;o++)n[o]=0+e[o];return{atlasOffset:i,index:n}},r.setItem=function(){var e=[],i=this.renderer.texture;i&&ec(e,i),i=this.renderer.texture;var r=this.getItemInitData(),n=this.renderer,o=this.material.getVector4("_TexParams");o&&(o.x=n.occlusion?+n.transparentOcclusion:1,o.y=+this.preMultiAlpha,o.z=n.renderMode);var a={atlasOffset:new Float32Array(r.atlasOffset.length),index:new Uint16Array(r.index.length)};a.atlasOffset.set(r.atlasOffset),a.index.set(r.index);var s=this.material,u=this.geometry,c=a.index;u.setIndexData(c),u.setAttributeData("atlasOffset",a.atlasOffset),u.setDrawCount(r.index.length);for(var h=0;h<e.length;h++){var l=e[h];s.setTexture("uSampler"+h,l)}for(var f=this.emptyTexture,d=e.length;d<t.maxSpriteMeshItemCount;d++)s.setTexture("uSampler"+d,f)},r.createGeometry=function(t){var e=12*this.splits.length;return r2.create(this.engine,{attributes:{aPos:{type:iC.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:iC.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},r.createMaterial=function(t,e){var i=t.side,r=t.occlusion,n=t.blending,o=t.maskMode,a=t.mask,s={shader:nF(t,e,1)};this.preMultiAlpha=iw(n);var u=rt.create(this.engine,s),c={side:i,blending:!0,blendMode:n,mask:a,maskMode:o,depthTest:!0,depthMask:r};return u.blending=c.blending,u.stencilRef=void 0!==c.mask?[c.mask,c.mask]:void 0,u.depthTest=c.depthTest,u.depthMask=c.depthMask,iO(u,c.blendMode),iI(u,c.maskMode),iR(u,c.side),u.shader.shaderData.properties='uSampler0("uSampler0",2D) = "white" {}',u.hasUniform("_Color")||u.setVector4("_Color",new ip(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new ip),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new ip),u},r.getItemGeometryData=function(){var t=this.splits,e=this.renderer,i=this.textureSheetAnimation;if(e.shape){for(var r=e.shape,n=r.index,o=r.aPoint,a=void 0===o?[]:o,s=new Float32Array(a),u=[],c=[],h=0;h<s.length;h+=6)s[h]*=1,s[h+1]*=1,c.push(a[h+2],a[h+3]),u.push(s[h],s[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(u)),{index:void 0===n?[]:n,atlasOffset:c}}var l=[],f=[],d=2,p=2;1===t.length&&(d=1,p=1);for(var m=[],v=0;v<d;v++)for(var y=0;y<p;y++){var g=(2*y+v)*4,x=i?[0,0,1,1,t[0][4]]:t[2*y+v],T=x[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],b=((v+v+1)/d-1)/2,E=((y+y+1)/p-1)/2,_=x[0],C=x[1],S=x[4]?x[3]:x[2],A=x[4]?x[2]:x[3],w=[-.5/d+b,.5/p+E,-.5/d+b,-.5/p+E,.5/d+b,.5/p+E,.5/d+b,-.5/p+E];l.push(T[0]*S+_,T[1]*A+C,T[2]*S+_,T[3]*A+C,T[4]*S+_,T[5]*A+C,T[6]*S+_,T[7]*A+C),m.push(1*w[0],1*w[1],0,1*w[2],1*w[3],0,1*w[4],1*w[5],0,1*w[6],1*w[7],0),f.push(g,1+g,2+g,2+g,1+g,3+g)}return this.geometry.setAttributeData("aPos",new Float32Array(m)),{index:f,atlasOffset:l}},r.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},r.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),i=rl(eJ.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){e.prototype.fromData.call(this,t);var i,r,n,o,a,s,u=t.interaction,c=t.options,h=t.listIndex,l=t.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:tT.BILLBOARD,blending:null!=(r=l.blending)?r:tf.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===tp.MASK,side:null!=(o=l.side)?o:td.DOUBLE,shape:l.shape,mask:null!=(a=l.mask)?a:0,maskMode:null!=(s=l.maskMode)?s:tp.NONE,order:void 0===h?0:h},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||nj,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=nL(this);var f=this.createGeometry(iC.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=e0.fromIdentity(),this.material=d,this.geometry=f;var p=c.startColor||[1,1,1,1];this.material.setVector4("_Color",new ip().setFromArray(p)),this.material.setVector4("_TexOffset",new ip().setFromArray([0,0,1,1])),this.setItem()},r.toData=function(){e.prototype.toData.call(this)},i}(ii),t.SpriteComponent=er([e6(tX.SpriteComponent)],t.SpriteComponent);var nZ="lookup_texture",nq="offscreen_canvas",nQ={},nK=new e$,nJ=1,n$=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new eJ(0,0,0),this.quat=new e$(0,0,0,1),this.rotation=new e1(0,0,0),this.scale=new eJ(1,1,1),this.anchor=new eJ(0,0,0),this.size=new eK(1,1),this.children=[],this.worldMatrix=e0.fromIdentity(),this.localMatrix=e0.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new eJ(0,0,0),quat:new e$(0,0,0,1),scale:new eJ(1,1,1)},this.name="transform_"+nJ++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,o=t.size,a=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(ee(i,eJ)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),a)ee(a,e$)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(r){var c=e?-1:1;ee(r,e1)?this.setRotation(r.x*c,r.y*c,r.z*c):this.setRotation(r[0]*c,r[1]*c,r[2]*c)}n&&(ee(n,eJ)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),u&&(ee(u,eK)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){ec(this.children,t)},e.removeChild=function(t){eh(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new e1)},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 e1)},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),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 eJ().copyFrom(t.position),rotation:new e1(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new eJ().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=nK.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},eB(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}(),n0=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=n1(this.arc,this.arcMode,t)*eW,i=new eJ(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*eW),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eF(0,1)),direction:n.normalize()}},t}();function n1(t,e,i){if(e===tM.RANDOM)t=eF(0,t);else if(e===tM.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tM.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),o=n-Math.floor(n);t*=Math.floor(n)%2?1-o:o}else e===tM.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var n2=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=n1(this.arc,this.arcMode,t)*eW,i=new eJ(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),n3=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eF(-this._d,this._d),i=eF(-this._h,this._h);return{direction:new eJ(0,0,1),position:new eJ(e,i,0)}},t}(),n4=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=n1(this.arc,this.arcMode,t)*eW,i=new eJ(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,o=Math.atan2(n,r),a=Math.tan(e),s=new eJ;return e<o?s.set(r,r*a,0):e>=o&&e<Math.PI-o?s.set(n/a,n,0):e<Math.PI+o?s.set(-r,-r*a,0):e<2*Math.PI-o?s.set(-n/a,-n,0):s.set(r,r*a,0),{direction:i,position:s}},t}(),n5=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tM.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eF(0,1);return{direction:new eJ(0,1,0),position:new eJ(this._d*(e-.5),0,0)}},t}(),n6=new e0,n8=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=eF(0,2*Math.PI),n=n1(this.arc,this.arcMode,t)*eW,o=n6.setFromRotationZ(n),a=new eJ(Math.cos(r),Math.sin(r),0),s=new eJ(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),n9=new e0,n7=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 eF(-90,90)},e.generate=function(t){var e=n1(this.arc,this.arcMode,t)*eW,i=this.getHorizontalAngle()*eW,r=this.radius,n=new eJ(Math.cos(i),0,Math.sin(i)),o=n9.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(r),direction:o}},t}(),ot=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.getHorizontalAngle=function(){return eF(0,90)},e}(n7),oe=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=eQ(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(n1(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,o=new eJ(r,n,0);return{position:new eJ(r*this.width,n*this.height,0),direction:o.normalize()}},t}(),oi=function(){function t(){}return t.prototype.generate=function(){return{position:new eJ,direction:new eJ}},t}(),or=((t0={})[tm.NONE]=oi,t0[tm.CONE]=n0,t0[tm.SPHERE]=n7,t0[tm.HEMISPHERE]=ot,t0[tm.CIRCLE]=n2,t0[tm.DONUT]=n8,t0[tm.RECTANGLE]=n3,t0[tm.EDGE]=n5,t0[tm.RECTANGLE_EDGE]=n4,t0[tm.TEXTURE]=oe,t0);function on(t){if(!t)return new oi;var e=iM({radius:1,arc:360,angle:0,arcMode:tM.RANDOM},t),i=t.type,r=or[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tm.NONE){var o=t.alignSpeedDirection,a=t.upDirection;n.alignSpeedDirection=o,n.upDirection=eJ.fromArray(void 0===a?[0,0,1]:a).normalize()}return n}function oo(t,e,i,r,n){var o,a;if(n===function(t,e,i,r){for(var n=0,o=e,a=i-r;o<i;o+=r)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,i,r)>0)for(o=e;o<i;o+=r)a=oy(o,t[o],t[o+1],a);else for(o=i-r;o>=e;o-=r)a=oy(o,t[o],t[o+1],a);return a&&ol(a,a.next)&&(og(a),a=a.next),a}function oa(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(ol(r,r.next)||0===oh(r.prev,r,r.next))){if(og(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function os(t,e){return t.x-e.x}function ou(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 oc(t,e,i,r,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(r-s)-(i-a)*(e-s)>=0&&(i-a)*(o-s)-(n-a)*(r-s)>=0}function oh(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ol(t,e){return t.x===e.x&&t.y===e.y}function of(t,e,i,r){var n=op(oh(t,e,i)),o=op(oh(t,e,r)),a=op(oh(i,r,t)),s=op(oh(i,r,e));return!!(n!==o&&a!==s||0===n&&od(t,i,e)||0===o&&od(t,r,e)||0===a&&od(i,t,r)||0===s&&od(i,e,r))}function od(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 op(t){return t>0?1:t<0?-1:0}function om(t,e){return 0>oh(t.prev,t,t.next)?oh(t,e,t.next)>=0&&oh(t,t.prev,e)>=0:0>oh(t,e,t.prev)||0>oh(t,t.next,e)}function ov(t,e){var i=new ox(t.i,t.x,t.y),r=new ox(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function oy(t,e,i,r){var n=new ox(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 og(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 ox(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 oT=0;function ob(t,e,i,r){i=i||2,oT=r||0;var n,o,a,s,u,c,h,l=e&&e.length,f=l?e[0]*i:t.length,d=oo(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(d=function(t,e,i,r){var n,o,a,s,u,c=[];for(n=0,o=e.length;n<o;n++)a=e[n]*r,s=n<o-1?e[n+1]*r:t.length,(u=oo(t,a,s,r,!1))===u.next&&(u.steiner=!0),c.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(c.sort(os),n=0;n<c.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,o=e,a=t.x,s=t.y,u=-1/0;do{if(s<=o.y&&s>=o.next.y&&o.next.y!==o.y){var c=o.x+(s-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(c<=a&&c>u){if(u=c,c===a){if(s===o.y)return o;if(s===o.next.y)return o.next}n=o.x<o.next.x?o:o.next}}o=o.next}while(o!==e);if(!n)return null;if(a===u)return n;var h,l=n,f=n.x,d=n.y,p=1/0;o=n;do a>=o.x&&o.x>=f&&a!==o.x&&oc(s<d?a:u,s,f,d,s<d?u:a,s,o.x,o.y)&&(h=Math.abs(s-o.y)/(a-o.x),om(o,t)&&(h<p||h===p&&(o.x>n.x||o.x===n.x&&(i=n,r=o,0>oh(i.prev,i,r.prev)&&0>oh(r.next,i,i.next))))&&(n=o,p=h)),o=o.next;while(o!==l);return n}(t,e)){var i=ov(e,t);oa(e,e.next),oa(i,i.next)}})(c[n],i),i=oa(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=a=t[0],o=s=t[1];for(var m=i;m<f;m+=i)u=t[m],c=t[m+1],u<n&&(n=u),c<o&&(o=c),u>a&&(a=u),c>s&&(s=c);h=0!==(h=Math.max(a-n,s-o))?1/h:0}return function t(e,i,r,n,o,a,s){if(e){!s&&a&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=ou(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,o,a,s,u,c=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,r=i,s=0,e=0;e<c&&(s++,r=r.nextZ);e++);for(u=c;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--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,c*=2}while(a>1)}(n)}(e,n,o,a);for(var u,c,h=e;e.prev!==e.next;){if(u=e.prev,c=e.next,a?function(t,e,i,r){var n=t.prev,o=t.next;if(oh(n,t,o)>=0)return!1;for(var a=n.x<t.x?n.x<o.x?n.x:o.x:t.x<o.x?t.x:o.x,s=n.y<t.y?n.y<o.y?n.y:o.y:t.y<o.y?t.y:o.y,u=n.x>t.x?n.x>o.x?n.x:o.x:t.x>o.x?t.x:o.x,c=n.y>t.y?n.y>o.y?n.y:o.y:t.y>o.y?t.y:o.y,h=ou(a,s,e,i,r),l=ou(u,c,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=l;){if(f!==t.prev&&f!==t.next&&oc(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&oh(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&oc(n.x,n.y,t.x,t.y,o.x,o.y,d.x,d.y)&&oh(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&oc(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&oh(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&oc(n.x,n.y,t.x,t.y,o.x,o.y,d.x,d.y)&&oh(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,o,a):function(t){var e=t.prev,i=t.next;if(oh(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(oc(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&oh(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+oT),i.push(e.i/r+oT),i.push(c.i/r+oT),og(e),e=c.next,h=c.next;continue}if((e=c)===h){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!ol(n,o)&&of(n,r,r.next,o)&&om(n,o)&&om(o,n)&&(e.push(n.i/i+oT),e.push(r.i/i+oT),e.push(o.i/i+oT),og(r),og(r.next),r=t=o),r=r.next}while(r!==t);return oa(r)}(oa(e),i,r),i,r,n,o,a,2):2===s&&function(e,i,r,n,o,a){var s=e;do{for(var u,c,h=s.next.next;h!==s.prev;){if(s.i!==h.i&&(u=s,c=h,u.next.i!==c.i&&u.prev.i!==c.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&&of(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,c)&&(om(u,c)&&om(c,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,c)&&(oh(u.prev,u,c.prev)||oh(u,c.prev,c))||ol(u,c)&&oh(u.prev,u,u.next)>0&&oh(c.prev,c,c.next)>0))){var l=ov(s,h);s=oa(s,s.next),l=oa(l,l.next),t(s,i,r,n,o,a),t(l,i,r,n,o,a);return}h=h.next}s=s.next}while(s!==e)}(e,i,r,n,o,a):t(oa(e),i,r,n,o,a,1);break}}}}(d,p,i,n,o,h),p}function oE(t,e){for(var i,r,n=t.s,o=t.p,a=n[1],s=o[1],u=0,c=0;c<a.length;c++)u+=a[c].length-1;var h,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=(h=d[4])?d[3]:d[2],g=h?d[2]:d[3]);for(var x=[0,0],T=0===h?0:-Math.PI/2,b=0;b<a.length;b++)for(var E=a[b],_=s[b],C=s[b+1]||s[0],S=[0,0],A=0;A<E.length-1;A++)(function(t,e,i,r,n,o,a,s){var u=1-e,c=u*u*u,h=3*e*u*u,l=3*e*e*u,f=e*e*e;t[0]=c*i[0]+h*n+l*a+f*r[0],t[1]=c*i[1]+h*o+l*s+f*r[1]})(S,E[A],_,C,_[4],_[5],C[2],C[3]),i=S[0],r=S[1],l[p++]=i/2,l[p++]=r/2,d?(x[0]=i,x[1]=r,oC(x,x,T),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=ob(Array.from(l),null,6,void 0===f?0:f);return{aPoint:l,index:new Uint16Array(w)}}function o_(t,e){for(var i,r=[],n=(i=[],t.gs?t.gs.forEach(function(t){i.push({p:[tA.SHAPE_POINTS,t.p],s:[tA.SHAPE_SPLITS,t.s]})}):t.g?i.push({p:[tA.SHAPE_POINTS,t.g.p],s:[tA.SHAPE_SPLITS,t.g.s]}):i.push(t),i),o=0,a=0,s=0,u=0;u<n.length;u++){var c=oE(n[u],{indexBase:o,uvTransform:e});o+=c.aPoint.length/5,r.push(c),a+=c.aPoint.length,s+=c.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(a),l=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];h.set(m.aPoint,d),d+=m.aPoint.length,l.set(m.index,p),p+=m.index.length}return{aPoint:h,index:l}}function oC(t,e,i){var r=Math.cos(i),n=Math.sin(i),o=e[0],a=e[1];return t[0]=r*o+n*a,t[1]=-n*o+r*a,t}var oS=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+i||1,this.count=ee(r,rw)?r:rU(r),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),oA=function(t){this.content=t},ow=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 oA(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 oA(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,o=t.next;n.next=o,o&&(o.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}(),oO=new eJ,oR=new eJ,oI=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,o=i.colorOverTrail,a=i.maxTrailCount,s=i.opacityOverLifetime,u=void 0===s?rU(1):s,c=i.widthOverTrail,h=i.name,l=i.occlusion,f=i.blending,d=i.maskMode,p=i.textureMap,m=i.texture,v=i.transparentOcclusion,y=i.minimumVertexDistance,g=i.lifetime,x=i.matrix,T=e.gpuCapability,b=T.detail,E=T.level,_=Math.max(i.pointCountPerTrail,2),C=rj(),S=b.maxVertexTextures>0,A=(null!=(r=e.renderer)?r:{}).env,w={},O=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",A===ib]],R=a>64,I=0;n&&(O.push(["COLOR_OVER_LIFETIME",!0]),I|=1,w.uColorOverLifetime=i$.createWithData(e,eb(n))),o&&(O.push(["COLOR_OVER_TRAIL",!0]),I|=4,w.uColorOverTrail=i$.createWithData(e,eb(o))),R?(O.push(["ATTR_TRAIL_START",1]),I|=8):w.uTrailStart=new Float32Array(a),w.uOpacityOverLifetimeValue=u.toUniform(C);var M=c.toUniform(C);O.push(["VERT_CURVE_VALUE_COUNT",C.index],["VERT_MAX_KEY_FRAME_COUNT",C.max]),w.uVCurveValues=rw.getAllData(C);var L={shader:{vertex:nn,fragment:ni,macros:O,glslVersion:1===E?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+I+"+"+C.index+"+"+C.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},P=_*a*2,V=(_-1)*a,F=Float32Array.BYTES_PER_ELEMENT,N=12*F,D={attributes:{aColor:{size:4,stride:N,data:new Float32Array(12*P)},aSeed:{size:1,stride:N,offset:4*F,dataSource:"aColor"},aInfo:{size:3,stride:N,offset:5*F,dataSource:"aColor"},aPos:{size:4,stride:N,offset:8*F,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(P)},aDir:{size:3,data:new Float32Array(3*P)}},indices:{data:new Uint16Array(6*P)},drawCount:6*V,name:"trail#"+h,bufferUsage:iC.DYNAMIC_DRAW};if(R)D.attributes.aTrailStart={size:1,data:new Float32Array(P)};else{var z=new Float32Array(P);D.attributes.aTrailStartIndex={size:1,data:z};for(var k=0;k<a;k++)for(var U=2*_,B=k*U,G=0;G<U;G++)z[B+G]=k}var X=iw(f),j=rt.create(e,L);j.blending=!0,j.depthMask=l,j.depthTest=!0,iI(j,d),iO(j,f);var H=this.mesh=r5.create(e,{name:"MTrail_"+h,material:j,geometry:r2.create(e,D)}),W=null!=m?m:i$.createWithData(e);Object.keys(w).map(function(t){var e=w[t];if(ee(e,i$))j.setTexture(t,e);else if("uTrailStart"===t)j.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new ip(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}j.setVector4Array(t,i)}else j.setVector4(t,ip.fromArray(e))}),j.setFloat("uTime",0),j.setVector4("uWidthOverTrail",ip.fromArray(M)),j.setVector2("uTexOffset",new eK(0,0)),j.setVector4("uTextureMap",ip.fromArray(void 0===p?[0,0,1,1]:p)),j.setVector4("uParams",new ip(0,_-1,0,0)),j.setTexture("uMaskTex",W),j.setVector4("uColorParams",new ip(m?1:0,+X,0,+(l&&!v))),this.maxTrailCount=a,this.pointCountPerTrail=_,this.checkVertexDistance=y>0,this.minimumVertexDistance=Math.pow(y||.001,2),this.useAttributeTrailStart=R,this.lifetime=g,x&&(this.mesh.worldMatrix=x),this.geometry=H.firstGeometry(),this.trailCursors=new Uint16Array(a)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=r%n,u=(r-1)%n,c=(r-2)%n,h=this.getTrailPosition(t,u,oO);if(!(h&&this.checkVertexDistance&&(null==h?void 0:h.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+s,f=oV(h,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),o.setAttributeSubData("aDir",6*l,v),o.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,o.setAttributeSubData("aColor",24*l,g),u>=0){var T=new Float32Array(oV(this.getTrailPosition(t,c,oR),h,e)),b=(t*n+u)*6;o.setAttributeSubData("aDir",b,T),o.setAttributeSubData("aDir",b+3,T);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*a+(r-1)%a)*6;o.setIndexSubData(C,_)}r=++this.trailCursors[t];var S=this.mesh.material,A=S.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var O=2*n,R=new Float32Array(O),I=0;I<O;I++)R[I]=w;o.setAttributeSubData("aTrailStart",t*R.length,R)}else{var M=S.getFloats("uTrailStart");void 0!=M&&(M[t]=w,S.setFloats("uTrailStart",M))}A&&(A.y=Math.max(A.y,r-1)-Math.max(0,r-n),S.setVector4("uParams",A))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,o=this.geometry.getAttributeData("aColor");return eS(o),i.x=o[n],i.y=o[1+n],i.z=o[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();eS(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");eS(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();eS(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){},eB(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}(),oM=new eJ,oL=new eJ,oP=new eJ;function oV(t,e,i){return t||i?(t?i?(oL.subtractVectors(e,t).normalize(),oL.subtractVectors(i,e),oP.copyFrom(oL).normalize(),oM.addVectors(oL,oP)):oM.subtractVectors(e,t):oM.subtractVectors(i,e),oM.normalize().toArray()):[0,0,0]}var oF=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new oZ(e,i)),r&&(n.trailMesh=new oI(e,r));var n,o=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(o.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=o,n}eX(e,t);var i=e.prototype;return i.start=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=eH(this.meshes);!(t=e()).done;)t.value.start()},i.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new ip(e,this.item.duration,0,0))},i.render=function(t){for(var e,i=eH(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.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}(ii);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)===tI.removeParticle,ray:t})}}},r&&n.fromData(r),n}eX(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},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]===tA.CONSTANT_VEC3?e.add(r[1]):t=rU(r)),this.basicTransform={position:e,rotation:i,path:t};var n=this.transform.parentTransform,o=e.clone();if(t&&o.add(t.getValue(0)),this.transform.setPosition(o.x,o.y,o.z),this.options.particleFollowParent&&n){var a=n.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.updateEmitterTransform=function(t){var e=this.transform.parentTransform,i=this.basicTransform,r=i.path,n=i.position.clone();if(r){var o=this.item.duration;n.add(r.getValue(t/o))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.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 o=r.first;r.removeNode(o),i=n[1]=o.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 ip(n[0],n[1],n[2],t));for(var o=r.getAttributeData("aColor")||[],a=0;a<o.length;a+=32)o[8*a+7]=t},r.setColor=function(t,e,i,r){var n,o=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,s=(null==(n=o.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];o.setVector4("uOpacityOverLifetimeValue",new ip(s[0],s[1],s[2],r));for(var u=a.getAttributeData("aColor")||[],c=0;c<u.length;c+=32)u[8*c+4]=t,u[8*c+5]=e,u[8*c+6]=i,u[8*c+7]=r},r.setParentTransform=function(t){},r.getTextures=function(){return this.renderer.getTextures()},r.start=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 ow(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1},r.onUpdate=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,o=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var a=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,c=!1,h=function(){e.trails&&!c&&(c=!0,a.forEach(function(t){var i=t[0],r=t[1],n=t[2],o=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,o,n)}))};if(this.ended){if(this.item.endBehavior!==tO.restart&&tO.destroy===this.item.endBehavior){var l=a.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/o.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=a.first;return e.emissionStopped||a.length===y&&t&&t.content[0]-n>u},x=0;x<m&&x<y&&!g();x++){var T=this.createPoint(d);T.delay+=i+x*v,this.addParticle(T,y),this.lastEmitTime=u}for(var b=o.bursts,E=(null==b?void 0:b.length)-1,_=0;E>=0&&_<y&&!g();E--){var C=b[E].getGeneratorOptions(u,d);if(C)for(var S=[0,0,0],A=o.burstOffsets[E],w=A&&A[C.cycleIndex]||S,O=0;O<C.count&&_<y&&!g();O++){var R,I=this.initPoint(this.shape.generate({total:C.total,index:C.index,burstIndex:O,burstCount:C.count}));I.delay+=i,_++,(R=I.transform).translate.apply(R,[].concat(w)),this.addParticle(I,y)}}}else this.item.endBehavior===tO.restart?(h(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=f,o.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===tO.freeze&&(this.frozen=!0))}h()}},r.onDestroy=function(){this.item&&this.item.composition&&(this.item.composition.destroyTextures(this.getTextures()),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 o=t.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);i.push({center:c,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>r&&(a=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],o=new eJ,a=!1;if(r&&r.content)do{var s=r.content,u=s[0],c=s[1];s[2];var h=s[3];if(u>this.timePassed){var l=this.getPointPosition(h),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:l,radius:t.radius},o)),d&&(t.removeParticle&&(i.removeParticlePoint(c),this.clearPointTrail(c),e.removeNode(r),r.content=[0]),n.push(l),t.multiple||(a=!0))}else break}while((r=r.pre)&&!a);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 o=this.trails,a=this.getPointPosition(i),s=o.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),c=1,h=o.lifetime.getValue(e);if(o.sizeAffectsWidth&&(c*=u[0]),o.sizeAffectsLifetime&&(h*=u[0]),o.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&a.subtract(l)}n.addTrailPoint(t,a,{color:s,lifetime:h,size:c,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,o=t.gravity,a=this.options.forceTarget,s=this.lastUpdate-n,u=new eJ,c=eJ.fromArray(void 0===o?[]:o);e.assignWorldTRS(u);var h=ro(new eJ,this.options,c,s,r,u,i);if(a){var l=a.target||[0,0,0],f=a.curve.getValue(s/r),d=1-f;h.x=h.x*d+l[0]*f,h.y=h.y*d+l[1]*f,h.z=h.z*d+l[2]*f}return h},r.initPoint=function(t){var e,i,r,n,o=this.options,a=this.lifetime,s=this.shape,u=o.startSpeed.getValue(a),c=o.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),h=t.position,l=new n$({position:c.transformPoint(h,new eJ),valid:!0}),f=t.direction;if(f=c.transformNormal(f,oN).normalize(),o.startTurbulence&&o.turbulence){for(var d=0;d<3;d++)oB.setElement(d,o.turbulence[d].getValue(a));oG.setFromVector3(oB.negate()),oj.setFromEuler(oG).transformNormal(f).normalize()}s.alignSpeedDirection?(oU.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=eJ.Z.clone(),c.transformNormal(this.upDirectionWorld)),ok.crossVectors(oU,this.upDirectionWorld).normalize(),ok.isZero()&&ok.set(1,0,0)):(ok.set(1,0,0),oU.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=oX)[0]=p.animationDelay.getValue(a),n[1]=p.animationDuration.getValue(a),n[2]=p.cycles.getValue(a)),o.start3DRotation?oz.set(o.startRotationX.getValue(a),o.startRotationY.getValue(a),o.startRotationZ.getValue(a)):o.startRotation?oz.set(0,0,o.startRotation.getValue(a)):oz.set(0,0,0),l.setRotation(oz.x,oz.y,oz.z);var m=o.startColor.getValue(a);if(3===m.length&&(m[3]=1),o.start3DSize)oD.x=o.startSizeX.getValue(a),oD.y=o.startSizeY.getValue(a);else{var v=o.startSize.getValue(a),y=o.sizeAspect.getValue(a);oD.x=v,oD.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!o.particleFollowParent){var x=new eJ;this.transform.assignWorldTRS(void 0,void 0,x),oD.x*=x.x,oD.y*=x.y}return l.setScale(oD.x,oD.y,1),{size:oD,vel:g,color:m,delay:o.startDelay.getValue(a),lifetime:o.startLifetime.getValue(a),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:o.gravity,sprite:n,dirY:oU,dirX:ok,transform:l}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&ee(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return -1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,r,n,o,a,s,u,c,h,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,T=ra(null==y?void 0:y.gravity),b=t.textureSheetAnimation,E=b?{animationDelay:rU(b.animationDelay||0),animationDuration:rU(b.animationDuration||1),cycles:rU(b.cycles||1),animate:b.animate,col:b.col,row:b.row,total:b.total||b.col*b.row}:void 0,_=!!(g&&g.turbulenceX||(null==g?void 0:g.turbulenceY)||(null==g?void 0:g.turbulenceZ));_&&(n=[rU(null!=(o=g.turbulenceX)?o:0),rU(null!=(a=g.turbulenceY)?a:0),rU(null!=(s=g.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=on(g),this.emission={rateOverTime:rU(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=ee(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 oS(t)})},this.textureSheetAnimation=E;var C=t.renderer||{},S={},A=t.rotationOverLifetime;A&&(S.asRotation=!!A.asRotation,S.z=A.z?rU(A.z):rU(0),A.separateAxes&&(S.x=A.x&&rU(A.x),S.y=A.y&&rU(A.y))),(null==y?void 0:y.forceTarget)&&(c={target:y.target||[0,0,0],curve:rU(y.forceCurve||[tA.LINE,[[0,0],[1,1]]])});var w={x:y.linearX&&rU(y.linearX||0),y:y.linearY&&rU(y.linearY||0),z:y.linearZ&&rU(y.linearZ||0),asMovement:y.asMovement},O={x:y.orbitalX&&rU(y.orbitalX),y:y.orbitalY&&rU(y.orbitalY),z:y.orbitalZ&&rU(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},R=t.sizeOverLifetime||{},I=t.colorOverLifetime,M=(null==R?void 0:R.separateAxes)?{separateAxes:!0,x:rU(R.x),y:rU(R.y)}:{separateAxes:!1,x:rU(("size"in R?R.size:R.x)||1)};C.anchor=C.anchor||[0,0];var L=eK.fromArray(C.anchor);this.options={particleFollowParent:!!m.particleFollowParent,startLifetime:rU(m.startLifetime),startDelay:rU(m.startDelay||0),startSpeed:rU(y.startSpeed||0),startColor:rU(m.startColor),looping:!1,maxCount:null!=(h=m.maxCount)?h:0,gravityModifier:rU(x||0),gravity:T,start3DSize:!!m.start3DSize,startTurbulence:_,turbulence:n,speedOverLifetime:y.speedOverLifetime&&rU(y.speedOverLifetime),linearVelOverLifetime:w,orbitalVelOverLifetime:O,forceTarget:c},m.startRotationZ&&(this.options.startRotation=rU(m.startRotationZ||0)),(m.startRotationX||m.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=rU(m.startRotationX||0),this.options.startRotationY=rU(m.startRotationY||0),this.options.startRotationZ=rU(m.startRotationZ||0)),m.start3DSize?(this.options.startSizeX=rU(m.startSizeX),this.options.startSizeY=rU(m.startSizeY)):(this.options.startSize=rU(m.startSize),this.options.sizeAspect=rU(m.sizeAspect||1));var P={meshSlots:m.meshSlots,name:this.name,matrix:e0.IDENTITY,shaderCachePrefix:"",renderMode:C.renderMode||tT.BILLBOARD,side:C.side||td.DOUBLE,gravity:T,blending:C.blending||tf.ALPHA,rotationOverLifetime:S,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:C.mask,maskMode:null!=(l=C.maskMode)?l:tp.NONE,forceTarget:c,diffuse:C.texture,sizeOverLifetime:M,anchor:L};if(I){var V=I.color,F=I.opacity;P.colorOverLifetime={},F&&(P.colorOverLifetime.opacity=rU(I.opacity)),V&&(V[0]===tA.GRADIENT_COLOR?P.colorOverLifetime.color=I.color[1]:V[0]===tA.RGBA_COLOR?P.colorOverLifetime.color=i$.createWithData(this.engine,{data:new Uint8Array(V[1]),width:1,height:1}):ee(V,i$)&&(P.colorOverLifetime.color=V))}var N=[],D=[0,0,1,1];if(t.splits){var z=t.splits[0];D=(f=z[4])?[z[0],z[1],z[3],z[2]]:[z[0],z[1],z[2],z[3]]}if(E&&!E.animate)for(var k=f?E.row:E.col,U=f?E.col:E.row,B=E.total||k*U,G=0,X=0;X<k;X++)for(var j=0;j<U&&G<B;j++,G++)N.push([X*D[2]/k+D[0],j*D[3]/U+D[1],D[2]/k,D[3]/U]);else N.push(D);this.uvs=N,P.textureFlip=f;var H=t.trails;H&&(this.trails={lifetime:rU(H.lifetime),dieWithParticles:!1!==H.dieWithParticles,sizeAffectsWidth:!!H.sizeAffectsWidth,sizeAffectsLifetime:!!H.sizeAffectsLifetime,inheritParticleColor:!!H.inheritParticleColor,parentAffectsPosition:!!H.parentAffectsPosition},d={name:"Trail",matrix:e0.IDENTITY,minimumVertexDistance:H.minimumVertexDistance||.02,maxTrailCount:m.maxCount,pointCountPerTrail:Math.round(H.maxPointPerTrail)||32,blending:H.blending,texture:H.texture,opacityOverLifetime:rU(H.opacityOverLifetime||1),widthOverTrail:rU(H.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!H.occlusion,transparentOcclusion:!!H.transparentOcclusion,textureMap:H.textureMap,mask:C.mask,maskMode:C.maskMode},H.colorOverLifetime&&H.colorOverLifetime[0]===tA.GRADIENT_COLOR&&(d.colorOverLifetime=H.colorOverLifetime[1]),H.colorOverTrail&&H.colorOverTrail[0]===tA.GRADIENT_COLOR&&(d.colorOverTrail=H.colorOverTrail[1])),this.renderer=new oF(this.engine,P,d),this.renderer.item=this.item,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},eB(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}}]),i}(it),t.ParticleSystem=er([e6(tX.ParticleSystem)],t.ParticleSystem);var oN=new eJ,oD=new eK,oz=new e1,ok=new eJ,oU=new eJ,oB=new eJ,oG=new e1,oX=[0,0,0],oj=new e0,oH=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}eX(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&ee(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform()))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){e.setVisible(!0);var i=t.deltaTime;this.time<e.item.duration&&e.isFrozen()&&e.reset(),.001>Math.abs(this.time-this.lastTime)&&(i=0),e.onUpdate(i)}this.lastTime=this.time},i}(nB),oW=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createPlayable=function(t){return new oH(t)},e}(nX),oY={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"},oZ=function(){function e(e,i){this.particleCount=0;var r,n,o,a,s,u,c,h,l,f=(null!=(c=e.renderer)?c:{}).env,d=i.speedOverLifetime,p=i.colorOverLifetime,m=i.linearVelOverLifetime,v=i.orbitalVelOverLifetime,y=i.sizeOverLifetime,g=i.rotationOverLifetime,x=i.sprite,T=i.gravityModifier,b=i.maxCount,E=i.textureFlip,_=i.useSprite,C=i.name,S=i.gravity,A=i.forceTarget,w=i.side,O=i.occlusion,R=i.anchor,I=i.blending,M=i.maskMode,L=i.mask,P=i.transparentOcclusion,V=i.meshSlots,F=i.renderMode,N=void 0===F?0:F,D=i.diffuse,z=void 0===D?i$.createWithData(e):D,k=e.gpuCapability.detail,U=k.halfFloatTexture,B=k.maxVertexUniforms,G=[["RENDER_MODE",+N],["ENV_EDITOR",f===ib]],X=e.gpuCapability.level,j=rj(),H=rj(),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(j)),(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=ee(p.color,i$)?p.color:i$.createWithData(e,eb(p.color))),(null==p?void 0:p.opacity)?Y.uOpacityOverLifetimeValue=p.opacity.toUniform(j):Y.uOpacityOverLifetimeValue=rU(1).toUniform(j),["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(j),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(j),r=1,q|=1<<10+e,h=!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),h&&((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(j),(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(j)),(null==g?void 0:g.z)&&(Y.uRZByLifeTimeValue=g.z.toUniform(j),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(Y.uRXByLifeTimeValue=g.x.toUniform(j),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(Y.uRYByLifeTimeValue=g.y.toUniform(j),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=T.toUniform(j),A&&(G.push(["FINAL_TARGET",!0]),q|=524288,Y.uFinalTarget=new Float32Array(A.target||[0,0,0]),Y.uForceCurve=A.curve.toUniform(j)),U&&H.max?(q|=1048576,Y.uFCurveValueTexture=i0(e,rw.getAllData(H,!0),H.index,1)):Y.uFCurveValues=rw.getAllData(H);var Q=j.max+j.curves.length-32>B;if(2===X&&(j.max=-1,j.index=V?V[0]:oQ(j.index),H.index>0&&(H.max=-1,H.index=V?V[1]:oQ(H.index))),Q&&U&&W){var K=i0(e,rw.getAllData(j,!0),j.index,1);Y.uVCurveValueTexture=K,Z=1}else Y.uVCurveValues=rw.getAllData(j);var J=["-p:",N,q,j.index,j.max,H.index,H.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",j.index],["FRAG_CURVE_VALUE_COUNT",H.index],["VERT_MAX_KEY_FRAME_COUNT",j.max],["FRAG_MAX_KEY_FRAME_COUNT",H.max]);var $={fragment:ni,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+nr,glslVersion:1===X?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,macros:G,name:"particle#"+C},tt=iw(I);Y.uTexOffset=new Float32Array(z?[1/z.getWidth(),1/z.getHeight()]:[0,0]),Y.uMaskTex=z,Y.uColorParams=new Float32Array([z?1:0,+tt,0,+(!!O&&!P)]),Y.uParams=[0,0,0,0],Y.uAcceleration=[(null==S?void 0:S[0])||0,(null==S?void 0:S[1])||0,(null==S?void 0:S[2])||0,0];var te=rt.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=L?[L,L]:void 0,iI(te,M),iO(te,I),iR(te,w),Object.keys(Y).map(function(t){var e=Y[t];if(ee(e,i$)){te.setTexture(t,e);return}var i=[];switch(oY[t]){case"vec4":te.setVector4(t,ip.fromArray(e));break;case"vec3":te.setVector3(t,eJ.fromArray(e));break;case"vec2":te.setVector2(t,eK.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new ip(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 eJ(0,0,0)),te.setFloat("emissionIntensity",0);var ti=r2.create(e,(r=4*b,n=this.useSprite,o="particle#"+C,u={aPos:{size:3,offset:0,stride:s=12*(a=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*a,stride:s,dataSource:"aPos"},aDirX:{size:3,offset:6*a,stride:s,dataSource:"aPos"},aDirY:{size:3,offset:9*a,stride:s,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*a,data:new Float32Array(0)},aSeed:{size:1,offset:3*a,stride:8*a,dataSource:"aRot"},aColor:{size:4,offset:4*a,stride:8*a,dataSource:"aRot"},aOffset:{size:4,stride:4*a,data:new Float32Array(0)}},n&&(u.aSprite={size:3,stride:3*a,data:new Float32Array(0)}),{attributes:u,indices:{data:new Uint16Array(0)},name:o,maxVertex:r})),tr=r5.create(e,{name:"MParticle_"+C,material:te,geometry:ti});this.anchor=R,this.mesh=tr,this.geometry=tr.firstGeometry(),this.forceTarget=A,this.sizeOverLifetime=y,this.speedOverLifetime=d,this.linearVelOverLifetime=m,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=T,this.maxCount=b,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 eS(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],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new i.constructor(0))},i.minusTime=function(t){var e=this.geometry.getAttributeData("aOffset");eS(e);for(var 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,o=4*n,a=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 c={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},h=this.useSprite;h&&(c.aSprite=new Float32Array(12));var l=new eJ,f=new e$,d=new eJ(1,1,1);e.transform.assignWorldTRS(l,f,d);var p=n$.getRotation(f,new e1),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],T=e.vel,b=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();h&&(r=e.sprite);for(var C=0;C<4;C++){var S=2*C,A=3*C,w=4*C,O=12*C,R=8*C;c.aPos.set(m,O),T.fill(c.aPos,O+3),c.aRot.set(v,R),c.aRot[R+3]=_,c.aRot.set(b,R+4),h&&c.aSprite.set(r,A);var I=e.uv||x;if(I){var M=h?1-y[S+1]:y[S+1];g[0]=I[0]+y[S]*I[2],g[1]=I[1]+M*I[3]}c.aOffset.set(g,w);for(var L=C+C,P=(E[L]-this.anchor.x)*d.x,V=(E[L+1]-this.anchor.y)*d.y,F=0;F<3;F++)c.aPos[O+6+F]=e.dirX.getElement(F)*P,c.aPos[O+9+F]=e.dirY.getElement(F)*V}var N=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var D=el(a.getIndexData(),6*n,6*i,u);D.set(N,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,N);Object.keys(c).forEach(function(e){var r=c[e],n=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var h=a.getAttributeData(e);eS(h);var l=el(h,o*n,4*i*n,u);l.set(r,r.length*t),a.setAttributeData(e,l)}else a.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),a.setDrawCount(6*this.particleCount)}},e}(),oq=[10,32,64,160];function oQ(t){for(var e=0;e<oq.length;e++){var i=oq[e];if(i>t)return i}return t||oq[0]}function oK(t,e,i){void 0===i&&(i="");var r,n,o,a=t.content,s=+((null==(r=a.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===ib]],c=e.level,h=e.detail,l=rj(),f=rj(),d=h.maxVertexUniforms>0,p=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,rX(l,p));var y=a.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=a.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&rX(l,x);var T=a.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==T?void 0:T[r])&&(rX(l,T[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==T?void 0:T[n])&&(rX(l,T[n]),a=1,v|=1<<10+e,o=!0),u.push(["ORB_VEL_"+t.toUpperCase(),a])}),(null==T?void 0:T.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),o&&(null==T?void 0:T.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),a.sizeOverLifetime){var b=a.sizeOverLifetime;b.separateAxes?(rX(l,b.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,rX(l,b.y)):rX(l,b.size)}if(a.rotationOverLifetime){var E=a.rotationOverLifetime;E.z&&(rX(l,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(rX(l,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(rX(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)}rX(l,null==T?void 0:T.gravityOverLifetime),(null==T?void 0:T.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,rX(l,T.forceCurve));var _=h.halfFloatTexture;_&&f.max&&(v|=1048576);var C=h.maxVertexUniforms,S=l.max+l.curves.length-32>C;nQ[nZ]&&(S=!0),2===c&&(l.max=-1,f.index>0&&(f.max=-1)),S&&_&&d&&(m=1);var A={fragment:ni,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+nr,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:A,vertex:l.index,fragment:f.index}}function oJ(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 o=0;o<t.macros.length;o++){var a=t.macros[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=i;break}}}var o$=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.precompile=function(e,i,r){var n=i.engine.gpuCapability,o=n.level,a=(null!=r?r:{}).env,s=i.getShaderLibrary(),u=[],c=[],h=0,l=0;return e.forEach(function(e){e.items.forEach(function(e){t.Item.isParticle(e)&&u.push(e)})}),u.forEach(function(e){var i=oK(e,n,a),r=i.shader,u=i.fragment,f=i.vertex;if(c.push(r),h=Math.max(h,u),l=Math.max(l,f),e.content.trails){var d,p,m,v,y,g,x,T,b=(d=e.content.trails,p=e.content.options.maxCount,m=e.name,void 0===(v=a)&&(v=""),y=0,g=nQ[nZ]?1:0,x=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",g],["ENV_EDITOR",v===ib]],T=rj(),d.colorOverLifetime&&(x.push(["COLOR_OVER_LIFETIME",!0]),y|=1),d.colorOverTrail&&(x.push(["COLOR_OVER_TRAIL",!0]),y|=4),p>64&&(x.push(["ATTR_TRAIL_START",1]),y|=8),rX(T,d.opacityOverLifetime),rX(T,d.widthOverTrail),x.push(["VERT_CURVE_VALUE_COUNT",T.index],["VERT_MAX_KEY_FRAME_COUNT",T.max]),{vertex:nn,fragment:ni,macros:x,shared:!0,name:"trail#"+m,cacheId:"-t:+"+y+"+"+T.index+"+"+T.max});b.glslVersion=2===o?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,null==s||s.addShader(b)}}),c.forEach(function(e){2===o?(oJ(e,l,h),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,null==s||s.addShader(e)}),2===o&&u.forEach(function(t){t.content.options.meshSlots=[l,h]}),Promise.resolve()},i}(ir),o0=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(ir),o1=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]},e.getInputStream=function(t){var e=this.playable.getInput(t);if(ee(e,o2))return e.animationStream},t}(),o2=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new o1(nk(i)),i}return eX(e,t),e}(nB),o3=new e1,o4=new eJ(1,1,1),o5=new eJ,o6=function(e){function i(){return e.apply(this,arguments)}eX(i,e);var r=i.prototype;return r.start=function(){var t,e=this.binding,i=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new eJ(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,o=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=rU(r.path));var a=r.linearX||r.linearY||r.linearZ;a&&(this.linearVelOverLifetime={x:r.linearX&&rU(r.linearX),y:r.linearY&&rU(r.linearY),z:r.linearZ&&rU(r.linearZ),asMovement:r.asMovement,enabled:!!a});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&rU(r.orbitalX),y:r.orbitalY&&rU(r.orbitalY),z:r.orbitalZ&&rU(r.orbitalZ),center:ra(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&rU(r.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=rU(o.x||1),this.sizeYOverLifetime=rU(o.y||1),this.sizeZOverLifetime=rU(o.z||1)):this.sizeXOverLifetime=rU(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:rU(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=rU(n.x||0),u.y=rU(n.y||0)}this.gravity=eJ.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=rU(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?eJ.fromArray(r.direction).normalize():new eJ,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.binding){var i=e.output.getUserData();ee(i,t.VFXItem)&&(this.binding=i,this.start())}this.binding&&this.binding.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.binding,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){o4.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(o4.y=this.sizeYOverLifetime.getValue(r),o4.z=this.sizeZOverLifetime.getValue(r)):o4.z=o4.y=o4.x;var n=this.originalTransform.scale;e.transform.setScale(o4.x*n.x,o4.y*n.y,o4.z*n.z)}if(this.rotationOverLifetime){var o=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},a=o(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;o3.x=s?o(this.rotationOverLifetime.x):0,o3.y=s?o(this.rotationOverLifetime.y):0,o3.z=a;var u=o3.addEulers(this.originalTransform.rotation,o3);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(ro(o5,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&o5.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(o5.x,o5.y,o5.z))},i}(o2);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new o6(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(nX),t.TransformPlayableAsset=er([e6("TransformPlayableAsset")],t.TransformPlayableAsset);var o8=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.processFrame=function(t){},e}(nB);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createPlayable=function(t){return new o8(t)},e}(nX),t.ActivationPlayableAsset=er([e6("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}eX(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=eH(this.positionCurves);!(r=n()).done;){var o=r.value,a=o.keyFrames.getValue(i),s=this.findTarget(t,o.path);null==s||s.transform.setPosition(a.x,a.y,a.z)}for(var u,c=eH(this.rotationCurves);!(u=c()).done;){var h=u.value,l=h.keyFrames.getValue(i),f=this.findTarget(t,h.path);null==f||f.transform.setQuaternion(l.x,l.y,l.z,l.w)}for(var d,p=eH(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=eH(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:rU(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var o,a=eH(t.rotationCurves);!(o=a()).done;){var s=o.value,u={path:s.path,keyFrames:rU(s.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var c,h=eH(t.scaleCurves);!(c=h()).done;){var l=c.value,f={path:l.path,keyFrames:rU(l.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=eH(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:rU(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=eH(e);!(i=n()).done;){for(var o,a=i.value,s=!1,u=eH(r.children);!(o=u()).done;){var c=o.value;if(c.name===a){r=c,s=!0;break}}if(!s)return}return r},e}(e7),t.AnimationClip=er([e6(tX.AnimationClip)],t.AnimationClip);var o9=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();ee(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(nB),o7=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>.001&&(this.endBehavior===tO.restart?e%=i:this.endBehavior===tO.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}eX(e,t);var i=e.prototype;return i.resolveBinding=function(t){return t},i.createTrackMixer=function(t){return new nB(t)},i.createOutput=function(){return new nG},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=eH(this.clips);!(i=n()).done;){var o=i.value;r.push(o)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),o=eH(e);!(r=o()).done;){var a=r.value,s=this.createClipPlayable(t,a),u=new at(a,s,n,this);i.push(u),n.addInput(s,0),n.setInputWeight(s,0)}return n},i.createPlayable=function(t){return new nB(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t)},i.createClip=function(t,e){var i=new o7;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=eH(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)},e}(nX),er([e9(o7,void 0)],t.TrackAsset.prototype,"clips",void 0),er([e9(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=er([e6("TrackAsset")],t.TrackAsset),t.TrackType=void 0,(to=t.TrackType||(t.TrackType={}))[to.MasterTrack=0]="MasterTrack",to[to.ObjectTrack=1]="ObjectTrack";var at=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,ee(this.track.binding,t.VFXItem)&&(this.particleSystem=this.track.binding.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,o=!1,a=this.track.binding;e>i.start+i.duration+.001&&i.endBehavior===tO.destroy?ee(a,t.VFXItem)&&t.VFXItem.isParticle(a)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,o=!0):e<i.start&&(r=0),o&&this.playable.getPlayState()!==tJ.Playing&&this.playable.play(),this.parentMixer.setInputWeight(this.playable,r),n&&(!ee(a,t.VFXItem)||a.ended||(a.ended=!0,a.onEnd(),a.compositionReusable||a.reusable||(a.dispose(),this.playable.dispose())),this.playable.getPlayState()===tJ.Playing&&this.playable.pause());var s=i.toLocalTime(e);this.playable.setTime(s)},eB(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setInputWeight(this.playable,0),this.playable.pause())}}]),e}();t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.prototype.create=function(e){var i=this.binding;if(i.getComponent(t.ParticleSystem)){var r=e.createTrack(t.TrackAsset,this,"ParticleTrack");r.binding=this.binding;var n=r.createClip(oW);n.start=i.start,n.duration=i.duration,n.endBehavior=i.endBehavior}},i}(t.TrackAsset),t.ObjectBindingTrack=er([e6("ObjectBindingTrack")],t.ObjectBindingTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(t.TrackAsset),t.TransformTrack=er([e6("TransformTrack")],t.TransformTrack);var ae=function(e){function i(){return e.apply(this,arguments)}eX(i,e);var r=i.prototype;return r.processFrame=function(e){var i=e.output.getUserData();if(ee(i,t.VFXItem)){for(var r=!1,n=0;n<this.getInputCount();n++)if(this.getInputWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),this.showRendererComponents(i)):(i.transform.setValid(!1),this.hideRendererComponents(i))}},r.hideRendererComponents=function(t){for(var e,i=eH(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled&&(r.enabled=!1)}},r.showRendererComponents=function(t){for(var e,i=eH(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled||(r.enabled=!0)}},i}(nB);t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createTrackMixer=function(t){return new ae(t)},e}(t.TrackAsset),t.ActivationTrack=er([e6("ActivationTrack")],t.ActivationTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(t.TrackAsset),t.SpriteColorTrack=er([e6("SpriteColorTrack")],t.SpriteColorTrack),t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t}eX(i,e);var r=i.prototype;return r.createPlayable=function(e){var i=new ai(e);i.setTraversalMode(t$.Passthrough);for(var r,n=eH(this.tracks);!(r=n()).done;){var o=r.value;ee(o,t.ObjectBindingTrack)&&o.create(this)}return i.compileTracks(e,this.tracks),i},r.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),r},r.fromData=function(t){},i}(nX),er([e9(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=er([e6("TimelineAsset")],t.TimelineAsset);var ai=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e}eX(e,t);var i=e.prototype;return i.prepareFrame=function(t){this.evaluate()},i.evaluate=function(){for(var t,e=this.getTime(),i=eH(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){this.sortTracks(e);for(var i,r=[],n=eH(e);!(i=n()).done;){var o=i.value;r.push(o),this.addSubTracksRecursive(o,r)}for(var a,s=eH(r);!(a=s()).done;){var u=a.value,c=u.createPlayableGraph(t,this.clips);this.addInput(c,0);var h=u.createOutput();h.setUserData(u.binding),t.addOutput(h),h.setSourcePlayeble(this,this.getInputCount()-1)}},i.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new ar(t[i],i));e.sort(ao),t.length=0;for(var r,n=eH(e);!(r=n()).done;){var o=r.value;t.push(o.track)}},i.addSubTracksRecursive=function(t,e){for(var i,r=eH(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var o,a=eH(t.getChildTracks());!(o=a()).done;){var s=o.value;this.addSubTracksRecursive(s,e)}},e}(nB),ar=function(t,e){this.track=t,this.originalIndex=e};function an(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1}function ao(e,i){var r=e.track.binding,n=i.track.binding;return ee(r,t.VFXItem)&&ee(n,t.VFXItem)?an(r,n)?-1:an(n,r)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}var aa=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.startTime=0,t.items=[],t.reusable=!1,t.sceneBindings=[],t.graph=new nU,t}eX(i,e);var r=i.prototype;return r.start=function(){var t=this.item.props.startTime;this.startTime=void 0===t?0:t,this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tO.destroy&&this.setReusable(!0)},r.setReusable=function(e){for(var r,n=eH(this.timelineAsset.tracks);!(r=n()).done;){var o=r.value,a=o.binding;if(ee(a,t.VFXItem)){ee(o,t.ObjectBindingTrack)&&(a.reusable=e);var s=a.getComponent(i);s&&s.setReusable(e)}}},r.getReusable=function(){return this.reusable},r.update=function(t){var e=this.time;this.timelinePlayable.setTime(e),this.graph.evaluate(t)},r.createContent=function(){for(var e,r=[],n=eH(this.data.sceneBindings);!(e=n()).done;){var o=e.value;r.push({key:this.engine.assetLoader.loadGUID(o.key.id),value:this.engine.assetLoader.loadGUID(o.value.id)})}this.sceneBindings=r;var a=this.data.timelineAsset?this.engine.assetLoader.loadGUID(this.data.timelineAsset.id):new t.TimelineAsset(this.engine);this.timelineAsset=a;var s=this.items;if(this.items.length=0,this.item.composition)for(var u=this.item.engine.assetLoader,c=this.data.items?this.data.items:[],h=0;h<c.length;h++){var l=void 0,f=c[h];if(t.Item.isComposition(f)){var d=f.content.options.refId,p=this.item.composition.refCompositionProps.get(d);if(!p)throw Error("Referenced precomposition with Id: "+d+" does not exist.");p.content=f.content,(l=u.loadGUID(f.id)).composition=this.item.composition;var m=l.addComponent(i);m.data=p,m.refId=d,l.transform.parentTransform=this.transform,this.item.composition.refContent.push(l),l.endBehavior===tO.restart&&(this.item.composition.autoRefTex=!1),m.createContent();for(var v,y=eH(m.items);!(v=y()).done;){var g=v.value;g.setInstanceId(eD());for(var x,T=eH(g.components);!(x=T()).done;)x.value.setInstanceId(eD())}}else(l=u.loadGUID(f.id)).composition=this.item.composition;l.parent=this.item,l.transform.parentTransform=f.type===tx.camera?new n$:this.transform,t.VFXItem.isExtraCamera(l)&&(this.item.composition.extraCamera=l),s.push(l)}},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,o,a){for(var s,u=[],c=(null==a?void 0:a.stop)||eR,h=(null==a?void 0:a.skip)||eR,l=(null==a?void 0:a.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<l;f++){var d=(s=this,function(a){var l=s.items[a];if(l.getVisible()&&l.transform.getValid()&&!l.ended&&!t.VFXItem.isComposition(l)&&!h(l)){var f=l.getHitTestParams(o);if(f){var d=!1,p=new eJ;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,T=f.size,b=x.clone().addScaledVector(T,.5),E=x.clone().addScaledVector(T,-.5);e.intersectBox({min:b,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 S=f.collect(e,new eK(i,r));S&&S.length>0&&(S.forEach(function(t){u.push(t)}),d=!0)}if(d){var A={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",A),n.push(A),c(A))return{v:n}}}}}(f));if("object"===ei(d))return d.v}return n},r.fromData=function(t){},r.resolveBindings=function(){for(var t,e=eH(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.binding=i.value}for(var r,n=eH(this.timelineAsset.tracks);!(r=n()).done;){var o=r.value;this.resolveTrackBindingsWithRoot(o)}},r.resolveTrackBindingsWithRoot=function(t){for(var e,i=eH(t.getChildTracks());!(e=i()).done;){var r=e.value;r.binding=r.resolveBinding(t.binding),this.resolveTrackBindingsWithRoot(r)}},i}(ie);t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.prototype.resolveBinding=function(e){if(!ee(e,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");return e.getComponent(aa)},i}(t.TrackAsset),t.SubCompositionTrack=er([e6("SubCompositionTrack")],t.SubCompositionTrack);var as=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();ee(e,aa)&&(e.time=this.getTime())},e}(nB);function au(t,e){return e&&("object"===ei(e)||"function"==typeof e)?e:nk(t)}t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createPlayable=function(t){return new as(t)},e}(nX),t.SubCompositionPlayableAsset=er([e6("SubCompositionPlayableAsset")],t.SubCompositionPlayableAsset);var ac=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tz.display:r,o=t.textBaseline,a=void 0===o?tk.top:o,s=t.textAlign,u=void 0===s?tU.left:s,c=t.text,h=t.letterSpace,l=void 0===h?0:h,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=c.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=a,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,o=t.fontScale,a=(i-r)/3,s=r+n*o,u=i*(e-1),c=0;switch(this.textBaseline){case tk.top:c=s+a;break;case tk.middle:c=(this.height*o-u+s)/2;break;case tk.bottom:c=this.height*o-u-a}return c},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tU.left:i=t.outlineWidth*t.fontScale;break;case tU.middle:i=(this.width*t.fontScale-e)/2;break;case tU.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),ah=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,o,a,s=t.textColor,u=t.fontSize,c=t.outline,h=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,c&&(this.isOutlined=!0,this.outlineColor=null!=(e=c.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=c.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),h&&(this.hasShadow=!0,this.shadowBlur=null!=(r=h.shadowBlur)?r:2,this.shadowColor=null!=(n=h.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(o=h.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(a=h.shadowOffsetY)?a:0),this.fontStyle!==tG.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},al=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 eS(t),t}if(nQ[nq])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?ec(this.elements,t):t.remove()},t}()),af=["serif","sans-serif","monospace","courier"];t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.lineCount=0,r.canvas=al.getCanvas(),al.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return au(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}eX(e,t);var i=e.prototype;return i.update=function(e){t.prototype.update.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture()},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.SpriteComponent),t.TextComponent=er([e6(tX.TextComponent)],t.TextComponent);var ad=function(){function t(){}var e=t.prototype;return e.updateWithOptions=function(t){this.textStyle=new ah(t),this.textLayout=new ac(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.letterSpace,n=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,o=this.textLayout.width+this.textStyle.fontOffset,a=1,s=0,u=0;u<t.length;u++){var c,h,l=t[u],f=(null!=(h=null==i?void 0:null==(c=i.measureText(l))?void 0:c.width)?h:0)*n;((s+=r)+f>o&&u>0||"\n"===l)&&(a++,s=0),"\n"!==l&&(s+=f)}return a},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&&!eA(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.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,o=(r.width+i.fontOffset)*n,a=r.lineHeight*this.lineCount,s=i.fontSize*n,u=r.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=o,r.autoWidth?(this.canvas.height=a*n,this.item.transform.size.set(1,a/r.height)):this.canvas.height=r.height*n;var c=this.canvas.height;e.clearRect(0,0,o,c),e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,c),e.scale(1,-1)),e.fillRect(0,0,o,c),i.fontDesc=this.getFontDesc(),e.font=i.fontDesc,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 h=[],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>o&&m>0||"\n"===v)&&(h.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)}h.push({y:f,width:l,chars:d,charOffsetX:p}),h.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,o){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[o],t.y),e.fillText(r,n+t.charOffsetX[o],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",i$.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:iC.LINEAR,minFilter:iC.LINEAR,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE})),this.isDirty=!1}},e.getFontDesc=function(){var t=this.textStyle,e=t.fontSize,i=t.fontScale,r=t.fontFamily,n=t.textWeight,o=t.fontStyle,a=""+(e*i).toString()+"px ";return af.includes(r)?a+=r:a+='"'+r+'"',n!==tB.normal&&(a=n+" "+a),o!==tG.normal&&(a=o+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],o=i[1],a=i[2],s=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*o+", "+255*a+", "+s+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,o=e.shadowOffsetY,a=i[0],s=i[1],u=i[2],c=i[3];t&&(t.shadowColor="rgba("+255*a+", "+255*s+", "+255*u+", "+c+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-o)},t}();ek(t.TextComponent,[ad]);var ap=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(ir);t.EffectComponent=function(e){function i(t){var i;return(i=e.call(this,t)||this).worldMatrix=e0.fromIdentity(),i.triangles=[],i.destroyed=!1,i.getHitTestParams=function(t){var e=i.getBoundingBox();if(e)return{type:e.type,triangles:e.area}},i.name="EffectComponent",i._priority=0,i}eX(i,e);var r=i.prototype;return r.start=function(){this.item.getHitTestParams=this.getHitTestParams},r.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.hitTestGeometry!==this.geometry&&(this.triangles=function(t){for(var e,i,r=null!=(e=t.getIndexData())?e:[],n=null!=(i=t.getAttributeData("aPos"))?i:[],o=[],a=0;a<r.length;a+=3){var s=3*r[a],u=3*r[a+1],c=3*r[a+2],h={x:n[s],y:n[s+1],z:n[s+2]},l={x:n[u],y:n[u+1],z:n[u+2]},f={x:n[c],y:n[c+1],z:n[c+2]};o.push({p0:h,p1:l,p2:f})}return o}(this.geometry),this.hitTestGeometry=this.geometry);for(var i,r=[],n=eH(this.triangles);!(i=n()).done;){var o=i.value;r.push({p0:o.p0,p1:o.p1,p2:o.p2})}return r.forEach(function(t){t.p0=e.transformPoint(t.p0,new eJ),t.p1=e.transformPoint(t.p1,new eJ),t.p2=e.transformPoint(t.p2,new eJ)}),{type:t.HitTestType.triangle,area:r}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.material=this.materials[0]},r.toData=function(){this.taggedProperties.id=this.guid},r.dispose=function(t){this.destroyed||(this.destroyed=!0,e.prototype.dispose.call(this))},i}(ii),er([e9(void 0,void 0)],t.EffectComponent.prototype,"geometry",void 0),t.EffectComponent=er([e6(tX.EffectComponent)],t.EffectComponent),t.PostProcessVolume=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.useHDR=!0,e.useBloom=!0,e.threshold=1,e.bloomIntensity=1,e.brightness=1,e.saturation=1,e.contrast=1,e.vignetteIntensity=.2,e.vignetteSmoothness=.4,e.vignetteRoundness=1,e.useToneMapping=!0,e}return eX(e,t),e.prototype.start=function(){var t=this.item.composition;t&&(t.globalVolume=this,t.createRenderFrame())},e}(ie),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"useHDR",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"useBloom",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"threshold",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"bloomIntensity",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"brightness",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"saturation",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"contrast",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteIntensity",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteSmoothness",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteRoundness",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"useToneMapping",void 0),t.PostProcessVolume=er([e6("PostProcessVolume")],t.PostProcessVolume);var am=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),o=1;o<r;o++)n[o-1]=arguments[o];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,o=i.options;r.apply(void 0,[].concat(n)),(null==o?void 0:o.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}))||[]}};t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new n$,r.duration=0,r.start=0,r.endBehavior=tO.forward,r.ended=!1,r.reusable=!1,r.type=tx.base,r.components=[],r.itemBehaviours=[],r.rendererComponents=[],r.visible=!0,r.speed=1,r.listIndex=0,r.eventProcessor=new am,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}eX(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.item=this,e.onAttached(),e},r.getComponent=function(t){for(var e,i,r=eH(this.components);!(i=r()).done;){var n=i.value;if(ee(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=eH(this.components);!(e=r()).done;){var n=e.value;ee(n,t)&&i.push(n)}return i},r.setParent=function(t){t!==this&&(this.parent&&eh(this.parent.children,this),this.parent=t,t&&(i.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition)))},r.onEnd=function(){},r.setColor=function(t,e,i,r){},r.setOpacity=function(t){},r.getVisible=function(){return this.visible},r.setVisible=function(t){this.visible!==t&&(this.visible=!!t)},r.getWorldTransform=function(t){var e=null!=t?t:new n$({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.getNodeTransform=function(t){for(var e=0;e<this.components.length;e++){var i=this.components[1];if(i.getNodeTransform)return i.getNodeTransform(t)}return this.transform},r.translate=function(t,e,i){this.transform.translate(t,e,i)},r.rotate=function(t,e,i){var r=new e1(t,e,i),n=e$.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,o=r.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/a-1)*n,(1-2*e/s)*o,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 eJ;return this.transform.assignWorldTRS(t),t},r.isEnded=function(t){return t-this.duration>.001},r.find=function(t){if(this.name===t)return this;for(var e,i=eH(this.children);!(e=i()).done;){var r=e.value;if(r.name===t)return r}for(var n,o=eH(this.children);!(n=o()).done;){var a=n.value.find(t);if(a)return a}},r.fromData=function(i){e.prototype.fromData.call(this,i);var r=i.id,n=i.name,o=i.delay,a=i.parentId,s=i.endBehavior,u=i.transform,c=i.listIndex,h=i.duration,l=void 0===h?0:h;if(this.props=i,this.type=i.type,this.id=r.toString(),this.name=n,this.start=o||this.start,u&&(u.position=new eJ().copyFrom(u.position),u.quat?u.quat=new e$(u.quat.x,u.quat.y,u.quat.z,u.quat.w):u.rotation=new e1().copyFrom(null!=(f=u.eulerHint)?f:u.rotation),u.scale=new eJ().copyFrom(u.scale),u.size&&(u.size=new eK().copyFrom(u.size)),u.anchor&&(u.anchor=new eK().copyFrom(u.anchor)),this.transform.setTransform(u)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=a,this.duration=l,this.endBehavior=s,i.content||(i.content={options:{}}),l<=0)throw Error("Item duration can't be less than 0, see "+iE["Item duration can't be less than 0"]+".");this.itemBehaviours.length=0,this.rendererComponents.length=0;for(var f,d,p=eH(this.components);!(d=p()).done;){var m=d.value;m.item=this,ee(m,ie)&&this.itemBehaviours.push(m),ee(m,ii)&&this.rendererComponents.push(m),ee(m,t.ParticleSystem)&&(this.components.includes(m.renderer)||this.components.push(m.renderer),this.rendererComponents.push(m.renderer))}this.renderOrder=void 0===c?0:c},r.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=tX.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.taggedProperties.parentId=null==(i=this.parent)?void 0:i.guid),!this.taggedProperties.components){this.taggedProperties.components=[];for(var e,i,r,n=eH(this.components);!(r=n()).done;){var o=r.value;ee(o,t.EffectComponent)&&this.taggedProperties.components.push(o)}}this.taggedProperties.content={}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,o=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(o),s=a.x,u=a.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=eH(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=eH(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&eh(null==(t=this.parent)?void 0:t.children,this)},i.isComposition=function(t){return t.type===tx.composition},i.isSprite=function(t){return t.type===tx.sprite},i.isParticle=function(t){return t.type===tx.particle},i.isNull=function(t){return t.type===tx.null},i.isTree=function(t){return t.type===tx.tree},i.isCamera=function(t){return t.type===tx.camera},i.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},eB(i,[{key:"content",get:function(){return this._content}},{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=eH(this.rendererComponents);!(e=i()).done;)e.value.priority=t}}}]),i}(e7),er([e9(void 0,void 0)],t.VFXItem.prototype,"components",void 0),t.VFXItem=er([e6(tX.VFXItemData)],t.VFXItem),t.Item=void 0,(ta=t.Item||(t.Item={})).is=function(t,e){return t.type===e},ta.isComposition=function(t){return t.type===tx.composition},ta.isParticle=function(t){return t.type===tx.particle},ta.isNull=function(t){return t.type===tx.null};var av={},ay=[],ag={};function ax(t,e,i,r){ag[t]&&eO.error("Duplicate registration for plugin "+t+"."),ag[t]=i,av[t]=e,r&&ec(ay,t)}var aT=function(){function e(t){var e={},i=[],r=function(t){var r=av[t];i.includes(r)||(i.push(r),e[t]=r)};ay.forEach(r),t.forEach(r),this.plugins=Object.keys(e).map(function(t){var e,i=av[t];if(!i)throw Error("The plugin '"+t+"' not found."+((e=ab[t])?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""));var r=new i;return r.name=t,r}).sort(function(t,e){return t.order-e.order})}var i=e.prototype;return i.initializeComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionConstructed(t,e)})},i.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},i.resetComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionReset(t,e)})},i.createPluginItem=function(e,i,r){var n=ag[e];if(!n)throw Error("The plugin '"+e+"' does not have a registered constructor.");var o=new n(r.getEngine(),i,r);if(o.composition=r,!ee(o,t.VFXItem))throw Error("The plugin '"+e+"' invalid constructor type.");return o},i.processRawJSON=function(t,e){var i=this;return et(function(){return en(this,function(r){return[2,i.callStatic("processRawJSON",t,e)]})})()},i.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 et(function(){var e,r,o,a,s,u;return en(this,function(c){for(o=0,e=[],r=n.plugins;o<r.length;o++)t in(a=av[r[o].name])&&e.push(Promise.resolve(null==(u=a[t])?void 0:(s=u).call.apply(s,[].concat([a],i))));return[2,Promise.all(e)]})})()},i.precompile=function(t,e,i){var r=this;return et(function(){return en(this,function(n){return[2,r.callStatic("precompile",t,e,i)]})})()},i.loadResources=function(t,e){var i=this;return et(function(){return en(this,function(r){return[2,i.callStatic("prepareResource",t,e)]})})()},e}(),ab={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",tree:"@galacean/effects-plugin-model",model:"@galacean/effects-plugin-model","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",spine:"@galacean/effects-plugin-spine"},aE=function(){function t(){}return t.collectSerializableObject=function(e,i){if(!i[e.getInstanceId()]){e.toData(),i[e.getInstanceId()]=e;var r=e8(e);if(r)for(var n,o=eH(Object.keys(r));!(n=o()).done;){var a=n.value,s=e.taggedProperties[a];if(void 0===s&&(s=e[a]),e7.is(s))t.collectSerializableObject(s,i);else if(eM(s))for(var u,c=eH(s);!(u=c()).done;){var h=u.value;e7.is(h)&&t.collectSerializableObject(h,i)}else if(eP(s))for(var l,f=eH(Object.keys(s));!(l=f()).done;){var d=s[l.value];e7.is(d)&&t.collectSerializableObject(d,i)}}}},t.serializeEffectObject=function(e){var i={},r=e.engine,n=iM({},r.jsonSceneData);t.collectSerializableObject(e,i);for(var o,a=eH(Object.keys(i));!(o=a()).done;){var s=i[o.value];n[s.getInstanceId()]||(n[s.getInstanceId()]={}),t.serializeTaggedProperties(s,n[s.getInstanceId()])}return n},t.serializeTaggedProperties=function(e,i){e.toData(),i||(i={});var r=e8(e);if(r)for(var n,o=eH(Object.keys(r));!(n=o()).done;){var a=n.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[a]=s:eM(s)?(i[a]||(i[a]=[]),t.serializeArrayProperty(s,i[a],0)):e7.is(s)?i[a]={id:s.getInstanceId()}:eP(s)&&(i[a]||(i[a]={}),t.serializeObjectProperty(s,i[a],0))}for(var u,c=eH(Object.keys(e.taggedProperties));!(u=c()).done;){var h=u.value,l=e.taggedProperties[h];"number"==typeof l||"string"==typeof l||"boolean"==typeof l||t.checkTypedArray(l)?i[h]=l:eM(l)?(i[h]||(i[h]=[]),t.serializeArrayProperty(l,i[h],0)):e7.is(l)?i[h]={id:l.getInstanceId()}:eP(l)&&(i[h]||(i[h]={}),t.serializeObjectProperty(l,i[h],0))}return i},t.deserializeTaggedProperties=function(e,i){for(var r,n=i.taggedProperties,o=e8(i),a=i.engine,s=eH(Object.keys(e));!(r=s()).done;){var u=r.value;if(!o||!o[u]){var c=e[u];n[u]=t.deserializeProperty(c,a,0)}}if(o)for(var h,l=eH(Object.keys(o));!(h=l()).done;){var f=h.value,d=e[f];if(void 0!==d){var p=o[f].type;i[f]=t.deserializeProperty(d,a,0,p)}}i.fromData(n)},t.deserializeTaggedPropertiesAsync=function(e,i){return et(function(){var r,n,o,a,s,u,c,h,l,f,d,p;return en(this,function(m){switch(m.label){case 0:r=i.taggedProperties,n=e8(i),o=i.engine,a=eH(Object.keys(e)),m.label=1;case 1:if((s=a()).done)return[3,4];if(u=s.value,n&&n[u])return[3,3];return c=e[u],[4,t.deserializePropertyAsync(c,o,0)];case 2:r[u]=m.sent(),m.label=3;case 3:return[3,1];case 4:if(!n)return[3,8];h=eH(Object.keys(n)),m.label=5;case 5:if((l=h()).done)return[3,8];if(void 0===(d=e[f=l.value]))return[3,7];return p=n[f].type,[4,t.deserializePropertyAsync(d,o,0,p)];case 6:i[f]=m.sent(),m.label=7;case 7:return[3,5];case 8:return i.fromData(r),[2]}})})()},t.checkTypedArray=function(t){return ee(t,Int8Array)||ee(t,Uint8Array)||ee(t,Uint8ClampedArray)||ee(t,Int16Array)||ee(t,Uint16Array)||ee(t,Int32Array)||ee(t,Uint32Array)||ee(t,Float32Array)||ee(t,Float64Array)||ee(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(eP(t)&&1===Object.keys(t).length&&"id"in t&&eI(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return eP(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return eV(t)||ee(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(eM(e)){for(var o,a=[],s=eH(e);!(o=s()).done;){var u=o.value;a.push(t.deserializeProperty(u,i,r+1,n))}return a}if(t.checkDataPath(e))return i.assetLoader.loadGUID(e.id);if(!eP(e)||e.constructor!==Object)return e;c=n?new n:{};for(var c,h,l=eH(Object.keys(e));!(h=l()).done;){var f=h.value;c[f]=t.deserializeProperty(e[f],i,r+1)}return c},t.deserializePropertyAsync=function(e,i,r,n){return et(function(){var o,a,s,u,c,h,l,f,d;return en(this,function(p){switch(p.label){case 0:if(r>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!eM(e))return[3,5];o=[],a=eH(e),p.label=1;case 1:if((s=a()).done)return[3,4];return u=s.value,c=o.push,[4,t.deserializePropertyAsync(u,i,r+1,n)];case 2:c.apply(o,[p.sent()]),p.label=3;case 3:return[3,1];case 4:return[2,o];case 5:if(!t.checkDataPath(e))return[3,7];return[4,i.assetLoader.loadGUIDAsync(e.id)];case 6:return[2,p.sent()];case 7:if(!(eP(e)&&e.constructor===Object))return[3,12];h=n?new n:{},l=eH(Object.keys(e)),p.label=8;case 8:if((f=l()).done)return[3,11];return d=f.value,[4,t.deserializePropertyAsync(e[d],i,r+1)];case 9:h[d]=p.sent(),p.label=10;case 10:return[3,8];case 11:return[2,h];case 12:return[2,e];case 13:return[2]}})})()},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,o=eH(Object.keys(e));!(n=o()).done;){var a=n.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[a]=s:eM(s)?(i[a]||(i[a]=[]),t.serializeArrayProperty(s,i[a],r+1)):e7.is(s)?i[a]={id:s.getInstanceId()}:eP(s)&&(i[a]||(i[a]={}),t.serializeObjectProperty(s,i[a],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 o=e[n];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[n]=o:eM(o)?(i[n]||(i[n]=[]),t.serializeArrayProperty(o,i[n],r+1)):e7.is(o)?i[n]={id:o.getInstanceId()}:eP(o)&&(i[n]||(i[n]={}),t.serializeObjectProperty(o,i[n],r+1))}},t}(),a_=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){if(this.engine.objectInstance[e])return this.engine.objectInstance[e];var i,r=this.findData(e);if(!r){console.error("Object data with uuid: "+e+" not found.");return}switch(r.dataType){case tX.Material:i=rt.create(this.engine);break;case tX.Geometry:i=r2.create(this.engine);break;case tX.Texture:i=i$.create(this.engine);break;default:var n=t.getClass(r.dataType);n&&(i=new n(this.engine))}if(!i){console.error("Constructor for DataType: "+r.dataType+" not found.");return}return i.setInstanceId(r.id),this.engine.addInstance(i),aE.deserializeTaggedProperties(r,i),i},e.loadGUIDAsync=function(e){var i=this;return et(function(){var r,n,o;return en(this,function(a){switch(a.label){case 0:if(i.engine.objectInstance[e])return[2,i.engine.objectInstance[e]];if(r=i.findData(e))return[3,2];if(!i.engine.database)return console.error("Object data with uuid: "+e+" not found."),[2,void 0];return[4,i.engine.database.loadGUID(e)];case 1:if(!(n=a.sent()))return console.error("Disk data with uuid: "+e+" not found."),[2,void 0];return i.engine.addInstance(n),[2,n];case 2:switch(r.dataType){case tX.Material:n=rt.create(i.engine);break;case tX.Geometry:n=r2.create(i.engine);break;case tX.Texture:n=i$.create(i.engine);break;default:(o=t.getClass(r.dataType))&&(n=new o(i.engine))}if(!n)return console.error("Constructor for DataType: "+r.dataType+" not found."),[2,void 0];return n.setInstanceId(r.id),i.engine.addInstance(n),[4,aE.deserializeTaggedPropertiesAsync(r,n)];case 3:return a.sent(),[2,n]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return e5[t]},t}(),aC=function(){function t(){}return t.prototype.loadGUID=function(t){return et(function(){return en(this,function(t){return[2,void 0]})})()},t}();function aS(t,e){if(!t.includes(e))return t.push(e),!0}function aA(t){if(Number.isFinite(t))return[tA.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tA.CONSTANT)return[tA.CONSTANT,t[1]];if("lines"===e)return[tA.LINE,t[1]];if(e===tA.LINE){var r=i.map(function(t){return[tw.LINE,t]});return[tA.BEZIER_CURVE,r]}return"curve"===e||e===tA.CURVE?[tA.BEZIER_CURVE,aX(i)]:t}}function aw(t,e){return Array.isArray(t)&&"random"===t[0]?[tA.CONSTANT,t[1][e]]:aA(t)}function aO(t){return t&&"color"===t[0]?aM(t[1],!0):[1,1,1,1]}function aR(t){return t&&"random"===t[0]?[tA.RANDOM,t[1]]:aA(t)}function aI(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,o=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,a=aM(t[r],e);i.push([o,a[0],a[1],a[2],a[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tA.GRADIENT_COLOR,i]}}function aM(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 ee(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=aL(i)),i}function aL(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function aP(t,e){return Array.isArray(t)?t[0]===tA.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&aI(t[1],e):aI(t,e)}function aV(t){if(t){if(3===t.length)return[tA.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tA.BEZIER_PATH||e===tA.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],o=i[2],a=aX(r);if(!o){o=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&o.push(u),o.push(u)}}return[tA.BEZIER_CURVE_PATH,[a,n,o]]}return t}}function aF(t){for(var e,i=eH(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function aN(t){for(var e,i=eH(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var aD=Math.cos,az=Math.sin,ak=Math.PI/180,aU=180/Math.PI;function aB(t,e){return t?[t[0]-.5,.5-t[1]]:e?aG[e]:[0,0]}var aG=((t1={})[tb.PARTICLE_ORIGIN_CENTER]=[0,0],t1[tb.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t1[tb.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t1[tb.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t1[tb.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t1[tb.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t1[tb.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t1[tb.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t1[tb.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t1);function aX(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]]],o=0;o<t.length-1;o++){var a=t[o][3]*(e-i),s=t[o+1][2]*(e-i),u=[t[o][0],t[o][1]],c=[t[o+1][0],t[o+1][1]];if(u[0]!=c[0]){var h=function(t,e,i,r){var n=i[0],o=i[1],a=r[0],s=r[1],u=a-n;return[[n+(a-n)/3,o+(t*=u)/3],[a-(a-n)/3,s-(e*=u)/3]]}(a,s,u,c),l=h[0],f=h[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[1]),n.push([f[0],f[1],c[0],c[1]])}else n[n.length-1].push(c[0]),n[n.length-1].push(c[1])}return n.map(function(t,e){return 0===e?[tw.EASE_OUT,t]:e===n.length-1?[tw.EASE_IN,t]:[tw.EASE,t]})}function aj(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tx.null&&t.endBehavior===tO.destroy&&(t.endBehavior=tO.freeze)})}),t.version="2.1",t}function aH(t){for(var e,i=iM({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=eH(i.images);!(e=r()).done;)e.value.id=eD();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=eD(),t.dataType=tX.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:eD(),dataType:tX.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(o=t.bins,i.bins=o.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eD()}}));for(var o,a,s={},u={},c=eH(t.compositions);!(a=c()).done;)!function(){var t=a.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=4),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tx.particle&&t.content.filter&&delete t.content.filter});for(var e,r=eH(t.items);!(e=r()).done;){var n=e.value;s[n.id]=eD(),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],o=e.parentId.split("^")[1];e.parentId=s[n]+"^"+o}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var o=iM({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(o),function(t,e,i){for(var r,n=[],o=[],a=[],s={tracks:[],id:eD(),dataType:"TimelineAsset"},u=eH(t.items);!(r=u()).done;){var c=e[r.value.id],h=[],l={id:eD(),dataType:"ActivationPlayableAsset"};a.push(l);var f={id:eD(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:l.id}}]};if(h.push({id:f.id}),o.push(f),c.type!==tx.particle){var d={id:eD(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};a.push(d);var p={id:eD(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:d.id}}]};h.push({id:p.id}),o.push(p)}if(c.type===tx.sprite){var m={id:eD(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime};a.push(m);var v={id:eD(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:m.id}}]};h.push({id:v.id}),o.push(v)}if(c.type===tx.composition){var y={id:eD(),dataType:"SubCompositionPlayableAsset"};a.push(y);var g={id:eD(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:y.id}}]};h.push({id:g.id}),o.push(g)}var x={id:eD(),dataType:"ObjectBindingTrack",children:h,clips:[]};o.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:c.id}})}for(var T,b=[],E=eH(o);!(T=E()).done;){var _=T.value;b.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var C,S=eH(o);!(C=S()).done;){var A=C.value;i.miscs.push(A)}for(var w,O=eH(a);!(w=O()).done;){var R=w.value;i.miscs.push(R)}}(o,u,i)}();for(var h,l=eH(i.items);!(h=l()).done;){var f=h.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!=(T=f.transform.scale)?T:[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===tx.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tx.sprite){var g,x,T,b,E,_,C,S=f.content;S.renderer||(S.renderer={});var A=S.renderer,w=aB(A.anchor,A.particleOrigin),O=f.transform.size;A.anchor||void 0===A.particleOrigin||(f.transform.position.x+=-w[0]*(null!=(b=null==O?void 0:O.x)?b: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===tx.particle){var R=f.content;R.renderer||(R.renderer={});var I=R.renderer;R.renderer.anchor=aB(I.anchor,I.particleOrigin)}f.type===tx.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),f.content.tracks=[];var M=f.content.tracks;if(f.type!==tx.particle&&M.push({clips:[{id:eD(),dataType:"TransformPlayableAsset",sizeOverLifetime:f.content.sizeOverLifetime,rotationOverLifetime:f.content.rotationOverLifetime,positionOverLifetime:f.content.positionOverLifetime}]}),f.type===tx.sprite&&M.push({clips:[{id:eD(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:f.content.colorOverLifetime,startColor:f.content.options.startColor}]}),void 0!==f.pn){var L=f.pn,P=t.plugins,V=void 0===P?[]:P;void 0!==L&&Number.isInteger(L)&&(f.pluginName=V[L])}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===tx.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===tx.sprite||f.type===tx.particle||f.type===tx.mesh||f.type===tx.skybox||f.type===tx.light||"camera"===f.type||f.type===tx.tree||f.type===tx.interact||f.type===tx.camera||f.type===tx.text||f.type===tx.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eD(),f.content.item={id:f.id},f.dataType=tX.VFXItemData,f.components.push({id:f.content.id})),(f.type===tx.null||f.type===tx.composition)&&(f.components=[],f.dataType=tX.VFXItemData),f.type){case tx.sprite:f.content.dataType=tX.SpriteComponent;break;case tx.particle:f.content.dataType=tX.ParticleSystem;break;case tx.mesh:f.content.dataType=tX.MeshComponent;break;case tx.skybox:f.content.dataType=tX.SkyboxComponent;break;case tx.light:f.content.dataType=tX.LightComponent;break;case"camera":f.content.dataType=tX.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tx.tree:f.content.dataType=tX.TreeComponent;break;case tx.interact:f.content.dataType=tX.InteractComponent;break;case tx.camera:f.content.dataType=tX.CameraController;break;case tx.text:f.content.dataType=tX.TextComponent;break;case tx.spine:f.content.dataType="SpineComponent"}}return i.version="3.0",i}function aW(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},o={path:aV(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:aA(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:aA(n.linearX),linearY:aA(n.linearY),linearZ:aA(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:aA(n.orbitalX),orbitalY:aA(n.orbitalY),orbitalZ:aA(n.orbitalZ),speedOverLifetime:aA(n.speedOverLifetime)};aN(o);var a={options:{startColor:aO(r.startColor)},positionOverLifetime:o};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=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=aA(s.x),u.y=aA(s.y),u.z=aA(s.z)):u.z=aA(s.angularVelocity)}var c=t.colorOverLifetime;if(c){var h=a.colorOverLifetime={opacity:aA(c.opacity)};c.color&&(h.color=aP(c.color))}var l=t.sizeOverLifetime;return l&&(a.sizeOverLifetime={separateAxes:l.separateAxes,size:aA(l.size),x:aA(l.x),y:aA(l.y),z:aA(l.z)}),a}var aY=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,aZ=/^(\d+)\.(\d+)$/,aq=!1;function aQ(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(l=null==(h=(c=t).version)?void 0:h.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||c.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tx.mesh||t.type===tx.light)&&(t.endBehavior=1===t.endBehavior?tO.destroy:t.endBehavior)})}),aY.test(t.version)){var e,i,r,n,o,a,s,u;return aq=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",aH(aj((aK="1.0",n=(e=t).plugins||[],(null==(i=e.bins)?void 0:i.length)&&(aK="1.3"),o=(e.requires||[]).slice(),a=e.images.map(function(t,i){return aJ(t,i,e.imageTags||[])}),s=e.textures||a.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:aK,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return a$(t,{plugins:n,requires:o})}),images:a,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)))}aq=!1;var c,h,l,f,d,p=aZ.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=eH(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=eH(Object.keys(e));!(i=r()).done;){var n=i.value,o=e[n],a=Array.isArray(o);a&&2===o.length&&Array.isArray(o[1])?"path"===n?e[n]=aV(o):e[n]=aA(o):a||"object"!=typeof o||t(o)}})(e.value.content)}),t=d),m<3?aH(aj(t)):t;throw Error("Invalid JSON version: "+t.version+".")}var aK="1.0";function aJ(t,e,i){var r=i[e],n=t.oriY;if("string"==typeof t)return{id:eD(),renderLevel:r,url:t,oriY:n};if(t.template)return{id:eD(),url:t.url,template:t.template,webp:t.webp,renderLevel:r,oriY:n};if(t.compressed)return{id:eD(),url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eD(),url:t.url,webp:t.webp,renderLevel:r,oriY:n};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function a$(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iM({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return a1(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var o=null==(i=t.meta)?void 0:i.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(r.previewSize=o),r}var a0=[0,0,0,1];function a1(t,e){void 0===e&&(e={});var i=tx.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tx.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),h=t.transform||T(l.transform)):t.particle?(i=tx.particle,h=T((l=t.particle).transform,aq,!0),f=function(t){var e=t.options,i=t.transform,r={type:tm.NONE};if(t.shape){var n,o=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iM({},t.shape,{type:tm[o]}),t.shape.upDirection){var a=t.shape.upDirection,s=a[0],u=a[1],c=a[2];0===s&&0===u&&0===c&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=aR(e.turbulenceX),r.turbulenceY=aR(e.turbulenceY),r.turbulenceZ=aR(e.turbulenceZ));var h=t.emission;h.bursts&&h.bursts.length>0&&(h.bursts=h.bursts.map(function(t){return aF(t)})),h.burstOffsets&&h.burstOffsets.length>0&&(h.burstOffsets=h.burstOffsets.map(function(t){return aF(t)})),h.rateOverTime&&(h.rateOverTime=aR(h.rateOverTime));var l={renderer:t.renderer,shape:r,splits:t.splits,emission:h,options:{startLifetime:aR(e.startLifetime),start3DSize:!!e.start3DSize,startSize:aR(e.startSize),startSizeX:aR(e.startSizeX),startSizeY:aR(e.startSizeY),sizeAspect:aR(e.sizeAspect),maxCount:e.maxCount,startDelay:aR(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tA.COLORS,t[1].map(function(t){return aM(t,e)})]:"gradient"===t[0]?aI(t[1],e):"color"===t[0]?[tA.RGBA_COLOR,aM(t[1],e)]:t}(e.startColor,!0),startRotationZ:aR(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=aR(e.startRotationX),l.options.startRotationY=aR(e.startRotationY)),i&&i.path&&(l.emitterTransform={path:aV(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:aR(f.x),y:aR(f.y)}:l.sizeOverLifetime={size:aR(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?aA(p):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:aA(e.gravityModifier),startSpeed:aR(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:aR(d.linearX),linearY:aR(d.linearY),linearZ:aR(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:aR(d.orbitalX),orbitalY:aR(d.orbitalY),orbitalZ:aR(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:aA(d.forceCurve)},aN(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:aR(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=aA(m.y),l.rotationOverLifetime.x=aA(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:aA(v.opacity)};v.color&&(y.color=aP(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:aA(g.cycles),animationDelay:aw(g.animationDelay,0),animationDuration:aw(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:aR(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:aA(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&aP(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&aP(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:aR(x.opacityOverLifetime)}),l.trails&&aN(l.trails);var T=t.interaction;return T&&(l.interaction={behavior:T.behavior,radius:T.radius,multiple:T.multiple}),l}(l)):t.sprite?(i=tx.sprite,h=T((l=t.sprite).transform,!1,!0),s=aW(a=l,h),(u=a.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=a.renderer,a.splits&&(s.splits=a.splits),a.interaction&&(s.interaction=a.interaction),f=s):t.cal?(i=tx.null,h=T((l=t.cal).transform,!1,!0),f=aW(l,h)):t.ui?(i=tx.interact,h=T((l=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:ty.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&aO(i.previewColor),behavior:i.behavior||tg.NOTIFY};break;case"drag":e={type:ty.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:ty.MESSAGE}}return{options:e}}(l),h.scale=[l.options.width||1,l.options.height||1,1]):t.model&&(l=t.model,1===t.model.options.type&&(i=tx.camera,h=T(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,o,a={path:aV(null==(o=t.transform)?void 0:o.path),linearX:aA(null==r?void 0:r.translateX),linearY:aA(null==r?void 0:r.translateY),linearZ:aA(null==r?void 0:r.translateZ)};aN(a),i.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:aA(null==s?void 0:s.rotateX),y:aA(null==s?void 0:s.rotateY),z:s.separateAxes?aA(null==s?void 0:s.rotateZ):aA(s.rotation)};aN(u),i.rotationOverLifetime=u}return i}(l))),null==(c=f.renderer)?void 0:c.anchor){var o=new Float32Array(f.renderer.anchor);.5==o[0]&&.5==o[1]?delete f.renderer.anchor:e.requires&&aS(e.requires,"anchor")}if(l){var a,s,u,c,h,l,f,d,p,m,v,y,g=null==(v=l.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tO.restart:tO.destroy:tO.restart:r||(null==l?void 0:null==(y=l.options)?void 0:y.endBehavior)||tO.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:h,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(aS(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 T(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 o,a,s,u,c,h,l,f,d,p,m,v,y,g,x,T,b,E,_,C,S,A,w,O,R=(o=r.rotation[0],a=r.rotation[1],s=r.rotation[2],u=aD(o*ak/2),c=aD(a*ak/2),h=aD(s*ak/2),l=az(o*ak/2),f=az(a*ak/2),d=az(s*ak/2),a0[0]=l*c*h+u*f*d,a0[1]=u*f*h-l*c*d,a0[2]=u*c*d+l*f*h,a0[3]=u*c*h-l*f*d,a0);r.rotation=(p=[],m=R[0],v=R[1],y=R[2],g=R[3],x=m+m,T=v+v,b=y+y,E=m*x,_=v*x,C=v*T,S=y*b,A=g*b,w=y*x-g*T,p[1]=Math.asin((O=-w)>1?1:O<-1?-1:O)*aU,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*T+g*x,1-E-C)*aU,p[2]=Math.atan2(_+A,1-C-S)*aU):(p[0]=0,p[2]=Math.atan2(-(_-A),1-E-S)*aU),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 a2=((t2={})[tl.S]=[tl.S,tl.BPlus,tl.APlus],t2[tl.A]=[tl.A,tl.BPlus,tl.APlus],t2[tl.B]=[tl.B,tl.BPlus],t2);function a3(t,e){if(!t||!e)return!0;var i=a2[e];return!!i&&i.includes(t)}function a4(t){return eP(t)&&"jsonScene"in t}function a5(t){return eP(t)&&"url"in t}function a6(t){return eP(t)&&"options"in t}function a8(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},o=n.name,a=n.url;return o&&(e&&e[o]?i=e[o]:a&&(i=a)),i}function a9(t,e,i){return a7.apply(this,arguments)}function a7(){return(a7=et(function(t,e,i){var r,n;return en(this,function(o){switch(o.label){case 0:if("string"!=typeof t)return[3,2];return[4,ik(t)];case 1:return r=o.sent(),[3,3];case 2:r=t,o.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=a8(e,i)){if(eI(n)&&n!==r.src)return[2,ik(n)];if(ee(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}var st=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(e7),se=1,si=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new iL),this.options=t,this.downloader=e,this.assets={},this.id=se++,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.updateSceneData=function(t){var e=this.options.variables;e&&0!==Object.keys(e).length&&t.forEach(function(t){if(t.type===tx.text){var i=e[t.name];i&&(t.content.options.text=i)}})},i.loadScene=function(e,i,r){var n=this;return et(function(){var o,a,s,u,c,h,l,f,d,p,m,v,y,g,x;return en(this,function(T){return s=eI(e)?e:n.id,u=performance.now(),c=[],f=null!=(l=null==(h=null==i?void 0:i.engine.gpuCapability)?void 0:null==(o=h.detail)?void 0:o.asyncShaderCompile)&&l,p=null!=(d=null==h?void 0:h.detail.compressedTexture)?d:t.COMPRESSED_TEXTURE.NONE,m={},y=!1,g=new Promise(function(t,e){v=window.setTimeout(function(){y=!0,n.removeTimer(v),e(Error("Load time out: totalTime: "+(performance.now()-u).toFixed(4)+"ms "+c.join(" ")+", url: "+s+"."))},1e3*n.timeout),n.timers.push(v)}),x=et(function(t,e){var i,r,n;return en(this,function(o){switch(o.label){case 0:if(y)return[3,4];i=performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e()];case 2:return r=o.sent(),n=performance.now()-i,c.push("["+t+": "+n.toFixed(2)+"]"),m[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+o.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([g,et(function(){var t,o,h,l,d,y,g,T,b,E,_,C,S,A,w,O,R,I,M,L,P;return en(this,function(V){switch(V.label){case 0:if(!eP(e))return[3,1];return a=e,n.baseUrl=location.href,[3,3];case 1:return e=new URL(e,location.href).href,n.baseUrl=e,[4,x("loadJSON",function(){return n.loadJSON(e)})];case 2:a=V.sent(),V.label=3;case 3:if(!a4(a))return[3,6];if(t=iM({},a),!(n.options&&n.options.variables&&0!==Object.keys(n.options.variables).length))return[3,5];for(l=0,o=a.jsonScene.images,h=t.images;l<o.length;l++)ee(h[l],HTMLCanvasElement)&&(h[l]=o[l]);return[4,x("processImages",function(){return n.processImages(h,p)})];case 4:for(d=0,t.images=V.sent();d<t.images.length;d++)t.textureOptions[d].image=t.images[d];n.updateSceneData(t.jsonScene.items),V.label=5;case 5:return[3,12];case 6:return[4,x("processJSON",function(){return n.processJSON(a)})];case 7:return g=(y=V.sent()).usedImages,T=y.jsonScene,b=y.pluginSystem,_=void 0===(E=T.bins)?[]:E,C=T.images,S=T.compositions,A=T.fonts,[4,Promise.all([x("processBins",function(){return n.processBins(_)}),x("processImages",function(){return n.processImages(C,p)}),x((f?"async":"sync")+"Compile",function(){return n.precompile(S,b,i,r)})])];case 8:if(O=(w=V.sent())[0],R=w[1],i)for(I=0;I<C.length;I++)(M=new st(i.engine)).data=R[I],M.setInstanceId(C[I].id),i.engine.addInstance(M);return[4,x("processFontURL",function(){return n.processFontURL(A)})];case 9:return V.sent(),[4,x("processTextures",function(){return n.processTextures(R,O,T,i.engine)})];case 10:return L=V.sent(),n.updateSceneData(T.items),t={timeInfos:m,url:e,renderLevel:n.options.renderLevel,storage:{},pluginSystem:b,jsonScene:T,usedImages:g,images:R,textureOptions:L,bins:O},[4,x("processPlugins",function(){return b.loadResources(t,n.options)})];case 11:V.sent(),V.label=12;case 12:return P=performance.now()-u,eO.info("Load asset: totalTime: "+P.toFixed(4)+"ms "+c.join(" ")+", url: "+s+"."),window.clearTimeout(v),n.removeTimer(v),t.totalTime=P,t.startTime=u,t.timeInfos=m,[2,t]}})})()])]})})()},i.precompile=function(t,e,i,r){return et(function(){var n;return en(this,function(o){switch(o.label){case 0:if(!i||!i.getShaderLibrary())return[2];return n=null==i?void 0:i.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,i,r)];case 1:return o.sent(),[4,new Promise(function(t){null==n||n.compileAllShaders(function(){t(null)})})];case 2:return o.sent(),[2]}})})()},i.processJSON=function(t){var e=this;return et(function(){var i,r,n,o,a,s,u,c,h;return en(this,function(l){switch(l.label){case 0:return n=void 0===(r=(i=aQ(t)).plugins)?[]:r,o=i.compositions,a=i.imgUsage,s=i.images,[4,(u=new aT(n)).processRawJSON(i,e.options)];case 1:return l.sent(),c=e.options.renderLevel,h={},a?function(t,e,i,r,n){for(var o=0;o<e.length;o++){var a=i[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];a3(r[u].renderLevel,n)&&(t[u]=!0)}}}(h,o,a,s,c):null==s||s.forEach(function(t,e){h[e]=!0}),[2,{usedImages:h,jsonScene:i,pluginSystem:u}]}})})()},i.processBins=function(t){var e=this;return et(function(){var i,r;return en(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(ee(n,ArrayBuffer))return n;if(a3(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 et(function(){return en(this,function(r){return t?[2,Promise.all(t.map(et(function(t){var r,n,o;return en(this,function(a){switch(a.label){case 0:if(!(t.fontURL&&!e.fonts.has(t.fontFamily)))return[3,4];eA(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),r=new URL(t.fontURL,i.baseUrl).href,[4,(o=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return a.sent(),document.fonts.add(o),e.fonts.add(t.fontFamily),[3,4];case 3:return a.sent(),eO.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 et(function(){var n,o,a,s;return en(this,function(u){return o=(n=r.options).useCompressedTexture,a=n.variables,s=r.baseUrl,[2,Promise.all(e.map(et(function(e,n){var u,c,h,l,f,d,p,m,v,y,g,x,T,b,E,_,C,S,A,w;return en(this,function(O){switch(O.label){case 0:if(u=e.url,c=e.webp,h=e.avif,l=new URL(u,s).href,f=c&&new URL(c,s).href,d=h&&new URL(h,s).href,!("template"in e))return[3,8];if(!(m=(p=e.template).background))return[3,7];v=a8(p,a),y=m.type===tS.video,g=m&&y?ij:ik,O.label=1;case 1:return O.trys.push([1,6,,7]),[4,iW(v,g)];case 2:if(!ee(x=O.sent(),HTMLVideoElement))return[3,3];return[2,x];case 3:return m&&Array.isArray(v)&&a&&(a[m.name]=x.src),[4,a9(x,p,a)];case 4:return[2,O.sent()];case 5:return[3,7];case 6:throw T=O.sent(),Error("Failed to load. Check the template or if the URL is "+(y?"video":"image")+" type, URL: "+v+", Error: "+T.message+".");case 7:return[3,9];case 8:if("compressed"in e&&o&&i){if(b=e.compressed,i===t.COMPRESSED_TEXTURE.ASTC?E=b.astc:i===t.COMPRESSED_TEXTURE.PVRTC&&(E=b.pvrtc),E)return _=new URL(E,s).href,r.assets[n]={url:_,type:t.TextureSourceType.compressed},[2,r.loadBins(_)]}else if("sourceType"in e)return[2,e];else if(ee(e,HTMLImageElement)||ee(e,HTMLCanvasElement)||ee(e,HTMLVideoElement)||ee(e,i$))return[2,e];O.label=9;case 9:if(!d)return[3,11];return[4,iD(l,d)];case 10:return w=O.sent(),[3,13];case 11:return[4,iF(l,f)];case 12:w=O.sent(),O.label=13;case 13:return S=(C=w).url,A=C.image,r.assets[n]={url:S,type:t.TextureSourceType.image},[2,A]}})})))]})})()},i.processTextures=function(e,i,r,n){var o=this;return et(function(){var a;return en(this,function(s){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(et(function(e,a){var s,u,c;return en(this,function(h){switch(h.label){case 0:if(ee(e,i$))return[2,e];if(!("mipmaps"in e))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,iZ(e,i,n,r.bins)];case 2:return[2,h.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+h.sent()+".");case 4:if(!eP(s=e.source))return[3,5];return u=n.assetLoader.loadGUID(s.id).data,[3,7];case 5:if("string"!=typeof s)return[3,7];return[4,ik(ez(s))];case 6:u=h.sent(),h.label=7;case 7:if(u)return(c=function(e,i){if(ee(e,i$))return e.source;if(ee(e,HTMLImageElement)||eV(e))return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:iC.LINEAR,magFilter:iC.LINEAR};if(ee(e,HTMLVideoElement))return{sourceType:t.TextureSourceType.video,video:e,minFilter:iC.LINEAR,magFilter:iC.LINEAR};if(ee(e,ArrayBuffer))return iM({},i5(e),{sourceFrom:i});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE,minFilter:iC.NEAREST,magFilter:iC.NEAREST};throw Error("Invalid texture options.")}(u,o.assets[a])).id=e.id,c.dataType=tX.Texture,[2,c.sourceType===t.TextureSourceType.compressed?c:iM({},c,e)];throw Error("Invalid texture source: "+s+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return et(function(){return en(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 et(function(){return en(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.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){for(var t in this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets){var e,i=this.assets[t];null==i||null==(e=i.dispose)||e.call(i)}this.assets={},this.timers=[]},e}();si.fonts=new Set;var sr=new eJ(1,1,1),sn=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewportMatrix=e0.fromIdentity(),this.viewMatrix=e0.fromIdentity(),this.projectionMatrix=e0.fromIdentity(),this.viewProjectionMatrix=e0.fromIdentity(),this.inverseViewMatrix=e0.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,o=e.aspect,a=e.clipMode,s=void 0===a?tC.portrait:a,u=e.position,c=e.rotation;this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===o?1:o,clipMode:s,position:eJ.fromArray(void 0===u?[0,0,8]:u),rotation:e1.fromArray(void 0===c?[0,0,0]:c)},this.dirty=!0,this.updateMatrix()}var e=t.prototype;return 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 eJ(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 o=i.projectPoint(e).z,a=r.projectPoint(new eJ(1,1,o)),s=a.x,u=a.y,c=r.projectPoint(new eJ(-1,-1,o));return new eJ((s-c.x)/2,(u-c.y)/2,0)},e.setQuat=function(t){void 0===this.options.quat?(this.options.quat=t.clone(),this.dirty=!0):this.options.quat.equals(t)||(this.options.quat.copyFrom(t),this.dirty=!0),this.dirty&&this.setRotationByQuat(t)},e.getQuat=function(){var t=this.options.quat;if(void 0===t){t=new e$;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},e.getOptions=function(){return this.options},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,o=t.aspect,a=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=o,this.position=a,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,i=t.aspect,r=t.near,n=t.far,o=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*eW,i,r,n,o===tC.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(a,this.getQuat(),sr),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){n$.getRotation(t,this.options.rotation)},eB(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.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)}},{key:"rotation",get:function(){return this.options.rotation.clone()},set:function(t){this.options.rotation.equals(t)||(this.options.rotation.copyFrom(t),this.dirty=!0,this.options.quat=void 0)}}]),t}(),so=0,sa=function(){function t(t,e){this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var i=t.jsonScene,r=t.renderLevel,n=t.textureOptions,o=t.pluginSystem,a=t.totalTime,s=i.compositions,u=i.imgUsage,c=i.compositionId;if(!n)throw Error("scene.textures expected.");for(var h,l=eH(s);!(h=l()).done;){var f=h.value;f.id===c?this.composition=f:this.refCompositions.set(f.id,f)}if(!this.composition)throw Error("Invalid composition id: "+c+".");this.jsonScene=i,this.renderLevel=r,this.pluginSystem=o,this.totalTime=null!=a?a:0,this.imgUsage=null!=u?u:{},this.textures=n,so=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=t.id,i=t.duration,r=t.name,n=t.endBehavior,o=t.camera,a=t.startTime,s=this.assembleItems(t);return iM({},t,{id:e,duration:i,name:r,endBehavior:isNaN(n)?tO.freeze:n,items:s,camera:o,startTime:void 0===a?0:a})},e.assembleItems=function(t){var e=[];this.mask++;for(var i,r={},n=eH(this.jsonScene.components);!(i=n()).done;){var o=i.value;r[o.id]=o}for(var a,s=eH(t.items);!(a=s()).done;){var u=a.value,c=this.engine.jsonSceneData[u.id];if(a3(c.renderLevel,this.renderLevel)){if(c.listIndex=so++,c.type===tx.sprite||c.type===tx.particle)for(var h,l=eH(c.components);!(h=l()).done;){var f=r[h.value.id];this.preProcessItemContent(f)}if(c.type===tx.composition){var d=c.content.options.refId;if(!this.refCompositions.get(d))throw Error("Invalid ref composition id: "+d+".");var p=this.getContent(this.refCompositions.get(d));this.refCompositionProps.has(d)||this.refCompositionProps.set(d,p)}e.push(c)}}return e},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var e,i=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=o_(null==(e=this.jsonScene)?void 0:e.shapes[t.renderer.shape],i):t.renderer.shape&&eP(t.renderer.shape)&&(t.renderer.shape=o_(t.renderer.shape,i))}t.trails&&(t.trails=this.changeTex(t.trails))},e.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},e.addTextureUsage=function(t){var e,i=null!=(e=this.imgUsage)?e:{};t&&i&&(i.hasOwnProperty(t)||(i[t]=0),i[t]++)},e.processMask=function(t){var e=t.maskMode;e!==tp.NONE&&(t.mask||(e===tp.MASK?t.mask=++this.mask:e!==tp.OBSCURED&&e!==tp.REVERSE_OBSCURED||(t.mask=this.mask)))},e.dispose=function(){this.textures=[],this.composition=void 0,this.jsonScene=void 0,this.totalTime=0,this.pluginSystem=void 0,this.sourceContent=void 0,this.refCompositions.clear(),this.refCompositionProps.clear()},t}(),ss=function(e){function i(i,r){(n=e.call(this)||this).speed=1,n.loaderData={},n.refContent=[],n.refCompositionProps=new Map,n.assigned=!1,n.destroyed=!1,n.postLoaders=[],n.paused=!1,n.lastVideoUpdateTime=0;var n,o,a,s=i.reusable,u=void 0!==s&&s,c=i.speed,h=i.baseRenderOrder,l=i.renderer,f=i.event,d=i.width,p=i.height,m=i.handleItemMessage;n.compositionSourceManager=new sa(r,l.engine),r.jsonScene.imgUsage=void 0,u&&(n.keepResource=!0,r.textures=void 0,r.consumed=!0);var v=n.compositionSourceManager,y=v.sourceContent,g=v.pluginSystem,x=v.imgUsage,T=v.totalTime,b=v.refCompositionProps;eS(y),n.renderer=l,n.refCompositionProps=b,n.rootItem=new t.VFXItem(n.getEngine(),y),n.rootItem.name="rootItem",n.rootItem.composition=nk(n),n.rootComposition=n.rootItem.addComponent(aa),n.rootComposition.startTime=y.startTime,n.rootComposition.data=y;var E=!u&&x;return n.width=d,n.height=p,n.renderOrder=void 0===h?0:h,n.id=y.id,n.renderer=l,n.texInfo=null!=E?E:{},n.event=f,n.statistic={loadTime:null!=T?T:0,loadStart:null!=(o=r.startTime)?o:0,firstFrameTime:0,precompileTime:null!=(a=r.timeInfos.asyncCompile)?a:r.timeInfos.syncCompile},n.reusable=u,n.speed=void 0===c?1:c,n.autoRefTex=!n.keepResource&&E&&n.rootItem.endBehavior!==tO.restart,n.name=y.name,n.pluginSystem=g,n.pluginSystem.initializeComposition(nk(n),r),n.camera=new sn(n.name,iM({},null==y?void 0:y.camera,{aspect:d/p})),n.url=r.url,n.assigned=!0,n.globalTime=0,n.interactive=!0,n.handleItemMessage=m,n.createRenderFrame(),n.rendererOptions=null,n.rootComposition.createContent(),n.buildItemTree(n.rootItem),n.callAwake(n.rootItem),n.rootItem.onEnd=function(){window.setTimeout(function(){n.emit("end",{composition:nk(n)})},0)},n.pluginSystem.resetComposition(nk(n),n.renderFrame),n}eX(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.items.forEach(function(e){e.setVisible(t)})},r.getSpeed=function(){return this.speed},r.play=function(){this.rootItem.ended&&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 nx({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},r.setTime=function(t){var e=this.paused;e&&this.resume(),this.rootComposition.isStartCalled||(this.rootComposition.start(),this.rootComposition.isStartCalled=!0),this.forwardTime(t+this.startTime),e&&this.pause()},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.globalTime=0,this.rootItem.ended=!1,this.pluginSystem.resetComposition(this,this.renderFrame)},r.prepareRender=function(){var t=this,e=this.renderFrame;e._renderPasses[0].meshes.length=0,this.postLoaders.length=0,this.pluginSystem.plugins.forEach(function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.gatherRendererComponent(this.rootItem,e),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},r.gatherRendererComponent=function(t,e){for(var i,r=eH(t.rendererComponents);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(n)}for(var o,a=eH(t.children);!(o=a()).done;){var s=o.value;this.gatherRendererComponent(s,e)}},r.update=function(t){if(this.assigned&&!this.paused){var e=this.getUpdateTime(t*this.speed);this.globalTime+=e,this.updateRootComposition(),this.updateVideo(),this.updatePluginLoaders(t),this.callStart(this.rootItem),this.callUpdate(this.rootItem,e),this.callLateUpdate(this.rootItem,e),this.updateCamera(),this.prepareRender(),this.shouldDispose()&&this.dispose()}},r.toLocalTime=function(t){var e=t-this.rootItem.start,i=this.rootItem.duration;if(e-i>.001)switch(this.rootItem.ended||(this.rootItem.ended=!0,this.emit("end",{composition:this})),this.rootItem.endBehavior){case tO.restart:e%=i,this.restart();break;case tO.freeze:e=Math.min(i,e);case tO.forward:case tO.destroy:}return e},r.shouldDispose=function(){return this.rootItem.ended&&this.rootItem.endBehavior===tO.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=eH(t.itemBehaviours);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.awake(),r.isAwakeCalled=!0)}for(var n,o=eH(t.children);!(n=o()).done;){var a=n.value;this.callAwake(a)}},r.callStart=function(t){for(var e,i=eH(t.itemBehaviours);!(e=i()).done;){var r=e.value;r.isActiveAndEnabled&&!r.isStartCalled&&(r.start(),r.isStartCalled=!0)}for(var n,o=eH(t.rendererComponents);!(n=o()).done;){var a=n.value;a.isActiveAndEnabled&&!a.isStartCalled&&(a.start(),a.isStartCalled=!0)}for(var s,u=eH(t.children);!(s=u()).done;){var c=s.value;this.callStart(c)}},r.callUpdate=function(e,i){for(var r,n=eH(e.itemBehaviours);!(r=n()).done;){var o=r.value;o.isActiveAndEnabled&&o.isStartCalled&&o.update(i)}for(var a,s=eH(e.rendererComponents);!(a=s()).done;){var u=a.value;u.isActiveAndEnabled&&u.isStartCalled&&u.update(i)}for(var c,h=eH(e.children);!(c=h()).done;){var l=c.value;t.VFXItem.isComposition(l)&&l.ended&&l.endBehavior===tO.restart?(l.ended=!1,this.callUpdate(l,0)):this.callUpdate(l,i)}},r.callLateUpdate=function(t,e){for(var i,r=eH(t.itemBehaviours);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&n.isStartCalled&&n.lateUpdate(e)}for(var o,a=eH(t.rendererComponents);!(o=a()).done;){var s=o.value;s.isActiveAndEnabled&&s.isStartCalled&&s.lateUpdate(e)}for(var u,c=eH(t.children);!(u=c()).done;){var h=u.value;this.callLateUpdate(h,e)}},r.buildItemTree=function(e){if(e.composition){for(var i,r=new Map,n=e.getComponent(aa).items,o=eH(n);!(i=o()).done;){var a=i.value;r.set(a.id,a)}for(var s,u=eH(n);!(s=u()).done;){var c=s.value;if(void 0===c.parentId)c.setParent(e);else{var h=this.getParentIdWithoutSuffix(c.parentId),l=r.get(h);if(l)t.VFXItem.isTree(l)&&c.parentId.includes("^")?(c.parent=l,c.transform.parentTransform=l.getNodeTransform(c.parentId)):(c.parent=l,c.transform.parentTransform=l.transform),l.children.push(c);else throw Error("The element references a non-existent element, please check the data.")}}for(var f,d=eH(n);!(f=d()).done;){var p=f.value;t.VFXItem.isComposition(p)&&this.buildItemTree(p)}}},r.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},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(){if(this.rootComposition.isActiveAndEnabled){var t=this.toLocalTime(this.globalTime/1e3);this.rootComposition.time=t}},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 rh((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(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n,o=[],a=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(aa))||n.hitTest(a,t,e,o,i,r),this.refContent.forEach(function(n){var s;null==(s=n.getComponent(aa))||s.hitTest(a,t,e,o,i,r)}),o},r.addInteractiveItem=function(t,e){if(e===ty.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===ty.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.destroyTextures=function(e){for(var i=0;i<e.length;i++){var r,n=e[i];if(n){if(n.sourceType===t.TextureSourceType.data&&!this.texInfo[n.getInstanceId()]){n!==(null==(r=this.rendererOptions)?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n!==this.getEngine().emptyTexture&&n.dispose();continue}!this.autoRefTex||--this.texInfo[n.getInstanceId()]||n.dispose()}}},r.destroyItem=function(t){var e=this;t.type==tx.composition?t.endBehavior!==tO.freeze&&t.getComponent(aa).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)})}):(eh(this.items,t),this.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)}))},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={},o=this.textures;o&&this.keepResource&&o.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=eR)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){eO.error("Update disposed composition: "+r.name+".")},this.dispose=eR,o&&this.keepResource&&o.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==ib&&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 et(function(){return en(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]}})})()},eB(i,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this.compositionSourceManager.textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){var t;return null!=(t=this.rootComposition.startTime)?t:0}},{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}(am),su=new Int32Array(2),sc=new Float32Array(su.buffer),sh=new Float64Array(su.buffer),sl=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(ts=t3||(t3={}))[ts.UTF8_BYTES=1]="UTF8_BYTES",ts[ts.UTF16_STRING=2]="UTF16_STRING";var sf=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 su[0]=this.readInt32(t),sc[0]},e.readFloat64=function(t){return su[sl?0:1]=this.readInt32(t),su[sl?1:0]=this.readInt32(t+4),sh[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){sc[0]=e,this.writeInt32(t,su[0])},e.writeFloat64=function(t,e){sh[0]=e,this.writeInt32(t,su[sl?0:1]),this.writeInt32(t+4,su[sl?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===t3.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}(),sd=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=sf.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,o=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(a)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(o+s)!=this.bb.readInt16(a+s))continue t;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:(ee(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=sf.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),sp=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 sm(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}(),sm=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=sp.createDataVector(t,this.data);return sp.createFBEffectsObjectData(t,e,i)},t}(),sv=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 sp).__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 sy(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}(),sy=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=sv.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return sv.createFBEffectsPackageData(t,e)},t}(),sg=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 sx(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}(),sx=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 sg.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),sT=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 sb(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,o,a){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,o),t.addNormalize(e,a),t.endFBVertexChannel(e)},t}(),sb=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 sT.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),sE=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 sT).__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 s_(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}(),s_=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=sE.createChannelsVector(t,t.createObjectOffsetList(this.channels));return sE.createFBVertexData(t,this.vertexCount,e)},t}(),sC=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 sE).__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 sg).__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 sS(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}(),sS=function(){function t(t,e,i,r,n,o,a,s,u,c,h,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===o&&(o=[]),void 0===a&&(a=0),void 0===s&&(s=null),void 0===u&&(u=[]),void 0===c&&(c=[]),void 0===h&&(h=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=o,this.mode=a,this.buffer=s,this.binaryData=u,this.boneNames=c,this.rootBoneName=h,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=sC.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),o=null!==this.buffer?t.createString(this.buffer):0,a=sC.createBinaryDataVector(t,this.binaryData),s=sC.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,c=sC.createInverseBindMatricesVector(t,this.inverseBindMatrices);return sC.startFBGeometryData(t),sC.addId(t,e),sC.addName(t,i),sC.addVertexData(t,r),sC.addIndexFormat(t,this.indexFormat),sC.addIndexOffset(t,this.indexOffset),sC.addSubMeshes(t,n),sC.addMode(t,this.mode),sC.addBuffer(t,o),sC.addBinaryData(t,a),sC.addBoneNames(t,s),sC.addRootBoneName(t,u),sC.addInverseBindMatrices(t,c),sC.endFBGeometryData(t)},t}(),sA=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 sd(1),i=new sy,r=[],n=eH(this.exportObjectDatas);!(t=n()).done;){var o=t.value,a=void 0;o.dataType===tX.Geometry&&(a=new sm("Geometry",this.geometryDataToBinary(o))),a&&r.push(a)}return i.exportObjects=r,sv.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new sf(t),i=sv.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var o=n.dataArray(),a=n.dataType();if(o){var s=void 0;a===tX.Geometry&&(s=this.binaryToGeometryData(o)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new sd(1),i=new sS,r=t.indexFormat,n=t.indexOffset,o=t.mode,a=t.id,s=t.vertexData,u=t.boneNames,c=t.rootBoneName,h=t.inverseBindMatrices,l=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=o,i.id=a,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===c?"":c,i.inverseBindMatrices=void 0===h?[]:h,i.binaryData=void 0===l?[]:l;var f=new s_;f.vertexCount=s.vertexCount,f.channels=[];for(var d,p=eH(s.channels);!(d=p()).done;){var m=d.value,v=new sb(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=eH(t.subMeshes);!(y=x()).done;){var T=y.value,b=new sx(T.offset,T.indexCount,T.vertexCount);g.push(b)}return i.subMeshes=g,sv.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,o=new sf(t),a=sC.getRootAsFBGeometryData(o),s={vertexCount:0,channels:[]},u=a.vertexData();if(u){s.vertexCount=u.vertexCount();for(var c=0;c<u.channelsLength();c++){var h,l=u.channels(c);if(l){var f={semantic:null!=(h=l.semantic())?h:"",offset:l.offset(),format:l.format(),dimension:l.dimension(),normalize:l.normalize()};s.channels.push(f)}}}for(var d=[],p=0;p<a.subMeshesLength();p++){var m=a.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<a.boneNamesLength();g++){var x=a.boneNames(g);y.push(x)}var T=a.inverseBindMatricesArray();return{vertexData:s,indexFormat:a.indexFormat(),indexOffset:a.indexOffset(),subMeshes:d,mode:a.mode(),buffer:null!=(e=a.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=a.rootBoneName())?i:"",inverseBindMatrices:T?Array.from(T):void 0,binaryData:null!=(r=a.binaryDataArray())?r:void 0,id:null!=(n=a.id())?n:"",dataType:tX.Geometry}},t}(),sw=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 a_(this),this.emptyTexture=i2(this),this.transparentTexture=i3(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.getInstance=function(t){return this.objectInstance[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,o=i.materials,a=i.shaders,s=i.geometries,u=i.components,c=i.animations,h=i.bins,l=void 0===h?[]:h,f=i.miscs,d=eH(void 0===n?[]:n);!(e=d()).done;){var p=e.value;this.addEffectsObjectData(p)}for(var m,v=eH(void 0===o?[]:o);!(m=v()).done;){var y=m.value;this.addEffectsObjectData(y)}for(var g,x=eH(void 0===a?[]:a);!(g=x()).done;){var T=g.value;this.addEffectsObjectData(T)}for(var b,E=eH(void 0===s?[]:s);!(b=E()).done;){var _=b.value;this.addEffectsObjectData(_)}for(var C,S=eH(void 0===u?[]:u);!(C=S()).done;){var A=C.value;this.addEffectsObjectData(A)}for(var w,O=eH(void 0===c?[]:c);!(w=O()).done;){var R=w.value;this.addEffectsObjectData(R)}for(var I,M=eH(void 0===f?[]:f);!(I=M()).done;){var L=I.value;this.addEffectsObjectData(L)}for(var P=0;P<l.length;P++){var V=l[P],F=t.bins[P];if(V.dataType===tX.BinaryAsset)V.buffer=F,V.id&&this.addEffectsObjectData(V);else{var N=new sA;N.deserializeFromBinary(new Uint8Array(F));for(var D,z=eH(N.exportObjectDatas);!(D=z()).done;){var k=D.value;this.addEffectsObjectData(k)}}}for(var U,B=eH(void 0===r?[]:r);!(U=B()).done;){var G=U.value;this.addEffectsObjectData(G)}},e.createVFXItems=function(t){var e=this;return et(function(){var i,r,n,o;return en(this,function(a){switch(a.label){case 0:i=eH(t.jsonScene.items),a.label=1;case 1:if((r=i()).done)return[3,4];if(!("ECS"===(o=(n=r.value).type)||"camera"===o||o===tx.sprite||o===tx.particle||o===tx.mesh||o===tx.skybox||o===tx.light||o===tx.tree||o===tx.interact||o===tx.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:a.sent(),a.label=3;case 3:return[3,1];case 4:return[2]}})})()},e.addTexture=function(t){this.destroyed||ec(this.textures,t)},e.removeTexture=function(t){this.destroyed||eh(this.textures,t)},e.addMaterial=function(t){this.destroyed||ec(this.materials,t)},e.removeMaterial=function(t){this.destroyed||eh(this.materials,t)},e.addGeometry=function(t){this.destroyed||ec(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||eh(this.geometries,t)},e.addMesh=function(t){this.destroyed||ec(this.meshes,t)},e.removeMesh=function(t){this.destroyed||eh(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||ec(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||eh(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&&eO.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}},eB(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),sO=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=eQ(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)},eB(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.fromData=function(t){},e}(e7),er([e9(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=er([e6("BinaryAsset")],t.BinaryAsset),ax("camera",io,t.VFXItem,!0),ax("text",ap,t.VFXItem,!0),ax("sprite",nz,t.VFXItem,!0),ax("particle",o$,t.VFXItem,!0),ax("cal",o0,t.VFXItem,!0),ax("interact",id,t.VFXItem,!0),eO.info("Core version: 2.0.0-beta.2.");var sR=((t4={})[iC.ONE]=t9.OneFactor,t4[iC.ZERO]=t9.ZeroFactor,t4[iC.SRC_COLOR]=t9.SrcColorFactor,t4[iC.SRC_ALPHA]=t9.SrcAlphaFactor,t4[iC.ONE_MINUS_SRC_COLOR]=t9.OneMinusSrcColorFactor,t4[iC.ONE_MINUS_SRC_ALPHA]=t9.OneMinusSrcAlphaFactor,t4[iC.DST_COLOR]=t9.DstColorFactor,t4[iC.DST_ALPHA]=t9.DstAlphaFactor,t4[iC.ONE_MINUS_DST_COLOR]=t9.OneMinusDstColorFactor,t4[iC.ONE_MINUS_DST_ALPHA]=t9.OneMinusDstAlphaFactor,t4),sI=((t5={})[iC.NEVER]=t9.NeverStencilFunc,t5[iC.EQUAL]=t9.EqualStencilFunc,t5[iC.LESS]=t9.LessStencilFunc,t5[iC.LEQUAL]=t9.LessEqualStencilFunc,t5[iC.ALWAYS]=t9.AlwaysStencilFunc,t5[iC.NOTEQUAL]=t9.NotEqualStencilFunc,t5[iC.GREATER]=t9.GreaterStencilFunc,t5[iC.GEQUAL]=t9.GreaterEqualStencilFunc,t5),sM=((t6={})[iC.KEEP]=t9.KeepStencilOp,t6[iC.ZERO]=t9.ZeroStencilOp,t6[iC.REPLACE]=t9.ReplaceStencilOp,t6[iC.INCR]=t9.IncrementStencilOp,t6[iC.DECR]=t9.DecrementStencilOp,t6[iC.INCR_WRAP]=t9.IncrementWrapStencilOp,t6[iC.DECR_WRAP]=t9.IncrementWrapStencilOp,t6[iC.INVERT]=t9.InvertStencilOp,t6),sL=((t8={})[iC.NEVER]=t9.NeverDepth,t8[iC.ALWAYS]=t9.AlwaysDepth,t8[iC.EQUAL]=t9.EqualDepth,t8[iC.LESS]=t9.LessDepth,t8[iC.LEQUAL]=t9.LessEqualDepth,t8[iC.GREATER]=t9.GreaterDepth,t8[iC.GEQUAL]=t9.GreaterEqualDepth,t8[iC.NOTEQUAL]=t9.NotEqualDepth,t8),sP=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],sV=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new t9.RawShaderMaterial,n.uniforms={};var n,o,a,s,u,c=null==r?void 0:r.shader,h=i.gpuCapability.level;n.shader=new t.Shader(i),n.shader.shaderData=iM({},c,{id:eD(),dataType:tX.Shader,vertex:null!=(o=null==c?void 0:c.vertex)?o:"",fragment:null!=(a=null==c?void 0:c.fragment)?a:""});for(var l=0;l<t.maxSpriteMeshItemCount;l++)n.uniforms["uSampler"+l]=new t9.Uniform(null);return n.uniforms.uEditorTransform=new t9.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new t9.Uniform(new t9.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new t9.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new t9.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new t9.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new t9.RawShaderMaterial({vertexShader:nf.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:null!=(s=null==c?void 0:c.vertex)?s:"",macros:null==c?void 0:c.macros,removeVersion:!0}),fragmentShader:nf.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:null!=(u=null==c?void 0:c.fragment)?u:"",macros:null==c?void 0:c.macros,removeVersion:!0}),alphaToCoverage:!1,depthFunc:t9.LessDepth,polygonOffsetFactor:t9.ZeroFactor,polygonOffsetUnits:t9.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===h?n.material.glslVersion=t9.GLSL1:n.material.glslVersion=t9.GLSL3,n}eX(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;sP.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new t9.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var o=new t9.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",o)}else{var a=r.camera;this.setMatrix("effects_MatrixVP",a.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",a.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=eH(e);!(i=n()).done;){var o=i.value;r=r.concat(o.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.uniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=eH(e);!(i=n()).done;){var o=i.value;r=r.concat(o.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){return this.uniforms[t].value},r.setColor=function(t,e){this.setUniform(t,e)},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 t9.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=i},r.enableMacro=function(t){throw Error("Method not implemented.")},r.disableMacro=function(t){throw Error("Method not implemented.")},r.isMacroEnabled=function(t){throw Error("Method not implemented.")},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)},eB(i,[{key:"blending",get:function(){return this.material.blending!==t9.NoBlending},set:function(t){this.material.blending=t?t9.CustomBlending:t9.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=sR[e],this.material.blendDst=sR[i],this.material.blendSrcAlpha=sR[r],this.material.blendDstAlpha=sR[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=sL[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=sI[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=sM[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=sM[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=sM[t[0]])}},{key:"culling",get:function(){return this.material.side!==t9.DoubleSide},set:function(t){this.material.side=t?t9.FrontSide:t9.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===td.FRONT?this.material.side=t9.FrontSide:t===td.BACK&&(this.material.side=t9.BackSide)}}]),i}(rt),sF=1,sN=function(t){function e(e,i){if((r=t.call(this,e)||this).attributes={},r.destroyed=!1,r.attributesName=[],!i)return au(r);var r,n=i.drawStart,o=i.drawCount,a=i.indices,s=i.mode,u=i.name,c=void 0===u?"effectsGeometry:"+sF++:u;r.name=c,r.mode=null!=s?s:iC.TRIANGLES;var h=[],l={},f=new t9.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 o=e.size,a=e.offset,s=e.normalize,u=l[n],c=u.buffer,d=u.dataLength,p=new t9.InterleavedBufferAttribute(c,o,(null!=a?a:0)/d,s);f.setAttribute(t,p),l[t]={buffer:c,attribute:p,type:u.type,dataLength:d}}}else r.setAttributeType(t,e,f,l,i.maxVertex);h.push(t)}),a&&a.data&&f.setIndex(new t9.BufferAttribute(a.data,1)),r.geometry=f,r.attributes=l,r.attributesName=h,r.drawStart=void 0===n?0:n,r.drawCount=null!=o?o:0,r}eX(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 t9.InterleavedBuffer(e,i.stride);i=this.attributes[t].attribute.data=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*r1[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 t9.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 o=e.stride,a=e.size,s=e.offset,u=e.normalize,c=e.type,h=void 0===c?iC.FLOAT:c,l=e.data;if(h&&!l&&(l=r3(h)),l){var f=ee(l,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,d=(void 0===o?0:o)/f,p=(n=(null!=n?n:0)*d)||a*f;p&&0===l.length&&(l=ee(l,Float32Array)?new Float32Array(p):new Uint16Array(p));var m=new t9.InterleavedBuffer(l,d),v=new t9.InterleavedBufferAttribute(m,a,(null!=s?s:0)/f,u);i.setAttribute(t,v),r[t]={buffer:m,attribute:v,type:h,dataLength:f}}},eB(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}(r2),sD=function(e){function i(t,i){if(!i)return au(r);var r,n=i.material,o=i.geometry,a=i.priority;return(r=e.call(this,t,i)||this).geometry=o,r.material=n,o.mode===iC.LINES?r.mesh=new t9.LineSegments(o.geometry,n.material):r.mesh=new t9.Mesh(o.geometry,n.material),r.priority=void 0===a?0:a,r}eX(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.start=function(){e.prototype.start.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)},eB(i,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),i}(r5),sz=function(e){function i(i,r,n){if(void 0===n&&(n={}),o=e.call(this,i)||this,r){var o,a=r.width,s=r.height;o.texture=o.createTextureByType(iM({},n,{sourceType:t.TextureSourceType.data,data:r})),o.width=void 0===a?1:a,o.height=void 0===s?1:s}else o.texture=o.createTextureByType(n);return o.texture.needsUpdate=!0,o}eX(i,e);var r=i.prototype;return r.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.startVideo=function(){var e=this;return et(function(){var i;return en(this,function(r){switch(r.label){case 0:if(e.sourceType!==t.TextureSourceType.video||!(i=e.texture.source.data).paused)return[3,2];return[4,i.play()];case 1:r.sent(),r.label=2;case 2:return[2]}})})()},r.assembleOptions=function(e){var r=e.target,n=void 0===r?iC.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),iM({},e,{target:n,format:t9.RGBAFormat,type:t9.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,o=i.wrapS,a=i.wrapT,s=i.minFilter,u=i.magFilter,c=i.sourceType,h=t9.UVMapping,l=i.format,f=void 0;if(this.sourceType=c,c===t.TextureSourceType.data){var d=e.data;f=new t9.DataTexture(d.data,d.width,d.height,l,n,h,o,a,u,s),this.width=d.width,this.height=d.height}else if(c===t.TextureSourceType.image){var p=e.image;f=new t9.Texture(p,h,o,a,u,s,l,n),this.width=p.width,this.height=p.height}else if(c===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=t9.RGBA_ASTC_4x4_Format,f=new t9.CompressedTexture(y,m,v,l,n,h,o,a,u,s),this.width=m,this.height=v}else if(c===t.TextureSourceType.video)f=new t9.VideoTexture(e.video,h,o,a,u,s,l,n);else if(c===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,T,b=null!=(x=g.width)?x:0,E=null!=(T=g.height)?T:0;f=new t9.FramebufferTexture(b,E,l),this.width=b,this.height=E}}else c===t.TextureSourceType.none&&((f=new t9.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=t9.MirroredRepeatWrapping,f.wrapT=t9.MirroredRepeatWrapping,this.width=this.height=1);if(f)return f.flipY=!!r,f;throw Error("Create a texture using an unknown data type.")},i.toThreeJsTextureFilter=function(t){return t===iC.LINEAR?t9.LinearFilter:t9.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case iC.MIRRORED_REPEAT:return t9.MirroredRepeatWrapping;case iC.REPEAT:return t9.RepeatWrapping;default:return t9.ClampToEdgeWrapping}},i}(i$),sk=function(t){function e(e,i){return t.call(this,e,i)}eX(e,t);var i=e.prototype;return i.updateVideo=function(){this.textures.map(function(t){return t.startVideo()})},i.prepareRender=function(){var t=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var e,i=eH(this.rootComposition.items);!(e=i()).done;)for(var r,n=e.value.getComponents(ii),o=eH(n);!(r=o()).done;){var a=r.value;a.isActiveAndEnabled&&a.render(t)}for(var s,u=eH(this.refContent);!(s=u()).done;)for(var c,h=s.value,l=eH(h.getComponent(aa).items);!(c=l()).done;)for(var f,d=c.value.getComponents(ii),p=eH(d);!(f=p()).done;){var m=f.value;m.isActiveAndEnabled&&m.render(t)}},i.getRendererOptions=function(){var t=sz.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},e}(ss);sk.shape={};var sU=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new nS(e),i}return eX(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}(sw),sB=function(t){function e(e){var i;return(i=t.call(this)||this).engine=new sU(e),i.engine.renderer=nk(i),i.env="",i.renderingData={currentFrame:{}},i}return eX(e,t),e}(nO),sG=function(t){function e(e,i){(r=t.call(this)||this).compositions=[],r.env="",r.baseCompositionIndex=0;var r,n=i.width,o=i.height,a=i.camera;return r.renderer=new sB(e),r.width=n,r.height=o,r.camera=a,r}eX(e,t);var i=e.prototype;return i.loadScene=function(t,e){var i=this;return et(function(){var r,n;return en(this,function(o){switch(o.label){case 0:if(n=i.baseCompositionIndex,!eM(t))return[3,2];return i.baseCompositionIndex+=t.length,[4,Promise.all(t.map(et(function(t,r){var o;return en(this,function(a){switch(a.label){case 0:return[4,i.createComposition(t,e)];case 1:return(o=a.sent()).setIndex(n+r),[2,o]}})})))];case 1:return r=o.sent(),[3,4];case 2:return i.baseCompositionIndex+=1,[4,i.createComposition(t,e)];case 3:(r=o.sent()).setIndex(n),o.label=4;case 4:return[2,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.createComposition=function(t,e){void 0===e&&(e={});var i=this;return et(function(){var r,n,o,a,s,u,c,h;return en(this,function(l){switch(l.label){case 0:return r=performance.now(),n=iM({autoplay:!0},e),a5(t)?(o=t.url,a6(t)&&(n=iM({},n,t.options||{}))):o=t,i.assetManager?i.assetManager.updateOptions(n):i.assetManager=new si(n),[4,i.assetManager.loadScene(o,i.renderer,{env:i.env})];case 1:for(a=l.sent(),(s=i.renderer.engine).clearResources(),s.addPackageDatas(a),u=0;u<a.textureOptions.length;u++)a.textureOptions[u]=s.assetLoader.loadGUID(a.textureOptions[u].id),a.textureOptions[u].initialize();if(!s.database)return[3,3];return[4,s.createVFXItems(a)];case 2:l.sent(),l.label=3;case 3:return(c=new sk(iM({},n,{width:i.width,height:i.height,renderer:i.renderer,handleItemMessage:function(t){i.dispatchEvent({type:"message",message:t})}}),a)).on("end",function(){i.dispatchEvent({type:"end",composition:c})}),i.renderer.engine.setOptions({threeCamera:i.camera,threeGroup:i,composition:c}),n.autoplay?c.play():c.pause(),h=performance.now()-r+c.statistic.loadTime,c.statistic.firstFrameTime=h,eO.info("First frame: ["+c.name+"]"+h.toFixed(4)+"ms."),i.compositions.push(c),[2,c]}})})()},i.update=function(t){this.compositions.forEach(function(e){e.update(t)})},eB(e,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(t9.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}eX(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===iC.LINES?this.threeMesh=new t9.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new t9.Mesh(this.geometry.geometry,this.material.material))},i.start=function(){t.prototype.start.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()},eB(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=er([e6(tX.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.canvas=al.getCanvas(),al.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return au(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(!1),r}eX(e,t);var i=e.prototype;return i.update=function(e){t.prototype.update.call(this,e),this.updateTexture(!1)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture(!1)},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=er([e6(tX.TextComponent)],t.ThreeTextComponent),ek(t.ThreeTextComponent,[ad]),nN(8),i$.create=function(t,e){return new sz(t,void 0,e)},i$.createWithData=function(t,e,i){return new sz(t,e,i)},rt.create=function(t,e){return new sV(t,e)},r2.create=function(t,e){return new sN(t,e)},r5.create=function(t,e){return new sD(t,e)};var sX="2.0.0-beta.2";eO.info("THREEJS plugin version: "+sX+"."),t.AbstractPlugin=ir,t.ActivationPlayable=o8,t.AnimationClipPlayable=o9,t.AssetLoader=a_,t.AssetManager=si,t.BYTES_TYPE_MAP=r1,t.Behaviour=ie,t.BezierCurve=rF,t.BezierCurvePath=rD,t.BezierCurveQuat=rz,t.CONSTANT_MAP_BLEND=sR,t.CONSTANT_MAP_DEPTH=sL,t.CONSTANT_MAP_STENCIL_FUNC=sI,t.CONSTANT_MAP_STENCIL_OP=sM,t.COPY_FRAGMENT_SHADER=rq,t.COPY_MESH_SHADER_ID=rY,t.COPY_VERTEX_SHADER=rZ,t.CalculateLoader=o0,t.Camera=sn,t.CameraVFXItemLoader=io,t.Component=it,t.Composition=ss,t.CompositionComponent=aa,t.CompositionSourceManager=sa,t.DEFAULT_FONTS=af,t.Database=aC,t.Downloader=iL,t.EFFECTS_COPY_MESH_NAME=rW,t.EVENT_TYPE_CLICK=ia,t.EVENT_TYPE_TOUCH_END=ic,t.EVENT_TYPE_TOUCH_MOVE=iu,t.EVENT_TYPE_TOUCH_START=is,t.EffectsObject=e7,t.EffectsPackage=sA,t.Engine=sw,t.EventEmitter=am,t.EventSystem=ih,t.Float16ArrayWrapper=ri,t.Framebuffer=nw,t.GPUCapability=nS,t.Geometry=r2,t.GlobalUniforms=nE,t.GradientValue=rP,t.HELP_LINK=iE,t.InteractLoader=id,t.InteractMesh=nI,t.KTXTexture=i4,t.LineSegments=rV,t.LinearValue=rL,t.Material=rt,t.MaterialDataBlock=i8,t.Mesh=r5,t.PLAYER_OPTIONS_ENV_EDITOR=ib,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=oH,t.ParticleBehaviourPlayableAsset=oW,t.ParticleLoader=o$,t.ParticleMesh=oZ,t.ParticleSystemRenderer=oF,t.PassTextureCache=r$,t.PathSegments=rN,t.PluginSystem=aT,t.RENDER_PASS_NAME_PREFIX=ny,t.RENDER_PREFER_LOOKUP_TEXTURE=nZ,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=rR,t.RandomValue=rI,t.RandomVectorValue=rM,t.RenderFrame=nx,t.RenderPass=r9,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=r6,t.Renderbuffer=n_,t.Renderer=nO,t.RendererComponent=ii,t.RuntimeClip=at,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=r0,t.SerializationHelper=aE,t.ShaderFactory=nf,t.ShaderVariant=rH,t.SpriteColorPlayable=nY,t.SpriteLoader=nz,t.StaticValue=rO,t.TEMPLATE_USE_OFFSCREEN_CANVAS=nq,t.TEXTURE_UNIFORM_MAP=sP,t.TextComponentBase=ad,t.TextLayout=ac,t.TextLoader=ap,t.TextStyle=ah,t.Texture=i$,t.TextureFactory=i6,t.ThreeComposition=sk,t.ThreeDisplayObject=sG,t.ThreeEngine=sU,t.ThreeMaterial=sV,t.ThreeTexture=sz,t.Ticker=sO,t.TimelineClip=o7,t.TimelinePlayable=ai,t.TrackSortWrapper=ar,t.Transform=n$,t.TransformAnimationPlayable=o6,t.ValueGetter=rw,t.addByOrder=e_,t.addItem=ec,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 o=t[n];if(r)for(;t[n-1][i]<o[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>o[i]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},t.applyMixins=ek,t.assertExist=eS,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=ez,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.calculateTranslation=ro,t.canvasPool=al,t.colorGradingFrag=na,t.colorStopsFromGradient=ep,t.colorToArr=ef,t.combineImageTemplate=a9,t.createCopyShader=rQ,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=rj,t.createShape=on,t.createValueGetter=rU,t.decimalEqual=rf,t.defaultGlobalVolume={useHDR:!1,useBloom:!0,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,vignetteIntensity:.2,vignetteSmoothness:.4,vignetteRoundness:1,useToneMapping:!0},t.defaultPlugins=ay,t.deserializeMipmapTexture=iZ,t.earcut=ob,t.effectsClass=e6,t.effectsClassStore=e5,t.enlargeBuffer=el,t.ensureFixedNumber=aA,t.ensureVec3=ra,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=ns,t.gaussianDownVFrag=nu,t.gaussianUpFrag=nc,t.generateEmptyTypedArray=r3,t.generateGUID=eD,t.generateHalfFloatTexture=i0,t.generateTransparentTexture=i3,t.generateWhiteTexture=i2,t.getBackgroundImage=a8,t.getColorFromGradientStops=ed,t.getConfig=function(t){return nQ[t]},t.getDefaultTextureFactory=function(){return tZ||(tZ=new i6),tZ},t.getGeometryByShape=o_,t.getGeometryTriangles=oE,t.getImageItemRenderInfo=nL,t.getKTXTextureOptions=i5,t.getKeyFrameMetaByRawValue=rX,t.getMergedStore=e8,t.getParticleMeshShader=oK,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=iw,t.getStandardComposition=a$,t.getStandardImage=aJ,t.getStandardItem=a1,t.getStandardJSON=aQ,t.getTextureSize=nT,t.glContext=iC,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return tH.Float32;case WebGLRenderingContext.SHORT:return tH.Int16;case WebGLRenderingContext.BYTE:return tH.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return tH.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return tH.UInt8;default:return tH.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=et(function(){return en(this,function(n){return[2,new Promise(function(n,o){if(i){var a=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);a&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(a||s)&&(t.deleteQuery(i),i=null),null!==a&&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){eI(t)&&(t=ef(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=eb,t.initErrors=i_,t.initGLContext=iS,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=ex,t.isAndroid=ey,t.isArray=eM,t.isCanvas=eV,t.isFunction=eL,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 ex()||eT()},t.isObject=eP,t.isSceneJSON=a4,t.isSceneURL=a5,t.isSceneWithOptions=a6,t.isSimulatorCellPhone=eg,t.isString=eI,t.isUniformStruct=i9,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&i9(t[0])},t.isValidFontFamily=eA,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.isWechatMiniApp=eT,t.itemFrag=ne,t.itemFrameFrag=r7,t.itemVert=nt,t.loadAVIFOptional=iD,t.loadBinary=iB,t.loadBlob=function(t){return iX.apply(this,arguments)},t.loadImage=ik,t.loadMedia=iW,t.loadVideo=ij,t.loadWebPOptional=iF,t.logger=eO,t.math=iT,t.modifyMaxKeyframeShader=oJ,t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=eR,t.normalizeColor=aL,t.numberToFix=rd,t.parsePercent=ev,t.particleFrag=ni,t.particleOriginTranslateMap=rc,t.particleUniformTypeMap=oY,t.particleVert=nr,t.pluginLoaderMap=av,t.randomInRange=eF,t.registerPlugin=ax,t.removeItem=eh,t.rotateVec2=oC,t.screenMeshVert=no,t.serialize=function(t,e){return e9(t,e)},t.setBlendMode=iO,t.setConfig=function(t,e){return nQ[t]=e},t.setDefaultTextureFactory=function(t){tZ=t},t.setMaskMode=iI,t.setMaxSpriteMeshItemCount=nN,t.setRayFromCamera=rh,t.setSideMode=iR,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 t9.Uniform(i)},t.sortByOrder=eE,t.spec=e2,t.spriteMeshShaderFromFilter=nP,t.spriteMeshShaderFromRenderInfo=nF,t.spriteMeshShaderIdFromRenderInfo=nV,t.thresholdFrag=nh,t.throwDestroyedError=eN,t.trailVert=nn,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=rl,t.unregisterPlugin=function(t){delete ag[t],delete av[t],eh(ay,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=rs,t.vecMulCombine=ru,t.version=sX,t.vertexFormatType2GLType=function(t){switch(t){case tH.Float32:return WebGLRenderingContext.FLOAT;case tH.Int16:return WebGLRenderingContext.SHORT;case tH.Int8:return WebGLRenderingContext.BYTE;case tH.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case tH.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
|
|
6
|
+
* Version: v2.0.1
|
|
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,o,a,s,u,c,h,l,f,d,p,m,v,y,g,x,T,b,E,_,C,S,A,w,O,R,I,M,L,P,V,F,N,D,z,k,U,B,G,X,j,H,W,Y,Z,q,Q,K,J,$,tt,te,ti,tr,tn,to,ta,ts,tu,tc,th,tl,tf,td,tp,tm,tv,ty,tg,tx,tT,tb,tE,t_,tC,tS,tA,tw,tO,tR,tI,tM,tL,tP,tV,tF,tN,tD,tz,tk,tU,tB,tG,tX,tj,tH,tW,tY,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9=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 t7(t,e,i,r,n,o,a){try{var s=t[o](a),u=s.value}catch(t){i(t);return}s.done?e(u):Promise.resolve(u).then(r,n)}function et(t){return function(){var e=this,i=arguments;return new Promise(function(r,n){var o=t.apply(e,i);function a(t){t7(o,r,n,a,s,"next",t)}function s(t){t7(o,r,n,a,s,"throw",t)}a(void 0)})}}function ee(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):ee(t,e)}function ei(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function er(t,e,i,r){var n,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,i,a):n(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a}function en(t,e){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),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 eo=new Uint8Array(16),ea=[],es=0;es<256;++es)ea.push((es+256).toString(16).slice(1));var eu={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ec(t,e){return t.includes(e)||t.push(e),t}function eh(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function el(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 o=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(o);return a.set(t),a}return t}function ef(t,e){var i=[0,0,0,0];if(eI(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 ee(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)i[o]/=255;return i}function ed(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){r=em(o.color,a.color,(e-o.stop)/(a.stop-o.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 ep(t){var e=[];if(ee(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],o=t[3],a=t[4];e.push({stop:ev(i),color:[r,n,o,a]})}):Object.keys(t).forEach(function(i){var r=ef(t[i]);e.push({stop:ev(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=[],o=1-i;if(r)for(var a=0;a<4;a++)n[a]=t[a]*o+e[a]*i;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*o+e[s]*e[s]*i));n[3]=Math.round(t[3]*o+e[3]*i)}return n}function ev(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function ey(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function eg(){return ey()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function ex(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"}function eT(){return"miniprogram"===window.__wxjs_environment}function eb(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=ep(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var o=n/128,a=void 0,s=void 0,u=0;u<r.length&&(a=r[u],s=r[u+1],!(a.stop<=o)||!(s.stop>o));u++);var c=em(a.color,s.color,(o-a.stop)/(s.stop-a.stop));i.set(c,4*n)}i.set(r[r.length-1].color,508)}return e}function eE(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 o,a,s=e[r],u=r,c=n;u<c;){if(2===i){for(;e[c].priority>s.priority&&c>=u;)c--;for(;e[u].priority<=s.priority&&u<c;)u++}else{for(;e[c].priority<s.priority&&c>=u;)c--;for(;e[u].priority>=s.priority&&u<c;)u++}o=[e[c],e[u]],e[u]=o[0],e[c]=o[1]}return a=[e[u],e[r]],e[r]=a[0],e[u]=a[1],t(e,i,r,u-1),t(e,i,c+1,n),e}(t,e);for(var r=1;r<i;r++)eC(t,r,e);return t}function e_(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&eC(t,t.length-1,i)),t}function eC(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 eS(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function eA(t){return/^[^\d.][\w-]*$/.test(t)}function ew(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 eO={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(ew(t),[r])),null==tc||tc("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(ew(t))),null==tc||tc("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(ew(t))),null==tc||tc("warn",t,r)},register:function(t){t&&eL(t)&&(tc=t)}};function eR(){}function eI(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 eM=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eL(t){return"[object Function]"===Object.prototype.toString.call(t)}function eP(t){return"[object Object]"===Object.prototype.toString.call(t)}function eV(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eF(t,e){return t+Math.random()*(e-t)}function eN(){throw Error("Destroyed item cannot be used again.")}function eD(){return(function(t,e,i){if(eu.randomUUID&&!t)return eu.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tu&&!(tu="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 tu(eo)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),ea[n[r+0]]+ea[n[r+1]]+ea[n[r+2]]+ea[n[r+3]]+"-"+ea[n[r+4]]+ea[n[r+5]]+"-"+ea[n[r+6]]+ea[n[r+7]]+"-"+ea[n[r+8]]+ea[n[r+9]]+"-"+ea[n[r+10]]+ea[n[r+11]]+ea[n[r+12]]+ea[n[r+13]]+ea[n[r+14]]+ea[n[r+15]]})().replace(/-/g,"")}function ez(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],o=0;o<r.length;o+=512){for(var a=r.slice(o,o+512),s=Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);var c=new Uint8Array(s);n.push(c)}return new File([new Blob(n,{type:i})],e,{type:i})}function ek(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)})})}function eU(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 eB(t,e,i){return e&&eU(t.prototype,e),i&&eU(t,i),t}function eG(t,e){return(eG=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function eX(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&&eG(t,e)}function ej(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 eH(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 ej(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 ej(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.")}var eW=Math.PI/180,eY=180/Math.PI;function eZ(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var eq=function(t,e,i){return(1-i)*t+i*e};function eQ(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 eK=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):ee(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):ee(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):ee(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):ee(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}();eK.ONE=new eK(1,1),eK.ZERO=new eK(0,0);var eJ=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):ee(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):ee(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):ee(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):ee(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,o=e.x,a=e.y,s=e.z;return this.x=r*s-n*a,this.y=n*o-i*s,this.z=i*a-r*o,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 eK(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}();eJ.X=new eJ(1,0,0),eJ.Y=new eJ(0,1,0),eJ.Z=new eJ(0,0,1),eJ.ONE=new eJ(1,1,1),eJ.ZERO=new eJ(0,0,0);var e$=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),o=t.tempVec0;return o.copyFrom(e).normalize(),this.x=o.x*n,this.y=o.y*n,this.z=o.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],o=e[1],a=e[5],s=e[9],u=e[2],c=e[6],h=e[10],l=i+a+h;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(c-s)*f,this.y=(n-u)*f,this.z=(o-r)*f}else if(i>a&&i>h){var d=2*Math.sqrt(1+i-a-h);this.w=(c-s)/d,this.x=.25*d,this.y=(r+o)/d,this.z=(n+u)/d,this.negate()}else if(a>h){var p=2*Math.sqrt(1+a-i-h);this.w=(n-u)/p,this.x=(r+o)/p,this.y=.25*p,this.z=(s+c)/p,this.negate()}else{var m=2*Math.sqrt(1+h-i-a);this.w=(o-r)/m,this.x=(n+u)/m,this.y=(s+c)/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(eQ(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,o=t.w,a=e.x,s=e.y,u=e.z,c=e.w;return this.x=i*c+o*a+r*u-n*s,this.y=r*c+o*s+n*a-i*u,this.z=n*c+o*u+i*s-r*a,this.w=o*c-i*a-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,o=this.w,a=o*t.w+i*t.x+r*t.y+n*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=o,this.x=i,this.y=r,this.z=n,this;var s=1-a*a;if(s<=Number.EPSILON){var u=1-e;return this.w=u*o+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 c=Math.sqrt(s),h=Math.atan2(c,a),l=Math.sin((1-e)*h)/c,f=Math.sin(e*h)/c;return this.w=o*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,o=this.w,a=t.x,s=t.y,u=t.z,c=o*a+r*u-n*s,h=o*s+n*a-i*u,l=o*u+i*s-r*a,f=-i*a-r*s-n*u,d=null!=e?e:t;return d.x=c*o+-(f*i)+-(h*n)- -(l*r),d.y=h*o+-(f*r)+-(l*i)- -(c*n),d.z=l*o+-(f*n)+-(c*r)- -(h*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(eJ.ZERO,this,eJ.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}();e$.tempVec0=new eJ;var e0=function(){function t(t,e,i,r,n,o,a,s,u,c,h,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===o&&(o=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===h&&(h=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,o,a,s,u,c,h,l,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,a,s,u,c,h,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]=o,v[6]=a,v[7]=s,v[8]=u,v[9]=c,v[10]=h,v[11]=l,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,o,a,s,u,c,h,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]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=c,v[10]=h,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),o=Math.sin(i),a=1-n,s=r.x,u=r.y,c=r.z,h=a*s,l=a*u;return this.set(h*s+n,h*u+o*c,h*c-o*u,0,h*u-o*c,l*u+n,l*c+o*s,0,h*c+o*u,l*c-o*s,a*c*c+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(eJ.ZERO,t,eJ.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,o=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,i),a.normalize(),n.crossVectors(r,a),n.normalize(),o.crossVectors(a,n);var s=this.elements;return s[0]=n.x,s[1]=o.x,s[2]=a.x,s[3]=0,s[4]=n.y,s[5]=o.y,s[6]=a.y,s[7]=0,s[8]=n.z,s[9]=o.z,s[10]=a.z,s[11]=0,s[12]=-n.dot(e),s[13]=-o.dot(e),s[14]=-a.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,o=i[0],a=i[4],s=i[8],u=i[12],c=i[1],h=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],T=i[15],b=r[0],E=r[4],_=r[8],C=r[12],S=r[1],A=r[5],w=r[9],O=r[13],R=r[2],I=r[6],M=r[10],L=r[14],P=r[3],V=r[7],F=r[11],N=r[15];return n[0]=o*b+a*S+s*R+u*P,n[4]=o*E+a*A+s*I+u*V,n[8]=o*_+a*w+s*M+u*F,n[12]=o*C+a*O+s*L+u*N,n[1]=c*b+h*S+l*R+f*P,n[5]=c*E+h*A+l*I+f*V,n[9]=c*_+h*w+l*M+f*F,n[13]=c*C+h*O+l*L+f*N,n[2]=d*b+p*S+m*R+v*P,n[6]=d*E+p*A+m*I+v*V,n[10]=d*_+p*w+m*M+v*F,n[14]=d*C+p*O+m*L+v*N,n[3]=y*b+g*S+x*R+T*P,n[7]=y*E+g*A+x*I+T*V,n[11]=y*_+g*w+x*M+T*F,n[15]=y*C+g*O+x*L+T*N,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],o=t[1],a=t[5],s=t[9],u=t[13],c=t[2],h=t[6],l=t[10],f=t[14];return t[3]*(+n*s*h-r*u*h-n*a*l+i*u*l+r*a*f-i*s*f)+t[7]*(+e*s*f-e*u*l+n*o*l-r*o*f+r*u*c-n*s*c)+t[11]*(+e*u*h-e*a*f-n*o*h+i*o*f+n*a*c-i*u*c)+t[15]*(-r*a*c-e*s*h+e*a*l+r*o*h-i*o*l+i*s*c)},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],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],h=t[9],l=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=h*m*u-p*l*u+p*s*f-a*m*f-h*s*v+a*l*v,g=d*l*u-c*m*u-d*s*f+o*m*f+c*s*v-o*l*v,x=c*p*u-d*h*u+d*a*f-o*p*f-c*a*v+o*h*v,T=d*h*s-c*p*s-d*a*l+o*p*l+c*a*m-o*h*m,b=e*y+i*g+r*x+n*T;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/b;return t[0]=y*E,t[1]=(p*l*n-h*m*n-p*r*f+i*m*f+h*r*v-i*l*v)*E,t[2]=(a*m*n-p*s*n+p*r*u-i*m*u-a*r*v+i*s*v)*E,t[3]=(h*s*n-a*l*n-h*r*u+i*l*u+a*r*f-i*s*f)*E,t[4]=g*E,t[5]=(c*m*n-d*l*n+d*r*f-e*m*f-c*r*v+e*l*v)*E,t[6]=(d*s*n-o*m*n-d*r*u+e*m*u+o*r*v-e*s*v)*E,t[7]=(o*l*n-c*s*n+c*r*u-e*l*u-o*r*f+e*s*f)*E,t[8]=x*E,t[9]=(d*h*n-c*p*n-d*i*f+e*p*f+c*i*v-e*h*v)*E,t[10]=(o*p*n-d*a*n+d*i*u-e*p*u-o*i*v+e*a*v)*E,t[11]=(c*a*n-o*h*n-c*i*u+e*h*u+o*i*f-e*a*f)*E,t[12]=T*E,t[13]=(c*p*r-d*h*r+d*i*l-e*p*l-c*i*m+e*h*m)*E,t[14]=(d*a*r-o*p*r-d*i*s+e*p*s+o*i*m-e*a*m)*E,t[15]=(o*h*r-c*a*r+c*i*s-e*h*s-o*i*l+e*a*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=eJ.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,u=e.w,c=-r.x,h=-r.y,l=-r.z,f=o+o,d=a+a,p=s+s,m=o*f,v=o*d,y=o*p,g=a*d,x=a*p,T=s*p,b=u*f,E=u*d,_=u*p,C=i.x,S=i.y,A=i.z;return n[0]=(1-(g+T))*C,n[1]=(v+_)*C,n[2]=(y-E)*C,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+T))*S,n[6]=(x+b)*S,n[7]=0,n[8]=(y+E)*A,n[9]=(x-b)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=c*n[0]+h*n[4]+l*n[8]-c+t.x,n[13]=c*n[1]+h*n[5]+l*n[9]-h+t.y,n[14]=c*n[2]+h*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,o=this.elements,a=n.set(o[0],o[1],o[2]).length(),s=n.set(o[4],o[5],o[6]).length(),u=n.set(o[8],o[9],o[10]).length();0>this.determinant()&&(a=-a),e.x=o[12],e.y=o[13],e.z=o[14];var c=t.tempMat0;c.copyFrom(this);var h=1/a,l=1/s,f=1/u;return c.elements[0]*=h,c.elements[1]*=h,c.elements[2]*=h,c.elements[4]*=l,c.elements[5]*=l,c.elements[6]*=l,c.elements[8]*=f,c.elements[9]*=f,c.elements[10]*=f,i.setFromRotationMatrix(c),r.x=a,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 eJ,e=new e$,i=new eJ;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,o){var a=1/(e-t),s=1/(i-r),u=1/(o-n),c=-(e+t)*a,h=-(i+r)*s,l=-(o+n)*u;a*=2,s*=2,u*=-2;var f=this.elements;return f[0]=a,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]=c,f[13]=h,f[14]=l,f[15]=1,this},e.perspective=function(t,e,i,r,n){var o=1/Math.tan(.5*t),a=1/(i-r),s=this.elements;return s[0]=n?o:o/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?o*e:o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(r+i)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*r*i*a,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,o=this.elements,a=null!=e?e:t;a.x=o[0]*i+o[4]*r+o[8]*n+o[12],a.y=o[1]*i+o[5]*r+o[9]*n+o[13],a.z=o[2]*i+o[6]*r+o[10]*n+o[14];var s=o[3]*i+o[7]*r+o[11]*n+o[15];return a.multiply(1/s)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[4]*r+o[8]*n+o[12],a.y=o[1]*i+o[5]*r+o[9]*n+o[13],a.z=o[2]*i+o[6]*r+o[10]*n+o[14],a},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[4]*r+o[8]*n,a.y=o[1]*i+o[5]*r+o[9]*n,a.z=o[2]*i+o[6]*r+o[10]*n,a.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,o=t.w,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n+a[12]*o,s.y=a[1]*i+a[5]*r+a[9]*n+a[13]*o,s.z=a[2]*i+a[6]*r+a[10]*n+a[14]*o,s.w=a[3]*i+a[7]*r+a[11]*n+a[15]*o,s},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!eZ(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,o){return new t().perspective(e,i,r,n,o)},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,o,a,s,u,c,h,l,f,d,p,m,v){return new t(e,o,c,d,i,a,h,p,r,s,l,m,n,u,f,v)},t}();e0.IDENTITY=new e0(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),e0.ZERO=new e0(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),e0.tempVec0=new eJ,e0.tempVec1=new eJ,e0.tempVec2=new eJ,e0.tempMat0=new e0,(n=th||(th={}))[n.XYZ=0]="XYZ",n[n.XZY=1]="XZY",n[n.YXZ=2]="YXZ",n[n.YZX=3]="YZX",n[n.ZXY=4]="ZXY",n[n.ZYX=5]="ZYX";var e1=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],o=i[8],a=i[1],s=i[5],u=i[9],c=i[2],h=i[6],l=i[10];switch(e){case th.XYZ:this.y=Math.asin(eQ(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(h,s),this.z=0);break;case th.YXZ:this.x=Math.asin(-eQ(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(o,l),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-c,r),this.z=0);break;case th.ZXY:this.x=Math.asin(eQ(h,-1,1)),.9999999>Math.abs(h)?(this.y=Math.atan2(-c,l),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,r));break;case th.ZYX:this.y=Math.asin(-eQ(c,-1,1)),.9999999>Math.abs(c)?(this.x=Math.atan2(h,l),this.z=Math.atan2(a,r)):(this.x=0,this.z=Math.atan2(-n,s));break;case th.YZX:this.z=Math.asin(eQ(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-c,r)):(this.x=0,this.y=Math.atan2(o,l));break;case th.XZY:this.z=Math.asin(-eQ(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(h,s),this.y=Math.atan2(o,r)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=eY,this.y*=eY,this.z*=eY,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,o,a;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!=(o=t[e+2])?o:0,this.order=null!=(a=t[e+3])?a: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 e$;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,o=Math.cos(e*eW*.5),a=Math.cos(i*eW*.5),s=Math.cos(r*eW*.5),u=Math.sin(e*eW*.5),c=Math.sin(i*eW*.5),h=Math.sin(r*eW*.5);switch(n){case th.XYZ:t.set(u*a*s+o*c*h,o*c*s-u*a*h,o*a*h+u*c*s,o*a*s-u*c*h);break;case th.YXZ:t.set(u*a*s+o*c*h,o*c*s-u*a*h,o*a*h-u*c*s,o*a*s+u*c*h);break;case th.ZXY:t.set(u*a*s-o*c*h,o*c*s+u*a*h,o*a*h+u*c*s,o*a*s-u*c*h);break;case th.ZYX:t.set(u*a*s-o*c*h,o*c*s+u*a*h,o*a*h-u*c*s,o*a*s+u*c*h);break;case th.YZX:t.set(u*a*s+o*c*h,o*c*s+u*a*h,o*a*h-u*c*s,o*a*s-u*c*h);break;case th.XZY:t.set(u*a*s-o*c*h,o*c*s-u*a*h,o*a*h+u*c*s,o*a*s+u*c*h);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,o=this.order,a=Math.cos(i*eW),s=Math.sin(i*eW),u=Math.cos(r*eW),c=Math.sin(r*eW),h=Math.cos(n*eW),l=Math.sin(n*eW);if(o===th.XYZ){var f=a*h,d=a*l,p=s*h,m=s*l;e[0]=u*h,e[4]=-u*l,e[8]=c,e[1]=d+p*c,e[5]=f-m*c,e[9]=-s*u,e[2]=m-f*c,e[6]=p+d*c,e[10]=a*u}else if(o===th.YXZ){var v=u*h,y=u*l,g=c*h,x=c*l;e[0]=v+x*s,e[4]=g*s-y,e[8]=a*c,e[1]=a*l,e[5]=a*h,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=a*u}else if(o===th.ZXY){var T=u*h,b=u*l,E=c*h,_=c*l;e[0]=T-_*s,e[4]=-a*l,e[8]=E+b*s,e[1]=b+E*s,e[5]=a*h,e[9]=_-T*s,e[2]=-a*c,e[6]=s,e[10]=a*u}else if(o===th.ZYX){var C=a*h,S=a*l,A=s*h,w=s*l;e[0]=u*h,e[4]=A*c-S,e[8]=C*c+w,e[1]=u*l,e[5]=w*c+C,e[9]=S*c-A,e[2]=-c,e[6]=s*u,e[10]=a*u}else if(o===th.YZX){var O=a*u,R=a*c,I=s*u,M=s*c;e[0]=u*h,e[4]=M-O*l,e[8]=I*l+R,e[1]=l,e[5]=a*h,e[9]=-s*h,e[2]=-c*h,e[6]=R*l+I,e[10]=O-M*l}else if(o===th.XZY){var L=a*u,P=a*c,V=s*u,F=s*c;e[0]=u*h,e[4]=-l,e[8]=c*h,e[1]=L*l+F,e[5]=a*h,e[9]=P*l-V,e[2]=V*l-P,e[6]=s*h,e[10]=F*l+L}else console.error("toMatrix4: Invalid order "+o);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}();e1.DEFAULT_ORDER=th.ZYX,e1.tempQuat0=new e$,e1.tempMat0=new e0,(o=tl||(tl={})).S="S",o.APlus="A+",o.A="A",o.BPlus="B+",o.B="B",(a=tf||(tf={}))[a.ALPHA=0]="ALPHA",a[a.ADD=1]="ADD",a[a.MULTIPLY=2]="MULTIPLY",a[a.BRIGHTNESS=3]="BRIGHTNESS",a[a.SUBTRACTION=4]="SUBTRACTION",a[a.STRONG_LIGHT=5]="STRONG_LIGHT",a[a.WEAK_LIGHT=6]="WEAK_LIGHT",a[a.SUPERPOSITION=7]="SUPERPOSITION",(s=td||(td={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=tp||(tp={}))[u.NONE=0]="NONE",u[u.MASK=1]="MASK",u[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(c=tm||(tm={}))[c.NONE=0]="NONE",c[c.SPHERE=1]="SPHERE",c[c.CONE=2]="CONE",c[c.HEMISPHERE=3]="HEMISPHERE",c[c.CIRCLE=4]="CIRCLE",c[c.DONUT=5]="DONUT",c[c.RECTANGLE=6]="RECTANGLE",c[c.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",c[c.EDGE=8]="EDGE",c[c.TEXTURE=9]="TEXTURE",(h=tv||(tv={}))[h.GYROSCOPE=0]="GYROSCOPE",h[h.SPINE=1]="SPINE",(l=ty||(ty={}))[l.CLICK=0]="CLICK",l[l.MESSAGE=1]="MESSAGE",l[l.DRAG=2]="DRAG",(f=tg||(tg={}))[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=tx||(tx={})).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.node="node",(p=tT||(tT={}))[p.BILLBOARD=0]="BILLBOARD",p[p.MESH=1]="MESH",p[p.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",p[p.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(m=tb||(tb={}))[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=tE||(tE={})).Opaque="Opaque",v.Transparent="Transparent",(y=t_||(t_={})).Both="Both",y.Back="Back",y.Front="Front",(g=tC||(tC={}))[g.portrait=1]="portrait",g[g.landscape=0]="landscape",(x=tS||(tS={})).video="video",x.image="image",(T=tA||(tA={}))[T.CONSTANT=0]="CONSTANT",T[T.CONSTANT_VEC2=1]="CONSTANT_VEC2",T[T.CONSTANT_VEC3=2]="CONSTANT_VEC3",T[T.CONSTANT_VEC4=3]="CONSTANT_VEC4",T[T.RANDOM=4]="RANDOM",T[T.LINE=5]="LINE",T[T.CURVE=6]="CURVE",T[T.BEZIER_PATH=7]="BEZIER_PATH",T[T.RGBA_COLOR=8]="RGBA_COLOR",T[T.GRADIENT_COLOR=9]="GRADIENT_COLOR",T[T.SHAPE_POINTS=10]="SHAPE_POINTS",T[T.SHAPE_SPLITS=11]="SHAPE_SPLITS",T[T.LINEAR_PATH=12]="LINEAR_PATH",T[T.COLORS=13]="COLORS",T[T.BINARY=20]="BINARY",T[T.BEZIER_CURVE=21]="BEZIER_CURVE",T[T.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",T[T.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",(b=tw||(tw={}))[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",(E=tO||(tO={}))[E.destroy=0]="destroy",E[E.restart=5]="restart",E[E.forward=2]="forward",E[E.freeze=4]="freeze",(_=tR||(tR={}))[_.destroyChildren=6]="destroyChildren",(C=tI||(tI={}))[C.none=0]="none",C[C.removeParticle=1]="removeParticle",(S=tM||(tM={}))[S.RANDOM=0]="RANDOM",S[S.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",S[S.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",S[S.UNIFORM_BURST=3]="UNIFORM_BURST",(A=tL||(tL={})).point="point",A.spot="spot",A.directional="directional",A.ambient="ambient",(w=tP||(tP={}))[w.box=2]="box",w[w.sphere=3]="sphere",(O=tV||(tV={})).orthographic="orthographic",O.perspective="perspective",(R=tF||(tF={})).unlit="unlit",R.pbr="pbr",R.hair="hair",(I=tN||(tN={}))[I.opaque=100]="opaque",I[I.masked=101]="masked",I[I.translucent=102]="translucent",I[I.additive=103]="additive",(M=tD||(tD={})).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",(L=tz||(tz={}))[L.display=0]="display",L[L.clip=1]="clip",L[L.ellipsis=2]="ellipsis",(P=tk||(tk={}))[P.top=0]="top",P[P.middle=1]="middle",P[P.bottom=2]="bottom",(V=tU||(tU={}))[V.left=0]="left",V[V.middle=1]="middle",V[V.right=2]="right",(F=tB||(tB={})).normal="normal",F.bold="bold",F.lighter="lighter",(N=tG||(tG={})).normal="normal",N.italic="italic",N.oblique="oblique",(D=tX||(tX={})).VFXItemData="VFXItemData",D.EffectComponent="EffectComponent",D.Material="Material",D.Shader="Shader",D.SpriteComponent="SpriteComponent",D.ParticleSystem="ParticleSystem",D.InteractComponent="InteractComponent",D.CameraController="CameraController",D.Geometry="Geometry",D.Texture="Texture",D.AnimationClip="AnimationClip",D.TextComponent="TextComponent",D.BinaryAsset="BinaryAsset",D.TrackAsset="TrackAsset",D.TimelineAsset="TimelineAsset",D.ObjectBindingTrack="ObjectBindingTrack",D.TransformTrack="TransformTrack",D.SpriteColorTrack="SpriteColorTrack",D.ActivationTrack="ActivationTrack",D.SubCompositionTrack="SubCompositionTrack",D.TransformPlayableAsset="TransformPlayableAsset",D.SpriteColorPlayableAsset="SpriteColorPlayableAsset",D.ActivationPlayableAsset="ActivationPlayableAsset",D.SubCompositionPlayableAsset="SubCompositionPlayableAsset",D.MeshComponent="MeshComponent",D.SkyboxComponent="SkyboxComponent",D.LightComponent="LightComponent",D.CameraComponent="CameraComponent",D.ModelPluginComponent="ModelPluginComponent",D.TreeComponent="TreeComponent",D.AnimationComponent="AnimationComponent",D.SpineComponent="SpineComponent",D.TimelineClip="TimelineClip",(z=tj||(tj={}))[z.POINTS=0]="POINTS",z[z.LINES=1]="LINES",z[z.LINE_LOOP=2]="LINE_LOOP",z[z.LINE_STRIP=3]="LINE_STRIP",z[z.TRIANGLES=4]="TRIANGLES",z[z.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",z[z.TRIANGLE_FAN=6]="TRIANGLE_FAN",(k=tH||(tH={}))[k.Float16=0]="Float16",k[k.Float32=1]="Float32",k[k.Int8=2]="Int8",k[k.Int16=3]="Int16",k[k.Int32=4]="Int32",k[k.UInt8=5]="UInt8",k[k.UInt16=6]="UInt16",k[k.UInt32=7]="UInt32",(U=tW||(tW={}))[U.None=-1]="None",U[U.UInt8=0]="UInt8",U[U.UInt16=1]="UInt16",U[U.UInt32=2]="UInt32",(B=tY||(tY={})).Position="POSITION",B.Uv="TEXCOORD0",B.Uv2="TEXCOORD1",B.Normal="NORMAL",B.Tangent="TANGENT",B.Color="COLOR",B.Joints="JOINTS",B.Weights="WEIGHTS",B.PositionBS0="POSITION_BS0",B.PositionBS1="POSITION_BS1",B.PositionBS2="POSITION_BS2",B.PositionBS3="POSITION_BS3",B.PositionBS4="POSITION_BS4",B.PositionBS5="POSITION_BS5",B.PositionBS6="POSITION_BS6",B.PositionBS7="POSITION_BS7",B.NormalBS0="NORMAL_BS0",B.NormalBS1="NORMAL_BS1",B.NormalBS2="NORMAL_BS2",B.NormalBS3="NORMAL_BS3",B.TangentBS0="TANGENT_BS0",B.TangentBS1="TANGENT_BS1",B.TangentBS2="TANGENT_BS2",B.TangentBS3="TANGENT_BS3";var e2=Object.freeze({__proto__:null,get RenderLevel(){return tl},get BlendingMode(){return tf},get SideMode(){return td},get MaskMode(){return tp},get ShapeType(){return tm},get PluginType(){return tv},get InteractType(){return ty},get InteractBehavior(){return tg},get ItemType(){return tx},get RenderMode(){return tT},get ParticleOrigin(){return tb},get RenderType(){return tE},get RenderFace(){return t_},get CameraClipMode(){return tC},get BackgroundType(){return tS},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 tA},get BezierKeyframeType(){return tw},get EndBehavior(){return tO},get ParentItemEndBehavior(){return tR},get ParticleInteractionBehavior(){return tI},get ShapeArcMode(){return tM},get LightType(){return tL},get ModelBoundingType(){return tP},get CameraType(){return tV},get MaterialType(){return tF},get MaterialBlending(){return tN},get RenderMode3D(){return tD},get TextOverflow(){return tz},get TextBaseline(){return tk},get TextAlignment(){return tU},get TextWeight(){return tB},get FontStyle(){return tG},get DataType(){return tX},get GeometryType(){return tj},get VertexFormatType(){return tH},get IndexFormatType(){return tW},get VertexBufferSemantic(){return tY},BuiltinObjectGUID:{WhiteTexture:"whitetexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"}}),e3=new Map,e4=new Map,e5={};function e6(t){return function(e,i){e5[t]&&console.warn("Class "+t+" is already registered."),e5[t]=e}}function e8(t){var e=t.constructor;if(e4.get(e))return e4.get(e);var i={};e4.set(e,i);for(var r=t,n=e;n;){var o=e3.get(n);for(var a in o)i[a]=o[a];var s=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(s).constructor)===Object)break;r=s}return i}function e9(t,e){return function(i,r){var n,o=(n=i.constructor,e3.get(n)||e3.set(n,{}),e3.get(n));o&&(o[r]||(o[r]={type:t,sourceName:e}))}}var e7=function(){function t(t){this.engine=t,this.guid=eD(),this.taggedProperties={},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){t.id&&this.setInstanceId(t.id)},e.dispose=function(){},t.is=function(e){return ee(e,t)&&"guid"in e},t}(),it=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onAttached=function(){},i.onDestroy=function(){},i.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},i.dispose=function(){this.onDestroy(),this.item&&eh(this.item.components,this)},eB(e,[{key:"transform",get:function(){return this.item.transform}}]),e}(e7),ie=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isAwakeCalled=!1,e.isStartCalled=!1,e._enabled=!0,e}eX(e,t);var i=e.prototype;return i.awake=function(){},i.onEnable=function(){},i.start=function(){},i.update=function(t){},i.lateUpdate=function(t){},i.onAttached=function(){this.item.itemBehaviours.push(this),this.isAwakeCalled||(this.awake(),this.isAwakeCalled=!0)},i.dispose=function(){this.item&&eh(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},eB(e,[{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&(this.isActiveAndEnabled&&this.onEnable(),this.isStartCalled||(this.start(),this.isStartCalled=!0))}}]),e}(it);er([e9(void 0,void 0)],ie.prototype,"_enabled",void 0);var ii=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.isStartCalled=!1,e.materials=[],e._priority=0,e._enabled=!0,e}eX(e,t);var i=e.prototype;return i.onEnable=function(){},i.start=function(){},i.update=function(t){},i.lateUpdate=function(t){},i.render=function(t){},i.onAttached=function(){this.item.rendererComponents.push(this)},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.toData=function(){t.prototype.toData.call(this)},i.dispose=function(){this.item&&eh(this.item.rendererComponents,this),t.prototype.dispose.call(this)},eB(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onEnable()}},{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(it);er([e9(void 0,void 0)],ii.prototype,"materials",void 0),er([e9(void 0,void 0)],ii.prototype,"_priority",void 0),er([e9(void 0,void 0)],ii.prototype,"_enabled",void 0);var ir=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return 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.precompile=function(t,e){return Promise.resolve()},t}();t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}eX(e,t);var i=e.prototype;return i.update=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.position=this.transform.getWorldPosition(),t.rotation=this.transform.getWorldRotation()}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(ie),t.CameraController=er([e6(tX.CameraController)],t.CameraController);var io=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(ir);t.HitTestType=void 0,(G=t.HitTestType||(t.HitTestType={}))[G.triangle=1]="triangle",G[G.box=2]="box",G[G.sphere=3]="sphere",G[G.custom=4]="custom";var ia="click",is="touchstart",iu="touchmove",ic="touchend",ih=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,o,a=this;n=function(t){return t};var s="mousedown",u="mousemove",c="mouseup",h=function(t,e,i,n,o){void 0===n&&(n=0),void 0===o&&(o=0);var s=0,u=0,c=performance.now();if(!a.target)return eO.error("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:o,ts:c,width:0,height:0,origin:t};var h=a.target,l=h.width,f=h.height;if(r){var d=c-r.ts;s=(n-r.dx)/d||0,u=(o-r.dy)/d||0,r={dx:n,dy:o,ts:c}}return{x:e,y:i,vx:s,vy:u,dx:n,dy:o,ts:c,width:l,height:f,origin:t}};eg()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((o={})[s]=function(o){if(a.enabled){var s=n(o),u=il(s);t=u.x,e=u.y,r=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},a.dispatchEvent(is,h(o,t,e))}},o[u]=function(r){if(i&&a.enabled){var o=il(n(r));t=o.x,e=o.y,a.dispatchEvent(iu,h(r,t,e,t-i.x,e-i.y))}},o[c]=function(r){if(i&&a.enabled){!a.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var o=n(r),s=il(o),u=Math.abs(i.clientX-o.clientX)+Math.abs(i.clientY-o.clientY);t=s.x,e=s.y,u<4&&a.dispatchEvent(ia,h(r,t,e)),a.dispatchEvent(ic,h(r,t,e,t-i.x,e-i.y))}i=0},o),Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.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]=[]),ec(i,e),function(){eh(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&eh(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 il(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),o=n.left,a=n.top;return{x:(i-o)/n.width*2-1,y:1-(r-a)/n.height*2}}var id=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(ir),ip=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,o;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!=(o=t[e+3])?o: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):ee(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):ee(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):ee(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):ee(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 eJ(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}();ip.ONE=new ip(1,1,1,1),ip.ZERO=new ip(0,0,0,0);var im=function(){function t(t,e,i,r,n,o,a,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===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,o,a,s,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=r,c[6]=a,c[1]=e,c[4]=n,c[7]=s,c[2]=i,c[5]=o,c[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=e,c[6]=i,c[1]=r,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[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,o=e+e,a=i+i,s=r+r,u=e*o,c=e*a,h=e*s,l=i*a,f=i*s,d=r*s,p=n*o,m=n*a,v=n*s,y=this.elements;return y[0]=1-(l+d),y[1]=c+v,y[2]=h-m,y[3]=c-v,y[4]=1-(u+d),y[5]=f+p,y[6]=h+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],o=r[3],a=r[6],s=r[1],u=r[4],c=r[7];return r[0]=e*n+i*s,r[3]=e*o+i*u,r[6]=e*a+i*c,r[1]=-i*n+e*s,r[4]=-i*o+e*u,r[7]=-i*a+e*c,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,o=i[0],a=i[3],s=i[6],u=i[1],c=i[4],h=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],T=r[2],b=r[5],E=r[8];return n[0]=o*p+a*y+s*T,n[3]=o*m+a*g+s*b,n[6]=o*v+a*x+s*E,n[1]=u*p+c*y+h*T,n[4]=u*m+c*g+h*b,n[7]=u*v+c*x+h*E,n[2]=l*p+f*y+d*T,n[5]=l*m+f*g+d*b,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],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8];return e*(o*c-u*a)+n*(u*r-i*c)+s*(i*a-o*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8],h=c*o-u*a,l=u*r-c*i,f=a*i-o*r,d=e*h+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]=h*p,t[1]=(s*a-c*n)*p,t[2]=(u*n-s*o)*p,t[3]=l*p,t[4]=(c*e-s*r)*p,t[5]=(s*i-u*e)*p,t[6]=f*p,t[7]=(n*r-a*e)*p,t[8]=(o*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,o=this.elements,a=null!=e?e:t;return a.x=o[0]*i+o[3]*r+o[6]*n,a.y=o[1]*i+o[4]*r+o[7]*n,a.z=o[2]*i+o[5]*r+o[8]*n,a},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(!eZ(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,o,a,s,u,c){return new t(e,n,s,i,o,u,r,a,c)},t}(),iv=function(){function t(t,e){void 0===t&&(t=eJ.ZERO),void 0===e&&(e=eJ.X),this.origin=new eJ,this.direction=new eJ,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 eJ;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,o,a,s,u=this.origin,c=u.x,h=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,T=t.max,b=T.x,E=T.y,_=T.z,C=1/d,S=1/p,A=1/m;if(C>=0?(i=(y-c)*C,r=(b-c)*C):(i=(b-c)*C,r=(y-c)*C),S>=0?(n=(g-h)*S,o=(E-h)*S):(n=(E-h)*S,o=(g-h)*S),!(i>o)&&!(n>r)&&((n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),(n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),A>=0?(a=(x-l)*A,s=(_-l)*A):(a=(_-l)*A,s=(x-l)*A),!(i>s)&&!(a>r))&&((a>i||i!=i)&&(i=a),(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 eJ).copyFrom(this.origin):void 0;var o=-(this.origin.dot(i)+r)/n;return o>=0?this.at(o,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),o=n.dot(this.direction),a=n.dot(n)-o*o,s=e.radius*e.radius;if(!(a>s)){var u=Math.sqrt(s-a),c=o-u,h=o+u;if(!(h<0))return c>=0?this.at(c,i):this.at(h,i)}},e.intersectTriangle=function(e,i,r){var n,o=e.p0,a=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(a,o),c=t.tempVec1.subtractVectors(s,o),h=t.tempVec2.subtractVectors(this.origin,o),l=t.tempVec3.crossVectors(u,c),f=this.direction.dot(l);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}c.crossVectors(h,c);var d=n*this.direction.dot(c);if(!(d<0)){u.cross(h);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*h.dot(l);if(!(m<0))return this.at(m/f,i)}}},t}();iv.tempVec0=new eJ,iv.tempVec1=new eJ,iv.tempVec2=new eJ,iv.tempVec3=new eJ;var iy=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,o;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!=(o=t[e+3])?o:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,o=t/60,a=n*(1-Math.abs(o%2-1)),s=0,u=0,c=0;o>=0&&o<=1?(s=n,u=a):o>=1&&o<=2?(s=a,u=n):o>=2&&o<=3?(u=n,c=a):o>=3&&o<=4?(u=a,c=n):o>=4&&o<=5?(s=a,c=n):o>=5&&o<=6&&(s=n,c=a);var h=i-n;return this.set(s+h,u+h,c+h,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):ee(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):ee(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):ee(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):ee(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 ip(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,o=Math.max(e,i,r),a=Math.min(e,i,r),s=o-a,u=0,c=0;return 0!==o&&(c=s/o),o!=a&&(o==e?(u=(i-r)/s,i<r&&(u+=6)):o==i?u=(r-e)/s+2:o==r&&(u=(e-i)/s+4),u*=60),new t(u,c,o,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)),o=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+o:"#"+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}();iy.BLACK=new iy(0,0,0,1),iy.BLUE=new iy(0,0,1,1),iy.CLEAR=new iy(0,0,0,0),iy.CYAN=new iy(0,1,1,1),iy.GRAY=new iy(.5,.5,.5,1),iy.GREEN=new iy(0,1,0,1),iy.MAGENTA=new iy(1,0,1,1),iy.RED=new iy(1,0,0,1),iy.WHITE=new iy(1,1,1,1),iy.YELLOW=new iy(1,.92,.016,1);var ig=function(){function t(t,e){void 0===t&&(t=new eJ(1/0,1/0,1/0)),void 0===e&&(e=new eJ(-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,o=-1/0,a=-1/0,s=0,u=t.length;s<u;s+=3){var c=t[s],h=t[s+1],l=t[s+2];c<e&&(e=c),h<i&&(i=h),l<r&&(r=l),c>n&&(n=c),h>o&&(o=h),l>a&&(a=l)}return this.min.set(e,i,r),this.max.set(n,o,a),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 eJ),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 eJ),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,o=0,a=n.length;o<a;o++)this.expandByObject(n[o]);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 eJ),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 eJ;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 eJ),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 eJ),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 eJ),this.isEmpty())return[];var i=[];return i[0]=new eJ(this.min.x,this.min.y,this.min.z),i[1]=new eJ(this.min.x,this.min.y,this.max.z),i[2]=new eJ(this.min.x,this.max.y,this.min.z),i[3]=new eJ(this.min.x,this.max.y,this.max.z),i[4]=new eJ(this.max.x,this.min.y,this.min.z),i[5]=new eJ(this.max.x,this.min.y,this.max.z),i[6]=new eJ(this.max.x,this.max.y,this.min.z),i[7]=new eJ(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 eJ;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}(),ix=function(){function t(t,e){void 0===t&&(t=eJ.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 o=new ig().setFromPoints(t);o.getCenter(i),this.radius=o.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 eJ),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 ig),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 eJ().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 eJ,i=new eJ;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 eJ().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}(),iT=Object.freeze({__proto__:null,get EulerOrder(){return th},Euler:e1,Quaternion:e$,Vector2:eK,Vector3:eJ,Vector4:ip,Matrix3:im,Matrix4:e0,Ray:iv,PI2:2*Math.PI,DEG2RAD:eW,RAD2DEG:eY,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:eZ,damp:function(t,e,i,r){return eq(t,e,1-Math.exp(-i*r))},lerp:eq,degToRad:function(t){return t*eW},radToDeg:function(t){return t*eY},clamp:eQ,Color:iy,Box3:ig,Sphere:ix}),ib="editor",iE={"Item duration can't be less than 0":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"},i_=[],iC={};function iS(){"function"==typeof WebGL2RenderingContext?iA(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iA(WebGLRenderingContext),iA(WebGLRenderingContext.prototype)):i_.push("iOS16 lockdown mode, WebGL Constants not in global"),i_.length||"HALF_FLOAT"in iC||(iC.HALF_FLOAT=5131)}function iA(t){for(var e in t)/^[A-Z_]/.test(e)&&(iC[e]=t[e])}function iw(t){switch(t){case tf.ALPHA:case tf.ADD:case tf.SUBTRACTION:case tf.STRONG_LIGHT:case tf.WEAK_LIGHT:return 1;case tf.SUPERPOSITION:return 2;case tf.BRIGHTNESS:return 3;case tf.MULTIPLY:return 0;default:return 1}}function iO(t,e){switch(e){case void 0:case tf.ALPHA:t.blendFunction=[iC.ONE,iC.ONE_MINUS_SRC_ALPHA,iC.ONE,iC.ONE_MINUS_SRC_ALPHA];break;case tf.ADD:t.blendFunction=[iC.ONE,iC.ONE,iC.ONE,iC.ONE];break;case tf.SUBTRACTION:t.blendFunction=[iC.ONE,iC.ONE,iC.ZERO,iC.ONE],t.blendEquation=[iC.FUNC_REVERSE_SUBTRACT,iC.FUNC_REVERSE_SUBTRACT];break;case tf.SUPERPOSITION:t.blendFunction=[iC.ONE,iC.ONE,iC.ONE,iC.ONE];break;case tf.MULTIPLY:t.blendFunction=[iC.DST_COLOR,iC.ONE_MINUS_SRC_ALPHA,iC.DST_COLOR,iC.ONE_MINUS_SRC_ALPHA];break;case tf.BRIGHTNESS:t.blendFunction=[iC.ONE,iC.ONE_MINUS_SRC_ALPHA,iC.ONE,iC.ONE_MINUS_SRC_ALPHA];break;case tf.STRONG_LIGHT:t.blendFunction=[iC.DST_COLOR,iC.DST_ALPHA,iC.ZERO,iC.ONE];break;case tf.WEAK_LIGHT:t.blendFunction=[iC.DST_COLOR,iC.ZERO,iC.ZERO,iC.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iR(t,e){e===td.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=iC.CW,t.cullFace=e===td.BACK?iC.BACK:iC.FRONT)}function iI(t,e){switch(e){case void 0:t.stencilTest=!1;break;case tp.MASK:t.stencilTest=!0,t.stencilFunc=[iC.ALWAYS,iC.ALWAYS],t.stencilOpZPass=[iC.REPLACE,iC.REPLACE];break;case tp.OBSCURED:t.stencilTest=!0,t.stencilFunc=[iC.EQUAL,iC.EQUAL];break;case tp.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[iC.NOTEQUAL,iC.NOTEQUAL];break;case tp.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function iM(){return(iM=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)}i_.length||iS(),t.ShaderType=void 0,(X=t.ShaderType||(t.ShaderType={}))[X.vertex=0]="vertex",X[X.fragment=1]="fragment",t.TextureLoadAction=void 0,(j=t.TextureLoadAction||(t.TextureLoadAction={}))[j.whatever=0]="whatever",j[j.clear=2]="clear",t.TextureSourceType=void 0,(H=t.TextureSourceType||(t.TextureSourceType={}))[H.none=0]="none",H[H.data=1]="data",H[H.image=2]="image",H[H.compressed=3]="compressed",H[H.video=4]="video",H[H.canvas=5]="canvas",H[H.framebuffer=6]="framebuffer",H[H.mipmaps=7]="mipmaps";var iL=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 o=new XMLHttpRequest,a=function(){n.finish(t,o.status,o.response)};o.responseType=e,o.addEventListener("load",function(){200==o.status||0==o.status?n.finish(t,200,o.response):a()}),o.addEventListener("error",a),o.open("GET",t,!0),o.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||0==e?[i]:[e,i],o=n.length-1,a=r.length;o<a;o+=2)r[o].apply(null,n)},t}(),iP=!1,iV=!1;function iF(t,e){return iN.apply(this,arguments)}function iN(){return(iN=et(function(t,e){return en(this,function(i){switch(i.label){case 0:if(!(iP||!e))return[3,2];return[4,ik(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,ik(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iP=!0,[4,ik(t)];case 6:return[2]}})})).apply(this,arguments)}function iD(t,e){return iz.apply(this,arguments)}function iz(){return(iz=et(function(t,e){return en(this,function(i){switch(i.label){case 0:if(!(iV||!e))return[3,2];return[4,ik(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,ik(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),iV=!0,[4,ik(t)];case 6:return[2]}})})).apply(this,arguments)}function ik(t){return iU.apply(this,arguments)}function iU(){return(iU=et(function(t){var e,i;return en(this,function(r){if(e="",ee(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else ee(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 iB(t){return iG.apply(this,arguments)}function iG(){return(iG=et(function(t){return en(this,function(e){return[2,new Promise(function(e,i){new iL().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iX(){return(iX=et(function(t){return en(this,function(e){return[2,new Promise(function(e,i){new iL().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function ij(t){return iH.apply(this,arguments)}function iH(){return(iH=et(function(t){var e;return en(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,ey()&&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(t)})})]})})).apply(this,arguments)}function iW(t,e){return iY.apply(this,arguments)}function iY(){return(iY=et(function(t,e){return en(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 iZ(t,e,i){return iq.apply(this,arguments)}function iq(){return(iq=et(function(e,i,r,n){var o,a,s,u,c,h,l;return en(this,function(f){switch(f.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,2];return o=e.mipmaps,a=e.target,[4,Promise.all(o.map(function(t){return Promise.all(t.map(function(t){return t.id?r.assetLoader.loadGUID(t.id).data:iQ(t,i)}))}))];case 1:return s=f.sent(),[2,iM({keepImageSource:!1},e,{mipmaps:s,sourceFrom:{target:a,type:t.TextureSourceType.mipmaps}})];case 2:return u=e.mipmaps,c=e.target,[4,Promise.all(u.map(function(t){return iQ(t,i)}))];case 3:return h=f.sent(),l=n[u[0][1][0]].url,[2,iM({keepImageSource:!1},e,{mipmaps:h,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:c,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 iQ(t,e){return iK.apply(this,arguments)}function iK(){return(iK=et(function(t,e){var i,r,n,o,a;return en(this,function(s){if(r=(i=t[1])[0],n=i[1],o=i[2],!(a=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,ik(new Blob([new Uint8Array(a,n,o)]))]})})).apply(this,arguments)}var iJ=1,i$=function(e){function i(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+iJ++,i}eX(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?iC.TEXTURE_2D:i,n=e.format,o=void 0===n?iC.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),iM({minFilter:iC.NEAREST,magFilter:iC.NEAREST,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE,target:r,format:iC.RGBA,internalFormat:o,type:iC.UNSIGNED_BYTE},e)},i.fromImage=function(e,r){return et(function(){var n,o;return en(this,function(a){switch(a.label){case 0:return[4,ik(e)];case 1:return n=a.sent(),(o=i.create(r,{sourceType:t.TextureSourceType.image,image:n,id:eD(),flipY:!0})).initialize(),[2,o]}})})()},eB(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(e7);function i0(t,e,i,r){var n,o,a=e.length/i/r;return o=n=4===a||0===a?iC.RGBA:3===a?iC.RGB:2===a?iC.LUMINANCE_ALPHA:iC.LUMINANCE,i$.createWithData(t,{data:e,width:i,height:r},{type:iC.HALF_FLOAT,format:n,internalFormat:o,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE})}var i1={type:iC.UNSIGNED_BYTE,format:iC.RGBA,internalFormat:iC.RGBA,wrapS:iC.MIRRORED_REPEAT,wrapT:iC.MIRRORED_REPEAT,minFilter:iC.NEAREST,magFilter:iC.NEAREST};function i2(e){return i$.create(e,iM({id:"whitetexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},i1))}function i3(e){return i$.create(e,iM({id:"transparenttexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},i1))}var i4=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,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===o.getUint32(0,!0);if(this.glType=o.getUint32(1*n,a),this.glTypeSize=o.getUint32(2*n,a),this.glFormat=o.getUint32(3*n,a),this.glInternalFormat=o.getUint32(4*n,a),this.glBaseInternalFormat=o.getUint32(5*n,a),this.pixelWidth=o.getUint32(6*n,a),this.pixelHeight=o.getUint32(7*n,a),this.pixelDepth=o.getUint32(8*n,a),this.numberOfArrayElements=o.getUint32(9*n,a),this.numberOfFaces=o.getUint32(10*n,a),this.numberOfMipmapLevels=o.getUint32(11*n,a),this.bytesOfKeyValueData=o.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){eO.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){eO.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){eO.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,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,s);e.push({data:c,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 i5(e){var i=new i4(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,o=i.pixelHeight,a=i.glType,s=i.numberOfFaces,u=i.glInternalFormat,c=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?iC.TEXTURE_CUBE_MAP:iC.TEXTURE_2D,internalFormat:u,format:c,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,o))+1))}}var i6=function(){function e(){this.reloadPending={}}var i=e.prototype;return i.reload=function(t){var e=this;return et(function(){var i,r;return en(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,o=e.url;return r===iC.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:eI(o)&&o.length>0}if(i===t.TextureSourceType.mipmaps){var a=e.bin,s=e.mipmaps,u=e.target,c=e.maps,h=e.urls;return a?s.length>0:u===iC.TEXTURE_CUBE_MAP?c.every(function(t){return"object"==typeof t&&t}):h.every(function(t){return eI(t)&&t.length>0})}}return!1},i.loadSource=function(e,i){var r=this;return et(function(){var n,o,a,s,u,c,h,l,f,d,p,m,v,y,g,x,T,b;return en(this,function(E){switch(E.label){case 0:if(n=e.type,o=e.target,a=e.map,s=e.url,u=e.bin,c=e.mipmaps,h=e.urls,l=e.maps,!(o===iC.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,r.loadCubeMap(a)];case 1:return f=E.sent(),[2,iM({},i,{cube:f,target:iC.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iM({},a),target:iC.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,ik(s)];case 3:return d=E.sent(),[2,iM({},i,{image:d,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:iC.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,ij(s)];case 5:return p=E.sent(),[2,iM({},i,{video:p,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,iB(s)];case 7:return m=E.sent(),[2,iM({},i5(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,iB(u)];case 9:if(v=E.sent(),g=(y=null!=o?o:iC.TEXTURE_2D)===iC.TEXTURE_2D?c.slice():c.map(function(t){return t.slice()}),o!==iC.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(c.map(function(t){return r.loadMipmapImages(t,v)}))];case 10:return x=E.sent(),[3,12];case 11:x=r.loadMipmapImages(c,v),E.label=12;case 12:return[2,iM({},i,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(o===iC.TEXTURE_2D||!o))return[3,15];return[4,Promise.all(h.map(function(t){return ik(t)}))];case 14:return T=E.sent(),[2,iM({},i,{mipmaps:T,target:iC.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:h.slice(),target:iC.TEXTURE_2D}})];case 15:if(o!==iC.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(l.map(function(t){return r.loadCubeMap(t)}))];case 16:return b=E.sent(),[2,iM({},i,{mipmaps:b,target:iC.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:l.map(function(t){return iM({},t)}),target:iC.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n+".")}})})()},i.loadMipmapImages=function(t,e){return et(function(){return en(this,function(i){return[2,Promise.all(t.map(function(t){return ik(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},i.loadCubeMap=function(t){return et(function(){return en(this,function(e){return[2,Promise.all(t.map(function(t){return ik(t)}))]})})()},e}(),i8=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 i9(t){return"object"==typeof t&&t&&void 0===t.length&&ee(t,i$)}t.MaterialRenderType=void 0,(W=t.MaterialRenderType||(t.MaterialRenderType={}))[W.normal=0]="normal",W[W.transformFeedback=1]="transformFeedback";var i7=1,rt=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,i){var n=i.name,o=void 0===n?"Material"+i7++:n,a=i.renderType,s=i.shader,u=i.uniformSemantics;r.name=o,r.renderType=void 0===a?0:a,r.shaderSource=s,r.props=i,r.uniformSemantics=iM({},u)}else r.name="Material"+i7++,r.renderType=0;return r}eX(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},eB(e,[{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:"colorMask",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(e7),re=(Z=new Int32Array((Y=new Float32Array(1)).buffer),function(t){Y[0]=t;var e=Z[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)}),ri=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]=re(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=re(t[i])},t}(),rr=new e1,rn=new e0;function ro(t,e,i,r,n,o,a){var s=r/n,u=r,c=e.speedOverLifetime;c&&(u=c.getIntegrateValue(0,r,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(o),t.addScaledVector(a,u),t.addScaledVector(i,h);var l=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new eJ;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});rr.setFromArray(v).negate(),rn.setFromEuler(rr);var y=rn.transformPoint(p);t.addVectors(d,y)}if(l.enabled){var g=l.asMovement,x=l.x,T=l.y,b=l.z;if(x){var E=g?x.getValue(s):x.getIntegrateValue(0,r,n);t.x=t.x+E}if(T){var _=g?T.getValue(s):T.getIntegrateValue(0,r,n);t.y=t.y+_}if(b){var C=g?b.getValue(s):b.getIntegrateValue(0,r,n);t.z=t.z+C}}return t}function ra(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function rs(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function ru(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 o=0;o<e.length;o++)t[o]=e[o]}else if(i&&t!==i)for(var a=0;a<i.length;a++)t[a]=i[a];return t}var rc=((tq={})[tb.PARTICLE_ORIGIN_CENTER]=[0,0],tq[tb.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],tq[tb.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],tq[tb.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],tq[tb.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],tq[tb.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],tq[tb.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],tq[tb.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],tq[tb.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],tq);function rh(t,e,i){var r=i.position,n=new eJ(t,e,0),o=new eJ;return i.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(r),new iv(r,o)}function rl(t,e,i){var r=t.x,n=t.y,o=t.z,a=new eJ(r-e,n+i,o),s=new eJ(r-e,n-i,o),u=new eJ(r+e,n-i,o),c=new eJ(r+e,n+i,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:c}]}function rf(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function rd(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function rp(t,e,i){return(rp=!function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}()?function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&eG(n,i.prototype),n}:Reflect.construct).apply(null,arguments)}var rm={getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t),r=i.xIndex,n=i.yIndex;return new eK(e[r],e[n])},getPointIndexInCurve:function(t){var e=t[0],i=t[2],r=e===tw.LINE?0:e===tw.EASE_OUT?0:e===tw.EASE_IN?2:e===tw.EASE?2:e===tw.HOLD&&i===tw.EASE_IN?2:0;return{xIndex:r,yIndex:r+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tw.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tw.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tw.EASE,tw.EASE_IN,tw.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tw.EASE,tw.EASE_OUT,tw.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tw.HOLD&&[tw.HOLD,tw.LINE_OUT,tw.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tw.HOLD&&[tw.HOLD,tw.LINE,tw.EASE_IN].includes(i)}},rv=function(t,e){this.points=t,this.totalLength=e},ry={},rg={};function rx(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function rT(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var rb=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=rd(e.x-t.x,3)+"_"+rd(e.y-t.y,3)+"_"+rd(e.z-t.z,3)+"&"+(rd(i.x-t.x,3)+"_"+rd(i.y-t.y,3))+"_"+rd(i.z-t.z,3)+"&"+(rd(r.x-t.x,3)+"_"+rd(r.y-t.y,3))+"_"+rd(r.z-t.z,3);if(rg[n])return{data:rg[n],interval:t};for(var o=[],a=null,s=0,u=0,c=0;c<300;c+=1){var h=new eJ,l=c/299;u=0,h.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),h.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),h.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!==a&&(u+=Math.pow(h.x-a.x,2)+Math.pow(h.y-a.y,2)+Math.pow(h.z-a.z,2)),a=h,s+=u=Math.sqrt(u),o[c]={partialLength:u,point:h}}var f=new rv(o,s);return rg[n]=f,{data:f,interval:new eJ(t.x,t.y,t.z)}}(t,e,i,r),o=n.data,a=n.interval;this.lengthData=o,this.interval=a,this.totalLength=o.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(rf(1-t,0))return e.points[299].point.clone().add(this.interval);if(rf(e.totalLength,0))return this.p1.clone();var i=new eJ,r=rd(e.totalLength*t,4),n=this.catching.lastAddedLength,o=this.catching.lastPoint;if(rf(n,r))return e.points[o].point.clone().add(this.interval);var a=!0,s=1;for(r<n&&(s=-1);a;){if(r>=n){if(299===o){i.x=e.points[o].point.x,i.y=e.points[o].point.y,i.z=e.points[o].point.z;break}if(r<n+e.points[o+1].partialLength){var u=(r-n)/e.points[o+1].partialLength;i.x=e.points[o].point.x+(e.points[o+1].point.x-e.points[o].point.x)*u,i.y=e.points[o].point.y+(e.points[o+1].point.y-e.points[o].point.y)*u,i.z=e.points[o].point.z+(e.points[o+1].point.z-e.points[o].point.z)*u;break}}s>0&&o<299?(o+=s,n+=rd(e.points[o].partialLength,5)):s<0&&o>0?(n-=rd(e.points[o].partialLength,5),o+=s):a=!1}return this.catching.lastPoint=o,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),rE=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new e$,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):rf(1-t,0)?this.temp.copyFrom(this.p2):(rS.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),r_=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(),rx(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=rx(.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,o=rT(n,this.mX1,this.mX2);return o>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var o=rT(e,i,r);if(0===o)break;var a=rx(e,i,r)-t;e-=a/o}return e}(t,n,this.mX1,this.mX2):0===o?n:function(t,e,i,r,n){var o,a,s=0;do(o=rx(a=e+(i-e)/2,r,n)-t)>0?i=a:e=a;while(Math.abs(o)>1e-7&&++s<10);return a}(t,i,i+.1,this.mX1,this.mX2)},t}();function rC(t,e){var i,r,n,o=function(t,e,i){var r=t[1],n=rm.isHoldOutKeyframe(t),o=rm.isHoldInKeyframe(e),a=!o&&rm.isRightSideEase(t),s=!n&&rm.isLeftSideEase(e);if(a&&!s&&!o){var u=new eK(r[r.length-4],r[r.length-3]),c=new eK(r[r.length-2],r[r.length-1]),h=rm.getPointInCurve(e),l=new eK(h.x,h.y),f=new eK(l.x-(l.x-u.x)/10,l.y);return{type:"ease",p0:u,p1:c,p2:f,p3:l}}if(!a&&s&&!n){var d=e[1],p=rm.getPointInCurve(t),m=new eK(p.x,p.y),v=new eK(d[0],d[1]),y=new eK(d[2],d[3]),g=new eK(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(a&&s){var x=e[1];return{type:"ease",p0:new eK(r[r.length-4],r[r.length-3]),p1:new eK(r[r.length-2],r[r.length-1]),p2:new eK(x[0],x[1]),p3:new eK(x[2],x[3])}}var T=rm.getPointInCurve(t),b=rm.getPointInCurve(e);if(n?b.y=T.y:o&&(T.y=b.y),!i)return{type:"line",p0:T,p1:b,isHold:n||o,leftHoldLine:n,rightHoldLine:o};var E=new eK((b.x-T.x)/3+T.x,(b.y-T.y)/3+T.y),_=new eK((b.x-T.x)/3*2+T.x,(b.y-T.y)/3*2+T.y);return{type:"ease",p0:T,p1:E,p2:_,p3:b,isHold:n||o,leftHoldLine:n,rightHoldLine:o}}(t,e,!0),a=o.p0,s=o.p1,u=o.p2,c=o.p3;eS(u),eS(c);var h=c.x-a.x,l=c.y-a.y,f=rd((s.x-a.x)/h,5),d=rd((u.x-a.x)/h,5);rf(l,0)?i=r=NaN:(i=rd((s.y-a.y)/l,5),r=rd((u.y-a.y)/l,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",a,s,u,c),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",a,s,u,c),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",a,s,u,c),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",a,s,u,c),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return ry[p]?n=ry[p]:(n=new r_(f,i,d,r),ry[p]=n),{points:[a,s,u,c],timeInterval:h,valueInterval:l,curve:n}}var rS=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,o=e.y,a=e.z,s=e.w,u=i.x,c=i.y,h=i.z,l=i.w;if(0===r){t.x=n,t.y=o,t.z=a,t.w=s;return}if(1===r){t.x=u,t.y=c,t.z=h,t.w=l;return}if(s!==l||n!==u||o!==c||a!==h){var f=1-r,d=n*u+o*c+a*h+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,o=o*f+c*g,a=a*f+h*g,s=s*f+l*g,f===1-r){var x=1/Math.sqrt(n*n+o*o+a*a+s*s);n*=x,o*=x,a*=x,s*=x}}t.x=n,t.y=o,t.z=a,t.w=s},t}(),rA="not_implement",rw=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(rA)},e.getIntegrateValue=function(t,e,i){throw Error(rA)},e.getIntegrateByTime=function(t,e){throw Error(rA)},e.getValue=function(t){throw Error(rA)},e.getMaxTime=function(){throw Error(rA)},e.toUniform=function(t){throw Error(rA)},e.map=function(t){throw Error(rA)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(rA)},t.getAllData=function(t,e){for(var i=new(e?ri:Float32Array)(4*t.index),r=0,n=0,o=t.curves;r<o.length;r++){var a=o[r].toData();i.set(a,n),n+=a.length}return e?i.data:i},t}(),rO=function(t){function e(){return t.apply(this,arguments)}eX(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}(rw),rR=function(t){function e(){return t.apply(this,arguments)}eX(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}(rw),rI=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){return eF(this.min,this.max)},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}(rw),rM=function(t){function e(){return t.apply(this,arguments)}eX(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 o=Math.random();r[n]=e[n]*(1-o)+i[n]*o}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(rw),rL=function(t){function e(){return t.apply(this,arguments)}eX(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,o=this.xCoord*i;return((r+e/o*(n-r)+r)*e-(r+t/o*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return rG(e,0,this.xCoord,this.min,this.max)-rG(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}(rw),rP=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=ep(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],o=e[r+1];if(n.stop<=t&&o.stop>t){var a=(t-n.stop)/(o.stop-n.stop);return em(n.color,o.color,a,!0)}}return e[i].color.slice()},e}(rw),rV=function(t){function e(){return t.apply(this,arguments)}eX(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],o=e[r+1],a=n[0],s=o[0];if(t>=a&&t<=s){var u=(t-a)/(s-a),c=n[1];return c+u*(o[1]-c)}}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,o=e?rG:rB,a=0;a<n;a++){var s=i[a],u=i[a+1],c=s[0],h=u[0];if(t>c&&t<=h)return r+o(t,c,h,s[1],u[1]);r+=o(h,c,h,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}(rw),rF=function(t){function e(){return t.apply(this,arguments)}eX(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=rC(t[e],t[e+1]),r=i.points,n=i.curve,o=i.timeInterval,a=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:o,valueInterval:a,curve:n}}},i.getValue=function(t){var e=0,i=Object.keys(this.curveMap),r=Number(i[0].split("&")[0]),n=Number(i[i.length-1].split("&")[1]);if(t<=r)return this.getCurveValue(i[0],r);if(t>=n)return this.getCurveValue(i[i.length-1],n);for(var o=0;o<i.length;o++){var a=i[o].split("&"),s=a[0],u=a[1];if(t>=Number(s)&&t<Number(u)){e=this.getCurveValue(i[o],t);break}}return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,o=Object.keys(this.curveMap);if(r<=Number(o[0].split("&")[0]))return 0;for(var a=0;a<o.length;a++){var s=o[a].split("&"),u=s[0],c=s[1];if(r>=Number(c)&&(n+=i*this.getCurveIntegrateValue(o[a],Number(c))),r>=Number(u)&&r<Number(c)){n+=i*this.getCurveIntegrateValue(o[a],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,o=i.valueInterval,a=0,s=(e-r.x)/20,u=0;u<=20;u++){var c=u*s/n,h=r.y+o*i.curve.getValue(c);0===u||20===u?a+=h:u%2==1?a+=4*h:a+=2*h}return s/3*a},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,o=i.valueInterval,a=(e-r.x)/n,s=i.curve.getValue(a);return r.y+o*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=Object.keys(this.curveMap);return Number(t[t.length-1].split("&")[1])},e}(rw),rN=function(t){function e(){return t.apply(this,arguments)}eX(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],o=e[r+1];if(n[0]<=t&&o[0]>=t){var a=o[1]-n[1],s=void 0;return s=0===a?(t-n[0])/(o[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,o=i[2]*r,a=(t-e[0])/r,s=a*a,u=s*a;return(2*u-3*s+1)*e[1]+(u-2*s+a)*n+(u-s)*o+(-2*u+3*s)*i[1]}(t,n,o)-n[1])/a,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],o=0;o<i.length;o++)n[o]=i[o]*(1-e)+r[o]*e;return n},e}(rw),rD=function(t){function e(){return t.apply(this,arguments)}eX(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 o=e[n],a=e[n+1],s=new eJ(i[n][0],i[n][1],i[n][2]),u=new eJ(i[n+1][0],i[n+1][1],i[n+1][2]),c=new eJ(r[2*n][0],r[2*n][1],r[2*n][2]),h=new eJ(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),l=rC(o,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new rb(s,u,c,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=rd(t,5),i=0,r=new eJ,n=Object.keys(this.curveSegments);if(!n.length)return r;var o=Number(n[0].split("&")[0]),a=Number(n[n.length-1].split("&")[1]);if(e<=o)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<n.length;s++){var u=n[s].split("&"),c=u[0],h=u[1];if(e>=Number(c)&&e<Number(h)){var l=this.curveSegments[n[s]].pathCurve;i=this.getPercValue(n[s],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,o=rd((e-r.x)/n,4);return eQ(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(rw),rz=function(t){function e(){return t.apply(this,arguments)}eX(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 o=e[n],a=e[n+1],s=e$.fromArray(i[n]),u=e$.fromArray(i[n+1]),c=e$.fromArray(r[2*n]),h=e$.fromArray(r[2*n+1]),l=rC(o,a),f=l.points,d=l.curve,p=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new rE(s,u,c,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=rd(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),o=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=o)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<r.length;a++){var s=r[a].split("&"),u=s[0],c=s[1];if(i>=Number(u)&&i<Number(c)){var h=this.curveSegments[r[a]].pathCurve;return e=this.getPercValue(r[a],i),h.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,o=rd((e-r.x)/n,4);return eQ(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(rw),rk=((tQ={})[tA.RANDOM]=function(t){return ee(t[0],Array)?new rM(t):new rI(t)},tQ[tA.CONSTANT]=function(t){return new rO(t)},tQ[tA.CONSTANT_VEC2]=function(t){return new rO(t)},tQ[tA.CONSTANT_VEC3]=function(t){return new rO(t)},tQ[tA.CONSTANT_VEC4]=function(t){return new rO(t)},tQ[tA.RGBA_COLOR]=function(t){return new rO(t)},tQ[tA.COLORS]=function(t){return new rR(t.map(function(t){return ef(t,!1)}))},tQ[tA.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new rL([t[0][1],t[1][1]]):new rV(t)},tQ[tA.GRADIENT_COLOR]=function(t){return new rP(t)},tQ[tA.LINEAR_PATH]=function(t){return new rN(t)},tQ[tA.BEZIER_CURVE]=function(t){return 1===t.length?new rO(t[0][1][1]):new rF(t)},tQ[tA.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new rO(rp(eJ,[].concat(t[1][0]))):new rD(t)},tQ[tA.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new rO(rp(e$,[].concat(t[1][0]))):new rz(t)},tQ);function rU(t){if(!t||!isNaN(+t))return new rO(t||0);if(ee(t,rw))return t;if(eL(rk[t[0]]))return rk[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+iE["ValueType: 21/22 is not supported"]+".")}function rB(t,e,i,r,n){var o=t-e;return(r+r+(n-r)*o/(i-e))*o/2}function rG(t,e,i,r,n){var o=t*t,a=e*e;return(o*t*2*(r-n)+3*o*(e*n-i*r)-a*e*(2*r+n)+3*a*i*r)/(6*(e-i))}function rX(t,e){if(e){var i=e[0],r=e[1];if(i===tA.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===tA.LINE){var o=r.length;if(2===o&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&o++,r[r.length-1][0]<1&&o++;var a=Math.ceil(o/2);t.lineSegCount+=a,t.curves.push(r),t.index+=a,t.max=Math.max(t.max,a)}else if(i===tA.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 rj(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}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,(Q=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",Q.GLSL3="300 es";var rH=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return eX(e,t),e}(e7);t.Shader=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=eH(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(e7),t.Shader=er([e6("Shader")],t.Shader);var rW="effects-internal-copy",rY="effects-internal-copy-mesh",rZ="\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}",rq="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 rQ(e,i){return{name:rW,vertex:rZ,fragment:rq,glslVersion:2===e?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!i]],cacheId:rY+ +i}}var rK={format:iC.RGBA,type:iC.UNSIGNED_BYTE,minFilter:iC.LINEAR,magFilter:iC.LINEAR,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE},rJ=Symbol("dispose"),r$=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,o=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:o},s=[o];Object.getOwnPropertyNames(rK).forEach(function(t){var i,r=null!=(i=e[t])?i:rK[t];a[t]=r,s.push(t,r)});var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var h=this.engine;eS(h),c=i$.create(h,a),this.textureCache[u]=c,this.textureRef[u]=1,c[rJ]=c.dispose,c.dispose=function(){return i.removeTexture(u)}}return c},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[rJ](),i.dispose=i[rJ]),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[rJ](),i.dispose=i[rJ]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),r0=function(){function t(t){void 0===t&&(t={}),this.semantics=iM({},t)}var e=t.prototype;return e.toObject=function(){return iM({},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 eL(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}(),r1=((tK={})[iC.FLOAT]=Float32Array.BYTES_PER_ELEMENT,tK[iC.INT]=Int32Array.BYTES_PER_ELEMENT,tK[iC.SHORT]=Int16Array.BYTES_PER_ELEMENT,tK[iC.BYTE]=Int8Array.BYTES_PER_ELEMENT,tK),r2=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(e7);function r3(t){return t===iC.INT?new Int32Array(0):t===iC.SHORT?new Int16Array(0):new Float32Array(0)}var r4=1,r5=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,o=i.geometry,a=i.name,s=i.priority,u=i.worldMatrix,c=void 0===u?e0.fromIdentity():u;r.id="Mesh"+r4++,r.name=void 0===a?"<unnamed>":a,r.geometry=o,r.material=n,r.priority=void 0===s?0:s,r.worldMatrix=c}else r.id="Mesh"+r4++,r.name="<unnamed>",r.worldMatrix=e0.fromIdentity(),r._priority=0;return r}eX(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)}},eB(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ii);t.RenderPassAttachmentStorageType=void 0,(K=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[K.none=0]="none",K[K.color=1]="color",K[K.stencil_8_opaque=2]="stencil_8_opaque",K[K.depth_16_opaque=3]="depth_16_opaque",K[K.depth_stencil_opaque=4]="depth_stencil_opaque",K[K.depth_16_texture=5]="depth_16_texture",K[K.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(J=t.TextureStoreAction||(t.TextureStoreAction={}))[J.store=0]="store",J[J.clear=2]="clear";var r6=function(){function e(e,i){if(this.destroyed=!1,i){var r=i.texture,n=i.size;if(ee(r,i$))this.texture=r,this.externalTexture=!0;else if(r){var o=r.wrapT,a=r.wrapS,s=r.minFilter,u=r.magFilter,c=r.internalFormat,h=r.format,l=void 0===h?iC.RGBA:h,f=r.type,d=void 0===f?iC.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:l,type:d,internalFormat:c||l,wrapT:o,wrapS:a,minFilter:s,magFilter:u,name:i.name},this.texture=i$.create(e,iM({},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)},eB(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,($=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[$.force=0]="force",$[$.keep=1]="keep",$[$.keepExternal=2]="keepExternal",$[$.destroy=0]="destroy";var r8=1,r9=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+r8++:r,o=i.clearAction,a=i.semantics,s=i.depthStencilAttachment,u=i.storeAction,c=i.priority,h=i.meshOrder,l=void 0===h?t.OrderType.ascending:h,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===c?0:c,this.meshOrder=l,this.meshes=eE((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=iM({},o),this.storeAction=iM({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new r0(a),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){e_(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){eh(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),eE(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],o=e[3];t.setViewport(i,r,n,o)}},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 r6(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 o=this.viewportScale,a=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*o,r.getHeight()*o],s=[a[2],a[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var c=n.attachments.map(function(t,e){var r;return new r6(i.renderer.engine,iM({size:s,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=c;var h=nw.create({storeAction:this.storeAction,name:u,viewport:a,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:c.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);h.bind(),h.unbind(),this.framebuffer=h}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 o=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===o||1===o||t.dispose()}),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:0,s=this.framebuffer;s&&(s.dispose({depthStencilAttachment:a}),s.externalStorage&&2===a||1===a||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=eN}},eB(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}(),r7="#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);}",nt="precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\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(0.0,texParams.y,texParams.x);vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",ne="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;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.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",ni="#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",nr="#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 vec3 aVel;attribute vec3 aRot;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;\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 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform 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;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}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\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void 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\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\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}}",nn="#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}",no="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",na="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*=hdrColor.a;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));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",ns="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",nu="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",nc="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);}",nh="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);}",nl={},nf=function(){function e(){}return e.registerInclude=function(t,e){nl[t]&&eO.warn('The "'+t+'" shader include already exist.'),nl[t]=e},e.unRegisterInclude=function(t){delete nl[t]},e.unRegisterAllIncludes=function(){Object.keys(nl).forEach(function(t){e.unRegisterInclude(t)})},e.genFinalShaderCode=function(i){var r=i.level,n=i.shaderType,o=i.shader,a=i.macros,s=i.removeVersion,u=e.genMacroString(r,a),c=e.genShaderVersion(r),h=e.parseIncludes(o),l=e.isVersion300(h);return(h=e.removeWebGLVersion(h),2!==r||l||(h=e.convertTo300(h,n===t.ShaderType.fragment)),s)?u+h:c+u+h},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=nl[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 o=e[n].match(/\bgl_FragData\[(.+?)\]/);o&&i.add(o[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}(),nd=function(e){function i(i,r){var n,o=(n=e.call(this,i,r)||this).renderer.engine,a=r2.create(o,{mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=rt.create(o,{shader:{vertex:no,fragment:nh,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=r5.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}eX(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=e.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",i),e.renderMeshes([this.screenMesh])},i}(r9),np=function(e){function i(i,r,n){(o=e.call(this,i,n)||this).type=r;var o,a=o.renderer.engine,s="PostProcess",u=r2.create(a,{name:s,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:no,fragment:"H"==r?ns:nu,glslVersion:t.GLSLVersion.GLSL1},h=rt.create(a,{name:s,shader:c});return h.blending=!1,h.depthTest=!1,h.culling=!1,o.screenMesh=r5.create(a,{name:s,geometry:u,material:h,priority:0}),o.priority=5e3,o}eX(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",nT(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(r9),nm=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",o=r.renderer.engine,a=r2.create(o,{name:n,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=rt.create(o,{name:n,shader:{vertex:no,fragment:nc}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=r5.create(o,{name:n,geometry:a,material:s,priority:0}),r.priority=5e3,r}eX(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",nT(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(r9),nv=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=r||new r6(a);var s=r2.create(a,{name:o,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=rt.create(a,{name:o,shader:{vertex:no,fragment:na,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=r5.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}eX(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=i.useBloom,n=i.bloomIntensity,o=i.brightness,a=i.saturation,s=i.contrast,u=i.useToneMapping,c=i.vignetteIntensity,h=i.vignetteSmoothness,l=i.vignetteRoundness;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",o),this.screenMesh.material.setFloat("_Saturation",a),this.screenMesh.material.setFloat("_Contrast",s),this.screenMesh.material.setInt("_UseBloom",Number(r)),r&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",n)),c>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",c),this.screenMesh.material.setFloat("_VignetteSmoothness",h),this.screenMesh.material.setFloat("_VignetteRoundness",l),this.screenMesh.material.setVector2("_VignetteCenter",new eK(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new eJ(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(u)),e.renderMeshes([this.screenMesh])},i}(r9),ny="_effects_default_",ng=1,nx=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i,r,n=e.camera,o=e.keepColorBuffer,a=e.renderer,s=e.editorTransform,u=e.globalVolume,c=e.clearAction,h=void 0===c?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:c,l=a.engine;u&&(this.globalVolume=u),this.globalUniforms=new nE;var f=[],d={};if(this.renderer=a,this.globalVolume){var p=this.globalVolume.useHDR?iC.HALF_FLOAT:iC.UNSIGNED_BYTE;f=[{texture:{format:iC.RGBA,type:p,magFilter:iC.LINEAR,minFilter:iC.LINEAR}}],r={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},d={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var m=[new r9(a,{name:ny,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:r,attachments:f,clearAction:d})];if(this.setRenderPasses(m),this.globalVolume){var v=new r6(l),y=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],g=Array(7),x=this.globalVolume.useHDR?iC.HALF_FLOAT:iC.UNSIGNED_BYTE,T=new nd(a,{name:"BloomThresholdPass",attachments:[{texture:{format:iC.RGBA,type:x,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]});T.sceneTextureHandle=v,this.addRenderPass(T);for(var b=0;b<7;b++){g[b]=new r6(l);var E=new np(a,"H",{name:"GaussianDownPassH"+b,viewport:y,attachments:[{texture:{format:iC.RGBA,type:x,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]}),_=new np(a,"V",{name:"GaussianDownPassV"+b,viewport:y,attachments:[{texture:{format:iC.RGBA,type:x,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]});_.gaussianResult=g[b],this.addRenderPass(E),this.addRenderPass(_),y[2]/=2,y[3]/=2}y[2]*=4,y[3]*=4;for(var C=0;C<6;C++){var S=new nm(a,{name:"GaussianUpPass"+C,viewport:y,attachments:[{texture:{format:iC.RGBA,type:x,minFilter:iC.LINEAR,magFilter:iC.LINEAR}}]});S.gaussianDownSampleResult=g[5-C],this.addRenderPass(S),y[2]*=2,y[3]*=2}var A=new nv(a,v);this.addRenderPass(A)}this.semantics=new r0(e.semantics),this.clearAction=h,this.name="RenderFrame"+ng++;var w=m[0];this.emptyTexture=i2(l),this.transparentTexture=i3(l),this.camera=n,this.keepColorBuffer=o,this.renderPassInfoMap.set(w,{listStart:0,listEnd:0,renderPass:w,intermedia:!1}),this.editorTransform=ip.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new r$(l);var O=l.gpuCapability,R=O.detail,I=rQ(O.level,R.readableDepthStencilTextures&&R.writableFragDepth);null==(i=this.renderer.getShaderLibrary())||i.addShader(I)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},i.removeMeshFromDefaultRenderPass=function(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,o=e;o<t.length;o++){var a,s,u,c=t[o],h=null==(s=c.attachments[0])?void 0:s.texture;if(h&&a===h){var l=h===r?n:r;c.resetColorAttachments([l])}(h=null==(u=c.attachments[0])?void 0:u.texture)&&(a=h)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(ny)&&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,o=r.persistent,a=n.format,s=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(a===iC.RGBA&&!o){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,o=r.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?iC.LINEAR:iC.NEAREST,c=i$.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iC.RGBA,name:"frame_a",minFilter:u,magFilter:u}),h=i$.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iC.RGBA,data:{width:a,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 r9(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:c}]}).initialize(this.renderer),d=new nb(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:h,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e,i=this.renderer.engine,r=r2.create(i,{name:rW,mode:iC.TRIANGLE_STRIP,attributes:{aPos:{type:iC.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=rQ(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(n);var o=rt.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:rW,shader:n});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==t?void 0:t.blend)&&(o.blending=!0,o.blendFunction=[iC.SRC_ALPHA,iC.ONE_MINUS_SRC_ALPHA,iC.SRC_ALPHA,iC.ONE_MINUS_SRC_ALPHA]),r5.create(i,{name:rW,geometry:r,material:o,priority:0})},i.removeRenderPass=function(t){eh(this._renderPasses,t)},eB(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function nT(t){return t?new eK(t.getWidth(),t.getHeight()):new eK}var nb=function(t){function e(){return t.apply(this,arguments)}eX(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",nT(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(r9),nE=function(){this.floats={},this.ints={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},n_=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 eB(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),nC="function"==typeof WebGL2RenderingContext,nS=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=nC&&ee(t,WebGL2RenderingContext)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),a=!!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"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),r&&!a&&(a=nA(t,t.HALF_FLOAT)),r&&!s&&(s=nA(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,c=r?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,h={floatTexture:u,halfFloatTexture:c,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"):c>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:a,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:!!t.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!o,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=h,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&i>0)throw Error("Draw multiple color buffers not available.");var a=o?o["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];a?t.framebufferTexture2D(e,a,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 nA(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,(tt=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[tt.NONE=0]="NONE",tt[tt.PVRTC=1]="PVRTC",tt[tt.ASTC=2]="ASTC",t.FilterMode=void 0,(te=t.FilterMode||(t.FilterMode={}))[te.Nearest=0]="Nearest",te[te.Linear=1]="Linear",t.RenderTextureFormat=void 0,(ti=t.RenderTextureFormat||(t.RenderTextureFormat={}))[ti.RGBA32=0]="RGBA32",ti[ti.RGBAHalf=1]="RGBAHalf";var nw=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){},eB(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),nO=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=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,o){return null},e.dispose=function(t){},t}(),nR=1,nI=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),o=this.createGeometry();this.mesh=this.createMesh(o,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 eJ,n=new e$,o=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,o),e.x=o.x,e.y=o.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)===ib]],n=rU(this.color).getValue(0),o={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"}},a=rt.create(this.engine,o);return a.blending=!0,a.depthTest=!1,a.setVector4("uPos",new ip(0,0,0,0)),a.setVector2("uSize",new eK(1,1)),a.setVector4("uColor",new ip(n[0]/255,n[1]/255,n[2]/255,n[3])),a.setQuaternion("uQuat",new e$(0,0,0,0)),a},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return r2.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:iC.LINES,maxVertex:4})},i.createMesh=function(t,e){return r5.create(this.engine,{name:"Interact_preview"+nR++,priority:0,worldMatrix:e0.fromIdentity(),geometry:t,material:e})},e}();function nM(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}function nL(t){var e=t.renderer,i=e.blending,r=e.side,n=e.occlusion,o=e.mask,a=e.maskMode,s=e.order,u=t.cachePrefix||"-";return{side:r,occlusion:n,blending:i,mask:o,maskMode:a,cachePrefix:u,cacheId:u+"."+ +r+"+"+ +n+"+"+ +i+"+"+s+"+"+a+"."+o}}function nP(e,i){var r=null!=i?i:{},n=r.env,o=r.wireframe,a=[["ENV_EDITOR",(void 0===n?"":n)===ib]];return{fragment:o?r7:ne,vertex:nt,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,macros:a,shared:!0}}function nV(t,e){return t.cachePrefix+"_effects_sprite_"+e}function nF(t,e,i,r){var n=t.wireframe,o=nP(i,{wireframe:n,env:r});return o.shared=!0,n||(o.cacheId=nV(t,e)),o}function nN(e){t.maxSpriteMeshItemCount=e}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.downgrade=.95,t.dragRatio=[1,1],t._interactive=!0,t.hasBeenAddedToComposition=!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}eX(i,e);var r=i.prototype;return r.start=function(){var t=this,e=this.item.props.content.options,i=this.item.engine.renderer.env,r=this.item.composition,n=this.interactData.options,o=n.type,a=n.showPreview;if(o===ty.CLICK&&(this.clickable=!0,a&&i===ib)){var s=null==r?void 0:r.getRendererOptions();void 0!==s&&(this.previewContent=new nI(this.item.props.content,s,this.transform,this.engine))}e.type===ty.DRAG&&(i!==ib||e.enableInEditor)&&(null==r?void 0:r.event)&&this.beginDragTarget(e,r.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams,this.item.onEnd=function(){if(t.item&&t.item.composition){var e;t.item.composition.removeInteractiveItem(t.item,t.item.props.content.options.type),t.clickable=!1,t.hasBeenAddedToComposition=!1,null==(e=t.previewContent)||e.mesh.dispose(),t.endDragTarget()}}},r.update=function(t){var e;if(null==(e=this.previewContent)||e.updateMesh(),!this.hasBeenAddedToComposition&&this.item.composition){var i=this.item.props.content.options;this.item.composition.addInteractiveItem(this.item,i.type),this.hasBeenAddedToComposition=!0}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,nM(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(){},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i=this.item.props.content.options,r=t.cameraParam,n=r.position,o=r.fov,a=e.dy,s=e.dx*e.width/e.height,u=n[2],c=Math.tan(o*Math.PI/180/2)*Math.abs(u),h=n[0]-this.dragRatio[0]*(s*c),l=n[1]-this.dragRatio[1]*(a*c);if(i.dxRange){var f,d=i.dxRange,p=d[0],m=d[1];(h=eQ(h,p,m))!==p&&h!==m&&p!==m&&(null==(f=e.origin)||f.preventDefault())}if(i.dyRange){var v,y=i.dyRange,g=y[0],x=y[1];(l=eQ(l,g,x))!==g&&l!==x&&g!==x&&(null==(v=e.origin)||v.preventDefault())}this.item.composition.camera.position=new eJ(h,l,u)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var o={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;!nM(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iM({},r)),r=null}}};Object.keys(o).forEach(function(t){e.addEventListener(t,o[t])}),o.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(o).forEach(function(t){e.removeEventListener(t,o[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=rl(eJ.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){e.prototype.fromData.call(this,t),this.interactData=t},r.canInteract=function(){var t;return!!(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},eB(i,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),i}(ii),t.InteractComponent=er([e6(tX.InteractComponent)],t.InteractComponent),t.maxSpriteMeshItemCount=8;var nD={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},nz=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return eX(i,e),i.precompile=function(e,i,r){var n=i.getShaderLibrary(),o=i.engine.gpuCapability,a=o.level,s=o.detail,u=(null!=r?r:{}).env;return(null==n?void 0:n.shaderResults[nV(nD,2)])||(null==n||n.addShader(nF(nD,2,1,u)),null==n||n.addShader(nF(nD,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&(null==n||n.addShader(rQ(a,!0)))),Promise.resolve()},i}(ir);function nk(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var nU=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=eH(this.playables);!(e=i()).done;){var r=e.value;this.updatePlayableTime(r,t)}for(var n,o=eH(this.playableOutputs);!(n=o()).done;)n.value.context.deltaTime=t;for(var a,s=eH(this.playableOutputs);!(a=s()).done;){var u=a.value;this.prepareFrameWithRoot(u)}for(var c,h=eH(this.playableOutputs);!(c=h()).done;){var l=c.value;this.processFrameWithRoot(l)}},e.connect=function(t,e,i,r){i.connectInput(r,t,e)},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrameRecursive(t.context,t.getSourceOutputPort()),t.processFrame()},e.prepareFrameWithRoot=function(t){t.sourcePlayable.prepareFrameRecursive(t.context,t.getSourceOutputPort()),t.prepareFrame()},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&(t.overrideTimeNextEvaluation?t.overrideTimeNextEvaluation=!1:t.setTime(t.getTime()+e))},t}(),nB=function(){function t(t,e){void 0===e&&(e=0),this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.overrideTimeNextEvaluation=!1,this.destroyed=!1,this.inputs=[],this.inputOuputPorts=[],this.inputWeight=[],this.outputs=[],this.playState=0,this.traversalMode=0,t.addPlayable(this),this.inputs=Array(e),this.inputOuputPorts=Array(e),this.inputWeight=Array(e)}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.connectInput=function(t,e,i,r){void 0===r&&(r=1),this.setInput(e,t),this.setInputWeight(t,r),e.setOutput(this,i),this.inputOuputPorts.length<t+1&&(this.inputOuputPorts.length=t+1),this.inputOuputPorts[t]=i},e.addInput=function(t,e,i){void 0===i&&(i=1),this.connectInput(this.getInputCount(),t,e,i)},e.getInputCount=function(){return this.inputs.length},e.getInputs=function(){return this.inputs},e.getInput=function(t){return this.inputs[t]},e.getOutputCount=function(){return this.outputs.length},e.getOutputs=function(){return this.outputs},e.getOutput=function(t){return this.outputs[t]},e.getInputWeight=function(t){return this.inputWeight[t]},e.setInputWeight=function(e,i){if(ee(e,t)){for(var r=0;r<this.inputs.length;r++)if(this.inputs[r]===e){this.inputWeight[r]=i;return}}else this.inputWeight.length<e+1&&(this.inputWeight.length=e+1),this.inputWeight[e]=i},e.setTime=function(t){this.time=t,this.overrideTimeNextEvaluation=!0},e.getTime=function(){return this.time},e.getPlayState=function(){return this.playState},e.setTraversalMode=function(t){this.traversalMode=t},e.getTraversalMode=function(){return this.traversalMode},e.onPlayablePlay=function(t){},e.onPlayablePause=function(t){},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},e.prepareFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState)switch(this.onPlayablePlayFlag&&(this.onPlayablePlay(t),this.onPlayablePlayFlag=!1),this.onPlayablePauseFlag&&(this.onPlayablePause(t),this.onPlayablePauseFlag=!1),0===e&&this.prepareFrame(t),this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).prepareFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).prepareFrameRecursive(t,this.inputOuputPorts[e])}},e.processFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState){switch(this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).processFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).processFrameRecursive(t,this.inputOuputPorts[e])}this.processFrame(t)}},e.setOutput=function(t,e){this.outputs.length<e+1&&(this.outputs.length=e+1),this.outputs[e]=t},e.setInput=function(t,e){this.inputs.length<e+1&&(this.inputs.length=e+1),this.inputs[e]=t},t}(),nG=function(){function t(){this.sourceOutputPort=0,this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayeble=function(t,e){void 0===e&&(e=0),this.sourcePlayable=t,this.sourceOutputPort=e},e.getSourceOutputPort=function(){return this.sourceOutputPort},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),nX=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(e7);(tr=tJ||(tJ={}))[tr.Playing=0]="Playing",tr[tr.Paused=1]="Paused",(tn=t$||(t$={}))[tn.Mix=0]="Mix",tn[tn.Passthrough=1]="Passthrough";var nj=[[0,0,1,1,void 0]],nH=[1,1,1,1],nW=0,nY=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}eX(i,e);var r=i.prototype;return r.processFrame=function(e){var i,r,n=e.output.getUserData();if(ee(n,t.VFXItem)){if(!this.spriteMaterial){this.spriteMaterial=n.getComponent(t.SpriteComponent).material;var o=this.spriteMaterial.getVector4("_Color");o&&(this.startColor=o.toArray())}var a=rs(nH,1),s=this.time/n.duration,u=this.opacityOverLifetime,c=this.colorOverLifetime;c&&(a=ed(c,s,!0),i=!0),u&&(a[3]*=u.getValue(s),i=!0),i&&(ru(this.renderColor,a,this.startColor),null==(r=this.spriteMaterial.getVector4("_Color"))||r.setFromArray(this.renderColor))}},r.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=rU(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tA.GRADIENT_COLOR&&(this.colorOverLifetime=ep(i.color[1]))),this},i}(nB);t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new nY(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(nX),t.SpriteColorPlayableAsset=er([e6("SpriteColorPlayableAsset")],t.SpriteColorPlayableAsset),t.SpriteComponent=function(e){function i(t,i){(r=e.call(this,t)||this).cachePrefix="-",r.frameAnimationLoop=!1,r.frameAnimationTime=0,r.color=[1,1,1,1],r.visible=!0,r.getHitTestParams=function(t){var e=r.interaction;if(t||e){var i,n=r.getBoundingBox();if(n)return{behavior:(null==(i=r.interaction)?void 0:i.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:r.renderer.side===td.FRONT}}},r.name="MSprite"+nW++,r.renderer={renderMode:tT.BILLBOARD,blending:tf.ALPHA,texture:r.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:td.DOUBLE,mask:0,maskMode:tp.NONE,order:0},r.emptyTexture=r.engine.emptyTexture,r.splits=nj,r.renderInfo=nL(nk(r));var r,n=r.createGeometry(iC.TRIANGLES),o=r.createMaterial(r.renderInfo,2);return r.worldMatrix=e0.fromIdentity(),r.material=o,r.geometry=n,r.material.setVector4("_Color",new ip().setFromArray([1,1,1,1])),r.material.setVector4("_TexOffset",new ip().setFromArray([0,0,1,1])),r.setItem(),i&&r.fromData(i),r}eX(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){this.color=t,this.material.setVector4("_Color",new ip().setFromArray(t))},r.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("uSampler0",t)},r.render=function(t){if(this.getVisible()){var e=this.material,i=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),t.drawGeometry(i,e)}},r.start=function(){this.item.getHitTestParams=this.getHitTestParams,this.item.endBehavior===tO.restart&&(this.frameAnimationLoop=!0)},r.update=function(t){this.frameAnimationTime+=t/1e3;var e=this.frameAnimationTime,i=this.item.duration;e>i&&this.frameAnimationLoop&&(e%=i);var r=Math.min(Math.max(e/i,0),1),n=this.textureSheetAnimation;if(n){var o,a,s,u,c,h=n.total||n.row*n.col,l=0,f=0,d=1,p=1;if(this.splits){var m=this.splits[0];a=m[4],l=m[0],f=m[1],a?(d=m[3],p=m[2]):(d=m[2],p=m[3])}if(a?(s=1/n.row*d,u=1/n.col*p):(s=1/n.col*d,u=1/n.row*p),n.animate){var v=Math.round(r*(h-1)),y=Math.floor(v/n.col),g=v-y*n.col;c=a?[s*y,u*(n.col-g)]:[s*g,u*(1+y)]}else c=[0,u];null==(o=this.material.getVector4("_TexOffset"))||o.setFromArray([l+c[0],p+f-c[1],s,u])}},r.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},r.getItemInitData=function(){this.geoData=this.getItemGeometryData();var t=this.geoData,e=t.index,i=t.atlasOffset,r=e.length,n=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new e.constructor(r);if(!this.wireframe)for(var o=0;o<r;o++)n[o]=0+e[o];return{atlasOffset:i,index:n}},r.setItem=function(){var e=[],i=this.renderer.texture;i&&ec(e,i),i=this.renderer.texture;var r=this.getItemInitData(),n=this.renderer,o=this.material.getVector4("_TexParams");o&&(o.x=n.occlusion?+n.transparentOcclusion:1,o.y=+this.preMultiAlpha,o.z=n.renderMode);var a={atlasOffset:new Float32Array(r.atlasOffset.length),index:new Uint16Array(r.index.length)};a.atlasOffset.set(r.atlasOffset),a.index.set(r.index);var s=this.material,u=this.geometry,c=a.index;u.setIndexData(c),u.setAttributeData("atlasOffset",a.atlasOffset),u.setDrawCount(r.index.length);for(var h=0;h<e.length;h++){var l=e[h];s.setTexture("uSampler"+h,l)}for(var f=this.emptyTexture,d=e.length;d<t.maxSpriteMeshItemCount;d++)s.setTexture("uSampler"+d,f)},r.createGeometry=function(t){var e=12*this.splits.length;return r2.create(this.engine,{attributes:{aPos:{type:iC.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:iC.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},r.createMaterial=function(t,e){var i=t.side,r=t.occlusion,n=t.blending,o=t.maskMode,a=t.mask,s={shader:nF(t,e,1)};this.preMultiAlpha=iw(n);var u=rt.create(this.engine,s),c={side:i,blending:!0,blendMode:n,mask:a,maskMode:o,depthTest:!0,depthMask:r};return u.blending=c.blending,u.stencilRef=void 0!==c.mask?[c.mask,c.mask]:void 0,u.depthTest=c.depthTest,u.depthMask=c.depthMask,iO(u,c.blendMode),iI(u,c.maskMode),iR(u,c.side),u.shader.shaderData.properties='uSampler0("uSampler0",2D) = "white" {}',u.hasUniform("_Color")||u.setVector4("_Color",new ip(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new ip),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new ip),u},r.getItemGeometryData=function(){var t=this.splits,e=this.renderer,i=this.textureSheetAnimation;if(e.shape){for(var r=e.shape,n=r.index,o=r.aPoint,a=void 0===o?[]:o,s=new Float32Array(a),u=[],c=[],h=0;h<s.length;h+=6)s[h]*=1,s[h+1]*=1,c.push(a[h+2],a[h+3]),u.push(s[h],s[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(u)),{index:void 0===n?[]:n,atlasOffset:c}}var l=[],f=[],d=2,p=2;1===t.length&&(d=1,p=1);for(var m=[],v=0;v<d;v++)for(var y=0;y<p;y++){var g=(2*y+v)*4,x=i?[0,0,1,1,t[0][4]]:t[2*y+v],T=x[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],b=((v+v+1)/d-1)/2,E=((y+y+1)/p-1)/2,_=x[0],C=x[1],S=x[4]?x[3]:x[2],A=x[4]?x[2]:x[3],w=[-.5/d+b,.5/p+E,-.5/d+b,-.5/p+E,.5/d+b,.5/p+E,.5/d+b,-.5/p+E];l.push(T[0]*S+_,T[1]*A+C,T[2]*S+_,T[3]*A+C,T[4]*S+_,T[5]*A+C,T[6]*S+_,T[7]*A+C),m.push(1*w[0],1*w[1],0,1*w[2],1*w[3],0,1*w[4],1*w[5],0,1*w[6],1*w[7],0),f.push(g,1+g,2+g,2+g,1+g,3+g)}return this.geometry.setAttributeData("aPos",new Float32Array(m)),{index:f,atlasOffset:l}},r.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},r.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),i=rl(eJ.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){e.prototype.fromData.call(this,t);var i,r,n,o,a,s,u=t.interaction,c=t.options,h=t.listIndex,l=t.renderer;l||(l={}),this.interaction=u,this.renderer={renderMode:null!=(i=l.renderMode)?i:tT.BILLBOARD,blending:null!=(r=l.blending)?r:tf.ALPHA,texture:null!=(n=l.texture)?n:this.engine.emptyTexture,occlusion:!!l.occlusion,transparentOcclusion:!!l.transparentOcclusion||l.maskMode===tp.MASK,side:null!=(o=l.side)?o:td.DOUBLE,shape:l.shape,mask:null!=(a=l.mask)?a:0,maskMode:null!=(s=l.maskMode)?s:tp.NONE,order:void 0===h?0:h},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||nj,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=nL(this);var f=this.createGeometry(iC.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=e0.fromIdentity(),this.material=d,this.geometry=f;var p=c.startColor||[1,1,1,1];this.material.setVector4("_Color",new ip().setFromArray(p)),this.material.setVector4("_TexOffset",new ip().setFromArray([0,0,1,1])),this.setItem()},r.toData=function(){e.prototype.toData.call(this)},i}(ii),t.SpriteComponent=er([e6(tX.SpriteComponent)],t.SpriteComponent);var nZ="lookup_texture",nq="offscreen_canvas",nQ={},nK=new e$,nJ=1,n$=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new eJ(0,0,0),this.quat=new e$(0,0,0,1),this.rotation=new e1(0,0,0),this.scale=new eJ(1,1,1),this.anchor=new eJ(0,0,0),this.size=new eK(1,1),this.children=[],this.worldMatrix=e0.fromIdentity(),this.localMatrix=e0.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new eJ(0,0,0),quat:new e$(0,0,0,1),scale:new eJ(1,1,1)},this.name="transform_"+nJ++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,o=t.size,a=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(ee(i,eJ)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),a)ee(a,e$)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(r){var c=e?-1:1;ee(r,e1)?this.setRotation(r.x*c,r.y*c,r.z*c):this.setRotation(r[0]*c,r[1]*c,r[2]*c)}n&&(ee(n,eJ)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),u&&(ee(u,eK)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){ec(this.children,t)},e.removeChild=function(t){eh(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new e1)},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 e1)},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),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 eJ().copyFrom(t.position),rotation:new e1(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new eJ().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=nK.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},eB(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}(),n0=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=n1(this.arc,this.arcMode,t)*eW,i=new eJ(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*eW),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eF(0,1)),direction:n.normalize()}},t}();function n1(t,e,i){if(e===tM.RANDOM)t=eF(0,t);else if(e===tM.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tM.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),o=n-Math.floor(n);t*=Math.floor(n)%2?1-o:o}else e===tM.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var n2=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=n1(this.arc,this.arcMode,t)*eW,i=new eJ(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),n3=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eF(-this._d,this._d),i=eF(-this._h,this._h);return{direction:new eJ(0,0,1),position:new eJ(e,i,0)}},t}(),n4=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=n1(this.arc,this.arcMode,t)*eW,i=new eJ(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,o=Math.atan2(n,r),a=Math.tan(e),s=new eJ;return e<o?s.set(r,r*a,0):e>=o&&e<Math.PI-o?s.set(n/a,n,0):e<Math.PI+o?s.set(-r,-r*a,0):e<2*Math.PI-o?s.set(-n/a,-n,0):s.set(r,r*a,0),{direction:i,position:s}},t}(),n5=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tM.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eF(0,1);return{direction:new eJ(0,1,0),position:new eJ(this._d*(e-.5),0,0)}},t}(),n6=new e0,n8=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=eF(0,2*Math.PI),n=n1(this.arc,this.arcMode,t)*eW,o=n6.setFromRotationZ(n),a=new eJ(Math.cos(r),Math.sin(r),0),s=new eJ(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),n9=new e0,n7=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 eF(-90,90)},e.generate=function(t){var e=n1(this.arc,this.arcMode,t)*eW,i=this.getHorizontalAngle()*eW,r=this.radius,n=new eJ(Math.cos(i),0,Math.sin(i)),o=n9.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(r),direction:o}},t}(),ot=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.getHorizontalAngle=function(){return eF(0,90)},e}(n7),oe=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=eQ(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(n1(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,o=new eJ(r,n,0);return{position:new eJ(r*this.width,n*this.height,0),direction:o.normalize()}},t}(),oi=function(){function t(){}return t.prototype.generate=function(){return{position:new eJ,direction:new eJ}},t}(),or=((t0={})[tm.NONE]=oi,t0[tm.CONE]=n0,t0[tm.SPHERE]=n7,t0[tm.HEMISPHERE]=ot,t0[tm.CIRCLE]=n2,t0[tm.DONUT]=n8,t0[tm.RECTANGLE]=n3,t0[tm.EDGE]=n5,t0[tm.RECTANGLE_EDGE]=n4,t0[tm.TEXTURE]=oe,t0);function on(t){if(!t)return new oi;var e=iM({radius:1,arc:360,angle:0,arcMode:tM.RANDOM},t),i=t.type,r=or[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tm.NONE){var o=t.alignSpeedDirection,a=t.upDirection;n.alignSpeedDirection=o,n.upDirection=eJ.fromArray(void 0===a?[0,0,1]:a).normalize()}return n}function oo(t,e,i,r,n){var o,a;if(n===function(t,e,i,r){for(var n=0,o=e,a=i-r;o<i;o+=r)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,i,r)>0)for(o=e;o<i;o+=r)a=oy(o,t[o],t[o+1],a);else for(o=i-r;o>=e;o-=r)a=oy(o,t[o],t[o+1],a);return a&&ol(a,a.next)&&(og(a),a=a.next),a}function oa(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(ol(r,r.next)||0===oh(r.prev,r,r.next))){if(og(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function os(t,e){return t.x-e.x}function ou(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 oc(t,e,i,r,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(r-s)-(i-a)*(e-s)>=0&&(i-a)*(o-s)-(n-a)*(r-s)>=0}function oh(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ol(t,e){return t.x===e.x&&t.y===e.y}function of(t,e,i,r){var n=op(oh(t,e,i)),o=op(oh(t,e,r)),a=op(oh(i,r,t)),s=op(oh(i,r,e));return!!(n!==o&&a!==s||0===n&&od(t,i,e)||0===o&&od(t,r,e)||0===a&&od(i,t,r)||0===s&&od(i,e,r))}function od(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 op(t){return t>0?1:t<0?-1:0}function om(t,e){return 0>oh(t.prev,t,t.next)?oh(t,e,t.next)>=0&&oh(t,t.prev,e)>=0:0>oh(t,e,t.prev)||0>oh(t,t.next,e)}function ov(t,e){var i=new ox(t.i,t.x,t.y),r=new ox(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function oy(t,e,i,r){var n=new ox(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 og(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 ox(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 oT=0;function ob(t,e,i,r){i=i||2,oT=r||0;var n,o,a,s,u,c,h,l=e&&e.length,f=l?e[0]*i:t.length,d=oo(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(l&&(d=function(t,e,i,r){var n,o,a,s,u,c=[];for(n=0,o=e.length;n<o;n++)a=e[n]*r,s=n<o-1?e[n+1]*r:t.length,(u=oo(t,a,s,r,!1))===u.next&&(u.steiner=!0),c.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(c.sort(os),n=0;n<c.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,o=e,a=t.x,s=t.y,u=-1/0;do{if(s<=o.y&&s>=o.next.y&&o.next.y!==o.y){var c=o.x+(s-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(c<=a&&c>u){if(u=c,c===a){if(s===o.y)return o;if(s===o.next.y)return o.next}n=o.x<o.next.x?o:o.next}}o=o.next}while(o!==e);if(!n)return null;if(a===u)return n;var h,l=n,f=n.x,d=n.y,p=1/0;o=n;do a>=o.x&&o.x>=f&&a!==o.x&&oc(s<d?a:u,s,f,d,s<d?u:a,s,o.x,o.y)&&(h=Math.abs(s-o.y)/(a-o.x),om(o,t)&&(h<p||h===p&&(o.x>n.x||o.x===n.x&&(i=n,r=o,0>oh(i.prev,i,r.prev)&&0>oh(r.next,i,i.next))))&&(n=o,p=h)),o=o.next;while(o!==l);return n}(t,e)){var i=ov(e,t);oa(e,e.next),oa(i,i.next)}})(c[n],i),i=oa(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=a=t[0],o=s=t[1];for(var m=i;m<f;m+=i)u=t[m],c=t[m+1],u<n&&(n=u),c<o&&(o=c),u>a&&(a=u),c>s&&(s=c);h=0!==(h=Math.max(a-n,s-o))?1/h:0}return function t(e,i,r,n,o,a,s){if(e){!s&&a&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=ou(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,o,a,s,u,c=1;do{for(i=t,t=null,o=null,a=0;i;){for(a++,r=i,s=0,e=0;e<c&&(s++,r=r.nextZ);e++);for(u=c;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--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,c*=2}while(a>1)}(n)}(e,n,o,a);for(var u,c,h=e;e.prev!==e.next;){if(u=e.prev,c=e.next,a?function(t,e,i,r){var n=t.prev,o=t.next;if(oh(n,t,o)>=0)return!1;for(var a=n.x<t.x?n.x<o.x?n.x:o.x:t.x<o.x?t.x:o.x,s=n.y<t.y?n.y<o.y?n.y:o.y:t.y<o.y?t.y:o.y,u=n.x>t.x?n.x>o.x?n.x:o.x:t.x>o.x?t.x:o.x,c=n.y>t.y?n.y>o.y?n.y:o.y:t.y>o.y?t.y:o.y,h=ou(a,s,e,i,r),l=ou(u,c,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=l;){if(f!==t.prev&&f!==t.next&&oc(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&oh(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&oc(n.x,n.y,t.x,t.y,o.x,o.y,d.x,d.y)&&oh(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&oc(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&oh(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=l;){if(d!==t.prev&&d!==t.next&&oc(n.x,n.y,t.x,t.y,o.x,o.y,d.x,d.y)&&oh(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,o,a):function(t){var e=t.prev,i=t.next;if(oh(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(oc(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&oh(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+oT),i.push(e.i/r+oT),i.push(c.i/r+oT),og(e),e=c.next,h=c.next;continue}if((e=c)===h){s?1===s?t(e=function(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!ol(n,o)&&of(n,r,r.next,o)&&om(n,o)&&om(o,n)&&(e.push(n.i/i+oT),e.push(r.i/i+oT),e.push(o.i/i+oT),og(r),og(r.next),r=t=o),r=r.next}while(r!==t);return oa(r)}(oa(e),i,r),i,r,n,o,a,2):2===s&&function(e,i,r,n,o,a){var s=e;do{for(var u,c,h=s.next.next;h!==s.prev;){if(s.i!==h.i&&(u=s,c=h,u.next.i!==c.i&&u.prev.i!==c.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&&of(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,c)&&(om(u,c)&&om(c,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,c)&&(oh(u.prev,u,c.prev)||oh(u,c.prev,c))||ol(u,c)&&oh(u.prev,u,u.next)>0&&oh(c.prev,c,c.next)>0))){var l=ov(s,h);s=oa(s,s.next),l=oa(l,l.next),t(s,i,r,n,o,a),t(l,i,r,n,o,a);return}h=h.next}s=s.next}while(s!==e)}(e,i,r,n,o,a):t(oa(e),i,r,n,o,a,1);break}}}}(d,p,i,n,o,h),p}function oE(t,e){for(var i,r,n=t.s,o=t.p,a=n[1],s=o[1],u=0,c=0;c<a.length;c++)u+=a[c].length-1;var h,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=(h=d[4])?d[3]:d[2],g=h?d[2]:d[3]);for(var x=[0,0],T=0===h?0:-Math.PI/2,b=0;b<a.length;b++)for(var E=a[b],_=s[b],C=s[b+1]||s[0],S=[0,0],A=0;A<E.length-1;A++)(function(t,e,i,r,n,o,a,s){var u=1-e,c=u*u*u,h=3*e*u*u,l=3*e*e*u,f=e*e*e;t[0]=c*i[0]+h*n+l*a+f*r[0],t[1]=c*i[1]+h*o+l*s+f*r[1]})(S,E[A],_,C,_[4],_[5],C[2],C[3]),i=S[0],r=S[1],l[p++]=i/2,l[p++]=r/2,d?(x[0]=i,x[1]=r,oC(x,x,T),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=ob(Array.from(l),null,6,void 0===f?0:f);return{aPoint:l,index:new Uint16Array(w)}}function o_(t,e){for(var i,r=[],n=(i=[],t.gs?t.gs.forEach(function(t){i.push({p:[tA.SHAPE_POINTS,t.p],s:[tA.SHAPE_SPLITS,t.s]})}):t.g?i.push({p:[tA.SHAPE_POINTS,t.g.p],s:[tA.SHAPE_SPLITS,t.g.s]}):i.push(t),i),o=0,a=0,s=0,u=0;u<n.length;u++){var c=oE(n[u],{indexBase:o,uvTransform:e});o+=c.aPoint.length/5,r.push(c),a+=c.aPoint.length,s+=c.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(a),l=new Uint16Array(s),f=0,d=0,p=0;f<r[f];f++){var m=r[f];h.set(m.aPoint,d),d+=m.aPoint.length,l.set(m.index,p),p+=m.index.length}return{aPoint:h,index:l}}function oC(t,e,i){var r=Math.cos(i),n=Math.sin(i),o=e[0],a=e[1];return t[0]=r*o+n*a,t[1]=-n*o+r*a,t}var oS=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+i||1,this.count=ee(r,rw)?r:rU(r),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),oA=function(t){this.content=t},ow=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 oA(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 oA(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,o=t.next;n.next=o,o&&(o.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}(),oO=new eJ,oR=new eJ,oI=function(){function e(e,i){this.pointStart=[];var r,n=i.colorOverLifetime,o=i.colorOverTrail,a=i.maxTrailCount,s=i.opacityOverLifetime,u=void 0===s?rU(1):s,c=i.widthOverTrail,h=i.name,l=i.occlusion,f=i.blending,d=i.maskMode,p=i.textureMap,m=i.texture,v=i.transparentOcclusion,y=i.minimumVertexDistance,g=i.lifetime,x=i.matrix,T=e.gpuCapability,b=T.detail,E=T.level,_=Math.max(i.pointCountPerTrail,2),C=rj(),S=b.maxVertexTextures>0,A=(null!=(r=e.renderer)?r:{}).env,w={},O=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",A===ib]],R=a>64,I=0;n&&(O.push(["COLOR_OVER_LIFETIME",!0]),I|=1,w.uColorOverLifetime=i$.createWithData(e,eb(n))),o&&(O.push(["COLOR_OVER_TRAIL",!0]),I|=4,w.uColorOverTrail=i$.createWithData(e,eb(o))),R?(O.push(["ATTR_TRAIL_START",1]),I|=8):w.uTrailStart=new Float32Array(a),w.uOpacityOverLifetimeValue=u.toUniform(C);var M=c.toUniform(C);O.push(["VERT_CURVE_VALUE_COUNT",C.index],["VERT_MAX_KEY_FRAME_COUNT",C.max]),w.uVCurveValues=rw.getAllData(C);var L={shader:{vertex:nn,fragment:ni,macros:O,glslVersion:1===E?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+I+"+"+C.index+"+"+C.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},P=_*a*2,V=(_-1)*a,F=Float32Array.BYTES_PER_ELEMENT,N=12*F,D={attributes:{aColor:{size:4,stride:N,data:new Float32Array(12*P)},aSeed:{size:1,stride:N,offset:4*F,dataSource:"aColor"},aInfo:{size:3,stride:N,offset:5*F,dataSource:"aColor"},aPos:{size:4,stride:N,offset:8*F,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(P)},aDir:{size:3,data:new Float32Array(3*P)}},indices:{data:new Uint16Array(6*P)},drawCount:6*V,name:"trail#"+h,bufferUsage:iC.DYNAMIC_DRAW};if(R)D.attributes.aTrailStart={size:1,data:new Float32Array(P)};else{var z=new Float32Array(P);D.attributes.aTrailStartIndex={size:1,data:z};for(var k=0;k<a;k++)for(var U=2*_,B=k*U,G=0;G<U;G++)z[B+G]=k}var X=iw(f),j=rt.create(e,L);j.blending=!0,j.depthMask=l,j.depthTest=!0,iI(j,d),iO(j,f);var H=this.mesh=r5.create(e,{name:"MTrail_"+h,material:j,geometry:r2.create(e,D)}),W=null!=m?m:i$.createWithData(e);Object.keys(w).map(function(t){var e=w[t];if(ee(e,i$))j.setTexture(t,e);else if("uTrailStart"===t)j.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new ip(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}j.setVector4Array(t,i)}else j.setVector4(t,ip.fromArray(e))}),j.setFloat("uTime",0),j.setVector4("uWidthOverTrail",ip.fromArray(M)),j.setVector2("uTexOffset",new eK(0,0)),j.setVector4("uTextureMap",ip.fromArray(void 0===p?[0,0,1,1]:p)),j.setVector4("uParams",new ip(0,_-1,0,0)),j.setTexture("uMaskTex",W),j.setVector4("uColorParams",new ip(m?1:0,+X,0,+(l&&!v))),this.maxTrailCount=a,this.pointCountPerTrail=_,this.checkVertexDistance=y>0,this.minimumVertexDistance=Math.pow(y||.001,2),this.useAttributeTrailStart=R,this.lifetime=g,x&&(this.mesh.worldMatrix=x),this.geometry=H.firstGeometry(),this.trailCursors=new Uint16Array(a)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=r%n,u=(r-1)%n,c=(r-2)%n,h=this.getTrailPosition(t,u,oO);if(!(h&&this.checkVertexDistance&&(null==h?void 0:h.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+s,f=oV(h,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),o.setAttributeSubData("aDir",6*l,v),o.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,o.setAttributeSubData("aColor",24*l,g),u>=0){var T=new Float32Array(oV(this.getTrailPosition(t,c,oR),h,e)),b=(t*n+u)*6;o.setAttributeSubData("aDir",b,T),o.setAttributeSubData("aDir",b+3,T);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*a+(r-1)%a)*6;o.setIndexSubData(C,_)}r=++this.trailCursors[t];var S=this.mesh.material,A=S.getVector4("uParams"),w=p[2];if(this.useAttributeTrailStart){for(var O=2*n,R=new Float32Array(O),I=0;I<O;I++)R[I]=w;o.setAttributeSubData("aTrailStart",t*R.length,R)}else{var M=S.getFloats("uTrailStart");void 0!=M&&(M[t]=w,S.setFloats("uTrailStart",M))}A&&(A.y=Math.max(A.y,r-1)-Math.max(0,r-n),S.setVector4("uParams",A))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,o=this.geometry.getAttributeData("aColor");return eS(o),i.x=o[n],i.y=o[1+n],i.z=o[2+n],i}},i.clearAllTrails=function(){var t=this.geometry.getIndexData();eS(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");eS(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();eS(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){},eB(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}(),oM=new eJ,oL=new eJ,oP=new eJ;function oV(t,e,i){return t||i?(t?i?(oL.subtractVectors(e,t).normalize(),oL.subtractVectors(i,e),oP.copyFrom(oL).normalize(),oM.addVectors(oL,oP)):oM.subtractVectors(e,t):oM.subtractVectors(i,e),oM.normalize().toArray()):[0,0,0]}var oF=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new oZ(e,i)),r&&(n.trailMesh=new oI(e,r));var n,o=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(o.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=o,n}eX(e,t);var i=e.prototype;return i.start=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=eH(this.meshes);!(t=e()).done;)t.value.start()},i.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new ip(e,this.item.duration,0,0))},i.render=function(t){for(var e,i=eH(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.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}(ii);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)===tI.removeParticle,ray:t})}}},r&&n.fromData(r),n}eX(i,e);var r=i.prototype;return r.isFrozen=function(){return this.frozen},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]===tA.CONSTANT_VEC3?e.add(r[1]):t=rU(r)),this.basicTransform={position:e,rotation:i,path:t};var n=this.transform.parentTransform,o=e.clone();if(t&&o.add(t.getValue(0)),this.transform.setPosition(o.x,o.y,o.z),this.options.particleFollowParent&&n){var a=n.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},r.updateEmitterTransform=function(t){var e=this.transform.parentTransform,i=this.basicTransform,r=i.path,n=i.position.clone();if(r){var o=this.item.duration;n.add(r.getValue(t/o))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.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 o=r.first;r.removeNode(o),i=n[1]=o.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 ip(n[0],n[1],n[2],t));for(var o=r.getAttributeData("aColor")||[],a=0;a<o.length;a+=32)o[8*a+7]=t},r.setColor=function(t,e,i,r){var n,o=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,s=(null==(n=o.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];o.setVector4("uOpacityOverLifetimeValue",new ip(s[0],s[1],s[2],r));for(var u=a.getAttributeData("aColor")||[],c=0;c<u.length;c+=32)u[8*c+4]=t,u[8*c+5]=e,u[8*c+6]=i,u[8*c+7]=r},r.setParentTransform=function(t){},r.getTextures=function(){return this.renderer.getTextures()},r.start=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 ow(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1,this.ended=!1},r.onUpdate=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,o=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var a=this.particleLink,s=(i-n)/this.item.duration,u=this.timePassed,c=!1,h=function(){e.trails&&!c&&(c=!0,a.forEach(function(t){var i=t[0],r=t[1],n=t[2],o=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,s,o,n)}))};if(this.ended){if(this.item.endBehavior!==tO.restart&&tO.destroy===this.item.endBehavior){var l=a.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/o.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=a.first;return e.emissionStopped||a.length===y&&t&&t.content[0]-n>u},x=0;x<m&&x<y&&!g();x++){var T=this.createPoint(d);T.delay+=i+x*v,this.addParticle(T,y),this.lastEmitTime=u}for(var b=o.bursts,E=(null==b?void 0:b.length)-1,_=0;E>=0&&_<y&&!g();E--){var C=b[E].getGeneratorOptions(u,d);if(C)for(var S=[0,0,0],A=o.burstOffsets[E],w=A&&A[C.cycleIndex]||S,O=0;O<C.count&&_<y&&!g();O++){var R,I=this.initPoint(this.shape.generate({total:C.total,index:C.index,burstIndex:O,burstCount:C.count}));I.delay+=i,_++,(R=I.transform).translate.apply(R,[].concat(w)),this.addParticle(I,y)}}}else this.item.endBehavior===tO.restart?(h(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=f,o.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===tO.freeze&&(this.frozen=!0))}h()}},r.onDestroy=function(){this.item&&this.item.composition&&(this.item.composition.destroyTextures(this.getTextures()),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 o=t.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);i.push({center:c,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>r&&(a=!0)}return i},r.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],o=new eJ,a=!1;if(r&&r.content)do{var s=r.content,u=s[0],c=s[1];s[2];var h=s[3];if(u>this.timePassed){var l=this.getPointPosition(h),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:l,radius:t.radius},o)),d&&(t.removeParticle&&(i.removeParticlePoint(c),this.clearPointTrail(c),e.removeNode(r),r.content=[0]),n.push(l),t.multiple||(a=!0))}else break}while((r=r.pre)&&!a);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 o=this.trails,a=this.getPointPosition(i),s=o.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),c=1,h=o.lifetime.getValue(e);if(o.sizeAffectsWidth&&(c*=u[0]),o.sizeAffectsLifetime&&(h*=u[0]),o.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&a.subtract(l)}n.addTrailPoint(t,a,{color:s,lifetime:h,size:c,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,o=t.gravity,a=this.options.forceTarget,s=this.lastUpdate-n,u=new eJ,c=eJ.fromArray(void 0===o?[]:o);e.assignWorldTRS(u);var h=ro(new eJ,this.options,c,s,r,u,i);if(a){var l=a.target||[0,0,0],f=a.curve.getValue(s/r),d=1-f;h.x=h.x*d+l[0]*f,h.y=h.y*d+l[1]*f,h.z=h.z*d+l[2]*f}return h},r.initPoint=function(t){var e,i,r,n,o=this.options,a=this.lifetime,s=this.shape,u=o.startSpeed.getValue(a),c=o.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),h=t.position,l=new n$({position:c.transformPoint(h,new eJ),valid:!0}),f=t.direction;if(f=c.transformNormal(f,oN).normalize(),o.startTurbulence&&o.turbulence){for(var d=0;d<3;d++)oB.setElement(d,o.turbulence[d].getValue(a));oG.setFromVector3(oB.negate()),oj.setFromEuler(oG).transformNormal(f).normalize()}s.alignSpeedDirection?(oU.copyFrom(f),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=eJ.Z.clone(),c.transformNormal(this.upDirectionWorld)),ok.crossVectors(oU,this.upDirectionWorld).normalize(),ok.isZero()&&ok.set(1,0,0)):(ok.set(1,0,0),oU.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((n=oX)[0]=p.animationDelay.getValue(a),n[1]=p.animationDuration.getValue(a),n[2]=p.cycles.getValue(a)),o.start3DRotation?oz.set(o.startRotationX.getValue(a),o.startRotationY.getValue(a),o.startRotationZ.getValue(a)):o.startRotation?oz.set(0,0,o.startRotation.getValue(a)):oz.set(0,0,0),l.setRotation(oz.x,oz.y,oz.z);var m=o.startColor.getValue(a);if(3===m.length&&(m[3]=1),o.start3DSize)oD.x=o.startSizeX.getValue(a),oD.y=o.startSizeY.getValue(a);else{var v=o.startSize.getValue(a),y=o.sizeAspect.getValue(a);oD.x=v,oD.y=0===y?0:v/y}var g=f.clone();if(g.multiply(u),!o.particleFollowParent){var x=new eJ;this.transform.assignWorldTRS(void 0,void 0,x),oD.x*=x.x,oD.y*=x.y}return l.setScale(oD.x,oD.y,1),{size:oD,vel:g,color:m,delay:o.startDelay.getValue(a),lifetime:o.startLifetime.getValue(a),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:o.gravity,sprite:n,dirY:oU,dirX:ok,transform:l}},r.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&ee(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return -1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,r,n,o,a,s,u,c,h,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,T=ra(null==y?void 0:y.gravity),b=t.textureSheetAnimation,E=b?{animationDelay:rU(b.animationDelay||0),animationDuration:rU(b.animationDuration||1),cycles:rU(b.cycles||1),animate:b.animate,col:b.col,row:b.row,total:b.total||b.col*b.row}:void 0,_=!!(g&&g.turbulenceX||(null==g?void 0:g.turbulenceY)||(null==g?void 0:g.turbulenceZ));_&&(n=[rU(null!=(o=g.turbulenceX)?o:0),rU(null!=(a=g.turbulenceY)?a:0),rU(null!=(s=g.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=on(g),this.emission={rateOverTime:rU(t.emission.rateOverTime),burstOffsets:(i=null!=(u=t.emission.burstOffsets)?u:[],r={},Array.isArray(i)&&i.forEach(function(t){var e=ee(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 oS(t)})},this.textureSheetAnimation=E;var C=t.renderer||{},S={},A=t.rotationOverLifetime;A&&(S.asRotation=!!A.asRotation,S.z=A.z?rU(A.z):rU(0),A.separateAxes&&(S.x=A.x&&rU(A.x),S.y=A.y&&rU(A.y))),(null==y?void 0:y.forceTarget)&&(c={target:y.target||[0,0,0],curve:rU(y.forceCurve||[tA.LINE,[[0,0],[1,1]]])});var w={x:y.linearX&&rU(y.linearX||0),y:y.linearY&&rU(y.linearY||0),z:y.linearZ&&rU(y.linearZ||0),asMovement:y.asMovement},O={x:y.orbitalX&&rU(y.orbitalX),y:y.orbitalY&&rU(y.orbitalY),z:y.orbitalZ&&rU(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},R=t.sizeOverLifetime||{},I=t.colorOverLifetime,M=(null==R?void 0:R.separateAxes)?{separateAxes:!0,x:rU(R.x),y:rU(R.y)}:{separateAxes:!1,x:rU(("size"in R?R.size:R.x)||1)};C.anchor=C.anchor||[0,0];var L=eK.fromArray(C.anchor);this.options={particleFollowParent:!!m.particleFollowParent,startLifetime:rU(m.startLifetime),startDelay:rU(m.startDelay||0),startSpeed:rU(y.startSpeed||0),startColor:rU(m.startColor),looping:!1,maxCount:null!=(h=m.maxCount)?h:0,gravityModifier:rU(x||0),gravity:T,start3DSize:!!m.start3DSize,startTurbulence:_,turbulence:n,speedOverLifetime:y.speedOverLifetime&&rU(y.speedOverLifetime),linearVelOverLifetime:w,orbitalVelOverLifetime:O,forceTarget:c},m.startRotationZ&&(this.options.startRotation=rU(m.startRotationZ||0)),(m.startRotationX||m.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=rU(m.startRotationX||0),this.options.startRotationY=rU(m.startRotationY||0),this.options.startRotationZ=rU(m.startRotationZ||0)),m.start3DSize?(this.options.startSizeX=rU(m.startSizeX),this.options.startSizeY=rU(m.startSizeY)):(this.options.startSize=rU(m.startSize),this.options.sizeAspect=rU(m.sizeAspect||1));var P={meshSlots:m.meshSlots,name:this.name,matrix:e0.IDENTITY,shaderCachePrefix:"",renderMode:C.renderMode||tT.BILLBOARD,side:C.side||td.DOUBLE,gravity:T,blending:C.blending||tf.ALPHA,rotationOverLifetime:S,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:C.mask,maskMode:null!=(l=C.maskMode)?l:tp.NONE,forceTarget:c,diffuse:C.texture,sizeOverLifetime:M,anchor:L};if(I){var V=I.color,F=I.opacity;P.colorOverLifetime={},F&&(P.colorOverLifetime.opacity=rU(I.opacity)),V&&(V[0]===tA.GRADIENT_COLOR?P.colorOverLifetime.color=I.color[1]:V[0]===tA.RGBA_COLOR?P.colorOverLifetime.color=i$.createWithData(this.engine,{data:new Uint8Array(V[1]),width:1,height:1}):ee(V,i$)&&(P.colorOverLifetime.color=V))}var N=[],D=[0,0,1,1];if(t.splits){var z=t.splits[0];D=(f=z[4])?[z[0],z[1],z[3],z[2]]:[z[0],z[1],z[2],z[3]]}if(E&&!E.animate)for(var k=f?E.row:E.col,U=f?E.col:E.row,B=E.total||k*U,G=0,X=0;X<k;X++)for(var j=0;j<U&&G<B;j++,G++)N.push([X*D[2]/k+D[0],j*D[3]/U+D[1],D[2]/k,D[3]/U]);else N.push(D);this.uvs=N,P.textureFlip=f;var H=t.trails;H&&(this.trails={lifetime:rU(H.lifetime),dieWithParticles:!1!==H.dieWithParticles,sizeAffectsWidth:!!H.sizeAffectsWidth,sizeAffectsLifetime:!!H.sizeAffectsLifetime,inheritParticleColor:!!H.inheritParticleColor,parentAffectsPosition:!!H.parentAffectsPosition},d={name:"Trail",matrix:e0.IDENTITY,minimumVertexDistance:H.minimumVertexDistance||.02,maxTrailCount:m.maxCount,pointCountPerTrail:Math.round(H.maxPointPerTrail)||32,blending:H.blending,texture:H.texture,opacityOverLifetime:rU(H.opacityOverLifetime||1),widthOverTrail:rU(H.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!H.occlusion,transparentOcclusion:!!H.transparentOcclusion,textureMap:H.textureMap,mask:C.mask,maskMode:C.maskMode},H.colorOverLifetime&&H.colorOverLifetime[0]===tA.GRADIENT_COLOR&&(d.colorOverLifetime=H.colorOverLifetime[1]),H.colorOverTrail&&H.colorOverTrail[0]===tA.GRADIENT_COLOR&&(d.colorOverTrail=H.colorOverTrail[1])),this.renderer=new oF(this.engine,P,d),this.renderer.item=this.item,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},eB(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}}]),i}(it),t.ParticleSystem=er([e6(tX.ParticleSystem)],t.ParticleSystem);var oN=new eJ,oD=new eK,oz=new e1,ok=new eJ,oU=new eJ,oB=new eJ,oG=new e1,oX=[0,0,0],oj=new e0,oH=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}eX(i,e);var r=i.prototype;return r.start=function(e){var i=e.output.getUserData();!this.particleSystem&&ee(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform()))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){e.setVisible(!0);var i=t.deltaTime;this.time<e.item.duration&&e.isFrozen()&&e.reset(),.001>Math.abs(this.time-this.lastTime)&&(i=0),e.onUpdate(i)}this.lastTime=this.time},i}(nB),oW=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createPlayable=function(t){return new oH(t)},e}(nX),oY={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"},oZ=function(){function e(e,i){this.particleCount=0;var r,n,o,a,s,u,c,h,l,f=(null!=(c=e.renderer)?c:{}).env,d=i.speedOverLifetime,p=i.colorOverLifetime,m=i.linearVelOverLifetime,v=i.orbitalVelOverLifetime,y=i.sizeOverLifetime,g=i.rotationOverLifetime,x=i.sprite,T=i.gravityModifier,b=i.maxCount,E=i.textureFlip,_=i.useSprite,C=i.name,S=i.gravity,A=i.forceTarget,w=i.side,O=i.occlusion,R=i.anchor,I=i.blending,M=i.maskMode,L=i.mask,P=i.transparentOcclusion,V=i.meshSlots,F=i.renderMode,N=void 0===F?0:F,D=i.diffuse,z=void 0===D?i$.createWithData(e):D,k=e.gpuCapability.detail,U=k.halfFloatTexture,B=k.maxVertexUniforms,G=[["RENDER_MODE",+N],["ENV_EDITOR",f===ib]],X=e.gpuCapability.level,j=rj(),H=rj(),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(j)),(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=ee(p.color,i$)?p.color:i$.createWithData(e,eb(p.color))),(null==p?void 0:p.opacity)?Y.uOpacityOverLifetimeValue=p.opacity.toUniform(j):Y.uOpacityOverLifetimeValue=rU(1).toUniform(j),["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(j),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(j),r=1,q|=1<<10+e,h=!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),h&&((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(j),(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(j)),(null==g?void 0:g.z)&&(Y.uRZByLifeTimeValue=g.z.toUniform(j),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(Y.uRXByLifeTimeValue=g.x.toUniform(j),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(Y.uRYByLifeTimeValue=g.y.toUniform(j),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=T.toUniform(j),A&&(G.push(["FINAL_TARGET",!0]),q|=524288,Y.uFinalTarget=new Float32Array(A.target||[0,0,0]),Y.uForceCurve=A.curve.toUniform(j)),U&&H.max?(q|=1048576,Y.uFCurveValueTexture=i0(e,rw.getAllData(H,!0),H.index,1)):Y.uFCurveValues=rw.getAllData(H);var Q=j.max+j.curves.length-32>B;if(2===X&&(j.max=-1,j.index=V?V[0]:oQ(j.index),H.index>0&&(H.max=-1,H.index=V?V[1]:oQ(H.index))),Q&&U&&W){var K=i0(e,rw.getAllData(j,!0),j.index,1);Y.uVCurveValueTexture=K,Z=1}else Y.uVCurveValues=rw.getAllData(j);var J=["-p:",N,q,j.index,j.max,H.index,H.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",j.index],["FRAG_CURVE_VALUE_COUNT",H.index],["VERT_MAX_KEY_FRAME_COUNT",j.max],["FRAG_MAX_KEY_FRAME_COUNT",H.max]);var $={fragment:ni,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+nr,glslVersion:1===X?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,macros:G,name:"particle#"+C},tt=iw(I);Y.uTexOffset=new Float32Array(z?[1/z.getWidth(),1/z.getHeight()]:[0,0]),Y.uMaskTex=z,Y.uColorParams=new Float32Array([z?1:0,+tt,0,+(!!O&&!P)]),Y.uParams=[0,0,0,0],Y.uAcceleration=[(null==S?void 0:S[0])||0,(null==S?void 0:S[1])||0,(null==S?void 0:S[2])||0,0];var te=rt.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=L?[L,L]:void 0,iI(te,M),iO(te,I),iR(te,w),Object.keys(Y).map(function(t){var e=Y[t];if(ee(e,i$)){te.setTexture(t,e);return}var i=[];switch(oY[t]){case"vec4":te.setVector4(t,ip.fromArray(e));break;case"vec3":te.setVector3(t,eJ.fromArray(e));break;case"vec2":te.setVector2(t,eK.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new ip(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 eJ(0,0,0)),te.setFloat("emissionIntensity",0);var ti=r2.create(e,(r=4*b,n=this.useSprite,o="particle#"+C,u={aPos:{size:3,offset:0,stride:s=12*(a=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*a,stride:s,dataSource:"aPos"},aDirX:{size:3,offset:6*a,stride:s,dataSource:"aPos"},aDirY:{size:3,offset:9*a,stride:s,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*a,data:new Float32Array(0)},aSeed:{size:1,offset:3*a,stride:8*a,dataSource:"aRot"},aColor:{size:4,offset:4*a,stride:8*a,dataSource:"aRot"},aOffset:{size:4,stride:4*a,data:new Float32Array(0)}},n&&(u.aSprite={size:3,stride:3*a,data:new Float32Array(0)}),{attributes:u,indices:{data:new Uint16Array(0)},name:o,maxVertex:r})),tr=r5.create(e,{name:"MParticle_"+C,material:te,geometry:ti});this.anchor=R,this.mesh=tr,this.geometry=tr.firstGeometry(),this.forceTarget=A,this.sizeOverLifetime=y,this.speedOverLifetime=d,this.linearVelOverLifetime=m,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=T,this.maxCount=b,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 eS(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],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new i.constructor(0))},i.minusTime=function(t){var e=this.geometry.getAttributeData("aOffset");eS(e);for(var 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,o=4*n,a=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 c={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},h=this.useSprite;h&&(c.aSprite=new Float32Array(12));var l=new eJ,f=new e$,d=new eJ(1,1,1);e.transform.assignWorldTRS(l,f,d);var p=n$.getRotation(f,new e1),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],T=e.vel,b=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();h&&(r=e.sprite);for(var C=0;C<4;C++){var S=2*C,A=3*C,w=4*C,O=12*C,R=8*C;c.aPos.set(m,O),T.fill(c.aPos,O+3),c.aRot.set(v,R),c.aRot[R+3]=_,c.aRot.set(b,R+4),h&&c.aSprite.set(r,A);var I=e.uv||x;if(I){var M=h?1-y[S+1]:y[S+1];g[0]=I[0]+y[S]*I[2],g[1]=I[1]+M*I[3]}c.aOffset.set(g,w);for(var L=C+C,P=(E[L]-this.anchor.x)*d.x,V=(E[L+1]-this.anchor.y)*d.y,F=0;F<3;F++)c.aPos[O+6+F]=e.dirX.getElement(F)*P,c.aPos[O+9+F]=e.dirY.getElement(F)*V}var N=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var D=el(a.getIndexData(),6*n,6*i,u);D.set(N,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,N);Object.keys(c).forEach(function(e){var r=c[e],n=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var h=a.getAttributeData(e);eS(h);var l=el(h,o*n,4*i*n,u);l.set(r,r.length*t),a.setAttributeData(e,l)}else a.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),a.setDrawCount(6*this.particleCount)}},e}(),oq=[10,32,64,160];function oQ(t){for(var e=0;e<oq.length;e++){var i=oq[e];if(i>t)return i}return t||oq[0]}function oK(t,e,i){void 0===i&&(i="");var r,n,o,a=t.content,s=+((null==(r=a.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",s],["ENV_EDITOR",i===ib]],c=e.level,h=e.detail,l=rj(),f=rj(),d=h.maxVertexUniforms>0,p=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,rX(l,p));var y=a.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=a.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&rX(l,x);var T=a.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==T?void 0:T[r])&&(rX(l,T[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==T?void 0:T[n])&&(rX(l,T[n]),a=1,v|=1<<10+e,o=!0),u.push(["ORB_VEL_"+t.toUpperCase(),a])}),(null==T?void 0:T.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),o&&(null==T?void 0:T.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),a.sizeOverLifetime){var b=a.sizeOverLifetime;b.separateAxes?(rX(l,b.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,rX(l,b.y)):rX(l,b.size)}if(a.rotationOverLifetime){var E=a.rotationOverLifetime;E.z&&(rX(l,null==E?void 0:E.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(rX(l,E.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),E.y&&(rX(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)}rX(l,null==T?void 0:T.gravityOverLifetime),(null==T?void 0:T.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,rX(l,T.forceCurve));var _=h.halfFloatTexture;_&&f.max&&(v|=1048576);var C=h.maxVertexUniforms,S=l.max+l.curves.length-32>C;nQ[nZ]&&(S=!0),2===c&&(l.max=-1,f.index>0&&(f.max=-1)),S&&_&&d&&(m=1);var A={fragment:ni,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+nr,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:A,vertex:l.index,fragment:f.index}}function oJ(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 o=0;o<t.macros.length;o++){var a=t.macros[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=i;break}}}var o$=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.precompile=function(e,i,r){var n=i.engine.gpuCapability,o=n.level,a=(null!=r?r:{}).env,s=i.getShaderLibrary(),u=[],c=[],h=0,l=0;return e.forEach(function(e){e.items.forEach(function(e){t.Item.isParticle(e)&&u.push(e)})}),u.forEach(function(e){var i=oK(e,n,a),r=i.shader,u=i.fragment,f=i.vertex;if(c.push(r),h=Math.max(h,u),l=Math.max(l,f),e.content.trails){var d,p,m,v,y,g,x,T,b=(d=e.content.trails,p=e.content.options.maxCount,m=e.name,void 0===(v=a)&&(v=""),y=0,g=nQ[nZ]?1:0,x=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",g],["ENV_EDITOR",v===ib]],T=rj(),d.colorOverLifetime&&(x.push(["COLOR_OVER_LIFETIME",!0]),y|=1),d.colorOverTrail&&(x.push(["COLOR_OVER_TRAIL",!0]),y|=4),p>64&&(x.push(["ATTR_TRAIL_START",1]),y|=8),rX(T,d.opacityOverLifetime),rX(T,d.widthOverTrail),x.push(["VERT_CURVE_VALUE_COUNT",T.index],["VERT_MAX_KEY_FRAME_COUNT",T.max]),{vertex:nn,fragment:ni,macros:x,shared:!0,name:"trail#"+m,cacheId:"-t:+"+y+"+"+T.index+"+"+T.max});b.glslVersion=2===o?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,null==s||s.addShader(b)}}),c.forEach(function(e){2===o?(oJ(e,l,h),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,null==s||s.addShader(e)}),2===o&&u.forEach(function(t){t.content.options.meshSlots=[l,h]}),Promise.resolve()},i}(ir),o0=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(ir),o1=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]},e.getInputStream=function(t){var e=this.playable.getInput(t);if(ee(e,o2))return e.animationStream},t}(),o2=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new o1(nk(i)),i}return eX(e,t),e}(nB),o3=new e1,o4=new eJ(1,1,1),o5=new eJ,o6=function(e){function i(){return e.apply(this,arguments)}eX(i,e);var r=i.prototype;return r.start=function(){var t,e=this.binding,i=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new eJ(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,o=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=rU(r.path));var a=r.linearX||r.linearY||r.linearZ;a&&(this.linearVelOverLifetime={x:r.linearX&&rU(r.linearX),y:r.linearY&&rU(r.linearY),z:r.linearZ&&rU(r.linearZ),asMovement:r.asMovement,enabled:!!a});var s=r.orbitalX||r.orbitalY||r.orbitalZ;s&&(this.orbitalVelOverLifetime={x:r.orbitalX&&rU(r.orbitalX),y:r.orbitalY&&rU(r.orbitalY),z:r.orbitalZ&&rU(r.orbitalZ),center:ra(r.orbCenter),asRotation:r.asRotation,enabled:!!s}),this.speedOverLifetime=r.speedOverLifetime&&rU(r.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=rU(o.x||1),this.sizeYOverLifetime=rU(o.y||1),this.sizeZOverLifetime=rU(o.z||1)):this.sizeXOverLifetime=rU(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:rU(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=rU(n.x||0),u.y=rU(n.y||0)}this.gravity=eJ.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=rU(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?eJ.fromArray(r.direction).normalize():new eJ,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.binding){var i=e.output.getUserData();ee(i,t.VFXItem)&&(this.binding=i,this.start())}this.binding&&this.binding.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.binding,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){o4.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(o4.y=this.sizeYOverLifetime.getValue(r),o4.z=this.sizeZOverLifetime.getValue(r)):o4.z=o4.y=o4.x;var n=this.originalTransform.scale;e.transform.setScale(o4.x*n.x,o4.y*n.y,o4.z*n.z)}if(this.rotationOverLifetime){var o=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},a=o(this.rotationOverLifetime.z),s=this.rotationOverLifetime.separateAxes;o3.x=s?o(this.rotationOverLifetime.x):0,o3.y=s?o(this.rotationOverLifetime.y):0,o3.z=a;var u=o3.addEulers(this.originalTransform.rotation,o3);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(ro(o5,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&o5.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(o5.x,o5.y,o5.z))},i}(o2);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new o6(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(nX),t.TransformPlayableAsset=er([e6("TransformPlayableAsset")],t.TransformPlayableAsset);var o8=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.processFrame=function(t){},e}(nB);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createPlayable=function(t){return new o8(t)},e}(nX),t.ActivationPlayableAsset=er([e6("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}eX(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=eH(this.positionCurves);!(r=n()).done;){var o=r.value,a=o.keyFrames.getValue(i),s=this.findTarget(t,o.path);null==s||s.transform.setPosition(a.x,a.y,a.z)}for(var u,c=eH(this.rotationCurves);!(u=c()).done;){var h=u.value,l=h.keyFrames.getValue(i),f=this.findTarget(t,h.path);null==f||f.transform.setQuaternion(l.x,l.y,l.z,l.w)}for(var d,p=eH(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=eH(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:rU(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var o,a=eH(t.rotationCurves);!(o=a()).done;){var s=o.value,u={path:s.path,keyFrames:rU(s.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var c,h=eH(t.scaleCurves);!(c=h()).done;){var l=c.value,f={path:l.path,keyFrames:rU(l.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=eH(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:rU(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=eH(e);!(i=n()).done;){for(var o,a=i.value,s=!1,u=eH(r.children);!(o=u()).done;){var c=o.value;if(c.name===a){r=c,s=!0;break}}if(!s)return}return r},e}(e7),t.AnimationClip=er([e6(tX.AnimationClip)],t.AnimationClip);var o9=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();ee(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(nB),o7=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>.001&&(this.endBehavior===tO.restart?e%=i:this.endBehavior===tO.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}eX(e,t);var i=e.prototype;return i.resolveBinding=function(t){return t},i.createTrackMixer=function(t){return new nB(t)},i.createOutput=function(){return new nG},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=eH(this.clips);!(i=n()).done;){var o=i.value;r.push(o)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),o=eH(e);!(r=o()).done;){var a=r.value,s=this.createClipPlayable(t,a),u=new at(a,s,n,this);i.push(u),n.addInput(s,0),n.setInputWeight(s,0)}return n},i.createPlayable=function(t){return new nB(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t)},i.createClip=function(t,e){var i=new o7;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=eH(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)},e}(nX),er([e9(o7,void 0)],t.TrackAsset.prototype,"clips",void 0),er([e9(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=er([e6("TrackAsset")],t.TrackAsset),t.TrackType=void 0,(to=t.TrackType||(t.TrackType={}))[to.MasterTrack=0]="MasterTrack",to[to.ObjectTrack=1]="ObjectTrack";var at=function(){function e(e,i,r,n){this.clip=e,this.playable=i,this.parentMixer=r,this.track=n,ee(this.track.binding,t.VFXItem)&&(this.particleSystem=this.track.binding.getComponent(t.ParticleSystem))}return e.prototype.evaluateAt=function(e){var i=this.clip,r=1,n=!1,o=!1,a=this.track.binding;e>i.start+i.duration+.001&&i.endBehavior===tO.destroy?ee(a,t.VFXItem)&&t.VFXItem.isParticle(a)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,o=!0):e<i.start&&(r=0),o&&this.playable.getPlayState()!==tJ.Playing&&this.playable.play(),this.parentMixer.setInputWeight(this.playable,r),n&&(!ee(a,t.VFXItem)||a.ended||(a.ended=!0,a.onEnd(),a.compositionReusable||a.reusable||(a.dispose(),this.playable.dispose())),this.playable.getPlayState()===tJ.Playing&&this.playable.pause());var s=i.toLocalTime(e);this.playable.setTime(s)},eB(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setInputWeight(this.playable,0),this.playable.pause())}}]),e}();t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.prototype.create=function(e){var i=this.binding;if(i.getComponent(t.ParticleSystem)){var r=e.createTrack(t.TrackAsset,this,"ParticleTrack");r.binding=this.binding;var n=r.createClip(oW);n.start=i.start,n.duration=i.duration,n.endBehavior=i.endBehavior}},i}(t.TrackAsset),t.ObjectBindingTrack=er([e6("ObjectBindingTrack")],t.ObjectBindingTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(t.TrackAsset),t.TransformTrack=er([e6("TransformTrack")],t.TransformTrack);var ae=function(e){function i(){return e.apply(this,arguments)}eX(i,e);var r=i.prototype;return r.processFrame=function(e){var i=e.output.getUserData();if(ee(i,t.VFXItem)){for(var r=!1,n=0;n<this.getInputCount();n++)if(this.getInputWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),this.showRendererComponents(i)):(i.transform.setValid(!1),this.hideRendererComponents(i))}},r.hideRendererComponents=function(t){for(var e,i=eH(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled&&(r.enabled=!1)}},r.showRendererComponents=function(t){for(var e,i=eH(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled||(r.enabled=!0)}},i}(nB);t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createTrackMixer=function(t){return new ae(t)},e}(t.TrackAsset),t.ActivationTrack=er([e6("ActivationTrack")],t.ActivationTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(t.TrackAsset),t.SpriteColorTrack=er([e6("SpriteColorTrack")],t.SpriteColorTrack),t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t}eX(i,e);var r=i.prototype;return r.createPlayable=function(e){var i=new ai(e);i.setTraversalMode(t$.Passthrough);for(var r,n=eH(this.tracks);!(r=n()).done;){var o=r.value;ee(o,t.ObjectBindingTrack)&&o.create(this)}return i.compileTracks(e,this.tracks),i},r.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),r},r.fromData=function(t){},i}(nX),er([e9(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=er([e6("TimelineAsset")],t.TimelineAsset);var ai=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e}eX(e,t);var i=e.prototype;return i.prepareFrame=function(t){this.evaluate()},i.evaluate=function(){for(var t,e=this.getTime(),i=eH(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){this.sortTracks(e);for(var i,r=[],n=eH(e);!(i=n()).done;){var o=i.value;r.push(o),this.addSubTracksRecursive(o,r)}for(var a,s=eH(r);!(a=s()).done;){var u=a.value,c=u.createPlayableGraph(t,this.clips);this.addInput(c,0);var h=u.createOutput();h.setUserData(u.binding),t.addOutput(h),h.setSourcePlayeble(this,this.getInputCount()-1)}},i.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new ar(t[i],i));e.sort(ao),t.length=0;for(var r,n=eH(e);!(r=n()).done;){var o=r.value;t.push(o.track)}},i.addSubTracksRecursive=function(t,e){for(var i,r=eH(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var o,a=eH(t.getChildTracks());!(o=a()).done;){var s=o.value;this.addSubTracksRecursive(s,e)}},e}(nB),ar=function(t,e){this.track=t,this.originalIndex=e};function an(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1}function ao(e,i){var r=e.track.binding,n=i.track.binding;return ee(r,t.VFXItem)&&ee(n,t.VFXItem)?an(r,n)?-1:an(n,r)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}var aa=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.startTime=0,t.items=[],t.reusable=!1,t.sceneBindings=[],t.graph=new nU,t}eX(i,e);var r=i.prototype;return r.start=function(){var t=this.item.props.startTime;this.startTime=void 0===t?0:t,this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tO.destroy&&this.setReusable(!0)},r.setReusable=function(e){for(var r,n=eH(this.timelineAsset.tracks);!(r=n()).done;){var o=r.value,a=o.binding;if(ee(a,t.VFXItem)){ee(o,t.ObjectBindingTrack)&&(a.reusable=e);var s=a.getComponent(i);s&&s.setReusable(e)}}},r.getReusable=function(){return this.reusable},r.update=function(t){var e=this.time;this.timelinePlayable.setTime(e),this.graph.evaluate(t)},r.createContent=function(){for(var e,r=[],n=eH(this.data.sceneBindings);!(e=n()).done;){var o=e.value;r.push({key:this.engine.assetLoader.loadGUID(o.key.id),value:this.engine.assetLoader.loadGUID(o.value.id)})}this.sceneBindings=r;var a=this.data.timelineAsset?this.engine.assetLoader.loadGUID(this.data.timelineAsset.id):new t.TimelineAsset(this.engine);this.timelineAsset=a;var s=this.items;if(this.items.length=0,this.item.composition)for(var u=this.item.engine.assetLoader,c=this.data.items?this.data.items:[],h=0;h<c.length;h++){var l=void 0,f=c[h];if(t.Item.isComposition(f)){var d=f.content.options.refId,p=this.item.composition.refCompositionProps.get(d);if(!p)throw Error("Referenced precomposition with Id: "+d+" does not exist.");p.content=f.content,(l=u.loadGUID(f.id)).composition=this.item.composition;var m=l.addComponent(i);m.data=p,m.refId=d,l.transform.parentTransform=this.transform,this.item.composition.refContent.push(l),l.endBehavior===tO.restart&&(this.item.composition.autoRefTex=!1),m.createContent();for(var v,y=eH(m.items);!(v=y()).done;){var g=v.value;g.setInstanceId(eD());for(var x,T=eH(g.components);!(x=T()).done;)x.value.setInstanceId(eD())}}else(l=u.loadGUID(f.id)).composition=this.item.composition;l.parent=this.item,l.transform.parentTransform=f.type===tx.camera?new n$:this.transform,t.VFXItem.isExtraCamera(l)&&(this.item.composition.extraCamera=l),s.push(l)}},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,o,a){for(var s,u=[],c=(null==a?void 0:a.stop)||eR,h=(null==a?void 0:a.skip)||eR,l=(null==a?void 0:a.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<l;f++){var d=(s=this,function(a){var l=s.items[a];if(l.getVisible()&&l.transform.getValid()&&!l.ended&&!t.VFXItem.isComposition(l)&&!h(l)){var f=l.getHitTestParams(o);if(f){var d=!1,p=new eJ;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,T=f.size,b=x.clone().addScaledVector(T,.5),E=x.clone().addScaledVector(T,-.5);e.intersectBox({min:b,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 S=f.collect(e,new eK(i,r));S&&S.length>0&&(S.forEach(function(t){u.push(t)}),d=!0)}if(d){var A={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",A),n.push(A),c(A))return{v:n}}}}}(f));if("object"===ei(d))return d.v}return n},r.fromData=function(t){},r.resolveBindings=function(){for(var t,e=eH(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.binding=i.value}for(var r,n=eH(this.timelineAsset.tracks);!(r=n()).done;){var o=r.value;this.resolveTrackBindingsWithRoot(o)}},r.resolveTrackBindingsWithRoot=function(t){for(var e,i=eH(t.getChildTracks());!(e=i()).done;){var r=e.value;r.binding=r.resolveBinding(t.binding),this.resolveTrackBindingsWithRoot(r)}},i}(ie);t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.prototype.resolveBinding=function(e){if(!ee(e,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");return e.getComponent(aa)},i}(t.TrackAsset),t.SubCompositionTrack=er([e6("SubCompositionTrack")],t.SubCompositionTrack);var as=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();ee(e,aa)&&(e.time=this.getTime())},e}(nB);function au(t,e){return e&&("object"===ei(e)||"function"==typeof e)?e:nk(t)}t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createPlayable=function(t){return new as(t)},e}(nX),t.SubCompositionPlayableAsset=er([e6("SubCompositionPlayableAsset")],t.SubCompositionPlayableAsset);var ac=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tz.display:r,o=t.textBaseline,a=void 0===o?tk.top:o,s=t.textAlign,u=void 0===s?tU.left:s,c=t.text,h=t.letterSpace,l=void 0===h?0:h,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=c.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=a,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,o=t.fontScale,a=(i-r)/3,s=r+n*o,u=i*(e-1),c=0;switch(this.textBaseline){case tk.top:c=s+a;break;case tk.middle:c=(this.height*o-u+s)/2;break;case tk.bottom:c=this.height*o-u-a}return c},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tU.left:i=t.outlineWidth*t.fontScale;break;case tU.middle:i=(this.width*t.fontScale-e)/2;break;case tU.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),ah=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,o,a,s=t.textColor,u=t.fontSize,c=t.outline,h=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,c&&(this.isOutlined=!0,this.outlineColor=null!=(e=c.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=c.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),h&&(this.hasShadow=!0,this.shadowBlur=null!=(r=h.shadowBlur)?r:2,this.shadowColor=null!=(n=h.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(o=h.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(a=h.shadowOffsetY)?a:0),this.fontStyle!==tG.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},al=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 eS(t),t}if(nQ[nq])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?ec(this.elements,t):t.remove()},t}()),af=["serif","sans-serif","monospace","courier"];t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.lineCount=0,r.canvas=al.getCanvas(),al.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return au(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}eX(e,t);var i=e.prototype;return i.update=function(e){t.prototype.update.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture()},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.SpriteComponent),t.TextComponent=er([e6(tX.TextComponent)],t.TextComponent);var ad=function(){function t(){}var e=t.prototype;return e.updateWithOptions=function(t){this.textStyle=new ah(t),this.textLayout=new ac(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.letterSpace,n=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,o=this.textLayout.width+this.textStyle.fontOffset,a=1,s=0,u=0;u<t.length;u++){var c,h,l=t[u],f=(null!=(h=null==i?void 0:null==(c=i.measureText(l))?void 0:c.width)?h:0)*n;((s+=r)+f>o&&u>0||"\n"===l)&&(a++,s=0),"\n"!==l&&(s+=f)}return a},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&&!eA(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.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,o=(r.width+i.fontOffset)*n,a=r.lineHeight*this.lineCount,s=i.fontSize*n,u=r.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=o,r.autoWidth?(this.canvas.height=a*n,this.item.transform.size.set(1,a/r.height)):this.canvas.height=r.height*n;var c=this.canvas.height;e.clearRect(0,0,o,c),e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,c),e.scale(1,-1)),e.fillRect(0,0,o,c),i.fontDesc=this.getFontDesc(),e.font=i.fontDesc,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 h=[],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>o&&m>0||"\n"===v)&&(h.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)}h.push({y:f,width:l,chars:d,charOffsetX:p}),h.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,o){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[o],t.y),e.fillText(r,n+t.charOffsetX[o],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",i$.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:iC.LINEAR,minFilter:iC.LINEAR,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE})),this.isDirty=!1}},e.getFontDesc=function(){var t=this.textStyle,e=t.fontSize,i=t.fontScale,r=t.fontFamily,n=t.textWeight,o=t.fontStyle,a=""+(e*i).toString()+"px ";return af.includes(r)?a+=r:a+='"'+r+'"',n!==tB.normal&&(a=n+" "+a),o!==tG.normal&&(a=o+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],o=i[1],a=i[2],s=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*o+", "+255*a+", "+s+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,o=e.shadowOffsetY,a=i[0],s=i[1],u=i[2],c=i[3];t&&(t.shadowColor="rgba("+255*a+", "+255*s+", "+255*u+", "+c+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-o)},t}();ek(t.TextComponent,[ad]);var ap=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(ir);t.EffectComponent=function(e){function i(t){var i;return(i=e.call(this,t)||this).worldMatrix=e0.fromIdentity(),i.triangles=[],i.destroyed=!1,i.getHitTestParams=function(t){var e=i.getBoundingBox();if(e)return{type:e.type,triangles:e.area}},i.name="EffectComponent",i._priority=0,i}eX(i,e);var r=i.prototype;return r.start=function(){this.item.getHitTestParams=this.getHitTestParams},r.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.hitTestGeometry!==this.geometry&&(this.triangles=function(t){for(var e,i,r=null!=(e=t.getIndexData())?e:[],n=null!=(i=t.getAttributeData("aPos"))?i:[],o=[],a=0;a<r.length;a+=3){var s=3*r[a],u=3*r[a+1],c=3*r[a+2],h={x:n[s],y:n[s+1],z:n[s+2]},l={x:n[u],y:n[u+1],z:n[u+2]},f={x:n[c],y:n[c+1],z:n[c+2]};o.push({p0:h,p1:l,p2:f})}return o}(this.geometry),this.hitTestGeometry=this.geometry);for(var i,r=[],n=eH(this.triangles);!(i=n()).done;){var o=i.value;r.push({p0:o.p0,p1:o.p1,p2:o.p2})}return r.forEach(function(t){t.p0=e.transformPoint(t.p0,new eJ),t.p1=e.transformPoint(t.p1,new eJ),t.p2=e.transformPoint(t.p2,new eJ)}),{type:t.HitTestType.triangle,area:r}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.material=this.materials[0]},r.toData=function(){this.taggedProperties.id=this.guid},r.dispose=function(t){this.destroyed||(this.destroyed=!0,e.prototype.dispose.call(this))},i}(ii),er([e9(void 0,void 0)],t.EffectComponent.prototype,"geometry",void 0),t.EffectComponent=er([e6(tX.EffectComponent)],t.EffectComponent),t.PostProcessVolume=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.useHDR=!0,e.useBloom=!0,e.threshold=1,e.bloomIntensity=1,e.brightness=1,e.saturation=1,e.contrast=1,e.vignetteIntensity=.2,e.vignetteSmoothness=.4,e.vignetteRoundness=1,e.useToneMapping=!0,e}return eX(e,t),e.prototype.start=function(){var t=this.item.composition;t&&(t.globalVolume=this,t.createRenderFrame())},e}(ie),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"useHDR",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"useBloom",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"threshold",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"bloomIntensity",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"brightness",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"saturation",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"contrast",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteIntensity",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteSmoothness",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"vignetteRoundness",void 0),er([e9(void 0,void 0)],t.PostProcessVolume.prototype,"useToneMapping",void 0),t.PostProcessVolume=er([e6("PostProcessVolume")],t.PostProcessVolume);var am=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),o=1;o<r;o++)n[o-1]=arguments[o];null==(i=e.listeners[t])||i.forEach(function(i){var r=i.listener,o=i.options;r.apply(void 0,[].concat(n)),(null==o?void 0:o.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}))||[]}};t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new n$,r.duration=0,r.start=0,r.endBehavior=tO.forward,r.ended=!1,r.reusable=!1,r.type=tx.base,r.components=[],r.itemBehaviours=[],r.rendererComponents=[],r.visible=!0,r.speed=1,r.listIndex=0,r.eventProcessor=new am,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}eX(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.item=this,e.onAttached(),e},r.getComponent=function(t){for(var e,i,r=eH(this.components);!(i=r()).done;){var n=i.value;if(ee(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,i=[],r=eH(this.components);!(e=r()).done;){var n=e.value;ee(n,t)&&i.push(n)}return i},r.setParent=function(t){t!==this&&(this.parent&&eh(this.parent.children,this),this.parent=t,t&&(i.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition)))},r.onEnd=function(){},r.setColor=function(t,e,i,r){},r.setOpacity=function(t){},r.getVisible=function(){return this.visible},r.setVisible=function(t){this.visible!==t&&(this.visible=!!t)},r.getWorldTransform=function(t){var e=null!=t?t:new n$({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.getNodeTransform=function(t){for(var e=0;e<this.components.length;e++){var i=this.components[1];if(i.getNodeTransform)return i.getNodeTransform(t)}return this.transform},r.translate=function(t,e,i){this.transform.translate(t,e,i)},r.rotate=function(t,e,i){var r=new e1(t,e,i),n=e$.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,o=r.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/a-1)*n,(1-2*e/s)*o,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 eJ;return this.transform.assignWorldTRS(t),t},r.isEnded=function(t){return t-this.duration>.001},r.find=function(t){if(this.name===t)return this;for(var e,i=eH(this.children);!(e=i()).done;){var r=e.value;if(r.name===t)return r}for(var n,o=eH(this.children);!(n=o()).done;){var a=n.value.find(t);if(a)return a}},r.fromData=function(i){e.prototype.fromData.call(this,i);var r=i.id,n=i.name,o=i.delay,a=i.parentId,s=i.endBehavior,u=i.transform,c=i.listIndex,h=i.duration,l=void 0===h?0:h;if(this.props=i,this.type=i.type,this.id=r.toString(),this.name=n,this.start=o||this.start,u&&(u.position=new eJ().copyFrom(u.position),u.quat?u.quat=new e$(u.quat.x,u.quat.y,u.quat.z,u.quat.w):u.rotation=new e1().copyFrom(null!=(f=u.eulerHint)?f:u.rotation),u.scale=new eJ().copyFrom(u.scale),u.size&&(u.size=new eK().copyFrom(u.size)),u.anchor&&(u.anchor=new eK().copyFrom(u.anchor)),this.transform.setTransform(u)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=a,this.duration=l,this.endBehavior=s,i.content||(i.content={options:{}}),l<=0)throw Error("Item duration can't be less than 0, see "+iE["Item duration can't be less than 0"]+".");this.itemBehaviours.length=0,this.rendererComponents.length=0;for(var f,d,p=eH(this.components);!(d=p()).done;){var m=d.value;m.item=this,ee(m,ie)&&this.itemBehaviours.push(m),ee(m,ii)&&this.rendererComponents.push(m),ee(m,t.ParticleSystem)&&(this.components.includes(m.renderer)||this.components.push(m.renderer),this.rendererComponents.push(m.renderer))}this.renderOrder=void 0===c?0:c},r.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=tX.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.taggedProperties.parentId=null==(i=this.parent)?void 0:i.guid),!this.taggedProperties.components){this.taggedProperties.components=[];for(var e,i,r,n=eH(this.components);!(r=n()).done;){var o=r.value;ee(o,t.EffectComponent)&&this.taggedProperties.components.push(o)}}this.taggedProperties.content={}},r.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,o=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(o),s=a.x,u=a.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=eH(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=eH(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&eh(null==(t=this.parent)?void 0:t.children,this)},i.isComposition=function(t){return t.type===tx.composition},i.isSprite=function(t){return t.type===tx.sprite},i.isParticle=function(t){return t.type===tx.particle},i.isNull=function(t){return t.type===tx.null},i.isTree=function(t){return t.type===tx.tree},i.isCamera=function(t){return t.type===tx.camera},i.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},eB(i,[{key:"content",get:function(){return this._content}},{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=eH(this.rendererComponents);!(e=i()).done;)e.value.priority=t}}}]),i}(e7),er([e9(void 0,void 0)],t.VFXItem.prototype,"components",void 0),t.VFXItem=er([e6(tX.VFXItemData)],t.VFXItem),t.Item=void 0,(ta=t.Item||(t.Item={})).is=function(t,e){return t.type===e},ta.isComposition=function(t){return t.type===tx.composition},ta.isParticle=function(t){return t.type===tx.particle},ta.isNull=function(t){return t.type===tx.null};var av={},ay=[],ag={};function ax(t,e,i,r){ag[t]&&eO.error("Duplicate registration for plugin "+t+"."),ag[t]=i,av[t]=e,r&&ec(ay,t)}var aT=function(){function e(t){var e={},i=[],r=function(t){var r=av[t];i.includes(r)||(i.push(r),e[t]=r)};ay.forEach(r),t.forEach(r),this.plugins=Object.keys(e).map(function(t){var e,i=av[t];if(!i)throw Error("The plugin '"+t+"' not found."+((e=ab[t])?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""));var r=new i;return r.name=t,r}).sort(function(t,e){return t.order-e.order})}var i=e.prototype;return i.initializeComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionConstructed(t,e)})},i.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},i.resetComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionReset(t,e)})},i.createPluginItem=function(e,i,r){var n=ag[e];if(!n)throw Error("The plugin '"+e+"' does not have a registered constructor.");var o=new n(r.getEngine(),i,r);if(o.composition=r,!ee(o,t.VFXItem))throw Error("The plugin '"+e+"' invalid constructor type.");return o},i.processRawJSON=function(t,e){var i=this;return et(function(){return en(this,function(r){return[2,i.callStatic("processRawJSON",t,e)]})})()},i.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 et(function(){var e,r,o,a,s,u;return en(this,function(c){for(o=0,e=[],r=n.plugins;o<r.length;o++)t in(a=av[r[o].name])&&e.push(Promise.resolve(null==(u=a[t])?void 0:(s=u).call.apply(s,[].concat([a],i))));return[2,Promise.all(e)]})})()},i.precompile=function(t,e,i){var r=this;return et(function(){return en(this,function(n){return[2,r.callStatic("precompile",t,e,i)]})})()},i.loadResources=function(t,e){var i=this;return et(function(){return en(this,function(r){return[2,i.callStatic("prepareResource",t,e)]})})()},e}(),ab={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",tree:"@galacean/effects-plugin-model",model:"@galacean/effects-plugin-model","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",spine:"@galacean/effects-plugin-spine"},aE=function(){function t(){}return t.collectSerializableObject=function(e,i){if(!i[e.getInstanceId()]){e.toData(),i[e.getInstanceId()]=e;var r=e8(e);if(r)for(var n,o=eH(Object.keys(r));!(n=o()).done;){var a=n.value,s=e.taggedProperties[a];if(void 0===s&&(s=e[a]),e7.is(s))t.collectSerializableObject(s,i);else if(eM(s))for(var u,c=eH(s);!(u=c()).done;){var h=u.value;e7.is(h)&&t.collectSerializableObject(h,i)}else if(eP(s))for(var l,f=eH(Object.keys(s));!(l=f()).done;){var d=s[l.value];e7.is(d)&&t.collectSerializableObject(d,i)}}}},t.serializeEffectObject=function(e){var i={},r=e.engine,n=iM({},r.jsonSceneData);t.collectSerializableObject(e,i);for(var o,a=eH(Object.keys(i));!(o=a()).done;){var s=i[o.value];n[s.getInstanceId()]||(n[s.getInstanceId()]={}),t.serializeTaggedProperties(s,n[s.getInstanceId()])}return n},t.serializeTaggedProperties=function(e,i){e.toData(),i||(i={});var r=e8(e);if(r)for(var n,o=eH(Object.keys(r));!(n=o()).done;){var a=n.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?i[a]=s:eM(s)?(i[a]||(i[a]=[]),t.serializeArrayProperty(s,i[a],0)):e7.is(s)?i[a]={id:s.getInstanceId()}:eP(s)&&(i[a]||(i[a]={}),t.serializeObjectProperty(s,i[a],0))}for(var u,c=eH(Object.keys(e.taggedProperties));!(u=c()).done;){var h=u.value,l=e.taggedProperties[h];"number"==typeof l||"string"==typeof l||"boolean"==typeof l||t.checkTypedArray(l)?i[h]=l:eM(l)?(i[h]||(i[h]=[]),t.serializeArrayProperty(l,i[h],0)):e7.is(l)?i[h]={id:l.getInstanceId()}:eP(l)&&(i[h]||(i[h]={}),t.serializeObjectProperty(l,i[h],0))}return i},t.deserializeTaggedProperties=function(e,i){for(var r,n=i.taggedProperties,o=e8(i),a=i.engine,s=eH(Object.keys(e));!(r=s()).done;){var u=r.value;if(!o||!o[u]){var c=e[u];n[u]=t.deserializeProperty(c,a,0)}}if(o)for(var h,l=eH(Object.keys(o));!(h=l()).done;){var f=h.value,d=e[f];if(void 0!==d){var p=o[f].type;i[f]=t.deserializeProperty(d,a,0,p)}}i.fromData(n)},t.deserializeTaggedPropertiesAsync=function(e,i){return et(function(){var r,n,o,a,s,u,c,h,l,f,d,p;return en(this,function(m){switch(m.label){case 0:r=i.taggedProperties,n=e8(i),o=i.engine,a=eH(Object.keys(e)),m.label=1;case 1:if((s=a()).done)return[3,4];if(u=s.value,n&&n[u])return[3,3];return c=e[u],[4,t.deserializePropertyAsync(c,o,0)];case 2:r[u]=m.sent(),m.label=3;case 3:return[3,1];case 4:if(!n)return[3,8];h=eH(Object.keys(n)),m.label=5;case 5:if((l=h()).done)return[3,8];if(void 0===(d=e[f=l.value]))return[3,7];return p=n[f].type,[4,t.deserializePropertyAsync(d,o,0,p)];case 6:i[f]=m.sent(),m.label=7;case 7:return[3,5];case 8:return i.fromData(r),[2]}})})()},t.checkTypedArray=function(t){return ee(t,Int8Array)||ee(t,Uint8Array)||ee(t,Uint8ClampedArray)||ee(t,Int16Array)||ee(t,Uint16Array)||ee(t,Int32Array)||ee(t,Uint32Array)||ee(t,Float32Array)||ee(t,Float64Array)||ee(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(eP(t)&&1===Object.keys(t).length&&"id"in t&&eI(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return eP(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return eV(t)||ee(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(eM(e)){for(var o,a=[],s=eH(e);!(o=s()).done;){var u=o.value;a.push(t.deserializeProperty(u,i,r+1,n))}return a}if(t.checkDataPath(e))return i.assetLoader.loadGUID(e.id);if(!eP(e)||e.constructor!==Object)return e;c=n?new n:{};for(var c,h,l=eH(Object.keys(e));!(h=l()).done;){var f=h.value;c[f]=t.deserializeProperty(e[f],i,r+1)}return c},t.deserializePropertyAsync=function(e,i,r,n){return et(function(){var o,a,s,u,c,h,l,f,d;return en(this,function(p){switch(p.label){case 0:if(r>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!eM(e))return[3,5];o=[],a=eH(e),p.label=1;case 1:if((s=a()).done)return[3,4];return u=s.value,c=o.push,[4,t.deserializePropertyAsync(u,i,r+1,n)];case 2:c.apply(o,[p.sent()]),p.label=3;case 3:return[3,1];case 4:return[2,o];case 5:if(!t.checkDataPath(e))return[3,7];return[4,i.assetLoader.loadGUIDAsync(e.id)];case 6:return[2,p.sent()];case 7:if(!(eP(e)&&e.constructor===Object))return[3,12];h=n?new n:{},l=eH(Object.keys(e)),p.label=8;case 8:if((f=l()).done)return[3,11];return d=f.value,[4,t.deserializePropertyAsync(e[d],i,r+1)];case 9:h[d]=p.sent(),p.label=10;case 10:return[3,8];case 11:return[2,h];case 12:return[2,e];case 13:return[2]}})})()},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,o=eH(Object.keys(e));!(n=o()).done;){var a=n.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[a]=s:eM(s)?(i[a]||(i[a]=[]),t.serializeArrayProperty(s,i[a],r+1)):e7.is(s)?i[a]={id:s.getInstanceId()}:eP(s)&&(i[a]||(i[a]={}),t.serializeObjectProperty(s,i[a],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 o=e[n];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[n]=o:eM(o)?(i[n]||(i[n]=[]),t.serializeArrayProperty(o,i[n],r+1)):e7.is(o)?i[n]={id:o.getInstanceId()}:eP(o)&&(i[n]||(i[n]={}),t.serializeObjectProperty(o,i[n],r+1))}},t}(),a_=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){if(this.engine.objectInstance[e])return this.engine.objectInstance[e];var i,r=this.findData(e);if(!r){console.error("Object data with uuid: "+e+" not found.");return}switch(r.dataType){case tX.Material:i=rt.create(this.engine);break;case tX.Geometry:i=r2.create(this.engine);break;case tX.Texture:i=i$.create(this.engine);break;default:var n=t.getClass(r.dataType);n&&(i=new n(this.engine))}if(!i){console.error("Constructor for DataType: "+r.dataType+" not found.");return}return i.setInstanceId(r.id),this.engine.addInstance(i),aE.deserializeTaggedProperties(r,i),i},e.loadGUIDAsync=function(e){var i=this;return et(function(){var r,n,o;return en(this,function(a){switch(a.label){case 0:if(i.engine.objectInstance[e])return[2,i.engine.objectInstance[e]];if(r=i.findData(e))return[3,2];if(!i.engine.database)return console.error("Object data with uuid: "+e+" not found."),[2,void 0];return[4,i.engine.database.loadGUID(e)];case 1:if(!(n=a.sent()))return console.error("Disk data with uuid: "+e+" not found."),[2,void 0];return i.engine.addInstance(n),[2,n];case 2:switch(r.dataType){case tX.Material:n=rt.create(i.engine);break;case tX.Geometry:n=r2.create(i.engine);break;case tX.Texture:n=i$.create(i.engine);break;default:(o=t.getClass(r.dataType))&&(n=new o(i.engine))}if(!n)return console.error("Constructor for DataType: "+r.dataType+" not found."),[2,void 0];return n.setInstanceId(r.id),i.engine.addInstance(n),[4,aE.deserializeTaggedPropertiesAsync(r,n)];case 3:return a.sent(),[2,n]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return e5[t]},t}(),aC=function(){function t(){}return t.prototype.loadGUID=function(t){return et(function(){return en(this,function(t){return[2,void 0]})})()},t}();function aS(t,e){if(!t.includes(e))return t.push(e),!0}function aA(t){if(Number.isFinite(t))return[tA.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tA.CONSTANT)return[tA.CONSTANT,t[1]];if("lines"===e)return[tA.LINE,t[1]];if(e===tA.LINE){var r=i.map(function(t){return[tw.LINE,t]});return[tA.BEZIER_CURVE,r]}return"curve"===e||e===tA.CURVE?[tA.BEZIER_CURVE,aX(i)]:t}}function aw(t,e){return Array.isArray(t)&&"random"===t[0]?[tA.CONSTANT,t[1][e]]:aA(t)}function aO(t){return t&&"color"===t[0]?aM(t[1],!0):[1,1,1,1]}function aR(t){return t&&"random"===t[0]?[tA.RANDOM,t[1]]:aA(t)}function aI(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,o=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,a=aM(t[r],e);i.push([o,a[0],a[1],a[2],a[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tA.GRADIENT_COLOR,i]}}function aM(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 ee(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=aL(i)),i}function aL(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function aP(t,e){return Array.isArray(t)?t[0]===tA.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&aI(t[1],e):aI(t,e)}function aV(t){if(t){if(3===t.length)return[tA.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tA.BEZIER_PATH||e===tA.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],o=i[2],a=aX(r);if(!o){o=[];for(var s=0;s<n.length;s++){var u=n[s].slice();0===s||s<n.length-1&&o.push(u),o.push(u)}}return[tA.BEZIER_CURVE_PATH,[a,n,o]]}return t}}function aF(t){for(var e,i=eH(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function aN(t){for(var e,i=eH(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var aD=Math.cos,az=Math.sin,ak=Math.PI/180,aU=180/Math.PI;function aB(t,e){return t?[t[0]-.5,.5-t[1]]:e?aG[e]:[0,0]}var aG=((t1={})[tb.PARTICLE_ORIGIN_CENTER]=[0,0],t1[tb.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t1[tb.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t1[tb.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t1[tb.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t1[tb.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t1[tb.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t1[tb.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t1[tb.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t1);function aX(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]]],o=0;o<t.length-1;o++){var a=t[o][3]*(e-i),s=t[o+1][2]*(e-i),u=[t[o][0],t[o][1]],c=[t[o+1][0],t[o+1][1]];if(u[0]!=c[0]){var h=function(t,e,i,r){var n=i[0],o=i[1],a=r[0],s=r[1],u=a-n;return[[n+(a-n)/3,o+(t*=u)/3],[a-(a-n)/3,s-(e*=u)/3]]}(a,s,u,c),l=h[0],f=h[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[1]),n.push([f[0],f[1],c[0],c[1]])}else n[n.length-1].push(c[0]),n[n.length-1].push(c[1])}return n.map(function(t,e){return 0===e?[tw.EASE_OUT,t]:e===n.length-1?[tw.EASE_IN,t]:[tw.EASE,t]})}function aj(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tx.null&&t.endBehavior===tO.destroy&&(t.endBehavior=tO.freeze)})}),t.version="2.1",t}function aH(t){for(var e,i=iM({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=eH(i.images);!(e=r()).done;)e.value.id=eD();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){var e;t.id=eD(),t.dataType=tX.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:eD(),dataType:tX.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(o=t.bins,i.bins=o.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eD()}}));for(var o,a,s={},u={},c=eH(t.compositions);!(a=c()).done;)!function(){var t=a.value;(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=4),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tx.particle&&t.content.filter&&delete t.content.filter});for(var e,r=eH(t.items);!(e=r()).done;){var n=e.value;s[n.id]=eD(),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],o=e.parentId.split("^")[1];e.parentId=s[n]+"^"+o}else e.parentId=s[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var o=iM({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(o),function(t,e,i){for(var r,n=[],o=[],a=[],s={tracks:[],id:eD(),dataType:"TimelineAsset"},u=eH(t.items);!(r=u()).done;){var c=e[r.value.id],h=[],l={id:eD(),dataType:"ActivationPlayableAsset"};a.push(l);var f={id:eD(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:l.id}}]};if(h.push({id:f.id}),o.push(f),c.type!==tx.particle){var d={id:eD(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};a.push(d);var p={id:eD(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:d.id}}]};h.push({id:p.id}),o.push(p)}if(c.type===tx.sprite){var m={id:eD(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime};a.push(m);var v={id:eD(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:m.id}}]};h.push({id:v.id}),o.push(v)}if(c.type===tx.composition){var y={id:eD(),dataType:"SubCompositionPlayableAsset"};a.push(y);var g={id:eD(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:y.id}}]};h.push({id:g.id}),o.push(g)}var x={id:eD(),dataType:"ObjectBindingTrack",children:h,clips:[]};o.push(x),s.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:c.id}})}for(var T,b=[],E=eH(o);!(T=E()).done;){var _=T.value;b.push({id:_.id})}t.timelineAsset={id:s.id},t.sceneBindings=n,i.miscs.push(s);for(var C,S=eH(o);!(C=S()).done;){var A=C.value;i.miscs.push(A)}for(var w,O=eH(a);!(w=O()).done;){var R=w.value;i.miscs.push(R)}}(o,u,i)}();for(var h,l=eH(i.items);!(h=l()).done;){var f=h.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!=(T=f.transform.scale)?T:[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===tx.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tx.sprite){var g,x,T,b,E,_,C,S=f.content;S.renderer||(S.renderer={});var A=S.renderer,w=aB(A.anchor,A.particleOrigin),O=f.transform.size;A.anchor||void 0===A.particleOrigin||(f.transform.position.x+=-w[0]*(null!=(b=null==O?void 0:O.x)?b: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===tx.particle){var R=f.content;R.renderer||(R.renderer={});var I=R.renderer;R.renderer.anchor=aB(I.anchor,I.particleOrigin)}f.type===tx.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),f.content.tracks=[];var M=f.content.tracks;if(f.type!==tx.particle&&M.push({clips:[{id:eD(),dataType:"TransformPlayableAsset",sizeOverLifetime:f.content.sizeOverLifetime,rotationOverLifetime:f.content.rotationOverLifetime,positionOverLifetime:f.content.positionOverLifetime}]}),f.type===tx.sprite&&M.push({clips:[{id:eD(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:f.content.colorOverLifetime,startColor:f.content.options.startColor}]}),void 0!==f.pn){var L=f.pn,P=t.plugins,V=void 0===P?[]:P;void 0!==L&&Number.isInteger(L)&&(f.pluginName=V[L])}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===tx.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===tx.sprite||f.type===tx.particle||f.type===tx.mesh||f.type===tx.skybox||f.type===tx.light||"camera"===f.type||f.type===tx.tree||f.type===tx.interact||f.type===tx.camera||f.type===tx.text||f.type===tx.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eD(),f.content.item={id:f.id},f.dataType=tX.VFXItemData,f.components.push({id:f.content.id})),(f.type===tx.null||f.type===tx.composition)&&(f.components=[],f.dataType=tX.VFXItemData),f.type){case tx.sprite:f.content.dataType=tX.SpriteComponent;break;case tx.particle:f.content.dataType=tX.ParticleSystem;break;case tx.mesh:f.content.dataType=tX.MeshComponent;break;case tx.skybox:f.content.dataType=tX.SkyboxComponent;break;case tx.light:f.content.dataType=tX.LightComponent;break;case"camera":f.content.dataType=tX.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tx.tree:f.content.dataType=tX.TreeComponent;break;case tx.interact:f.content.dataType=tX.InteractComponent;break;case tx.camera:f.content.dataType=tX.CameraController;break;case tx.text:f.content.dataType=tX.TextComponent;break;case tx.spine:f.content.dataType="SpineComponent"}}return i.version="3.0",i}function aW(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},o={path:aV(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:aA(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:aA(n.linearX),linearY:aA(n.linearY),linearZ:aA(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:aA(n.orbitalX),orbitalY:aA(n.orbitalY),orbitalZ:aA(n.orbitalZ),speedOverLifetime:aA(n.speedOverLifetime)};aN(o);var a={options:{startColor:aO(r.startColor)},positionOverLifetime:o};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=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=aA(s.x),u.y=aA(s.y),u.z=aA(s.z)):u.z=aA(s.angularVelocity)}var c=t.colorOverLifetime;if(c){var h=a.colorOverLifetime={opacity:aA(c.opacity)};c.color&&(h.color=aP(c.color))}var l=t.sizeOverLifetime;return l&&(a.sizeOverLifetime={separateAxes:l.separateAxes,size:aA(l.size),x:aA(l.x),y:aA(l.y),z:aA(l.z)}),a}var aY=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,aZ=/^(\d+)\.(\d+)$/,aq=!1;function aQ(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(l=null==(h=(c=t).version)?void 0:h.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||c.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tx.mesh||t.type===tx.light)&&(t.endBehavior=1===t.endBehavior?tO.destroy:t.endBehavior)})}),aY.test(t.version)){var e,i,r,n,o,a,s,u;return aq=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",aH(aj((aK="1.0",n=(e=t).plugins||[],(null==(i=e.bins)?void 0:i.length)&&(aK="1.3"),o=(e.requires||[]).slice(),a=e.images.map(function(t,i){return aJ(t,i,e.imageTags||[])}),s=e.textures||a.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:aK,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return a$(t,{plugins:n,requires:o})}),images:a,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)))}aq=!1;var c,h,l,f,d,p=aZ.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=eH(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=eH(Object.keys(e));!(i=r()).done;){var n=i.value,o=e[n],a=Array.isArray(o);a&&2===o.length&&Array.isArray(o[1])?"path"===n?e[n]=aV(o):e[n]=aA(o):a||"object"!=typeof o||t(o)}})(e.value.content)}),t=d),m<3?aH(aj(t)):t;throw Error("Invalid JSON version: "+t.version+".")}var aK="1.0";function aJ(t,e,i){var r=i[e],n=t.oriY;if("string"==typeof t)return{id:eD(),renderLevel:r,url:t,oriY:n};if(t.template)return{id:eD(),url:t.url,template:t.template,webp:t.webp,renderLevel:r,oriY:n};if(t.compressed)return{id:eD(),url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eD(),url:t.url,webp:t.webp,renderLevel:r,oriY:n};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function a$(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iM({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return a1(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var o=null==(i=t.meta)?void 0:i.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(r.previewSize=o),r}var a0=[0,0,0,1];function a1(t,e){void 0===e&&(e={});var i=tx.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tx.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),h=t.transform||T(l.transform)):t.particle?(i=tx.particle,h=T((l=t.particle).transform,aq,!0),f=function(t){var e=t.options,i=t.transform,r={type:tm.NONE};if(t.shape){var n,o=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iM({},t.shape,{type:tm[o]}),t.shape.upDirection){var a=t.shape.upDirection,s=a[0],u=a[1],c=a[2];0===s&&0===u&&0===c&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=aR(e.turbulenceX),r.turbulenceY=aR(e.turbulenceY),r.turbulenceZ=aR(e.turbulenceZ));var h=t.emission;h.bursts&&h.bursts.length>0&&(h.bursts=h.bursts.map(function(t){return aF(t)})),h.burstOffsets&&h.burstOffsets.length>0&&(h.burstOffsets=h.burstOffsets.map(function(t){return aF(t)})),h.rateOverTime&&(h.rateOverTime=aR(h.rateOverTime));var l={renderer:t.renderer,shape:r,splits:t.splits,emission:h,options:{startLifetime:aR(e.startLifetime),start3DSize:!!e.start3DSize,startSize:aR(e.startSize),startSizeX:aR(e.startSizeX),startSizeY:aR(e.startSizeY),sizeAspect:aR(e.sizeAspect),maxCount:e.maxCount,startDelay:aR(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tA.COLORS,t[1].map(function(t){return aM(t,e)})]:"gradient"===t[0]?aI(t[1],e):"color"===t[0]?[tA.RGBA_COLOR,aM(t[1],e)]:t}(e.startColor,!0),startRotationZ:aR(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=aR(e.startRotationX),l.options.startRotationY=aR(e.startRotationY)),i&&i.path&&(l.emitterTransform={path:aV(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:aR(f.x),y:aR(f.y)}:l.sizeOverLifetime={size:aR(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?aA(p):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:aA(e.gravityModifier),startSpeed:aR(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:aR(d.linearX),linearY:aR(d.linearY),linearZ:aR(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:aR(d.orbitalX),orbitalY:aR(d.orbitalY),orbitalZ:aR(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:aA(d.forceCurve)},aN(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:aR(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=aA(m.y),l.rotationOverLifetime.x=aA(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:aA(v.opacity)};v.color&&(y.color=aP(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:aA(g.cycles),animationDelay:aw(g.animationDelay,0),animationDuration:aw(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:aR(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:aA(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&aP(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&aP(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:aR(x.opacityOverLifetime)}),l.trails&&aN(l.trails);var T=t.interaction;return T&&(l.interaction={behavior:T.behavior,radius:T.radius,multiple:T.multiple}),l}(l)):t.sprite?(i=tx.sprite,h=T((l=t.sprite).transform,!1,!0),s=aW(a=l,h),(u=a.textureSheetAnimation)&&(s.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),s.renderer=a.renderer,a.splits&&(s.splits=a.splits),a.interaction&&(s.interaction=a.interaction),f=s):t.cal?(i=tx.null,h=T((l=t.cal).transform,!1,!0),f=aW(l,h)):t.ui?(i=tx.interact,h=T((l=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:ty.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&aO(i.previewColor),behavior:i.behavior||tg.NOTIFY};break;case"drag":e={type:ty.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:ty.MESSAGE}}return{options:e}}(l),h.scale=[l.options.width||1,l.options.height||1,1]):t.model&&(l=t.model,1===t.model.options.type&&(i=tx.camera,h=T(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,o,a={path:aV(null==(o=t.transform)?void 0:o.path),linearX:aA(null==r?void 0:r.translateX),linearY:aA(null==r?void 0:r.translateY),linearZ:aA(null==r?void 0:r.translateZ)};aN(a),i.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:aA(null==s?void 0:s.rotateX),y:aA(null==s?void 0:s.rotateY),z:s.separateAxes?aA(null==s?void 0:s.rotateZ):aA(s.rotation)};aN(u),i.rotationOverLifetime=u}return i}(l))),null==(c=f.renderer)?void 0:c.anchor){var o=new Float32Array(f.renderer.anchor);.5==o[0]&&.5==o[1]?delete f.renderer.anchor:e.requires&&aS(e.requires,"anchor")}if(l){var a,s,u,c,h,l,f,d,p,m,v,y,g=null==(v=l.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tO.restart:tO.destroy:tO.restart:r||(null==l?void 0:null==(y=l.options)?void 0:y.endBehavior)||tO.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:h,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(aS(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 T(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 o,a,s,u,c,h,l,f,d,p,m,v,y,g,x,T,b,E,_,C,S,A,w,O,R=(o=r.rotation[0],a=r.rotation[1],s=r.rotation[2],u=aD(o*ak/2),c=aD(a*ak/2),h=aD(s*ak/2),l=az(o*ak/2),f=az(a*ak/2),d=az(s*ak/2),a0[0]=l*c*h+u*f*d,a0[1]=u*f*h-l*c*d,a0[2]=u*c*d+l*f*h,a0[3]=u*c*h-l*f*d,a0);r.rotation=(p=[],m=R[0],v=R[1],y=R[2],g=R[3],x=m+m,T=v+v,b=y+y,E=m*x,_=v*x,C=v*T,S=y*b,A=g*b,w=y*x-g*T,p[1]=Math.asin((O=-w)>1?1:O<-1?-1:O)*aU,.9999999>Math.abs(w)?(p[0]=Math.atan2(y*T+g*x,1-E-C)*aU,p[2]=Math.atan2(_+A,1-C-S)*aU):(p[0]=0,p[2]=Math.atan2(-(_-A),1-E-S)*aU),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 a2=((t2={})[tl.S]=[tl.S,tl.BPlus,tl.APlus],t2[tl.A]=[tl.A,tl.BPlus,tl.APlus],t2[tl.B]=[tl.B,tl.BPlus],t2);function a3(t,e){if(!t||!e)return!0;var i=a2[e];return!!i&&i.includes(t)}function a4(t){return eP(t)&&"jsonScene"in t}function a5(t){return eP(t)&&"url"in t}function a6(t){return eP(t)&&"options"in t}function a8(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},o=n.name,a=n.url;return o&&(e&&e[o]?i=e[o]:a&&(i=a)),i}function a9(t,e,i){return a7.apply(this,arguments)}function a7(){return(a7=et(function(t,e,i){var r,n;return en(this,function(o){switch(o.label){case 0:if("string"!=typeof t)return[3,2];return[4,ik(t)];case 1:return r=o.sent(),[3,3];case 2:r=t,o.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=a8(e,i)){if(eI(n)&&n!==r.src)return[2,ik(n)];if(ee(n,HTMLImageElement))return[2,n]}return[2,r]}})})).apply(this,arguments)}var st=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(e7),se=1,si=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new iL),this.options=t,this.downloader=e,this.assets={},this.id=se++,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.updateSceneData=function(t){var e=this.options.variables;e&&0!==Object.keys(e).length&&t.forEach(function(t){if(t.type===tx.text){var i=e[t.name];i&&(t.content.options.text=i)}})},i.loadScene=function(e,i,r){var n=this;return et(function(){var o,a,s,u,c,h,l,f,d,p,m,v,y,g,x;return en(this,function(T){return s=eI(e)?e:n.id,u=performance.now(),c=[],f=null!=(l=null==(h=null==i?void 0:i.engine.gpuCapability)?void 0:null==(o=h.detail)?void 0:o.asyncShaderCompile)&&l,p=null!=(d=null==h?void 0:h.detail.compressedTexture)?d:t.COMPRESSED_TEXTURE.NONE,m={},y=!1,g=new Promise(function(t,e){v=window.setTimeout(function(){y=!0,n.removeTimer(v),e(Error("Load time out: totalTime: "+(performance.now()-u).toFixed(4)+"ms "+c.join(" ")+", url: "+s+"."))},1e3*n.timeout),n.timers.push(v)}),x=et(function(t,e){var i,r,n;return en(this,function(o){switch(o.label){case 0:if(y)return[3,4];i=performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e()];case 2:return r=o.sent(),n=performance.now()-i,c.push("["+t+": "+n.toFixed(2)+"]"),m[t]=n,[2,r];case 3:throw Error("Load error in "+t+", "+o.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([g,et(function(){var t,o,h,l,d,y,g,T,b,E,_,C,S,A,w,O,R,I,M,L,P;return en(this,function(V){switch(V.label){case 0:if(!eP(e))return[3,1];return a=e,n.baseUrl=location.href,[3,3];case 1:return e=new URL(e,location.href).href,n.baseUrl=e,[4,x("loadJSON",function(){return n.loadJSON(e)})];case 2:a=V.sent(),V.label=3;case 3:if(!a4(a))return[3,6];if(t=iM({},a),!(n.options&&n.options.variables&&0!==Object.keys(n.options.variables).length))return[3,5];for(l=0,o=a.jsonScene.images,h=t.images;l<o.length;l++)ee(h[l],HTMLCanvasElement)&&(h[l]=o[l]);return[4,x("processImages",function(){return n.processImages(h,p)})];case 4:for(d=0,t.images=V.sent();d<t.images.length;d++)t.textureOptions[d].image=t.images[d];n.updateSceneData(t.jsonScene.items),V.label=5;case 5:return[3,12];case 6:return[4,x("processJSON",function(){return n.processJSON(a)})];case 7:return g=(y=V.sent()).usedImages,T=y.jsonScene,b=y.pluginSystem,_=void 0===(E=T.bins)?[]:E,C=T.images,S=T.compositions,A=T.fonts,[4,Promise.all([x("processBins",function(){return n.processBins(_)}),x("processImages",function(){return n.processImages(C,p)}),x((f?"async":"sync")+"Compile",function(){return n.precompile(S,b,i,r)})])];case 8:if(O=(w=V.sent())[0],R=w[1],i)for(I=0;I<C.length;I++)(M=new st(i.engine)).data=R[I],M.setInstanceId(C[I].id),i.engine.addInstance(M);return[4,x("processFontURL",function(){return n.processFontURL(A)})];case 9:return V.sent(),[4,x("processTextures",function(){return n.processTextures(R,O,T,i.engine)})];case 10:return L=V.sent(),n.updateSceneData(T.items),t={timeInfos:m,url:e,renderLevel:n.options.renderLevel,storage:{},pluginSystem:b,jsonScene:T,usedImages:g,images:R,textureOptions:L,bins:O},[4,x("processPlugins",function(){return b.loadResources(t,n.options)})];case 11:V.sent(),V.label=12;case 12:return P=performance.now()-u,eO.info("Load asset: totalTime: "+P.toFixed(4)+"ms "+c.join(" ")+", url: "+s+"."),window.clearTimeout(v),n.removeTimer(v),t.totalTime=P,t.startTime=u,t.timeInfos=m,[2,t]}})})()])]})})()},i.precompile=function(t,e,i,r){return et(function(){var n;return en(this,function(o){switch(o.label){case 0:if(!i||!i.getShaderLibrary())return[2];return n=null==i?void 0:i.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,i,r)];case 1:return o.sent(),[4,new Promise(function(t){null==n||n.compileAllShaders(function(){t(null)})})];case 2:return o.sent(),[2]}})})()},i.processJSON=function(t){var e=this;return et(function(){var i,r,n,o,a,s,u,c,h;return en(this,function(l){switch(l.label){case 0:return n=void 0===(r=(i=aQ(t)).plugins)?[]:r,o=i.compositions,a=i.imgUsage,s=i.images,[4,(u=new aT(n)).processRawJSON(i,e.options)];case 1:return l.sent(),c=e.options.renderLevel,h={},a?function(t,e,i,r,n){for(var o=0;o<e.length;o++){var a=i[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];a3(r[u].renderLevel,n)&&(t[u]=!0)}}}(h,o,a,s,c):null==s||s.forEach(function(t,e){h[e]=!0}),[2,{usedImages:h,jsonScene:i,pluginSystem:u}]}})})()},i.processBins=function(t){var e=this;return et(function(){var i,r;return en(this,function(n){return i=e.options.renderLevel,r=e.baseUrl,[2,Promise.all(t.map(function(n){if(ee(n,ArrayBuffer))return n;if(a3(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 et(function(){return en(this,function(r){return t?[2,Promise.all(t.map(et(function(t){var r,n,o;return en(this,function(a){switch(a.label){case 0:if(!(t.fontURL&&!e.fonts.has(t.fontFamily)))return[3,4];eA(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),r=new URL(t.fontURL,i.baseUrl).href,[4,(o=new FontFace(null!=(n=t.fontFamily)?n:"","url("+r+")")).load()];case 2:return a.sent(),document.fonts.add(o),e.fonts.add(t.fontFamily),[3,4];case 3:return a.sent(),eO.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 et(function(){var n,o,a,s;return en(this,function(u){return o=(n=r.options).useCompressedTexture,a=n.variables,s=r.baseUrl,[2,Promise.all(e.map(et(function(e,n){var u,c,h,l,f,d,p,m,v,y,g,x,T,b,E,_,C,S,A,w;return en(this,function(O){switch(O.label){case 0:if(u=e.url,c=e.webp,h=e.avif,l=new URL(u,s).href,f=c&&new URL(c,s).href,d=h&&new URL(h,s).href,!("template"in e))return[3,8];if(!(m=(p=e.template).background))return[3,7];v=a8(p,a),y=m.type===tS.video,g=m&&y?ij:ik,O.label=1;case 1:return O.trys.push([1,6,,7]),[4,iW(v,g)];case 2:if(!ee(x=O.sent(),HTMLVideoElement))return[3,3];return[2,x];case 3:return m&&Array.isArray(v)&&a&&(a[m.name]=x.src),[4,a9(x,p,a)];case 4:return[2,O.sent()];case 5:return[3,7];case 6:throw T=O.sent(),Error("Failed to load. Check the template or if the URL is "+(y?"video":"image")+" type, URL: "+v+", Error: "+T.message+".");case 7:return[3,9];case 8:if("compressed"in e&&o&&i){if(b=e.compressed,i===t.COMPRESSED_TEXTURE.ASTC?E=b.astc:i===t.COMPRESSED_TEXTURE.PVRTC&&(E=b.pvrtc),E)return _=new URL(E,s).href,r.assets[n]={url:_,type:t.TextureSourceType.compressed},[2,r.loadBins(_)]}else if("sourceType"in e)return[2,e];else if(ee(e,HTMLImageElement)||ee(e,HTMLCanvasElement)||ee(e,HTMLVideoElement)||ee(e,i$))return[2,e];O.label=9;case 9:if(!d)return[3,11];return[4,iD(l,d)];case 10:return w=O.sent(),[3,13];case 11:return[4,iF(l,f)];case 12:w=O.sent(),O.label=13;case 13:return S=(C=w).url,A=C.image,r.assets[n]={url:S,type:t.TextureSourceType.image},[2,A]}})})))]})})()},i.processTextures=function(e,i,r,n){var o=this;return et(function(){var a;return en(this,function(s){return[2,Promise.all((null!=(a=r.textures)?a:e.map(function(t,e){return{source:e}})).map(et(function(e,a){var s,u,c;return en(this,function(h){switch(h.label){case 0:if(ee(e,i$))return[2,e];if(!("mipmaps"in e))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,iZ(e,i,n,r.bins)];case 2:return[2,h.sent()];case 3:throw Error("Load texture "+a+" fails, error message: "+h.sent()+".");case 4:if(!eP(s=e.source))return[3,5];return u=n.assetLoader.loadGUID(s.id).data,[3,7];case 5:if("string"!=typeof s)return[3,7];return[4,ik(ez(s))];case 6:u=h.sent(),h.label=7;case 7:if(u)return(c=function(e,i){if(ee(e,i$))return e.source;if(ee(e,HTMLImageElement)||eV(e))return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:iC.LINEAR,magFilter:iC.LINEAR};if(ee(e,HTMLVideoElement))return{sourceType:t.TextureSourceType.video,video:e,minFilter:iC.LINEAR,magFilter:iC.LINEAR};if(ee(e,ArrayBuffer))return iM({},i5(e),{sourceFrom:i});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:iC.CLAMP_TO_EDGE,wrapT:iC.CLAMP_TO_EDGE,minFilter:iC.NEAREST,magFilter:iC.NEAREST};throw Error("Invalid texture options.")}(u,o.assets[a])).id=e.id,c.dataType=tX.Texture,[2,c.sourceType===t.TextureSourceType.compressed?c:iM({},c,e)];throw Error("Invalid texture source: "+s+".")}})})))]})})()},i.loadJSON=function(t){var e=this;return et(function(){return en(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 et(function(){return en(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.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){for(var t in this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets){var e,i=this.assets[t];null==i||null==(e=i.dispose)||e.call(i)}this.assets={},this.timers=[]},e}();si.fonts=new Set;var sr=new eJ(1,1,1),sn=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewportMatrix=e0.fromIdentity(),this.viewMatrix=e0.fromIdentity(),this.projectionMatrix=e0.fromIdentity(),this.viewProjectionMatrix=e0.fromIdentity(),this.inverseViewMatrix=e0.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,o=e.aspect,a=e.clipMode,s=void 0===a?tC.portrait:a,u=e.position,c=e.rotation;this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===o?1:o,clipMode:s,position:eJ.fromArray(void 0===u?[0,0,8]:u),rotation:e1.fromArray(void 0===c?[0,0,0]:c)},this.dirty=!0,this.updateMatrix()}var e=t.prototype;return 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 eJ(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 o=i.projectPoint(e).z,a=r.projectPoint(new eJ(1,1,o)),s=a.x,u=a.y,c=r.projectPoint(new eJ(-1,-1,o));return new eJ((s-c.x)/2,(u-c.y)/2,0)},e.setQuat=function(t){void 0===this.options.quat?(this.options.quat=t.clone(),this.dirty=!0):this.options.quat.equals(t)||(this.options.quat.copyFrom(t),this.dirty=!0),this.dirty&&this.setRotationByQuat(t)},e.getQuat=function(){var t=this.options.quat;if(void 0===t){t=new e$;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},e.getOptions=function(){return this.options},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,o=t.aspect,a=t.position,s=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=o,this.position=a,this.rotation=s,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,i=t.aspect,r=t.near,n=t.far,o=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*eW,i,r,n,o===tC.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(a,this.getQuat(),sr),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){n$.getRotation(t,this.options.rotation)},eB(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.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)}},{key:"rotation",get:function(){return this.options.rotation.clone()},set:function(t){this.options.rotation.equals(t)||(this.options.rotation.copyFrom(t),this.dirty=!0,this.options.quat=void 0)}}]),t}(),so=0,sa=function(){function t(t,e){this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var i=t.jsonScene,r=t.renderLevel,n=t.textureOptions,o=t.pluginSystem,a=t.totalTime,s=i.compositions,u=i.imgUsage,c=i.compositionId;if(!n)throw Error("scene.textures expected.");for(var h,l=eH(s);!(h=l()).done;){var f=h.value;f.id===c?this.composition=f:this.refCompositions.set(f.id,f)}if(!this.composition)throw Error("Invalid composition id: "+c+".");this.jsonScene=i,this.renderLevel=r,this.pluginSystem=o,this.totalTime=null!=a?a:0,this.imgUsage=null!=u?u:{},this.textures=n,so=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=t.id,i=t.duration,r=t.name,n=t.endBehavior,o=t.camera,a=t.startTime,s=this.assembleItems(t);return iM({},t,{id:e,duration:i,name:r,endBehavior:isNaN(n)?tO.freeze:n,items:s,camera:o,startTime:void 0===a?0:a})},e.assembleItems=function(t){var e=[];this.mask++;for(var i,r={},n=eH(this.jsonScene.components);!(i=n()).done;){var o=i.value;r[o.id]=o}for(var a,s=eH(t.items);!(a=s()).done;){var u=a.value,c=this.engine.jsonSceneData[u.id];if(a3(c.renderLevel,this.renderLevel)){if(c.listIndex=so++,c.type===tx.sprite||c.type===tx.particle)for(var h,l=eH(c.components);!(h=l()).done;){var f=r[h.value.id];this.preProcessItemContent(f)}if(c.type===tx.composition){var d=c.content.options.refId;if(!this.refCompositions.get(d))throw Error("Invalid ref composition id: "+d+".");var p=this.getContent(this.refCompositions.get(d));this.refCompositionProps.has(d)||this.refCompositionProps.set(d,p)}e.push(c)}}return e},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var e,i=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=o_(null==(e=this.jsonScene)?void 0:e.shapes[t.renderer.shape],i):t.renderer.shape&&eP(t.renderer.shape)&&(t.renderer.shape=o_(t.renderer.shape,i))}t.trails&&(t.trails=this.changeTex(t.trails))},e.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},e.addTextureUsage=function(t){var e,i=null!=(e=this.imgUsage)?e:{};t&&i&&(i.hasOwnProperty(t)||(i[t]=0),i[t]++)},e.processMask=function(t){var e=t.maskMode;e!==tp.NONE&&(t.mask||(e===tp.MASK?t.mask=++this.mask:e!==tp.OBSCURED&&e!==tp.REVERSE_OBSCURED||(t.mask=this.mask)))},e.dispose=function(){this.textures=[],this.composition=void 0,this.jsonScene=void 0,this.totalTime=0,this.pluginSystem=void 0,this.sourceContent=void 0,this.refCompositions.clear(),this.refCompositionProps.clear()},t}(),ss=function(e){function i(i,r){(n=e.call(this)||this).speed=1,n.loaderData={},n.refContent=[],n.refCompositionProps=new Map,n.assigned=!1,n.destroyed=!1,n.postLoaders=[],n.paused=!1,n.lastVideoUpdateTime=0;var n,o,a,s=i.reusable,u=void 0!==s&&s,c=i.speed,h=i.baseRenderOrder,l=i.renderer,f=i.event,d=i.width,p=i.height,m=i.handleItemMessage;n.compositionSourceManager=new sa(r,l.engine),r.jsonScene.imgUsage=void 0,u&&(n.keepResource=!0,r.textures=void 0,r.consumed=!0);var v=n.compositionSourceManager,y=v.sourceContent,g=v.pluginSystem,x=v.imgUsage,T=v.totalTime,b=v.refCompositionProps;eS(y),n.renderer=l,n.refCompositionProps=b,n.rootItem=new t.VFXItem(n.getEngine(),y),n.rootItem.name="rootItem",n.rootItem.composition=nk(n),n.rootComposition=n.rootItem.addComponent(aa),n.rootComposition.startTime=y.startTime,n.rootComposition.data=y;var E=!u&&x;return n.width=d,n.height=p,n.renderOrder=void 0===h?0:h,n.id=y.id,n.renderer=l,n.texInfo=null!=E?E:{},n.event=f,n.statistic={loadTime:null!=T?T:0,loadStart:null!=(o=r.startTime)?o:0,firstFrameTime:0,precompileTime:null!=(a=r.timeInfos.asyncCompile)?a:r.timeInfos.syncCompile},n.reusable=u,n.speed=void 0===c?1:c,n.autoRefTex=!n.keepResource&&E&&n.rootItem.endBehavior!==tO.restart,n.name=y.name,n.pluginSystem=g,n.pluginSystem.initializeComposition(nk(n),r),n.camera=new sn(n.name,iM({},null==y?void 0:y.camera,{aspect:d/p})),n.url=r.url,n.assigned=!0,n.globalTime=0,n.interactive=!0,n.handleItemMessage=m,n.createRenderFrame(),n.rendererOptions=null,n.rootComposition.createContent(),n.buildItemTree(n.rootItem),n.callAwake(n.rootItem),n.rootItem.onEnd=function(){window.setTimeout(function(){n.emit("end",{composition:nk(n)})},0)},n.pluginSystem.resetComposition(nk(n),n.renderFrame),n}eX(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.items.forEach(function(e){e.setVisible(t)})},r.getSpeed=function(){return this.speed},r.play=function(){this.rootItem.ended&&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 nx({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},r.setTime=function(t){var e=this.paused;e&&this.resume(),this.rootComposition.isStartCalled||(this.rootComposition.start(),this.rootComposition.isStartCalled=!0),this.forwardTime(t+this.startTime),e&&this.pause()},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.globalTime=0,this.rootItem.ended=!1,this.pluginSystem.resetComposition(this,this.renderFrame)},r.prepareRender=function(){var t=this,e=this.renderFrame;e._renderPasses[0].meshes.length=0,this.postLoaders.length=0,this.pluginSystem.plugins.forEach(function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.gatherRendererComponent(this.rootItem,e),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},r.gatherRendererComponent=function(t,e){for(var i,r=eH(t.rendererComponents);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(n)}for(var o,a=eH(t.children);!(o=a()).done;){var s=o.value;this.gatherRendererComponent(s,e)}},r.update=function(t){if(this.assigned&&!this.paused){var e=this.getUpdateTime(t*this.speed);this.globalTime+=e,this.updateRootComposition(),this.updateVideo(),this.updatePluginLoaders(t),this.callStart(this.rootItem),this.callUpdate(this.rootItem,e),this.callLateUpdate(this.rootItem,e),this.updateCamera(),this.prepareRender(),this.shouldDispose()&&this.dispose()}},r.toLocalTime=function(t){var e=t-this.rootItem.start,i=this.rootItem.duration;if(e-i>.001)switch(this.rootItem.ended||(this.rootItem.ended=!0,this.emit("end",{composition:this})),this.rootItem.endBehavior){case tO.restart:e%=i,this.restart();break;case tO.freeze:e=Math.min(i,e);case tO.forward:case tO.destroy:}return e},r.shouldDispose=function(){return this.rootItem.ended&&this.rootItem.endBehavior===tO.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=eH(t.itemBehaviours);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.awake(),r.isAwakeCalled=!0)}for(var n,o=eH(t.children);!(n=o()).done;){var a=n.value;this.callAwake(a)}},r.callStart=function(t){for(var e,i=eH(t.itemBehaviours);!(e=i()).done;){var r=e.value;r.isActiveAndEnabled&&!r.isStartCalled&&(r.start(),r.isStartCalled=!0)}for(var n,o=eH(t.rendererComponents);!(n=o()).done;){var a=n.value;a.isActiveAndEnabled&&!a.isStartCalled&&(a.start(),a.isStartCalled=!0)}for(var s,u=eH(t.children);!(s=u()).done;){var c=s.value;this.callStart(c)}},r.callUpdate=function(e,i){for(var r,n=eH(e.itemBehaviours);!(r=n()).done;){var o=r.value;o.isActiveAndEnabled&&o.isStartCalled&&o.update(i)}for(var a,s=eH(e.rendererComponents);!(a=s()).done;){var u=a.value;u.isActiveAndEnabled&&u.isStartCalled&&u.update(i)}for(var c,h=eH(e.children);!(c=h()).done;){var l=c.value;t.VFXItem.isComposition(l)&&l.ended&&l.endBehavior===tO.restart?(l.ended=!1,this.callUpdate(l,0)):this.callUpdate(l,i)}},r.callLateUpdate=function(t,e){for(var i,r=eH(t.itemBehaviours);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&n.isStartCalled&&n.lateUpdate(e)}for(var o,a=eH(t.rendererComponents);!(o=a()).done;){var s=o.value;s.isActiveAndEnabled&&s.isStartCalled&&s.lateUpdate(e)}for(var u,c=eH(t.children);!(u=c()).done;){var h=u.value;this.callLateUpdate(h,e)}},r.buildItemTree=function(e){if(e.composition){for(var i,r=new Map,n=e.getComponent(aa).items,o=eH(n);!(i=o()).done;){var a=i.value;r.set(a.id,a)}for(var s,u=eH(n);!(s=u()).done;){var c=s.value;if(void 0===c.parentId)c.setParent(e);else{var h=this.getParentIdWithoutSuffix(c.parentId),l=r.get(h);if(l)t.VFXItem.isTree(l)&&c.parentId.includes("^")?(c.parent=l,c.transform.parentTransform=l.getNodeTransform(c.parentId)):(c.parent=l,c.transform.parentTransform=l.transform),l.children.push(c);else throw Error("The element references a non-existent element, please check the data.")}}for(var f,d=eH(n);!(f=d()).done;){var p=f.value;t.VFXItem.isComposition(p)&&this.buildItemTree(p)}}},r.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},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(){if(this.rootComposition.isActiveAndEnabled){var t=this.toLocalTime(this.globalTime/1e3);this.rootComposition.time=t}},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 rh((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(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n,o=[],a=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(aa))||n.hitTest(a,t,e,o,i,r),this.refContent.forEach(function(n){var s;null==(s=n.getComponent(aa))||s.hitTest(a,t,e,o,i,r)}),o},r.addInteractiveItem=function(t,e){if(e===ty.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===ty.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.destroyTextures=function(e){for(var i=0;i<e.length;i++){var r,n=e[i];if(n){if(n.sourceType===t.TextureSourceType.data&&!this.texInfo[n.getInstanceId()]){n!==(null==(r=this.rendererOptions)?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n!==this.getEngine().emptyTexture&&n.dispose();continue}!this.autoRefTex||--this.texInfo[n.getInstanceId()]||n.dispose()}}},r.destroyItem=function(t){var e=this;t.type==tx.composition?t.endBehavior!==tO.freeze&&t.getComponent(aa).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)})}):(eh(this.items,t),this.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)}))},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={},o=this.textures;o&&this.keepResource&&o.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=eR)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){eO.error("Update disposed composition: "+r.name+".")},this.dispose=eR,o&&this.keepResource&&o.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==ib&&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 et(function(){return en(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]}})})()},eB(i,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this.compositionSourceManager.textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){var t;return null!=(t=this.rootComposition.startTime)?t:0}},{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}(am),su=new Int32Array(2),sc=new Float32Array(su.buffer),sh=new Float64Array(su.buffer),sl=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];(ts=t3||(t3={}))[ts.UTF8_BYTES=1]="UTF8_BYTES",ts[ts.UTF16_STRING=2]="UTF16_STRING";var sf=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 su[0]=this.readInt32(t),sc[0]},e.readFloat64=function(t){return su[sl?0:1]=this.readInt32(t),su[sl?1:0]=this.readInt32(t+4),sh[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){sc[0]=e,this.writeInt32(t,su[0])},e.writeFloat64=function(t,e){sh[0]=e,this.writeInt32(t,su[sl?0:1]),this.writeInt32(t+4,su[sl?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===t3.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}(),sd=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=sf.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,o=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(a)){for(var s=2;s<r;s+=2)if(this.bb.readInt16(o+s)!=this.bb.readInt16(a+s))continue t;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:(ee(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=sf.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),sp=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 sm(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}(),sm=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=sp.createDataVector(t,this.data);return sp.createFBEffectsObjectData(t,e,i)},t}(),sv=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 sp).__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 sy(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}(),sy=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=sv.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return sv.createFBEffectsPackageData(t,e)},t}(),sg=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 sx(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}(),sx=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 sg.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),sT=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 sb(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,o,a){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,o),t.addNormalize(e,a),t.endFBVertexChannel(e)},t}(),sb=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 sT.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),sE=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 sT).__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 s_(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}(),s_=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=sE.createChannelsVector(t,t.createObjectOffsetList(this.channels));return sE.createFBVertexData(t,this.vertexCount,e)},t}(),sC=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 sE).__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 sg).__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 sS(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}(),sS=function(){function t(t,e,i,r,n,o,a,s,u,c,h,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===o&&(o=[]),void 0===a&&(a=0),void 0===s&&(s=null),void 0===u&&(u=[]),void 0===c&&(c=[]),void 0===h&&(h=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=o,this.mode=a,this.buffer=s,this.binaryData=u,this.boneNames=c,this.rootBoneName=h,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=sC.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),o=null!==this.buffer?t.createString(this.buffer):0,a=sC.createBinaryDataVector(t,this.binaryData),s=sC.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,c=sC.createInverseBindMatricesVector(t,this.inverseBindMatrices);return sC.startFBGeometryData(t),sC.addId(t,e),sC.addName(t,i),sC.addVertexData(t,r),sC.addIndexFormat(t,this.indexFormat),sC.addIndexOffset(t,this.indexOffset),sC.addSubMeshes(t,n),sC.addMode(t,this.mode),sC.addBuffer(t,o),sC.addBinaryData(t,a),sC.addBoneNames(t,s),sC.addRootBoneName(t,u),sC.addInverseBindMatrices(t,c),sC.endFBGeometryData(t)},t}(),sA=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 sd(1),i=new sy,r=[],n=eH(this.exportObjectDatas);!(t=n()).done;){var o=t.value,a=void 0;o.dataType===tX.Geometry&&(a=new sm("Geometry",this.geometryDataToBinary(o))),a&&r.push(a)}return i.exportObjects=r,sv.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new sf(t),i=sv.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var o=n.dataArray(),a=n.dataType();if(o){var s=void 0;a===tX.Geometry&&(s=this.binaryToGeometryData(o)),s&&this.exportObjectDatas.push(s)}}}},e.geometryDataToBinary=function(t){var e=new sd(1),i=new sS,r=t.indexFormat,n=t.indexOffset,o=t.mode,a=t.id,s=t.vertexData,u=t.boneNames,c=t.rootBoneName,h=t.inverseBindMatrices,l=t.binaryData;i.indexFormat=r,i.indexOffset=n,i.mode=o,i.id=a,i.boneNames=void 0===u?[]:u,i.rootBoneName=void 0===c?"":c,i.inverseBindMatrices=void 0===h?[]:h,i.binaryData=void 0===l?[]:l;var f=new s_;f.vertexCount=s.vertexCount,f.channels=[];for(var d,p=eH(s.channels);!(d=p()).done;){var m=d.value,v=new sb(m.semantic,m.offset,m.format,m.dimension,m.normalize);f.channels.push(v)}i.vertexData=f;for(var y,g=[],x=eH(t.subMeshes);!(y=x()).done;){var T=y.value,b=new sx(T.offset,T.indexCount,T.vertexCount);g.push(b)}return i.subMeshes=g,sv.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e,i,r,n,o=new sf(t),a=sC.getRootAsFBGeometryData(o),s={vertexCount:0,channels:[]},u=a.vertexData();if(u){s.vertexCount=u.vertexCount();for(var c=0;c<u.channelsLength();c++){var h,l=u.channels(c);if(l){var f={semantic:null!=(h=l.semantic())?h:"",offset:l.offset(),format:l.format(),dimension:l.dimension(),normalize:l.normalize()};s.channels.push(f)}}}for(var d=[],p=0;p<a.subMeshesLength();p++){var m=a.subMeshes(p);if(m){var v={offset:m.offset(),vertexCount:m.vertexCount(),indexCount:m.indexCount()};d.push(v)}}for(var y=[],g=0;g<a.boneNamesLength();g++){var x=a.boneNames(g);y.push(x)}var T=a.inverseBindMatricesArray();return{vertexData:s,indexFormat:a.indexFormat(),indexOffset:a.indexOffset(),subMeshes:d,mode:a.mode(),buffer:null!=(e=a.buffer())?e:"",boneNames:y,rootBoneName:null!=(i=a.rootBoneName())?i:"",inverseBindMatrices:T?Array.from(T):void 0,binaryData:null!=(r=a.binaryDataArray())?r:void 0,id:null!=(n=a.id())?n:"",dataType:tX.Geometry}},t}(),sw=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 a_(this),this.emptyTexture=i2(this),this.transparentTexture=i3(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.getInstance=function(t){return this.objectInstance[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,o=i.materials,a=i.shaders,s=i.geometries,u=i.components,c=i.animations,h=i.bins,l=void 0===h?[]:h,f=i.miscs,d=eH(void 0===n?[]:n);!(e=d()).done;){var p=e.value;this.addEffectsObjectData(p)}for(var m,v=eH(void 0===o?[]:o);!(m=v()).done;){var y=m.value;this.addEffectsObjectData(y)}for(var g,x=eH(void 0===a?[]:a);!(g=x()).done;){var T=g.value;this.addEffectsObjectData(T)}for(var b,E=eH(void 0===s?[]:s);!(b=E()).done;){var _=b.value;this.addEffectsObjectData(_)}for(var C,S=eH(void 0===u?[]:u);!(C=S()).done;){var A=C.value;this.addEffectsObjectData(A)}for(var w,O=eH(void 0===c?[]:c);!(w=O()).done;){var R=w.value;this.addEffectsObjectData(R)}for(var I,M=eH(void 0===f?[]:f);!(I=M()).done;){var L=I.value;this.addEffectsObjectData(L)}for(var P=0;P<l.length;P++){var V=l[P],F=t.bins[P];if(V.dataType===tX.BinaryAsset)V.buffer=F,V.id&&this.addEffectsObjectData(V);else{var N=new sA;N.deserializeFromBinary(new Uint8Array(F));for(var D,z=eH(N.exportObjectDatas);!(D=z()).done;){var k=D.value;this.addEffectsObjectData(k)}}}for(var U,B=eH(void 0===r?[]:r);!(U=B()).done;){var G=U.value;this.addEffectsObjectData(G)}},e.createVFXItems=function(t){var e=this;return et(function(){var i,r,n,o;return en(this,function(a){switch(a.label){case 0:i=eH(t.jsonScene.items),a.label=1;case 1:if((r=i()).done)return[3,4];if(!("ECS"===(o=(n=r.value).type)||"camera"===o||o===tx.sprite||o===tx.particle||o===tx.mesh||o===tx.skybox||o===tx.light||o===tx.tree||o===tx.interact||o===tx.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:a.sent(),a.label=3;case 3:return[3,1];case 4:return[2]}})})()},e.addTexture=function(t){this.destroyed||ec(this.textures,t)},e.removeTexture=function(t){this.destroyed||eh(this.textures,t)},e.addMaterial=function(t){this.destroyed||ec(this.materials,t)},e.removeMaterial=function(t){this.destroyed||eh(this.materials,t)},e.addGeometry=function(t){this.destroyed||ec(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||eh(this.geometries,t)},e.addMesh=function(t){this.destroyed||ec(this.meshes,t)},e.removeMesh=function(t){this.destroyed||eh(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||ec(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||eh(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&&eO.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}},eB(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),sO=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=eQ(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)},eB(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.fromData=function(t){},e}(e7),er([e9(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=er([e6("BinaryAsset")],t.BinaryAsset),ax("camera",io,t.VFXItem,!0),ax("text",ap,t.VFXItem,!0),ax("sprite",nz,t.VFXItem,!0),ax("particle",o$,t.VFXItem,!0),ax("cal",o0,t.VFXItem,!0),ax("interact",id,t.VFXItem,!0),eO.info("Core version: 2.0.1.");var sR=((t4={})[iC.ONE]=t9.OneFactor,t4[iC.ZERO]=t9.ZeroFactor,t4[iC.SRC_COLOR]=t9.SrcColorFactor,t4[iC.SRC_ALPHA]=t9.SrcAlphaFactor,t4[iC.ONE_MINUS_SRC_COLOR]=t9.OneMinusSrcColorFactor,t4[iC.ONE_MINUS_SRC_ALPHA]=t9.OneMinusSrcAlphaFactor,t4[iC.DST_COLOR]=t9.DstColorFactor,t4[iC.DST_ALPHA]=t9.DstAlphaFactor,t4[iC.ONE_MINUS_DST_COLOR]=t9.OneMinusDstColorFactor,t4[iC.ONE_MINUS_DST_ALPHA]=t9.OneMinusDstAlphaFactor,t4),sI=((t5={})[iC.NEVER]=t9.NeverStencilFunc,t5[iC.EQUAL]=t9.EqualStencilFunc,t5[iC.LESS]=t9.LessStencilFunc,t5[iC.LEQUAL]=t9.LessEqualStencilFunc,t5[iC.ALWAYS]=t9.AlwaysStencilFunc,t5[iC.NOTEQUAL]=t9.NotEqualStencilFunc,t5[iC.GREATER]=t9.GreaterStencilFunc,t5[iC.GEQUAL]=t9.GreaterEqualStencilFunc,t5),sM=((t6={})[iC.KEEP]=t9.KeepStencilOp,t6[iC.ZERO]=t9.ZeroStencilOp,t6[iC.REPLACE]=t9.ReplaceStencilOp,t6[iC.INCR]=t9.IncrementStencilOp,t6[iC.DECR]=t9.DecrementStencilOp,t6[iC.INCR_WRAP]=t9.IncrementWrapStencilOp,t6[iC.DECR_WRAP]=t9.IncrementWrapStencilOp,t6[iC.INVERT]=t9.InvertStencilOp,t6),sL=((t8={})[iC.NEVER]=t9.NeverDepth,t8[iC.ALWAYS]=t9.AlwaysDepth,t8[iC.EQUAL]=t9.EqualDepth,t8[iC.LESS]=t9.LessDepth,t8[iC.LEQUAL]=t9.LessEqualDepth,t8[iC.GREATER]=t9.GreaterDepth,t8[iC.GEQUAL]=t9.GreaterEqualDepth,t8[iC.NOTEQUAL]=t9.NotEqualDepth,t8),sP=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],sV=function(e){function i(i,r){(n=e.call(this,i,r)||this).textures={},n.material=new t9.RawShaderMaterial,n.uniforms={};var n,o,a,s,u,c=null==r?void 0:r.shader,h=i.gpuCapability.level;n.shader=new t.Shader(i),n.shader.shaderData=iM({},c,{id:eD(),dataType:tX.Shader,vertex:null!=(o=null==c?void 0:c.vertex)?o:"",fragment:null!=(a=null==c?void 0:c.fragment)?a:""});for(var l=0;l<t.maxSpriteMeshItemCount;l++)n.uniforms["uSampler"+l]=new t9.Uniform(null);return n.uniforms.uEditorTransform=new t9.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new t9.Uniform(new t9.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new t9.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new t9.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new t9.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new t9.RawShaderMaterial({vertexShader:nf.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.vertex,shader:null!=(s=null==c?void 0:c.vertex)?s:"",macros:null==c?void 0:c.macros,removeVersion:!0}),fragmentShader:nf.genFinalShaderCode({level:n.engine.gpuCapability.level,shaderType:t.ShaderType.fragment,shader:null!=(u=null==c?void 0:c.fragment)?u:"",macros:null==c?void 0:c.macros,removeVersion:!0}),alphaToCoverage:!1,depthFunc:t9.LessDepth,polygonOffsetFactor:t9.ZeroFactor,polygonOffsetUnits:t9.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===h?n.material.glslVersion=t9.GLSL1:n.material.glslVersion=t9.GLSL3,n}eX(i,e);var r=i.prototype;return r.onSetUniformValue=function(t,e){var i;sP.includes(t)&&(i=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=i||e:this.material.uniforms[t]=new t9.Uniform(i||e)},r.use=function(t,e){var i=this.engine,r=i.composition,n=i.threeCamera;if(n){var o=new t9.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",o)}else{var a=r.camera;this.setMatrix("effects_MatrixVP",a.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",a.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=eH(e);!(i=n()).done;){var o=i.value;r=r.concat(o.toArray())}this.setUniform(t,r)},r.getMatrixArray=function(t){return this.uniforms[t].value},r.setMatrixArray=function(t,e){for(var i,r=[],n=eH(e);!(i=n()).done;){var o=i.value;r=r.concat(o.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){return this.uniforms[t].value},r.setColor=function(t,e){this.setUniform(t,e)},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 t9.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=i},r.enableMacro=function(t){throw Error("Method not implemented.")},r.disableMacro=function(t){throw Error("Method not implemented.")},r.isMacroEnabled=function(t){throw Error("Method not implemented.")},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)},eB(i,[{key:"blending",get:function(){return this.material.blending!==t9.NoBlending},set:function(t){this.material.blending=t?t9.CustomBlending:t9.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=sR[e],this.material.blendDst=sR[i],this.material.blendSrcAlpha=sR[r],this.material.blendDstAlpha=sR[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=sL[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=sI[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=sM[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=sM[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=sM[t[0]])}},{key:"culling",get:function(){return this.material.side!==t9.DoubleSide},set:function(t){this.material.side=t?t9.FrontSide:t9.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===td.FRONT?this.material.side=t9.FrontSide:t===td.BACK&&(this.material.side=t9.BackSide)}}]),i}(rt),sF=1,sN=function(t){function e(e,i){if((r=t.call(this,e)||this).attributes={},r.destroyed=!1,r.attributesName=[],!i)return au(r);var r,n=i.drawStart,o=i.drawCount,a=i.indices,s=i.mode,u=i.name,c=void 0===u?"effectsGeometry:"+sF++:u;r.name=c,r.mode=null!=s?s:iC.TRIANGLES;var h=[],l={},f=new t9.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 o=e.size,a=e.offset,s=e.normalize,u=l[n],c=u.buffer,d=u.dataLength,p=new t9.InterleavedBufferAttribute(c,o,(null!=a?a:0)/d,s);f.setAttribute(t,p),l[t]={buffer:c,attribute:p,type:u.type,dataLength:d}}}else r.setAttributeType(t,e,f,l,i.maxVertex);h.push(t)}),a&&a.data&&f.setIndex(new t9.BufferAttribute(a.data,1)),r.geometry=f,r.attributes=l,r.attributesName=h,r.drawStart=void 0===n?0:n,r.drawCount=null!=o?o:0,r}eX(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 t9.InterleavedBuffer(e,i.stride);i=this.attributes[t].attribute.data=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*r1[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 t9.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 o=e.stride,a=e.size,s=e.offset,u=e.normalize,c=e.type,h=void 0===c?iC.FLOAT:c,l=e.data;if(h&&!l&&(l=r3(h)),l){var f=ee(l,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,d=(void 0===o?0:o)/f,p=(n=(null!=n?n:0)*d)||a*f;p&&0===l.length&&(l=ee(l,Float32Array)?new Float32Array(p):new Uint16Array(p));var m=new t9.InterleavedBuffer(l,d),v=new t9.InterleavedBufferAttribute(m,a,(null!=s?s:0)/f,u);i.setAttribute(t,v),r[t]={buffer:m,attribute:v,type:h,dataLength:f}}},eB(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}(r2),sD=function(e){function i(t,i){if(!i)return au(r);var r,n=i.material,o=i.geometry,a=i.priority;return(r=e.call(this,t,i)||this).geometry=o,r.material=n,o.mode===iC.LINES?r.mesh=new t9.LineSegments(o.geometry,n.material):r.mesh=new t9.Mesh(o.geometry,n.material),r.priority=void 0===a?0:a,r}eX(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.start=function(){e.prototype.start.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)},eB(i,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),i}(r5),sz=function(e){function i(i,r,n){if(void 0===n&&(n={}),o=e.call(this,i)||this,r){var o,a=r.width,s=r.height;o.texture=o.createTextureByType(iM({},n,{sourceType:t.TextureSourceType.data,data:r})),o.width=void 0===a?1:a,o.height=void 0===s?1:s}else o.texture=o.createTextureByType(n);return o.texture.needsUpdate=!0,o}eX(i,e);var r=i.prototype;return r.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.startVideo=function(){var e=this;return et(function(){var i;return en(this,function(r){switch(r.label){case 0:if(e.sourceType!==t.TextureSourceType.video||!(i=e.texture.source.data).paused)return[3,2];return[4,i.play()];case 1:r.sent(),r.label=2;case 2:return[2]}})})()},r.assembleOptions=function(e){var r=e.target,n=void 0===r?iC.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),iM({},e,{target:n,format:t9.RGBAFormat,type:t9.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,o=i.wrapS,a=i.wrapT,s=i.minFilter,u=i.magFilter,c=i.sourceType,h=t9.UVMapping,l=i.format,f=void 0;if(this.sourceType=c,c===t.TextureSourceType.data){var d=e.data;f=new t9.DataTexture(d.data,d.width,d.height,l,n,h,o,a,u,s),this.width=d.width,this.height=d.height}else if(c===t.TextureSourceType.image){var p=e.image;f=new t9.Texture(p,h,o,a,u,s,l,n),this.width=p.width,this.height=p.height}else if(c===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=t9.RGBA_ASTC_4x4_Format,f=new t9.CompressedTexture(y,m,v,l,n,h,o,a,u,s),this.width=m,this.height=v}else if(c===t.TextureSourceType.video)f=new t9.VideoTexture(e.video,h,o,a,u,s,l,n);else if(c===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,T,b=null!=(x=g.width)?x:0,E=null!=(T=g.height)?T:0;f=new t9.FramebufferTexture(b,E,l),this.width=b,this.height=E}}else c===t.TextureSourceType.none&&((f=new t9.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=t9.MirroredRepeatWrapping,f.wrapT=t9.MirroredRepeatWrapping,this.width=this.height=1);if(f)return f.flipY=!!r,f;throw Error("Create a texture using an unknown data type.")},i.toThreeJsTextureFilter=function(t){return t===iC.LINEAR?t9.LinearFilter:t9.NearestFilter},i.toThreeJsTextureWrap=function(t){switch(t){case iC.MIRRORED_REPEAT:return t9.MirroredRepeatWrapping;case iC.REPEAT:return t9.RepeatWrapping;default:return t9.ClampToEdgeWrapping}},i}(i$),sk=function(t){function e(e,i){return t.call(this,e,i)}eX(e,t);var i=e.prototype;return i.updateVideo=function(){this.textures.map(function(t){return t.startVideo()})},i.prepareRender=function(){var t=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var e,i=eH(this.rootComposition.items);!(e=i()).done;)for(var r,n=e.value.getComponents(ii),o=eH(n);!(r=o()).done;){var a=r.value;a.isActiveAndEnabled&&a.render(t)}for(var s,u=eH(this.refContent);!(s=u()).done;)for(var c,h=s.value,l=eH(h.getComponent(aa).items);!(c=l()).done;)for(var f,d=c.value.getComponents(ii),p=eH(d);!(f=p()).done;){var m=f.value;m.isActiveAndEnabled&&m.render(t)}},i.getRendererOptions=function(){var t=sz.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},e}(ss);sk.shape={};var sU=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new nS(e),i}return eX(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}(sw),sB=function(t){function e(e){var i;return(i=t.call(this)||this).engine=new sU(e),i.engine.renderer=nk(i),i.env="",i.renderingData={currentFrame:{}},i}return eX(e,t),e}(nO),sG=function(t){function e(e,i){(r=t.call(this)||this).compositions=[],r.env="",r.baseCompositionIndex=0;var r,n=i.width,o=i.height,a=i.camera;return r.renderer=new sB(e),r.width=n,r.height=o,r.camera=a,r}eX(e,t);var i=e.prototype;return i.loadScene=function(t,e){var i=this;return et(function(){var r,n;return en(this,function(o){switch(o.label){case 0:if(n=i.baseCompositionIndex,!eM(t))return[3,2];return i.baseCompositionIndex+=t.length,[4,Promise.all(t.map(et(function(t,r){var o;return en(this,function(a){switch(a.label){case 0:return[4,i.createComposition(t,e)];case 1:return(o=a.sent()).setIndex(n+r),[2,o]}})})))];case 1:return r=o.sent(),[3,4];case 2:return i.baseCompositionIndex+=1,[4,i.createComposition(t,e)];case 3:(r=o.sent()).setIndex(n),o.label=4;case 4:return[2,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.createComposition=function(t,e){void 0===e&&(e={});var i=this;return et(function(){var r,n,o,a,s,u,c,h;return en(this,function(l){switch(l.label){case 0:return r=performance.now(),n=iM({autoplay:!0},e),a5(t)?(o=t.url,a6(t)&&(n=iM({},n,t.options||{}))):o=t,i.assetManager?i.assetManager.updateOptions(n):i.assetManager=new si(n),[4,i.assetManager.loadScene(o,i.renderer,{env:i.env})];case 1:for(a=l.sent(),(s=i.renderer.engine).clearResources(),s.addPackageDatas(a),u=0;u<a.textureOptions.length;u++)a.textureOptions[u]=s.assetLoader.loadGUID(a.textureOptions[u].id),a.textureOptions[u].initialize();if(!s.database)return[3,3];return[4,s.createVFXItems(a)];case 2:l.sent(),l.label=3;case 3:return(c=new sk(iM({},n,{width:i.width,height:i.height,renderer:i.renderer,handleItemMessage:function(t){i.dispatchEvent({type:"message",message:t})}}),a)).on("end",function(){i.dispatchEvent({type:"end",composition:c})}),i.renderer.engine.setOptions({threeCamera:i.camera,threeGroup:i,composition:c}),n.autoplay?c.play():c.pause(),h=performance.now()-r+c.statistic.loadTime,c.statistic.firstFrameTime=h,eO.info("First frame: ["+c.name+"]"+h.toFixed(4)+"ms."),i.compositions.push(c),[2,c]}})})()},i.update=function(t){this.compositions.forEach(function(e){e.update(t)})},eB(e,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(t9.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}eX(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===iC.LINES?this.threeMesh=new t9.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new t9.Mesh(this.geometry.geometry,this.material.material))},i.start=function(){t.prototype.start.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()},eB(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=er([e6(tX.SpriteComponent)],t.ThreeSpriteComponent),t.ThreeTextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.canvas=al.getCanvas(),al.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return au(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(!1),r}eX(e,t);var i=e.prototype;return i.update=function(e){t.prototype.update.call(this,e),this.updateTexture(!1)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture(!1)},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.ThreeSpriteComponent),t.ThreeTextComponent=er([e6(tX.TextComponent)],t.ThreeTextComponent),ek(t.ThreeTextComponent,[ad]),nN(8),i$.create=function(t,e){return new sz(t,void 0,e)},i$.createWithData=function(t,e,i){return new sz(t,e,i)},rt.create=function(t,e){return new sV(t,e)},r2.create=function(t,e){return new sN(t,e)},r5.create=function(t,e){return new sD(t,e)};var sX="2.0.1";eO.info("THREEJS plugin version: "+sX+"."),t.AbstractPlugin=ir,t.ActivationPlayable=o8,t.AnimationClipPlayable=o9,t.AssetLoader=a_,t.AssetManager=si,t.BYTES_TYPE_MAP=r1,t.Behaviour=ie,t.BezierCurve=rF,t.BezierCurvePath=rD,t.BezierCurveQuat=rz,t.CONSTANT_MAP_BLEND=sR,t.CONSTANT_MAP_DEPTH=sL,t.CONSTANT_MAP_STENCIL_FUNC=sI,t.CONSTANT_MAP_STENCIL_OP=sM,t.COPY_FRAGMENT_SHADER=rq,t.COPY_MESH_SHADER_ID=rY,t.COPY_VERTEX_SHADER=rZ,t.CalculateLoader=o0,t.Camera=sn,t.CameraVFXItemLoader=io,t.Component=it,t.Composition=ss,t.CompositionComponent=aa,t.CompositionSourceManager=sa,t.DEFAULT_FONTS=af,t.Database=aC,t.Downloader=iL,t.EFFECTS_COPY_MESH_NAME=rW,t.EVENT_TYPE_CLICK=ia,t.EVENT_TYPE_TOUCH_END=ic,t.EVENT_TYPE_TOUCH_MOVE=iu,t.EVENT_TYPE_TOUCH_START=is,t.EffectsObject=e7,t.EffectsPackage=sA,t.Engine=sw,t.EventEmitter=am,t.EventSystem=ih,t.Float16ArrayWrapper=ri,t.Framebuffer=nw,t.GPUCapability=nS,t.Geometry=r2,t.GlobalUniforms=nE,t.GradientValue=rP,t.HELP_LINK=iE,t.InteractLoader=id,t.InteractMesh=nI,t.KTXTexture=i4,t.LineSegments=rV,t.LinearValue=rL,t.Material=rt,t.MaterialDataBlock=i8,t.Mesh=r5,t.PLAYER_OPTIONS_ENV_EDITOR=ib,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=oH,t.ParticleBehaviourPlayableAsset=oW,t.ParticleLoader=o$,t.ParticleMesh=oZ,t.ParticleSystemRenderer=oF,t.PassTextureCache=r$,t.PathSegments=rN,t.PluginSystem=aT,t.RENDER_PASS_NAME_PREFIX=ny,t.RENDER_PREFER_LOOKUP_TEXTURE=nZ,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=rR,t.RandomValue=rI,t.RandomVectorValue=rM,t.RenderFrame=nx,t.RenderPass=r9,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=r6,t.Renderbuffer=n_,t.Renderer=nO,t.RendererComponent=ii,t.RuntimeClip=at,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=r0,t.SerializationHelper=aE,t.ShaderFactory=nf,t.ShaderVariant=rH,t.SpriteColorPlayable=nY,t.SpriteLoader=nz,t.StaticValue=rO,t.TEMPLATE_USE_OFFSCREEN_CANVAS=nq,t.TEXTURE_UNIFORM_MAP=sP,t.TextComponentBase=ad,t.TextLayout=ac,t.TextLoader=ap,t.TextStyle=ah,t.Texture=i$,t.TextureFactory=i6,t.ThreeComposition=sk,t.ThreeDisplayObject=sG,t.ThreeEngine=sU,t.ThreeMaterial=sV,t.ThreeTexture=sz,t.Ticker=sO,t.TimelineClip=o7,t.TimelinePlayable=ai,t.TrackSortWrapper=ar,t.Transform=n$,t.TransformAnimationPlayable=o6,t.ValueGetter=rw,t.addByOrder=e_,t.addItem=ec,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 o=t[n];if(r)for(;t[n-1][i]<o[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>o[i]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},t.applyMixins=ek,t.assertExist=eS,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=ez,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.calculateTranslation=ro,t.canvasPool=al,t.colorGradingFrag=na,t.colorStopsFromGradient=ep,t.colorToArr=ef,t.combineImageTemplate=a9,t.createCopyShader=rQ,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=rj,t.createShape=on,t.createValueGetter=rU,t.decimalEqual=rf,t.defaultGlobalVolume={useHDR:!1,useBloom:!0,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,vignetteIntensity:.2,vignetteSmoothness:.4,vignetteRoundness:1,useToneMapping:!0},t.defaultPlugins=ay,t.deserializeMipmapTexture=iZ,t.earcut=ob,t.effectsClass=e6,t.effectsClassStore=e5,t.enlargeBuffer=el,t.ensureFixedNumber=aA,t.ensureVec3=ra,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=ns,t.gaussianDownVFrag=nu,t.gaussianUpFrag=nc,t.generateEmptyTypedArray=r3,t.generateGUID=eD,t.generateHalfFloatTexture=i0,t.generateTransparentTexture=i3,t.generateWhiteTexture=i2,t.getBackgroundImage=a8,t.getColorFromGradientStops=ed,t.getConfig=function(t){return nQ[t]},t.getDefaultTextureFactory=function(){return tZ||(tZ=new i6),tZ},t.getGeometryByShape=o_,t.getGeometryTriangles=oE,t.getImageItemRenderInfo=nL,t.getKTXTextureOptions=i5,t.getKeyFrameMetaByRawValue=rX,t.getMergedStore=e8,t.getParticleMeshShader=oK,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=iw,t.getStandardComposition=a$,t.getStandardImage=aJ,t.getStandardItem=a1,t.getStandardJSON=aQ,t.getTextureSize=nT,t.glContext=iC,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return tH.Float32;case WebGLRenderingContext.SHORT:return tH.Int16;case WebGLRenderingContext.BYTE:return tH.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return tH.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return tH.UInt8;default:return tH.Float32}},t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),r=et(function(){return en(this,function(n){return[2,new Promise(function(n,o){if(i){var a=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);a&&!s&&n(t.getQueryParameter(i,t.QUERY_RESULT)/1e3/1e3),(a||s)&&(t.deleteQuery(i),i=null),null!==a&&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){eI(t)&&(t=ef(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=eb,t.initErrors=i_,t.initGLContext=iS,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=ex,t.isAndroid=ey,t.isArray=eM,t.isCanvas=eV,t.isFunction=eL,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 ex()||eT()},t.isObject=eP,t.isSceneJSON=a4,t.isSceneURL=a5,t.isSceneWithOptions=a6,t.isSimulatorCellPhone=eg,t.isString=eI,t.isUniformStruct=i9,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&i9(t[0])},t.isValidFontFamily=eA,t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.isWechatMiniApp=eT,t.itemFrag=ne,t.itemFrameFrag=r7,t.itemVert=nt,t.loadAVIFOptional=iD,t.loadBinary=iB,t.loadBlob=function(t){return iX.apply(this,arguments)},t.loadImage=ik,t.loadMedia=iW,t.loadVideo=ij,t.loadWebPOptional=iF,t.logger=eO,t.math=iT,t.modifyMaxKeyframeShader=oJ,t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=eR,t.normalizeColor=aL,t.numberToFix=rd,t.parsePercent=ev,t.particleFrag=ni,t.particleOriginTranslateMap=rc,t.particleUniformTypeMap=oY,t.particleVert=nr,t.pluginLoaderMap=av,t.randomInRange=eF,t.registerPlugin=ax,t.removeItem=eh,t.rotateVec2=oC,t.screenMeshVert=no,t.serialize=function(t,e){return e9(t,e)},t.setBlendMode=iO,t.setConfig=function(t,e){return nQ[t]=e},t.setDefaultTextureFactory=function(t){tZ=t},t.setMaskMode=iI,t.setMaxSpriteMeshItemCount=nN,t.setRayFromCamera=rh,t.setSideMode=iR,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 t9.Uniform(i)},t.sortByOrder=eE,t.spec=e2,t.spriteMeshShaderFromFilter=nP,t.spriteMeshShaderFromRenderInfo=nF,t.spriteMeshShaderIdFromRenderInfo=nV,t.thresholdFrag=nh,t.throwDestroyedError=eN,t.trailVert=nn,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=rl,t.unregisterPlugin=function(t){delete ag[t],delete av[t],eh(ay,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=rs,t.vecMulCombine=ru,t.version=sX,t.vertexFormatType2GLType=function(t){switch(t){case tH.Float32:return WebGLRenderingContext.FLOAT;case tH.Int16:return WebGLRenderingContext.SHORT;case tH.Int8:return WebGLRenderingContext.BYTE;case tH.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case tH.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}},Object.defineProperty(t,"__esModule",{value:!0})});
|
|
8
8
|
//# sourceMappingURL=index.min.js.map
|