@galacean/effects-threejs 2.0.0-alpha.7 → 2.0.0-alpha.9
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 +15430 -16896
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +14347 -15795
- package/dist/index.mjs.map +1 -1
- package/dist/material/three-material.d.ts +3 -0
- package/dist/three-display-object.d.ts +1 -2
- package/dist/three-texture.d.ts +2 -186
- package/package.json +2 -2
package/dist/index.min.js
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
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.0-alpha.
|
|
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 r,i,n,o,a,s,u,l,c,h,f,m,d,p,v,y,g,x,T,E,_,C,S,R,A,b,O,w,L,I,M,P,V,F,N,D,z,k,U,B,G,X,H,Y,W,j,Z,q,Q,K,J,$,tt,te,tr,ti,tn,to,ta,ts,tu,tl,tc,th,tf,tm,td,tp,tv,ty,tg,tx,tT,tE,t_,tC,tS,tR,tA,tb,tO,tw,tL,tI,tM,tP,tV,tF,tN,tD,tz,tk,tU,tB,tG,tX,tH,tY,tW,tj,tZ,tq,tQ,tK,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,er,ei,en,eo,ea,es,eu,el,ec,eh,ef,em,ed,ep,ev,ey,eg,ex,eT,eE,e_,eC,eS,eR,eA,eb,eO,ew,eL,eI,eM,eP,eV,eF,eN,eD,ez,ek,eU,eB,eG,eX,eH,eY,eW,ej,eZ,eq,eQ,eK,eJ=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}(e);function e$(t,e,r,i,n,o,a){try{var s=t[o](a),u=s.value}catch(t){r(t);return}s.done?e(u):Promise.resolve(u).then(i,n)}function e0(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(t){e$(o,i,n,a,s,"next",t)}function s(t){e$(o,i,n,a,s,"throw",t)}a(void 0)})}}function e1(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):e1(t,e)}function e2(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function e3(t,e,r,i){var n,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,r,a):n(e,r))||a);return o>3&&a&&Object.defineProperty(e,r,a),a}function e4(t,e){var r,i,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(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=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++,i=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],i=0}finally{r=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 e5=new Uint8Array(16),e6=[],e8=0;e8<256;++e8)e6.push((e8+256).toString(16).slice(1));var e9={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function e7(t,e){return t.includes(e)||t.push(e),t}function rt(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function re(t,e,r,i){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);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 rr(t,e){var r=[0,0,0,0];if(rV(t)){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else e1(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)r[o]/=255;return r}function ri(t,e,r){if(t.length){for(var i,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){i=ro(o.color,a.color,(e-o.stop)/(a.stop-o.stop));break}}return i||(i=t[t.length-1].color),r?i.map(function(t){return t/255}):i}return[0,0,0,0]}function rn(t){var e=[];if(e1(t,Array)?t.forEach(function(t){var r=t[0],i=t[1],n=t[2],o=t[3],a=t[4];e.push({stop:ra(r),color:[i,n,o,a]})}):Object.keys(t).forEach(function(r){var i=rr(t[r]);e.push({stop:ra(r),color:i})}),(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 r=e[e.length-1];1!==r.stop&&e.push({stop:1,color:r.color.slice()})}return e}function ro(t,e,r,i){var n=[],o=1-r;if(i)for(var a=0;a<4;a++)n[a]=t[a]*o+e[a]*r;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*o+e[s]*e[s]*r));n[3]=Math.round(t[3]*o+e[3]*r)}return n}function ra(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function rs(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function ru(){return rs()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function rl(t){var e={width:128,height:1,data:new Uint8Array(512)},r=e.data,i=rn(t);if(i.length){r.set(i[0].color,0);for(var n=1;n<127;n++){for(var o=n/128,a=void 0,s=void 0,u=0;u<i.length&&(a=i[u],s=i[u+1],!(a.stop<=o)||!(s.stop>o));u++);var l=ro(a.color,s.color,(o-a.stop)/(s.stop-a.stop));r.set(l,4*n)}r.set(i[i.length-1].color,508)}return e}function rc(t,e){void 0===e&&(e=2);var r=t.length;if(r<=1||1===e)return t;if(!(r<=30))return function t(e,r,i,n){if(void 0===i&&(i=0),void 0===n&&(n=e.length-1),i>=n)return e;for(var o,a,s=e[i],u=i,l=n;u<l;){if(2===r){for(;e[l].priority>s.priority&&l>=u;)l--;for(;e[u].priority<=s.priority&&u<l;)u++}else{for(;e[l].priority<s.priority&&l>=u;)l--;for(;e[u].priority>=s.priority&&u<l;)u++}o=[e[l],e[u]],e[u]=o[0],e[l]=o[1]}return a=[e[u],e[i]],e[i]=a[0],e[u]=a[1],t(e,r,i,u-1),t(e,r,l+1,n),e}(t,e);for(var i=1;i<r;i++)rf(t,i,e);return t}function rh(t,e,r){return void 0===r&&(r=2),t.includes(e)||(t.push(e),1===t.length||1!==r&&rf(t,t.length-1,r)),t}function rf(t,e,r){var i=t[e];if(2!==r)for(;e>=1&&t[e-1].priority<i.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>i.priority&&(t[e]=t[e-1],0!=--e););t[e]=i}function rm(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}t.OrderType=void 0,(r=t.OrderType||(t.OrderType={}))[r.none=1]="none",r[r.ascending=2]="ascending",r[r.descending=3]="descending";var rd=Math.PI/180,rp=180/Math.PI;function rv(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var ry=function(t,e,r){return(1-r)*t+r*e};function rg(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r;return Math.min(Math.max(t,Math.min(i,n)),Math.max(i,n))}var rx=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 r,i;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):e1(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):e1(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):e1(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):e1(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,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,r=this.y-t.y;return Math.sqrt(e*e+r*r)},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t}();rx.ONE=new rx(1,1),rx.ZERO=new rx(0,0);var rT=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}var e=t.prototype;return e.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,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 r,i,n;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):e1(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):e1(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):e1(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):e1(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,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 r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*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,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},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,r=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new rx(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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t}();rT.X=new rT(1,0,0),rT.Y=new rT(0,1,0),rT.Z=new rT(0,0,1),rT.ONE=new rT(1,1,1),rT.ZERO=new rT(0,0,0);var rE=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),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(i),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,r=e[0],i=e[4],n=e[8],o=e[1],a=e[5],s=e[9],u=e[2],l=e[6],c=e[10],h=r+a+c;if(h>0){var f=.5/Math.sqrt(h+1);this.w=.25/f,this.x=(l-s)*f,this.y=(n-u)*f,this.z=(o-i)*f}else if(r>a&&r>c){var m=2*Math.sqrt(1+r-a-c);this.w=(l-s)/m,this.x=.25*m,this.y=(i+o)/m,this.z=(n+u)/m,this.negate()}else if(a>c){var d=2*Math.sqrt(1+a-r-c);this.w=(n-u)/d,this.x=(i+o)/d,this.y=.25*d,this.z=(s+l)/d,this.negate()}else{var p=2*Math.sqrt(1+c-r-a);this.w=(o-i)/p,this.x=(n+u)/p,this.y=(s+l)/p,this.z=.25*p,this.negate()}return this},e.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=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=r,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(rg(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var r=this.angleTo(t);return 0===r||this.slerp(t,Math.min(1,e/r)),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 r=t.x,i=t.y,n=t.z,o=t.w,a=e.x,s=e.y,u=e.z,l=e.w;return this.x=r*l+o*a+i*u-n*s,this.y=i*l+o*s+n*a-r*u,this.z=n*l+o*u+r*s-i*a,this.w=o*l-r*a-i*s-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var r=this.x,i=this.y,n=this.z,o=this.w,a=o*t.w+r*t.x+i*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=r,this.y=i,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*r+e*this.x,this.y=u*i+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var l=Math.sqrt(s),c=Math.atan2(l,a),h=Math.sin((1-e)*c)/l,f=Math.sin(e*c)/l;return this.w=o*h+this.w*f,this.x=r*h+this.x*f,this.y=i*h+this.y*f,this.z=n*h+this.z*f,this},e.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},e.rotateVector3=function(t,e){var r=this.x,i=this.y,n=this.z,o=this.w,a=t.x,s=t.y,u=t.z,l=o*a+i*u-n*s,c=o*s+n*a-r*u,h=o*u+r*s-i*a,f=-r*a-i*s-n*u,m=null!=e?e:t;return m.x=l*o+-(f*r)+-(c*n)- -(h*i),m.y=c*o+-(f*i)+-(h*r)- -(l*n),m.z=h*o+-(f*n)+-(l*i)- -(c*r),m},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(rT.ZERO,this,rT.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,r){return new t().setFromAxisAngle(e,r)},t.fromArray=function(e,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,r){return new t().setFromUnitVectors(e,r)},t}();rE.tempVec0=new rT;var r_=function(){function t(t,e,r,i,n,o,a,s,u,l,c,h,f,m,d,p){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=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===l&&(l=0),void 0===c&&(c=1),void 0===h&&(h=0),void 0===f&&(f=0),void 0===m&&(m=0),void 0===d&&(d=0),void 0===p&&(p=1),this.elements=[t,e,r,i,n,o,a,s,u,l,c,h,f,m,d,p]}var e=t.prototype;return e.set=function(t,e,r,i,n,o,a,s,u,l,c,h,f,m,d,p){var v=this.elements;return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=o,v[6]=a,v[7]=s,v[8]=u,v[9]=l,v[10]=c,v[11]=h,v[12]=f,v[13]=m,v[14]=d,v[15]=p,this},e.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u,l,c,h,f,m,d,p){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=i,v[1]=n,v[5]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=l,v[10]=c,v[14]=h,v[3]=f,v[7]=m,v[11]=d,v[15]=p,this},e.setFromColumnVectors=function(t,e,r,i){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.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 r=0;r<16;r++)this.elements[r]=t[e+r];return this},e.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},e.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},e.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),o=Math.sin(r),a=1-n,s=i.x,u=i.y,l=i.z,c=a*s,h=a*u;return this.set(c*s+n,c*u+o*l,c*l-o*u,0,c*u-o*l,h*u+n,h*l+o*s,0,c*l+o*u,h*l-o*s,a*l*l+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(rT.ZERO,t,rT.ONE)},e.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},e.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.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,r,i){var n=t.tempVec0,o=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,r),a.normalize(),n.crossVectors(i,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 r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[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 r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],u=r[12],l=r[1],c=r[5],h=r[9],f=r[13],m=r[2],d=r[6],p=r[10],v=r[14],y=r[3],g=r[7],x=r[11],T=r[15],E=i[0],_=i[4],C=i[8],S=i[12],R=i[1],A=i[5],b=i[9],O=i[13],w=i[2],L=i[6],I=i[10],M=i[14],P=i[3],V=i[7],F=i[11],N=i[15];return n[0]=o*E+a*R+s*w+u*P,n[4]=o*_+a*A+s*L+u*V,n[8]=o*C+a*b+s*I+u*F,n[12]=o*S+a*O+s*M+u*N,n[1]=l*E+c*R+h*w+f*P,n[5]=l*_+c*A+h*L+f*V,n[9]=l*C+c*b+h*I+f*F,n[13]=l*S+c*O+h*M+f*N,n[2]=m*E+d*R+p*w+v*P,n[6]=m*_+d*A+p*L+v*V,n[10]=m*C+d*b+p*I+v*F,n[14]=m*S+d*O+p*M+v*N,n[3]=y*E+g*R+x*w+T*P,n[7]=y*_+g*A+x*L+T*V,n[11]=y*C+g*b+x*I+T*F,n[15]=y*S+g*O+x*M+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],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],u=t[13],l=t[2],c=t[6],h=t[10],f=t[14];return t[3]*(+n*s*c-i*u*c-n*a*h+r*u*h+i*a*f-r*s*f)+t[7]*(+e*s*f-e*u*h+n*o*h-i*o*f+i*u*l-n*s*l)+t[11]*(+e*u*c-e*a*f-n*o*c+r*o*f+n*a*l-r*u*l)+t[15]*(-i*a*l-e*s*c+e*a*h+i*o*c-r*o*h+r*s*l)},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],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],u=t[7],l=t[8],c=t[9],h=t[10],f=t[11],m=t[12],d=t[13],p=t[14],v=t[15],y=c*p*u-d*h*u+d*s*f-a*p*f-c*s*v+a*h*v,g=m*h*u-l*p*u-m*s*f+o*p*f+l*s*v-o*h*v,x=l*d*u-m*c*u+m*a*f-o*d*f-l*a*v+o*c*v,T=m*c*s-l*d*s-m*a*h+o*d*h+l*a*p-o*c*p,E=e*y+r*g+i*x+n*T;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var _=1/E;return t[0]=y*_,t[1]=(d*h*n-c*p*n-d*i*f+r*p*f+c*i*v-r*h*v)*_,t[2]=(a*p*n-d*s*n+d*i*u-r*p*u-a*i*v+r*s*v)*_,t[3]=(c*s*n-a*h*n-c*i*u+r*h*u+a*i*f-r*s*f)*_,t[4]=g*_,t[5]=(l*p*n-m*h*n+m*i*f-e*p*f-l*i*v+e*h*v)*_,t[6]=(m*s*n-o*p*n-m*i*u+e*p*u+o*i*v-e*s*v)*_,t[7]=(o*h*n-l*s*n+l*i*u-e*h*u-o*i*f+e*s*f)*_,t[8]=x*_,t[9]=(m*c*n-l*d*n-m*r*f+e*d*f+l*r*v-e*c*v)*_,t[10]=(o*d*n-m*a*n+m*r*u-e*d*u-o*r*v+e*a*v)*_,t[11]=(l*a*n-o*c*n-l*r*u+e*c*u+o*r*f-e*a*f)*_,t[12]=T*_,t[13]=(l*d*i-m*c*i+m*r*h-e*d*h-l*r*p+e*c*p)*_,t[14]=(m*a*i-o*d*i-m*r*s+e*d*s+o*r*p-e*a*p)*_,t[15]=(o*c*i-l*a*i+l*r*s-e*c*s-o*r*h+e*a*h)*_,this},e.extractBasis=function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},e.compose=function(t,e,r,i){void 0===i&&(i=rT.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,u=e.w,l=-i.x,c=-i.y,h=-i.z,f=o+o,m=a+a,d=s+s,p=o*f,v=o*m,y=o*d,g=a*m,x=a*d,T=s*d,E=u*f,_=u*m,C=u*d,S=r.x,R=r.y,A=r.z;return n[0]=(1-(g+T))*S,n[1]=(v+C)*S,n[2]=(y-_)*S,n[3]=0,n[4]=(v-C)*R,n[5]=(1-(p+T))*R,n[6]=(x+E)*R,n[7]=0,n[8]=(y+_)*A,n[9]=(x-E)*A,n[10]=(1-(p+g))*A,n[11]=0,n[12]=l*n[0]+c*n[4]+h*n[8]-l+t.x,n[13]=l*n[1]+c*n[5]+h*n[9]-c+t.y,n[14]=l*n[2]+c*n[6]+h*n[10]-h+t.z,this},e.decompose=function(e,r,i){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 l=t.tempMat0;l.copyFrom(this);var c=1/a,h=1/s,f=1/u;return l.elements[0]*=c,l.elements[1]*=c,l.elements[2]*=c,l.elements[4]*=h,l.elements[5]*=h,l.elements[6]*=h,l.elements[8]*=f,l.elements[9]*=f,l.elements[10]*=f,r.setFromRotationMatrix(l),i.x=a,i.y=s,i.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 rT,e=new rE,r=new rT;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},e.orthographic=function(t,e,r,i,n,o){var a=1/(e-t),s=1/(r-i),u=1/(o-n),l=-(e+t)*a,c=-(r+i)*s,h=-(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]=l,f[13]=c,f[14]=h,f[15]=1,this},e.perspective=function(t,e,r,i,n){var o=1/Math.tan(.5*t),a=1/(r-i),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]=(i+r)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*i*r*a,s[15]=0,(null===i||i===1/0)&&(s[10]=-1,s[14]=-2*r),this},e.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14];var s=o[3]*r+o[7]*i+o[11]*n+o[15];return a.multiply(1/s)},e.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14],a},e.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n,a.y=o[1]*r+o[5]*i+o[9]*n,a.z=o[2]*r+o[6]*i+o[10]*n,a.normalize()},e.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,o=t.w,a=this.elements,s=null!=e?e:t;return s.x=a[0]*r+a[4]*i+a[8]*n+a[12]*o,s.y=a[1]*r+a[5]*i+a[9]*n+a[13]*o,s.z=a[2]*r+a[6]*i+a[10]*n+a[14]*o,s.w=a[3]*r+a[7]*i+a[11]*n+a[15]*o,s},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!rv(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[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,r,i){return new t().lookAt(e,r,i)},t.fromPerspective=function(e,r,i,n,o){return new t().perspective(e,r,i,n,o)},t.fromColumnVectors=function(e,r,i,n){return new t().setFromColumnVectors(e,r,i,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromScale=function(e,r,i){return new t().setFromScale(e,r,i)},t.fromTranslation=function(e,r,i){return new t().setFromTranslation(e,r,i)},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,r){return new t().setFromRotationAxis(e,r)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,r,i){return new t().setFromShear(e,r,i)},t.fromBasis=function(e,r,i){return new t().setFromBasis(e,r,i)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,l,c,h,f,m,d,p,v){return new t(e,o,l,m,r,a,c,d,i,s,h,p,n,u,f,v)},t}();r_.IDENTITY=new r_(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),r_.ZERO=new r_(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),r_.tempVec0=new rT,r_.tempVec1=new rT,r_.tempVec2=new rT,r_.tempMat0=new r_,(i=tF||(tF={}))[i.XYZ=0]="XYZ",i[i.XZY=1]="XZY",i[i.YXZ=2]="YXZ",i[i.YZX=3]="YZX",i[i.ZXY=4]="ZXY",i[i.ZYX=5]="ZYX";var rC=function(){function t(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=r,this.z=i,this.order=n}var e=t.prototype;return e.set=function(t,e,r,i){return void 0===i&&(i=this.order),this.x=t,this.y=e,this.z=r,this.order=i,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 r=t.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],u=r[9],l=r[2],c=r[6],h=r[10];switch(e){case tF.XYZ:this.y=Math.asin(rg(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,h),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(c,s),this.z=0);break;case tF.YXZ:this.x=Math.asin(-rg(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(o,h),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-l,i),this.z=0);break;case tF.ZXY:this.x=Math.asin(rg(c,-1,1)),.9999999>Math.abs(c)?(this.y=Math.atan2(-l,h),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,i));break;case tF.ZYX:this.y=Math.asin(-rg(l,-1,1)),.9999999>Math.abs(l)?(this.x=Math.atan2(c,h),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,s));break;case tF.YZX:this.z=Math.asin(rg(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-l,i)):(this.x=0,this.y=Math.atan2(o,h));break;case tF.XZY:this.z=Math.asin(-rg(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(c,s),this.y=Math.atan2(o,i)):(this.x=Math.atan2(-u,h),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=rp,this.y*=rp,this.z*=rp,this.order=e,this},e.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},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,r){var i,n,o,a;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!=(i=t[e])?i: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:r,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 rE;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},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,r=this.y,i=this.z,n=this.order,o=Math.cos(e*rd*.5),a=Math.cos(r*rd*.5),s=Math.cos(i*rd*.5),u=Math.sin(e*rd*.5),l=Math.sin(r*rd*.5),c=Math.sin(i*rd*.5);switch(n){case tF.XYZ:t.set(u*a*s+o*l*c,o*l*s-u*a*c,o*a*c+u*l*s,o*a*s-u*l*c);break;case tF.YXZ:t.set(u*a*s+o*l*c,o*l*s-u*a*c,o*a*c-u*l*s,o*a*s+u*l*c);break;case tF.ZXY:t.set(u*a*s-o*l*c,o*l*s+u*a*c,o*a*c+u*l*s,o*a*s-u*l*c);break;case tF.ZYX:t.set(u*a*s-o*l*c,o*l*s+u*a*c,o*a*c-u*l*s,o*a*s+u*l*c);break;case tF.YZX:t.set(u*a*s+o*l*c,o*l*s+u*a*c,o*a*c-u*l*s,o*a*s-u*l*c);break;case tF.XZY:t.set(u*a*s-o*l*c,o*l*s-u*a*c,o*a*c+u*l*s,o*a*s+u*l*c);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,r=this.x,i=this.y,n=this.z,o=this.order,a=Math.cos(r*rd),s=Math.sin(r*rd),u=Math.cos(i*rd),l=Math.sin(i*rd),c=Math.cos(n*rd),h=Math.sin(n*rd);if(o===tF.XYZ){var f=a*c,m=a*h,d=s*c,p=s*h;e[0]=u*c,e[4]=-u*h,e[8]=l,e[1]=m+d*l,e[5]=f-p*l,e[9]=-s*u,e[2]=p-f*l,e[6]=d+m*l,e[10]=a*u}else if(o===tF.YXZ){var v=u*c,y=u*h,g=l*c,x=l*h;e[0]=v+x*s,e[4]=g*s-y,e[8]=a*l,e[1]=a*h,e[5]=a*c,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=a*u}else if(o===tF.ZXY){var T=u*c,E=u*h,_=l*c,C=l*h;e[0]=T-C*s,e[4]=-a*h,e[8]=_+E*s,e[1]=E+_*s,e[5]=a*c,e[9]=C-T*s,e[2]=-a*l,e[6]=s,e[10]=a*u}else if(o===tF.ZYX){var S=a*c,R=a*h,A=s*c,b=s*h;e[0]=u*c,e[4]=A*l-R,e[8]=S*l+b,e[1]=u*h,e[5]=b*l+S,e[9]=R*l-A,e[2]=-l,e[6]=s*u,e[10]=a*u}else if(o===tF.YZX){var O=a*u,w=a*l,L=s*u,I=s*l;e[0]=u*c,e[4]=I-O*h,e[8]=L*h+w,e[1]=h,e[5]=a*c,e[9]=-s*c,e[2]=-l*c,e[6]=w*h+L,e[10]=O-I*h}else if(o===tF.XZY){var M=a*u,P=a*l,V=s*u,F=s*l;e[0]=u*c,e[4]=-h,e[8]=l*c,e[1]=M*h+F,e[5]=a*c,e[9]=P*h-V,e[2]=V*h-P,e[6]=s*c,e[10]=F*h+M}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,r){return void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,r)},t.fromQuaternion=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromQuaternion(e,r)},t.fromVector3=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromVector3(e,r)},t.fromArray=function(e,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromArray(e,r,i)},t}();rC.DEFAULT_ORDER=tF.ZYX,rC.tempQuat0=new rE,rC.tempMat0=new r_;var rS=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,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 r,i,n,o;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):e1(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):e1(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):e1(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):e1(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,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,r=this.z,i=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(r)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new rT(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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t}();rS.ONE=new rS(1,1,1,1),rS.ZERO=new rS(0,0,0,0);var rR=function(){function t(t,e,r,i,n,o,a,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=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,r,i,n,o,a,s,u]}var e=t.prototype;return e.set=function(t,e,r,i,n,o,a,s,u){var l=this.elements;return l[0]=t,l[3]=i,l[6]=a,l[1]=e,l[4]=n,l[7]=s,l[2]=r,l[5]=o,l[8]=u,this},e.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u){var l=this.elements;return l[0]=t,l[3]=e,l[6]=r,l[1]=i,l[4]=n,l[7]=o,l[2]=a,l[5]=s,l[8]=u,this},e.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.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 r=0;r<9;r++)this.elements[r]=t[e+r];return this},e.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,o=e+e,a=r+r,s=i+i,u=e*o,l=e*a,c=e*s,h=r*a,f=r*s,m=i*s,d=n*o,p=n*a,v=n*s,y=this.elements;return y[0]=1-(h+m),y[1]=l+v,y[2]=c-p,y[3]=l-v,y[4]=1-(u+m),y[5]=f+d,y[6]=c+p,y[7]=f-d,y[8]=1-(u+h),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 r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],o=i[3],a=i[6],s=i[1],u=i[4],l=i[7];return i[0]=e*n+r*s,i[3]=e*o+r*u,i[6]=e*a+r*l,i[1]=-r*n+e*s,i[4]=-r*o+e*u,i[7]=-r*a+e*l,this},e.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[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 r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[3],s=r[6],u=r[1],l=r[4],c=r[7],h=r[2],f=r[5],m=r[8],d=i[0],p=i[3],v=i[6],y=i[1],g=i[4],x=i[7],T=i[2],E=i[5],_=i[8];return n[0]=o*d+a*y+s*T,n[3]=o*p+a*g+s*E,n[6]=o*v+a*x+s*_,n[1]=u*d+l*y+c*T,n[4]=u*p+l*g+c*E,n[7]=u*v+l*x+c*_,n[2]=h*d+f*y+m*T,n[5]=h*p+f*g+m*E,n[8]=h*v+f*x+m*_,this},e.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],l=t[8];return e*(o*l-u*a)+n*(u*i-r*l)+s*(r*a-o*i)},e.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],l=t[8],c=l*o-u*a,h=u*i-l*r,f=a*r-o*i,m=e*c+n*h+s*f;if(0===m)return this.set(0,0,0,0,0,0,0,0,0);var d=1/m;return t[0]=c*d,t[1]=(s*a-l*n)*d,t[2]=(u*n-s*o)*d,t[3]=h*d,t[4]=(l*e-s*i)*d,t[5]=(s*r-u*e)*d,t[6]=f*d,t[7]=(n*i-a*e)*d,t[8]=(o*e-n*r)*d,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 r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[3]*i+o[6]*n,a.y=o[1]*r+o[4]*i+o[7]*n,a.z=o[2]*r+o[5]*i+o[8]*n,a},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!rv(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return new t().setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,l){return new t(e,n,s,r,o,u,i,a,l)},t}(),rA=function(){function t(t,e){void 0===t&&(t=rT.ZERO),void 0===e&&(e=rT.X),this.origin=new rT,this.direction=new rT,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 r=e||new rT;return r.copyFrom(this.origin),r.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 r,i,n,o,a,s,u=this.origin,l=u.x,c=u.y,h=u.z,f=this.direction,m=f.x,d=f.y,p=f.z,v=t.min,y=v.x,g=v.y,x=v.z,T=t.max,E=T.x,_=T.y,C=T.z,S=1/m,R=1/d,A=1/p;if(S>=0?(r=(y-l)*S,i=(E-l)*S):(r=(E-l)*S,i=(y-l)*S),R>=0?(n=(g-c)*R,o=(_-c)*R):(n=(_-c)*R,o=(g-c)*R),!(r>o)&&!(n>i)&&((n>r||r!=r)&&(r=n),(o<i||i!=i)&&(i=o),(n>r||r!=r)&&(r=n),(o<i||i!=i)&&(i=o),A>=0?(a=(x-h)*A,s=(C-h)*A):(a=(C-h)*A,s=(x-h)*A),!(r>s)&&!(a>i))&&((a>r||r!=r)&&(r=a),(s<i||i!=i)&&(i=s),!(i<0)))return r>=0?this.at(r,e):this.at(i,e)},e.intersectPlane=function(t,e){var r=t.normal,i=t.distance,n=r.dot(this.direction);if(0===n)return 0===r.dot(this.origin)+i?(e||new rT).copyFrom(this.origin):void 0;var o=-(this.origin.dot(r)+i)/n;return o>=0?this.at(o,e):void 0},e.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,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),l=o-u,c=o+u;if(!(c<0))return l>=0?this.at(l,r):this.at(c,r)}},e.intersectTriangle=function(e,r,i){var n,o=e.p0,a=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(a,o),l=t.tempVec1.subtractVectors(s,o),c=t.tempVec2.subtractVectors(this.origin,o),h=t.tempVec3.crossVectors(u,l),f=this.direction.dot(h);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}l.crossVectors(c,l);var m=n*this.direction.dot(l);if(!(m<0)){u.cross(c);var d=n*this.direction.dot(u);if(!(d<0)&&!(m+d>f)){var p=-n*c.dot(h);if(!(p<0))return this.at(p/f,r)}}},t}();rA.tempVec0=new rT,rA.tempVec1=new rT,rA.tempVec2=new rT,rA.tempVec3=new rT;var rb=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,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 r,i,n,o;return void 0===e&&(e=0),this.r=null!=(r=t[e])?r:0,this.g=null!=(i=t[e+1])?i: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,r,i){void 0===i&&(i=1);var n=r*e,o=t/60,a=n*(1-Math.abs(o%2-1)),s=0,u=0,l=0;o>=0&&o<=1?(s=n,u=a):o>=1&&o<=2?(s=a,u=n):o>=2&&o<=3?(u=n,l=a):o>=3&&o<=4?(u=a,l=n):o>=4&&o<=5?(s=a,l=n):o>=5&&o<=6&&(s=n,l=a);var c=r-n;return this.set(s+c,u+c,l+c,i)},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,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,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):e1(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):e1(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):e1(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):e1(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 rS(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,r=this.g,i=this.b,n=this.a,o=Math.max(e,r,i),a=Math.min(e,r,i),s=o-a,u=0,l=0;return 0!==o&&(l=s/o),o!=a&&(o==e?(u=(r-i)/s,r<i&&(u+=6)):o==r?u=(i-e)/s+2:o==i&&(u=(e-r)/s+4),u*=60),new t(u,l,o,n)},e.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=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?"#"+r+i+n+o:"#"+r+i+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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),new t().setFromHSV(e,r,i,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}();rb.BLACK=new rb(0,0,0,1),rb.BLUE=new rb(0,0,1,1),rb.CLEAR=new rb(0,0,0,0),rb.CYAN=new rb(0,1,1,1),rb.GRAY=new rb(.5,.5,.5,1),rb.GREEN=new rb(0,1,0,1),rb.MAGENTA=new rb(1,0,1,1),rb.RED=new rb(1,0,0,1),rb.WHITE=new rb(1,1,1,1),rb.YELLOW=new rb(1,.92,.016,1);var rO=function(){function t(t,e){void 0===t&&(t=new rT(1/0,1/0,1/0)),void 0===e&&(e=new rT(-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),r=Number(1/0),i=Number(1/0),n=-1/0,o=-1/0,a=-1/0,s=0,u=t.length;s<u;s+=3){var l=t[s],c=t[s+1],h=t[s+2];l<e&&(e=l),c<r&&(r=c),h<i&&(i=h),l>n&&(n=l),c>o&&(o=c),h>a&&(a=h)}return this.min.set(e,r,i),this.max.set(n,o,a),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),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 rT),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 rT),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 r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}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 rT),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 rT;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 rT),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 rT),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new rT),this.isEmpty())return[];var r=[];return r[0]=new rT(this.min.x,this.min.y,this.min.z),r[1]=new rT(this.min.x,this.min.y,this.max.z),r[2]=new rT(this.min.x,this.max.y,this.min.z),r[3]=new rT(this.min.x,this.max.y,this.max.z),r[4]=new rT(this.max.x,this.min.y,this.min.z),r[5]=new rT(this.max.x,this.min.y,this.max.z),r[6]=new rT(this.max.x,this.max.y,this.min.z),r[7]=new rT(this.max.x,this.max.y,this.max.z),r.forEach(function(r){r.subtract(e),r.applyMatrix(t),r.add(e)}),r},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new rT;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}(),rw=function(){function t(t,e){void 0===t&&(t=rT.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 r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var o=new rO().setFromPoints(t);o.getCenter(r),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 r=this.center.distanceSquared(t);return void 0===e&&(e=new rT),e.copyFrom(t),r>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 rO),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=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(r,i,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=new rT().subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=(i-this.radius)*.5;this.center.add(e.multiply(n/i)),this.radius+=n}return this},e.union=function(t){var e=new rT,r=new rT;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},e.intersect=function(t){var e=new rT().subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}(),rL=Object.freeze({__proto__:null,get EulerOrder(){return tF},Euler:rC,Quaternion:rE,Vector2:rx,Vector3:rT,Vector4:rS,Matrix3:rR,Matrix4:r_,Ray:rA,PI2:2*Math.PI,DEG2RAD:rd,RAD2DEG:rp,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:rv,damp:function(t,e,r,i){return ry(t,e,1-Math.exp(-r*i))},lerp:ry,degToRad:function(t){return t*rd},radToDeg:function(t){return t*rp},clamp:rg,Color:rb,Box3:rO,Sphere:rw});function rI(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}new rC,new rT(1,1,1),new rT(0,0,0);var rM={error:function(t){for(var e,r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];(e=console).error.apply(e,[].concat(rI(t),[i])),null==tN||tN("error",t,i)},info:function(t){for(var e,r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(rI(t))),null==tN||tN("info",t,i)},warn:function(t){for(var e,r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(rI(t))),null==tN||tN("warn",t,i)},register:function(t){t&&rN(t)&&(tN=t)}};function rP(){}function rV(t){return"string"==typeof t}t.DestroyOptions=void 0,(n=t.DestroyOptions||(t.DestroyOptions={}))[n.destroy=0]="destroy",n[n.keep=1]="keep",n[n.force=0]="force";var rF=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function rN(t){return"[object Function]"===Object.prototype.toString.call(t)}function rD(t){return"[object Object]"===Object.prototype.toString.call(t)}function rz(t,e){return t+Math.random()*(e-t)}function rk(){throw Error("destroyed item cannot be used again")}function rU(){return(function(t,e,r){if(e9.randomUUID&&!t)return e9.randomUUID();var i,n=(t=t||{}).random||(t.rng||function(){if(!tV&&!(tV="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return tV(e5)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===i&&(i=0),e6[n[i+0]]+e6[n[i+1]]+e6[n[i+2]]+e6[n[i+3]]+"-"+e6[n[i+4]]+e6[n[i+5]]+"-"+e6[n[i+6]]+e6[n[i+7]]+"-"+e6[n[i+8]]+e6[n[i+9]]+"-"+e6[n[i+10]]+e6[n[i+11]]+e6[n[i+12]]+e6[n[i+13]]+e6[n[i+14]]+e6[n[i+15]]})().replace(/-/g,"")}function rB(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function rG(t,e,r){return e&&rB(t.prototype,e),r&&rB(t,r),t}function rX(t,e){return(rX=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function rH(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&&rX(t,e)}function rY(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function rW(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return rY(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rY(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}/*!
|
|
6
|
+
* Version: v2.0.0-alpha.9
|
|
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 r,i,n,o,a,s,u,l,c,h,f,m,d,p,v,y,g,x,T,E,_,C,A,R,S,O,b,w,L,I,M,P,V,N,F,D,U,z,k,B,G,X,H,Y,j,W,Z,q,K,Q,J,$,tt,te,tr,ti,tn,to,ta,ts,tu,tl,tc,th,tf,tm,td,tp,tv,ty,tg,tx,tT,tE,t_,tC,tA,tR,tS,tO,tb,tw,tL,tI,tM,tP,tV,tN,tF,tD,tU,tz,tk,tB,tG,tX,tH,tY,tj,tW,tZ,tq,tK,tQ,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,er,ei,en,eo,ea,es,eu,el,ec,eh,ef,em,ed,ep,ev,ey,eg,ex,eT,eE,e_,eC,eA,eR,eS,eO,eb,ew,eL,eI,eM,eP,eV,eN,eF,eD,eU,ez,ek,eB,eG,eX,eH,eY,ej,eW,eZ,eq,eK=function(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach(function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,Object.freeze(e)}(e);function eQ(t,e,r,i,n,o,a){try{var s=t[o](a),u=s.value}catch(t){r(t);return}s.done?e(u):Promise.resolve(u).then(i,n)}function eJ(t){return function(){var e=this,r=arguments;return new Promise(function(i,n){var o=t.apply(e,r);function a(t){eQ(o,i,n,a,s,"next",t)}function s(t){eQ(o,i,n,a,s,"throw",t)}a(void 0)})}}function e$(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):e$(t,e)}function e0(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function e1(t,e,r,i){var n,o=arguments.length,a=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,r,a):n(e,r))||a);return o>3&&a&&Object.defineProperty(e,r,a),a}function e2(t,e){var r,i,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(r)throw TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=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++,i=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],i=0}finally{r=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 e3=new Uint8Array(16),e4=[],e5=0;e5<256;++e5)e4.push((e5+256).toString(16).slice(1));var e6={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function e8(t,e){return t.includes(e)||t.push(e),t}function e9(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function e7(t,e,r,i){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);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 rt(t,e){var r=[0,0,0,0];if(rp(t)){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else e$(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)r[o]/=255;return r}function re(t,e,r){if(t.length){for(var i,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){i=ri(o.color,a.color,(e-o.stop)/(a.stop-o.stop));break}}return i||(i=t[t.length-1].color),r?i.map(function(t){return t/255}):i}return[0,0,0,0]}function rr(t){var e=[];if(e$(t,Array)?t.forEach(function(t){var r=t[0],i=t[1],n=t[2],o=t[3],a=t[4];e.push({stop:rn(r),color:[i,n,o,a]})}):Object.keys(t).forEach(function(r){var i=rt(t[r]);e.push({stop:rn(r),color:i})}),(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 r=e[e.length-1];1!==r.stop&&e.push({stop:1,color:r.color.slice()})}return e}function ri(t,e,r,i){var n=[],o=1-r;if(i)for(var a=0;a<4;a++)n[a]=t[a]*o+e[a]*r;else{for(var s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*o+e[s]*e[s]*r));n[3]=Math.round(t[3]*o+e[3]*r)}return n}function rn(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function ro(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function ra(){return ro()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function rs(t){var e={width:128,height:1,data:new Uint8Array(512)},r=e.data,i=rr(t);if(i.length){r.set(i[0].color,0);for(var n=1;n<127;n++){for(var o=n/128,a=void 0,s=void 0,u=0;u<i.length&&(a=i[u],s=i[u+1],!(a.stop<=o)||!(s.stop>o));u++);var l=ri(a.color,s.color,(o-a.stop)/(s.stop-a.stop));r.set(l,4*n)}r.set(i[i.length-1].color,508)}return e}function ru(t,e){void 0===e&&(e=2);var r=t.length;if(r<=1||1===e)return t;if(!(r<=30))return function t(e,r,i,n){if(void 0===i&&(i=0),void 0===n&&(n=e.length-1),i>=n)return e;for(var o,a,s=e[i],u=i,l=n;u<l;){if(2===r){for(;e[l].priority>s.priority&&l>=u;)l--;for(;e[u].priority<=s.priority&&u<l;)u++}else{for(;e[l].priority<s.priority&&l>=u;)l--;for(;e[u].priority>=s.priority&&u<l;)u++}o=[e[l],e[u]],e[u]=o[0],e[l]=o[1]}return a=[e[u],e[i]],e[i]=a[0],e[u]=a[1],t(e,r,i,u-1),t(e,r,l+1,n),e}(t,e);for(var i=1;i<r;i++)rc(t,i,e);return t}function rl(t,e,r){return void 0===r&&(r=2),t.includes(e)||(t.push(e),1===t.length||1!==r&&rc(t,t.length-1,r)),t}function rc(t,e,r){var i=t[e];if(2!==r)for(;e>=1&&t[e-1].priority<i.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>i.priority&&(t[e]=t[e-1],0!=--e););t[e]=i}function rh(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function rf(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(r=t.OrderType||(t.OrderType={}))[r.none=1]="none",r[r.ascending=2]="ascending",r[r.descending=3]="descending";var rm={error:function(t){for(var e,r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];(e=console).error.apply(e,[].concat(rf(t),[i])),null==tP||tP("error",t,i)},info:function(t){for(var e,r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(rf(t))),null==tP||tP("info",t,i)},warn:function(t){for(var e,r=arguments.length,i=Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(rf(t))),null==tP||tP("warn",t,i)},register:function(t){t&&ry(t)&&(tP=t)}};function rd(){}function rp(t){return"string"==typeof t}t.DestroyOptions=void 0,(i=t.DestroyOptions||(t.DestroyOptions={}))[i.destroy=0]="destroy",i[i.keep=1]="keep",i[i.force=0]="force";var rv=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function ry(t){return"[object Function]"===Object.prototype.toString.call(t)}function rg(t){return"[object Object]"===Object.prototype.toString.call(t)}function rx(t,e){return t+Math.random()*(e-t)}function rT(){throw Error("destroyed item cannot be used again")}function rE(){return(function(t,e,r){if(e6.randomUUID&&!t)return e6.randomUUID();var i,n=(t=t||{}).random||(t.rng||function(){if(!tM&&!(tM="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 tM(e3)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===i&&(i=0),e4[n[i+0]]+e4[n[i+1]]+e4[n[i+2]]+e4[n[i+3]]+"-"+e4[n[i+4]]+e4[n[i+5]]+"-"+e4[n[i+6]]+e4[n[i+7]]+"-"+e4[n[i+8]]+e4[n[i+9]]+"-"+e4[n[i+10]]+e4[n[i+11]]+e4[n[i+12]]+e4[n[i+13]]+e4[n[i+14]]+e4[n[i+15]]})().replace(/-/g,"")}function r_(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function rC(t,e,r){return e&&r_(t.prototype,e),r&&r_(t,r),t}function rA(t,e){return(rA=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function rR(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&&rA(t,e)}function rS(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=Array(e);r<e;r++)i[r]=t[r];return i}function rO(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return rS(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);if("Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rS(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var rb=Math.PI/180,rw=180/Math.PI;function rL(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var rI=function(t,e,r){return(1-r)*t+r*e};function rM(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r;return Math.min(Math.max(t,Math.min(i,n)),Math.max(i,n))}var rP=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 r,i;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):e$(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):e$(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):e$(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):e$(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,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,r=this.y-t.y;return Math.sqrt(e*e+r*r)},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t}();rP.ONE=new rP(1,1),rP.ZERO=new rP(0,0);var rV=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}var e=t.prototype;return e.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,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 r,i,n;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):e$(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):e$(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):e$(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):e$(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,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 r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*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,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},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,r=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new rP(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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t}();rV.X=new rV(1,0,0),rV.Y=new rV(0,1,0),rV.Z=new rV(0,0,1),rV.ONE=new rV(1,1,1),rV.ZERO=new rV(0,0,0);var rN=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),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(i),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,r=e[0],i=e[4],n=e[8],o=e[1],a=e[5],s=e[9],u=e[2],l=e[6],c=e[10],h=r+a+c;if(h>0){var f=.5/Math.sqrt(h+1);this.w=.25/f,this.x=(l-s)*f,this.y=(n-u)*f,this.z=(o-i)*f}else if(r>a&&r>c){var m=2*Math.sqrt(1+r-a-c);this.w=(l-s)/m,this.x=.25*m,this.y=(i+o)/m,this.z=(n+u)/m,this.negate()}else if(a>c){var d=2*Math.sqrt(1+a-r-c);this.w=(n-u)/d,this.x=(i+o)/d,this.y=.25*d,this.z=(s+l)/d,this.negate()}else{var p=2*Math.sqrt(1+c-r-a);this.w=(o-i)/p,this.x=(n+u)/p,this.y=(s+l)/p,this.z=.25*p,this.negate()}return this},e.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=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=r,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(rM(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var r=this.angleTo(t);return 0===r||this.slerp(t,Math.min(1,e/r)),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 r=t.x,i=t.y,n=t.z,o=t.w,a=e.x,s=e.y,u=e.z,l=e.w;return this.x=r*l+o*a+i*u-n*s,this.y=i*l+o*s+n*a-r*u,this.z=n*l+o*u+r*s-i*a,this.w=o*l-r*a-i*s-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var r=this.x,i=this.y,n=this.z,o=this.w,a=o*t.w+r*t.x+i*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=r,this.y=i,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*r+e*this.x,this.y=u*i+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var l=Math.sqrt(s),c=Math.atan2(l,a),h=Math.sin((1-e)*c)/l,f=Math.sin(e*c)/l;return this.w=o*h+this.w*f,this.x=r*h+this.x*f,this.y=i*h+this.y*f,this.z=n*h+this.z*f,this},e.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},e.rotateVector3=function(t,e){var r=this.x,i=this.y,n=this.z,o=this.w,a=t.x,s=t.y,u=t.z,l=o*a+i*u-n*s,c=o*s+n*a-r*u,h=o*u+r*s-i*a,f=-r*a-i*s-n*u,m=null!=e?e:t;return m.x=l*o+-(f*r)+-(c*n)- -(h*i),m.y=c*o+-(f*i)+-(h*r)- -(l*n),m.z=h*o+-(f*n)+-(l*i)- -(c*r),m},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(rV.ZERO,this,rV.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,r){return new t().setFromAxisAngle(e,r)},t.fromArray=function(e,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,r){return new t().setFromUnitVectors(e,r)},t}();rN.tempVec0=new rV;var rF=function(){function t(t,e,r,i,n,o,a,s,u,l,c,h,f,m,d,p){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=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===l&&(l=0),void 0===c&&(c=1),void 0===h&&(h=0),void 0===f&&(f=0),void 0===m&&(m=0),void 0===d&&(d=0),void 0===p&&(p=1),this.elements=[t,e,r,i,n,o,a,s,u,l,c,h,f,m,d,p]}var e=t.prototype;return e.set=function(t,e,r,i,n,o,a,s,u,l,c,h,f,m,d,p){var v=this.elements;return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=o,v[6]=a,v[7]=s,v[8]=u,v[9]=l,v[10]=c,v[11]=h,v[12]=f,v[13]=m,v[14]=d,v[15]=p,this},e.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u,l,c,h,f,m,d,p){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=i,v[1]=n,v[5]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=l,v[10]=c,v[14]=h,v[3]=f,v[7]=m,v[11]=d,v[15]=p,this},e.setFromColumnVectors=function(t,e,r,i){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.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 r=0;r<16;r++)this.elements[r]=t[e+r];return this},e.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},e.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},e.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),o=Math.sin(r),a=1-n,s=i.x,u=i.y,l=i.z,c=a*s,h=a*u;return this.set(c*s+n,c*u+o*l,c*l-o*u,0,c*u-o*l,h*u+n,h*l+o*s,0,c*l+o*u,h*l-o*s,a*l*l+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(rV.ZERO,t,rV.ONE)},e.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},e.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.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,r,i){var n=t.tempVec0,o=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,r),a.normalize(),n.crossVectors(i,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 r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[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 r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],u=r[12],l=r[1],c=r[5],h=r[9],f=r[13],m=r[2],d=r[6],p=r[10],v=r[14],y=r[3],g=r[7],x=r[11],T=r[15],E=i[0],_=i[4],C=i[8],A=i[12],R=i[1],S=i[5],O=i[9],b=i[13],w=i[2],L=i[6],I=i[10],M=i[14],P=i[3],V=i[7],N=i[11],F=i[15];return n[0]=o*E+a*R+s*w+u*P,n[4]=o*_+a*S+s*L+u*V,n[8]=o*C+a*O+s*I+u*N,n[12]=o*A+a*b+s*M+u*F,n[1]=l*E+c*R+h*w+f*P,n[5]=l*_+c*S+h*L+f*V,n[9]=l*C+c*O+h*I+f*N,n[13]=l*A+c*b+h*M+f*F,n[2]=m*E+d*R+p*w+v*P,n[6]=m*_+d*S+p*L+v*V,n[10]=m*C+d*O+p*I+v*N,n[14]=m*A+d*b+p*M+v*F,n[3]=y*E+g*R+x*w+T*P,n[7]=y*_+g*S+x*L+T*V,n[11]=y*C+g*O+x*I+T*N,n[15]=y*A+g*b+x*M+T*F,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],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],u=t[13],l=t[2],c=t[6],h=t[10],f=t[14];return t[3]*(+n*s*c-i*u*c-n*a*h+r*u*h+i*a*f-r*s*f)+t[7]*(+e*s*f-e*u*h+n*o*h-i*o*f+i*u*l-n*s*l)+t[11]*(+e*u*c-e*a*f-n*o*c+r*o*f+n*a*l-r*u*l)+t[15]*(-i*a*l-e*s*c+e*a*h+i*o*c-r*o*h+r*s*l)},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],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],u=t[7],l=t[8],c=t[9],h=t[10],f=t[11],m=t[12],d=t[13],p=t[14],v=t[15],y=c*p*u-d*h*u+d*s*f-a*p*f-c*s*v+a*h*v,g=m*h*u-l*p*u-m*s*f+o*p*f+l*s*v-o*h*v,x=l*d*u-m*c*u+m*a*f-o*d*f-l*a*v+o*c*v,T=m*c*s-l*d*s-m*a*h+o*d*h+l*a*p-o*c*p,E=e*y+r*g+i*x+n*T;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var _=1/E;return t[0]=y*_,t[1]=(d*h*n-c*p*n-d*i*f+r*p*f+c*i*v-r*h*v)*_,t[2]=(a*p*n-d*s*n+d*i*u-r*p*u-a*i*v+r*s*v)*_,t[3]=(c*s*n-a*h*n-c*i*u+r*h*u+a*i*f-r*s*f)*_,t[4]=g*_,t[5]=(l*p*n-m*h*n+m*i*f-e*p*f-l*i*v+e*h*v)*_,t[6]=(m*s*n-o*p*n-m*i*u+e*p*u+o*i*v-e*s*v)*_,t[7]=(o*h*n-l*s*n+l*i*u-e*h*u-o*i*f+e*s*f)*_,t[8]=x*_,t[9]=(m*c*n-l*d*n-m*r*f+e*d*f+l*r*v-e*c*v)*_,t[10]=(o*d*n-m*a*n+m*r*u-e*d*u-o*r*v+e*a*v)*_,t[11]=(l*a*n-o*c*n-l*r*u+e*c*u+o*r*f-e*a*f)*_,t[12]=T*_,t[13]=(l*d*i-m*c*i+m*r*h-e*d*h-l*r*p+e*c*p)*_,t[14]=(m*a*i-o*d*i-m*r*s+e*d*s+o*r*p-e*a*p)*_,t[15]=(o*c*i-l*a*i+l*r*s-e*c*s-o*r*h+e*a*h)*_,this},e.extractBasis=function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},e.compose=function(t,e,r,i){void 0===i&&(i=rV.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,u=e.w,l=-i.x,c=-i.y,h=-i.z,f=o+o,m=a+a,d=s+s,p=o*f,v=o*m,y=o*d,g=a*m,x=a*d,T=s*d,E=u*f,_=u*m,C=u*d,A=r.x,R=r.y,S=r.z;return n[0]=(1-(g+T))*A,n[1]=(v+C)*A,n[2]=(y-_)*A,n[3]=0,n[4]=(v-C)*R,n[5]=(1-(p+T))*R,n[6]=(x+E)*R,n[7]=0,n[8]=(y+_)*S,n[9]=(x-E)*S,n[10]=(1-(p+g))*S,n[11]=0,n[12]=l*n[0]+c*n[4]+h*n[8]-l+t.x,n[13]=l*n[1]+c*n[5]+h*n[9]-c+t.y,n[14]=l*n[2]+c*n[6]+h*n[10]-h+t.z,this},e.decompose=function(e,r,i){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 l=t.tempMat0;l.copyFrom(this);var c=1/a,h=1/s,f=1/u;return l.elements[0]*=c,l.elements[1]*=c,l.elements[2]*=c,l.elements[4]*=h,l.elements[5]*=h,l.elements[6]*=h,l.elements[8]*=f,l.elements[9]*=f,l.elements[10]*=f,r.setFromRotationMatrix(l),i.x=a,i.y=s,i.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 rV,e=new rN,r=new rV;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},e.orthographic=function(t,e,r,i,n,o){var a=1/(e-t),s=1/(r-i),u=1/(o-n),l=-(e+t)*a,c=-(r+i)*s,h=-(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]=l,f[13]=c,f[14]=h,f[15]=1,this},e.perspective=function(t,e,r,i,n){var o=1/Math.tan(.5*t),a=1/(r-i),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]=(i+r)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*i*r*a,s[15]=0,(null===i||i===1/0)&&(s[10]=-1,s[14]=-2*r),this},e.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14];var s=o[3]*r+o[7]*i+o[11]*n+o[15];return a.multiply(1/s)},e.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14],a},e.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n,a.y=o[1]*r+o[5]*i+o[9]*n,a.z=o[2]*r+o[6]*i+o[10]*n,a.normalize()},e.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,o=t.w,a=this.elements,s=null!=e?e:t;return s.x=a[0]*r+a[4]*i+a[8]*n+a[12]*o,s.y=a[1]*r+a[5]*i+a[9]*n+a[13]*o,s.z=a[2]*r+a[6]*i+a[10]*n+a[14]*o,s.w=a[3]*r+a[7]*i+a[11]*n+a[15]*o,s},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!rL(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[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,r,i){return new t().lookAt(e,r,i)},t.fromPerspective=function(e,r,i,n,o){return new t().perspective(e,r,i,n,o)},t.fromColumnVectors=function(e,r,i,n){return new t().setFromColumnVectors(e,r,i,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromScale=function(e,r,i){return new t().setFromScale(e,r,i)},t.fromTranslation=function(e,r,i){return new t().setFromTranslation(e,r,i)},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,r){return new t().setFromRotationAxis(e,r)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,r,i){return new t().setFromShear(e,r,i)},t.fromBasis=function(e,r,i){return new t().setFromBasis(e,r,i)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,l,c,h,f,m,d,p,v){return new t(e,o,l,m,r,a,c,d,i,s,h,p,n,u,f,v)},t}();rF.IDENTITY=new rF(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),rF.ZERO=new rF(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),rF.tempVec0=new rV,rF.tempVec1=new rV,rF.tempVec2=new rV,rF.tempMat0=new rF,(n=tV||(tV={}))[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 rD=function(){function t(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=r,this.z=i,this.order=n}var e=t.prototype;return e.set=function(t,e,r,i){return void 0===i&&(i=this.order),this.x=t,this.y=e,this.z=r,this.order=i,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 r=t.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],u=r[9],l=r[2],c=r[6],h=r[10];switch(e){case tV.XYZ:this.y=Math.asin(rM(o,-1,1)),.9999999>Math.abs(o)?(this.x=Math.atan2(-u,h),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(c,s),this.z=0);break;case tV.YXZ:this.x=Math.asin(-rM(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(o,h),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-l,i),this.z=0);break;case tV.ZXY:this.x=Math.asin(rM(c,-1,1)),.9999999>Math.abs(c)?(this.y=Math.atan2(-l,h),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,i));break;case tV.ZYX:this.y=Math.asin(-rM(l,-1,1)),.9999999>Math.abs(l)?(this.x=Math.atan2(c,h),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,s));break;case tV.YZX:this.z=Math.asin(rM(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-l,i)):(this.x=0,this.y=Math.atan2(o,h));break;case tV.XZY:this.z=Math.asin(-rM(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(c,s),this.y=Math.atan2(o,i)):(this.x=Math.atan2(-u,h),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=rw,this.y*=rw,this.z*=rw,this.order=e,this},e.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},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,r){var i,n,o,a;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!=(i=t[e])?i: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:r,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 rN;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},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,r=this.y,i=this.z,n=this.order,o=Math.cos(e*rb*.5),a=Math.cos(r*rb*.5),s=Math.cos(i*rb*.5),u=Math.sin(e*rb*.5),l=Math.sin(r*rb*.5),c=Math.sin(i*rb*.5);switch(n){case tV.XYZ:t.set(u*a*s+o*l*c,o*l*s-u*a*c,o*a*c+u*l*s,o*a*s-u*l*c);break;case tV.YXZ:t.set(u*a*s+o*l*c,o*l*s-u*a*c,o*a*c-u*l*s,o*a*s+u*l*c);break;case tV.ZXY:t.set(u*a*s-o*l*c,o*l*s+u*a*c,o*a*c+u*l*s,o*a*s-u*l*c);break;case tV.ZYX:t.set(u*a*s-o*l*c,o*l*s+u*a*c,o*a*c-u*l*s,o*a*s+u*l*c);break;case tV.YZX:t.set(u*a*s+o*l*c,o*l*s+u*a*c,o*a*c-u*l*s,o*a*s-u*l*c);break;case tV.XZY:t.set(u*a*s-o*l*c,o*l*s-u*a*c,o*a*c+u*l*s,o*a*s+u*l*c);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,r=this.x,i=this.y,n=this.z,o=this.order,a=Math.cos(r*rb),s=Math.sin(r*rb),u=Math.cos(i*rb),l=Math.sin(i*rb),c=Math.cos(n*rb),h=Math.sin(n*rb);if(o===tV.XYZ){var f=a*c,m=a*h,d=s*c,p=s*h;e[0]=u*c,e[4]=-u*h,e[8]=l,e[1]=m+d*l,e[5]=f-p*l,e[9]=-s*u,e[2]=p-f*l,e[6]=d+m*l,e[10]=a*u}else if(o===tV.YXZ){var v=u*c,y=u*h,g=l*c,x=l*h;e[0]=v+x*s,e[4]=g*s-y,e[8]=a*l,e[1]=a*h,e[5]=a*c,e[9]=-s,e[2]=y*s-g,e[6]=x+v*s,e[10]=a*u}else if(o===tV.ZXY){var T=u*c,E=u*h,_=l*c,C=l*h;e[0]=T-C*s,e[4]=-a*h,e[8]=_+E*s,e[1]=E+_*s,e[5]=a*c,e[9]=C-T*s,e[2]=-a*l,e[6]=s,e[10]=a*u}else if(o===tV.ZYX){var A=a*c,R=a*h,S=s*c,O=s*h;e[0]=u*c,e[4]=S*l-R,e[8]=A*l+O,e[1]=u*h,e[5]=O*l+A,e[9]=R*l-S,e[2]=-l,e[6]=s*u,e[10]=a*u}else if(o===tV.YZX){var b=a*u,w=a*l,L=s*u,I=s*l;e[0]=u*c,e[4]=I-b*h,e[8]=L*h+w,e[1]=h,e[5]=a*c,e[9]=-s*c,e[2]=-l*c,e[6]=w*h+L,e[10]=b-I*h}else if(o===tV.XZY){var M=a*u,P=a*l,V=s*u,N=s*l;e[0]=u*c,e[4]=-h,e[8]=l*c,e[1]=M*h+N,e[5]=a*c,e[9]=P*h-V,e[2]=V*h-P,e[6]=s*c,e[10]=N*h+M}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,r){return void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,r)},t.fromQuaternion=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromQuaternion(e,r)},t.fromVector3=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromVector3(e,r)},t.fromArray=function(e,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromArray(e,r,i)},t}();rD.DEFAULT_ORDER=tV.ZYX,rD.tempQuat0=new rN,rD.tempMat0=new rF,/*!
|
|
8
8
|
* Name: @galacean/effects-specification
|
|
9
9
|
* Description: Galacean Effects JSON Specification
|
|
10
10
|
* Author: Ant Group CO., Ltd.
|
|
11
|
-
* Version: v2.0.0-alpha.
|
|
12
|
-
*/"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);for(var rj=[],rZ=0;rZ<256;++rZ)rj.push((rZ+256).toString(16).slice(1));(o=tD||(tD={})).S="S",o.APlus="A+",o.A="A",o.BPlus="B+",o.B="B",(a=tz||(tz={}))[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=tk||(tk={}))[s.DOUBLE=1032]="DOUBLE",s[s.FRONT=1028]="FRONT",s[s.BACK=1029]="BACK",(u=tU||(tU={}))[u.NONE=0]="NONE",u[u.MASK=1]="MASK",u[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(l=tB||(tB={}))[l.NONE=0]="NONE",l[l.SPHERE=1]="SPHERE",l[l.CONE=2]="CONE",l[l.HEMISPHERE=3]="HEMISPHERE",l[l.CIRCLE=4]="CIRCLE",l[l.DONUT=5]="DONUT",l[l.RECTANGLE=6]="RECTANGLE",l[l.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",l[l.EDGE=8]="EDGE",l[l.TEXTURE=9]="TEXTURE",(c=tG||(tG={}))[c.GYROSCOPE=0]="GYROSCOPE",c[c.SPINE=1]="SPINE",(h=tX||(tX={}))[h.CLICK=0]="CLICK",h[h.MESSAGE=1]="MESSAGE",h[h.DRAG=2]="DRAG",(f=tH||(tH={}))[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",(m=tY||(tY={})).base="0",m.sprite="1",m.particle="2",m.null="3",m.interact="4",m.plugin="5",m.camera="6",m.composition="7",m.filter="8",m.spine="spine",m.mesh="mesh",m.tree="tree",m.text="text",m.light="light",m.skybox="skybox",m.effect="effect",(d=tW||(tW={}))[d.BILLBOARD=0]="BILLBOARD",d[d.MESH=1]="MESH",d[d.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",d[d.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(p=tj||(tj={}))[p.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",p[p.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",p[p.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",p[p.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",p[p.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",p[p.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",p[p.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",p[p.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",p[p.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(v=tZ||(tZ={}))[v.portrait=1]="portrait",v[v.landscape=0]="landscape",(y=tq||(tq={}))[y.destroy=0]="destroy",y[y.pause=1]="pause",y[y.restart=5]="restart",y[y.forward=2]="forward",y[y.pause_destroy=3]="pause_destroy",y[y.freeze=4]="freeze",(g=tQ||(tQ={})).video="video",g.image="image",(x=tK||(tK={}))[x.CONSTANT=0]="CONSTANT",x[x.CONSTANT_VEC2=1]="CONSTANT_VEC2",x[x.CONSTANT_VEC3=2]="CONSTANT_VEC3",x[x.CONSTANT_VEC4=3]="CONSTANT_VEC4",x[x.RANDOM=4]="RANDOM",x[x.LINE=5]="LINE",x[x.CURVE=6]="CURVE",x[x.BEZIER_PATH=7]="BEZIER_PATH",x[x.RGBA_COLOR=8]="RGBA_COLOR",x[x.GRADIENT_COLOR=9]="GRADIENT_COLOR",x[x.SHAPE_POINTS=10]="SHAPE_POINTS",x[x.SHAPE_SPLITS=11]="SHAPE_SPLITS",x[x.LINEAR_PATH=12]="LINEAR_PATH",x[x.COLORS=13]="COLORS",x[x.BINARY=20]="BINARY",x[x.BEZIER_CURVE=21]="BEZIER_CURVE",x[x.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",(T=tJ||(tJ={}))[T.AUTO=0]="AUTO",T[T.EASE=1]="EASE",T[T.EASE_IN=2]="EASE_IN",T[T.EASE_OUT=3]="EASE_OUT",T[T.LINE=4]="LINE",T[T.HOLD=5]="HOLD",T[T.LINE_OUT=6]="LINE_OUT",(E=t$||(t$={}))[E.destroy=0]="destroy",E[E.loop=5]="loop",E[E.freeze=4]="freeze",(_=t0||(t0={}))[_.destroyChildren=6]="destroyChildren",(C=t1||(t1={}))[C.none=0]="none",C[C.removeParticle=1]="removeParticle",(S=t2||(t2={}))[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",(R=t3||(t3={})).point="point",R.spot="spot",R.directional="directional",R.ambient="ambient",(A=t4||(t4={}))[A.box=2]="box",A[A.sphere=3]="sphere",(b=t5||(t5={})).orthographic="orthographic",b.perspective="perspective",(O=t6||(t6={})).unlit="unlit",O.pbr="pbr",O.hair="hair",(w=t8||(t8={}))[w.opaque=100]="opaque",w[w.masked=101]="masked",w[w.translucent=102]="translucent",w[w.additive=103]="additive",(L=t9||(t9={})).none="none",L.uv="uv",L.normal="normal",L.basecolor="basecolor",L.alpha="alpha",L.metallic="metallic",L.roughness="roughness",L.ao="ao",L.emissive="emissive",(I=t7||(t7={}))[I.display=0]="display",I[I.clip=1]="clip",I[I.ellipsis=2]="ellipsis",(M=et||(et={}))[M.top=0]="top",M[M.middle=1]="middle",M[M.bottom=2]="bottom",(P=ee||(ee={}))[P.left=0]="left",P[P.middle=1]="middle",P[P.right=2]="right",(V=er||(er={})).normal="normal",V.bold="bold",V.lighter="lighter",(F=ei||(ei={})).normal="normal",F.italic="italic",F.oblique="oblique",(N=en||(en={})).VFXItemData="VFXItemData",N.EffectComponent="EffectComponent",N.Material="Material",N.Shader="Shader",N.SpriteComponent="SpriteComponent",N.ParticleSystem="ParticleSystem",N.InteractComponent="InteractComponent",N.CameraController="CameraController",N.Geometry="Geometry",N.Texture="Texture",N.TextComponent="TextComponent",N.MeshComponent="MeshComponent",N.SkyboxComponent="SkyboxComponent",N.LightComponent="LightComponent",N.CameraComponent="CameraComponent",N.ModelPluginComponent="ModelPluginComponent",N.TreeComponent="TreeComponent",(D=eo||(eo={}))[D.POINTS=0]="POINTS",D[D.LINES=1]="LINES",D[D.LINE_LOOP=2]="LINE_LOOP",D[D.LINE_STRIP=3]="LINE_STRIP",D[D.TRIANGLES=4]="TRIANGLES",D[D.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",D[D.TRIANGLE_FAN=6]="TRIANGLE_FAN";var rq=Object.freeze({__proto__:null,get BackgroundType(){return tQ},get BezierKeyframeType(){return tJ},get BlendingMode(){return tz},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return tZ},get CameraType(){return t5},get CompositionEndBehavior(){return tq},get DataType(){return en},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_DESTROY_CHILDREN:6,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_RESTART:5,get FontStyle(){return ei},get GeometryType(){return eo},get InteractBehavior(){return tH},get InteractType(){return tX},get ItemEndBehavior(){return t$},get ItemType(){return tY},get LightType(){return t3},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return tU},get MaterialBlending(){return t8},get MaterialType(){return t6},get ModelBoundingType(){return t4},get ParentItemEndBehavior(){return t0},get ParticleInteractionBehavior(){return t1},get ParticleOrigin(){return tj},get PluginType(){return tG},get RenderLevel(){return tD},get RenderMode(){return tW},get RenderMode3D(){return t9},get ShapeArcMode(){return t2},get ShapeType(){return tB},get SideMode(){return tk},get TextAlignment(){return ee},get TextBaseline(){return et},get TextOverflow(){return t7},get TextWeight(){return er},get ValueType(){return tK}}),rQ={},rK={},rJ={};function r$(t){var e=t.constructor.name;if(rJ[e])return rJ[e];rJ[e]={};for(var r=rJ[e],i=t,n=e;n;){var o=rK[n];for(var a in o)r[a]=o[a];var s=Object.getPrototypeOf(i);if("Object"===(n=Object.getPrototypeOf(s).constructor.name))break;i=s}return r}function r0(t){return function(e,r){var i,n=(rK[i=e.constructor.name]||(rK[i]={}),rK[i]);n[r]||(n[r]={type:0,sourceName:t})}}function r1(t){return function(e,r){rQ[t]&&console.warn("Class "+t+" 重复注册"),rQ[t]=e}}t.ShaderType=void 0,(z=t.ShaderType||(t.ShaderType={}))[z.vertex=0]="vertex",z[z.fragment=1]="fragment";var r2=[],r3={};function r4(){"function"==typeof WebGL2RenderingContext?r5(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(r5(WebGLRenderingContext),r5(WebGLRenderingContext.prototype)):r2.push("iOS16 lockdown mode, WebGL Constants not in global"),r2.length||"HALF_FLOAT"in r3||(r3.HALF_FLOAT=5131)}function r5(t){for(var e in t)/^[A-Z_]/.test(e)&&(r3[e]=t[e])}function r6(t){switch(t){case tz.ALPHA:case tz.ADD:case tz.SUBTRACTION:case tz.STRONG_LIGHT:case tz.WEAK_LIGHT:return 1;case tz.SUPERPOSITION:return 2;case tz.BRIGHTNESS:return 3;case tz.MULTIPLY:return 0;default:return 1}}r2.length||r4();var r8=((ea={})[t.ShaderType.vertex]={in:"attribute",out:"varying"},ea[t.ShaderType.fragment]={in:"varying"},ea);function r9(t,e,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),t&&(t.forEach(function(t){var e=t[0],r=t[1];!0===r?n.push("#define "+e):Number.isFinite(r)&&n.push("#define "+e+" "+r)}),o=n.length?n.join("\n")+"\n":"");var a="WEBGL"+i,s=(o=o+("\n#ifndef "+a)+"\n#define "+a+"\n#endif")+"\n"+e,u=s.match(/#version\s+\b\d{3}\b\s*(es)?/),l=u?u[0]:"";if(l&&l.includes("300")){var c=RegExp(""+l,"g");1===i&&(s=s.replace(/\b(in|out)\b/g,function(t){var e;return null!=(e=r8[r][t])?e:t})),s=s.replace(c,"\n")}return s}function r7(t,e){switch(e){case void 0:case tz.ALPHA:t.blendFunction=[r3.ONE,r3.ONE_MINUS_SRC_ALPHA,r3.ONE,r3.ONE_MINUS_SRC_ALPHA];break;case tz.ADD:t.blendFunction=[r3.ONE,r3.ONE,r3.ONE,r3.ONE];break;case tz.SUBTRACTION:t.blendFunction=[r3.ONE,r3.ONE,r3.ZERO,r3.ONE],t.blendEquation=[r3.FUNC_REVERSE_SUBTRACT,r3.FUNC_REVERSE_SUBTRACT];break;case tz.SUPERPOSITION:t.blendFunction=[r3.ONE,r3.ONE,r3.ONE,r3.ONE];break;case tz.MULTIPLY:t.blendFunction=[r3.DST_COLOR,r3.ONE_MINUS_SRC_ALPHA,r3.DST_COLOR,r3.ONE_MINUS_SRC_ALPHA];break;case tz.BRIGHTNESS:t.blendFunction=[r3.ONE,r3.ONE_MINUS_SRC_ALPHA,r3.ONE,r3.ONE_MINUS_SRC_ALPHA];break;case tz.STRONG_LIGHT:t.blendFunction=[r3.DST_COLOR,r3.DST_ALPHA,r3.ZERO,r3.ONE];break;case tz.WEAK_LIGHT:t.blendFunction=[r3.DST_COLOR,r3.ZERO,r3.ZERO,r3.ONE];break;default:console.warn("blendMode "+e+" not in specification, please set blend params separately")}}function it(t,e){e===tk.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=r3.CW,t.cullFace=e===tk.BACK?r3.BACK:r3.FRONT)}function ie(t,e){switch(e){case void 0:t.stencilTest=!1;break;case tU.MASK:t.stencilTest=!0,t.stencilFunc=[r3.ALWAYS,r3.ALWAYS],t.stencilOpZPass=[r3.REPLACE,r3.REPLACE];break;case tU.OBSCURED:t.stencilTest=!0,t.stencilFunc=[r3.EQUAL,r3.EQUAL];break;case tU.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[r3.NOTEQUAL,r3.NOTEQUAL];break;case tU.NONE:t.stencilTest=!1;break;default:console.warn("maskMode "+e+" not in specification, please set stencil params seperately")}}function ir(){return(ir=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}).apply(this,arguments)}t.TextureLoadAction=void 0,(k=t.TextureLoadAction||(t.TextureLoadAction={}))[k.whatever=0]="whatever",k[k.clear=2]="clear",t.TextureSourceType=void 0,(U=t.TextureSourceType||(t.TextureSourceType={}))[U.none=0]="none",U[U.data=1]="data",U[U.image=2]="image",U[U.compressed=3]="compressed",U[U.video=4]="video",U[U.canvas=5]="canvas",U[U.framebuffer=6]="framebuffer",U[U.mipmaps=7]="mipmaps";var ii=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},e.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},e.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},e.download=function(t,e,r,i){var n=this;if(void 0===e&&(e="json"),!this.start(t,r,i)){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,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},e.finish=function(t,e,r){var i=this.callbacks[t];delete this.callbacks[t];for(var n=200==e||0==e?[r]:[e,r],o=n.length-1,a=i.length;o<a;o+=2)i[o].apply(null,n)},t}(),io=!1;function ia(t,e){return is.apply(this,arguments)}function is(){return(is=e0(function(t,e){return e4(this,function(r){switch(r.label){case 0:if(!(io||!e))return[3,2];return[4,iu(t)];case 1:case 5:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,iu(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),io=!0,[4,iu(t)];case 6:return[2]}})})).apply(this,arguments)}function iu(t){return il.apply(this,arguments)}function il(){return(il=e0(function(t){var e,r;return e4(this,function(i){if(e="",e1(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else e1(t,Blob)?(e=URL.createObjectURL(t),r=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t));return[2,new Promise(function(t,i){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,r&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,r&&URL.revokeObjectURL(e),i("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function ic(t){return ih.apply(this,arguments)}function ih(){return(ih=e0(function(t){return e4(this,function(e){return[2,new Promise(function(e,r){new ii().downloadBinary(t,e,function(e,i){r("Couldn't load bins "+t+": status "+e+", "+i)})})]})})).apply(this,arguments)}function im(){return(im=e0(function(t){return e4(this,function(e){return[2,new Promise(function(e,r){new ii().downloadBlob(t,e,function(e,i){r("Couldn't load blob "+t+": status "+e+", "+i)})})]})})).apply(this,arguments)}function id(t){return ip.apply(this,arguments)}function ip(){return(ip=e0(function(t){var e;return e4(this,function(r){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,rs()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,r){var i=e.play();i?i.then(function(){return t(e)}):e.addEventListener("loadeddata",function r(){t(e),e.removeEventListener("loadeddata",r)},!0),e.addEventListener("error",function(t){r(t)})})]})})).apply(this,arguments)}function iv(t,e){return iy.apply(this,arguments)}function iy(){return(iy=e0(function(e,r,i){var n,o,a,s,u,l,c,h;return e4(this,function(f){switch(f.label){case 0:if(void 0===i&&(i=[]),34067!==e.target)return[3,2];return n=e.mipmaps,o=e.target,[4,Promise.all(n.map(function(t){return Promise.all(t.map(function(t){return ig(t,r)}))}))];case 1:return a=f.sent(),s=i[n[0][0][1][0]].url,[2,ir({keepImageSource:!1},e,{mipmaps:a,sourceFrom:{target:o,bin:s,type:t.TextureSourceType.mipmaps,mipmaps:n.map(function(t){return t.map(function(t){return[t[1][1],t[1][2]]})})}})];case 2:return u=e.mipmaps,l=e.target,[4,Promise.all(u.map(function(t){return ig(t,r)}))];case 3:return c=f.sent(),h=i[u[0][1][0]].url,[2,ir({keepImageSource:!1},e,{mipmaps:c,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:l,bin:h,type:t.TextureSourceType.mipmaps,mipmaps:u.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function ig(t,e){return ix.apply(this,arguments)}function ix(){return(ix=e0(function(t,e){var r,i,n,o,a;return e4(this,function(s){if(i=(r=t[1])[0],n=r[1],o=r[2],!(a=e[i]))throw Error("invalid bin pointer: "+JSON.stringify(t));return[2,iu(new Blob([new Uint8Array(a,n,o)]))]})})).apply(this,arguments)}var iT=function(){function t(t){this.engine=t,this.guid=rU(),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}();e3([r0()],iT.prototype,"guid",void 0);var iE=1,i_=function(e){function r(t){var r;return(r=e.call(this,t)||this).destroyed=!1,r.id="Tex"+iE++,r}rH(r,e);var i=r.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(e){var r=e.target,i=void 0===r?r3.TEXTURE_2D:r,n=e.format,o=void 0===n?r3.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),ir({minFilter:r3.NEAREST,magFilter:r3.NEAREST,wrapS:r3.CLAMP_TO_EDGE,wrapT:r3.CLAMP_TO_EDGE,target:i,format:r3.RGBA,internalFormat:o,type:r3.UNSIGNED_BYTE},e)},rG(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(iT);function iC(t,e,r,i){var n,o,a=e.length/r/i;return o=n=4===a||0===a?r3.RGBA:3===a?r3.RGB:2===a?r3.LUMINANCE_ALPHA:r3.LUMINANCE,i_.createWithData(t,{data:e,width:r,height:i},{type:r3.HALF_FLOAT,format:n,internalFormat:o,wrapS:r3.CLAMP_TO_EDGE,wrapT:r3.CLAMP_TO_EDGE})}var iS=function(){function t(t,e,r){void 0===r&&(r=0),this.arrayBuffer=t,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[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){rM.warn("Only 2D textures currently supported");return}if(0!==this.numberOfArrayElements){rM.warn("Texture arrays not currently supported");return}if(this.numberOfFaces!==e){rM.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=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var l=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,s);e.push({data:l,width:i,height:n}),r+=s+4+(3-(s+3)%4)}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function iR(e){var r=new iS(e,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,l=r.glFormat;return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?r3.TEXTURE_CUBE_MAP:r3.TEXTURE_2D,internalFormat:u,format:l,mipmaps:r.mipmaps(i>=Math.floor(Math.log2(Math.max(n,o))+1))}}var iA=function(){function e(){this.reloadPending={}}var r=e.prototype;return r.reload=function(t){var e=this;return e0(function(){var r,i;return e4(this,function(n){switch(n.label){case 0:if(r=t.id,e.reloadPending[r])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[r]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return i=n.sent(),t.updateSource(i),e.reloadPending[r]=!1,[3,3];case 2:throw Error("No source from");case 3:return[2]}})})()},r.canOffloadTexture=function(e){if(e){var r=e.type;if(r===t.TextureSourceType.compressed||r===t.TextureSourceType.image){var i=e.target,n=e.map,o=e.url;return i===r3.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:rV(o)&&o.length>0}if(r===t.TextureSourceType.mipmaps){var a=e.bin,s=e.mipmaps,u=e.target,l=e.maps,c=e.urls;return a?s.length>0:u===r3.TEXTURE_CUBE_MAP?l.every(function(t){return"object"==typeof t&&t}):c.every(function(t){return rV(t)&&t.length>0})}}return!1},r.loadSource=function(e,r){var i=this;return e0(function(){var n,o,a,s,u,l,c,h,f,m,d,p,v,y,g,x,T,E;return e4(this,function(_){switch(_.label){case 0:if(n=e.type,o=e.target,a=e.map,s=e.url,u=e.bin,l=e.mipmaps,c=e.urls,h=e.maps,!(o===r3.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,i.loadCubeMap(a)];case 1:return f=_.sent(),[2,ir({},r,{cube:f,target:r3.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:ir({},a),target:r3.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,iu(s)];case 3:return m=_.sent(),[2,ir({},r,{image:m,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:r3.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,id(s)];case 5:return d=_.sent(),[2,ir({},r,{video:d,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,ic(s)];case 7:return p=_.sent(),[2,ir({},iR(p),r,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(n!==t.TextureSourceType.mipmaps)return[3,17];if(!u)return[3,13];return[4,ic(u)];case 9:if(v=_.sent(),g=(y=null!=o?o:r3.TEXTURE_2D)===r3.TEXTURE_2D?l.slice():l.map(function(t){return t.slice()}),o!==r3.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(l.map(function(t){return i.loadMipmapImages(t,v)}))];case 10:return x=_.sent(),[3,12];case 11:x=i.loadMipmapImages(l,v),_.label=12;case 12:return[2,ir({},r,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(o===r3.TEXTURE_2D||!o))return[3,15];return[4,Promise.all(c.map(function(t){return iu(t)}))];case 14:return T=_.sent(),[2,ir({},r,{mipmaps:T,target:r3.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:c.slice(),target:r3.TEXTURE_2D}})];case 15:if(o!==r3.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(h.map(function(t){return i.loadCubeMap(t)}))];case 16:return E=_.sent(),[2,ir({},r,{mipmaps:E,target:r3.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:h.map(function(t){return ir({},t)}),target:r3.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n)}})})()},r.loadMipmapImages=function(t,e){return e0(function(){return e4(this,function(r){return[2,Promise.all(t.map(function(t){return iu(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},r.loadCubeMap=function(t){return e0(function(){return e4(this,function(e){return[2,Promise.all(t.map(function(t){return iu(t)}))]})})()},e}(),ib=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(r){e.setUniformValue(r,t[r])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,r){},t}();function iO(t){return"object"==typeof t&&t&&void 0===t.length&&e1(t,i_)}t.MaterialRenderType=void 0,(B=t.MaterialRenderType||(t.MaterialRenderType={}))[B.normal=0]="normal",B[B.transformFeedback=1]="transformFeedback";var iw=1,iL=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).destroyed=!1,i.initialized=!1,r){var n=r.name,o=void 0===n?"Material"+iw++:n,a=r.renderType,s=r.shader,u=r.uniformSemantics;i.name=o,i.renderType=void 0===a?0:a,i.shaderSource=s,i.props=r,i.uniformSemantics=ir({},u)}else i.name="Material"+iw++,i.renderType=0;return i}rH(e,t);var r=e.prototype;return r.initialize=function(){},r.use=function(t,e){},rG(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}(iT),iI="uniform vec2 uFilterSourceSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));return mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}";t.ShaderCompileResultStatus=void 0,(G=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[G.noShader=0]="noShader",G[G.success=1]="success",G[G.fail=2]="fail",G[G.compiling=3]="compiling",t.GLSLVersion=void 0,(X=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",X.GLSL3="300 es";var iM=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).source=r,i}return rH(e,t),e}(iT);t.Shader=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.createVariant=function(t){var e=[];if(t)for(var r,i=rW(Object.keys(t));!(r=i()).done;){var n=r.value;e.push([n,t[n]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(iT),t.Shader=e3([r1("Shader")],t.Shader);var iP="effects-internal-copy",iV="effects-internal-copy-mesh",iF="\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",iN="precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\n"+iI+"\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n fragColor = filterMain(vTex,uFilterSource);\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n";function iD(e,r){var i=2===e,n=i?"#version 300 es":"";return{name:iP,vertex:n+"\n"+iF,fragment:n+"\n"+iN,glslVersion:i?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:iV+ +r}}var iz={format:r3.RGBA,type:r3.UNSIGNED_BYTE,minFilter:r3.LINEAR,magFilter:r3.LINEAR,wrapS:r3.CLAMP_TO_EDGE,wrapT:r3.CLAMP_TO_EDGE},ik=Symbol("dispose"),iU=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var r=e.prototype;return r.requestColorAttachmentTexture=function(e){var r=this,i=e.width,n=e.height,o=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:i,height:n},name:o},s=[o];Object.getOwnPropertyNames(iz).forEach(function(t){var r,i=null!=(r=e[t])?r:iz[t];a[t]=i,s.push(t,i)});var u=s.join(":"),l=this.textureCache[u];if(l)this.textureRef[u]++;else{var c=this.engine;rm(c),l=i_.create(c,a),this.textureCache[u]=l,this.textureRef[u]=1,l[ik]=l.dispose,l.dispose=function(){return r.removeTexture(u)}}return l},r.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("ref count < 0");var r=this.textureCache[t];r&&(r[ik](),r.dispose=r[ik]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},r.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var r=t.textureCache[e];r[ik](),r.dispose=r[ik]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),iB=function(){function t(t){void 0===t&&(t={}),this.semantics=ir({},t)}var e=t.prototype;return e.toObject=function(){return ir({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var r=this.semantics[t];return rN(r)?r(e):r},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}(),iG=((eu={})[r3.FLOAT]=Float32Array.BYTES_PER_ELEMENT,eu[r3.INT]=Int32Array.BYTES_PER_ELEMENT,eu[r3.SHORT]=Int16Array.BYTES_PER_ELEMENT,eu[r3.BYTE]=Int8Array.BYTES_PER_ELEMENT,eu),iX=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.initialize=function(){},r.flush=function(){},e}(iT);function iH(t){return t===r3.INT?new Int32Array(0):t===r3.SHORT?new Int16Array(0):new Float32Array(0)}var iY=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onAttached=function(){},r.onDestroy=function(){},r.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},r.dispose=function(){this.onDestroy(),this.item&&rt(this.item.components,this)},rG(e,[{key:"transform",get:function(){return this.item.transform}}]),e}(iT),iW=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e._enabled=!0,e}rH(e,t);var r=e.prototype;return r.onBehaviourEnable=function(){},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.toData=function(){t.prototype.toData.call(this)},rG(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.onBehaviourEnable()}}]),e}(iY);e3([r0()],iW.prototype,"_enabled",void 0);var ij=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e}rH(e,t);var r=e.prototype;return r.onEnable=function(){},r.start=function(){},r.update=function(t){},r.lateUpdate=function(t){},r.onAttached=function(){this.item.itemBehaviours.push(this)},r.dispose=function(){this.item&&rt(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},r.onBehaviourEnable=function(){this.onEnable(),this.started||(this.start(),this.started=!0)},e}(iW),iZ=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e.materials=[],e._enabled=!0,e}rH(e,t);var r=e.prototype;return r.onEnable=function(){},r.start=function(){},r.update=function(t){},r.lateUpdate=function(t){},r.render=function(t){},r.onAttached=function(){this.item.rendererComponents.push(this)},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.toData=function(){t.prototype.toData.call(this)},r.dispose=function(){this.item&&rt(this.item.rendererComponents,this),t.prototype.dispose.call(this)},rG(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}(iY);e3([r0()],iZ.prototype,"materials",void 0),e3([r0()],iZ.prototype,"_priority",void 0),e3([r0()],iZ.prototype,"_enabled",void 0);var iq=1,iQ=function(e){function r(t,r){var i;if((i=e.call(this,t)||this).destroyed=!1,i.visible=!0,r){var n=r.material,o=r.geometry,a=r.name,s=r.priority,u=r.worldMatrix,l=void 0===u?r_.fromIdentity():u;i.id="Mesh"+iq++,i.name=void 0===a?"<unnamed>":a,i.geometry=o,i.material=n,i.priority=void 0===s?0:s,i.worldMatrix=l}else i.id="Mesh"+iq++,i.name="<unnamed>",i.worldMatrix=r_.fromIdentity(),i._priority=0;return i}rH(r,e);var i=r.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){if(!this.isDestroyed&&this.getVisible()){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),r.flush(),t.drawGeometry(r,e)}},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},i.restore=function(){},i.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var r=null==e?void 0:e.material;r!==t.DestroyOptions.keep&&this.material.dispose(r),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},rG(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(iZ);t.RenderPassAttachmentStorageType=void 0,(H=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[H.none=0]="none",H[H.color=1]="color",H[H.stencil_8_opaque=2]="stencil_8_opaque",H[H.depth_16_opaque=3]="depth_16_opaque",H[H.depth_stencil_opaque=4]="depth_stencil_opaque",H[H.depth_16_texture=5]="depth_16_texture",H[H.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(Y=t.TextureStoreAction||(t.TextureStoreAction={}))[Y.store=0]="store",Y[Y.clear=2]="clear";var iK=function(){function e(e,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(e1(i,i_))this.texture=i,this.externalTexture=!0;else if(i){var o=i.wrapT,a=i.wrapS,s=i.minFilter,u=i.magFilter,l=i.internalFormat,c=i.format,h=void 0===c?r3.RGBA:c,f=i.type,m=void 0===f?r3.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:h,type:m,internalFormat:l||h,wrapT:o,wrapS:a,minFilter:s,magFilter:u,name:r.name},this.texture=i_.create(e,ir({},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)},rG(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,(W=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[W.force=0]="force",W[W.keep=1]="keep",W[W.keepExternal=2]="keepExternal",W[W.destroy=0]="destroy";var iJ=1,i$=function(){function e(e,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+iJ++:i,o=r.clearAction,a=r.semantics,s=r.depthStencilAttachment,u=r.storeAction,l=r.priority,c=r.meshOrder,h=void 0===c?t.OrderType.ascending:c,f=r.meshes,m=r.delegate;this.name=n,this.renderer=e,this.priority=void 0===l?0:l,this.meshOrder=h,this.meshes=rc((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=ir({},o),this.storeAction=ir({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new iB(a),this.options=r,this.delegate=void 0===m?{}:m,this.setViewportOptions(r)}var r=e.prototype;return r.addMesh=function(t){rh(this.meshes,t,this.meshOrder)},r.removeMesh=function(t){rt(this.meshes,t)},r.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),rc(this.meshes,this.meshOrder),this.meshes},r.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},r.configure=function(t){if(this.frameBuffer)t.setFrameBuffer(this.frameBuffer);else{var e=this.getViewport(),r=e[0],i=e[1],n=e[2],o=e[3];t.setViewport(r,i,n,o)}},r.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},r.frameCleanup=function(t){},r.resetColorAttachments=function(e){var r=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=e.map(function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new iK(r.renderer.engine,{texture:e})});this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments=i,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}})})},r.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},r.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)},r._resetAttachments=function(){var t,e,r=this,i=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,i.getWidth()*o,i.getHeight()*o],s=[a[2],a[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var l=n.attachments.map(function(t,e){var i;return new iK(r.renderer.engine,ir({size:s,name:(null==(i=t.texture)?void 0:i.name)||u+"##color_"+e},t))});this.attachments=l;var c=ng.create({storeAction:this.storeAction,name:u,viewport:a,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:l.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},i);c.bind(),c.unbind(),this.frameBuffer=c}else this.attachments.length=0},r.getViewport=function(){var t,e=(null==(t=this.frameBuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},r.getDepthAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:t.getDepthTexture()?this.getDepthTexture(t.getDepthTexture(),t.externalStorage):void 0}},r.getStencilAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:t.getStencilTexture()?this.getStencilTexture(t.getStencilTexture(),t.externalStorage):void 0}},r.getDepthTexture=function(t,e){if(!this.depthTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},r.getStencilTexture=function(t,e){if(!this.stencilTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},r.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},r.dispose=function(e){if(!this.destroyed){var r,i,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==(r=this.stencilTexture)||r.dispose(),null==(i=this.depthTexture)||i.dispose())),this.options=this.renderer=null,this.initialize=rk}},rG(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}(),i0="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",i1="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}",i2="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;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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;}",i3="#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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\nin float vLife;in vec2 vTexCoord;in 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\nin vec4 vTexCoordBlend;\n#ifdef USE_FILTER\nuniform vec4 uFSprite;\n#endif\n#endif\nin 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(){fragColor=uPreviewColor;}\n#else\n#pragma FILTER_FRAG\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}\n#ifdef USE_FILTER\n#ifdef USE_SPRITE\ntexOffset=uTexOffset/uFSprite.xy;\n#endif\ncolor=filterMain(vTexCoord,uMaskTex);\n#else\nif(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#endif\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);fragColor=color;}\n#endif\n",i4="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}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;}else 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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}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.;}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#pragma EDITOR_VERT_DEFINE\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\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef USE_FILTER\n#pragma FILTER_VERT\n#endif\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 USE_FILTER\nfilterMain(life);\n#endif\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n#pragma EDITOR_VERT_TRANSFORM\n}}",i5="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in 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\nout float vLife;out vec2 vTexCoord;out 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}",i6="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",i8="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",i9="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);}",i7="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);}",nt="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);}",ne="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}",nr=function(e){function r(r,i){var n,o=(n=e.call(this,r,i)||this).renderer.engine,a=iX.create(o,{mode:r3.TRIANGLE_STRIP,attributes:{aPos:{type:r3.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=iL.create(o,{shader:{vertex:i6,fragment:ne,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=iQ.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}rH(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFrameBuffer(this.frameBuffer)},i.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 r=e.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",r),e.renderMeshes([this.screenMesh])},r}(i$),ni=function(e){function r(r,i,n){(o=e.call(this,r,n)||this).type=i;var o,a=o.renderer.engine,s="PostProcess",u=iX.create(a,{name:s,mode:r3.TRIANGLE_STRIP,attributes:{aPos:{type:r3.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),l={vertex:i6,fragment:"H"==i?i9:i7,glslVersion:t.GLSLVersion.GLSL1},c=iL.create(a,{name:s,shader:l});return c.blending=!1,c.depthTest=!1,c.culling=!1,o.screenMesh=iQ.create(a,{name:s,geometry:u,material:c,priority:0}),o.priority=5e3,o}rH(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},i.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",nc(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFrameBuffer().getColorTextures()[0])},r}(i$),nn=function(e){function r(t,r){i=e.call(this,t,r)||this;var i,n="PostProcess",o=i.renderer.engine,a=iX.create(o,{name:n,mode:r3.TRIANGLE_STRIP,attributes:{aPos:{type:r3.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=iL.create(o,{name:n,shader:{vertex:i6,fragment:nt}});return s.blending=!1,s.depthTest=!1,s.culling=!1,i.screenMesh=iQ.create(o,{name:n,geometry:a,material:s,priority:0}),i.priority=5e3,i}rH(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},i.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",nc(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},r}(i$),no=function(e){function r(r,i){n=e.call(this,r,{})||this;var n,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new iK(a);var s=iX.create(a,{name:o,mode:r3.TRIANGLE_STRIP,attributes:{aPos:{type:r3.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=iL.create(a,{name:o,shader:{vertex:i6,fragment:i8,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=iQ.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}rH(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFrameBuffer(null)},i.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var r=e.renderingData.currentFrame.globalVolume,i=r.useBloom,n=r.bloomIntensity,o=r.brightness,a=r.saturation,s=r.contrast,u=r.useToneMapping,l=r.vignetteIntensity,c=r.vignetteSmoothness,h=r.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",i),i&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",n)),l>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",l),this.screenMesh.material.setFloat("_VignetteSmoothness",c),this.screenMesh.material.setFloat("_VignetteRoundness",h),this.screenMesh.material.setVector2("_VignetteCenter",new rx(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new rT(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",u),e.renderMeshes([this.screenMesh])},r}(i$),na={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,vignetteIntensity:.2,vignetteSmoothness:.4,vignetteRoundness:1,useToneMapping:1},ns="_effects_default_",nu=1,nl=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var r=e.camera,i=e.keepColorBuffer,n=e.renderer,o=e.editorTransform,a=e.globalVolume,s=e.clearAction,u=void 0===s?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:s,l=n.engine;a&&(this.globalVolume=ir({},na,a)),this.globalUniforms=new nf;var c=[],h={};if(this.renderer=n,this.globalVolume){var f=this.globalVolume.useHDR?r3.HALF_FLOAT:r3.UNSIGNED_BYTE;c=[{texture:{format:r3.RGBA,type:f,magFilter:r3.LINEAR,minFilter:r3.LINEAR}}],p={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},h={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var m=[new i$(n,{name:ns,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:p,attachments:c,clearAction:h})];if(this.setRenderPasses(m),this.globalVolume){var d,p,v,y=this.globalVolume.useBloom,g=new iK(l);if(y){var x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],T=Array(7),E=this.globalVolume.useHDR?r3.HALF_FLOAT:r3.UNSIGNED_BYTE,_=new nr(n,{name:"BloomThresholdPass",attachments:[{texture:{format:r3.RGBA,type:E,minFilter:r3.LINEAR,magFilter:r3.LINEAR}}]});_.sceneTextureHandle=g,this.addRenderPass(_);for(var C=0;C<7;C++){T[C]=new iK(l);var S=new ni(n,"H",{name:"GaussianDownPassH"+C,viewport:x,attachments:[{texture:{format:r3.RGBA,type:E,minFilter:r3.LINEAR,magFilter:r3.LINEAR}}]}),R=new ni(n,"V",{name:"GaussianDownPassV"+C,viewport:x,attachments:[{texture:{format:r3.RGBA,type:E,minFilter:r3.LINEAR,magFilter:r3.LINEAR}}]});R.gaussianResult=T[C],this.addRenderPass(S),this.addRenderPass(R),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var b=new nn(n,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:r3.RGBA,type:E,minFilter:r3.LINEAR,magFilter:r3.LINEAR}}]});b.gaussianDownSampleResult=T[5-A],this.addRenderPass(b),x[2]*=2,x[3]*=2}}v=y?new no(n,g):new no(n),this.addRenderPass(v)}this.semantics=new iB(e.semantics),this.clearAction=u,this.name="RenderFrame"+nu++;var O=m[0],w={type:r3.UNSIGNED_BYTE,format:r3.RGBA,internalFormat:r3.RGBA,wrapS:r3.MIRRORED_REPEAT,wrapT:r3.MIRRORED_REPEAT,minFilter:r3.NEAREST,magFilter:r3.NEAREST};this.emptyTexture=i_.create(l,ir({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},w)),this.transparentTexture=i_.create(l,ir({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},w)),this.camera=r,this.keepColorBuffer=i,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=rS.fromArray(void 0===o?[1,1,0,0]:o),e.clearAction||this.resetClearActions(),this.passTextureCache=new iU(l);var L=l.gpuCapability,I=L.detail,M=iD(L.level,I.readableDepthStencilTextures&&I.writableFragDepth);null==(d=this.renderer.getShaderLibrary())||d.addShader(M)}var r=e.prototype;return r.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},r.removeMeshFromDefaultRenderPass=function(t){},r.dispose=function(e){(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var r,i,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==(i=this.resource.depthStencil)||null==(r=i.texture)||r.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},r.resetRenderPassDefaultAttachment=function(t,e){for(var r=this.resource,i=r.color_a,n=r.color_b,o=e;o<t.length;o++){var a,s,u,l=t[o],c=null==(s=l.attachments[0])?void 0:s.texture;if(c&&a===c){var h=c===i?n:i;l.resetColorAttachments([h])}(c=null==(u=l.attachments[0])?void 0:u.texture)&&(a=c)}},r.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(r,i){return!(r.name.startsWith(ns)&&r.meshes.includes(t))||(e=i,!1)}),e},r.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e)},r.getRPAttachments=function(t,e){if((null==t?void 0:t.length)===1){var r,i=t[0],n=i.texture,o=i.persistent,a=n.format,s=null!=(r=null==e?void 0:e.getInitAttachments())?r:[];if(a===r3.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},r.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)},r.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach(function(t){return t.initialize(e.renderer)}),this._renderPasses=t.slice()},r.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},r.createResource=function(){var e=this.renderer.engine;if(!this.resource){var r,i=e.gpuCapability,n=i.detail,o=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?r3.LINEAR:r3.NEAREST,l=i_.create(e,{sourceType:t.TextureSourceType.framebuffer,format:r3.RGBA,name:"frame_a",minFilter:u,magFilter:u}),c=i_.create(e,{sourceType:t.TextureSourceType.framebuffer,format:r3.RGBA,data:{width:a,height:s},minFilter:u,magFilter:u,name:"frame_b"}),h=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new i$(this.renderer,{depthStencilAttachment:{storageType:h},attachments:[{texture:l}]}).initialize(this.renderer),m=new nh(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==(r=f.getDepthAttachment())?void 0:r.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:c,finalCopyRP:m,depthStencil:f.depthAttachment,resRP:f}}},r.createCopyMesh=function(t){var e=this.renderer.engine,r=iX.create(e,{name:iP,mode:r3.TRIANGLE_STRIP,attributes:{aPos:{type:r3.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),i=iD(e.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(i);var n=iL.create(e,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:iP,shader:i});return n.blending=!1,n.depthTest=!1,n.culling=!1,(null==t?void 0:t.blend)&&(n.blending=!0,n.blendFunction=[r3.SRC_ALPHA,r3.ONE_MINUS_SRC_ALPHA,r3.SRC_ALPHA,r3.ONE_MINUS_SRC_ALPHA]),iQ.create(e,{name:iP,geometry:r,material:n,priority:0})},r.removeRenderPass=function(t){rt(this._renderPasses,t)},rG(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function nc(t){return t?new rx(t.getWidth(),t.getHeight()):new rx}var nh=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(null)},r.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",nc(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(i$),nf=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},nm=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,r=t.format,i=t.attachment;this.storageType=e,this.format=r,this.attachment=i}return rG(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),nd="function"==typeof WebGL2RenderingContext,np=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,r=nd&&e1(t,WebGL2RenderingContext)?2:1,i=2===r,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=r,this.type=i?"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),i&&!a&&(a=nv(t,t.HALF_FLOAT)),i&&!s&&(s=nv(t,t.FLOAT)),this.internalFormatDepth16=i?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=i?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=i||t.getExtension("OES_texture_float")?t.FLOAT:0,l=i?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,c={floatTexture:u,halfFloatTexture:l,maxSample:i?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:i?!!t.getExtension("EXT_color_buffer_float"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:i?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:t.getExtension("WEBGL_compressed_texture_astc")?ny.ASTC:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?ny.PVRTC:ny.NONE,halfFloatLinear:a,floatLinear:s,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:i||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:i||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:i||!!this.drawBufferExtension,asyncShaderCompile:!!t.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:i||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:i||!!o,writableFragDepth:i||!!t.getExtension("EXT_frag_depth")};this.detail=c,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,r,i,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&r>0)throw Error("draw multiple color buffers not available");var a=o?o["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r];a?t.framebufferTexture2D(e,a,i,n,0):console.error("invalid color attachment index: "+r)},e.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1===this.level&&!r){if(!(e.length>1))return;throw Error("draw buffers not available")}var i=e.map(function(e,i){return e?r?r["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i]:t.NONE});r?r.drawBuffersWEBGL(i):t.drawBuffers(i)},e.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function nv(t,e){var r=t.createTexture(),i=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,r),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()||(i=!0),t.deleteTexture(r),i}var ny={NONE:0,PVRTC:1,ASTC:2};t.FilterMode=void 0,(j=t.FilterMode||(t.FilterMode={}))[j.Nearest=0]="Nearest",j[j.Linear=1]="Linear",t.RenderTextureFormat=void 0,(Z=t.RenderTextureFormat||(t.RenderTextureFormat={}))[Z.RGBA32=0]="RGBA32",Z[Z.RGBAHalf=1]="RGBAHalf";var ng=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,r,i){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},rG(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),nx=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFrameBuffer=function(){return null},e.setFrameBuffer=function(t){},e.setViewport=function(t,e,r,i){},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){},e.getTemporaryRT=function(t,e,r,i,n,o){return null},e.dispose=function(t){},t}(),nT=function(){function t(){}return t.collectSerializableObject=function(t,e){if(!e[t.getInstanceId()]){t.toData(),e[t.getInstanceId()]=t;for(var r,i=r$(t),n=rW(Object.keys(i));!(r=n()).done;){var o=r.value,a=t.taggedProperties[o];if(void 0===a&&(a=t[o]),e1(a,iT))this.collectSerializableObject(a,e);else if(e1(a,Array))for(var s,u=rW(a);!(s=u()).done;){var l=s.value;e1(l,iT)&&this.collectSerializableObject(l,e)}else if(e1(a,Object))for(var c,h=rW(Object.keys(a));!(c=h()).done;){var f=a[c.value];e1(f,iT)&&this.collectSerializableObject(f,e)}}}},t.serializeEffectObject=function(e){var r={},i=e.engine,n=ir({},i.jsonSceneData);t.collectSerializableObject(e,r);for(var o,a=rW(Object.keys(r));!(o=a()).done;){var s=r[o.value];n[s.getInstanceId()]||(n[s.getInstanceId()]={}),t.serializeTaggedProperties(s,n[s.getInstanceId()])}return n},t.serializeTaggedProperties=function(e,r){e.toData(),r||(r={});for(var i,n=r$(e),o=rW(Object.keys(n));!(i=o()).done;){var a=i.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?r[a]=s:e1(s,Array)?(r[a]||(r[a]=[]),t.serializeArrayProperty(s,r[a],0)):e1(s,iT)?r[a]={id:s.getInstanceId()}:e1(s,Object)&&(r[a]||(r[a]={}),t.serializeObjectProperty(s,r[a],0))}for(var u,l=rW(Object.keys(e.taggedProperties));!(u=l()).done;){var c=u.value,h=e.taggedProperties[c];"number"==typeof h||"string"==typeof h||"boolean"==typeof h||t.checkTypedArray(h)?r[c]=h:e1(h,Array)?(r[c]||(r[c]=[]),t.serializeArrayProperty(h,r[c],0)):e1(h,iT)?r[c]={id:h.getInstanceId()}:e1(h,Object)&&(r[c]||(r[c]={}),t.serializeObjectProperty(h,r[c],0))}return r},t.deserializeTaggedProperties=function(e,r){for(var i,n=r.taggedProperties,o=r$(r),a=r.engine,s=rW(Object.keys(e));!(i=s()).done;){var u=i.value;if(!o[u]){var l=e[u];n[u]=t.deserializeProperty(l,a,0)}}for(var c,h=rW(Object.keys(o));!(c=h()).done;){var f=c.value,m=e[f];void 0!==m&&(r[f]=t.deserializeProperty(m,a,0))}r.fromData(n)},t.deserializeTaggedPropertiesAsync=function(e,r){return e0(function(){var i,n,o,a,s,u,l,c,h,f,m;return e4(this,function(d){switch(d.label){case 0:i=r.taggedProperties,n=r$(r),o=r.engine,a=rW(Object.keys(e)),d.label=1;case 1:if((s=a()).done)return[3,4];if(n[u=s.value])return[3,3];return l=e[u],[4,t.deserializePropertyAsync(l,o,0)];case 2:i[u]=d.sent(),d.label=3;case 3:return[3,1];case 4:c=rW(Object.keys(n)),d.label=5;case 5:if((h=c()).done)return[3,8];if(void 0===(m=e[f=h.value]))return[3,7];return[4,t.deserializePropertyAsync(m,o,0)];case 6:r[f]=d.sent(),d.label=7;case 7:return[3,5];case 8:return r.fromData(i),[2]}})})()},t.checkTypedArray=function(t){return e1(t,Int8Array)||e1(t,Uint8Array)||e1(t,Uint8ClampedArray)||e1(t,Int16Array)||e1(t,Uint16Array)||e1(t,Int32Array)||e1(t,Uint32Array)||e1(t,Float32Array)||e1(t,Float64Array)},t.checkDataPath=function(t){return e1(t,Object)&&1===Object.keys(t).length&&t.id&&32===t.id.length},t.checkGLTFNode=function(t){return e1(t,Object)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.deserializeProperty=function(e,r,i){if(i>14){console.error("序列化数据的内嵌对象层数大于上限");return}if("number"==typeof e||"string"==typeof e||"boolean"==typeof e)return e;if(e1(e,Array)){for(var n,o=[],a=rW(e);!(n=a()).done;){var s=n.value;o.push(t.deserializeProperty(s,r,i+1))}return o}if(t.checkDataPath(e))return r.assetLoader.loadGUID(e.id);if(e1(e,iT)||t.checkTypedArray(e)||t.checkGLTFNode(e))return e;if(e1(e,Object)){for(var u,l={},c=rW(Object.keys(e));!(u=c()).done;){var h=u.value;l[h]=t.deserializeProperty(e[h],r,i+1)}return l}},t.deserializePropertyAsync=function(e,r,i){return e0(function(){var n,o,a,s,u,l,c,h,f;return e4(this,function(m){switch(m.label){case 0:if(i>14)return console.error("序列化数据的内嵌对象层数大于上限"),[2];if(!("number"==typeof e||"string"==typeof e||"boolean"==typeof e))return[3,1];return[2,e];case 1:if(!e1(e,Array))return[3,6];n=[],o=rW(e),m.label=2;case 2:if((a=o()).done)return[3,5];return s=a.value,u=n.push,[4,t.deserializePropertyAsync(s,r,i+1)];case 3:u.apply(n,[m.sent()]),m.label=4;case 4:return[3,2];case 5:return[2,n];case 6:if(!t.checkDataPath(e))return[3,8];return[4,r.assetLoader.loadGUIDAsync(e.id)];case 7:return[2,m.sent()];case 8:if(!(e1(e,iT)||t.checkTypedArray(e)||t.checkGLTFNode(e)))return[3,9];return[2,e];case 9:if(!e1(e,Object))return[3,14];l={},c=rW(Object.keys(e)),m.label=10;case 10:if((h=c()).done)return[3,13];return f=h.value,[4,t.deserializePropertyAsync(e[f],r,i+1)];case 11:l[f]=m.sent(),m.label=12;case 12:return[3,10];case 13:return[2,l];case 14:return[2]}})})()},t.serializeObjectProperty=function(e,r,i){if(i>14){console.error("序列化数据的内嵌对象层数大于上限");return}r||(r={});for(var n,o=rW(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)?r[a]=s:e1(s,Array)?(r[a]||(r[a]=[]),t.serializeArrayProperty(s,r[a],i+1)):e1(s,iT)?r[a]={id:s.getInstanceId()}:e1(s,Object)&&(r[a]||(r[a]={}),t.serializeObjectProperty(s,r[a],i+1))}},t.serializeArrayProperty=function(e,r,i){if(i>14){console.error("序列化数据的内嵌对象层数大于上限");return}r||(r=[]);for(var n=0;n<e.length;n++){var o=e[n];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?r[n]=o:e1(o,Array)?(r[n]||(r[n]=[]),this.serializeArrayProperty(o,r[n],i+1)):e1(o,iT)?r[n]={id:o.getInstanceId()}:e1(o,Object)&&(r[n]||(r[n]={}),t.serializeObjectProperty(o,r[n],i+1))}},t}(),nE=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 r,i=this.findData(e);if(!i){console.error("未找到 uuid: "+e+"的对象数据");return}switch(i.dataType){case"Material":r=iL.create(this.engine);break;case"Geometry":r=iX.create(this.engine);break;case"Texture":return i_.create(this.engine,i);default:var n=t.getClass(i.dataType);n&&(r=new n(this.engine))}if(!r){console.error("未找到 DataType: "+i.dataType+"的构造函数");return}return r.setInstanceId(i.id),this.engine.addInstance(r),nT.deserializeTaggedProperties(i,r),r},e.loadGUIDAsync=function(e){var r=this;return e0(function(){var i,n,o;return e4(this,function(a){switch(a.label){case 0:if(r.engine.objectInstance[e])return[2,r.engine.objectInstance[e]];if(n=r.findData(e))return[3,2];if(!r.engine.database)return console.error("未找到 uuid: "+e+"的对象数据"),[2,void 0];return[4,r.engine.database.loadGUID(e)];case 1:if(!(i=a.sent()))return console.error("未找到 uuid: "+e+"的磁盘数据"),[2,void 0];return r.engine.addInstance(i),[2,i];case 2:switch(n.dataType){case"Material":i=iL.create(r.engine);break;case"Geometry":i=iX.create(r.engine);break;case"Texture":return[2,i=i_.create(r.engine,n)];default:(o=t.getClass(n.dataType))&&(i=new o(r.engine))}if(!i)return console.error("未找到 DataType: "+n.dataType+"的构造函数"),[2,void 0];return i.setInstanceId(n.id),r.engine.addInstance(i),[4,nT.deserializeTaggedPropertiesAsync(n,i)];case 3:return a.sent(),[2,i]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return rQ[t]},t}(),n_=function(){function t(){}return t.prototype.loadGUID=function(t){return e0(function(){return e4(this,function(t){return[2,void 0]})})()},t}();t.DataType=void 0,(q=t.DataType||(t.DataType={})).VFXItemData="VFXItemData",q.EffectComponent="EffectComponent",q.Material="Material",q.Shader="Shader",q.SpriteComponent="SpriteComponent",q.ParticleSystem="ParticleSystem",q.InteractComponent="InteractComponent",q.CameraController="CameraController",q.Geometry="Geometry",q.Texture="Texture",q.TextComponent="TextComponent",q.MeshComponent="MeshComponent",q.SkyboxComponent="SkyboxComponent",q.LightComponent="LightComponent",q.CameraComponent="CameraComponent",q.ModelPluginComponent="ModelPluginComponent",q.TreeComponent="TreeComponent";var nC=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}(),nS=(K=new Int32Array((Q=new Float32Array(1)).buffer),function(t){Q[0]=t;var e=K[0],r=e>>16&32768,i=e>>12&2047,n=e>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&e):n<113?(i|=2048,r|=(i>>114-n)+(i>>113-n&1)):(r|=n-112<<10|i>>1,r+=1&i)}),nR=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),r=0;r<e.length;r++)e[r]=nS(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=nS(t[r])},t}(),nA=new rC,nb=new r_;function nO(t,e,r,i,n,o,a){var s=i/n,u=i,l=e.speedOverLifetime;l&&(u=l.getIntegrateValue(0,i,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;t.copyFrom(o),t.addScaledVector(a,u),t.addScaledVector(r,c);var h=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{},m=["x","y","z"];if(f.enabled){var d=new rT;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),v=f.asRotation,y=m.map(function(t){var e=f[t];return e?v?e.getValue(s):e.getIntegrateValue(0,i,n):0});nA.setFromArray(y).negate(),nb.setFromEuler(nA);var g=nb.transformPoint(p);t.addVectors(d,g)}if(h.enabled)for(var x=h.asMovement,T=0;T<3;T++){var E=h[m[T]];if(E){var _=x?E.getValue(s):E.getIntegrateValue(0,i,n);t.setElement(T,t.getElement(T)+_)}}return t}function nw(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function nL(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function nI(t,e,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)t[n]=e[n+i];return t}function nM(t,e,r){if(e&&r)for(var i=0,n=e.length;i<n;i++)t[i]=e[i]*r[i];else if(e){if(t!==e)for(var o=0;o<e.length;o++)t[o]=e[o]}else if(r&&t!==r)for(var a=0;a<r.length;a++)t[a]=r[a];return t}var nP=((el={})[tj.PARTICLE_ORIGIN_CENTER]=[0,0],el[tj.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],el[tj.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],el[tj.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],el[tj.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],el[tj.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],el[tj.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],el[tj.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],el[tj.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],el);function nV(t,e,r){var i=r.position,n=new rT(t,e,0),o=new rT;return r.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(i),new rA(i,o)}function nF(t,e,r){var i=t.x,n=t.y,o=t.z,a=new rT(i-e,n+r,o),s=new rT(i-e,n-r,o),u=new rT(i+e,n-r,o),l=new rT(i+e,n+r,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:l}]}var nN="not_implement",nD=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(nN)},e.getIntegrateValue=function(t,e,r){throw Error(nN)},e.getIntegrateByTime=function(t,e){throw Error(nN)},e.getValue=function(t){throw Error(nN)},e.toUniform=function(t){throw Error(nN)},e.map=function(t){throw Error(nN)},e.scaleXCoord=function(t){return this},t}(),nz=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onCreate=function(t){this.value=t},r.getIntegrateValue=function(t,e,r){return this.value*(e-t)},r.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},r.getValue=function(t){return this.value},r.toUniform=function(){return new Float32Array([0,this.value,0,0])},r.map=function(t){var e=this.value;return this.value=t(e),this},e}(nD),nk=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onCreate=function(t){this.items=t},r.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},r.map=function(t){return this.items=this.items.map(t),this},e}(nD),nU=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){return rz(this.min,this.max)},r.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(nD),nB=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var o=Math.random();i[n]=e[n]*(1-o)+r[n]*o}return i},r.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(nD),nG=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},r.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},r.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,o=this.xCoord*r;return((i+e/o*(n-i)+i)*e-(i+t/o*(n-i)+i)*t)/2},r.getIntegrateByTime=function(t,e){return nK(e,0,this.xCoord,this.min,this.max)-nK(t,0,this.xCoord,this.min,this.max)},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},r.scaleXCoord=function(t){return this.xCoord=t,this},e}(nD),nX=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onCreate=function(t){this.stops=rn(t)},r.getStops=function(){return this.stops},r.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1];if(n.stop<=t&&o.stop>t){var a=(t-n.stop)/(o.stop-n.stop);return ro(n.color,o.color,a,!0)}}return e[r].color.slice()},e}(nD),nH=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onCreate=function(t){var e=1/0,r=-1/0;if(Number.isFinite(t[0])&&Number.isFinite(t[1])){for(var i=[],n=2;n<t.length;n++)i.push(t[n].slice(0,4));this.keys=i,this.min=t[0],this.dist=t[1]-t[0]}else{var o=t.map(function(t){if(rF(t))return e=Math.min(e,t[1]),r=Math.max(r,t[1]),t.slice(0,4);if("object"==typeof t&&t){var i=t.time,n=t.value,o=t.inTangent,a=t.outTangent;return e=Math.min(e,n),r=Math.max(r,n),[i,n,void 0===o?0:o,void 0===a?0:a]}throw Error("invalid keyframe")}),a=r-e;if(this.keys=o,0!==a)for(var s=0;s<o.length;s++){var u=o[s];u[1]=(u[1]-e)/a}var l=o[0];l[0]>0&&(l[2]=0,o.unshift([0,l[1],0,0]));var c=o[o.length-1];c[0]<1&&(c[3]=0,o.push([1,c[1],0,0])),this.min=e,this.dist=a}this.isCurveValue=!0},r.getValue=function(t){var e=this.keys,r=this.min,i=this.dist;if(t<=e[0][0])return e[0][1]*i+r;for(var n=e.length-1,o=0;o<n;o++){var a=e[o],s=e[o+1];if(t>a[0]&&t<=s[0])return nJ(t,a,s)*i+r}return e[n][1]*i+r},r.getIntegrateByTime=function(t,e){var r=this.integrate(e,!0)-this.integrate(t,!0);return .5*this.min*(e-t)*(e-t)+r*this.dist},r.getIntegrateValue=function(t,e,r){r=r||1;var i=(this.integrate(e/r,!1)-this.integrate(t/r,!1))*r,n=(e-t)/r;return this.min*n+i*this.dist},r.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?n0:n$,a=0;a<n;a++){var s=r[a],u=r[a+1],l=s[0],c=u[0];if(t>l&&t<=c)return i+o(t,s,u);i+=o(c,s,u)}return i},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4)e.set(t[r],i);return e},r.toUniform=function(t){var e=t.index,r=this.keys;return t.curves.push(this),t.index+=r.length,t.max=Math.max(t.max,r.length),t.curveCount+=r.length,new Float32Array([2,e+1/r.length,this.min,this.dist])},r.map=function(t){return this.keys.forEach(function(e){e[1]=t(e[1])}),this},r.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e.getAllData=function(t,e){for(var r=new(e?nR:Float32Array)(4*t.index),i=0,n=0,o=t.curves;i<o.length;i++){var a=o[i].toData();r.set(a,n),n+=a.length}return e?r.data:r},e}(nD),nY=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.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 r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},r.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1],a=n[0],s=o[0];if(t>=a&&t<=s){var u=(t-a)/(s-a),l=n[1];return l+u*(o[1]-l)}}return e[r][1]},r.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},r.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},r.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?nK:nQ,a=0;a<n;a++){var s=r[a],u=r[a+1],l=s[0],c=u[0];if(t>l&&t<=c)return i+o(t,l,c,s[1],u[1]);i+=o(c,l,c,s[1],u[1])}return i},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),r=0,i=0;r<t.length;r++,i+=2)e.set(t[r],i);return e.set(t[t.length-1],e.length-2),e},r.toUniform=function(t){var e=t.index,r=Math.ceil(this.keys.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},r.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},r.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(nD),nW=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t[0],this.values=t[1]},r.getValue=function(t){for(var e=this.keys,r=this.values,i=0;i<e.length-1;i++){var n=e[i],o=e[i+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]):(nJ(t,n,o)-n[1])/a,this.calculateVec(i,s)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},r.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=[0,0,0],o=0;o<r.length;o++)n[o]=r[o]*(1-e)+i[o]*e;return n},e}(nD),nj=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onCreate=function(e){t.prototype.onCreate.call(this,e),this.cps=e[2]},r.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=this.cps[t+t],o=this.cps[t+t+1],a=[0,0,0],s=1-e,u=s*s*s,l=3*e*s*s,c=3*e*e*s,h=e*e*e,f=0;f<r.length;f++)a[f]=u*r[f]+l*n[f]+c*o[f]+h*i[f];return a},e}(nW),nZ=((ec={})[tK.RANDOM]=function(t){return e1(t[0],Array)?new nB(t):new nU(t)},ec[tK.CONSTANT]=function(t){return new nz(t)},ec[tK.CONSTANT_VEC2]=function(t){return new nz(t)},ec[tK.CONSTANT_VEC3]=function(t){return new nz(t)},ec[tK.CONSTANT_VEC4]=function(t){return new nz(t)},ec[tK.CURVE]=function(t){return new nH(t)},ec[tK.RGBA_COLOR]=function(t){return new nz(t)},ec[tK.COLORS]=function(t){return new nk(t.map(function(t){return rr(t,!1)}))},ec[tK.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new nG([t[0][1],t[1][1]]):new nY(t)},ec[tK.GRADIENT_COLOR]=function(t){return new nX(t)},ec[tK.LINEAR_PATH]=function(t){return new nW(t)},ec[tK.BEZIER_PATH]=function(t){return new nj(t)},ec);function nq(t){if(!t||!isNaN(+t))return new nz(t||0);if(e1(t,nD))return t;if(rN(nZ[t[0]]))return nZ[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not support")}function nQ(t,e,r,i,n){var o=t-e;return(i+i+(n-i)*o/(r-e))*o/2}function nK(t,e,r,i,n){var o=t*t,a=e*e;return(o*t*2*(i-n)+3*o*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function nJ(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=(t-e[0])/i,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)*r[1]}function n$(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],u=r[1],l=a-t,c=l*l,h=c*l;return(n+o+2*s-2*u)*h*l/(4*i*i*i)+(2*n+o+3*s-3*u)*h/(3*i*i)+n*c/2/i-s*l}function n0(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],u=r[1],l=a-t,c=l*l,h=c*l,f=i*i,m=f*i;return(-30*m*s*(a+t)*l+10*f*n*(a+2*t)*c+5*i*(a+3*t)*(2*n+o+3*s-3*u)*h+3*(a+4*t)*(n+o+2*s-2*u)*h*l)/60/m}function n1(t,e){if(e){var r=e[0],i=e[1];if(r===tK.CURVE){t.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(r===tK.LINE){var o=i.length;if(2===o&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&o++,i[i.length-1][0]<1&&o++;var a=Math.ceil(o/2);t.lineSegCount+=a,t.curves.push(i),t.index+=a,t.max=Math.max(t.max,a)}}}function n2(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var n3=new rE,n4=1,n5=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new rT(0,0,0),this.quat=new rE(0,0,0,1),this.rotation=new rC(0,0,0),this.scale=new rT(1,1,1),this.anchor=new rT(0,0,0),this.size=new rx(1,1),this.children=[],this.worldMatrix=r_.fromIdentity(),this.localMatrix=r_.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new rT(0,0,0),quat:new rE(0,0,0,1),scale:new rT(1,1,1)},this.name="transform_"+n4++,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,r){(this.position.x!==t||this.position.y!==e||this.position.z!==r)&&(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,r){(0!==t||0!==e||0!==r)&&(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,r){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==r)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,r,i){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==r||this.quat.w!==i)&&(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=i,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,r){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==r)&&(this.scale.x=t,this.scale.y=e,this.scale.z=r,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,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,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 r=t.position,i=t.rotation,n=t.scale,o=t.size,a=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),r&&(e1(r,rT)?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),a)e1(a,rE)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(i){var l=e?-1:1;e1(i,rC)?this.setRotation(i.x*l,i.y*l,i.z*l):this.setRotation(i[0]*l,i[1]*l,i[2]*l)}n&&(e1(n,rT)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),u&&(e1(u,rx)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){e7(this.children,t)},e.removeChild=function(t){rt(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new rC)},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 rC)},e.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.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.rotation={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 rT().copyFrom(t.position),rotation:new rC(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new rT().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 r=n3.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},rG(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}();t.CameraController=function(t){function e(e,r){var i;return i=t.call(this,e)||this,r&&i.fromData(r),i}rH(e,t);var r=e.prototype;return r.start=function(){this.options.position=this.transform.position.clone(),this.options.rotation=this.transform.getRotation().clone()},r.update=function(){var t=this.item.lifetime;if(!(t<0)&&this.item.transform.getValid()){var e=new rE,r=new rT,i=new rC;r.copyFrom(this.options.position),i.copyFrom(this.options.rotation);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(t=rg(t,0,1),n&&(r.x+=n.x.getValue(t),r.y+=n.y.getValue(t),r.z+=n.z.getValue(t),n.path)){var a=n.path.getValue(t);r.x+=a[0],r.y+=a[1],r.z+=a[2]}if(o){var s=o.z.getValue(t);i.z+=s,o.separateAxes?(i.x+=o.x.getValue(t),i.y+=o.y.getValue(t)):(i.x+=s,i.y+=s)}this.far=this.options.far.getValue(t),this.near=this.options.near.getValue(t),this.fov=this.options.fov.getValue(t),this.transform.setPosition(r.x,r.y,r.z),this.transform.setRotation(i.x,i.y,i.z),this.transform.assignWorldTRS(r,e),this.position=r,this.rotation=n5.getRotation(e,i),this.updateCamera()}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.options,i=r.near,n=r.far,o=r.fov,a=r.clipMode;if(this.clipMode=a,this.options={position:new rT,rotation:new rC,near:nq(i),far:nq(n),fov:nq(o)},e.positionOverLifetime){var s=e.positionOverLifetime,u=s.path,l=s.linearX,c=s.linearY,h=s.linearZ;this.translateOverLifetime={path:u&&nq(u),x:nq(void 0===l?0:l),y:nq(void 0===c?0:c),z:nq(void 0===h?0:h)}}if(e.rotationOverLifetime){var f=e.rotationOverLifetime,m=f.separateAxes,d=f.x,p=f.y,v=f.z;this.rotationOverLifetime={separateAxes:m,x:nq(void 0===d?0:d),y:nq(void 0===p?0:p),z:nq(void 0===v?0:v)}}},r.updateCamera=function(){if(this.item.composition){var t=this.item.composition.camera;t.near=this.near,t.far=this.far,t.fov=this.fov,t.clipMode=this.clipMode,t.position=this.position,t.rotation=this.rotation}},e}(ij),t.CameraController=e3([r1(t.DataType.CameraController)],t.CameraController);var n6=function(t){function e(){return t.apply(this,arguments)}return rH(e,t),e}(nC);t.HitTestType=void 0,(J=t.HitTestType||(t.HitTestType={}))[J.triangle=1]="triangle",J[J.box=2]="box",J[J.sphere=3]="sphere",J[J.custom=4]="custom";var n8="click",n9="touchstart",n7="touchmove",ot="touchend",oe=tH,or=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,r,i,n,o,a=this;n=function(t){return t};var s="mousedown",u="mousemove",l="mouseup",c=function(t,e,r,n,o){void 0===n&&(n=0),void 0===o&&(o=0);var s=a.target,u=s.width,l=s.height,c=performance.now(),h=0,f=0;if(i){var m=c-i.ts;h=(n-i.dx)/m||0,f=(o-i.dy)/m||0,i={dx:n,dy:o,ts:c}}return{x:e,y:r,vx:h,vy:f,dx:n,dy:o,ts:c,width:u,height:l,origin:t}};ru()&&(n=function(t){var e=t.touches,r=t.changedTouches;return e[0]||r[0]},s="touchstart",u="touchmove",l="touchend"),this.nativeHandlers=((o={})[s]=function(o){if(a.enabled){var s=n(o),u=oi(s);t=u.x,e=u.y,i=r={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},a.dispatchEvent(n9,c(o,t,e))}},o[u]=function(i){if(r&&a.enabled){var o=oi(n(i));t=o.x,e=o.y,a.dispatchEvent(n7,c(i,t,e,t-r.x,e-r.y))}},o[l]=function(i){if(r&&a.enabled){!a.allowPropagation&&i.cancelable&&(i.preventDefault(),i.stopPropagation());var o=n(i),s=oi(o),u=Math.abs(r.clientX-o.clientX)+Math.abs(r.clientY-o.clientY);t=s.x,e=s.y,u<4&&a.dispatchEvent(n8,c(i,t,e)),a.dispatchEvent(ot,c(i,t,e,t-r.x,e-r.y))}r=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 r=this.handlers[t];null==r||r.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),e7(r,e),function(){rt(r,e)}},e.removeEventListener=function(t,e){var r=this.handlers[t];r&&rt(r,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var r;null==(r=t.target)||r.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={},this.target=null)},t}();function oi(t){var e=t.target,r=t.clientX,i=t.clientY,n=e.getBoundingClientRect(),o=n.left,a=n.top;return{x:(r-o)/n.width*2-1,y:1-(i-a)/n.height*2}}var on=function(t){function e(){return t.apply(this,arguments)}return rH(e,t),e}(nC),oo="editor",oa={"Filter not imported":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg","Item duration can't be less than 0":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"},os=1,ou=function(){function e(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),o=this.createGeometry();this.mesh=this.createMesh(o,n),this.updateMesh()}var r=e.prototype;return r.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new rT,n=new rE,o=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,o),e.x=o.x,e.y=o.y,r.x=i.x,r.y=i.y,r.z=i.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",n)},r.createMaterial=function(e){var r,i=[["ENV_EDITOR",(null==(r=this.engine.renderer)?void 0:r.env)===oo]],n=nq(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;\n}\n",glslVersion:t.GLSLVersion.GLSL1,cacheId:""+e.cachePrefix+"_effects_interact",marcos:i},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=iL.create(this.engine,o);return a.depthTest=!1,a.setVector4("uPos",new rS(0,0,0,0)),a.setVector2("uSize",new rx(1,1)),a.setVector4("uColor",new rS(n[0]/255,n[1]/255,n[2]/255,n[3])),a.setQuaternion("uQuat",new rE(0,0,0,0)),a},r.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return iX.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:r3.LINES,maxVertex:4})},r.createMesh=function(t,e){return iQ.create(this.engine,{name:"Interact_preview"+os++,priority:0,worldMatrix:r_.fromIdentity(),geometry:t,material:e})},e}();function ol(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}function oc(t){var e=t.renderer,r=e.blending,i=e.side,n=e.occlusion,o=e.mask,a=e.maskMode,s=e.order,u=t.cachePrefix||"-";return{side:i,occlusion:n,blending:r,mask:o,maskMode:a,cachePrefix:u,cacheId:u+"."+ +i+"+"+ +n+"+"+ +r+"+"+s+"+"+a+"."+o}}function oh(e,r){var i=null!=r?r:{},n=i.count,o=i.env,a=i.ignoreBlend,s=i.wireframe,u=[["MAX_ITEM_COUNT",void 0===n?2:n],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",(void 0===o?"":o)===oo],["USE_BLEND",!a],["MAX_FRAG_TEX",t.maxSpriteTextureCount>=16?16:8]];return{fragment:s?i0:i2.replace(/#pragma\s+FILTER_FRAG/,""),vertex:i1.replace(/#pragma\s+FILTER_VERT/,"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}"),glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,marcos:u,shared:!0}}function of(t,e){return t.cachePrefix+"_effects_sprite_"+e}function om(t,e,r,i){var n=t.wireframe,o=oh(r,{count:e,wireframe:n,env:i});return o.shared=!0,n||(o.cacheId=of(t,e)),o}function od(e){t.maxSpriteMeshItemCount=e}t.InteractComponent=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.getHitTestParams=function(e){if(t.clickable){var r=t.item.props.content.options.behavior,i=t.getBoundingBox();if(i)return{type:i.type,triangles:i.area,behavior:r}}},t}rH(r,e);var i=r.prototype;return i.start=function(){var t=this,e=this.item.props.content.options,r=this.item.engine.renderer.env,i=this.item.composition,n=this.interactData.options,o=n.type,a=n.showPreview;if(o===tX.CLICK&&(this.clickable=!0,a&&r===oo)){var s=this.item.composition.getRendererOptions();this.previewContent=new ou(this.item.props.content,s,this.transform,this.engine)}i.addInteractiveItem(this.item,e.type),this.item.onEnd=function(){return i.removeInteractiveItem(t.item,e.type)},e.type===tX.DRAG&&(r!==oo||e.enableInEditor)&&i.event&&this.beginDragTarget(e,i.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},i.update=function(t){var e;null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=.95,this.bouncingArg.vy*=.95,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,ol(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){if(this.item&&this.item.composition){var t;this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.clickable=!1,null==(t=this.previewContent)||t.mesh.dispose(),this.endDragTarget()}},i.endDragTarget=function(){},i.handleDragMove=function(t,e){if(t&&t.cameraParam&&this.item.composition){var r=this.item.props.content.options,i=t.cameraParam,n=i.position,o=i.fov,a=e.dy,s=e.dx*e.width/e.height,u=n[2],l=Math.tan(o*Math.PI/180/2)*Math.abs(u),c=n[0]-s*l,h=n[1]-a*l;if(r.dxRange){var f,m=r.dxRange,d=m[0],p=m[1];(c=rg(c,d,p))!==d&&c!==p&&d!==p&&(null==(f=e.origin)||f.preventDefault())}if(r.dyRange){var v,y=r.dyRange,g=y[0],x=y[1];(h=rg(h,g,x))!==g&&h!==x&&g!==x&&(null==(v=e.origin)||v.preventDefault())}this.item.composition.camera.position=new rT(c,h,u)}},i.beginDragTarget=function(t,e){var i,n=this;if("camera"===t.target){var o={touchstart:function(t){n.dragEvent=null,n.bouncingArg=null;var e,r=null==(e=n.item.composition)?void 0:e.camera;i={x:t.x,y:t.y,cameraParam:{position:(null==r?void 0:r.position.toArray())||[0,0,8],fov:(null==r?void 0:r.fov)||60}}},touchmove:function(t){n.handleDragMove(i,t),n.bouncingArg=t},touchend:function(t){var e=n.bouncingArg;!ol(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=ir({},i)),i=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(r).endDragTarget=function(){Object.keys(o).forEach(function(t){e.removeEventListener(t,o[t])})}}},i.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),r=nF(rT.ZERO,.5,.5);return r.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:r}},i.fromData=function(t){e.prototype.fromData.call(this,t),this.interactData=t},r}(iZ),t.InteractComponent=e3([r1(t.DataType.InteractComponent)],t.InteractComponent),t.maxSpriteMeshItemCount=8,t.maxSpriteTextureCount=8;var op={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},ov=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return rH(r,e),r.precompile=function(e,r,i){var n=r.getShaderLibrary(),o=r.engine.gpuCapability,a=o.level,s=o.detail,u=(null!=i?i:{}).env;return!n.shaderResults[of(op,2)]&&(n.addShader(om(op,2,1,u)),n.addShader(om(op,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&n.addShader(iD(a,!0))),Promise.resolve()},r}(nC),oy=function(){function t(){this.playableOutputs=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,r=rW(this.playableOutputs);!(e=r()).done;){var i=e.value;this.callProcessFrame(i.sourcePlayable,t),i.processFrame(t)}},e.connect=function(t,e){e.connect(t)},e.addOutput=function(t){this.playableOutputs.push(t)},e.callProcessFrame=function(t,e){for(var r,i=rW(t.getInputs());!(r=i()).done;){var n=r.value;this.callProcessFrame(n,e)}t.processFrame(e)},t}(),og=function(){function t(){this.inputs=[]}var e=t.prototype;return e.connect=function(t){this.inputs.push(t)},e.getInputs=function(){return this.inputs},e.getInput=function(t){if(!(t>this.inputs.length-1))return this.inputs[t]},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.onGraphStart=function(){},e.onGraphStop=function(){},e.onPlayablePlay=function(){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.fromData=function(t){},t}(),ox=function(){function t(){}var e=t.prototype;return e.setSourcePlayeble=function(t){this.sourcePlayable=t},e.onGraphStart=function(){},e.processFrame=function(t){},t}(),oT=function(){function t(){}return t.prototype.fromData=function(t){},t}(),oE=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.clipSeed=0,e}rH(e,t);var r=e.prototype;return r.createOutput=function(){return new ox},r.createMixerPlayable=function(){return new og},r.createPlayable=function(){for(var t,e=this.createMixerPlayable(),r=rW(this.clips);!(t=r()).done;){var i=t.value;e.connect(i.playable)}return e},r.createClip=function(t,e){var r=new o_;return r.playable=new t,r.name=e||"TimelineClip"+r.id,this.addClip(r),r},r.getClips=function(){return this.clips},r.findClip=function(t){for(var e,r=rW(this.clips);!(e=r()).done;){var i=e.value;if(i.name===t)return i}},r.addClip=function(t){t.playable.bindingItem=this.bindingItem,t.id=(this.clipSeed++).toString(),this.clips.push(t)},e}(oT),o_=function(){this.start=0,this.duration=0};function oC(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var oS=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,r){return this.findCurveValue(t,e)?this.curveValues[t+e].value=r:this.curveValues[t+e]={componentType:t,propertyName:e,value:r},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(e1(e,oR))return e.animationStream},t}(),oR=function(t){function e(){var e;return(e=t.call(this)||this).animationStream=new oS(oC(e)),e}return rH(e,t),e}(og),oA=new rC,ob=new rT(1,1,1),oO=new rT,ow=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.processFrame=function(t){this.bindingItem.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.bindingItem.duration,r=this.time/e;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){ob.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(ob.y=this.sizeYOverLifetime.getValue(r),ob.z=this.sizeZOverLifetime.getValue(r)):ob.z=ob.y=ob.x;var i=this.originalTransform.scale;this.bindingItem.transform.setScale(ob.x*i.x,ob.y*i.y,ob.z*i.z)}if(this.rotationOverLifetime){var n=function(i){return t.rotationOverLifetime.asRotation?i.getValue(r):i.getIntegrateValue(0,r,e)},o=n(this.rotationOverLifetime.z),a=this.rotationOverLifetime.separateAxes;oA.x=a?n(this.rotationOverLifetime.x):0,oA.y=a?n(this.rotationOverLifetime.y):0,oA.z=o;var s=oA.addEulers(this.originalTransform.rotation,oA);this.bindingItem.transform.setRotation(s.x,s.y,s.z)}this.positionOverLifetime&&(nO(oO,this,this.gravity,this.time,e,this.originalTransform.position,this.velocity),this.originalTransform.path&&oO.add(this.originalTransform.path.getValue(r)),this.bindingItem.transform.setPosition(oO.x,oO.y,oO.z))},r.fromData=function(t){var e,r=this.bindingItem.transform.scale;this.originalTransform={position:this.bindingItem.transform.position.clone(),rotation:this.bindingItem.transform.getRotation().clone(),scale:new rT(r.x,r.y,r.x)};var i=t.positionOverLifetime,n=t.rotationOverLifetime,o=t.sizeOverLifetime;if(i&&0!==Object.keys(i).length){this.positionOverLifetime=i,i.path&&(this.originalTransform.path=nq(i.path));var a=i.linearX||i.linearY||i.linearZ;a&&(this.linearVelOverLifetime={x:i.linearX&&nq(i.linearX),y:i.linearY&&nq(i.linearY),z:i.linearZ&&nq(i.linearZ),asMovement:i.asMovement,enabled:!!a});var s=i.orbitalX||i.orbitalY||i.orbitalZ;s&&(this.orbitalVelOverLifetime={x:i.orbitalX&&nq(i.orbitalX),y:i.orbitalY&&nq(i.orbitalY),z:i.orbitalZ&&nq(i.orbitalZ),center:nw(i.orbCenter),asRotation:i.asRotation,enabled:!!s}),this.speedOverLifetime=i.speedOverLifetime&&nq(i.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=nq(o.x||1),this.sizeYOverLifetime=nq(o.y||1),this.sizeZOverLifetime=nq(o.z||1)):this.sizeXOverLifetime=nq(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:nq(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=nq(n.x||0),u.y=nq(n.y||0)}this.gravity=rT.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=nq(null!=(e=null==i?void 0:i.gravityOverLifetime)?e:0),this.direction=(null==i?void 0:i.direction)?rT.fromArray(i.direction).normalize():new rT,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},e}(oR),oL=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.createPlayable=function(){var t=new ow;return t.fromData(this.transformAnimationData),t},r.fromData=function(t){this.transformAnimationData=t},e}(oT),oI=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.onGraphStart=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},r.onPlayablePlay=function(){this.bindingItem.transform.setValid(!0),this.showRendererComponents()},r.onPlayableDestroy=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},r.hideRendererComponents=function(){for(var t,e=rW(this.bindingItem.rendererComponents);!(t=e()).done;){var r=t.value;r.enabled&&(r.enabled=!1)}},r.showRendererComponents=function(){for(var t,e=rW(this.bindingItem.rendererComponents);!(t=e()).done;){var r=t.value;r.enabled||(r.enabled=!0)}},e}(og),oM=function(e){function r(t){var r;return(r=e.call(this,t)||this).reusable=!1,r.timelineStarted=!1,r.playableGraph=new oy,r.time=0,r.tracks=[],r.trackSeed=0,r}rH(r,e);var i=r.prototype;return i.start=function(){for(var t,e=rW(this.tracks);!(t=e()).done;)for(var r,i=t.value,n=rW(i.getClips());!(r=n()).done;){var o=r.value;o.start=this.item.start,o.duration=this.item.duration}this.compileTracks(this.playableGraph)},i.update=function(e){if(!this.item.stopped&&this.item.composition){if(!this.timelineStarted){for(var r,i=rW(this.tracks);!(r=i()).done;)for(var n,o=r.value,a=rW(o.getClips());!(n=a()).done;)n.value.playable.onGraphStart();this.timelineStarted=!0}var s=this.time;if(this.item.delaying&&s>=0&&s<=this.item.duration){this.item.delaying=!1;for(var u,l=rW(this.tracks);!(u=l()).done;)for(var c,h=u.value,f=rW(h.getClips());!(c=f()).done;)c.value.playable.onPlayablePlay()}if(t.VFXItem.isParticle(this.item)?this.item.isEnded(s)&&this.item.content.destoryed:this.item.isEnded(s)){var m=this.item.endBehavior;if(!this.item.ended&&(this.item.ended=!0,this.item.onEnd(),0===m)){for(var d,p=rW(this.tracks);!(d=p()).done;)for(var v,y=d.value,g=rW(y.getClips());!(v=g()).done;)v.value.playable.onPlayableDestroy();if(this.item.delaying=!0,!this.item.reusable&&!this.reusable){this.item.dispose();return}}}if(!this.item.delaying){var x=this.time/this.item.duration;this.item.lifetime=x;for(var T,E=rW(this.tracks);!(T=E()).done;)for(var _,C=T.value,S=rW(C.getClips());!(_=S()).done;)_.value.playable.setTime(this.time);this.playableGraph.evaluate(e)}}},i.setTime=function(t){this.time=t},i.getTime=function(){return this.time},i.toLocalTime=function(t){var e=t-this.options.start,r=this.options.duration;return e-r>.001&&(5===this.options.endBehavior?e%=r:4===this.options.endBehavior&&(e=Math.min(r,e))),e},i.createTrack=function(t,e){var r=new t;return r.bindingItem=this.item,r.id=(this.trackSeed++).toString(),r.name=e||"Track"+r.id,this.tracks.push(r),r},i.getTracks=function(){return this.tracks},i.findTrack=function(t){for(var e,r=rW(this.tracks);!(e=r()).done;){var i=e.value;if(i.name===t)return i}},i.rebuildGraph=function(){this.playableGraph=new oy,this.compileTracks(this.playableGraph)},i.compileTracks=function(t){for(var e,r=rW(this.tracks);!(e=r()).done;){var i=e.value,n=i.createPlayable(),o=i.createOutput();t.addOutput(o),o.setSourcePlayeble(n)}},i.fromData=function(t){if(e.prototype.fromData.call(this,t),this.options={start:this.item.start,duration:this.item.duration,looping:5===this.item.endBehavior,endBehavior:this.item.endBehavior||0},this.id=this.item.id,this.name=this.item.name,this.createTrack(oE,"ActivationTrack").createClip(oI,"ActivationTimelineClip"),t.tracks)for(var r,i=t.tracks,n=rW(i);!(r=n()).done;)for(var o,a=r.value,s=this.createTrack(oE),u=rW(a.clips);!(o=u()).done;){var l=o.value;switch(l.dataType){case"TransformAnimationPlayableAsset":s.name="AnimationTrack",s.createClip(ow,"AnimationTimelineClip").playable.fromData(l.animationClip);break;case"SpriteColorAnimationPlayableAsset":s.name="SpriteColorTrack",s.createClip(oN,"SpriteColorClip").playable.fromData(l.animationClip)}}},i.toData=function(){e.prototype.toData.call(this)},r}(ij);e3([r0()],oM.prototype,"time",void 0);var oP=[[0,0,1,1,void 0]],oV=[1,1,1,1],oF=0,oN=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}rH(r,e);var i=r.prototype;return i.onPlayablePlay=function(){this.spriteMaterial=this.bindingItem.getComponent(t.SpriteComponent).material},i.processFrame=function(t){var e,r=nL(oV,1),i=this.time/this.bindingItem.duration,n=this.opacityOverLifetime,o=this.colorOverLifetime;o&&(r=ri(o,i,!0),e=!0),n&&(r[3]*=n.getValue(i),e=!0),e&&(nM(this.renderColor,r,this.startColor),this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor))},i.fromData=function(t){this.clipData=t;var e,r=t.colorOverLifetime;return r&&(this.opacityOverLifetime=nq(null!=(e=r.opacity)?e:1),r.color&&r.color[0]===tK.GRADIENT_COLOR&&(this.colorOverLifetime=rn(r.color[1]))),this.startColor=t.startColor||[1,1,1,1],this},r}(og);t.SpriteComponent=function(e){function r(t,r){var i;return(i=e.call(this,t)||this).color=[1,1,1,1],i.visible=!0,i.getHitTestParams=function(t){var e=i.interaction;if(t||e){var r,n=i.getBoundingBox();if(n)return{behavior:(null==(r=i.interaction)?void 0:r.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:i.renderer.side===tk.FRONT}}},r&&i.fromData(r),i}rH(r,e);var i=r.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){if(this.getVisible()){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),r.flush(),t.drawGeometry(r,e)}},i.start=function(){this.priority=this.item.listIndex,this.timelineComponent=this.item.getComponent(oM),this.item.getHitTestParams=this.getHitTestParams},i.update=function(t){var e=this.timelineComponent.getTime(),r=this.item.duration,i=this.textureSheetAnimation;if(i){var n,o,a,s,u=i.total||i.row*i.col,l=0,c=0,h=1,f=1;if(this.splits){var m=this.splits[0];n=m[4],l=m[0],c=m[1],n?(h=m[3],f=m[2]):(h=m[2],f=m[3])}if(n?(o=1/i.row*h,a=1/i.col*f):(o=1/i.col*h,a=1/i.row*f),i.animate){var d=Math.round(Math.min(Math.max(e/r,0),1)*(u-1)),p=Math.floor(d/i.col),v=d-p*i.col;s=n?[o*p,a*(i.col-v)]:[o*v,a*(1+p)]}else s=[0,a];this.material.getVector4("_TexOffset").setFromArray([l+s[0],f+c-s[1],o,a])}},i.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},i.getItemInitData=function(t,e,r,i){var n=t.geoData;n||(n=t.geoData=this.getItemGeometryData(t,e));var o=n.index,a=o.length,s=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new o.constructor(a);if(!this.wireframe)for(var u=0;u<a;u++)s[u]=r+o[u];return{atlasOffset:n.atlasOffset,index:s}},i.setItem=function(){var e=[],r=this.renderer.texture;r&&e7(e,r);var i=(r=this.renderer.texture)?e.indexOf(r):-1,n=this.getItemInitData(this,0,0,i),o=this.renderer,a=this.material.getVector4("_TexParams");a.x=o.occlusion?+o.transparentOcclusion:1,a.y=+this.preMultiAlpha,a.z=o.renderMode;var s={atlasOffset:new Float32Array(n.atlasOffset.length),index:new Uint16Array(n.index.length)};s.atlasOffset.set(n.atlasOffset),s.index.set(n.index);var u=this.material,l=this.geometry,c=s.index;l.setIndexData(c),l.setAttributeData("atlasOffset",s.atlasOffset),l.setDrawCount(n.index.length);for(var h=0;h<e.length;h++){var f=e[h];u.setTexture("uSampler"+h,f)}for(var m=this.emptyTexture,d=e.length;d<t.maxSpriteMeshItemCount;d++)u.setTexture("uSampler"+d,m)},i.createGeometry=function(t){var e=12*this.splits.length;return iX.create(this.engine,{attributes:{aPos:{type:r3.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:r3.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},i.createMaterial=function(t,e){var r=t.side,i=t.occlusion,n=t.blending,o=t.maskMode,a=t.mask,s={shader:om(t,e,1)};this.preMultiAlpha=r6(n);var u=iL.create(this.engine,s),l={side:r,blending:!0,blendMode:n,mask:a,maskMode:o,depthTest:!0,depthMask:i};return u.blending=l.blending,u.stencilRef=void 0!==l.mask?[l.mask,l.mask]:void 0,u.depthTest=l.depthTest,u.depthMask=l.depthMask,r7(u,l.blendMode),ie(u,l.maskMode),it(u,l.side),u.hasUniform("_Color")||u.setVector4("_Color",new rS(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new rS),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new rS),u},i.getItemGeometryData=function(t,e){var r=t.splits,i=t.renderer,n=t.textureSheetAnimation;if(i.shape){for(var o=i.shape,a=o.index,s=o.aPoint,u=new Float32Array(s),l=[],c=[],h=0;h<u.length;h+=6)u[h]*=1,u[h+1]*=1,c.push(s[h+2],s[h+3]),l.push(u[h],u[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(l)),{index:a,atlasOffset:c}}var f=[],m=[],d=2,p=2;1===r.length&&(d=1,p=1);for(var v=[],y=0;y<d;y++)for(var g=0;g<p;g++){var x=(2*g+y)*4,T=n?[0,0,1,1,r[0][4]]:r[2*g+y],E=T[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],_=((y+y+1)/d-1)/2,C=((g+g+1)/p-1)/2,S=T[0],R=T[1],A=T[4]?T[3]:T[2],b=T[4]?T[2]:T[3],O=[-.5/d+_,.5/p+C,-.5/d+_,-.5/p+C,.5/d+_,.5/p+C,.5/d+_,-.5/p+C];f.push(E[0]*A+S,E[1]*b+R,E[2]*A+S,E[3]*b+R,E[4]*A+S,E[5]*b+R,E[6]*A+S,E[7]*b+R),v.push(1*O[0],1*O[1],0,1*O[2],1*O[3],0,1*O[4],1*O[5],0,1*O[6],1*O[7],0),m.push(x,1+x,2+x,2+x,1+x,3+x)}return this.geometry.setAttributeData("aPos",new Float32Array(v)),{index:m,atlasOffset:f}},i.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},i.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),r=nF(rT.ZERO,.5,.5);return r.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:r}}},i.fromData=function(t){e.prototype.fromData.call(this,t);var r,i,n,o,a,s,u=t.interaction,l=t.options,c=t.listIndex,h=t.renderer;h||(h={}),this.interaction=u,this.renderer={renderMode:null!=(r=h.renderMode)?r:tW.BILLBOARD,blending:null!=(i=h.blending)?i:tz.ALPHA,texture:null!=(n=h.texture)?n:this.engine.emptyTexture,occlusion:!!h.occlusion,transparentOcclusion:!!h.transparentOcclusion||h.maskMode===tU.MASK,side:null!=(o=h.side)?o:tk.DOUBLE,shape:h.shape,mask:null!=(a=h.mask)?a:0,maskMode:null!=(s=h.maskMode)?s:tU.NONE,order:void 0===c?0:c},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||oP,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=oc(this);var f=this.createGeometry(r3.TRIANGLES),m=this.createMaterial(this.renderInfo,2);this.worldMatrix=r_.fromIdentity(),this.material=m,this.geometry=f,this.name="MSprite"+oF++;var d=l.startColor||[1,1,1,1];this.material.setVector4("_Color",new rS().setFromArray(d)),this.material.setVector4("_TexOffset",new rS().setFromArray([0,0,1,1])),this.setItem()},i.toData=function(){e.prototype.toData.call(this)},r}(iZ),t.SpriteComponent=e3([r1(t.DataType.SpriteComponent)],t.SpriteComponent);var oD="lookup_texture",oz="offscreen_canvas",ok={},oU=function(){function e(e,r){this.particleCount=0;var i,n,o,a,s,u,l,c,h,f=(null!=(l=e.renderer)?l:{}).env,m=r.speedOverLifetime,d=r.colorOverLifetime,p=r.linearVelOverLifetime,v=r.orbitalVelOverLifetime,y=r.sizeOverLifetime,g=r.rotationOverLifetime,x=r.sprite,T=r.gravityModifier,E=r.maxCount,_=r.textureFlip,C=r.useSprite,S=r.name;r.filter;var R=r.gravity,A=r.forceTarget,b=r.side,O=r.occlusion,w=r.anchor,L=r.blending,I=r.maskMode,M=r.mask,P=r.transparentOcclusion,V=r.meshSlots,F=r.renderMode,N=void 0===F?0:F,D=r.diffuse,z=void 0===D?i_.createWithData(e):D,k=e.gpuCapability.detail,U=k.halfFloatTexture,B=k.maxVertexUniforms,G=[["RENDER_MODE",+N],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",f===oo]],X=e.gpuCapability.level,H=n2(),Y=n2(),W=B>0,j={},Z=0,q=0;this.useSprite=C,W&&G.push(["ENABLE_VERTEX_TEXTURE",!0]),m&&(G.push(["SPEED_OVER_LIFETIME",!0]),q|=2,j.uSpeedLifetimeValue=m.toUniform(H)),(null==x?void 0:x.animate)&&(G.push(["USE_SPRITE",!0]),q|=4,j.uFSprite=j.uSprite=new Float32Array([x.col,x.row,x.total,x.blend?1:0]),this.useSprite=!0),(null==d?void 0:d.color)&&(G.push(["COLOR_OVER_LIFETIME",!0]),q|=16,j.uColorOverLifetime=e1(d.color,i_)?d.color:i_.createWithData(e,rl(d.color))),(null==d?void 0:d.opacity)?j.uOpacityOverLifetimeValue=d.opacity.toUniform(H):j.uOpacityOverLifetimeValue=nq(1).toUniform(H),["x","y","z"].forEach(function(t,e){var r=0,i=0;(null==p?void 0:p[t])&&(j["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=p[t].toUniform(H),r=1,q|=1<<7+e,p.enabled=!0),G.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==v?void 0:v[t])&&(j["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(H),i=1,q|=1<<10+e,c=!0,v.enabled=!0),G.push(["ORB_VEL_"+t.toUpperCase(),i])}),(null==p?void 0:p.asMovement)&&(G.push(["AS_LINEAR_MOVEMENT",!0]),q|=32),c&&((null==v?void 0:v.asRotation)&&(G.push(["AS_ORBITAL_MOVEMENT",!0]),q|=64),j.uOrbCenter=new Float32Array((null==v?void 0:v.center)||[0,0,0])),j.uSizeByLifetimeValue=null==y?void 0:y.x.toUniform(H),(null==y?void 0:y.separateAxes)&&(G.push(["SIZE_Y_BY_LIFE",1]),q|=16384,j.uSizeYByLifetimeValue=null==y?void 0:null==(h=y.y)?void 0:h.toUniform(H)),(null==g?void 0:g.z)&&(j.uRZByLifeTimeValue=g.z.toUniform(H),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(j.uRXByLifeTimeValue=g.x.toUniform(H),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(j.uRYByLifeTimeValue=g.y.toUniform(H),q|=131072,G.push(["ROT_Y_LIFETIME",1])),(null==g?void 0:g.asRotation)&&(G.push(["ROT_LIFETIME_AS_MOVEMENT",1]),q|=262144),j.uGravityModifierValue=T.toUniform(H),A&&(G.push(["FINAL_TARGET",!0]),q|=524288,j.uFinalTarget=new Float32Array(A.target||[0,0,0]),j.uForceCurve=A.curve.toUniform(H)),U&&Y.max?(q|=1048576,j.uFCurveValueTexture=iC(e,nH.getAllData(Y,!0),Y.index,1)):j.uFCurveValues=nH.getAllData(Y);var Q=H.max+H.curves.length-32>B;if(2===X&&(H.max=-1,H.index=V?V[0]:oG(H.index),Y.index>0&&(Y.max=-1,Y.index=V?V[1]:oG(Y.index))),Q&&U&&W){var K=iC(e,nH.getAllData(H,!0),H.index,1);j.uVCurveValueTexture=K,Z=1}else j.uVCurveValues=nH.getAllData(H);var J=["-p:",N,q,H.index,H.max,Y.index,Y.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",H.index],["FRAG_CURVE_VALUE_COUNT",Y.index],["VERT_MAX_KEY_FRAME_COUNT",H.max],["FRAG_MAX_KEY_FRAME_COUNT",Y.max]);var $={fragment:i3,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+i4,glslVersion:1===X?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,marcos:G,name:"particle#"+S},tt=r6(L);j.uTexOffset=new Float32Array(z?[1/z.getWidth(),1/z.getHeight()]:[0,0]),j.uMaskTex=z,j.uColorParams=new Float32Array([z?1:0,+tt,0,+(!!O&&!P)]),j.uParams=[0,0,0,0],j.uAcceleration=[(null==R?void 0:R[0])||0,(null==R?void 0:R[1])||0,(null==R?void 0:R[2])||0,0];var te=iL.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=M?[M,M]:void 0,ie(te,I),r7(te,L),it(te,b);var tr={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"};Object.keys(j).map(function(t){var e=j[t];if(e1(e,i_)){te.setTexture(t,e);return}var r=[];switch(tr[t]){case"vec4":te.setVector4(t,rS.fromArray(e));break;case"vec3":te.setVector3(t,rT.fromArray(e));break;case"vec2":te.setVector2(t,rx.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new rS(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}te.setVector4Array(t,r),r.length=0;break;default:console.warn("uniform "+t+"'s type not in typeMap")}}),te.setVector3("emissionColor",new rT(0,0,0)),te.setFloat("emissionIntensity",0);var ti=iX.create(e,(i=4*E,n=this.useSprite,o="particle#"+S,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:i})),tn=iQ.create(e,{name:"MParticle_"+S,material:te,geometry:ti});this.anchor=w,this.mesh=tn,this.geometry=tn.firstGeometry(),this.forceTarget=A,this.sizeOverLifetime=y,this.speedOverLifetime=m,this.linearVelOverLifetime=p,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=T,this.maxCount=E,this.textureOffsets=_?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var r=e.prototype;return r.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),r=32*t+4;return[e[r],e[r+1],e[r+2],e[r+3]]},r.getPointPosition=function(t){var e=this.geometry,r=48*t,i=e.getAttributeData("aPos"),n=e.getAttributeData("aOffset"),o=this.time-n[16*t+2],a=n[16*t+3],s=this.mesh.material,u=s.getVector4("uAcceleration").toVector3(),l=rT.fromArray(i,r),c=rT.fromArray(i,r+3),h=nO(new rT,this,u,o,a,l,c);if(this.forceTarget){var f=s.getVector3("uFinalTarget"),m=this.forceTarget.curve.getValue(o/a),d=1-m;h.x=h.x*d+f.x*m,h.y=h.y*d+f.y*m,h.z=h.z*d+f.z*m}return h},r.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},r.resetGeometryData=function(t){for(var e=t.getAttributeNames(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new r.constructor(0))},r.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},r.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},r.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i,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 l={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},c=this.useSprite;c&&(l.aSprite=new Float32Array(12));var h=new rT,f=new rE,m=new rT(1,1,1);e.transform.assignWorldTRS(h,f,m);var d=n5.getRotation(f,new rC),p=h.toArray(),v=d.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],T=e.vel,E=e.color,_=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],C=Math.random();c&&(i=e.sprite);for(var S=0;S<4;S++){var R=2*S,A=3*S,b=4*S,O=12*S,w=8*S;l.aPos.set(p,O),T.fill(l.aPos,O+3),l.aRot.set(v,w),l.aRot[w+3]=C,l.aRot.set(E,w+4),c&&l.aSprite.set(i,A);var L=e.uv||x;if(L){var I=c?1-y[R+1]:y[R+1];g[0]=L[0]+y[R]*L[2],g[1]=L[1]+I*L[3]}l.aOffset.set(g,b);for(var M=S+S,P=(_[M]-this.anchor.x)*m.x,V=(_[M+1]-this.anchor.y)*m.y,F=0;F<3;F++)l.aPos[O+6+F]=e.dirX.getElement(F)*P,l.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=re(a.getIndexData(),6*n,u,6*r);D.set(N,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,N);Object.keys(l).forEach(function(e){var i=l[e],n=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var c=re(a.getAttributeData(e),o*n,u,4*r*n);c.set(i,i.length*t),a.setAttributeData(e,c)}else a.setAttributeSubData(e,i.length*t,i)}),this.particleCount=Math.max(n,this.particleCount),a.setDrawCount(6*this.particleCount)}},e}(),oB=[10,32,64,160];function oG(t){for(var e=0;e<oB.length;e++){var r=oB[e];if(r>t)return r}return t||oB[0]}function oX(t,e,r){void 0===e&&(e="");var i,n,o,a=t.content,s=+((null==(i=a.renderer)?void 0:i.renderMode)||0),u=[["RENDER_MODE",s],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",e===oo]],l=r.level,c=r.detail,h=n2(),f=n2(),m=c.maxVertexUniforms>0,d=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,p=0,v=0;m&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,n1(h,d));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&&n1(h,x);var T=a.positionOverLifetime;["x","y","z"].forEach(function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==T?void 0:T[i])&&(n1(h,T[i]),r=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),r]);var a=0;(null==T?void 0:T[n])&&(n1(h,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);var E=a.sizeOverLifetime;n1(h,null==E?void 0:E.x),(null==E?void 0:E.separateAxes)&&(u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,n1(h,null==E?void 0:E.y));var _=a.rotationOverLifetime;(null==_?void 0:_.z)&&(n1(h,null==_?void 0:_.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),(null==_?void 0:_.separateAxes)&&(_.x&&(n1(h,_.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),_.y&&(n1(h,_.y),v|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==_?void 0:_.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),v|=262144),n1(h,null==T?void 0:T.gravityOverLifetime),(null==T?void 0:T.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,n1(h,T.forceCurve));var C=c.halfFloatTexture;C&&f.max&&(v|=1048576);var S=c.maxVertexUniforms,R=h.max+h.curves.length-32>S;ok[oD]&&(R=!0),2===l&&(h.max=-1,f.index>0&&(f.max=-1)),R&&C&&m&&(p=1);var A={fragment:i3,vertex:"#define LOOKUP_TEXTURE_CURVE "+p+"\n"+i4,shared:!0,cacheId:["-p:",s,v,h.index,h.max,f.index,f.max].join("+"),marcos:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",h.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",h.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:A,vertex:h.index,fragment:f.index}}function oH(t,e,r){var i,n=null==(i=t.cacheId)?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.marcos)for(var o=0;o<t.marcos.length;o++){var a=t.marcos[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}}var oY=new rT,oW=new rT,oj=function(){function e(e,r){this.pointStart=[];var i,n=r.colorOverLifetime,o=r.colorOverTrail,a=r.maxTrailCount,s=r.opacityOverLifetime,u=void 0===s?nq(1):s,l=r.widthOverTrail,c=r.name,h=r.occlusion,f=r.blending,m=r.maskMode,d=r.textureMap,p=r.texture,v=r.transparentOcclusion,y=r.minimumVertexDistance,g=r.lifetime,x=r.matrix,T=e.gpuCapability,E=T.detail,_=T.level,C=Math.max(r.pointCountPerTrail,2),S=n2(),R=E.maxVertexTextures>0,A=(null!=(i=e.renderer)?i:{}).env,b={},O=[["ENABLE_VERTEX_TEXTURE",R],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",A===oo]],w=a>64,L=0;n&&(O.push(["COLOR_OVER_LIFETIME",!0]),L|=1,b.uColorOverLifetime=i_.createWithData(e,rl(n))),o&&(O.push(["COLOR_OVER_TRAIL",!0]),L|=4,b.uColorOverTrail=i_.createWithData(e,rl(o))),w?(O.push(["ATTR_TRAIL_START",1]),L|=8):b.uTrailStart=new Float32Array(a),b.uOpacityOverLifetimeValue=u.toUniform(S);var I=l.toUniform(S);O.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),b.uVCurveValues=nH.getAllData(S);var M={shader:{vertex:i5,fragment:i3,marcos:O,glslVersion:1===_?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+L+"+"+S.index+"+"+S.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},P=C*a*2,V=(C-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#"+c,bufferUsage:r3.DYNAMIC_DRAW};if(w)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*C,B=k*U,G=0;G<U;G++)z[B+G]=k}var X=r6(f),H=iL.create(e,M);H.blending=!0,H.depthMask=h,H.depthTest=!0,ie(H,m),r7(H,f);var Y=this.mesh=iQ.create(e,{name:"MTrail_"+c,material:H,geometry:iX.create(e,D)}),W=null!=p?p:i_.createWithData(e);Object.keys(b).map(function(t){var e=b[t];if(e1(e,i_))H.setTexture(t,e);else if("uTrailStart"===t)H.setFloats("uTrailStart",e);else if("uVCurveValues"===t){var r=[];r.push(new rS(e[0],e[1],e[2],e[3])),r.push(new rS(e[4],e[5],e[6],e[7])),H.setVector4Array(t,r)}else H.setVector4(t,rS.fromArray(e))}),H.setFloat("uTime",0),H.setVector4("uWidthOverTrail",rS.fromArray(I)),H.setVector2("uTexOffset",new rx(0,0)),H.setVector4("uTextureMap",rS.fromArray(void 0===d?[0,0,1,1]:d)),H.setVector4("uParams",new rS(0,C-1,0,0)),H.setTexture("uMaskTex",W),H.setVector4("uColorParams",new rS(p?1:0,+X,0,+(h&&!v))),this.maxTrailCount=a,this.pointCountPerTrail=C,this.checkVertexDistance=y>0,this.minimumVertexDistance=Math.pow(y||.001,2),this.useAttributeTrailStart=w,this.lifetime=g,x&&(this.mesh.worldMatrix=x),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(a)}var r=e.prototype;return r.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=i%n,u=(i-1)%n,l=(i-2)%n,c=this.getTrailPosition(t,u,oY);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var h=t*n+s,f=oK(c,e),m=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],p=r.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),o.setAttributeSubData("aDir",6*h,v),o.setAttributeSubData("aTime",2*h,new Float32Array([m,m]));var y=r.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(d,4),g[7]=0,g.set(x,8),g[11]=.5*p,g.set(y,12),g.set(d,16),g[19]=1,g.set(x,20),g[23]=-.5*p,o.setAttributeSubData("aColor",24*h,g),u>=0){var T=new Float32Array(oK(this.getTrailPosition(t,l,oW),c,e)),E=(t*n+u)*6;o.setAttributeSubData("aDir",E,T),o.setAttributeSubData("aDir",E+3,T);var _=t*n*2,C=new Uint16Array([2*u+_,2*u+1+_,2*s+_,2*s+_,2*u+1+_,2*s+1+_]),S=(t*a+(i-1)%a)*6;o.setIndexSubData(S,C)}i=++this.trailCursors[t];var R=this.mesh.material,A=R.getVector4("uParams"),b=d[2];if(this.useAttributeTrailStart){for(var O=2*n,w=new Float32Array(O),L=0;L<O;L++)w[L]=b;o.setAttributeSubData("aTrailStart",t*w.length,w)}else{var I=R.getFloats("uTrailStart");void 0!=I&&(I[t]=b,R.setFloats("uTrailStart",I))}A&&(A.y=Math.max(A.y,i-1)-Math.max(0,i-n),R.setVector4("uParams",A))}},r.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=(t*i+e)*24+8,o=this.geometry.getAttributeData("aColor");return r.x=o[n],r.y=o[1+n],r.z=o[2+n],r}},r.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},r.minusTime=function(t){for(var e=this.geometry.getAttributeData("aTime"),r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},r.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,r=this.geometry.getIndexData();r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),this.trailCursors[t]=0}},r.getPointStartPos=function(t){return this.pointStart[t]},r.setPointStartPos=function(t,e){this.pointStart[t]=e},r.onUpdate=function(t){},rG(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}(),oZ=new rT,oq=new rT,oQ=new rT;function oK(t,e,r){return t||r?(t?r?(oq.subtractVectors(e,t).normalize(),oq.subtractVectors(r,e),oQ.copyFrom(oq).normalize(),oZ.addVectors(oq,oQ)):oZ.subtractVectors(e,t):oZ.subtractVectors(r,e),oZ.normalize().toArray()):[0,0,0]}var oJ=function(e){function r(){return e.apply(this,arguments)}return rH(r,e),r.precompile=function(e,r,i){var n=e[0],o={rotationOverLifetime:{x:!1,y:!1,z:!1},positionOverLifetime:{speedOverLifetime:!1,linearX:!1,linearY:!1,linearZ:!1,orbitalX:!1,orbitalY:!1,orbitalZ:!1,forceCurve:!1},colorOverLifetime:{opacity:!1,color:!1},sizeOverLifetime:{x:!1,y:!1}},a={colorOverLifetime:{opacity:1,color:[tK.RGBA_COLOR,[255,255,255,255]]},positionOverLifetime:{speedOverLifetime:1},sizeOverLifetime:{x:1,y:1}},s=r.engine.gpuCapability,u=s.level,l=(null!=i?i:{}).env,c=r.getShaderLibrary(),h=[],f=[],m=[],d=0,p=0;return n.items.forEach(function(e){t.Item.isParticle(e)&&(f.push(e),function(e){if(t.Item.isParticle(e)){var r=e.content;r.rotationOverLifetime||(r.rotationOverLifetime={});var i=r.rotationOverLifetime;i.z||(i.z=[tK.CONSTANT,0]),i.separateAxes||(delete i.y,delete i.x),r.sizeOverLifetime||(r.sizeOverLifetime={});var n=r.sizeOverLifetime;n.separateAxes||delete n.y,n.size&&(n.x=n.size,delete n.size),n.x||(n.x=[tK.CONSTANT,1])}}(e),2===u&&Object.keys(o).forEach(function(t){var r=o[t],i=e.content[t];i&&Object.keys(r).forEach(function(e){i[e]&&(r[e]=!0,e7(h,t))})}))}),f.forEach(function(e){var r=e.content;2===u&&(h.forEach(function(t){var e=o[t],i=r[t]||(r[t]={});Object.keys(e).forEach(function(r){if(e[r]&&!i[r]){var n=a[t]&&a[t][r]||0;i[r]=isNaN(n)?n:[tK.CONSTANT,n]}})}),o.positionOverLifetime.forceCurve&&(r.positionOverLifetime.forceTarget=!0),(o.rotationOverLifetime.x||o.rotationOverLifetime.y)&&(r.rotationOverLifetime.separateAxes=!0),o.sizeOverLifetime.y&&(r.sizeOverLifetime.separateAxes=!0));var i=oX(e,l,s),n=i.shader,f=i.fragment,v=i.vertex;if(m.push(n),d=Math.max(d,f),p=Math.max(p,v),e.content.trails){var y,g,x,T,E,_,C,S,R,A,b=(y=e.content.trails,g=e.content.options.maxCount,x=e.name,void 0===(T=l)&&(T=""),E=0,_=ok[oD]?1:0,C=[["ENABLE_VERTEX_TEXTURE",s.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",_],["ENV_EDITOR",T===oo]],S=n2(),y.colorOverLifetime&&(C.push(["COLOR_OVER_LIFETIME",!0]),E|=1),y.colorOverTrail&&(C.push(["COLOR_OVER_TRAIL",!0]),E|=4),g>64&&(C.push(["ATTR_TRAIL_START",1]),E|=8),n1(S,y.opacityOverLifetime),n1(S,y.widthOverTrail),C.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),{vertex:i5,fragment:i3,marcos:C,shared:!0,name:"trail#"+x,cacheId:"-t:+"+E+"+"+S.index+"+"+S.max});b.vertex=r9(null!=(R=b.marcos)?R:[],b.vertex,t.ShaderType.vertex,u),b.fragment=r9(null!=(A=b.marcos)?A:[],b.fragment,t.ShaderType.fragment,u),b.glslVersion=2===u?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,c.addShader(b)}}),m.forEach(function(e){var r,i;2===u?(oH(e,p,d),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,e.vertex=r9(null!=(r=e.marcos)?r:[],e.vertex,t.ShaderType.vertex,u),e.fragment=r9(null!=(i=e.marcos)?i:[],e.fragment,t.ShaderType.fragment,u),c.addShader(e)}),2===u&&f.forEach(function(t){t.content.options.meshSlots=[p,d]}),Promise.resolve()},r}(nC),o$=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}return t.prototype.generate=function(t){var e=o0(this.arc,this.arcMode,t)*rd,r=new rT(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),i=Math.tan(this.angle*rd),n=r.clone().multiply(i);return n.z+=1,{position:r.multiply(rz(0,1)),direction:n.normalize()}},t}();function o0(t,e,r){if(e===t2.RANDOM)t=rz(0,t);else if(e===t2.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===t2.BIDIRECTIONAL_CYCLE){var n=r.index/(r.total+1),o=n-Math.floor(n);t*=Math.floor(n)%2?1-o:o}else e===t2.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var o1=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}return t.prototype.generate=function(t){var e=o0(this.arc,this.arcMode,t)*rd,r=new rT(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),o2=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=rz(-this._d,this._d),r=rz(-this._h,this._h);return{direction:new rT(0,0,1),position:new rT(e,r,0)}},t}(),o3=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=o0(this.arc,this.arcMode,t)*rd,r=new rT(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(e),s=new rT;return e<o?s.set(i,i*a,0):e>=o&&e<Math.PI-o?s.set(n/a,n,0):e<Math.PI+o?s.set(-i,-i*a,0):e<2*Math.PI-o?s.set(-n/a,-n,0):s.set(i,i*a,0),{direction:r,position:s}},t}(),o4=function(){function t(t){this._d=(t.width||1)/2,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===t2.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):rz(0,1);return{direction:new rT(0,1,0),position:new rT(this._d*(e-.5),0,0)}},t}(),o5=new r_,o6=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}return t.prototype.generate=function(t){var e=this.donutRadius,r=this.radius-e,i=rz(0,2*Math.PI),n=o0(this.arc,this.arcMode,t)*rd,o=o5.setFromRotationZ(n),a=new rT(Math.cos(i),Math.sin(i),0),s=new rT(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),o8=new r_,o9=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}var e=t.prototype;return e.getHorizontalAngle=function(){return rz(-90,90)},e.generate=function(t){var e=o0(this.arc,this.arcMode,t)*rd,r=this.getHorizontalAngle()*rd,i=this.radius,n=new rT(Math.cos(r),0,Math.sin(r)),o=o8.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(i),direction:o}},t}(),o7=function(t){function e(){return t.apply(this,arguments)}return rH(e,t),e.prototype.getHorizontalAngle=function(){return rz(0,90)},e}(o9),at=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=rg(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=Math.floor(o0(e.length/2-1,this.arcMode,t)),i=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,o=new rT(i,n,0);return{position:new rT(i*this.width,n*this.height,0),direction:o.normalize()}},t}(),ae=function(){function t(){}return t.prototype.generate=function(){return{position:new rT,direction:new rT}},t}(),ar=((eh={})[tB.NONE]=ae,eh[tB.CONE]=o$,eh[tB.SPHERE]=o9,eh[tB.HEMISPHERE]=o7,eh[tB.CIRCLE]=o1,eh[tB.DONUT]=o6,eh[tB.RECTANGLE]=o2,eh[tB.EDGE]=o4,eh[tB.RECTANGLE_EDGE]=o3,eh[tB.TEXTURE]=at,eh);function ai(t){if(!t)return new ae;var e=ir({radius:1,arc:360,angle:0,arcMode:t2.RANDOM},t),r=t.type,i=ar[r];if(!i)throw Error("invalid shape:"+r);var n=new i(e);if(r!==tB.NONE){var o=t.alignSpeedDirection,a=t.upDirection;n.alignSpeedDirection=o,n.upDirection=rT.fromArray(void 0===a?[0,0,1]:a).normalize()}return n}function an(t,e,r,i,n){var o,a;if(n===function(t,e,r,i){for(var n=0,o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,r,i)>0)for(o=e;o<r;o+=i)a=av(o,t[o],t[o+1],a);else for(o=r-i;o>=e;o-=i)a=av(o,t[o],t[o+1],a);return a&&ac(a,a.next)&&(ay(a),a=a.next),a}function ao(t,e){if(!t)return t;e||(e=t);var r,i=t;do if(r=!1,!i.steiner&&(ac(i,i.next)||0===al(i.prev,i,i.next))){if(ay(i),(i=e=i.prev)===i.next)break;r=!0}else i=i.next;while(r||i!==e);return e}function aa(t,e){return t.x-e.x}function as(t,e,r,i,n){return(t=((t=((t=((t=((t=32767*(t-r)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-i)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function au(t,e,r,i,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(i-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function al(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ac(t,e){return t.x===e.x&&t.y===e.y}function ah(t,e,r,i){var n=am(al(t,e,r)),o=am(al(t,e,i)),a=am(al(r,i,t)),s=am(al(r,i,e));return!!(n!==o&&a!==s||0===n&&af(t,r,e)||0===o&&af(t,i,e)||0===a&&af(r,t,i)||0===s&&af(r,e,i))}function af(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function am(t){return t>0?1:t<0?-1:0}function ad(t,e){return 0>al(t.prev,t,t.next)?al(t,e,t.next)>=0&&al(t,t.prev,e)>=0:0>al(t,e,t.prev)||0>al(t,t.next,e)}function ap(t,e){var r=new ag(t.i,t.x,t.y),i=new ag(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function av(t,e,r,i){var n=new ag(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function ay(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 ag(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ax=0;function aT(t,e,r,i){r=r||2,ax=i||0;var n,o,a,s,u,l,c,h=e&&e.length,f=h?e[0]*r:t.length,m=an(t,0,f,r,!0),d=[];if(!m||m.next===m.prev)return d;if(h&&(m=function(t,e,r,i){var n,o,a,s,u,l=[];for(n=0,o=e.length;n<o;n++)a=e[n]*i,s=n<o-1?e[n+1]*i:t.length,(u=an(t,a,s,i,!1))===u.next&&(u.steiner=!0),l.push(function(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}(u));for(l.sort(aa),n=0;n<l.length;n++)(function(t,e){if(e=function(t,e){var r,i,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 l=o.x+(s-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(l<=a&&l>u){if(u=l,l===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 c,h=n,f=n.x,m=n.y,d=1/0;o=n;do a>=o.x&&o.x>=f&&a!==o.x&&au(s<m?a:u,s,f,m,s<m?u:a,s,o.x,o.y)&&(c=Math.abs(s-o.y)/(a-o.x),ad(o,t)&&(c<d||c===d&&(o.x>n.x||o.x===n.x&&(r=n,i=o,0>al(r.prev,r,i.prev)&&0>al(i.next,r,r.next))))&&(n=o,d=c)),o=o.next;while(o!==h);return n}(t,e)){var r=ap(e,t);ao(e,e.next),ao(r,r.next)}})(l[n],r),r=ao(r,r.next);return r}(t,e,m,r)),t.length>80*r){n=a=t[0],o=s=t[1];for(var p=r;p<f;p+=r)u=t[p],l=t[p+1],u<n&&(n=u),l<o&&(o=l),u>a&&(a=u),l>s&&(s=l);c=0!==(c=Math.max(a-n,s-o))?1/c:0}return function t(e,r,i,n,o,a,s){if(e){!s&&a&&function(t,e,r,i){var n=t;do null===n.z&&(n.z=as(n.x,n.y,e,r,i)),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,r,i,n,o,a,s,u,l=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,i=r,s=0,e=0;e<l&&(s++,i=i.nextZ);e++);for(u=l;s>0||u>0&&i;)0!==s&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,u--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,l*=2}while(a>1)}(n)}(e,n,o,a);for(var u,l,c=e;e.prev!==e.next;){if(u=e.prev,l=e.next,a?function(t,e,r,i){var n=t.prev,o=t.next;if(al(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,l=n.y>t.y?n.y>o.y?n.y:o.y:t.y>o.y?t.y:o.y,c=as(a,s,e,r,i),h=as(u,l,e,r,i),f=t.prevZ,m=t.nextZ;f&&f.z>=c&&m&&m.z<=h;){if(f!==t.prev&&f!==t.next&&au(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&al(f.prev,f,f.next)>=0||(f=f.prevZ,m!==t.prev&&m!==t.next&&au(n.x,n.y,t.x,t.y,o.x,o.y,m.x,m.y)&&al(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&au(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&al(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;m&&m.z<=h;){if(m!==t.prev&&m!==t.next&&au(n.x,n.y,t.x,t.y,o.x,o.y,m.x,m.y)&&al(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}(e,n,o,a):function(t){var e=t.prev,r=t.next;if(al(e,t,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(au(e.x,e.y,t.x,t.y,r.x,r.y,i.x,i.y)&&al(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}(e)){r.push(u.i/i+ax),r.push(e.i/i+ax),r.push(l.i/i+ax),ay(e),e=l.next,c=l.next;continue}if((e=l)===c){s?1===s?t(e=function(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!ac(n,o)&&ah(n,i,i.next,o)&&ad(n,o)&&ad(o,n)&&(e.push(n.i/r+ax),e.push(i.i/r+ax),e.push(o.i/r+ax),ay(i),ay(i.next),i=t=o),i=i.next}while(i!==t);return ao(i)}(ao(e),r,i),r,i,n,o,a,2):2===s&&function(e,r,i,n,o,a){var s=e;do{for(var u,l,c=s.next.next;c!==s.prev;){if(s.i!==c.i&&(u=s,l=c,u.next.i!==l.i&&u.prev.i!==l.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&ah(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(u,l)&&(ad(u,l)&&ad(l,u)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}(u,l)&&(al(u.prev,u,l.prev)||al(u,l.prev,l))||ac(u,l)&&al(u.prev,u,u.next)>0&&al(l.prev,l,l.next)>0))){var h=ap(s,c);s=ao(s,s.next),h=ao(h,h.next),t(s,r,i,n,o,a),t(h,r,i,n,o,a);return}c=c.next}s=s.next}while(s!==e)}(e,r,i,n,o,a):t(ao(e),r,i,n,o,a,1);break}}}}(m,d,r,n,o,c),d}function aE(t,e){for(var r,i,n=t.s,o=t.p,a=n[1],s=o[1],u=0,l=0;l<a.length;l++)u+=a[l].length-1;var c,h=new Float32Array(6*u),f=e.indexBase,m=e.uvTransform,d=0,p=0,v=0,y=1,g=1;m&&(p=m[0],v=m[1],y=(c=m[4])?m[3]:m[2],g=c?m[2]:m[3]);for(var x=[0,0],T=0===c?0:-Math.PI/2,E=0;E<a.length;E++)for(var _=a[E],C=s[E],S=s[E+1]||s[0],R=[0,0],A=0;A<_.length-1;A++)(function(t,e,r,i,n,o,a,s){var u=1-e,l=u*u*u,c=3*e*u*u,h=3*e*e*u,f=e*e*e;t[0]=l*r[0]+c*n+h*a+f*i[0],t[1]=l*r[1]+c*o+h*s+f*i[1]})(R,_[A],C,S,C[4],C[5],S[2],S[3]),r=R[0],i=R[1],h[d++]=r/2,h[d++]=i/2,m?(x[0]=r,x[1]=i,aC(x,x,T),h[d++]=p+(x[0]+1)/2*y,h[d++]=v+(x[1]+1)/2*g):(h[d++]=(r+1)/2,h[d++]=(i+1)/2),d+=2;var b=aT(Array.from(h),null,6,void 0===f?0:f);return{aPoint:h,index:new Uint16Array(b)}}function a_(t,e){for(var r,i=[],n=(r=[],t.gs?t.gs.forEach(function(t){r.push({p:[tK.SHAPE_POINTS,t.p],s:[tK.SHAPE_SPLITS,t.s]})}):t.g?r.push({p:[tK.SHAPE_POINTS,t.g.p],s:[tK.SHAPE_SPLITS,t.g.s]}):r.push(t),r),o=0,a=0,s=0,u=0;u<n.length;u++){var l=aE(n[u],{indexBase:o,uvTransform:e});o+=l.aPoint.length/5,i.push(l),a+=l.aPoint.length,s+=l.index.length}if(1===i.length)return i[0];for(var c=new Float32Array(a),h=new Uint16Array(s),f=0,m=0,d=0;f<i[f];f++){var p=i[f];c.set(p.aPoint,m),m+=p.aPoint.length,h.set(p.index,d),d+=p.index.length}return{aPoint:c,index:h}}function aC(t,e,r){var i=Math.cos(r),n=Math.sin(r),o=e[0],a=e[1];return t[0]=i*o+n*a,t[1]=-n*o+i*a,t}var aS=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+r||1,this.count=e1(i,nD)?i:nq(i),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(this)},t}(),aR=function(t){this.content=t},aA=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 r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},e.shiftNode=function(t){var e=new aR(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(0>=this.sort(r.content,e.content)))return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e;if(!r.next)return this.insertNode(r,e),this.last=e;r=r.next}},e.pushNode=function(t){var e=new aR(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(0>=this.sort(e.content,r.content)))return this.insertNode(r,e),r===this.last&&(this.last=e),e;if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var r=this.first=e.next;r&&(r.pre=null)}else if((e=this.last)===t){var i=this.last=e.pre;i&&(i.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 r=this.first,i=0;if(r)do t.call(e||this,r.content,i++);while(r=r.next)},e.forEachReverse=function(t,e){var r=this.last,i=this.length-1;if(r)do t.call(e||this,r.content,i--);while(r=r.pre)},t}(),ab=function(t){function e(e,r,i){(n=t.call(this,e)||this).name="ParticleSystemRenderer",n.particleMesh=new oU(e,r),void 0!==i&&(n.trailMesh=new oj(e,i));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}rH(e,t);var r=e.prototype;return r.start=function(){this._priority=this.item.listIndex,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=rW(this.meshes);!(t=e()).done;)t.value.start()},r.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new rS(e,this.item.duration,0,0))},r.render=function(t){for(var e,r=rW(this.meshes);!(e=r()).done;)e.value.render(t)},r.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},r.updateTime=function(t,e){this.particleMesh.time=t,this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},r.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},r.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},r.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},r.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(r){t.push(e[r])}),this.trailMesh){var r=this.trailMesh.mesh.material.textures;Object.keys(r).forEach(function(e){t.push(r[e])})}return t},r.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},r.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},r.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},r.hasTrail=function(){return void 0!==this.trailMesh},r.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},r.addTrailPoint=function(t,e,r){var i;null==(i=this.trailMesh)||i.addPoint(t,e,r)},r.setTrailStartPosition=function(t,e){var r;null==(r=this.trailMesh)||r.setPointStartPos(t,e)},r.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(iZ);t.ParticleSystem=function(e){function r(r,i){var n;return(n=e.call(this,r)||this).destoryed=!1,n.getHitTestParams=function(e){var r=n.interaction;if(e||r)return{type:t.HitTestType.custom,collect:function(t){return n.raycast({radius:(null==r?void 0:r.radius)||.4,multiple:!!(null==r?void 0:r.multiple),removeParticle:(null==r?void 0:r.behavior)===t1.removeParticle,ray:t})}}},i&&n.fromData(i),n}rH(r,e);var i=r.prototype;return i.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),r=this.item.transform.rotation.clone(),i=this.props.emitterTransform&&this.props.emitterTransform.path;i&&(i[0]===tK.CONSTANT_VEC3?e.add(i[1]):t=nq(i)),this.basicTransform={position:e,rotation:r,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)}},i.updateEmitterTransform=function(t){var e=this.transform.parentTransform,r=this.basicTransform,i=r.path,n=r.position.clone();if(i){var o=this.item.duration;n.add(i.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)}},i.addParticle=function(t,e){var r,i=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(i.length<e)r=n[1]=i.length;else{var o=i.first;i.removeNode(o),r=n[1]=o.content[1]}i.pushNode(n),this.renderer.setParticlePoint(r,t),this.clearPointTrail(r),this.transform.parentTransform&&this.renderer.setTrailStartPosition(r,this.transform.parentTransform.position.clone())},i.setVisible=function(t){this.renderer.setVisible(t)},i.setOpacity=function(t){var e,r=this.renderer.particleMesh.mesh.material,i=this.renderer.particleMesh.mesh.geometry,n=(null==(e=r.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new rS(n[0],n[1],n[2],t));for(var o=i.getAttributeData("aColor")||[],a=0;a<o.length;a+=32)o[8*a+7]=t},i.setColor=function(t,e,r,i){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 rS(s[0],s[1],s[2],i));for(var u=a.getAttributeData("aColor")||[],l=0;l<u.length;l+=32)u[8*l+4]=t,u[8*l+5]=e,u[8*l+6]=r,u[8*l+7]=i},i.setParentTransform=function(t){},i.getTextures=function(){return this.renderer.getTextures()},i.start=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.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 aA(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1},i.onUpdate=function(t){var e=this;if(this.started&&!this.frozen){var r=this.lastUpdate+t/1e3,i=this.options,n=this.loopStartTime,o=this.emission;this.lastUpdate=r,this.upDirectionWorld=null,this.renderer.updateTime(r,t);var a=this.particleLink,s=(r-n)/this.item.duration,u=this.timePassed,l=!1,c=function(){e.trails&&!l&&(l=!0,a.forEach(function(t){var r=t[0],i=t[1],n=t[2],o=t[3];r<u?e.clearPointTrail(i):u>n&&e.updatePointTrail(i,s,o,n)}))};if(this.ended){if(this.item.endBehavior!==t$.loop&&0===this.item.endBehavior){var h=a.last;h&&h.content[0]<this.lastUpdate&&(this.destoryed=!0)}}else{var f=this.item.duration,m=this.lifetime;if(u<f){var d=1/o.rateOverTime.getValue(m),p=Math.floor((u-this.lastEmitTime)/d),v=d/p,y=i.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<p&&x<y&&!g();x++){var T=this.createPoint(m);T.delay+=r+x*v,this.addParticle(T,y),this.lastEmitTime=u}for(var E=o.bursts,_=(null==E?void 0:E.length)-1,C=0;_>=0&&C<y&&!g();_--){var S=E[_],R=!S.disabled&&S.getGeneratorOptions(u,m);if(R){var A=[0,0,0],b=o.burstOffsets[_],O=b&&b[R.cycleIndex]||A;S.once&&this.removeBurst(_);for(var w=0;w<R.count&&C<y&&!g();w++){var L,I=this.initPoint(this.shape.generate({total:R.total,index:R.index,burstIndex:w,burstCount:R.count}));I.delay+=r,C++,(L=I.transform).translate.apply(L,[].concat(O)),this.addParticle(I,y)}}}}else this.item.endBehavior===t$.loop?(c(),this.loopStartTime=r-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.onIterate(this)):(this.ended=!0,this.onEnd(this),4===this.item.endBehavior&&(this.frozen=!0))}c()}},i.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}})}))},i.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,r=[],i=this.particleCount,n=0;if(!(t&&e))return r;for(var o=t.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var l=this.getPointPosition(u);r.push({center:l,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>i&&(a=!0)}return r},i.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],o=new rT,a=!1;if(i&&i.content)do{var s=i.content,u=s[0],l=s[1];s[2];var c=s[3];if(u>this.timePassed){var h=this.getPointPosition(c),f=t.ray,m=!1;f&&(m=!!f.intersectSphere({center:h,radius:t.radius},o)),m&&(t.removeParticle&&(r.removeParticlePoint(l),this.clearPointTrail(l),e.removeNode(i),i.content=[0]),n.push(h),t.multiple||(a=!0))}else break}while((i=i.pre)&&!a);return n}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.updatePointTrail=function(t,e,r,i){var n=this.renderer;if(n.hasTrail()){var o=this.trails,a=this.getPointPosition(r),s=o.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=r.transform.getWorldScale().toArray(),l=1,c=o.lifetime.getValue(e);if(o.sizeAffectsWidth&&(l*=u[0]),o.sizeAffectsLifetime&&(c*=u[0]),o.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var h=n.getTrailStartPosition(t);h&&a.subtract(h)}n.addTrailPoint(t,a,{color:s,lifetime:c,size:l,time:i})}},i.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,o=t.gravity,a=this.options.forceTarget,s=this.lastUpdate-n,u=new rT,l=rT.fromArray(void 0===o?[]:o);e.assignWorldTRS(u);var c=nO(new rT,this.options,l,s,i,u,r);if(a){var h=a.target||[0,0,0],f=a.curve.getValue(s/i),m=1-f;c.x=c.x*m+h[0]*f,c.y=c.y*m+h[1]*f,c.z=c.z*m+h[2]*f}return c},i.onEnd=function(t){},i.onIterate=function(t){},i.initPoint=function(t){var e,r,i,n,o=this.options,a=this.lifetime,s=this.shape,u=o.startSpeed.getValue(a),l=o.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),c=new n5({position:l.transformPoint(t.position,new rT),valid:!0}),h=t.direction;if(h=l.transformNormal(h,aO).normalize(),o.startTurbulence&&o.turbulence){for(var f=0;f<3;f++)aP.setElement(f,o.turbulence[f].getValue(a));aV.setFromVector3(aP.negate()),aN.setFromEuler(aV).transformNormal(h).normalize()}s.alignSpeedDirection?(aM.copyFrom(h),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=rT.Z.clone(),l.transformNormal(this.upDirectionWorld)),aI.crossVectors(aM,this.upDirectionWorld).normalize(),aI.isZero()&&aI.set(1,0,0)):(aI.set(1,0,0),aM.set(0,1,0));var m=this.textureSheetAnimation;m&&m.animate&&((n=aF)[0]=m.animationDelay.getValue(a),n[1]=m.animationDuration.getValue(a),n[2]=m.cycles.getValue(a)),o.start3DRotation?aL.set(o.startRotationX.getValue(a),o.startRotationY.getValue(a),o.startRotationZ.getValue(a)):o.startRotation?aL.set(0,0,o.startRotation.getValue(a)):aL.set(0,0,0),c.setRotation(aL.x,aL.y,aL.z);var d=o.startColor.getValue(a);if(3===d.length&&(d[3]=1),o.start3DSize)aw.x=o.startSizeX.getValue(a),aw.y=o.startSizeY.getValue(a);else{var p=o.startSize.getValue(a),v=o.sizeAspect.getValue(a);aw.x=p,aw.y=0===v?0:p/v}var y=h.clone();if(y.multiply(u),!o.particleFollowParent){var g=new rT;this.transform.assignWorldTRS(void 0,void 0,g),aw.x*=g.x,aw.y*=g.y}return c.setScale(aw.x,aw.y,1),{size:aw,vel:y,color:d,delay:o.startDelay.getValue(a),lifetime:o.startLifetime.getValue(a),uv:(r=Math.floor(Math.random()*(e=this.uvs).length),i=e[r],i),gravity:o.gravity,sprite:n,dirY:aM,dirX:aI,transform:c}},i.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&e1(e,Array)){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return -1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.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))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},i.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destoryed=!1;var r,i,n,o,a,s,u,l,c,h,f,m,d=t.options,p=t.positionOverLifetime,v=t.shape,y=p.gravityOverLifetime,g=nw(p.gravity),x=t.textureSheetAnimation,T=x?{animationDelay:nq(x.animationDelay||0),animationDuration:nq(x.animationDuration||1),cycles:nq(x.cycles||1),animate:x.animate,col:x.col,row:x.row,total:x.total||x.col*x.row}:void 0,E=!!(v&&v.turbulenceX||v.turbulenceY||v.turbulenceZ);E&&(n=[nq(null!=(o=v.turbulenceX)?o:0),nq(null!=(a=v.turbulenceY)?a:0),nq(null!=(s=v.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=ai(v),this.emission={rateOverTime:nq(t.emission.rateOverTime),burstOffsets:(r=null!=(u=t.emission.burstOffsets)?u:[],i={},Array.isArray(r)&&r.forEach(function(t){var e=e1(t,Array),r=e?t[0]:t.index,n=i[r];n||(n=i[r]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),i),bursts:(t.emission.bursts||[]).map(function(t){return new aS(t)})},this.textureSheetAnimation=T;var _=t.renderer||{},C={},S=t.rotationOverLifetime;S&&(C.asRotation=!!S.asRotation,C.z=S.z?nq(S.z):nq(0),S.separateAxes&&(C.x=S.x&&nq(S.x),C.y=S.y&&nq(S.y))),p.forceTarget&&(l={target:p.target||[0,0,0],curve:nq(p.forceCurve||[tK.LINE,[[0,0],[1,1]]])});var R={x:p.linearX&&nq(p.linearX||0),y:p.linearY&&nq(p.linearY||0),z:p.linearZ&&nq(p.linearZ||0),asMovement:p.asMovement},A={x:p.orbitalX&&nq(p.orbitalX),y:p.orbitalY&&nq(p.orbitalY),z:p.orbitalZ&&nq(p.orbitalZ),center:p.orbCenter,asRotation:p.asRotation},b=t.sizeOverLifetime||{},O=t.colorOverLifetime,w=(null==b?void 0:b.separateAxes)?{separateAxes:!0,x:nq(b.x),y:nq(b.y)}:{separateAxes:!1,x:nq(("size"in b?b.size:b.x)||1)};_.anchor=_.anchor||[0,0];var L=rx.fromArray(_.anchor);this.options={particleFollowParent:!!d.particleFollowParent,startLifetime:nq(d.startLifetime),startDelay:nq(d.startDelay||0),startSpeed:nq(p.startSpeed||0),startColor:nq(d.startColor),looping:!1,maxCount:null!=(c=d.maxCount)?c:0,gravityModifier:nq(y||0),gravity:g,start3DSize:!!d.start3DSize,startTurbulence:E,turbulence:n,speedOverLifetime:p.speedOverLifetime&&nq(p.speedOverLifetime),linearVelOverLifetime:R,orbitalVelOverLifetime:A,forceTarget:l},d.startRotationZ&&(this.options.startRotation=nq(d.startRotationZ||0)),(d.startRotationX||d.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=nq(d.startRotationX||0),this.options.startRotationY=nq(d.startRotationY||0),this.options.startRotationZ=nq(d.startRotationZ||0)),d.start3DSize?(this.options.startSizeX=nq(d.startSizeX),this.options.startSizeY=nq(d.startSizeY)):(this.options.startSize=nq(d.startSize),this.options.sizeAspect=nq(d.sizeAspect||1));var I={meshSlots:d.meshSlots,name:this.name,matrix:r_.IDENTITY,filter:t.filter,shaderCachePrefix:"",renderMode:_.renderMode||tW.BILLBOARD,side:_.side||tk.DOUBLE,gravity:g,blending:_.blending||tz.ALPHA,rotationOverLifetime:C,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:T,occlusion:!!_.occlusion,transparentOcclusion:!!_.transparentOcclusion,maxCount:d.maxCount,mask:_.mask,maskMode:null!=(h=_.maskMode)?h:tU.NONE,forceTarget:l,diffuse:_.texture,sizeOverLifetime:w,anchor:L};if(O){var M=O.color,P=O.opacity;I.colorOverLifetime={},P&&(I.colorOverLifetime.opacity=nq(O.opacity)),M&&(M[0]===tK.GRADIENT_COLOR?I.colorOverLifetime.color=O.color[1]:M[0]===tK.RGBA_COLOR?I.colorOverLifetime.color=i_.createWithData(this.engine,{data:new Uint8Array(M[1]),width:1,height:1}):e1(M,i_)&&(I.colorOverLifetime.color=M))}var V=[],F=[0,0,1,1];if(t.splits){var N=t.splits[0];F=(f=N[4])?[N[0],N[1],N[3],N[2]]:[N[0],N[1],N[2],N[3]]}if(T&&!T.animate)for(var D=f?T.row:T.col,z=f?T.col:T.row,k=T.total||D*z,U=0,B=0;B<D;B++)for(var G=0;G<z&&U<k;G++,U++)V.push([B*F[2]/D+F[0],G*F[3]/z+F[1],F[2]/D,F[3]/z]);else V.push(F);this.uvs=V,I.textureFlip=f;var X=t.trails;X&&(this.trails={lifetime:nq(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},m={name:"Trail",matrix:r_.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:d.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture,opacityOverLifetime:nq(X.opacityOverLifetime||1),widthOverTrail:nq(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion,textureMap:X.textureMap,mask:_.mask,maskMode:_.maskMode},X.colorOverLifetime&&X.colorOverLifetime[0]===tK.GRADIENT_COLOR&&(m.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===tK.GRADIENT_COLOR&&(m.colorOverTrail=X.colorOverTrail[1])),this.renderer=new ab(this.engine,I,m),this.meshes=this.renderer.meshes;var H=t.interaction;H&&(this.interaction={multiple:H.multiple,radius:H.radius,behavior:H.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this,this.renderer.item=this.item,this.item.components.push(this.renderer),this.item.rendererComponents.push(this.renderer),this.item.getComponent(oM).createTrack(oE).createClip(aD)},rG(r,[{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}}]),r}(iY),t.ParticleSystem=e3([r1(t.DataType.ParticleSystem)],t.ParticleSystem);var aO=new rT,aw=new rx,aL=new rC,aI=new rT,aM=new rT,aP=new rT,aV=new rC,aF=[0,0,0],aN=new r_,aD=function(e){function r(){return e.apply(this,arguments)}rH(r,e);var i=r.prototype;return i.onPlayablePlay=function(){this.particleSystem=this.bindingItem.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=this.bindingItem.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform())},i.processFrame=function(t){var e=this.particleSystem;e&&(this.bindingItem.parent,e.setVisible(!0),e.onUpdate(t))},r}(og),az=function(t){function e(){return t.apply(this,arguments)}return rH(e,t),e}(nC);function ak(t,e){return e&&("object"===e2(e)||"function"==typeof e)?e:oC(t)}var aU=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=t.textWidth,i=t.textOverflow,n=void 0===i?t7.display:i,o=t.textBaseline,a=void 0===o?et.top:o,s=t.textAlign,u=void 0===s?ee.left:s,l=t.text,c=t.letterSpace,h=void 0===c?0:c,f=t.autoWidth,m=t.fontSize,d=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=l.length*(m+h),this.width=void 0===r?100:r,this.height=void 0===e?100:e,this.letterSpace=h,this.overFlow=n,this.textBaseline=a,this.textAlign=u,this.lineHeight=void 0===d?m:d}var e=t.prototype;return e.getOffsetY=function(t){var e=0,r=(t.fontSize+t.outlineWidth)*t.fontScale;switch(this.textBaseline){case 0:e=r;break;case 1:e=(this.height+r)/2;break;case 2:e=this.height-r/2}return e},e.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case 0:r=t.outlineWidth*t.fontScale;break;case 1:r=(this.width*t.fontScale-e)/2;break;case 2:r=this.width*t.fontScale-e}return r},e.setSize=function(t,e){this.width=t,this.height=e},t}(),aB=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,r,i,n,o,a,s=t.textColor,u=t.fontSize,l=t.outline,c=t.shadow,h=t.fontWeight,f=t.fontStyle,m=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,this.textWeight=void 0===h?"normal":h,this.fontStyle=void 0===f?"normal":f,this.fontFamily=void 0===m?"sans-serif":m,this.fontSize=void 0===u?40:u,l&&(this.isOutlined=!0,this.outlineColor=null!=(e=l.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(r=l.outlineWidth)?r:1,this.fontOffset+=this.outlineWidth),c&&(this.hasShadow=!0,this.shadowBlur=null!=(i=c.shadowBlur)?i:2,this.shadowColor=null!=(n=c.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(o=c.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(a=c.shadowOffsetY)?a:0),this.fontStyle!==ei.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},aG=function(){function t(){}return t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var r={ascent:0,descent:0,fontSize:0},i=t._canvas,n=i.getContext("2d",{willReadFrequently:!0});n.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,a=Math.ceil(n.measureText(o).width),s=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),u=Math.ceil(t.HEIGHT_MULTIPLIER*s);s=s*t.BASELINE_MULTIPLIER|0,i.width=a,i.height=u,n.fillStyle="#f00",n.fillRect(0,0,a,u),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,s);var l=n.getImageData(0,0,a,u).data,c=l.length,h=4*a,f=0,m=0,d=!1;for(f=0;f<s;++f){for(var p=0;p<h;p+=4)if(255!==l[m+p]){d=!0;break}if(d)break;m+=h}for(r.ascent=s-f,m=c-h,d=!1,f=u;f>s;--f){for(var v=0;v<h;v+=4)if(255!==l[m+v]){d=!0;break}if(d)break;m-=h}return r.descent=f-s,r.fontSize=r.ascent+r.descent,t._fonts[e]=r,r},rG(t,null,[{key:"_canvas",get:function(){var e;return ok[oz]?(e=window._createOffscreenCanvas(10,10),t.__canvas=e):t.__canvas||((e=document.createElement("canvas")).width=e.height=10,t.__canvas=e),t.__canvas}}]),t}();aG._fonts={},aG.METRICS_STRING="|\xc9q\xc5",aG.BASELINE_SYMBOL="M",aG.BASELINE_MULTIPLIER=1.4,aG.HEIGHT_MULTIPLIER=2;var aX=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];t.QTextWrapMode=void 0,($=t.QTextWrapMode||(t.QTextWrapMode={}))[$.Default=0]="Default",$[$.Clip=1]="Clip",$[$.Ellipsis=2]="Ellipsis";var aH=function(){function t(t,e){var r,i,n,o,a,s,u,l,c,h;this.left=0,this.top=0,this.fontSize=48,this.fontFamily="Arial",this.color="black",this.letterSpacing=0,this.maxLineWidth=0,this.wrap=1,this.scaleX=1,this.scaleY=1,this.angle=0,this.active=!0,this.padding=0,this.borderColor="#ffffffff",this.borderWidth=1,this.fontProperties={ascent:0,descent:0,fontSize:0},this.fontVariant="normal",this.originX="left",this.originY="top",this.ellipsis="…",this.text=t,this.left=null!=(r=e.left)?r:0,this.top=null!=(i=e.top)?i:0,this.maxLineWidth=null!=(n=e.maxWidth)?n:0,this.letterSpacing=null!=(o=e.letterSpacing)?o:0,this.originX="left",this.originY="top",this.color=null!=(a=e.color)?a:"black",this.fontFamily=null!=(s=e.fontFamily)?s:"Arial",this.fontSize=null!=(u=e.fontSize)?u:48,this.wrap=null!=(l=e.wrap)?l:1,this.fontStyle=null!=(c=e.fontStyle)?c:"normal",this.textAlign="left",this.textBaseline="alphabetic",this.fontWeight="normal",this.angle=null!=(h=e.angle)?h:0,this.name=e.name||""}var e=t.prototype;return e.update=function(){this.updateDimension()},e.render=function(){if(void 0!==this.viewer){var t=this.viewer.renderContext;void 0!==t&&(t.save(),this.setRenderTransform(t),this.renderText(t),this.active&&this.drawBorders(t),t.restore())}},e.init=function(t){this.viewer=t,this.updateDimension()},e.getLayout=function(){var t=this.viewer.scaleX,e=this.viewer.scaleY;return{x:this.left*t,y:this.top*e,width:this.width*t,height:this.height*e}},e.updateDimension=function(){var t=this.viewer.renderContext;this.configTextStyle(t),this.configTextLayout(t);var e=this.getFontDesc();this.fontProperties=aG.measureFont(e),0===this.fontProperties.fontSize&&(this.fontProperties.fontSize=this.fontSize,this.fontProperties.ascent=this.fontSize);var r=this.createCharsFromText(t,this.text),i=0;if(r.length>0){var n=r[r.length-1];i=n.left+n.width}this.chars=r,this.maxLineWidth=i,void 0===this.height&&(this.height=this.fontProperties.fontSize),void 0===this.width&&(this.width=this.maxLineWidth)},e.configTextStyle=function(t){t.font=this.getFontDesc(),t.fillStyle=this.color},e.getFontDesc=function(){for(var t="number"==typeof this.fontSize?""+this.fontSize+"px":this.fontSize,e=this.fontFamily.split(","),r=e.length-1;r>=0;r--){var i=e[r].trim();/([\"\'])[^\'\"]+\1/.test(i)||aX.includes(i)||(i='"'+i+'"'),e[r]=i}return e.push("Arial, Helvetica, sans-serif"),this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},e.configTextLayout=function(t){t.textBaseline=this.textBaseline,t.textAlign=this.textAlign},e.setRenderTransform=function(t){t.scale(this.scaleX,this.scaleY),t.translate(this.left,this.top)},e.renderText=function(t){this.drawCharsInTextBox(t,{min:[0,0],max:[0+this.width,0+this.height]})},e.drawCharsInTextBox=function(t,e){var r=this.chars,i=0;if(r.length>0){var n=r[r.length-1];i=n.left+n.width}var o=e.max[0]-e.min[0],a=0;"left"===this.textAlign?a=0:"center"===this.textAlign?a=.5*(o-i):"right"===this.textAlign&&(a=o-i),this.addOffsetToChars(r,a);var s=this.cloneChars(this.clipCharsWithTextBox(r,e)),u=s;2===this.wrap&&0===(u=this.replaceCharWithEllipsis(t,s,e)).length&&0!==r.length&&this.addEllipsisToChars(t,u,e),this.drawCharsFromLeft(t,u)},e.addEllipsisToChars=function(t,e,r){var i=t.measureText(this.ellipsis).width;if("left"===this.textAlign)e.push({char:this.ellipsis,left:r.min[0],top:0,width:i,heigh:null!=(n=this.height)?n:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else if("right"===this.textAlign)e.push({char:this.ellipsis,left:r.max[0]-i,top:0,width:i,heigh:null!=(o=this.height)?o:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else{var n,o,a,s=(r.max[0]+r.min[0])*.5;e.push({char:this.ellipsis,left:s-.5*i,top:0,width:i,heigh:null!=(a=this.height)?a:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0})}},e.createCharsFromText=function(t,e){var r=e.split(""),i=0,n=0;"top"===this.textBaseline?n=0:"middle"===this.textBaseline?n+=.5*this.fontProperties.ascent:"alphabetic"===this.textBaseline&&(n+=this.fontProperties.ascent);for(var o=[],a=0;a<r.length;++a){var s=r[a],u=Math.floor(t.measureText(s).width),l={left:i,top:n,width:u,heigh:this.fontSize,char:s,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!1,scale:1,index:a};o.push(l),i+=u+this.letterSpacing}return o},e.addOffsetToChars=function(t,e){return t.forEach(function(t){t.left+=e}),t},e.clipCharsWithTextBox=function(t,e){for(var r=[],i=0;i<t.length;++i){var n=t[i];n.left>=e.min[0]&&n.left+n.width<e.max[0]+.5&&r.push(n)}return r},e.cloneChars=function(t){return t.map(function(t){return ir({},t)})},e.replaceCharWithEllipsis=function(t,e,r){var i=t.measureText(this.ellipsis).width;if(e.length>0){if(0!==e[0].index){var n=ir({},e[0]);n.char=this.ellipsis,n.isEllipsis=!0,n.width=i,e=this.findEllipsisPositionAndReplaceCharsFromLeft(e,n,r)}var o=e.length-1,a=this.chars.length;if(e[o].index!==a-1){var s=ir({},e[0]);s.char=this.ellipsis,s.isEllipsis=!0,s.width=i,e=this.findEllipsisPositionAndReplaceCharsFromRight(e,s,r)}}return e},e.findEllipsisPositionAndReplaceCharsFromLeft=function(t,e,r){for(var i=0,n=0;n<t.length;++n){var o=t[n],a=o.left+o.width;if(i=n,a-e.width>=r.min[0])break}var s=t[i];e.left=s.left+s.width-e.width;for(var u=0;u<i+1;++u)t.shift();return[e].concat(t)},e.findEllipsisPositionAndReplaceCharsFromRight=function(t,e,r){for(var i=t.length-1,n=i;n>=0;--n){var o=t[n].left+e.width;if(i=n,o<=r.max[0])break}e.left=t[i].left;for(var a=t.length,s=a-1;s>=i;--s)t.pop();return t.concat([e])},e.drawCharsFromLeft=function(t,e){var r=t.textAlign||"left";t.textAlign="left";for(var i=0;i<e.length;++i){var n=e[i];t.fillText(n.char,n.left,n.top)}t.textAlign=r},e.drawBorders=function(t){this.padding;var e=this.borderWidth;t.strokeStyle=this.borderColor,t.lineWidth=e;var r=this.width,i=this.height,n=0,o=0;"center"===this.originX?n-=this.width/2:"right"===this.originX&&(n-=this.width),"center"===this.originY?o-=this.height/2:"bottom"===this.originY&&(o-=this.height),t.strokeRect(n+e/2,o+e/2,r-e,i-e)},t}(),aY=function(){function t(t,e,r,i,n,o){var a;this.textList=[],a="string"==typeof t?document.getElementById(t):t,this.scaleX=null!=i?i:1,this.scaleY=null!=n?n:1,this.flipY=null!=o&&o,this.width=e,this.height=r,a.style.width=""+e*this.scaleX+"px",a.style.height=""+r*this.scaleY+"px",this.devicePixelRatio=1,a.width=1*e*this.scaleX,a.height=1*r*this.scaleY,a.className="lower-canvas",this.renderCanvas=a,this.renderContext=this.renderCanvas.getContext("2d"),this.renderContext.scale(1*this.scaleX,1*this.scaleY)}var e=t.prototype;return e.initDimension=function(t,e,r,i){this.width=t,this.height=e,this.scaleX=null!=r?r:1,this.scaleY=null!=i?i:1,this.renderCanvas.style.width=""+t*this.scaleX+"px",this.renderCanvas.style.height=""+e*this.scaleY+"px";var n=this.devicePixelRatio;this.renderCanvas.width=n*t*this.scaleX,this.renderCanvas.height=n*e*this.scaleY,this.flipY&&(this.renderContext.translate(0,this.height),this.renderContext.scale(1,-1)),this.renderContext.scale(n*this.scaleX,n*this.scaleY)},e.clearText=function(){this.textList=[]},e.clearCanvasWithContext=function(t){t.clearRect(0,0,this.width,this.height)},e.clearCanvas=function(){this.clearCanvasWithContext(this.renderContext)},e.addObject=function(t){t.init(this),this.textList.push(t)},e.render=function(){this.clearCanvasWithContext(this.renderContext),this.renderContext.fillStyle="rgba(255, 255, 255, 0.0039)",this.renderContext.fillRect(0,0,this.width,this.height);var t=this.background;t&&void 0!==t.width&&void 0!==t.height&&this.renderContext.drawImage(t,0,0,t.width,t.height,0,0,this.width,this.height);for(var e=0;e<this.textList.length;++e){this.renderContext.save();var r=this.textList[e];r.update(),r.render(),this.renderContext.restore()}},t}();function aW(t,e){return e=e||{},new Promise(function(r,i){var n=new XMLHttpRequest;n.responseType=(null==e?void 0:e.responseType)||"json",n.addEventListener("load",function(){return r(n.response)}),n.addEventListener("error",function(){return i(Error("load "+t+" fail"))}),n.open((null==e?void 0:e.method)||"get",t),n.send(null==e?void 0:e.data)})}function aj(t,e,r,i,n){return aZ.apply(this,arguments)}function aZ(){return(aZ=e0(function(t,e,r,i,n){var o,a,s,u,l,c,h,f,m;return e4(this,function(d){switch(d.label){case 0:if(o={},a=[],i=i||{},r=r||{},e.asImage){if(u=r[s=e.content.replace(/\$/g,"")]||e.variables[s],l=function(t){var r=(null==i?void 0:i.canvas)||document.createElement("canvas"),o=r.width=e.backgroundWidth,a=r.height=e.backgroundHeight,s=r.getContext("2d");return null==s||s.clearRect(0,0,o,a),n&&(null==s||s.translate(0,a),null==s||s.scale(1,-1)),null==s||s.drawImage(t,0,0,t.width,t.height,0,0,o,a),r},u)return[2,iu(u).then(l)];return[2,(rV(t)?iu(t):Promise.resolve(t)).then(l)]}return c=i.templateScale||1,Object.keys(e.variables).forEach(function(t){var i=e.variables[t];if(r.hasOwnProperty(t)&&(i=r[t]),/^image_/.test(t)){var n=e1(i,Array),s=n?i[0]:i;a.push((function(t,e){return r(t,function(i){return e?r(e,function(){return t}):t});function r(t,e){return/^(https?:)?\/\//.test(t)?aW(t,{responseType:"blob"}).then(aQ,e):Promise.resolve(t)}})(s,n&&i[1]).then(function(e){return o[t]=e}))}else o[t]=i}),[4,Promise.all(a)];case 1:return d.sent(),[4,iu(t)];case 2:return h=d.sent(),[4,iu("data:image/svg+xml,"+encodeURIComponent(e.content.replace(/\$([\w_]+)\$/g,function(t,e){return o[e]}).replace('width="'+e.width+'px"','width="'+e.width*c+'px"').replace('height="'+e.height+'px"','height="'+e.height*c+'px"')))];case 3:return f=d.sent(),(m=(null==i?void 0:i.canvas)||document.createElement("canvas")).width=h.width*c,m.height=h.height*c,[2,new Promise(function(t,r){var i=m.getContext("2d");i.clearRect(0,0,m.width,m.height),n&&(i.translate(0,m.height),i.scale(1,-1)),i.drawImage(h,0,0,h.width,h.height,0,0,m.width,m.height),i.drawImage(f,0,0,f.width,f.height,(e.x||0)*c,(e.y||0)*c,e.width*c/e.backgroundWidth*h.width,e.height*c/e.backgroundHeight*h.height),t(m)})]}})})).apply(this,arguments)}function aq(){return(aq=e0(function(t,e,r,i,n){return e4(this,function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,aj(t,e,r,i,n)]})})).apply(this,arguments)}function aQ(t){return new Promise(function(e,r){var i=new FileReader;i.readAsDataURL(t),i.onload=function(){e(i.result)},i.onerror=r})}var aK=["serif","sans-serif","monospace","courier"],aJ=new Map,a$=new(function(){function t(){this.elements=[]}var e=t.prototype;return e.dispose=function(){this.elements.forEach(function(t){return t.remove()}),this.elements=[]},e.getCanvas=function(){if(this.elements.length)return this.elements.shift();if(ok[oz])return window._createOffscreenCanvas(10,10);var t=document.createElement("canvas");return t.getContext("2d",{willReadFrequently:!0}),t},e.saveCanvas=function(t){t.width=t.height=1,this.elements.length<3?e7(this.elements,t):t.remove()},t}());function a0(t,e){if(null==t?void 0:null==(r=t.background)?void 0:r.name){var r,i,n,o=t.background.name;e&&e[o]?i=e[o]:(null==(n=t.background)?void 0:n.url)&&(i=t.background.url)}return i}function a1(t,e){return a2.apply(this,arguments)}function a2(){return(a2=e0(function(t,e){return e4(this,function(r){switch(r.label){case 0:if(!Array.isArray(t))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,r.sent()];case 3:return r.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function a3(t,e,r,i,n){return a4.apply(this,arguments)}function a4(){return(a4=e0(function(e,r,i,n,o){var a,s,u,l,c,h,f,m,d,p,v;return e4(this,function(y){switch(y.label){case 0:if(!r)throw Error("image not provided");if(s=a=(null==o?void 0:o.templateScale)||1,u=a,l=r,c=r.width,h=r.height,!i)return[3,5];if(c=i.width,h=i.height,(r.width!==c||r.height!==h)&&(s*=r.width/i.width,u*=r.height/i.height),!((f=a0(i,n))&&f!==r.src))return[3,4];if(!rV(f))return[3,2];return[4,iu(f)];case 1:return m=y.sent(),[3,3];case 2:m=f,y.label=3;case 3:l=m,y.label=4;case 4:if(d=i.content){var g,x,T;g=ir({},o,{scaleX:s,scaleY:u}),x=d.fonts,T=[],d.texts.forEach(function(e){var r,i=e.t,o=e.x,a=e.y,s={weight:400,family:"serif",size:48,style:ei.normal};void 0!==e.f&&(s=x[e.f]);var u=e.n;u&&n&&n.hasOwnProperty(u)&&(i=""+n[u]);var l=new aH(i,{left:o,top:a,fontSize:s.size,fontFamily:s.family,fontWeight:""+s.weight,fontStyle:"normal",name:u});if(void 0!==e.r&&(l.angle=e.r*Math.PI/180),l.active=null!=(r=null==g?void 0:g.debug)&&r,void 0!==e.w&&(l.width=e.w),void 0!==s.letterSpace&&(l.letterSpacing=s.letterSpace),e.of===t7.display?l.wrap=t.QTextWrapMode.Default:e.of===t7.clip?l.wrap=t.QTextWrapMode.Clip:e.of===t7.ellipsis&&(l.wrap=t.QTextWrapMode.Ellipsis),void 0!==e.c){var c=d.colors[e.c][1],h=1;void 0!==c[3]&&(h=c[3]/255),l.color="rgba("+c[0]+", "+c[1]+", "+c[2]+", "+h+")"}e.a===ee.left?l.textAlign="left":e.a===ee.middle?l.textAlign="center":e.a===ee.right&&(l.textAlign="right"),s.style===ei.normal?l.fontStyle="normal":s.style===ei.italic?l.fontStyle="italic":s.style===ei.oblique&&(l.fontStyle="oblique"),void 0!==s.weight&&(l.fontWeight=String(s.weight)),(null==g?void 0:g.borderColor)&&(l.borderColor=g.borderColor),(null==g?void 0:g.borderWidth)!==void 0&&(l.borderWidth=g.borderWidth),T.push(l)}),T.forEach(function(t){e.addObject(t)})}y.label=5;case 5:return e.flipY=null!=(p=null==o?void 0:o.flipY)&&p,e.initDimension(c,h,s,u),e.background=l,e.render(),(v=null==o?void 0:o.textLayouts)&&(v.length=0,e.textList.forEach(function(t){var e=t.getLayout(),r={x:e.x,y:e.y,width:e.width,height:e.height};v.push(r)})),[2]}})})).apply(this,arguments)}function a5(){return(a5=e0(function(t){var e,r,i;return e4(this,function(n){switch(n.label){case 0:if(!(t.content&&t.content.fonts))return[3,4];e=function(t){var e,i,n,o,a;return e4(this,function(s){switch(s.label){case 0:if(e=r[t].family,i=r[t].url,n=!1,aK.includes(e)?n=!0:void 0!==document.fonts&&document.fonts.forEach(function(t){t.family===e&&(n=!0)}),!(!n&&void 0!==i&&""!==i)||(o="url("+i+")",!(void 0!==document.fonts)))return[3,2];return[4,(a=new FontFace(""+e,o)).load()];case 1:s.sent(),document.fonts.add(a),s.label=2;case 2:return[2]}})},r=t.content.fonts,i=0,n.label=1;case 1:if(!(i<r.length))return[3,4];return[5,function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(e(i))];case 2:n.sent(),n.label=3;case 3:return++i,[3,1];case 4:return[2]}})})).apply(this,arguments)}function a6(t,e,r,i,n){return a8.apply(this,arguments)}function a8(){return(a8=e0(function(t,e,r,i,n){var o,a,s;return e4(this,function(u){switch(u.label){case 0:if(a=function(t,e,r){var i,n=(null==r?void 0:r.templateScale)||1,o=(null==r?void 0:r.flipY)||!1;if(null==r?void 0:r.canvas){if(!(i=aJ.get(r.canvas))){var a=new aY(r.canvas,800,800,n,n,o);aJ.set(r.canvas,a),i=a}}else i=new aY(a$.getCanvas(),800,600,n,n,o);return i}(0,0,o=ir({},i,{flipY:n})),!(void 0!==e))return[3,2];return[4,function(t){return a5.apply(this,arguments)}(e)];case 1:u.sent(),u.label=2;case 2:if(a.clearText(),"string"!=typeof t)return[3,5];return[4,iu(t)];case 3:return s=u.sent(),[4,a3(a,s,e,r,o)];case 4:case 6:return u.sent(),[2,a.renderCanvas];case 5:return[4,a3(a,t,e,r,o)];case 7:return[2]}})})).apply(this,arguments)}function a9(){return(a9=e0(function(t,e,r,i,n){return e4(this,function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,a6(t,e,r,i,n)]})})).apply(this,arguments)}function a7(t,e,r,i,n){return st.apply(this,arguments)}function st(){return(st=e0(function(t,e,r,i,n){return e4(this,function(o){return 2===e.v?[2,a6(t,e,r,{templateScale:null==i?void 0:i.templateScale,toData:!0},n)]:[2,aj(t,e,r,i,n)]})})).apply(this,arguments)}function se(){return(se=e0(function(t,e,r,i,n){return e4(this,function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,a7(t,e,r,i,n)]})})).apply(this,arguments)}t.TextComponent=function(t){function e(e,r){if((i=t.call(this,e,r)||this).isDirty=!0,i.canvas=a$.getCanvas(),a$.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),!r)return ak(i);var i,n=r.options;return i.textStyle=new aB(n),i.textLayout=new aU(n),i.text=n.text,i.updateTexture(),i}rH(e,t);var r=e.prototype;return r.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}},r.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},r.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},r.setText=function(t){this.text!==t&&(this.text=t,this.isDirty=!0)},r.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},r.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},r.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},r.setFontFamily=function(t){this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0)},r.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},r.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},r.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},r.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},r.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},r.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},r.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},r.update=function(e){t.prototype.update.call(this,e),this.updateTexture()},r.updateTexture=function(){if(this.isDirty&&this.context&&this.canvas){var t=this.context,e=this.textStyle,r=this.textLayout,i=e.fontScale,n=(r.width+e.fontOffset)*i,o=r.height*i,a=e.fontSize*i,s=r.lineHeight*i;this.char=(this.text||"").split(""),this.canvas.width=n,this.canvas.height=o,t.clearRect(0,0,n,this.canvas.height),t.fillStyle="rgba(255, 255, 255, 0.0039)",t.fillRect(0,0,n,this.canvas.height),e.fontDesc=this.getFontDesc(),t.font=e.fontDesc,e.hasShadow&&this.setupShadow(),e.isOutlined&&this.setupOutline(),t.fillStyle="rgba("+e.textColor[0]+", "+e.textColor[1]+", "+e.textColor[2]+", "+e.textColor[3]+")";for(var u=[],l=0,c=r.getOffsetY(e)+(s-a)/3,h=[],f=[],m=0;m<this.char.length;m++){var d=this.char[m],p=t.measureText(d);((l+=r.letterSpace*i)+p.width>n&&m>0||"\n"===d)&&(u.push({y:c,width:l,chars:h,charOffsetX:f}),l=0,c+=s,h=[],f=[]),"\n"!==d&&(h.push(d),f.push(l),l+=p.width)}u.push({y:c,width:l,chars:h,charOffsetX:f}),u.forEach(function(i){var n=r.getOffsetX(e,i.width);i.chars.forEach(function(r,o){e.isOutlined&&t.strokeText(r,n+i.charOffsetX[o],i.y),t.fillText(r,n+i.charOffsetX[o],i.y)})}),e.hasShadow&&(t.shadowColor="transparent");var v=t.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",i_.createWithData(this.engine,{data:new Uint8Array(v.data),width:v.width,height:v.height},{flipY:!0,magFilter:r3.LINEAR,minFilter:r3.LINEAR,wrapS:r3.CLAMP_TO_EDGE,wrapT:r3.CLAMP_TO_EDGE})),this.isDirty=!1}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.options;this.textStyle=new aB(r),this.textLayout=new aU(r),this.text=r.text,this.updateTexture()},r.getFontDesc=function(){var t=this.textStyle,e=""+(t.fontSize*t.fontScale).toString()+"px ";return aK.includes(t.fontFamily)?e+=t.fontFamily:e+='"'+t.fontFamily+'"',t.textWeight!==er.normal&&(e=t.textWeight+" "+e),t.fontStyle!==ei.normal&&(e=t.fontStyle+" "+e),e},r.setupOutline=function(){var t=this.context,e=this.textStyle;t.strokeStyle="rgba("+255*e.outlineColor[0]+", "+255*e.outlineColor[1]+", "+255*e.outlineColor[2]+", "+e.outlineColor[3]+")",t.lineWidth=2*e.outlineWidth},r.setupShadow=function(){var t=this.context,e=this.textStyle;t.shadowColor="rgba("+255*e.shadowColor[0]+", "+255*e.shadowColor[1]+", "+255*e.shadowColor[2]+", "+e.shadowColor[3]+")",t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=-e.shadowOffsetY},e}(t.SpriteComponent),t.TextComponent=e3([r1(t.DataType.TextComponent)],t.TextComponent);var sr=function(t){function e(){return t.apply(this,arguments)}return rH(e,t),e}(nC),si=1;function sn(t,e){var r=t.type,i=t.pluginName;if(!i)switch(r){case tY.null:i="cal";break;case tY.sprite:i="sprite";break;case tY.particle:i="particle";break;case tY.interact:i="interact";break;case tY.camera:i="camera";break;case tY.filter:i="filter";break;case tY.text:i="text";break;case tY.tree:i="tree";break;default:throw Error("invalid vfx item type")}return e.pluginSystem.createPluginItem(i,t,e)}t.EffectComponent=function(e){function r(t){var r;return(r=e.call(this,t)||this).worldMatrix=r_.fromIdentity(),r.triangles=[],r.destroyed=!1,r.visible=!1,r.getHitTestParams=function(t){var e=r.getBoundingBox();if(e)return{type:e.type,triangles:e.area}},r.id="Mesh"+si++,r.name="<unnamed>",r._priority=0,r}rH(r,e);var i=r.prototype;return i.setVisible=function(t){this.visible=t},i.start=function(){this.item.getHitTestParams=this.getHitTestParams},i.render=function(t){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),r.flush(),t.drawGeometry(r,e)},i.getVisible=function(){return this.visible},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},i.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.hitTestGeometry!==this.geometry&&(this.triangles=function(t){for(var e=t.getIndexData(),r=t.getAttributeData("aPos"),i=[],n=0;n<e.length;n+=3){var o=3*e[n],a=3*e[n+1],s=3*e[n+2],u={x:r[o],y:r[o+1],z:r[o+2]},l={x:r[a],y:r[a+1],z:r[a+2]},c={x:r[s],y:r[s+1],z:r[s+2]};i.push({p0:u,p1:l,p2:c})}return i}(this.geometry),this.hitTestGeometry=this.geometry);for(var r,i=[],n=rW(this.triangles);!(r=n()).done;){var o=r.value;i.push({p0:o.p0,p1:o.p1,p2:o.p2})}return i.forEach(function(t){t.p0=e.transformPoint(t.p0,new rT),t.p1=e.transformPoint(t.p1,new rT),t.p2=e.transformPoint(t.p2,new rT)}),{type:t.HitTestType.triangle,area:i}},i.fromData=function(t){e.prototype.fromData.call(this,t),this.material=this.materials[0]},i.toData=function(){this.taggedProperties.id=this.guid},i.dispose=function(t){this.destroyed||(this.destroyed=!0,e.prototype.dispose.call(this))},rG(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(iZ),e3([r0()],t.EffectComponent.prototype,"geometry",void 0),t.EffectComponent=e3([r1(t.DataType.EffectComponent)],t.EffectComponent),t.VFXItem=function(e){function r(t,r){var i;return(i=e.call(this,t)||this).children=[],i.transform=new n5,i.duration=0,i.start=0,i.ended=!1,i.delaying=!0,i.type=tY.base,i.stopped=!1,i.components=[],i.itemBehaviours=[],i.rendererComponents=[],i.visible=!0,i._contentVisible=!1,i.speed=1,i.name="VFXItem",i.transform.name=i.name,i.transform.engine=t,i.addComponent(oM),r&&i.fromData(r),i}rH(r,e);var i=r.prototype;return i.setSpeed=function(t){this.speed=t},i.getSpeed=function(){return this.speed},i.addComponent=function(t){var e=new t(this.engine);return e.item=this,this.components.push(e),e.onAttached(),e},i.getComponent=function(t){for(var e,r,i=rW(this.components);!(r=i()).done;){var n=r.value;if(e1(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,r=[],i=rW(this.components);!(e=i()).done;){var n=e.value;e1(n,t)&&r.push(n)}return r},i.setParent=function(t){t!==this&&(this.parent&&rt(this.parent.children,this),this.parent=t,t&&(r.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition)))},i.stop=function(){this.stopped=!0},i.onEnd=function(){},i.setColor=function(t,e,r,i){},i.setOpacity=function(t){},i.getVisible=function(){return this.visible},i.setVisible=function(t){this.visible!==t&&(this.visible=!!t)},i.getWorldTransform=function(t){var e=null!=t?t:new n5({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.getNodeTransform=function(t){for(var e=0;e<this.components.length;e++){var r=this.components[1];if(r.getNodeTransform)return r.getNodeTransform(t)}return this.transform},i.translate=function(t,e,r){this.transform.translate(t,e,r)},i.rotate=function(t,e,r){var i=new rC(t,e,r),n=rE.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},i.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,o=i.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition(2*t*n/a,-2*e*o/s,r)}},i.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},i.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},i.setScale=function(t,e,r){this.transform.setScale(t,e,r)},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.getCurrentPosition=function(){var t=new rT;return this.transform.assignWorldTRS(t),t},i.isEnded=function(t){return t-this.duration>.001},i.find=function(t){if(this.name===t)return this;for(var e,r=rW(this.children);!(e=r()).done;){var i=e.value;if(i.name===t)return i}for(var n,o=rW(this.children);!(n=o()).done;){var a=n.value.find(t);if(a)return a}},i.fromData=function(t){e.prototype.fromData.call(this,t);var r=t.id,i=t.name,n=t.delay,o=t.parentId,a=t.endBehavior,s=t.transform,u=t.listIndex,l=t.duration,c=void 0===l?0:l;if(this.props=t,this.type=t.type,this.id=r.toString(),this.name=i,this.start=n||this.start,s&&(s.position=new rT().copyFrom(s.position),s.rotation=new rC().copyFrom(null!=(h=s.eulerHint)?h:s.rotation),s.scale=new rT().copyFrom(s.scale),s.size&&(s.size=new rx().copyFrom(s.size)),s.anchor&&(s.anchor=new rx().copyFrom(s.anchor)),this.transform.setTransform(s)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=o,this.duration=c,this.endBehavior=a,this.lifetime=-(this.start/this.duration),this.listIndex=void 0===u?0:u,this.oldId=t.oldId,t.content||(t.content={options:{}}),this.getComponent(oM).fromData(t.content),c<=0)throw Error("Item duration can't be less than 0, see "+oa["Item duration can't be less than 0"]);if(t.components)for(var h,f,m=rW(t.components);!(f=m()).done;){var d=f.value;this.components.push(d),e1(d,iZ)?this.rendererComponents.push(d):e1(d,ij)&&this.itemBehaviours.push(d)}},i.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=t.DataType.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.taggedProperties.parentId=null==(r=this.parent)?void 0:r.guid),!this.taggedProperties.components){this.taggedProperties.components=[];for(var e,r,i,n=rW(this.components);!(i=n()).done;){var o=i.value;e1(o,t.EffectComponent)&&this.taggedProperties.components.push(o)}}this.taggedProperties.content={}},i.translateByPixel=function(t,e){if(this.composition){var r=this.composition.renderer.canvas.getBoundingClientRect(),i=r.width,n=r.height,o=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(o),s=a.x,u=a.y;this.transform.translate(2*t*s/i,-2*e*u/n,0)}},i.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=rW(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this.composition=null,this._contentVisible=!1,this.transform.setValid(!1)}},i.resetChildrenParent=function(){for(var t,e,r=rW(this.children);!(e=r()).done;){var i=e.value;this.parent&&i.setParent(this.parent)}this.parent&&rt(null==(t=this.parent)?void 0:t.children,this)},r.isComposition=function(t){return t.type===tY.composition},r.isSprite=function(t){return t.type===tY.sprite},r.isParticle=function(t){return t.type===tY.particle},r.isNull=function(t){return t.type===tY.null},r.isTree=function(t){return t.type===tY.tree},r.isCamera=function(t){return t.type===tY.camera},r.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},rG(r,[{key:"content",get:function(){return this._content}},{key:"reusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"lifetimeStarted",get:function(){return!this.delaying}}]),r}(iT),t.VFXItem=e3([r1(t.DataType.VFXItemData)],t.VFXItem),t.Item=void 0,(tt=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tt.isFilter=function(t){return t.type===tY.filter},tt.isComposition=function(t){return t.type===tY.composition},tt.isParticle=function(t){return t.type===tY.particle},tt.isNull=function(t){return t.type===tY.null};var so={},sa=[],ss={};function su(t,e,r,i){ss[t]=r,so[t]=e,i&&e7(sa,t)}var sl=function(){function e(t){var e={},r=[],i=function(t){var i=so[t];r.includes(i)||(r.push(i),e[t]=i)};sa.forEach(i),t.forEach(i),this.plugins=Object.keys(e).map(function(t){var e,r=so[t];if(!r)throw Error("plugin '"+t+"' not found."+((e=sc[t])?"\nInstall Plugin: npm i "+e+"@latest --save\nImport Plugin: import '"+e+"'":""));var i=new r;return i.name=t,i}).sort(function(t,e){return t.order-e.order})}var r=e.prototype;return r.initializeComposition=function(t,e){this.plugins.forEach(function(r){return r.onCompositionConstructed(t,e)})},r.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},r.resetComposition=function(t,e){this.plugins.forEach(function(r){return r.onCompositionReset(t,e)})},r.createPluginItem=function(e,r,i){var n=ss[e];if(!n)throw Error("plugin "+e+" no registered constructor");var o=new n(i.getEngine(),r,i);if(o.composition=i,!e1(o,t.VFXItem))throw Error("plugin "+e+" invalid constructor type");return o},r.processRawJSON=function(t,e){var r=this;return e0(function(){return e4(this,function(i){return[2,r.callStatic("processRawJSON",t,e)]})})()},r.callStatic=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n=this;return e0(function(){var e,i,o,a,s,u;return e4(this,function(l){for(o=0,e=[],i=n.plugins;o<i.length;o++)t in(a=so[i[o].name])&&e.push(Promise.resolve(null==(u=a[t])?void 0:(s=u).call.apply(s,[].concat([a],r))));return[2,Promise.all(e)]})})()},r.precompile=function(t,e,r){var i=this;return e0(function(){return e4(this,function(n){return[2,i.callStatic("precompile",t,e,r)]})})()},r.loadResources=function(t,e){var r=this;return e0(function(){return e4(this,function(i){return[2,r.callStatic("prepareResource",t,e)]})})()},e}(),sc={"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"},sh=function(){return(sh=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};function sf(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function sm(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function sd(t,e,r){if(r||2==arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;for(var sp={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},sv=new Uint8Array(16),sy=[],sg=0;sg<256;++sg)sy.push((sg+256).toString(16).slice(1));function sx(t,e){if(!t.includes(e))return t.push(e),!0}function sT(t,e,r){if(t)for(var i in t)Object.hasOwnProperty.call(t,i)&&e.call(r,t[i],i);return t}function sE(t){if(Number.isFinite(t))return[eb.CONSTANT,t];if(t){if("lines"===t[0])return[eb.LINE,t[1]];if("curve"===t[0])return[eb.CURVE,t[1]];if("static"===t[0])return[eb.CONSTANT,t[1]]}}function s_(t,e){return Array.isArray(t)&&"random"===t[0]?[eb.CONSTANT,t[1][e]]:sE(t)}function sC(t){return t&&"color"===t[0]?sb(t[1],!0):[1,1,1,1]}function sS(t,e){if(t){if("colors"===t[0])return[eb.COLORS,t[1].map(function(t){return sb(t,e)})];if("gradient"===t[0])return sA(t[1],e);if("color"===t[0])return[eb.RGBA_COLOR,sb(t[1],e)]}}function sR(t){return t&&"random"===t[0]?[eb.RANDOM,t[1]]:sE(t)}function sA(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach(function(i){var n,o=(n=/^(-)?([\d+.]+)%$/.exec(i))?+n[2]/100*(n[1]?-1:1):+i,a=sb(t[i],e);r.push([o,a[0],a[1],a[2],a[3]])}),r=r.sort(function(t,e){return t[0]-e[0]}),[eb.GRADIENT_COLOR,r]}}function sb(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else e1(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=function(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}(r)),r}function sO(t,e){return Array.isArray(t)?("gradient"===t[0]||"color"===t[0])&&sA(t[1],e):sA(t,e)}function sw(t){if(t){if(3===t.length)return[eb.CONSTANT_VEC3,t];if("path"===t[0])return[eb.LINEAR_PATH,t[1]];if("bezier"===t[0])return[eb.BEZIER_PATH,t[1]]}}function sL(t){var e,r;try{for(var i=sf(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;t[o]=Number(t[o])}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}function sI(t){var e,r;try{for(var i=sf(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;void 0===t[o]&&delete t[o]}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}(te=em||(em={})).S="S",te.APlus="A+",te.A="A",te.BPlus="B+",te.B="B",(tr=ed||(ed={}))[tr.ALPHA=0]="ALPHA",tr[tr.ADD=1]="ADD",tr[tr.MULTIPLY=2]="MULTIPLY",tr[tr.BRIGHTNESS=3]="BRIGHTNESS",tr[tr.SUBTRACTION=4]="SUBTRACTION",tr[tr.STRONG_LIGHT=5]="STRONG_LIGHT",tr[tr.WEAK_LIGHT=6]="WEAK_LIGHT",tr[tr.SUPERPOSITION=7]="SUPERPOSITION",(ti=ep||(ep={}))[ti.DOUBLE=1032]="DOUBLE",ti[ti.FRONT=1028]="FRONT",ti[ti.BACK=1029]="BACK",(tn=ev||(ev={}))[tn.NONE=0]="NONE",tn[tn.MASK=1]="MASK",tn[tn.OBSCURED=2]="OBSCURED",tn[tn.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(to=ey||(ey={}))[to.NONE=0]="NONE",to[to.SPHERE=1]="SPHERE",to[to.CONE=2]="CONE",to[to.HEMISPHERE=3]="HEMISPHERE",to[to.CIRCLE=4]="CIRCLE",to[to.DONUT=5]="DONUT",to[to.RECTANGLE=6]="RECTANGLE",to[to.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",to[to.EDGE=8]="EDGE",to[to.TEXTURE=9]="TEXTURE",(ta=eg||(eg={}))[ta.GYROSCOPE=0]="GYROSCOPE",ta[ta.SPINE=1]="SPINE",(ts=ex||(ex={}))[ts.CLICK=0]="CLICK",ts[ts.MESSAGE=1]="MESSAGE",ts[ts.DRAG=2]="DRAG",(tu=eT||(eT={}))[tu.NONE=0]="NONE",tu[tu.NOTIFY=1]="NOTIFY",tu[tu.RESUME_PLAYER=2]="RESUME_PLAYER",tu[tu.REMOVE=3]="REMOVE",tu[tu.PAUSE=4]="PAUSE",(tl=eE||(eE={})).base="0",tl.sprite="1",tl.particle="2",tl.null="3",tl.interact="4",tl.plugin="5",tl.camera="6",tl.composition="7",tl.filter="8",tl.spine="spine",tl.mesh="mesh",tl.tree="tree",tl.text="text",tl.light="light",tl.skybox="skybox",tl.effect="effect",(tc=e_||(e_={}))[tc.BILLBOARD=0]="BILLBOARD",tc[tc.MESH=1]="MESH",tc[tc.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",tc[tc.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(th=eC||(eC={}))[th.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",th[th.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",th[th.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",th[th.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",th[th.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",th[th.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",th[th.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",th[th.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",th[th.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(tf=eS||(eS={}))[tf.portrait=1]="portrait",tf[tf.landscape=0]="landscape",(tm=eR||(eR={}))[tm.destroy=0]="destroy",tm[tm.pause=1]="pause",tm[tm.restart=5]="restart",tm[tm.forward=2]="forward",tm[tm.pause_destroy=3]="pause_destroy",tm[tm.freeze=4]="freeze",(td=eA||(eA={})).video="video",td.image="image",(tp=eb||(eb={}))[tp.CONSTANT=0]="CONSTANT",tp[tp.CONSTANT_VEC2=1]="CONSTANT_VEC2",tp[tp.CONSTANT_VEC3=2]="CONSTANT_VEC3",tp[tp.CONSTANT_VEC4=3]="CONSTANT_VEC4",tp[tp.RANDOM=4]="RANDOM",tp[tp.LINE=5]="LINE",tp[tp.CURVE=6]="CURVE",tp[tp.BEZIER_PATH=7]="BEZIER_PATH",tp[tp.RGBA_COLOR=8]="RGBA_COLOR",tp[tp.GRADIENT_COLOR=9]="GRADIENT_COLOR",tp[tp.SHAPE_POINTS=10]="SHAPE_POINTS",tp[tp.SHAPE_SPLITS=11]="SHAPE_SPLITS",tp[tp.LINEAR_PATH=12]="LINEAR_PATH",tp[tp.COLORS=13]="COLORS",tp[tp.BINARY=20]="BINARY",tp[tp.BEZIER_CURVE=21]="BEZIER_CURVE",tp[tp.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",(tv=eO||(eO={}))[tv.AUTO=0]="AUTO",tv[tv.EASE=1]="EASE",tv[tv.EASE_IN=2]="EASE_IN",tv[tv.EASE_OUT=3]="EASE_OUT",tv[tv.LINE=4]="LINE",tv[tv.HOLD=5]="HOLD",tv[tv.LINE_OUT=6]="LINE_OUT",(ty=ew||(ew={}))[ty.destroy=0]="destroy",ty[ty.loop=5]="loop",ty[ty.freeze=4]="freeze",(tg=eL||(eL={}))[tg.destroyChildren=6]="destroyChildren",(tx=eI||(eI={}))[tx.none=0]="none",tx[tx.removeParticle=1]="removeParticle",(tT=eM||(eM={}))[tT.RANDOM=0]="RANDOM",tT[tT.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",tT[tT.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",tT[tT.UNIFORM_BURST=3]="UNIFORM_BURST",(tE=eP||(eP={})).point="point",tE.spot="spot",tE.directional="directional",tE.ambient="ambient",(t_=eV||(eV={}))[t_.box=2]="box",t_[t_.sphere=3]="sphere",(tC=eF||(eF={})).orthographic="orthographic",tC.perspective="perspective",(tS=eN||(eN={})).unlit="unlit",tS.pbr="pbr",tS.hair="hair",(tR=eD||(eD={}))[tR.opaque=100]="opaque",tR[tR.masked=101]="masked",tR[tR.translucent=102]="translucent",tR[tR.additive=103]="additive",(tA=ez||(ez={})).none="none",tA.uv="uv",tA.normal="normal",tA.basecolor="basecolor",tA.alpha="alpha",tA.metallic="metallic",tA.roughness="roughness",tA.ao="ao",tA.emissive="emissive",(tb=ek||(ek={}))[tb.display=0]="display",tb[tb.clip=1]="clip",tb[tb.ellipsis=2]="ellipsis",(tO=eU||(eU={}))[tO.top=0]="top",tO[tO.middle=1]="middle",tO[tO.bottom=2]="bottom",(tw=eB||(eB={}))[tw.left=0]="left",tw[tw.middle=1]="middle",tw[tw.right=2]="right",(tL=eG||(eG={})).normal="normal",tL.bold="bold",tL.lighter="lighter",(tI=eX||(eX={})).normal="normal",tI.italic="italic",tI.oblique="oblique",(tM=eH||(eH={})).VFXItemData="VFXItemData",tM.EffectComponent="EffectComponent",tM.Material="Material",tM.Shader="Shader",tM.SpriteComponent="SpriteComponent",tM.ParticleSystem="ParticleSystem",tM.InteractComponent="InteractComponent",tM.CameraController="CameraController",tM.Geometry="Geometry",tM.Texture="Texture",tM.TextComponent="TextComponent",tM.MeshComponent="MeshComponent",tM.SkyboxComponent="SkyboxComponent",tM.LightComponent="LightComponent",tM.CameraComponent="CameraComponent",tM.ModelPluginComponent="ModelPluginComponent",tM.TreeComponent="TreeComponent",(tP=eY||(eY={}))[tP.POINTS=0]="POINTS",tP[tP.LINES=1]="LINES",tP[tP.LINE_LOOP=2]="LINE_LOOP",tP[tP.LINE_STRIP=3]="LINE_STRIP",tP[tP.TRIANGLES=4]="TRIANGLES",tP[tP.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",tP[tP.TRIANGLE_FAN=6]="TRIANGLE_FAN";var sM=Math.cos,sP=Math.sin,sV=Math.PI/180,sF=180/Math.PI;function sN(){return(function(t,e,r){if(sp.randomUUID&&!t)return sp.randomUUID();var i,n=(t=t||{}).random||(t.rng||function(){if(!ef&&!(ef="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 ef(sv)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===i&&(i=0),sy[n[i+0]]+sy[n[i+1]]+sy[n[i+2]]+sy[n[i+3]]+"-"+sy[n[i+4]]+sy[n[i+5]]+"-"+sy[n[i+6]]+sy[n[i+7]]+"-"+sy[n[i+8]]+sy[n[i+9]]+"-"+sy[n[i+10]]+sy[n[i+11]]+sy[n[i+12]]+sy[n[i+13]]+sy[n[i+14]]+sy[n[i+15]]})().replace(/-/g,"")}function sD(t,e){return t?[t[0]-.5,.5-t[1]]:e?sz[e]:[0,0]}var sz=((eW={})[eC.PARTICLE_ORIGIN_CENTER]=[0,0],eW[eC.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eW[eC.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eW[eC.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eW[eC.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eW[eC.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eW[eC.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eW[eC.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eW[eC.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eW);function sk(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:sw(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:sE(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:sE(n.linearX),linearY:sE(n.linearY),linearZ:sE(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:sE(n.orbitalX),orbitalY:sE(n.orbitalY),orbitalZ:sE(n.orbitalZ),speedOverLifetime:sE(n.speedOverLifetime)};sI(o);var a={options:{startColor:sC(i.startColor)},positionOverLifetime:o};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var s=t.rotationOverLifetime;if(s){var u=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=sE(s.x),u.y=sE(s.y),u.z=sE(s.z)):u.z=sE(s.angularVelocity)}var l=t.colorOverLifetime;if(l){var c=a.colorOverLifetime={opacity:sE(l.opacity)};l.color&&(c.color=sO(l.color))}var h=t.sizeOverLifetime;return h&&(a.sizeOverLifetime={separateAxes:h.separateAxes,size:sE(h.size),x:sE(h.x),y:sE(h.y),z:sE(h.z)}),a}function sU(t,e){var r=sk(t,e),i=t.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=t.renderer,t.splits&&(r.splits=t.splits),t.interaction&&(r.interaction=t.interaction),r}var sB=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],sG=["path","position"];function sX(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===eE.null&&t.endBehavior===ew.destroy&&(t.endBehavior=ew.freeze)})}),t.version="2.1",t}function sH(t){var e,r,i,n,o,a,s,u,l,c,h=sh(sh({},t),{items:[],components:[],materials:[],shaders:[],geometries:[]});if(null!==(i=h.textures)&&void 0!==i||(h.textures=[]),h.textures.forEach(function(t){t.id=sN(),t.dataType=eH.Texture}),h.textures.length<h.images.length)for(var f=h.textures.length;f<h.images.length;f++)h.textures.push({id:sN(),dataType:eH.Texture,source:f,flipY:!0});var m=function(t){(3===t.endBehavior||1===t.endBehavior)&&(t.endBehavior=4);var e,r,i,f,m={};try{for(var d=(e=void 0,sf(t.items)),p=d.next();!p.done;p=d.next()){var v=p.value;m[v.id]=sN(),v.oldId=v.id,v.id=m[v.id]}}catch(t){e={error:t}}finally{try{p&&!p.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}t.items.forEach(function(e,r){if(e.parentId){if(e.parentId.includes("^")){var i=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=m[i]+"^"+n}else e.parentId=m[e.parentId]}h.items.push(e),t.items[r]={id:e.id}});try{for(var y=(i=void 0,sf(h.items)),g=y.next();!g.done;g=y.next()){var v=g.value;if(v.content){if(v.content.renderer&&void 0!==v.content.renderer.texture){var x=v.content.renderer.texture;v.content.renderer.texture={id:h.textures[x].id}}if(v.content.trails&&void 0!==v.content.trails.texture){var x=v.content.trails.texture;v.content.trails.texture={id:h.textures[x].id}}}if(v.transform){var T=sd([],sm(null!==(n=v.transform.position)&&void 0!==n?n:[0,0,0]),!1),E=sd([],sm(null!==(o=v.transform.rotation)&&void 0!==o?o:[0,0,0]),!1),_=sd([],sm(null!==(a=v.transform.scale)&&void 0!==a?a:[1,1,1]),!1);if(Object.assign(v,{transform:{position:{x:T[0],y:T[1],z:T[2]},eulerHint:{x:E[0],y:E[1],z:E[2]},scale:{x:_[0],y:_[1],z:_[0]}}}),v.type===eE.sprite&&(v.transform.size={x:_[0],y:_[1]},v.transform.scale={x:1,y:1,z:1}),v.type===eE.sprite){var C=v.content;C.renderer||(C.renderer={});var S=C.renderer,R=sD(S.anchor,S.particleOrigin),A=v.transform.size;S.anchor||void 0===S.particleOrigin||(v.transform.position.x+=-R[0]*(null!==(s=null==A?void 0:A.x)&&void 0!==s?s:1),v.transform.position.y+=-R[1]*(null!==(u=null==A?void 0:A.y)&&void 0!==u?u:1)),v.transform.anchor={x:R[0]*(null!==(l=null==A?void 0:A.x)&&void 0!==l?l:1),y:R[1]*(null!==(c=null==A?void 0:A.y)&&void 0!==c?c:1)}}}if(v.type===eE.particle){var C=v.content;C.renderer||(C.renderer={});var S=C.renderer;C.renderer.anchor=sD(S.anchor,S.particleOrigin)}v.content.tracks=[];var b=v.content.tracks;v.type!==eE.particle&&b.push({clips:[{dataType:"TransformAnimationPlayableAsset",animationClip:{sizeOverLifetime:v.content.sizeOverLifetime,rotationOverLifetime:v.content.rotationOverLifetime,positionOverLifetime:v.content.positionOverLifetime}}]}),v.type===eE.sprite&&b.push({clips:[{dataType:"SpriteColorAnimationPlayableAsset",animationClip:{colorOverLifetime:v.content.colorOverLifetime,startColor:v.content.options.startColor}}]}),v.content.options.target&&(v.content.options.target=m[v.content.options.target]);var O=sN();switch((v.type===eE.sprite||v.type===eE.particle||v.type===eE.mesh||v.type===eE.skybox||v.type===eE.light||"camera"===v.type||v.type===eE.tree||v.type===eE.interact||v.type===eE.camera||v.type===eE.text)&&(v.components=[],h.components.push(v.content),v.content.id=O,v.content.item={id:v.id},v.dataType=eH.VFXItemData,v.components.push({id:v.content.id})),v.type){case eE.sprite:v.content.dataType=eH.SpriteComponent;break;case eE.particle:v.content.dataType=eH.ParticleSystem;break;case eE.mesh:v.content.dataType=eH.MeshComponent;break;case eE.skybox:v.content.dataType=eH.SkyboxComponent;break;case eE.light:v.content.dataType=eH.LightComponent;break;case"camera":v.content.dataType=eH.CameraComponent;break;case eE.tree:v.content.dataType=eH.TreeComponent;break;case eE.interact:v.content.dataType=eH.InteractComponent;break;case eE.camera:v.content.dataType=eH.CameraController;break;case eE.text:v.content.dataType=eH.TextComponent}}}catch(t){i={error:t}}finally{try{g&&!g.done&&(f=y.return)&&f.call(y)}finally{if(i)throw i.error}}};try{for(var d=sf(t.compositions),p=d.next();!p.done;p=d.next()){var v=p.value;m(v)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}return h.version="3.0",h}var sY=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,sW=/^(\d+)\.(\d+)$/,sj=!1;function sZ(t){if(!t||"object"!=typeof t)throw Error("expect a json object");if(!(l=null===(u=t.version)||void 0===u?void 0:u.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||t.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===eE.mesh||t.type===eE.light)&&(t.endBehavior=1===t.endBehavior?ew.destroy:t.endBehavior)})}),sY.test(t.version)){var e,r,i,n,o,a,s;return sj=(null===(c=/^(\d+)/.exec(t.version))||void 0===c?void 0:c[0])==="0",sH(sX((sq="1.0",i=t.plugins||[],(null===(e=t.bins)||void 0===e?void 0:e.length)&&(sq="1.3"),n=(t.requires||[]).slice(),o=t.images.map(function(e,r){return sQ(e,r,t.imageTags||[])}),a=t.textures||o.map(function(t,e){return{source:e,flipY:!0}}),s={plugins:i,shapes:t.shapes||[],type:"ge",version:sq,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map(function(t){return sK(t,{plugins:i,requires:n})}),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:a,bins:(t.bins||[]).slice()},t._textures&&(s._textures=t._textures),s)))}var u,l,c,h,f=null===(h=sW.exec(t.version))||void 0===h?void 0:h[1];if(f)return 3>Number(f)?sH(sX(t)):t;throw Error("invalid json version "+t.version)}var sq="1.0";function sQ(t,e,r){var i=r[e],n=t.oriY;if("string"==typeof t)return{renderLevel:i,url:t,oriY:n};if(t.template)return{url:t.url,template:t.template,webp:t.webp,renderLevel:i,oriY:n};if(t.compressed)return{url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{url:t.url,webp:t.webp,renderLevel:i,oriY:n};if(t&&t.sourceType)return t;throw Error("invalid image type")}function sK(t,e){void 0===e&&(e={});var r,i={id:t.id+"",camera:sh({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return s$(t,e)}),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var o=null===(r=t.meta)||void 0===r?void 0:r.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(i.previewSize=o),i}var sJ=[0,0,0,1];function s$(t,e){void 0===e&&(e={});var r,i,n,o,a,s,u,l,c,h,f,m=eE.base,d=t.endBehavior,p=NaN;if(t.content?(m=t.type||eE.plugin,f=t.pn,h=t.pluginName,l=t.content,u=t.content,isNaN(f)&&!h&&(h=l.options.type),t.duration&&(p=t.duration),s=t.transform||x(u.transform),m===eE.filter&&(sq<"1.1"&&(sq="1.1"),(l=sU(u,s)).filter=(r=u.filter,i={},sT(r,function(t,e){sB.includes(e)?i[e]=sE(t):sG.includes(e)?i[e]=sw(t):i[e]=t}),i))):t.particle?(m=eE.particle,s=x((u=t.particle).transform,sj,!0),l=function(t){var e,r=t.options,i=t.transform,n={type:ey.NONE};if(t.shape){var o=null===(e=t.shape.shape)||void 0===e?void 0:e.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(n=sh(sh({},t.shape),{type:ey[o]}),t.shape.upDirection){var a=sm(t.shape.upDirection,3),s=a[0],u=a[1],l=a[2];0===s&&0===u&&0===l&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=sR(r.turbulenceX),n.turbulenceY=sR(r.turbulenceY),n.turbulenceZ=sR(r.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map(function(t){return sL(t)})),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map(function(t){return sL(t)})),c.rateOverTime&&(c.rateOverTime=sR(c.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:c,options:{startLifetime:sR(r.startLifetime),start3DSize:!!r.start3DSize,startSize:sR(r.startSize),startSizeX:sR(r.startSizeX),startSizeY:sR(r.startSizeY),sizeAspect:sR(r.sizeAspect),maxCount:r.maxCount,startDelay:sR(r.startDelay),startColor:sS(r.startColor,!0),startRotationZ:sR(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(h.options.startRotationX=sR(r.startRotationX),h.options.startRotationY=sR(r.startRotationY)),t.filter){var f={};sT(t.filter,function(t,e){f[e]=Array.isArray(t)&&"string"==typeof t[0]&&(sR(t)||sw(t)||sS(t))||t}),h.filter=f}i&&i.path&&(h.emitterTransform={path:sw(i.path)});var m=t.sizeOverLifetime;m&&(m.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:sR(m.x),y:sR(m.y)}:h.sizeOverLifetime={size:sR(m.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?sE(p):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:sE(r.gravityModifier),startSpeed:sR(r.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:sR(d.linearX),linearY:sR(d.linearY),linearZ:sR(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:sR(d.orbitalX),orbitalY:sR(d.orbitalY),orbitalZ:sR(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:sE(d.forceCurve)},sI(h.positionOverLifetime);var v=t.rotationOverLifetime;v&&(h.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:sR(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(h.rotationOverLifetime.y=sE(v.y),h.rotationOverLifetime.x=sE(v.x)));var y=t.colorOverLifetime;if(y){var g=h.colorOverLifetime={opacity:sE(y.opacity)};y.color&&(g.color=sO(y.color))}var x=t.textureSheetAnimation;x&&(h.textureSheetAnimation={row:x.row,col:x.col,total:x.total,animate:x.animate,cycles:sE(x.cycles),animationDelay:s_(x.animationDelay,0),animationDuration:s_(x.animationDuration,0)});var T=t.trails;T&&(h.trails={lifetime:sR(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:sE(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&sO(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&sO(T.colorOverLifetime,!1),inheritParticleColor:T.inheritParticleColor,occlusion:T.occlusion,transparentOcclusion:T.transparentOcclusion,orderOffset:T.orderOffset,sizeAffectsLifetime:T.sizeAffectsLifetime,sizeAffectsWidth:T.sizeAffectsWidth,texture:T.texture,parentAffectsPosition:T.parentAffectsPosition,opacityOverLifetime:sR(T.opacityOverLifetime)}),h.trails&&sI(h.trails);var E=t.interaction;return E&&(h.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),h}(u)):t.sprite?(m=eE.sprite,s=x((u=t.sprite).transform,!1,!0),l=sU(u,s)):t.cal?(m=eE.null,s=x((u=t.cal).transform,!1,!0),l=sk(u,s)):t.ui?(m=eE.interact,s=x((u=t.ui).transform),l=function(t){var e,r=t.options;switch(r.type){case"click":e={type:ex.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&sC(r.previewColor),behavior:r.behavior||eT.NOTIFY};break;case"drag":e={type:ex.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:ex.MESSAGE}}return{options:e}}(u),s.scale=[u.options.width||1,u.options.height||1,1]):t.model&&(u=t.model,1===t.model.options.type&&(m=eE.camera,s=x(u.transform),l=function(t){var e,r,i=t.options,n={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},o=t.velocityOverLifetime;if(o||(null===(e=t.transform)||void 0===e?void 0:e.path)){var a={path:sw(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:sE(null==o?void 0:o.translateX),linearY:sE(null==o?void 0:o.translateY),linearZ:sE(null==o?void 0:o.translateZ)};sI(a),n.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:sE(null==s?void 0:s.rotateX),y:sE(null==s?void 0:s.rotateY),z:s.separateAxes?sE(null==s?void 0:s.rotateZ):sE(s.rotation)};sI(u),n.rotationOverLifetime=u}return n}(u))),null===(n=l.renderer)||void 0===n?void 0:n.anchor){var v=new Float32Array(l.renderer.anchor);.5==v[0]&&.5==v[1]?delete l.renderer.anchor:e.requires&&sx(e.requires,"anchor")}if(u){var y=null===(o=u.options)||void 0===o?void 0:o.looping;d=y?Array.isArray(y)?y[1]?ew.loop:ew.destroy:ew.loop:d||(null===(a=null==u?void 0:u.options)||void 0===a?void 0:a.endBehavior)||ew.destroy,u.options.renderLevel&&(c=u.options.renderLevel),isNaN(p)&&(p=u.options.duration)}var g={type:m,name:t.name,delay:t.delay,duration:p,id:t.id+"",transform:s,endBehavior:d,renderLevel:c,content:l};return h?e.plugins?(sx(e.plugins,h),g.pn=e.plugins.indexOf(h)):g.pluginName=h:Number.isInteger(f)&&(g.pn=f),t.parentId&&(g.parentId=t.parentId+""),g;function x(t,e,r){if(t){var i={},n=t.rotation;if(n&&(e?i.rotation=[-n[0],-n[1],-n[2]]:i.rotation=[n[0],n[1],n[2]],r)){var o,a,s,u,l,c,h,f,m,d,p,v,y,g,x,T,E,_,C,S,R,A,b,O,w=(o=i.rotation[0],a=i.rotation[1],s=i.rotation[2],u=sM(o*sV/2),l=sM(a*sV/2),c=sM(s*sV/2),h=sP(o*sV/2),f=sP(a*sV/2),m=sP(s*sV/2),sJ[0]=h*l*c+u*f*m,sJ[1]=u*f*c-h*l*m,sJ[2]=u*l*m+h*f*c,sJ[3]=u*l*c-h*f*m,sJ);i.rotation=(d=[],p=w[0],v=w[1],y=w[2],g=w[3],x=p+p,T=v+v,E=y+y,_=p*x,C=v*x,S=v*T,R=y*E,A=g*E,b=y*x-g*T,d[1]=Math.asin((O=-b)>1?1:O<-1?-1:O)*sF,.9999999>Math.abs(b)?(d[0]=Math.atan2(y*T+g*x,1-_-S)*sF,d[2]=Math.atan2(C+A,1-S-R)*sF):(d[0]=0,d[2]=Math.atan2(-(C-A),1-_-R)*sF),d)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}return{}}}var s0=((ej={})[tD.S]=[tD.S,tD.BPlus,tD.APlus],ej[tD.A]=[tD.A,tD.BPlus,tD.APlus],ej[tD.B]=[tD.B,tD.BPlus],ej);function s1(t,e){if(!t||!e)return!0;var r=s0[e];return!!r&&r.includes(t)}function s2(t){return rD(t)&&"jsonScene"in t}var s3=1,s4=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new ii),this.options=t,this.downloader=e,this.assets={},this.id=s3++,this.timers=[],this.updateOptions(t)}var r=e.prototype;return r.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout;this.timeout=void 0===e?10:e},r.updateSceneData=function(t){var e=this.options.variables;return!e||Object.keys(e).length<=0||t.forEach(function(t){t.items.forEach(function(t){if(t.type===tY.text){var r=e[t.name];r&&(t.content.options.text=r)}})}),t},r.loadScene=function(t,e,r){var i=this;return e0(function(){var n,o,a,s,u,l,c,h,f,m,d,p,v,y;return e4(this,function(g){return a=rV(t)?t:i.id,s=performance.now(),u=[],h=null!=(c=null==(l=null==e?void 0:e.engine.gpuCapability)?void 0:null==(n=l.detail)?void 0:n.asyncShaderCompile)&&c,m=null!=(f=null==l?void 0:l.detail.compressedTexture)?f:0,p=!1,v=new Promise(function(t,e){d=window.setTimeout(function(){p=!0,i.removeTimer(d),e("Load time out: totalTime: "+(performance.now()-s).toFixed(4)+"ms "+u.join(" ")+", url: "+a)},1e3*i.timeout),i.timers.push(d)}),y=e0(function(t,e){var r,i;return e4(this,function(n){switch(n.label){case 0:if(p)return[3,4];r=performance.now(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e()];case 2:return i=n.sent(),u.push("["+t+": "+(performance.now()-r).toFixed(2)+"]"),[2,i];case 3:throw Error("load error in "+t+", "+n.sent());case 4:throw Error("load canceled.")}})}),[2,Promise.race([v,e0(function(){var n,l,c,f,p,v,g,x,T,E,_,C,S,R,A,b,O,w,L;return e4(this,function(I){switch(I.label){case 0:if(!rD(t))return[3,1];return o=t,i.baseUrl=location.href,[3,3];case 1:return t=new URL(t,location.href).href,i.baseUrl=t,[4,y("loadJSON",function(){return i.loadJSON(t)})];case 2:o=I.sent(),I.label=3;case 3:if(!s2(o))return[3,6];if(n=ir({},o),!(i.options&&i.options.variables&&0!==Object.keys(i.options.variables).length))return[3,5];for(f=0,l=o.jsonScene.images,c=n.images;f<l.length;f++)e1(c[f],HTMLCanvasElement)&&(c[f]=l[f]);return[4,y("processImages",function(){return i.processImages(c,n.usedImages,m)})];case 4:for(p=0,n.images=I.sent();p<n.images.length;p++)n.textureOptions[p].image=n.images[p];n.jsonScene.compositions=i.updateSceneData(n.jsonScene.compositions),I.label=5;case 5:return[3,12];case 6:return[4,y("processJSON",function(){return i.processJSON(o)})];case 7:return g=(v=I.sent()).usedImages,x=v.jsonScene,T=v.pluginSystem,_=void 0===(E=x.bins)?[]:E,C=x.images,S=x.compositions,R=x.fonts,[4,Promise.all([y("processBins",function(){return i.processBins(_)}),y("processImages",function(){return i.processImages(C,g,m)}),y((h?"async":"sync")+" compile",function(){return i.precompile(S,T,e,r)})])];case 8:return b=(A=I.sent())[0],O=A[1],[4,y("processFontURL",function(){return i.processFontURL(R)})];case 9:return I.sent(),[4,y("processTextures",function(){return i.processTextures(O,b,x)})];case 10:return w=I.sent(),x.compositions=i.updateSceneData(x.compositions),n={url:t,renderLevel:i.options.renderLevel,storage:{},pluginSystem:T,jsonScene:x,usedImages:g,images:O,textureOptions:w,bins:b},[4,y("processPlugins",function(){return T.loadResources(n,i.options)})];case 11:I.sent(),I.label=12;case 12:return L=performance.now()-s,rM.info("Load asset: totalTime: "+L.toFixed(4)+"ms "+u.join(" ")+", url: "+a),window.clearTimeout(d),i.removeTimer(d),n.totalTime=L,n.startTime=s,[2,n]}})})()])]})})()},r.precompile=function(t,e,r,i){return e0(function(){var n;return e4(this,function(o){switch(o.label){case 0:if(!r||!r.getShaderLibrary())return[2];return n=null==r?void 0:r.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,r,i)];case 1:return o.sent(),[4,new Promise(function(t){n.compileAllShaders(function(){t(null)})})];case 2:return o.sent(),[2]}})})()},r.processJSON=function(t){var e=this;return e0(function(){var r,i,n,o,a,s,u,l,c;return e4(this,function(h){switch(h.label){case 0:return r=sZ(t),t.compositions.forEach(function(t,e){t.globalVolume&&(r.compositions[e].globalVolume=t.globalVolume)}),n=void 0===(i=r.plugins)?[]:i,o=r.compositions,a=r.imgUsage,s=r.images,[4,(u=new sl(n)).processRawJSON(r,e.options)];case 1:return h.sent(),l=e.options.renderLevel,c={},a?function(t,e,r,i,n){for(var o=0;o<e.length;o++){var a=r[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];s1(i[u].renderLevel,n)&&(t[u]=!0)}}}(c,o,a,s,l):null==s||s.forEach(function(t,e){c[e]=!0}),[2,{usedImages:c,jsonScene:r,pluginSystem:u}]}})})()},r.processBins=function(t){var e=this;return e0(function(){var r,i;return e4(this,function(n){return r=e.options.renderLevel,i=e.baseUrl,[2,Promise.all(t.map(function(n){if(e1(n,ArrayBuffer))return n;if(s1(n.renderLevel,r))return e.loadBins(new URL(n.url,i).href);throw Error("Invalid bins source: "+JSON.stringify(t))}))]})})()},r.processFontURL=function(t){var r=this;return e0(function(){return e4(this,function(i){return t?[2,Promise.all(t.map(e0(function(t){var i,n,o;return e4(this,function(a){switch(a.label){case 0:if(!(t.fontURL&&!e.fonts.has(t.fontFamily)))return[3,4];i=new URL(t.fontURL,r.baseUrl).href,o=new FontFace(null!=(n=t.fontFamily)?n:"","url("+i+")"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,o.load()];case 2:return a.sent(),document.fonts.add(o),e.fonts.add(t.fontFamily),[3,4];case 3:return a.sent(),rM.warn("Invalid fonts source: "+JSON.stringify(i)),[3,4];case 4:return[2]}})})))]:[2]})})()},r.processImages=function(e,r,i){var n=this;return e0(function(){var o,a,s,u;return e4(this,function(l){return a=(o=n.options).useCompressedTexture,s=o.variables,u=n.baseUrl,[2,Promise.all(e.map(e0(function(e,o){var l,c,h,f,m,d,p,v,y,g,x,T,E,_,C,S,R;return e4(this,function(A){switch(A.label){case 0:if(!r[o])return[2,void 0];if(l=e.url,c=e.webp,h=new URL(l,u).href,f=c&&new URL(c,u).href,!("template"in e))return[3,13];if(p=(d="v"in(m=e.template)&&2===m.v&&m.background)?m.background:void 0,!(d&&p))return[3,8];v=a0(m,s),y=p.type===tQ.video,g=p&&y?id:iu,A.label=1;case 1:return A.trys.push([1,6,,7]),[4,a1(v,g)];case 2:if(!e1(x=A.sent(),HTMLVideoElement))return[3,3];return[2,x];case 3:return p&&!Array.isArray(v)&&s&&(s[p.name]=v),[4,a7(x,m,s,n.options,-1===e.oriY)];case 4:case 10:return[2,A.sent()];case 5:return[3,7];case 6:throw A.sent(),Error("Failed to load. Check the template or if the URL is "+(y?"video":"image")+" type, URL: "+v+".");case 7:return[3,12];case 8:return A.trys.push([8,11,,12]),[4,ia(h,f)];case 9:return[4,a7(A.sent().image,m,s,n.options,-1===e.oriY)];case 11:throw A.sent(),Error("Failed to load. Check the template, URL: "+h+".");case 12:return[3,14];case 13:if("type"in e&&"video"===e.type)return console.warn("The video element is deprecated. Use template BackgroundType.video instead."),[2,id(e.url)];if("compressed"in e&&a&&i){if(T=e.compressed,i===ny.ASTC?E=T.astc:i===ny.PVRTC&&(E=T.pvrtc),E)return _=new URL(E,u).href,n.assets[o]={url:_,type:t.TextureSourceType.compressed},[2,n.loadBins(_)]}else if("sourceType"in e)return[2,e];else if(e1(e,HTMLImageElement)||e1(e,HTMLCanvasElement)||e1(e,HTMLVideoElement)||e1(e,i_))return[2,e];A.label=14;case 14:return[4,ia(h,f)];case 15:return S=(C=A.sent()).url,R=C.image,n.assets[o]={url:S,type:t.TextureSourceType.image},[2,R]}})})))]})})()},r.processTextures=function(e,r,i){var n=this;return e0(function(){var o;return e4(this,function(a){return[2,Promise.all((null!=(o=i.textures)?o:e.map(function(t,e){return{source:e}})).map(e0(function(o,a){var s,u,l;return e4(this,function(c){switch(c.label){case 0:if(e1(o,i_))return[2,o];if(!("mipmaps"in o))return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,iv(o,r,i.bins)];case 2:return[2,c.sent()];case 3:throw Error("load texture "+a+" fails, error message: "+c.sent());case 4:if("number"!=typeof(s=o.source))return[3,5];return u=e[s],[3,7];case 5:if("string"!=typeof s)return[3,7];return[4,iu(function(t,e,r){void 0===e&&(e="base64File"),void 0===r&&(r="");for(var i=atob(t.split(",")[1]||t),n=[],o=0;o<i.length;o+=512){for(var a=i.slice(o,o+512),s=Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);var l=new Uint8Array(s);n.push(l)}return new File([new Blob(n,{type:r})],e,{type:r})}(s))];case 6:u=c.sent(),c.label=7;case 7:if(u)return(l=function(e,r){var i;if(e1(e,i_))return e.source;if(e1(e,HTMLImageElement)||"object"==typeof e&&null!==e&&(null==(i=e.tagName)?void 0:i.toUpperCase())==="CANVAS")return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:r3.LINEAR,magFilter:r3.LINEAR};if(e1(e,HTMLVideoElement))return{sourceType:t.TextureSourceType.video,video:e,minFilter:r3.LINEAR,magFilter:r3.LINEAR};if(e1(e,ArrayBuffer))return ir({},iR(e),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:r3.CLAMP_TO_EDGE,wrapT:r3.CLAMP_TO_EDGE,minFilter:r3.NEAREST,magFilter:r3.NEAREST};throw Error("Invalid texture options")}(u,n.assets[a])).id=o.id,l.dataType=en.Texture,[2,l.sourceType===t.TextureSourceType.compressed?l:ir({},l,o)];throw Error("Invalid texture source: "+s)}})})))]})})()},r.loadJSON=function(t){var e=this;return e0(function(){return e4(this,function(r){return[2,new Promise(function(r,i){e.downloader.downloadJSON(t,r,function(e,r){i("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+r)})})]})})()},r.loadBins=function(t){var e=this;return e0(function(){return e4(this,function(r){return[2,new Promise(function(r,i){e.downloader.downloadBinary(t,r,function(e,r){i("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+r)})})]})})()},r.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},r.dispose=function(){for(var t in this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets){var e,r=this.assets[t];null==r||null==(e=r.dispose)||e.call(r)}this.assets={},this.timers=[]},e}();s4.fonts=new Set;var s5=new rT(1,1,1),s6=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=r_.fromIdentity(),this.projectionMatrix=r_.fromIdentity(),this.viewProjectionMatrix=r_.fromIdentity(),this.inverseViewMatrix=r_.fromIdentity(),this.dirty=!0;var r=e.near,i=e.far,n=e.fov,o=e.aspect,a=e.clipMode,s=void 0===a?tZ.portrait:a,u=e.position,l=e.rotation;this.options={near:void 0===r?.1:r,far:void 0===i?20:i,fov:void 0===n?60:n,aspect:void 0===o?1:o,clipMode:s,position:rT.fromArray(void 0===u?[0,0,8]:u),rotation:rC.fromArray(void 0===l?[0,0,0]:l)},this.dirty=!0,this.updateMatrix()}var e=t.prototype;return 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 rT(0,0,t),r=this.getViewProjectionMatrix(),i=this.getInverseViewProjectionMatrix(),n=r.projectPoint(e).z;return i.projectPoint(new rT(1,1,n))},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 rE;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,r=t.far,i=t.fov,n=t.clipMode,o=t.aspect,a=t.position,s=t.rotation;this.near=e,this.far=r,this.fov=i,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,r=t.aspect,i=t.near,n=t.far,o=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*rd,r,i,n,o===tZ.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),s5),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){n5.getRotation(t,this.options.rotation)},rG(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}(),s8=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.items=[],t}rH(r,e);var i=r.prototype;return i.start=function(){var t=this.item.props.startTime;this.startTime=void 0===t?0:t,this.timelineComponents=[],this.timelineComponent=this.item.getComponent(oM);for(var e,r=rW(this.items);!(e=r()).done;){var i=e.value.getComponent(oM);i&&(this.timelineComponents.push(i),(0!==this.item.endBehavior||this.timelineComponent.reusable)&&(i.reusable=!0))}},i.update=function(t){for(var e,r=this.timelineComponent.getTime(),i=rW(this.timelineComponents);!(e=i()).done;){var n=e.value,o=n.toLocalTime(r);n.setTime(o)}},i.resetStatus=function(){this.item.ended=!1,this.item.delaying=!0},i.createContent=function(){var e=this.items;if(this.items.length=0,this.item.composition){var i=this.item.engine.assetLoader;this.item.composition.compositionSourceManager.jsonScene;for(var n=this.item.props.items?this.item.props.items:[],o=0;o<n.length;o++){var a=void 0,s=n[o];if(t.Item.isComposition(s)){var u=s.content.options.refId,l=this.item.composition.refCompositionProps.get(u);if(!l)throw Error("引用的Id: "+u+" 的预合成不存在");l.content=s.content,(a=new t.VFXItem(this.engine,ir({},l,{id:s.id,name:s.name,delay:s.delay,duration:s.duration,endBehavior:s.endBehavior,parentId:s.parentId,transform:s.transform,oldId:s.oldId}))).type=tY.composition,a.composition=this.item.composition,a.addComponent(r).refId=u,a.transform.parentTransform=this.transform,this.item.composition.refContent.push(a),5===a.endBehavior&&(this.item.composition.autoRefTex=!1),a.getComponent(r).createContent()}else"ECS"===s.type||s.type===tY.sprite||s.type===tY.text||s.type===tY.particle||s.type===tY.mesh||s.type===tY.skybox||s.type===tY.light||"camera"===s.type||s.type===tY.tree||s.type===tY.interact||s.type===tY.camera?(a=i.loadGUID(s.id)).composition=this.item.composition:((a=new t.VFXItem(this.engine,s)).composition=this.item.composition,a=sn(s,this.item.composition));a.parent=this.item,a.transform.parentTransform=s.type===tY.camera?new n5:this.transform,t.VFXItem.isExtraCamera(a)&&(this.item.composition.extraCamera=a),e.push(a)}}},i.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},i.hitTest=function(e,r,i,n,o,a){for(var s,u=[],l=(null==a?void 0:a.stop)||rP,c=(null==a?void 0:a.skip)||rP,h=(null==a?void 0:a.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<h;f++){var m=(s=this,function(a){var h=s.items[a];if(h.lifetime>=0&&!h.ended&&!t.VFXItem.isComposition(h)&&!c(h)){var f=h.getHitTestParams(o);if(f){var m=!1,d=new rT;if(f.type===t.HitTestType.triangle)for(var p=f.triangles,v=f.backfaceCulling,y=0;y<p.length;y++){var g=p[y];if(e.intersectTriangle(g,d,v)){m=!0,u.push(d);break}}else if(f.type===t.HitTestType.box){var x=f.center,T=f.size,E=x.clone().addScaledVector(T,.5),_=x.clone().addScaledVector(T,-.5);e.intersectBox({min:E,max:_},d)&&(m=!0,u.push(d))}else if(f.type===t.HitTestType.sphere){var C=f.center,S=f.radius;e.intersectSphere({center:C,radius:S},d)&&(m=!0,u.push(d))}else if(f.type===t.HitTestType.custom){var R=f.collect(e,new rx(r,i));R&&R.length>0&&(R.forEach(function(t){u.push(t)}),m=!0)}if(m){var A={compContent:s.item,id:h.id,name:h.name,position:u[u.length-1],parentId:h.parentId,hitPositions:u,behavior:f.behavior};if(n.push(A),l(A))return{v:n}}}}}(f));if("object"===e2(m))return m.v}return n},r}(ij),s9=function(){function e(e,r,i){var n,o=this;this.compositionSourceManager=i,this.speed=1,this.loaderData={},this.refContent=[],this.refCompositionProps=new Map,this.assigned=!1,this.destroyed=!1,this.paused=!1,this.lastVideoUpdateTime=0,this.postLoaders=[];var a=e.reusable,s=void 0!==a&&a,u=e.speed,l=e.baseRenderOrder,c=e.renderer,h=e.onPlayerPause,f=e.onMessageItem,m=e.onEnd,d=e.event,p=e.width,v=e.height;r.jsonScene.imgUsage=void 0,s&&(this.keepResource=!0,r.textures=void 0,r.consumed=!0);var y=this.compositionSourceManager,g=y.sourceContent,x=y.pluginSystem,T=y.imgUsage,E=y.totalTime,_=y.renderLevel,C=y.refCompositionProps;rm(g),this.renderer=c,this.refCompositionProps=C;var S=new t.VFXItem(this.getEngine(),g);S.name="rootItem",S.type=tY.composition,S.composition=this,this.rootComposition=S.addComponent(s8),this.rootTimeline=S.getComponent(oM);var R=!s&&T;this.transform=new n5({name:this.name}),this.transform.engine=this.getEngine(),S.transform=this.transform,this.globalVolume=g.globalVolume,this.width=p,this.height=v,this.renderOrder=void 0===l?0:l,this.id=g.id,this.renderer=c,this.texInfo=null!=R?R:{},this.event=d,this.statistic={loadTime:null!=E?E:0,loadStart:null!=(n=r.startTime)?n:0,firstFrameTime:0},this.reusable=s,this.speed=void 0===u?1:u,this.renderLevel=_,this.autoRefTex=!this.keepResource&&R&&5!==S.endBehavior,this.rootItem=S,this.name=g.name,this.pluginSystem=x,this.pluginSystem.initializeComposition(this,r),this.camera=new s6(this.name,ir({},null==g?void 0:g.camera,{aspect:p/v})),this.url=r.url,this.assigned=!0,this.globalTime=0,this.onPlayerPause=h,this.onMessageItem=f,this.onEnd=m,this.createRenderFrame(),this.rendererOptions=null,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout(function(){null==o.onEnd||o.onEnd.call(o,o)},0)},this.pluginSystem.resetComposition(this,this.renderFrame)}var r=e.prototype;return r.getDuration=function(){return this.rootItem.duration},r.restart=function(){this.rootComposition.items,this.prepareRender(),this.reset(),this.transform.setValid(!0),this.rootComposition.resetStatus(),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.getSpeed=function(){return this.speed},r.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootTimeline.timelineStarted?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.resume(),this.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime)},r.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new nl({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.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime,!0),e&&this.pause()},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.forwardTime=function(t,e){void 0===e&&(e=!1);for(var r=1e3*t-1e3*this.rootTimeline.getTime(),i=r<0,n=Math.abs(r),o=i?-15:15;n>15;n-=15)this.update(o,e);this.update(i?-n:n,e)},r.reset=function(){var e=this,r=new t.VFXItem(this.getEngine(),this.compositionSourceManager.sourceContent);r.type=tY.composition,r.composition=this,this.rootComposition=r.addComponent(s8),this.rootTimeline=r.getComponent(oM),this.transform=new n5({name:this.name}),this.transform.engine=this.getEngine(),r.transform=this.transform,this.rootItem=r,this.rendererOptions=null,this.globalTime=0,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout(function(){null==e.onEnd||e.onEnd.call(e,e)},0)},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(r){r.prepareRenderFrame(t,e)&&t.postLoaders.push(r)});for(var r,i=rW(this.rootComposition.items);!(r=i()).done;)for(var n,o=r.value.getComponents(iZ),a=rW(o);!(n=a()).done;){var s=n.value;s.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(s)}for(var u,l=rW(this.refContent);!(u=l()).done;)for(var c,h=u.value,f=rW(h.getComponent(s8).items);!(c=f()).done;)for(var m,d=c.value.getComponents(iZ),p=rW(d);!(m=p()).done;){var v=m.value;v.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(v)}this.postLoaders.forEach(function(r){return r.postProcessFrame(t,e)})},r.shouldRestart=function(){var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&5===r},r.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},r.update=function(t,e){if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var r,i,n=this.getUpdateTime(t*this.speed);if(this.globalTime+=n,this.rootTimeline.isActiveAndEnabled){var o=this.rootTimeline.toLocalTime(this.globalTime/1e3);this.rootTimeline.setTime(o)}this.updateVideo(),this.updatePluginLoaders(t),this.callStart(this.rootItem),this.callUpdate(this.rootItem,n),this.callLateUpdate(this.rootItem,n),null==(i=this.extraCamera)||null==(r=i.getComponent(oM))||r.update(t),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},r.getUpdateTime=function(t){var e=1e3*this.startTime;this.rootItem;var r=1e3*this.rootTimeline.getTime();return t<0&&r+t<e?e-r:t},r.callStart=function(t){for(var e,r=rW(t.itemBehaviours);!(e=r()).done;){var i=e.value;i.isActiveAndEnabled&&!i.started&&(i.start(),i.started=!0)}for(var n,o=rW(t.rendererComponents);!(n=o()).done;){var a=n.value;a.isActiveAndEnabled&&!a.started&&(a.start(),a.started=!0)}for(var s,u=rW(t.children);!(s=u()).done;){var l=s.value;this.callStart(l)}},r.callUpdate=function(e,r){for(var i,n=rW(e.itemBehaviours);!(i=n()).done;){var o=i.value;o.isActiveAndEnabled&&o.started&&o.update(r)}for(var a,s=rW(e.rendererComponents);!(a=s()).done;){var u=a.value;u.isActiveAndEnabled&&u.started&&u.update(r)}for(var l,c=rW(e.children);!(l=c()).done;){var h=l.value;t.VFXItem.isComposition(h)&&h.ended&&5===h.endBehavior?(h.getComponent(s8).resetStatus(),this.callUpdate(h,0)):this.callUpdate(h,r)}},r.callLateUpdate=function(t,e){for(var r,i=rW(t.itemBehaviours);!(r=i()).done;){var n=r.value;n.isActiveAndEnabled&&n.started&&n.lateUpdate(e)}for(var o,a=rW(t.rendererComponents);!(o=a()).done;){var s=o.value;s.isActiveAndEnabled&&s.started&&s.lateUpdate(e)}for(var u,l=rW(t.children);!(u=l()).done;){var c=u.value;this.callLateUpdate(c,e)}},r.buildItemTree=function(e){if(e.composition){for(var r,i=new Map,n=e.getComponent(s8).items,o=rW(n);!(r=o()).done;){var a=r.value;i.set(a.id,a)}for(var s,u=rW(n);!(s=u()).done;){var l=s.value;if(void 0===l.parentId)l.setParent(e);else{var c=this.getParentIdWithoutSuffix(l.parentId),h=i.get(c);if(h)t.VFXItem.isTree(h)&&l.parentId.includes("^")?(l.parent=h,l.transform.parentTransform=h.getNodeTransform(l.parentId)):(l.parent=h,l.transform.parentTransform=h.transform),h.children.push(l);else throw Error("元素引用了不存在的元素,请检查数据")}}for(var f,m=rW(n);!(f=m()).done;){var d=f.value;t.VFXItem.isComposition(d)&&this.buildItemTree(d)}}},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(r){return r.onCompositionUpdate(e,t)})},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return nV((t-r.z)/i,(e-r.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,r,i){if(this.isDestroyed)return[];var n,o=[],a=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(s8))||n.hitTest(a,t,e,o,r,i),this.refContent.forEach(function(n){var s;null==(s=n.getComponent(s8))||s.hitTest(a,t,e,o,r,i)}),o},r.addInteractiveItem=function(t,e){if(e===tX.MESSAGE)return null==this.onMessageItem||this.onMessageItem.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.id},r.removeInteractiveItem=function(t,e){e===tX.MESSAGE&&(null==this.onMessageItem||this.onMessageItem.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},r.destroyTextures=function(e){for(var r=0;r<e.length;r++){var i,n=e[r];if(n){if(n.sourceType===t.TextureSourceType.data&&!this.texInfo[n.getInstanceId()]){n!==(null==(i=this.rendererOptions)?void 0:i.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==tY.composition?4!==t.endBehavior&&t.getComponent(s8).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(r){return r.onCompositionItemRemoved(e,t)})}):(rt(this.items,t),this.pluginSystem.plugins.forEach(function(r){return r.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,r,i=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=rP)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(r=this.pluginSystem)||r.destroyComposition(this),this.update=function(){rM.error("Update disposed composition: "+i.name+".")},this.onPlayerPause=rP,this.dispose=rP,o&&this.keepResource&&o.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==oo&&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,r){this.renderFrame.editorTransform.set(t,t,e,r)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Can not translate position when container not assigned");return}this.rootItem.translateByPixel(t,e)},r.translate=function(t,e,r){this.rootItem.translate(t,e,r)},r.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},r.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},r.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},r.scale=function(t,e,r){this.rootItem.scale(t,e,r)},r.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},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 e0(function(){return e4(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]}})})()},rG(e,[{key:"handleEnd",set:function(t){console.warn("The handleEnd property is deprecated. Use onEnd instead."),this.onEnd=t}},{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.rootTimeline.getTime()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(),s7=0,ut=function(){function t(t,e){this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var r=t.jsonScene,i=t.renderLevel,n=t.textureOptions,o=t.pluginSystem,a=t.totalTime,s=r.compositions,u=r.imgUsage,l=r.compositionId;if(!n)throw Error("scene.textures expected");for(var c,h=rW(s);!(c=h()).done;){var f=c.value;f.id===l?this.composition=f:this.refCompositions.set(f.id,f)}if(!this.composition)throw Error("Invalid composition id: "+l);this.jsonScene=r,this.renderLevel=i,this.pluginSystem=o,this.totalTime=null!=a?a:0,this.imgUsage=null!=u?u:{},this.textures=n,s7=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=t.id,r=t.duration,i=t.name,n=t.endBehavior,o=t.camera,a=t.globalVolume,s=t.startTime,u=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:u,camera:o,startTime:void 0===s?0:s,globalVolume:a}},e.assembleItems=function(t){var e=this,r=[];this.mask++;for(var i,n={},o=rW(this.jsonScene.components);!(i=o()).done;){var a=i.value;n[a.id]=a}for(var s,u=rW(t.items);!(s=u()).done;){var l=s.value,c=this.engine.jsonSceneData[l.id];if(s1(c.renderLevel,this.renderLevel)){if(c.type===tY.sprite||c.type===tY.particle)for(var h,f=rW(c.components);!(h=f()).done;){var m=n[h.value.id];this.preProcessItemContent(m)}else{var d=c.content;d&&this.preProcessItemContent(d)}var p=c.pn,v=this.jsonScene.plugins,y=void 0===v?[]:v;if(c.listIndex=s7++,void 0!==p&&Number.isInteger(p)&&(c.pluginName=y[p]),c.type===tY.composition){var g=c.content.options.refId;if(!this.refCompositions.get(g))throw Error("Invalid Ref Composition id: "+g);var x=this.getContent(this.refCompositions.get(g));this.refCompositionProps.has(g)||this.refCompositionProps.set(g,x),x.items.forEach(function(t){e.processMask(t.content)}),c.items=x.items}r.push(c)}}return r},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var e,r=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=a_(null==(e=this.jsonScene)?void 0:e.shapes[t.renderer.shape],r):t.renderer.shape&&rD(t.renderer.shape)&&(t.renderer.shape=a_(t.renderer.shape,r))}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,r=null!=(e=this.imgUsage)?e:{};t&&r&&(r.hasOwnProperty(t)||(r[t]=0),r[t]++)},e.processMask=function(t){if(t.maskMode!==tU.NONE&&!t.mask){var e=t.maskMode;e===tU.MASK?t.mask=++this.mask:(e===tU.OBSCURED||e===tU.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}(),ue=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new nE(this),this.createDefaultTexture()}var r=e.prototype;return r.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},r.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},r.findEffectsObjectData=function(t){return this.jsonSceneData[t]},r.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},r.getInstance=function(t){return this.objectInstance[t]},r.removeInstance=function(t){delete this.objectInstance[t]},r.addPackageDatas=function(t){var e=t.jsonScene;if(e.items)for(var r,i=rW(e.items);!(r=i()).done;){var n=r.value;this.addEffectsObjectData(n)}if(e.materials)for(var o,a=rW(e.materials);!(o=a()).done;){var s=o.value;this.addEffectsObjectData(s)}if(e.shaders)for(var u,l=rW(e.shaders);!(u=l()).done;){var c=u.value;this.addEffectsObjectData(c)}if(e.geometries)for(var h,f=rW(e.geometries);!(h=f()).done;){var m=h.value;this.addEffectsObjectData(m)}if(e.components)for(var d,p=rW(e.components);!(d=p()).done;){var v=d.value;this.addEffectsObjectData(v)}if(t.textureOptions)for(var y,g=rW(t.textureOptions);!(y=g()).done;){var x=y.value;this.addEffectsObjectData(x)}},r.createVFXItemsAsync=function(t){var e=this;return e0(function(){var r,i,n;return e4(this,function(o){switch(o.label){case 0:r=rW(t.jsonScene.items),o.label=1;case 1:if((i=r()).done)return[3,4];if(!("ECS"===(n=i.value).type||n.type===tY.sprite||n.type===tY.particle||n.type===tY.mesh||n.type===tY.skybox||n.type===tY.light||"camera"===n.type||n.type===tY.tree||n.type===tY.interact||n.type===tY.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:o.sent(),o.label=3;case 3:return[3,1];case 4:return[2]}})})()},r.addTexture=function(t){this.destroyed||e7(this.textures,t)},r.removeTexture=function(t){this.destroyed||rt(this.textures,t)},r.addMaterial=function(t){this.destroyed||e7(this.materials,t)},r.removeMaterial=function(t){this.destroyed||rt(this.materials,t)},r.addGeometry=function(t){this.destroyed||e7(this.geometries,t)},r.removeGeometry=function(t){this.destroyed||rt(this.geometries,t)},r.addMesh=function(t){this.destroyed||e7(this.meshes,t)},r.removeMesh=function(t){this.destroyed||rt(this.meshes,t)},r.addRenderPass=function(t){this.destroyed||e7(this.renderPasses,t)},r.removeRenderPass=function(t){this.destroyed||rt(this.renderPasses,t)},r.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},r.createDefaultTexture=function(){var e={type:r3.UNSIGNED_BYTE,format:r3.RGBA,internalFormat:r3.RGBA,wrapS:r3.MIRRORED_REPEAT,wrapT:r3.MIRRORED_REPEAT,minFilter:r3.NEAREST,magFilter:r3.NEAREST};this.emptyTexture=i_.create(this,ir({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},e)),this.transparentTexture=i_.create(this,ir({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},e))},r.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&&rM.warn("Release GPU memory: "+t.join(", ")),this.renderPasses.forEach(function(t){t.dispose()}),this.meshes.forEach(function(t){t.dispose()}),this.geometries.forEach(function(t){t.dispose()}),this.materials.forEach(function(t){t.dispose()}),this.textures.forEach(function(t){t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},rG(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(),ur=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this._deltaTime=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=rg(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._deltaTime=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},r=function(){t.intervalId=e(r),t.paused||t.tick()};r()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this._deltaTime=0,this.tickers=[]},e.pause=function(){this.paused=!0,this._deltaTime=0},e.resume=function(){this.paused=!1,this._deltaTime=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this._deltaTime=t-this.lastTime,this._deltaTime>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e=0,r=this.tickers.length;e<r;e++)(0,this.tickers[e])(this._deltaTime)}}},e.add=function(t){if("function"!=typeof t)throw Error("Ticker: The tick object must implement the tick method.");this.tickers.push(t)},rG(t,[{key:"deltaTime",get:function(){return this._deltaTime}}]),t}();su("camera",n6,t.VFXItem,!0),su("text",sr,t.VFXItem,!0),su("sprite",ov,t.VFXItem,!0),su("particle",oJ,t.VFXItem,!0),su("cal",az,t.VFXItem,!0),su("interact",on,t.VFXItem,!0);var ui=((eZ={})[r3.ONE]=eJ.OneFactor,eZ[r3.ZERO]=eJ.ZeroFactor,eZ[r3.SRC_COLOR]=eJ.SrcColorFactor,eZ[r3.SRC_ALPHA]=eJ.SrcAlphaFactor,eZ[r3.ONE_MINUS_SRC_COLOR]=eJ.OneMinusSrcColorFactor,eZ[r3.ONE_MINUS_SRC_ALPHA]=eJ.OneMinusSrcAlphaFactor,eZ[r3.DST_COLOR]=eJ.DstColorFactor,eZ[r3.DST_ALPHA]=eJ.DstAlphaFactor,eZ[r3.ONE_MINUS_DST_COLOR]=eJ.OneMinusDstColorFactor,eZ[r3.ONE_MINUS_DST_ALPHA]=eJ.OneMinusDstAlphaFactor,eZ),un=((eq={})[r3.NEVER]=eJ.NeverStencilFunc,eq[r3.EQUAL]=eJ.EqualStencilFunc,eq[r3.LESS]=eJ.LessStencilFunc,eq[r3.LEQUAL]=eJ.LessEqualStencilFunc,eq[r3.ALWAYS]=eJ.AlwaysStencilFunc,eq[r3.NOTEQUAL]=eJ.NotEqualStencilFunc,eq[r3.GREATER]=eJ.GreaterStencilFunc,eq[r3.GEQUAL]=eJ.GreaterEqualStencilFunc,eq),uo=((eQ={})[r3.KEEP]=eJ.KeepStencilOp,eQ[r3.ZERO]=eJ.ZeroStencilOp,eQ[r3.REPLACE]=eJ.ReplaceStencilOp,eQ[r3.INCR]=eJ.IncrementStencilOp,eQ[r3.DECR]=eJ.DecrementStencilOp,eQ[r3.INCR_WRAP]=eJ.IncrementWrapStencilOp,eQ[r3.DECR_WRAP]=eJ.IncrementWrapStencilOp,eQ[r3.INVERT]=eJ.InvertStencilOp,eQ),ua=((eK={})[r3.NEVER]=eJ.NeverDepth,eK[r3.ALWAYS]=eJ.AlwaysDepth,eK[r3.EQUAL]=eJ.EqualDepth,eK[r3.LESS]=eJ.LessDepth,eK[r3.LEQUAL]=eJ.LessEqualDepth,eK[r3.GREATER]=eJ.GreaterDepth,eK[r3.GEQUAL]=eJ.GreaterEqualDepth,eK[r3.NOTEQUAL]=eJ.NotEqualDepth,eK),us=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],uu=function(e){function r(r,i){(n=e.call(this,r,i)||this).textures={},n.material=new eJ.RawShaderMaterial,n.uniforms={};for(var n,o=null==i?void 0:i.shader,a=r.gpuCapability.level,s=0;s<t.maxSpriteMeshItemCount;s++)n.uniforms["uSampler"+s]=new eJ.Uniform(null);return n.uniforms.uEditorTransform=new eJ.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new eJ.Uniform(new eJ.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new eJ.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new eJ.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new eJ.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new eJ.RawShaderMaterial({vertexShader:r9(o.marcos,o.vertex,t.ShaderType.vertex,n.engine.gpuCapability.level),fragmentShader:r9(o.marcos,o.fragment,t.ShaderType.fragment,n.engine.gpuCapability.level),alphaToCoverage:!1,depthFunc:eJ.LessDepth,polygonOffsetFactor:eJ.ZeroFactor,polygonOffsetUnits:eJ.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===a?n.material.glslVersion=eJ.GLSL1:n.material.glslVersion=eJ.GLSL3,n}rH(r,e);var i=r.prototype;return i.onSetUniformValue=function(t,e){var r;us.includes(t)&&(r=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=r||e:this.material.uniforms[t]=new eJ.Uniform(r||e)},i.use=function(t,e){var r=this.engine,i=r.composition,n=r.threeCamera;if(n){var o=new eJ.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",o)}else{var a=i.camera;this.setMatrix("effects_MatrixVP",a.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",a.getViewMatrix())}},i.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},i.getVector4Array=function(t){return this.uniforms[t].value},i.setVector4Array=function(t,e){for(var r,i=[],n=rW(e);!(r=n()).done;){var o=r.value;i=i.concat(o.toArray())}this.setUniform(t,i)},i.getMatrixArray=function(t){return this.uniforms[t].value},i.setMatrixArray=function(t,e){for(var r,i=[],n=rW(e);!(r=n()).done;){var o=r.value;i=i.concat(o.elements)}this.setUniform(t,i)},i.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},i.getMatrix=function(t){return this.uniforms[t].value},i.setMatrix=function(t,e){this.setUniform(t,e)},i.setMatrix3=function(t,e){this.setUniform(t,e)},i.getVector2=function(t){return this.uniforms[t].value},i.setVector2=function(t,e){this.setUniform(t,e)},i.getVector3=function(t){return this.uniforms[t].value},i.setVector3=function(t,e){this.setUniform(t,e)},i.getVector4=function(t){return this.uniforms[t].value},i.setVector4=function(t,e){this.setUniform(t,e)},i.getQuaternion=function(t){return this.uniforms[t].value},i.setQuaternion=function(t,e){this.setUniform(t,e)},i.getFloat=function(t){return this.uniforms[t].value},i.setFloat=function(t,e){this.setUniform(t,e)},i.getFloats=function(t){return this.uniforms[t].value},i.setFloats=function(t,e){this.setUniform(t,e)},i.getInt=function(t){return this.uniforms[t].value},i.setInt=function(t,e){this.setUniform(t,e)},i.hasUniform=function(t){return!!this.uniforms[t]},i.setUniform=function(t,e){var r=new eJ.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=r},i.enableMacro=function(t){throw Error("Method not implemented.")},i.disableMacro=function(t){throw Error("Method not implemented.")},i.isMacroEnabled=function(t){throw Error("Method not implemented.")},i.clone=function(t){throw Error("Method not implemented.")},i.cloneUniforms=function(t){throw Error("Method not implemented.")},i.fromData=function(t){throw Error("Method not implemented.")},i.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},rG(r,[{key:"blending",get:function(){return this.material.blending!==eJ.NoBlending},set:function(t){this.material.blending=t?eJ.CustomBlending:eJ.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,r=t.blendDst;return[e,r,t.blendSrcAlpha||e,t.blendDstAlpha||r]},set:function(t){if(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.material.blendSrc=ui[e],this.material.blendDst=ui[r],this.material.blendSrcAlpha=ui[i],this.material.blendDstAlpha=ui[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],r=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=r}}},{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=ua[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],r=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=r}}},{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=un[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=uo[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=uo[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=uo[t[0]])}},{key:"culling",get:function(){return this.material.side!==eJ.DoubleSide},set:function(t){this.material.side=t?eJ.FrontSide:eJ.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tk.FRONT?this.material.side=eJ.FrontSide:t===tk.BACK&&(this.material.side=eJ.BackSide)}}]),r}(iL),ul=1,uc=function(t){function e(e,r){if((i=t.call(this,e)||this).attributes={},i.destroyed=!1,i.attributesName=[],!r)return ak(i);var i,n=r.drawStart,o=r.drawCount,a=r.indices,s=r.mode,u=r.name,l=void 0===u?"effectsGeometry:"+ul++:u;i.name=l,i.mode=null!=s?s:r3.TRIANGLES;var c=[],h={},f=new eJ.BufferGeometry;return Object.keys(r.attributes).forEach(function(t){var e=r.attributes[t];if("dataSource"in e){var n=e.dataSource;if(n){void 0===h[n]&&i.setAttributeType(n,e,f,h,r.maxVertex);var o=e.size,a=e.offset,s=e.normalize,u=h[n],l=u.buffer,m=u.dataLength,d=new eJ.InterleavedBufferAttribute(l,o,(null!=a?a:0)/m,s);f.setAttribute(t,d),h[t]={buffer:l,attribute:d,type:u.type,dataLength:m}}}else i.setAttributeType(t,e,f,h,r.maxVertex);c.push(t)}),a&&a.data&&f.setIndex(new eJ.BufferAttribute(a.data,1)),i.geometry=f,i.attributes=h,i.attributesName=c,i.drawStart=void 0===n?0:n,i.drawCount=null!=o?o:0,i}rH(e,t);var r=e.prototype;return r.getAttributeData=function(t){if(void 0!=this.attributes[t])return this.attributes[t].buffer.array},r.setAttributeData=function(t,e){if(void 0!=this.attributes[t]){var r=this.attributes[t].buffer;if(e.length>r.array.length){var i=new eJ.InterleavedBuffer(e,r.stride);r=this.attributes[t].attribute.data=i,this.geometry.setAttribute(t,this.attributes[t].attribute)}else r.set(e,0),r.updateRange.count=e.length,r.updateRange.offset=0;this.geometry.attributes[t].needsUpdate=!0}},r.setAttributeSubData=function(t,e,r){void 0!=this.attributes[t]&&(this.attributes[t].buffer.set(r,e),this.geometry.attributes[t].needsUpdate=!0)},r.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*iG[e.type]},r.getAttributeNames=function(){return this.attributesName},r.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},r.setIndexData=function(t){t&&(this.geometry.setIndex(new eJ.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},r.setIndexSubData=function(t,e){var r=this.geometry.getIndex();if(null!==r){var i=t+e.length;if(r.count<i){var n=new e.constructor(end);n.set(r.array),r.array=n}r.array.set(e,t),this.geometry.index.needsUpdate=!0}},r.setDrawStart=function(t){this.drawStart=t},r.getDrawStart=function(){return this.drawStart},r.setDrawCount=function(t){this.drawCount=t},r.getDrawCount=function(){return this.drawCount},r.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},r.setAttributeType=function(t,e,r,i,n){var o=e.stride,a=e.size,s=e.offset,u=e.normalize,l=e.type,c=void 0===l?r3.FLOAT:l,h=e.data;if(c&&!h&&(h=iH(c)),h){var f=e1(h,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,m=(void 0===o?0:o)/f,d=(n=(null!=n?n:0)*m)||a*f;d&&0===h.length&&(h=e1(h,Float32Array)?new Float32Array(d):new Uint16Array(d));var p=new eJ.InterleavedBuffer(h,m),v=new eJ.InterleavedBufferAttribute(p,a,(null!=s?s:0)/f,u);r.setAttribute(t,v),i[t]={buffer:p,attribute:v,type:c,dataLength:f}}},rG(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}(iX),uh=function(e){function r(t,r){if(!r)return ak(i);var i,n=r.material,o=r.geometry,a=r.priority;return(i=e.call(this,t,r)||this).geometry=o,i.material=n,o.mode===r3.LINES?i.mesh=new eJ.LineSegments(o.geometry,n.material):i.mesh=new eJ.Mesh(o.geometry,n.material),i.priority=void 0===a?0:a,i}rH(r,e);var i=r.prototype;return i.setVisible=function(t){this.mesh.visible=t},i.getVisible=function(){return this.mesh.visible},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e,this.mesh.material=e.material},i.start=function(){e.prototype.start.call(this),this.engine.threeGroup.add(this.mesh)},i.restore=function(){},i.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},rG(r,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),r}(iQ),uf=function(e){function r(r,i,n){if(void 0===n&&(n={}),o=e.call(this,r)||this,i){var o,a=i.width,s=i.height;o.texture=o.createTextureByType(ir({},n,{sourceType:t.TextureSourceType.data,data:i})),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}rH(r,e);var i=r.prototype;return i.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},i.startVideo=function(){var e=this;return e0(function(){var r;return e4(this,function(i){switch(i.label){case 0:if(e.sourceType!==t.TextureSourceType.video||!(r=e.texture.source.data).paused)return[3,2];return[4,r.play()];case 1:i.sent(),i.label=2;case 2:return[2]}})})()},i.assembleOptions=function(e){var i=e.target,n=void 0===i?r3.TEXTURE_2D:i;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),ir({target:n,format:eJ.RGBAFormat,type:eJ.UnsignedByteType},e,{minFilter:r.toThreeJsTextureFilter(e.minFilter),magFilter:r.toThreeJsTextureFilter(e.magFilter),wrapS:r.toThreeJsTextureWrap(e.wrapS),wrapT:r.toThreeJsTextureWrap(e.wrapT)})},i.dispose=function(){this.texture.dispose()},i.createTextureByType=function(e){var r=this.assembleOptions(e),i=r.flipY,n=r.type,o=r.wrapS,a=r.wrapT,s=r.minFilter,u=r.magFilter,l=r.sourceType,c=eJ.UVMapping,h=r.format,f=void 0;if(this.sourceType=l,l===t.TextureSourceType.data){var m=e.data;f=new eJ.DataTexture(m.data,m.width,m.height,h,n,c,o,a,u,s),this.width=m.width,this.height=m.height}else if(l===t.TextureSourceType.image){var d=e.image;f=new eJ.Texture(d,c,o,a,u,s,h,n),this.width=d.width,this.height=d.height}else if(l===t.TextureSourceType.compressed){var p=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,r=t.width,i=t.height;return p=p<r?r:p,v=v<i?i:v,{data:e,width:r,height:i,colorSpace:"srgb"}});h=eJ.RGBA_ASTC_4x4_Format,f=new eJ.CompressedTexture(y,p,v,h,n,c,o,a,u,s),this.width=p,this.height=v}else if(l===t.TextureSourceType.video)f=new eJ.VideoTexture(e.video,c,o,a,u,s,h,n);else if(l===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,T,E=null!=(x=g.width)?x:0,_=null!=(T=g.height)?T:0;f=new eJ.FramebufferTexture(E,_,h),this.width=E,this.height=_}}else l===t.TextureSourceType.none&&((f=new eJ.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=eJ.MirroredRepeatWrapping,f.wrapT=eJ.MirroredRepeatWrapping,this.width=this.height=1);if(f)return f.flipY=!!i,f;throw Error("使用未知的数据类型创建纹理")},r.toThreeJsTextureFilter=function(t){return t===r3.LINEAR?eJ.LinearFilter:eJ.NearestFilter},r.toThreeJsTextureWrap=function(t){switch(t){case r3.MIRRORED_REPEAT:return eJ.MirroredRepeatWrapping;case r3.REPEAT:return eJ.RepeatWrapping;default:return eJ.ClampToEdgeWrapping}},r}(i_),um=function(t){function e(e,r,i){var n;return(n=t.call(this,e,r,i)||this).rootItem.getComponent(s8).resetStatus(),n}rH(e,t);var r=e.prototype;return r.updateVideo=function(){this.textures.map(function(t){return t.startVideo()})},r.prepareRender=function(){var t=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var e,r=rW(this.rootComposition.items);!(e=r()).done;)for(var i,n=e.value.getComponents(iZ),o=rW(n);!(i=o()).done;){var a=i.value;a.isActiveAndEnabled&&a.render(t)}for(var s,u=rW(this.refContent);!(s=u()).done;)for(var l,c=s.value,h=rW(c.getComponent(s8).items);!(l=h()).done;)for(var f,m=l.value.getComponents(iZ),d=rW(m);!(f=d()).done;){var p=f.value;p.isActiveAndEnabled&&p.render(t)}},r.getRendererOptions=function(){var t=uf.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}(s9);um.shape={};var ud=function(t){function e(e){var r;return(r=t.call(this)||this).gpuCapability=new np(e),r}return rH(e,t),e.prototype.setOptions=function(t){var e=t.threeCamera,r=t.threeGroup,i=t.composition;this.threeCamera=e,this.threeGroup=r,this.composition=i},e}(ue),up=function(t){function e(e){var r;return(r=t.call(this)||this).engine=new ud(e),r.renderingData={currentFrame:{}},r}return rH(e,t),e}(nx),uv=function(t){function e(e,r){(i=t.call(this)||this).compositions=[],i.baseCompositionIndex=0,i.env="";var i,n=r.width,o=r.height,a=r.camera;return i.renderer=new up(e),i.width=n,i.height=o,i.camera=a,i}rH(e,t);var r=e.prototype;return r.loadScene=function(t,e){var r=this;return e0(function(){var i,n;return e4(this,function(o){switch(o.label){case 0:if(n=r.baseCompositionIndex,!rF(t))return[3,2];return r.baseCompositionIndex+=t.length,[4,Promise.all(t.map(e0(function(t,i){var o;return e4(this,function(a){switch(a.label){case 0:return[4,r.createComposition(t,e)];case 1:return(o=a.sent()).setIndex(n+i),[2,o]}})})))];case 1:return i=o.sent(),[3,4];case 2:return r.baseCompositionIndex+=1,[4,r.createComposition(t,e)];case 3:(i=o.sent()).setIndex(n),o.label=4;case 4:return[2,i]}})})()},r.createComposition=function(t,e){void 0===e&&(e={});var r=this;return e0(function(){var i,n,o,a,s,u,l,c,h;return e4(this,function(f){switch(f.label){case 0:return i=performance.now(),n=ir({autoplay:!0},e),uy(t)?(o=t.scene,n=ir({},n,t.options||{})):o=t,r.assetManager?r.assetManager.updateOptions(n):r.assetManager=new s4(n),[4,r.assetManager.loadScene(o,r.renderer,{env:r.env})];case 1:for(a=f.sent(),(s=r.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(l=new ut(a,s),!s.database)return[3,3];return[4,s.createVFXItemsAsync(a)];case 2:f.sent(),f.label=3;case 3:return c=new um(ir({},n,{width:r.width,height:r.height,renderer:r.renderer}),a,l),r.renderer.engine.setOptions({threeCamera:r.camera,threeGroup:r,composition:c}),n.autoplay?c.play():c.pause(),h=performance.now()-i+c.statistic.loadTime,c.statistic.firstFrameTime=h,rM.info("first frame: ["+c.name+"]"+h.toFixed(4)+"ms"),r.compositions.push(c),[2,c]}})})()},r.update=function(t){this.compositions.forEach(function(e){e.update(t)})},rG(e,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(eJ.Group);function uy(t){return rD(t)&&"scene"in t}t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}rH(e,t);var r=e.prototype;return r.setVisible=function(t){this.threeMesh.visible=t},r.getVisible=function(){return this.threeMesh.visible},r.dispose=function(){t.prototype.dispose.call(this),this.isActiveAndEnabled||this.threeMesh.clear()},r.fromData=function(e){t.prototype.fromData.call(this,e),this.threeMesh||(this.geometry.mode===r3.LINES?this.threeMesh=new eJ.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new eJ.Mesh(this.geometry.geometry,this.material.material))},r.start=function(){t.prototype.start.call(this),this.engine.threeGroup.add(this.threeMesh)},r.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))},r.onDestroy=function(){this.threeMesh.clear()},rG(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=e3([r1(t.DataType.SpriteComponent)],t.ThreeSpriteComponent),od(8),i_.create=function(t,e){return new uf(t,void 0,e)},i_.createWithData=function(t,e,r){return new uf(t,e,r)},iL.create=function(t,e){return new uu(t,e)},iX.create=function(t,e){return new uc(t,e)},iQ.create=function(t,e){return new uh(t,e)};var ug="2.0.0-alpha.7";rM.info("THREEJS plugin version: "+ug),t.AbstractPlugin=nC,t.ActivationPlayable=oI,t.AssetLoader=nE,t.AssetManager=s4,t.BYTES_TYPE_MAP=iG,t.Behaviour=iW,t.BezierSegments=nj,t.COMPRESSED_TEXTURE=ny,t.CONSTANT_MAP_BLEND=ui,t.CONSTANT_MAP_DEPTH=ua,t.CONSTANT_MAP_STENCIL_FUNC=un,t.CONSTANT_MAP_STENCIL_OP=uo,t.COPY_FRAGMENT_SHADER=iN,t.COPY_MESH_SHADER_ID=iV,t.COPY_VERTEX_SHADER=iF,t.CalculateLoader=az,t.Camera=s6,t.CameraVFXItemLoader=n6,t.Component=iY,t.Composition=s9,t.CompositionComponent=s8,t.CompositionSourceManager=ut,t.CurveValue=nH,t.DEFAULT_FONTS=aK,t.Database=n_,t.Downloader=ii,t.EFFECTS_COPY_MESH_NAME=iP,t.EVENT_TYPE_CLICK=n8,t.EVENT_TYPE_TOUCH_END=ot,t.EVENT_TYPE_TOUCH_MOVE=n7,t.EVENT_TYPE_TOUCH_START=n9,t.EffectsObject=iT,t.Engine=ue,t.EventSystem=or,t.FILTER_NAME_NONE="none",t.Float16ArrayWrapper=nR,t.FrameBuffer=ng,t.GPUCapability=np,t.Geometry=iX,t.GlobalUniforms=nf,t.GradientValue=nX,t.HELP_LINK=oa,t.InteractBehavior=oe,t.InteractLoader=on,t.InteractMesh=ou,t.ItemBehaviour=ij,t.KTXTexture=iS,t.LineSegments=nY,t.LinearValue=nG,t.Material=iL,t.MaterialDataBlock=ib,t.Mesh=iQ,t.PLAYER_OPTIONS_ENV_EDITOR=oo,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=aD,t.ParticleLoader=oJ,t.ParticleMesh=oU,t.ParticleSystemRenderer=ab,t.PassTextureCache=iU,t.PathSegments=nW,t.PluginSystem=sl,t.QCanvasViewer=aY,t.QText=aH,t.RENDER_PASS_NAME_PREFIX=ns,t.RENDER_PREFER_LOOKUP_TEXTURE=oD,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=nk,t.RandomValue=nU,t.RandomVectorValue=nB,t.RenderBuffer=nm,t.RenderFrame=nl,t.RenderPass=i$,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=iK,t.Renderer=nx,t.RendererComponent=iZ,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=iB,t.SerializationHelper=nT,t.ShaderVariant=iM,t.SpriteColorPlayable=oN,t.SpriteLoader=ov,t.StaticValue=nz,t.TEMPLATE_USE_OFFSCREEN_CANVAS=oz,t.TEXTURE_UNIFORM_MAP=us,t.TextLoader=sr,t.Texture=i_,t.TextureFactory=iA,t.ThreeComposition=um,t.ThreeDisplayObject=uv,t.ThreeEngine=ud,t.ThreeMaterial=uu,t.ThreeTexture=uf,t.Ticker=ur,t.TimelineClip=o_,t.TimelineComponent=oM,t.Track=oE,t.Transform=n5,t.TransformAnimationPlayable=ow,t.TransformAnimationPlayableAsset=oL,t.ValueGetter=nD,t.addByOrder=rh,t.addItem=e7,t.addItemWithOrder=function(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var o=t[n];if(i)for(;t[n-1][r]<o[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>o[r]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},t.alphaFrameFrag="uniform vec4 uTexRange;uniform vec2 uFilterSourceSize;\n#define INTERPOLATION 0\nvec4 filterMain(vec2 texCoord,sampler2D source){float x=uTexRange.x+texCoord.x*uTexRange.y;\n#if INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 color=mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nvec4 color=texture2D(source,vec2(x,texCoord.y));\n#endif\nx=uTexRange.z+texCoord.x*uTexRange.w;vec4 opacity=texture2D(source,vec2(x,texCoord.y));return vec4(color.rgb,opacity.r);}",t.alphaMaskFrag="uniform sampler2D uAlphaXSample;uniform sampler2D uAlphaYSample;vec4 filterMain(vec2 texCoord,sampler2D source){vec4 color=texture2D(source,texCoord);float x=texture2D(uAlphaXSample,vec2(vFeatherCoord.x,0.)).r;float y=texture2D(uAlphaYSample,vec2(vFeatherCoord.y,0.)).r;return vec4(color.rgb,color.a*min(x,y));}",t.assertExist=rm,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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.bloomMixVert="uniform sampler2D uBloomBlur;uniform vec4 uBloomParams;vec4 filterMain(vec2 coord,sampler2D tex){const vec3 gamma=vec3(1./2.2);vec4 c1=texture2D(tex,coord);vec4 bloomColor=texture2D(uBloomBlur,coord);float alpha=max(c1.a,bloomColor.a);vec3 color=max(c1.rgb*c1.a,bloomColor.rgb*bloomColor.a)/alpha*uBloomParams.y+bloomColor.rgb*uBloomParams.x;return vec4(color,alpha);}",t.bloomThresholdVert="uniform vec4 uColorThreshold;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);vec3 color=c1.rgb*c1.a;vec3 s=step(uColorThreshold.xyz,color);float m=min(s.r+s.g+s.b,1.);return c1*m;}",t.calculateTranslation=nO,t.cameraMoveFrag="uniform vec2 uMoveTexSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uMoveTexSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uMoveTexSize,(coordMin+vec2(1.))/uMoveTexSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 cB=mix(cLB,cRB,pp.x);vec4 cT=mix(cLT,cRT,pp.x);return mix(cB,cT,pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}",t.cameraMoveVert="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",t.canvasPool=a$,t.colorGradingFrag=i8,t.colorStopsFromGradient=rn,t.colorToArr=rr,t.combineImageTemplate=a7,t.combineImageTemplate1=aj,t.combineImageTemplate1Async=function(t,e,r,i,n){return aq.apply(this,arguments)},t.combineImageTemplate2=a6,t.combineImageTemplate2Async=function(t,e,r,i,n){return a9.apply(this,arguments)},t.combineImageTemplateAsync=function(t,e,r,i,n){return se.apply(this,arguments)},t.compatibleFrag="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n",t.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",t.copyFrag=iI,t.createCopyShader=iD,t.createGLContext=function(t,e,r){var i;if(void 0===e&&(e="webgl"),"webgl2"!==e||(i=t.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),i&&"webgl"!==e||(i=t.getContext("webgl",r)),!i)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i},t.createKeyFrameMeta=n2,t.createShaderWithMarcos=r9,t.createShape=ai,t.createVFXItem=sn,t.createValueGetter=nq,t.deepClone=function t(e){if(rF(e))return e.map(t);if(e&&"object"==typeof e){if(ArrayBuffer.isView(e))return e.slice();for(var r={},i=Object.keys(e),n=0;n<i.length;n++){var o=i[n];r[o]=t(e[o])}return r}return e},t.defaultGlobalVolume=na,t.defaultPlugins=sa,t.delayFrag="uniform sampler2D uLastSource;uniform vec4 uParams;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);if(uParams.x<1.){return c1;}vec4 c2=texture2D(uLastSource,coord);return mix(c1,c2,uParams.y);}",t.deserializeMipmapTexture=iv,t.distortionFrag="uniform vec4 uWaveParams;\n#ifdef PATICLE_SHADER\nin vec4 vWaveParams;\n#else\nuniform vec4 vWaveParams;\n#endif\nvec4 filterMain(vec2 texCoord,sampler2D tex){vec2 vp=texCoord-uWaveParams.xy;float xx=dot(vp,uWaveParams.zw);float d=sin(vWaveParams.x*xx+vWaveParams.y)*vWaveParams.z;vec2 up=vec2(-uWaveParams.w,uWaveParams.z)*d;return texture2D(tex,clamp(texCoord+up,0.,1.));}",t.distortionVert="uniform vec4 uMovementValue;uniform vec4 uStrengthValue;uniform vec4 uPeriodValue;out vec4 vWaveParams;void filterMain(float lifetime){const float pi2=3.14159265;vWaveParams=vec4(getValueFromTime(lifetime,uPeriodValue)*pi2,getValueFromTime(lifetime,uMovementValue)*pi2,getValueFromTime(lifetime,uStrengthValue),0.);}",t.earcut=aT,t.effectsClass=r1,t.effectsClassStore=rQ,t.enlargeBuffer=re,t.ensureVec3=nw,t.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-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=i9,t.gaussianDownVFrag=i7,t.gaussianUpFrag=nt,t.generateEmptyTypedArray=iH,t.generateGUID=rU,t.generateHalfFloatTexture=iC,t.getBackgroundImage=a0,t.getColorFromGradientStops=ri,t.getConfig=function(t){return ok[t]},t.getDefaultTemplateCanvasPool=function(){return a$},t.getDefaultTextureFactory=function(){return es||(es=new iA),es},t.getGeometryByShape=a_,t.getGeometryTriangles=aE,t.getImageItemRenderInfo=oc,t.getKTXTextureOptions=iR,t.getKeyFrameMetaByRawValue=n1,t.getMergedStore=r$,t.getParticleMeshShader=oX,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=r6,t.getStandardComposition=sK,t.getStandardImage=sQ,t.getStandardItem=s$,t.getStandardJSON=sZ,t.getTextureSize=nc,t.glContext=r3,t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var r=t.createQuery(),i=e0(function(){return e4(this,function(n){return[2,new Promise(function(n,o){if(r){var a=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);a&&!s&&n(t.getQueryParameter(r,t.QUERY_RESULT)/1e3/1e3),(a||s)&&(t.deleteQuery(r),r=null),null!==a&&r&&window.setTimeout(function(){i().then(n).catch},1)}})]})});if(!r)return;return{begin:function(){r&&t.beginQuery(e.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:i}}},t.imageDataFromColor=function(t){rV(t)&&(t=rr(t));for(var e=t,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=e[n];return r},t.imageDataFromGradient=rl,t.initErrors=r2,t.initGLContext=r4,t.integrate="float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}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;}else 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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}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.;}return 0.;}",t.interpolateColor=ro,t.isAndroid=rs,t.isArray=rF,t.isFunction=rN,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=rD,t.isScene=s2,t.isSceneWithOptions=uy,t.isSimulatorCellPhone=ru,t.isString=rV,t.isUniformStruct=iO,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&iO(t[0])},t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",t.itemFrag=i2,t.itemFrameFrag=i0,t.itemVert=i1,t.loadBinary=ic,t.loadBlob=function(t){return im.apply(this,arguments)},t.loadImage=iu,t.loadMedia=a1,t.loadVideo=id,t.loadWebPOptional=ia,t.logger=rM,t.math=rL,t.modifyMaxKeyframeShader=oH,t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=rP,t.parsePercent=ra,t.particleFrag=i3,t.particleOriginTranslateMap=nP,t.particleVert=i4,t.pluginLoaderMap=so,t.random=rz,t.registerPlugin=su,t.removeItem=rt,t.requestAsync=aW,t.rotateVec2=aC,t.screenMeshVert=i6,t.serialize=r0,t.setBlendMode=r7,t.setConfig=function(t,e){return ok[t]=e},t.setDefaultTextureFactory=function(t){es=t},t.setMaskMode=ie,t.setMaxSpriteMeshItemCount=od,t.setRayFromCamera=nV,t.setSideMode=it,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=function(e){return(t.maxSpriteTextureCount=Math.min(e.maxFragmentTextures,16),e.maxVertexUniforms>=256)?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void(t.maxSpriteTextureCount=8)},t.setUniformValue=function(t,e,r){t[e]?t[e].value=r:t[e]=new eJ.Uniform(r)},t.sortByOrder=rc,t.spec=rq,t.spriteMeshShaderFromFilter=oh,t.spriteMeshShaderFromRenderInfo=om,t.spriteMeshShaderIdFromRenderInfo=of,t.thresholdFrag=ne,t.throwDestroyedError=rk,t.trailVert=i5,t.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},t.trianglesFromRect=nF,t.unregisterPlugin=function(t){delete ss[t],delete so[t],rt(sa,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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}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.vecAssign=nI,t.vecFill=nL,t.vecMulCombine=nM,t.vecNormalize=function(t,e){1==arguments.length&&(e=t,t=[]);var r,i=e,n=(r=Math).hypot.apply(r,[].concat(i));if(0===n)return nI(t,i,i.length);for(var o=0;o<i.length;o++)t[o]=i[o]/n;return t},t.version=ug,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
11
|
+
* Version: v2.0.0-alpha.8
|
|
12
|
+
*/"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);for(var rU=[],rz=0;rz<256;++rz)rU.push((rz+256).toString(16).slice(1));(o=tN||(tN={})).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=tU||(tU={}))[u.NONE=0]="NONE",u[u.MASK=1]="MASK",u[u.OBSCURED=2]="OBSCURED",u[u.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(l=tz||(tz={}))[l.NONE=0]="NONE",l[l.SPHERE=1]="SPHERE",l[l.CONE=2]="CONE",l[l.HEMISPHERE=3]="HEMISPHERE",l[l.CIRCLE=4]="CIRCLE",l[l.DONUT=5]="DONUT",l[l.RECTANGLE=6]="RECTANGLE",l[l.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",l[l.EDGE=8]="EDGE",l[l.TEXTURE=9]="TEXTURE",(c=tk||(tk={}))[c.GYROSCOPE=0]="GYROSCOPE",c[c.SPINE=1]="SPINE",(h=tB||(tB={}))[h.CLICK=0]="CLICK",h[h.MESSAGE=1]="MESSAGE",h[h.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",(m=tX||(tX={})).base="0",m.sprite="1",m.particle="2",m.null="3",m.interact="4",m.plugin="5",m.camera="6",m.composition="7",m.spine="spine",m.mesh="mesh",m.tree="tree",m.text="text",m.light="light",m.skybox="skybox",m.effect="effect",(d=tH||(tH={}))[d.BILLBOARD=0]="BILLBOARD",d[d.MESH=1]="MESH",d[d.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",d[d.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(p=tY||(tY={}))[p.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",p[p.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",p[p.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",p[p.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",p[p.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",p[p.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",p[p.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",p[p.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",p[p.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(v=tj||(tj={}))[v.portrait=1]="portrait",v[v.landscape=0]="landscape",(y=tW||(tW={}))[y.destroy=0]="destroy",y[y.pause=1]="pause",y[y.restart=5]="restart",y[y.forward=2]="forward",y[y.pause_destroy=3]="pause_destroy",y[y.freeze=4]="freeze",(g=tZ||(tZ={})).video="video",g.image="image",(x=tq||(tq={}))[x.CONSTANT=0]="CONSTANT",x[x.CONSTANT_VEC2=1]="CONSTANT_VEC2",x[x.CONSTANT_VEC3=2]="CONSTANT_VEC3",x[x.CONSTANT_VEC4=3]="CONSTANT_VEC4",x[x.RANDOM=4]="RANDOM",x[x.LINE=5]="LINE",x[x.CURVE=6]="CURVE",x[x.BEZIER_PATH=7]="BEZIER_PATH",x[x.RGBA_COLOR=8]="RGBA_COLOR",x[x.GRADIENT_COLOR=9]="GRADIENT_COLOR",x[x.SHAPE_POINTS=10]="SHAPE_POINTS",x[x.SHAPE_SPLITS=11]="SHAPE_SPLITS",x[x.LINEAR_PATH=12]="LINEAR_PATH",x[x.COLORS=13]="COLORS",x[x.BINARY=20]="BINARY",x[x.BEZIER_CURVE=21]="BEZIER_CURVE",x[x.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",(T=tK||(tK={}))[T.AUTO=0]="AUTO",T[T.EASE=1]="EASE",T[T.EASE_IN=2]="EASE_IN",T[T.EASE_OUT=3]="EASE_OUT",T[T.LINE=4]="LINE",T[T.HOLD=5]="HOLD",T[T.LINE_OUT=6]="LINE_OUT",(E=tQ||(tQ={}))[E.destroy=0]="destroy",E[E.loop=5]="loop",E[E.freeze=4]="freeze",(_=tJ||(tJ={}))[_.destroyChildren=6]="destroyChildren",(C=t$||(t$={}))[C.none=0]="none",C[C.removeParticle=1]="removeParticle",(A=t0||(t0={}))[A.RANDOM=0]="RANDOM",A[A.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",A[A.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",A[A.UNIFORM_BURST=3]="UNIFORM_BURST",(R=t1||(t1={})).point="point",R.spot="spot",R.directional="directional",R.ambient="ambient",(S=t2||(t2={}))[S.box=2]="box",S[S.sphere=3]="sphere",(O=t3||(t3={})).orthographic="orthographic",O.perspective="perspective",(b=t4||(t4={})).unlit="unlit",b.pbr="pbr",b.hair="hair",(w=t5||(t5={}))[w.opaque=100]="opaque",w[w.masked=101]="masked",w[w.translucent=102]="translucent",w[w.additive=103]="additive",(L=t6||(t6={})).none="none",L.uv="uv",L.normal="normal",L.basecolor="basecolor",L.alpha="alpha",L.metallic="metallic",L.roughness="roughness",L.ao="ao",L.emissive="emissive",(I=t8||(t8={}))[I.display=0]="display",I[I.clip=1]="clip",I[I.ellipsis=2]="ellipsis",(M=t9||(t9={}))[M.top=0]="top",M[M.middle=1]="middle",M[M.bottom=2]="bottom",(P=t7||(t7={}))[P.left=0]="left",P[P.middle=1]="middle",P[P.right=2]="right",(V=et||(et={})).normal="normal",V.bold="bold",V.lighter="lighter",(N=ee||(ee={})).normal="normal",N.italic="italic",N.oblique="oblique",(F=er||(er={})).VFXItemData="VFXItemData",F.EffectComponent="EffectComponent",F.Material="Material",F.Shader="Shader",F.SpriteComponent="SpriteComponent",F.ParticleSystem="ParticleSystem",F.InteractComponent="InteractComponent",F.CameraController="CameraController",F.Geometry="Geometry",F.Texture="Texture",F.TextComponent="TextComponent",F.MeshComponent="MeshComponent",F.SkyboxComponent="SkyboxComponent",F.LightComponent="LightComponent",F.CameraComponent="CameraComponent",F.ModelPluginComponent="ModelPluginComponent",F.TreeComponent="TreeComponent",(D=ei||(ei={}))[D.POINTS=0]="POINTS",D[D.LINES=1]="LINES",D[D.LINE_LOOP=2]="LINE_LOOP",D[D.LINE_STRIP=3]="LINE_STRIP",D[D.TRIANGLES=4]="TRIANGLES",D[D.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",D[D.TRIANGLE_FAN=6]="TRIANGLE_FAN";var rk=Object.freeze({__proto__:null,get BackgroundType(){return tZ},get BezierKeyframeType(){return tK},get BlendingMode(){return tF},BuiltinObjectGUID:function(){function t(){}return t.WhiteTexture="whitetexture00000000000000000000",t.PBRShader="pbr00000000000000000000000000000",t.UnlitShader="unlit000000000000000000000000000",t}(),CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return tj},get CameraType(){return t3},get CompositionEndBehavior(){return tW},get DataType(){return er},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_DESTROY_CHILDREN:6,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_RESTART:5,get FontStyle(){return ee},get GeometryType(){return ei},get InteractBehavior(){return tG},get InteractType(){return tB},get ItemEndBehavior(){return tQ},get ItemType(){return tX},get LightType(){return t1},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return tU},get MaterialBlending(){return t5},get MaterialType(){return t4},get ModelBoundingType(){return t2},get ParentItemEndBehavior(){return tJ},get ParticleInteractionBehavior(){return t$},get ParticleOrigin(){return tY},get PluginType(){return tk},get RenderLevel(){return tN},get RenderMode(){return tH},get RenderMode3D(){return t6},get ShapeArcMode(){return t0},get ShapeType(){return tz},get SideMode(){return tD},get TextAlignment(){return t7},get TextBaseline(){return t9},get TextOverflow(){return t8},get TextWeight(){return et},get ValueType(){return tq}}),rB={},rG={},rX={};function rH(t){var e=t.constructor.name;if(rX[e])return rX[e];rX[e]={};for(var r=rX[e],i=t,n=e;n;){var o=rG[n];for(var a in o)r[a]=o[a];var s=Object.getPrototypeOf(i);if("Object"===(n=Object.getPrototypeOf(s).constructor.name))break;i=s}return r}function rY(t){return function(e,r){var i,n=(rG[i=e.constructor.name]||(rG[i]={}),rG[i]);n[r]||(n[r]={type:0,sourceName:t})}}function rj(t){return function(e,r){rB[t]&&console.warn("Class "+t+" 重复注册"),rB[t]=e}}var rW=function(){function t(t){this.engine=t,this.guid=rE(),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}();e1([rY()],rW.prototype,"guid",void 0);var rZ=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onAttached=function(){},r.onDestroy=function(){},r.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},r.dispose=function(){this.onDestroy(),this.item&&e9(this.item.components,this)},rC(e,[{key:"transform",get:function(){return this.item.transform}}]),e}(rW),rq=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e._enabled=!0,e}rR(e,t);var r=e.prototype;return r.onBehaviourEnable=function(){},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.toData=function(){t.prototype.toData.call(this)},rC(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.onBehaviourEnable()}}]),e}(rZ);e1([rY()],rq.prototype,"_enabled",void 0);var rK=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e}rR(e,t);var r=e.prototype;return r.onEnable=function(){},r.start=function(){},r.update=function(t){},r.lateUpdate=function(t){},r.onAttached=function(){this.item.itemBehaviours.push(this)},r.dispose=function(){this.item&&e9(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},r.onBehaviourEnable=function(){this.onEnable(),this.started||(this.start(),this.started=!0)},e}(rq),rQ=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e.materials=[],e._enabled=!0,e}rR(e,t);var r=e.prototype;return r.onEnable=function(){},r.start=function(){},r.update=function(t){},r.lateUpdate=function(t){},r.render=function(t){},r.onAttached=function(){this.item.rendererComponents.push(this)},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.toData=function(){t.prototype.toData.call(this)},r.dispose=function(){this.item&&e9(this.item.rendererComponents,this),t.prototype.dispose.call(this)},rC(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}(rZ);e1([rY()],rQ.prototype,"materials",void 0),e1([rY()],rQ.prototype,"_priority",void 0),e1([rY()],rQ.prototype,"_enabled",void 0);var rJ=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}(),r$=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,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 r,i,n,o;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):e$(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):e$(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):e$(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):e$(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,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,r=this.z,i=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(r)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new rV(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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t}();r$.ONE=new r$(1,1,1,1),r$.ZERO=new r$(0,0,0,0);var r0=function(){function t(t,e,r,i,n,o,a,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=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,r,i,n,o,a,s,u]}var e=t.prototype;return e.set=function(t,e,r,i,n,o,a,s,u){var l=this.elements;return l[0]=t,l[3]=i,l[6]=a,l[1]=e,l[4]=n,l[7]=s,l[2]=r,l[5]=o,l[8]=u,this},e.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u){var l=this.elements;return l[0]=t,l[3]=e,l[6]=r,l[1]=i,l[4]=n,l[7]=o,l[2]=a,l[5]=s,l[8]=u,this},e.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.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 r=0;r<9;r++)this.elements[r]=t[e+r];return this},e.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,o=e+e,a=r+r,s=i+i,u=e*o,l=e*a,c=e*s,h=r*a,f=r*s,m=i*s,d=n*o,p=n*a,v=n*s,y=this.elements;return y[0]=1-(h+m),y[1]=l+v,y[2]=c-p,y[3]=l-v,y[4]=1-(u+m),y[5]=f+d,y[6]=c+p,y[7]=f-d,y[8]=1-(u+h),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 r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],o=i[3],a=i[6],s=i[1],u=i[4],l=i[7];return i[0]=e*n+r*s,i[3]=e*o+r*u,i[6]=e*a+r*l,i[1]=-r*n+e*s,i[4]=-r*o+e*u,i[7]=-r*a+e*l,this},e.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[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 r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[3],s=r[6],u=r[1],l=r[4],c=r[7],h=r[2],f=r[5],m=r[8],d=i[0],p=i[3],v=i[6],y=i[1],g=i[4],x=i[7],T=i[2],E=i[5],_=i[8];return n[0]=o*d+a*y+s*T,n[3]=o*p+a*g+s*E,n[6]=o*v+a*x+s*_,n[1]=u*d+l*y+c*T,n[4]=u*p+l*g+c*E,n[7]=u*v+l*x+c*_,n[2]=h*d+f*y+m*T,n[5]=h*p+f*g+m*E,n[8]=h*v+f*x+m*_,this},e.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],l=t[8];return e*(o*l-u*a)+n*(u*i-r*l)+s*(r*a-o*i)},e.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],l=t[8],c=l*o-u*a,h=u*i-l*r,f=a*r-o*i,m=e*c+n*h+s*f;if(0===m)return this.set(0,0,0,0,0,0,0,0,0);var d=1/m;return t[0]=c*d,t[1]=(s*a-l*n)*d,t[2]=(u*n-s*o)*d,t[3]=h*d,t[4]=(l*e-s*i)*d,t[5]=(s*r-u*e)*d,t[6]=f*d,t[7]=(n*i-a*e)*d,t[8]=(o*e-n*r)*d,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 r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[3]*i+o[6]*n,a.y=o[1]*r+o[4]*i+o[7]*n,a.z=o[2]*r+o[5]*i+o[8]*n,a},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!rL(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return new t().setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,l){return new t(e,n,s,r,o,u,i,a,l)},t}(),r1=function(){function t(t,e){void 0===t&&(t=rV.ZERO),void 0===e&&(e=rV.X),this.origin=new rV,this.direction=new rV,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 r=e||new rV;return r.copyFrom(this.origin),r.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 r,i,n,o,a,s,u=this.origin,l=u.x,c=u.y,h=u.z,f=this.direction,m=f.x,d=f.y,p=f.z,v=t.min,y=v.x,g=v.y,x=v.z,T=t.max,E=T.x,_=T.y,C=T.z,A=1/m,R=1/d,S=1/p;if(A>=0?(r=(y-l)*A,i=(E-l)*A):(r=(E-l)*A,i=(y-l)*A),R>=0?(n=(g-c)*R,o=(_-c)*R):(n=(_-c)*R,o=(g-c)*R),!(r>o)&&!(n>i)&&((n>r||r!=r)&&(r=n),(o<i||i!=i)&&(i=o),(n>r||r!=r)&&(r=n),(o<i||i!=i)&&(i=o),S>=0?(a=(x-h)*S,s=(C-h)*S):(a=(C-h)*S,s=(x-h)*S),!(r>s)&&!(a>i))&&((a>r||r!=r)&&(r=a),(s<i||i!=i)&&(i=s),!(i<0)))return r>=0?this.at(r,e):this.at(i,e)},e.intersectPlane=function(t,e){var r=t.normal,i=t.distance,n=r.dot(this.direction);if(0===n)return 0===r.dot(this.origin)+i?(e||new rV).copyFrom(this.origin):void 0;var o=-(this.origin.dot(r)+i)/n;return o>=0?this.at(o,e):void 0},e.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,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),l=o-u,c=o+u;if(!(c<0))return l>=0?this.at(l,r):this.at(c,r)}},e.intersectTriangle=function(e,r,i){var n,o=e.p0,a=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(a,o),l=t.tempVec1.subtractVectors(s,o),c=t.tempVec2.subtractVectors(this.origin,o),h=t.tempVec3.crossVectors(u,l),f=this.direction.dot(h);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}l.crossVectors(c,l);var m=n*this.direction.dot(l);if(!(m<0)){u.cross(c);var d=n*this.direction.dot(u);if(!(d<0)&&!(m+d>f)){var p=-n*c.dot(h);if(!(p<0))return this.at(p/f,r)}}},t}();r1.tempVec0=new rV,r1.tempVec1=new rV,r1.tempVec2=new rV,r1.tempVec3=new rV;var r2=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,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 r,i,n,o;return void 0===e&&(e=0),this.r=null!=(r=t[e])?r:0,this.g=null!=(i=t[e+1])?i: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,r,i){void 0===i&&(i=1);var n=r*e,o=t/60,a=n*(1-Math.abs(o%2-1)),s=0,u=0,l=0;o>=0&&o<=1?(s=n,u=a):o>=1&&o<=2?(s=a,u=n):o>=2&&o<=3?(u=n,l=a):o>=3&&o<=4?(u=a,l=n):o>=4&&o<=5?(s=a,l=n):o>=5&&o<=6&&(s=n,l=a);var c=r-n;return this.set(s+c,u+c,l+c,i)},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,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,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):e$(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):e$(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):e$(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):e$(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 r$(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,r=this.g,i=this.b,n=this.a,o=Math.max(e,r,i),a=Math.min(e,r,i),s=o-a,u=0,l=0;return 0!==o&&(l=s/o),o!=a&&(o==e?(u=(r-i)/s,r<i&&(u+=6)):o==r?u=(i-e)/s+2:o==i&&(u=(e-r)/s+4),u*=60),new t(u,l,o,n)},e.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=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?"#"+r+i+n+o:"#"+r+i+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,r){return void 0===r&&(r=0),new t().setFromArray(e,r)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),new t().setFromHSV(e,r,i,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}();r2.BLACK=new r2(0,0,0,1),r2.BLUE=new r2(0,0,1,1),r2.CLEAR=new r2(0,0,0,0),r2.CYAN=new r2(0,1,1,1),r2.GRAY=new r2(.5,.5,.5,1),r2.GREEN=new r2(0,1,0,1),r2.MAGENTA=new r2(1,0,1,1),r2.RED=new r2(1,0,0,1),r2.WHITE=new r2(1,1,1,1),r2.YELLOW=new r2(1,.92,.016,1);var r3=function(){function t(t,e){void 0===t&&(t=new rV(1/0,1/0,1/0)),void 0===e&&(e=new rV(-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),r=Number(1/0),i=Number(1/0),n=-1/0,o=-1/0,a=-1/0,s=0,u=t.length;s<u;s+=3){var l=t[s],c=t[s+1],h=t[s+2];l<e&&(e=l),c<r&&(r=c),h<i&&(i=h),l>n&&(n=l),c>o&&(o=c),h>a&&(a=h)}return this.min.set(e,r,i),this.max.set(n,o,a),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),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 rV),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 rV),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 r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}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 rV),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 rV;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 rV),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 rV),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new rV),this.isEmpty())return[];var r=[];return r[0]=new rV(this.min.x,this.min.y,this.min.z),r[1]=new rV(this.min.x,this.min.y,this.max.z),r[2]=new rV(this.min.x,this.max.y,this.min.z),r[3]=new rV(this.min.x,this.max.y,this.max.z),r[4]=new rV(this.max.x,this.min.y,this.min.z),r[5]=new rV(this.max.x,this.min.y,this.max.z),r[6]=new rV(this.max.x,this.max.y,this.min.z),r[7]=new rV(this.max.x,this.max.y,this.max.z),r.forEach(function(r){r.subtract(e),r.applyMatrix(t),r.add(e)}),r},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new rV;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}(),r4=function(){function t(t,e){void 0===t&&(t=rV.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 r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var o=new r3().setFromPoints(t);o.getCenter(r),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 r=this.center.distanceSquared(t);return void 0===e&&(e=new rV),e.copyFrom(t),r>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 r3),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=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(r,i,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=new rV().subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=(i-this.radius)*.5;this.center.add(e.multiply(n/i)),this.radius+=n}return this},e.union=function(t){var e=new rV,r=new rV;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},e.intersect=function(t){var e=new rV().subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}(),r5=Object.freeze({__proto__:null,get EulerOrder(){return tV},Euler:rD,Quaternion:rN,Vector2:rP,Vector3:rV,Vector4:r$,Matrix3:r0,Matrix4:rF,Ray:r1,PI2:2*Math.PI,DEG2RAD:rb,RAD2DEG:rw,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:rL,damp:function(t,e,r,i){return rI(t,e,1-Math.exp(-r*i))},lerp:rI,degToRad:function(t){return t*rb},radToDeg:function(t){return t*rw},clamp:rM,Color:r2,Box3:r3,Sphere:r4}),r6=(z=new Int32Array((U=new Float32Array(1)).buffer),function(t){U[0]=t;var e=z[0],r=e>>16&32768,i=e>>12&2047,n=e>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&e):n<113?(i|=2048,r|=(i>>114-n)+(i>>113-n&1)):(r|=n-112<<10|i>>1,r+=1&i)}),r8=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),r=0;r<e.length;r++)e[r]=r6(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=r6(t[r])},t}(),r9=new rD,r7=new rF;function it(t,e,r,i,n,o,a){var s=i/n,u=i,l=e.speedOverLifetime;l&&(u=l.getIntegrateValue(0,i,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;t.copyFrom(o),t.addScaledVector(a,u),t.addScaledVector(r,c);var h=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{},m=["x","y","z"];if(f.enabled){var d=new rV;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),v=f.asRotation,y=m.map(function(t){var e=f[t];return e?v?e.getValue(s):e.getIntegrateValue(0,i,n):0});r9.setFromArray(y).negate(),r7.setFromEuler(r9);var g=r7.transformPoint(p);t.addVectors(d,g)}if(h.enabled)for(var x=h.asMovement,T=0;T<3;T++){var E=h[m[T]];if(E){var _=x?E.getValue(s):E.getIntegrateValue(0,i,n);t.setElement(T,t.getElement(T)+_)}}return t}function ie(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function ir(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function ii(t,e,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)t[n]=e[n+i];return t}function io(t,e,r){if(e&&r)for(var i=0,n=e.length;i<n;i++)t[i]=e[i]*r[i];else if(e){if(t!==e)for(var o=0;o<e.length;o++)t[o]=e[o]}else if(r&&t!==r)for(var a=0;a<r.length;a++)t[a]=r[a];return t}var ia=((en={})[tY.PARTICLE_ORIGIN_CENTER]=[0,0],en[tY.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],en[tY.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],en[tY.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],en[tY.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],en[tY.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],en[tY.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],en[tY.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],en[tY.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],en);function is(t,e,r){var i=r.position,n=new rV(t,e,0),o=new rV;return r.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(i),new r1(i,o)}function iu(t,e,r){var i=t.x,n=t.y,o=t.z,a=new rV(i-e,n+r,o),s=new rV(i-e,n-r,o),u=new rV(i+e,n-r,o),l=new rV(i+e,n+r,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:l}]}var il="not_implement",ic=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(il)},e.getIntegrateValue=function(t,e,r){throw Error(il)},e.getIntegrateByTime=function(t,e){throw Error(il)},e.getValue=function(t){throw Error(il)},e.toUniform=function(t){throw Error(il)},e.map=function(t){throw Error(il)},e.scaleXCoord=function(t){return this},t}(),ih=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onCreate=function(t){this.value=t},r.getIntegrateValue=function(t,e,r){return this.value*(e-t)},r.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},r.getValue=function(t){return this.value},r.toUniform=function(){return new Float32Array([0,this.value,0,0])},r.map=function(t){var e=this.value;return this.value=t(e),this},e}(ic),im=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onCreate=function(t){this.items=t},r.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},r.map=function(t){return this.items=this.items.map(t),this},e}(ic),id=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){return rx(this.min,this.max)},r.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(ic),ip=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var o=Math.random();i[n]=e[n]*(1-o)+r[n]*o}return i},r.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(ic),iv=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},r.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},r.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,o=this.xCoord*r;return((i+e/o*(n-i)+i)*e-(i+t/o*(n-i)+i)*t)/2},r.getIntegrateByTime=function(t,e){return iR(e,0,this.xCoord,this.min,this.max)-iR(t,0,this.xCoord,this.min,this.max)},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},r.scaleXCoord=function(t){return this.xCoord=t,this},e}(ic),iy=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onCreate=function(t){this.stops=rr(t)},r.getStops=function(){return this.stops},r.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1];if(n.stop<=t&&o.stop>t){var a=(t-n.stop)/(o.stop-n.stop);return ri(n.color,o.color,a,!0)}}return e[r].color.slice()},e}(ic),ig=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onCreate=function(t){var e=1/0,r=-1/0;if(Number.isFinite(t[0])&&Number.isFinite(t[1])){for(var i=[],n=2;n<t.length;n++)i.push(t[n].slice(0,4));this.keys=i,this.min=t[0],this.dist=t[1]-t[0]}else{var o=t.map(function(t){if(rv(t))return e=Math.min(e,t[1]),r=Math.max(r,t[1]),t.slice(0,4);if("object"==typeof t&&t){var i=t.time,n=t.value,o=t.inTangent,a=t.outTangent;return e=Math.min(e,n),r=Math.max(r,n),[i,n,void 0===o?0:o,void 0===a?0:a]}throw Error("invalid keyframe")}),a=r-e;if(this.keys=o,0!==a)for(var s=0;s<o.length;s++){var u=o[s];u[1]=(u[1]-e)/a}var l=o[0];l[0]>0&&(l[2]=0,o.unshift([0,l[1],0,0]));var c=o[o.length-1];c[0]<1&&(c[3]=0,o.push([1,c[1],0,0])),this.min=e,this.dist=a}this.isCurveValue=!0},r.getValue=function(t){var e=this.keys,r=this.min,i=this.dist;if(t<=e[0][0])return e[0][1]*i+r;for(var n=e.length-1,o=0;o<n;o++){var a=e[o],s=e[o+1];if(t>a[0]&&t<=s[0])return iS(t,a,s)*i+r}return e[n][1]*i+r},r.getIntegrateByTime=function(t,e){var r=this.integrate(e,!0)-this.integrate(t,!0);return .5*this.min*(e-t)*(e-t)+r*this.dist},r.getIntegrateValue=function(t,e,r){r=r||1;var i=(this.integrate(e/r,!1)-this.integrate(t/r,!1))*r,n=(e-t)/r;return this.min*n+i*this.dist},r.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?ib:iO,a=0;a<n;a++){var s=r[a],u=r[a+1],l=s[0],c=u[0];if(t>l&&t<=c)return i+o(t,s,u);i+=o(c,s,u)}return i},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4)e.set(t[r],i);return e},r.toUniform=function(t){var e=t.index,r=this.keys;return t.curves.push(this),t.index+=r.length,t.max=Math.max(t.max,r.length),t.curveCount+=r.length,new Float32Array([2,e+1/r.length,this.min,this.dist])},r.map=function(t){return this.keys.forEach(function(e){e[1]=t(e[1])}),this},r.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e.getAllData=function(t,e){for(var r=new(e?r8:Float32Array)(4*t.index),i=0,n=0,o=t.curves;i<o.length;i++){var a=o[i].toData();r.set(a,n),n+=a.length}return e?r.data:r},e}(ic),ix=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.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 r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},r.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1],a=n[0],s=o[0];if(t>=a&&t<=s){var u=(t-a)/(s-a),l=n[1];return l+u*(o[1]-l)}}return e[r][1]},r.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},r.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},r.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?iR:iA,a=0;a<n;a++){var s=r[a],u=r[a+1],l=s[0],c=u[0];if(t>l&&t<=c)return i+o(t,l,c,s[1],u[1]);i+=o(c,l,c,s[1],u[1])}return i},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),r=0,i=0;r<t.length;r++,i+=2)e.set(t[r],i);return e.set(t[t.length-1],e.length-2),e},r.toUniform=function(t){var e=t.index,r=Math.ceil(this.keys.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},r.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},r.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(ic),iT=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t[0],this.values=t[1]},r.getValue=function(t){for(var e=this.keys,r=this.values,i=0;i<e.length-1;i++){var n=e[i],o=e[i+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]):(iS(t,n,o)-n[1])/a,this.calculateVec(i,s)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},r.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=[0,0,0],o=0;o<r.length;o++)n[o]=r[o]*(1-e)+i[o]*e;return n},e}(ic),iE=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onCreate=function(e){t.prototype.onCreate.call(this,e),this.cps=e[2]},r.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=this.cps[t+t],o=this.cps[t+t+1],a=[0,0,0],s=1-e,u=s*s*s,l=3*e*s*s,c=3*e*e*s,h=e*e*e,f=0;f<r.length;f++)a[f]=u*r[f]+l*n[f]+c*o[f]+h*i[f];return a},e}(iT),i_=((eo={})[tq.RANDOM]=function(t){return e$(t[0],Array)?new ip(t):new id(t)},eo[tq.CONSTANT]=function(t){return new ih(t)},eo[tq.CONSTANT_VEC2]=function(t){return new ih(t)},eo[tq.CONSTANT_VEC3]=function(t){return new ih(t)},eo[tq.CONSTANT_VEC4]=function(t){return new ih(t)},eo[tq.CURVE]=function(t){return new ig(t)},eo[tq.RGBA_COLOR]=function(t){return new ih(t)},eo[tq.COLORS]=function(t){return new im(t.map(function(t){return rt(t,!1)}))},eo[tq.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new iv([t[0][1],t[1][1]]):new ix(t)},eo[tq.GRADIENT_COLOR]=function(t){return new iy(t)},eo[tq.LINEAR_PATH]=function(t){return new iT(t)},eo[tq.BEZIER_PATH]=function(t){return new iE(t)},eo);function iC(t){if(!t||!isNaN(+t))return new ih(t||0);if(e$(t,ic))return t;if(ry(i_[t[0]]))return i_[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not support")}function iA(t,e,r,i,n){var o=t-e;return(i+i+(n-i)*o/(r-e))*o/2}function iR(t,e,r,i,n){var o=t*t,a=e*e;return(o*t*2*(i-n)+3*o*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function iS(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=(t-e[0])/i,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)*r[1]}function iO(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],u=r[1],l=a-t,c=l*l,h=c*l;return(n+o+2*s-2*u)*h*l/(4*i*i*i)+(2*n+o+3*s-3*u)*h/(3*i*i)+n*c/2/i-s*l}function ib(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],u=r[1],l=a-t,c=l*l,h=c*l,f=i*i,m=f*i;return(-30*m*s*(a+t)*l+10*f*n*(a+2*t)*c+5*i*(a+3*t)*(2*n+o+3*s-3*u)*h+3*(a+4*t)*(n+o+2*s-2*u)*h*l)/60/m}function iw(t,e){if(e){var r=e[0],i=e[1];if(r===tq.CURVE){t.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(r===tq.LINE){var o=i.length;if(2===o&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&o++,i[i.length-1][0]<1&&o++;var a=Math.ceil(o/2);t.lineSegCount+=a,t.curves.push(i),t.index+=a,t.max=Math.max(t.max,a)}}}function iL(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var iI=new rN,iM=1,iP=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new rV(0,0,0),this.quat=new rN(0,0,0,1),this.rotation=new rD(0,0,0),this.scale=new rV(1,1,1),this.anchor=new rV(0,0,0),this.size=new rP(1,1),this.children=[],this.worldMatrix=rF.fromIdentity(),this.localMatrix=rF.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new rV(0,0,0),quat:new rN(0,0,0,1),scale:new rV(1,1,1)},this.name="transform_"+iM++,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,r){(this.position.x!==t||this.position.y!==e||this.position.z!==r)&&(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,r){(0!==t||0!==e||0!==r)&&(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,r){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==r)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,r,i){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==r||this.quat.w!==i)&&(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=i,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,r){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==r)&&(this.scale.x=t,this.scale.y=e,this.scale.z=r,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,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,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 r=t.position,i=t.rotation,n=t.scale,o=t.size,a=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),r&&(e$(r,rV)?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),a)e$(a,rN)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(i){var l=e?-1:1;e$(i,rD)?this.setRotation(i.x*l,i.y*l,i.z*l):this.setRotation(i[0]*l,i[1]*l,i[2]*l)}n&&(e$(n,rV)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),u&&(e$(u,rP)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){e8(this.children,t)},e.removeChild=function(t){e9(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new rD)},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 rD)},e.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.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 rV().copyFrom(t.position),rotation:new rD(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new rV().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 r=iI.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},rC(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}();t.CameraController=function(t){function e(e,r){var i;return i=t.call(this,e)||this,r&&i.fromData(r),i}rR(e,t);var r=e.prototype;return r.start=function(){this.options.position=this.transform.position.clone(),this.options.rotation=this.transform.getRotation().clone()},r.update=function(){var t=this.item.lifetime;if(!(t<0)&&this.item.transform.getValid()){var e=new rN,r=new rV,i=new rD;r.copyFrom(this.options.position),i.copyFrom(this.options.rotation);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(t=rM(t,0,1),n&&(r.x+=n.x.getValue(t),r.y+=n.y.getValue(t),r.z+=n.z.getValue(t),n.path)){var a=n.path.getValue(t);r.x+=a[0],r.y+=a[1],r.z+=a[2]}if(o){var s=o.z.getValue(t);i.z+=s,o.separateAxes?(i.x+=o.x.getValue(t),i.y+=o.y.getValue(t)):(i.x+=s,i.y+=s)}this.far=this.options.far.getValue(t),this.near=this.options.near.getValue(t),this.fov=this.options.fov.getValue(t),this.transform.setPosition(r.x,r.y,r.z),this.transform.setRotation(i.x,i.y,i.z),this.transform.assignWorldTRS(r,e),this.position=r,this.rotation=iP.getRotation(e,i),this.updateCamera()}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.options,i=r.near,n=r.far,o=r.fov,a=r.clipMode;if(this.clipMode=a,this.options={position:new rV,rotation:new rD,near:iC(i),far:iC(n),fov:iC(o)},e.positionOverLifetime){var s=e.positionOverLifetime,u=s.path,l=s.linearX,c=s.linearY,h=s.linearZ;this.translateOverLifetime={path:u&&iC(u),x:iC(void 0===l?0:l),y:iC(void 0===c?0:c),z:iC(void 0===h?0:h)}}if(e.rotationOverLifetime){var f=e.rotationOverLifetime,m=f.separateAxes,d=f.x,p=f.y,v=f.z;this.rotationOverLifetime={separateAxes:m,x:iC(void 0===d?0:d),y:iC(void 0===p?0:p),z:iC(void 0===v?0:v)}}},r.updateCamera=function(){if(this.item.composition){var t=this.item.composition.camera;t.near=this.near,t.far=this.far,t.fov=this.fov,t.clipMode=this.clipMode,t.position=this.position,t.rotation=this.rotation}},e}(rK),t.CameraController=e1([rj(er.CameraController)],t.CameraController);var iV=function(t){function e(){return t.apply(this,arguments)}return rR(e,t),e}(rJ);t.HitTestType=void 0,(k=t.HitTestType||(t.HitTestType={}))[k.triangle=1]="triangle",k[k.box=2]="box",k[k.sphere=3]="sphere",k[k.custom=4]="custom";var iN="click",iF="touchstart",iD="touchmove",iU="touchend",iz=tG,ik=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,r,i,n,o,a=this;n=function(t){return t};var s="mousedown",u="mousemove",l="mouseup",c=function(t,e,r,n,o){void 0===n&&(n=0),void 0===o&&(o=0);var s=a.target,u=s.width,l=s.height,c=performance.now(),h=0,f=0;if(i){var m=c-i.ts;h=(n-i.dx)/m||0,f=(o-i.dy)/m||0,i={dx:n,dy:o,ts:c}}return{x:e,y:r,vx:h,vy:f,dx:n,dy:o,ts:c,width:u,height:l,origin:t}};ra()&&(n=function(t){var e=t.touches,r=t.changedTouches;return e[0]||r[0]},s="touchstart",u="touchmove",l="touchend"),this.nativeHandlers=((o={})[s]=function(o){if(a.enabled){var s=n(o),u=iB(s);t=u.x,e=u.y,i=r={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:e},a.dispatchEvent(iF,c(o,t,e))}},o[u]=function(i){if(r&&a.enabled){var o=iB(n(i));t=o.x,e=o.y,a.dispatchEvent(iD,c(i,t,e,t-r.x,e-r.y))}},o[l]=function(i){if(r&&a.enabled){!a.allowPropagation&&i.cancelable&&(i.preventDefault(),i.stopPropagation());var o=n(i),s=iB(o),u=Math.abs(r.clientX-o.clientX)+Math.abs(r.clientY-o.clientY);t=s.x,e=s.y,u<4&&a.dispatchEvent(iN,c(i,t,e)),a.dispatchEvent(iU,c(i,t,e,t-r.x,e-r.y))}r=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 r=this.handlers[t];null==r||r.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),e8(r,e),function(){e9(r,e)}},e.removeEventListener=function(t,e){var r=this.handlers[t];r&&e9(r,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var r;null==(r=t.target)||r.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={},this.target=null)},t}();function iB(t){var e=t.target,r=t.clientX,i=t.clientY,n=e.getBoundingClientRect(),o=n.left,a=n.top;return{x:(r-o)/n.width*2-1,y:1-(i-a)/n.height*2}}var iG=function(t){function e(){return t.apply(this,arguments)}return rR(e,t),e}(rJ),iX="editor",iH={"Filter not imported":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg","Item duration can't be less than 0":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"},iY=[],ij={};function iW(){"function"==typeof WebGL2RenderingContext?iZ(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iZ(WebGLRenderingContext),iZ(WebGLRenderingContext.prototype)):iY.push("iOS16 lockdown mode, WebGL Constants not in global"),iY.length||"HALF_FLOAT"in ij||(ij.HALF_FLOAT=5131)}function iZ(t){for(var e in t)/^[A-Z_]/.test(e)&&(ij[e]=t[e])}function iq(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}}iY.length||iW(),t.ShaderType=void 0,(B=t.ShaderType||(t.ShaderType={}))[B.vertex=0]="vertex",B[B.fragment=1]="fragment";var iK=((ea={})[t.ShaderType.vertex]={in:"attribute",out:"varying"},ea[t.ShaderType.fragment]={in:"varying"},ea);function iQ(t,e,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),t&&(t.forEach(function(t){var e=t[0],r=t[1];!0===r?n.push("#define "+e):Number.isFinite(r)&&n.push("#define "+e+" "+r)}),o=n.length?n.join("\n")+"\n":"");var a="WEBGL"+i,s=(o=o+("\n#ifndef "+a)+"\n#define "+a+"\n#endif")+"\n"+e,u=s.match(/#version\s+\b\d{3}\b\s*(es)?/),l=u?u[0]:"";if(l&&l.includes("300")){var c=RegExp(""+l,"g");1===i&&(s=s.replace(/\b(in|out)\b/g,function(t){var e;return null!=(e=iK[r][t])?e:t})),s=s.replace(c,"\n")}return s}function iJ(t,e){switch(e){case void 0:case tF.ALPHA:t.blendFunction=[ij.ONE,ij.ONE_MINUS_SRC_ALPHA,ij.ONE,ij.ONE_MINUS_SRC_ALPHA];break;case tF.ADD:t.blendFunction=[ij.ONE,ij.ONE,ij.ONE,ij.ONE];break;case tF.SUBTRACTION:t.blendFunction=[ij.ONE,ij.ONE,ij.ZERO,ij.ONE],t.blendEquation=[ij.FUNC_REVERSE_SUBTRACT,ij.FUNC_REVERSE_SUBTRACT];break;case tF.SUPERPOSITION:t.blendFunction=[ij.ONE,ij.ONE,ij.ONE,ij.ONE];break;case tF.MULTIPLY:t.blendFunction=[ij.DST_COLOR,ij.ONE_MINUS_SRC_ALPHA,ij.DST_COLOR,ij.ONE_MINUS_SRC_ALPHA];break;case tF.BRIGHTNESS:t.blendFunction=[ij.ONE,ij.ONE_MINUS_SRC_ALPHA,ij.ONE,ij.ONE_MINUS_SRC_ALPHA];break;case tF.STRONG_LIGHT:t.blendFunction=[ij.DST_COLOR,ij.DST_ALPHA,ij.ZERO,ij.ONE];break;case tF.WEAK_LIGHT:t.blendFunction=[ij.DST_COLOR,ij.ZERO,ij.ZERO,ij.ONE];break;default:console.warn("blendMode "+e+" not in specification, please set blend params separately")}}function i$(t,e){e===tD.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=ij.CW,t.cullFace=e===tD.BACK?ij.BACK:ij.FRONT)}function i0(t,e){switch(e){case void 0:t.stencilTest=!1;break;case tU.MASK:t.stencilTest=!0,t.stencilFunc=[ij.ALWAYS,ij.ALWAYS],t.stencilOpZPass=[ij.REPLACE,ij.REPLACE];break;case tU.OBSCURED:t.stencilTest=!0,t.stencilFunc=[ij.EQUAL,ij.EQUAL];break;case tU.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[ij.NOTEQUAL,ij.NOTEQUAL];break;case tU.NONE:t.stencilTest=!1;break;default:console.warn("maskMode "+e+" not in specification, please set stencil params seperately")}}function i1(){return(i1=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t}).apply(this,arguments)}t.TextureLoadAction=void 0,(G=t.TextureLoadAction||(t.TextureLoadAction={}))[G.whatever=0]="whatever",G[G.clear=2]="clear",t.TextureSourceType=void 0,(X=t.TextureSourceType||(t.TextureSourceType={}))[X.none=0]="none",X[X.data=1]="data",X[X.image=2]="image",X[X.compressed=3]="compressed",X[X.video=4]="video",X[X.canvas=5]="canvas",X[X.framebuffer=6]="framebuffer",X[X.mipmaps=7]="mipmaps";var i2=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},e.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},e.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},e.download=function(t,e,r,i){var n=this;if(void 0===e&&(e="json"),!this.start(t,r,i)){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,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},e.finish=function(t,e,r){var i=this.callbacks[t];delete this.callbacks[t];for(var n=200==e||0==e?[r]:[e,r],o=n.length-1,a=i.length;o<a;o+=2)i[o].apply(null,n)},t}(),i3=!1;function i4(t,e){return i5.apply(this,arguments)}function i5(){return(i5=eJ(function(t,e){return e2(this,function(r){switch(r.label){case 0:if(!(i3||!e))return[3,2];return[4,i6(t)];case 1:case 5:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,i6(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),i3=!0,[4,i6(t)];case 6:return[2]}})})).apply(this,arguments)}function i6(t){return i8.apply(this,arguments)}function i8(){return(i8=eJ(function(t){var e,r;return e2(this,function(i){if(e="",e$(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else e$(t,Blob)?(e=URL.createObjectURL(t),r=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t));return[2,new Promise(function(t,i){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,r&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,r&&URL.revokeObjectURL(e),i("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function i9(t){return i7.apply(this,arguments)}function i7(){return(i7=eJ(function(t){return e2(this,function(e){return[2,new Promise(function(e,r){new i2().downloadBinary(t,e,function(e,i){r("Couldn't load bins "+t+": status "+e+", "+i)})})]})})).apply(this,arguments)}function nt(){return(nt=eJ(function(t){return e2(this,function(e){return[2,new Promise(function(e,r){new i2().downloadBlob(t,e,function(e,i){r("Couldn't load blob "+t+": status "+e+", "+i)})})]})})).apply(this,arguments)}function ne(t){return nr.apply(this,arguments)}function nr(){return(nr=eJ(function(t){var e;return e2(this,function(r){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,ro()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,r){var i=e.play();i?i.then(function(){return t(e)}):e.addEventListener("loadeddata",function r(){t(e),e.removeEventListener("loadeddata",r)},!0),e.addEventListener("error",function(t){r(t)})})]})})).apply(this,arguments)}function ni(t,e){return nn.apply(this,arguments)}function nn(){return(nn=eJ(function(t,e){return e2(this,function(r){switch(r.label){case 0:if(!Array.isArray(t))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,r.sent()];case 3:return r.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function no(t,e){return na.apply(this,arguments)}function na(){return(na=eJ(function(e,r,i){var n,o,a,s,u,l,c,h;return e2(this,function(f){switch(f.label){case 0:if(void 0===i&&(i=[]),34067!==e.target)return[3,2];return n=e.mipmaps,o=e.target,[4,Promise.all(n.map(function(t){return Promise.all(t.map(function(t){return ns(t,r)}))}))];case 1:return a=f.sent(),s=i[n[0][0][1][0]].url,[2,i1({keepImageSource:!1},e,{mipmaps:a,sourceFrom:{target:o,bin:s,type:t.TextureSourceType.mipmaps,mipmaps:n.map(function(t){return t.map(function(t){return[t[1][1],t[1][2]]})})}})];case 2:return u=e.mipmaps,l=e.target,[4,Promise.all(u.map(function(t){return ns(t,r)}))];case 3:return c=f.sent(),h=i[u[0][1][0]].url,[2,i1({keepImageSource:!1},e,{mipmaps:c,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:l,bin:h,type:t.TextureSourceType.mipmaps,mipmaps:u.map(function(t){return[t[1][1],t[1][2]]})}})];case 4:return[2]}})})).apply(this,arguments)}function ns(t,e){return nu.apply(this,arguments)}function nu(){return(nu=eJ(function(t,e){var r,i,n,o,a;return e2(this,function(s){if(i=(r=t[1])[0],n=r[1],o=r[2],!(a=e[i]))throw Error("invalid bin pointer: "+JSON.stringify(t));return[2,i6(new Blob([new Uint8Array(a,n,o)]))]})})).apply(this,arguments)}var nl=1,nc=function(e){function r(t){var r;return(r=e.call(this,t)||this).destroyed=!1,r.id="Tex"+nl++,r}rR(r,e);var i=r.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(e){var r=e.target,i=void 0===r?ij.TEXTURE_2D:r,n=e.format,o=void 0===n?ij.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),i1({minFilter:ij.NEAREST,magFilter:ij.NEAREST,wrapS:ij.CLAMP_TO_EDGE,wrapT:ij.CLAMP_TO_EDGE,target:i,format:ij.RGBA,internalFormat:o,type:ij.UNSIGNED_BYTE},e)},r.fromImage=function(e,i){return eJ(function(){var n,o;return e2(this,function(a){switch(a.label){case 0:return[4,i6(e)];case 1:return n=a.sent(),(o=r.create(i,{sourceType:t.TextureSourceType.image,image:n,id:rE()})).initialize(),[2,o]}})})()},rC(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(rW);function nh(t,e,r,i){var n,o,a=e.length/r/i;return o=n=4===a||0===a?ij.RGBA:3===a?ij.RGB:2===a?ij.LUMINANCE_ALPHA:ij.LUMINANCE,nc.createWithData(t,{data:e,width:r,height:i},{type:ij.HALF_FLOAT,format:n,internalFormat:o,wrapS:ij.CLAMP_TO_EDGE,wrapT:ij.CLAMP_TO_EDGE})}var nf=function(){function t(t,e,r){void 0===r&&(r=0),this.arrayBuffer=t,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[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){rm.warn("Only 2D textures currently supported");return}if(0!==this.numberOfArrayElements){rm.warn("Texture arrays not currently supported");return}if(this.numberOfFaces!==e){rm.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=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var l=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,s);e.push({data:l,width:i,height:n}),r+=s+4+(3-(s+3)%4)}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function nm(e){var r=new nf(e,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,l=r.glFormat;return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?ij.TEXTURE_CUBE_MAP:ij.TEXTURE_2D,internalFormat:u,format:l,mipmaps:r.mipmaps(i>=Math.floor(Math.log2(Math.max(n,o))+1))}}var nd=function(){function e(){this.reloadPending={}}var r=e.prototype;return r.reload=function(t){var e=this;return eJ(function(){var r,i;return e2(this,function(n){switch(n.label){case 0:if(r=t.id,e.reloadPending[r])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[r]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return i=n.sent(),t.updateSource(i),e.reloadPending[r]=!1,[3,3];case 2:throw Error("No source from");case 3:return[2]}})})()},r.canOffloadTexture=function(e){if(e){var r=e.type;if(r===t.TextureSourceType.compressed||r===t.TextureSourceType.image){var i=e.target,n=e.map,o=e.url;return i===ij.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:rp(o)&&o.length>0}if(r===t.TextureSourceType.mipmaps){var a=e.bin,s=e.mipmaps,u=e.target,l=e.maps,c=e.urls;return a?s.length>0:u===ij.TEXTURE_CUBE_MAP?l.every(function(t){return"object"==typeof t&&t}):c.every(function(t){return rp(t)&&t.length>0})}}return!1},r.loadSource=function(e,r){var i=this;return eJ(function(){var n,o,a,s,u,l,c,h,f,m,d,p,v,y,g,x,T,E;return e2(this,function(_){switch(_.label){case 0:if(n=e.type,o=e.target,a=e.map,s=e.url,u=e.bin,l=e.mipmaps,c=e.urls,h=e.maps,!(o===ij.TEXTURE_CUBE_MAP&&n!==t.TextureSourceType.mipmaps))return[3,2];return[4,i.loadCubeMap(a)];case 1:return f=_.sent(),[2,i1({},r,{cube:f,target:ij.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:i1({},a),target:ij.TEXTURE_CUBE_MAP}})];case 2:if(n!==t.TextureSourceType.image)return[3,4];return[4,i6(s)];case 3:return m=_.sent(),[2,i1({},r,{image:m,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:s,target:ij.TEXTURE_2D}})];case 4:if(n!==t.TextureSourceType.video)return[3,6];return[4,ne(s)];case 5:return d=_.sent(),[2,i1({},r,{video:d,sourceType:t.TextureSourceType.video})];case 6:if(n!==t.TextureSourceType.compressed)return[3,8];return[4,i9(s)];case 7:return p=_.sent(),[2,i1({},nm(p),r,{sourceFrom:{url:s,type:t.TextureSourceType.compressed}})];case 8:if(n!==t.TextureSourceType.mipmaps)return[3,17];if(!u)return[3,13];return[4,i9(u)];case 9:if(v=_.sent(),g=(y=null!=o?o:ij.TEXTURE_2D)===ij.TEXTURE_2D?l.slice():l.map(function(t){return t.slice()}),o!==ij.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(l.map(function(t){return i.loadMipmapImages(t,v)}))];case 10:return x=_.sent(),[3,12];case 11:x=i.loadMipmapImages(l,v),_.label=12;case 12:return[2,i1({},r,{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:if(!(o===ij.TEXTURE_2D||!o))return[3,15];return[4,Promise.all(c.map(function(t){return i6(t)}))];case 14:return T=_.sent(),[2,i1({},r,{mipmaps:T,target:ij.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:c.slice(),target:ij.TEXTURE_2D}})];case 15:if(o!==ij.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(h.map(function(t){return i.loadCubeMap(t)}))];case 16:return E=_.sent(),[2,i1({},r,{mipmaps:E,target:ij.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:h.map(function(t){return i1({},t)}),target:ij.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+n)}})})()},r.loadMipmapImages=function(t,e){return eJ(function(){return e2(this,function(r){return[2,Promise.all(t.map(function(t){return i6(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},r.loadCubeMap=function(t){return eJ(function(){return e2(this,function(e){return[2,Promise.all(t.map(function(t){return i6(t)}))]})})()},e}(),np=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(r){e.setUniformValue(r,t[r])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,r){},t}();function nv(t){return"object"==typeof t&&t&&void 0===t.length&&e$(t,nc)}t.MaterialRenderType=void 0,(H=t.MaterialRenderType||(t.MaterialRenderType={}))[H.normal=0]="normal",H[H.transformFeedback=1]="transformFeedback";var ny=1,ng=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).stringTags={},i.destroyed=!1,i.initialized=!1,r){var n=r.name,o=void 0===n?"Material"+ny++:n,a=r.renderType,s=r.shader,u=r.uniformSemantics;i.name=o,i.renderType=void 0===a?0:a,i.shaderSource=s,i.props=r,i.uniformSemantics=i1({},u)}else i.name="Material"+ny++,i.renderType=0;return i}rR(e,t);var r=e.prototype;return r.initialize=function(){},r.use=function(t,e){},rC(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}(rW);t.ShaderCompileResultStatus=void 0,(Y=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[Y.noShader=0]="noShader",Y[Y.success=1]="success",Y[Y.fail=2]="fail",Y[Y.compiling=3]="compiling",t.GLSLVersion=void 0,(j=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",j.GLSL3="300 es";var nx=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).source=r,i}return rR(e,t),e}(rW);t.Shader=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.createVariant=function(t){var e=[];if(t)for(var r,i=rO(Object.keys(t));!(r=i()).done;){var n=r.value;e.push([n,t[n]])}var o=this.engine.getShaderLibrary().createShader(this.shaderData,e);return o.shader=this,o},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(rW),t.Shader=e1([rj("Shader")],t.Shader);var nT="effects-internal-copy",nE="effects-internal-copy-mesh",n_="\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",nC="precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n";function nA(e,r){var i=2===e,n=i?"#version 300 es":"";return{name:nT,vertex:n+"\n"+n_,fragment:n+"\n"+nC,glslVersion:i?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:nE+ +r}}var nR={format:ij.RGBA,type:ij.UNSIGNED_BYTE,minFilter:ij.LINEAR,magFilter:ij.LINEAR,wrapS:ij.CLAMP_TO_EDGE,wrapT:ij.CLAMP_TO_EDGE},nS=Symbol("dispose"),nO=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var r=e.prototype;return r.requestColorAttachmentTexture=function(e){var r=this,i=e.width,n=e.height,o=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:i,height:n},name:o},s=[o];Object.getOwnPropertyNames(nR).forEach(function(t){var r,i=null!=(r=e[t])?r:nR[t];a[t]=i,s.push(t,i)});var u=s.join(":"),l=this.textureCache[u];if(l)this.textureRef[u]++;else{var c=this.engine;rh(c),l=nc.create(c,a),this.textureCache[u]=l,this.textureRef[u]=1,l[nS]=l.dispose,l.dispose=function(){return r.removeTexture(u)}}return l},r.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("ref count < 0");var r=this.textureCache[t];r&&(r[nS](),r.dispose=r[nS]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},r.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var r=t.textureCache[e];r[nS](),r.dispose=r[nS]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),nb=function(){function t(t){void 0===t&&(t={}),this.semantics=i1({},t)}var e=t.prototype;return e.toObject=function(){return i1({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var r=this.semantics[t];return ry(r)?r(e):r},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}(),nw=((eu={})[ij.FLOAT]=Float32Array.BYTES_PER_ELEMENT,eu[ij.INT]=Int32Array.BYTES_PER_ELEMENT,eu[ij.SHORT]=Int16Array.BYTES_PER_ELEMENT,eu[ij.BYTE]=Int8Array.BYTES_PER_ELEMENT,eu),nL=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.initialize=function(){},r.flush=function(){},e}(rW);function nI(t){return t===ij.INT?new Int32Array(0):t===ij.SHORT?new Int16Array(0):new Float32Array(0)}var nM=1,nP=function(e){function r(t,r){var i;if((i=e.call(this,t)||this).destroyed=!1,i.visible=!0,r){var n=r.material,o=r.geometry,a=r.name,s=r.priority,u=r.worldMatrix,l=void 0===u?rF.fromIdentity():u;i.id="Mesh"+nM++,i.name=void 0===a?"<unnamed>":a,i.geometry=o,i.material=n,i.priority=void 0===s?0:s,i.worldMatrix=l}else i.id="Mesh"+nM++,i.name="<unnamed>",i.worldMatrix=rF.fromIdentity(),i._priority=0;return i}rR(r,e);var i=r.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){!this.isDestroyed&&this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},i.restore=function(){},i.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var r=null==e?void 0:e.material;r!==t.DestroyOptions.keep&&this.material.dispose(r),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},rC(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(rQ);t.RenderPassAttachmentStorageType=void 0,(W=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[W.none=0]="none",W[W.color=1]="color",W[W.stencil_8_opaque=2]="stencil_8_opaque",W[W.depth_16_opaque=3]="depth_16_opaque",W[W.depth_stencil_opaque=4]="depth_stencil_opaque",W[W.depth_16_texture=5]="depth_16_texture",W[W.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(Z=t.TextureStoreAction||(t.TextureStoreAction={}))[Z.store=0]="store",Z[Z.clear=2]="clear";var nV=function(){function e(e,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(e$(i,nc))this.texture=i,this.externalTexture=!0;else if(i){var o=i.wrapT,a=i.wrapS,s=i.minFilter,u=i.magFilter,l=i.internalFormat,c=i.format,h=void 0===c?ij.RGBA:c,f=i.type,m=void 0===f?ij.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:h,type:m,internalFormat:l||h,wrapT:o,wrapS:a,minFilter:s,magFilter:u,name:r.name},this.texture=nc.create(e,i1({},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)},rC(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,(q=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[q.force=0]="force",q[q.keep=1]="keep",q[q.keepExternal=2]="keepExternal",q[q.destroy=0]="destroy";var nN=1,nF=function(){function e(e,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+nN++:i,o=r.clearAction,a=r.semantics,s=r.depthStencilAttachment,u=r.storeAction,l=r.priority,c=r.meshOrder,h=void 0===c?t.OrderType.ascending:c,f=r.meshes,m=r.delegate;this.name=n,this.renderer=e,this.priority=void 0===l?0:l,this.meshOrder=h,this.meshes=ru((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=i1({},o),this.storeAction=i1({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new nb(a),this.options=r,this.delegate=void 0===m?{}:m,this.setViewportOptions(r)}var r=e.prototype;return r.addMesh=function(t){rl(this.meshes,t,this.meshOrder)},r.removeMesh=function(t){e9(this.meshes,t)},r.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),ru(this.meshes,this.meshOrder),this.meshes},r.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},r.configure=function(t){if(this.frameBuffer)t.setFrameBuffer(this.frameBuffer);else{var e=this.getViewport(),r=e[0],i=e[1],n=e[2],o=e[3];t.setViewport(r,i,n,o)}},r.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},r.frameCleanup=function(t){},r.resetColorAttachments=function(e){var r=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=e.map(function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new nV(r.renderer.engine,{texture:e})});this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments=i,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}})})},r.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},r.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)},r._resetAttachments=function(){var t,e,r=this,i=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,i.getWidth()*o,i.getHeight()*o],s=[a[2],a[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var l=n.attachments.map(function(t,e){var i;return new nV(r.renderer.engine,i1({size:s,name:(null==(i=t.texture)?void 0:i.name)||u+"##color_"+e},t))});this.attachments=l;var c=oe.create({storeAction:this.storeAction,name:u,viewport:a,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:l.map(function(t){return t.texture}),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},i);c.bind(),c.unbind(),this.frameBuffer=c}else this.attachments.length=0},r.getViewport=function(){var t,e=(null==(t=this.frameBuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},r.getDepthAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:t.getDepthTexture()?this.getDepthTexture(t.getDepthTexture(),t.externalStorage):void 0}},r.getStencilAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:t.getStencilTexture()?this.getStencilTexture(t.getStencilTexture(),t.externalStorage):void 0}},r.getDepthTexture=function(t,e){if(!this.depthTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},r.getStencilTexture=function(t,e){if(!this.stencilTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},r.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},r.dispose=function(e){if(!this.destroyed){var r,i,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==(r=this.stencilTexture)||r.dispose(),null==(i=this.depthTexture)||i.dispose())),this.options=this.renderer=null,this.initialize=rT}},rC(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}(),nD="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",nU="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}",nz="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;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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;}",nk="#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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\nin float vLife;in vec2 vTexCoord;in 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\nin vec4 vTexCoordBlend;\n#endif\nin 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(){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);fragColor=color;}\n#endif\n",nB="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}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;}else 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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}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.;}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#pragma EDITOR_VERT_DEFINE\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\nout float vLife;out vec4 vColor;out 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#pragma EDITOR_VERT_TRANSFORM\n}}",nG="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in 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\nout float vLife;out vec2 vTexCoord;out 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}",nX="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",nH="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",nY="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);}",nj="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);}",nW="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);}",nZ="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}",nq=function(e){function r(r,i){var n,o=(n=e.call(this,r,i)||this).renderer.engine,a=nL.create(o,{mode:ij.TRIANGLE_STRIP,attributes:{aPos:{type:ij.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=ng.create(o,{shader:{vertex:nX,fragment:nZ,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=nP.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}rR(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFrameBuffer(this.frameBuffer)},i.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 r=e.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",r),e.renderMeshes([this.screenMesh])},r}(nF),nK=function(e){function r(r,i,n){(o=e.call(this,r,n)||this).type=i;var o,a=o.renderer.engine,s="PostProcess",u=nL.create(a,{name:s,mode:ij.TRIANGLE_STRIP,attributes:{aPos:{type:ij.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),l={vertex:nX,fragment:"H"==i?nY:nj,glslVersion:t.GLSLVersion.GLSL1},c=ng.create(a,{name:s,shader:l});return c.blending=!1,c.depthTest=!1,c.culling=!1,o.screenMesh=nP.create(a,{name:s,geometry:u,material:c,priority:0}),o.priority=5e3,o}rR(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},i.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",n3(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFrameBuffer().getColorTextures()[0])},r}(nF),nQ=function(e){function r(t,r){i=e.call(this,t,r)||this;var i,n="PostProcess",o=i.renderer.engine,a=nL.create(o,{name:n,mode:ij.TRIANGLE_STRIP,attributes:{aPos:{type:ij.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=ng.create(o,{name:n,shader:{vertex:nX,fragment:nW}});return s.blending=!1,s.depthTest=!1,s.culling=!1,i.screenMesh=nP.create(o,{name:n,geometry:a,material:s,priority:0}),i.priority=5e3,i}rR(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},i.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",n3(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},r}(nF),nJ=function(e){function r(r,i){n=e.call(this,r,{})||this;var n,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new nV(a);var s=nL.create(a,{name:o,mode:ij.TRIANGLE_STRIP,attributes:{aPos:{type:ij.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=ng.create(a,{name:o,shader:{vertex:nX,fragment:nH,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=nP.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}rR(r,e);var i=r.prototype;return i.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFrameBuffer(null)},i.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var r=e.renderingData.currentFrame.globalVolume,i=r.useBloom,n=r.bloomIntensity,o=r.brightness,a=r.saturation,s=r.contrast,u=r.useToneMapping,l=r.vignetteIntensity,c=r.vignetteSmoothness,h=r.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",i),i&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",n)),l>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",l),this.screenMesh.material.setFloat("_VignetteSmoothness",c),this.screenMesh.material.setFloat("_VignetteRoundness",h),this.screenMesh.material.setVector2("_VignetteCenter",new rP(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new rV(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",u),e.renderMeshes([this.screenMesh])},r}(nF),n$={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,vignetteIntensity:.2,vignetteSmoothness:.4,vignetteRoundness:1,useToneMapping:1},n0="_effects_default_",n1=1,n2=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var r=e.camera,i=e.keepColorBuffer,n=e.renderer,o=e.editorTransform,a=e.globalVolume,s=e.clearAction,u=void 0===s?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:s,l=n.engine;a&&(this.globalVolume=i1({},n$,a)),this.globalUniforms=new n5;var c=[],h={};if(this.renderer=n,this.globalVolume){var f=this.globalVolume.useHDR?ij.HALF_FLOAT:ij.UNSIGNED_BYTE;c=[{texture:{format:ij.RGBA,type:f,magFilter:ij.LINEAR,minFilter:ij.LINEAR}}],p={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},h={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var m=[new nF(n,{name:n0,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:p,attachments:c,clearAction:h})];if(this.setRenderPasses(m),this.globalVolume){var d,p,v,y=this.globalVolume.useBloom,g=new nV(l);if(y){var x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],T=Array(7),E=this.globalVolume.useHDR?ij.HALF_FLOAT:ij.UNSIGNED_BYTE,_=new nq(n,{name:"BloomThresholdPass",attachments:[{texture:{format:ij.RGBA,type:E,minFilter:ij.LINEAR,magFilter:ij.LINEAR}}]});_.sceneTextureHandle=g,this.addRenderPass(_);for(var C=0;C<7;C++){T[C]=new nV(l);var A=new nK(n,"H",{name:"GaussianDownPassH"+C,viewport:x,attachments:[{texture:{format:ij.RGBA,type:E,minFilter:ij.LINEAR,magFilter:ij.LINEAR}}]}),R=new nK(n,"V",{name:"GaussianDownPassV"+C,viewport:x,attachments:[{texture:{format:ij.RGBA,type:E,minFilter:ij.LINEAR,magFilter:ij.LINEAR}}]});R.gaussianResult=T[C],this.addRenderPass(A),this.addRenderPass(R),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var S=0;S<6;S++){var O=new nQ(n,{name:"GaussianUpPass"+S,viewport:x,attachments:[{texture:{format:ij.RGBA,type:E,minFilter:ij.LINEAR,magFilter:ij.LINEAR}}]});O.gaussianDownSampleResult=T[5-S],this.addRenderPass(O),x[2]*=2,x[3]*=2}}v=y?new nJ(n,g):new nJ(n),this.addRenderPass(v)}this.semantics=new nb(e.semantics),this.clearAction=u,this.name="RenderFrame"+n1++;var b=m[0],w={type:ij.UNSIGNED_BYTE,format:ij.RGBA,internalFormat:ij.RGBA,wrapS:ij.MIRRORED_REPEAT,wrapT:ij.MIRRORED_REPEAT,minFilter:ij.NEAREST,magFilter:ij.NEAREST};this.emptyTexture=nc.create(l,i1({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},w)),this.transparentTexture=nc.create(l,i1({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},w)),this.camera=r,this.keepColorBuffer=i,this.renderPassInfoMap.set(b,{listStart:0,listEnd:0,renderPass:b,intermedia:!1}),this.editorTransform=r$.fromArray(void 0===o?[1,1,0,0]:o),e.clearAction||this.resetClearActions(),this.passTextureCache=new nO(l);var L=l.gpuCapability,I=L.detail,M=nA(L.level,I.readableDepthStencilTextures&&I.writableFragDepth);null==(d=this.renderer.getShaderLibrary())||d.addShader(M)}var r=e.prototype;return r.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},r.removeMeshFromDefaultRenderPass=function(t){},r.dispose=function(e){(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var r,i,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==(i=this.resource.depthStencil)||null==(r=i.texture)||r.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},r.resetRenderPassDefaultAttachment=function(t,e){for(var r=this.resource,i=r.color_a,n=r.color_b,o=e;o<t.length;o++){var a,s,u,l=t[o],c=null==(s=l.attachments[0])?void 0:s.texture;if(c&&a===c){var h=c===i?n:i;l.resetColorAttachments([h])}(c=null==(u=l.attachments[0])?void 0:u.texture)&&(a=c)}},r.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(r,i){return!(r.name.startsWith(n0)&&r.meshes.includes(t))||(e=i,!1)}),e},r.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e)},r.getRPAttachments=function(t,e){if((null==t?void 0:t.length)===1){var r,i=t[0],n=i.texture,o=i.persistent,a=n.format,s=null!=(r=null==e?void 0:e.getInitAttachments())?r:[];if(a===ij.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},r.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)},r.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach(function(t){return t.initialize(e.renderer)}),this._renderPasses=t.slice()},r.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},r.createResource=function(){var e=this.renderer.engine;if(!this.resource){var r,i=e.gpuCapability,n=i.detail,o=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?ij.LINEAR:ij.NEAREST,l=nc.create(e,{sourceType:t.TextureSourceType.framebuffer,format:ij.RGBA,name:"frame_a",minFilter:u,magFilter:u}),c=nc.create(e,{sourceType:t.TextureSourceType.framebuffer,format:ij.RGBA,data:{width:a,height:s},minFilter:u,magFilter:u,name:"frame_b"}),h=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new nF(this.renderer,{depthStencilAttachment:{storageType:h},attachments:[{texture:l}]}).initialize(this.renderer),m=new n4(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==(r=f.getDepthAttachment())?void 0:r.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:c,finalCopyRP:m,depthStencil:f.depthAttachment,resRP:f}}},r.createCopyMesh=function(t){var e=this.renderer.engine,r=nL.create(e,{name:nT,mode:ij.TRIANGLE_STRIP,attributes:{aPos:{type:ij.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),i=nA(e.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(i);var n=ng.create(e,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:nT,shader:i});return n.blending=!1,n.depthTest=!1,n.culling=!1,(null==t?void 0:t.blend)&&(n.blending=!0,n.blendFunction=[ij.SRC_ALPHA,ij.ONE_MINUS_SRC_ALPHA,ij.SRC_ALPHA,ij.ONE_MINUS_SRC_ALPHA]),nP.create(e,{name:nT,geometry:r,material:n,priority:0})},r.removeRenderPass=function(t){e9(this._renderPasses,t)},rC(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function n3(t){return t?new rP(t.getWidth(),t.getHeight()):new rP}var n4=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(null)},r.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",n3(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(nF),n5=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},n6=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,r=t.format,i=t.attachment;this.storageType=e,this.format=r,this.attachment=i}return rC(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),n8="function"==typeof WebGL2RenderingContext,n9=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,r=n8&&e$(t,WebGL2RenderingContext)?2:1,i=2===r,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=r,this.type=i?"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),i&&!a&&(a=n7(t,t.HALF_FLOAT)),i&&!s&&(s=n7(t,t.FLOAT)),this.internalFormatDepth16=i?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=i?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=i||t.getExtension("OES_texture_float")?t.FLOAT:0,l=i?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,c={floatTexture:u,halfFloatTexture:l,maxSample:i?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:i?!!t.getExtension("EXT_color_buffer_float"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:i?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:t.getExtension("WEBGL_compressed_texture_astc")?ot.ASTC:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?ot.PVRTC:ot.NONE,halfFloatLinear:a,floatLinear:s,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:i||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:i||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:i||!!this.drawBufferExtension,asyncShaderCompile:!!t.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:i||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:i||!!o,writableFragDepth:i||!!t.getExtension("EXT_frag_depth")};this.detail=c,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,r,i,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&r>0)throw Error("draw multiple color buffers not available");var a=o?o["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r];a?t.framebufferTexture2D(e,a,i,n,0):console.error("invalid color attachment index: "+r)},e.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1===this.level&&!r){if(!(e.length>1))return;throw Error("draw buffers not available")}var i=e.map(function(e,i){return e?r?r["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i]:t.NONE});r?r.drawBuffersWEBGL(i):t.drawBuffers(i)},e.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function n7(t,e){var r=t.createTexture(),i=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,r),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()||(i=!0),t.deleteTexture(r),i}var ot={NONE:0,PVRTC:1,ASTC:2};t.FilterMode=void 0,(K=t.FilterMode||(t.FilterMode={}))[K.Nearest=0]="Nearest",K[K.Linear=1]="Linear",t.RenderTextureFormat=void 0,(Q=t.RenderTextureFormat||(t.RenderTextureFormat={}))[Q.RGBA32=0]="RGBA32",Q[Q.RGBAHalf=1]="RGBAHalf";var oe=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,r,i){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},rC(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),or=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFrameBuffer=function(){return null},e.setFrameBuffer=function(t){},e.setViewport=function(t,e,r,i){},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){},e.getTemporaryRT=function(t,e,r,i,n,o){return null},e.dispose=function(t){},t}(),oi=1,on=function(){function e(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),o=this.createGeometry();this.mesh=this.createMesh(o,n),this.updateMesh()}var r=e.prototype;return r.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new rV,n=new rN,o=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,o),e.x=o.x,e.y=o.y,r.x=i.x,r.y=i.y,r.z=i.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",n)},r.createMaterial=function(e){var r,i=[["ENV_EDITOR",(null==(r=this.engine.renderer)?void 0:r.env)===iX]],n=iC(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;\n}\n",glslVersion:t.GLSLVersion.GLSL1,cacheId:""+e.cachePrefix+"_effects_interact",marcos:i},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=ng.create(this.engine,o);return a.depthTest=!1,a.setVector4("uPos",new r$(0,0,0,0)),a.setVector2("uSize",new rP(1,1)),a.setVector4("uColor",new r$(n[0]/255,n[1]/255,n[2]/255,n[3])),a.setQuaternion("uQuat",new rN(0,0,0,0)),a},r.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return nL.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:ij.LINES,maxVertex:4})},r.createMesh=function(t,e){return nP.create(this.engine,{name:"Interact_preview"+oi++,priority:0,worldMatrix:rF.fromIdentity(),geometry:t,material:e})},e}();function oo(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}function oa(t){var e=t.renderer,r=e.blending,i=e.side,n=e.occlusion,o=e.mask,a=e.maskMode,s=e.order,u=t.cachePrefix||"-";return{side:i,occlusion:n,blending:r,mask:o,maskMode:a,cachePrefix:u,cacheId:u+"."+ +i+"+"+ +n+"+"+ +r+"+"+s+"+"+a+"."+o}}function os(e,r){var i=null!=r?r:{},n=i.count,o=i.env,a=i.ignoreBlend,s=i.wireframe,u=[["MAX_ITEM_COUNT",void 0===n?2:n],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",(void 0===o?"":o)===iX],["USE_BLEND",!a],["MAX_FRAG_TEX",t.maxSpriteTextureCount>=16?16:8]];return{fragment:s?nD:nz,vertex:nU,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,marcos:u,shared:!0}}function ou(t,e){return t.cachePrefix+"_effects_sprite_"+e}function ol(t,e,r,i){var n=t.wireframe,o=os(r,{count:e,wireframe:n,env:i});return o.shared=!0,n||(o.cacheId=ou(t,e)),o}function oc(e){t.maxSpriteMeshItemCount=e}t.InteractComponent=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.getHitTestParams=function(e){if(t.clickable){var r=t.item.props.content.options.behavior,i=t.getBoundingBox();if(i)return{type:i.type,triangles:i.area,behavior:r}}},t}rR(r,e);var i=r.prototype;return i.start=function(){var t=this,e=this.item.props.content.options,r=this.item.engine.renderer.env,i=this.item.composition,n=this.interactData.options,o=n.type,a=n.showPreview;if(o===tB.CLICK&&(this.clickable=!0,a&&r===iX)){var s=this.item.composition.getRendererOptions();this.previewContent=new on(this.item.props.content,s,this.transform,this.engine)}i.addInteractiveItem(this.item,e.type),this.item.onEnd=function(){return i.removeInteractiveItem(t.item,e.type)},e.type===tB.DRAG&&(r!==iX||e.enableInEditor)&&i.event&&this.beginDragTarget(e,i.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},i.update=function(t){var e;null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=.95,this.bouncingArg.vy*=.95,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,oo(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){if(this.item&&this.item.composition){var t;this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.clickable=!1,null==(t=this.previewContent)||t.mesh.dispose(),this.endDragTarget()}},i.endDragTarget=function(){},i.handleDragMove=function(t,e){if(t&&t.cameraParam&&this.item.composition){var r=this.item.props.content.options,i=t.cameraParam,n=i.position,o=i.fov,a=e.dy,s=e.dx*e.width/e.height,u=n[2],l=Math.tan(o*Math.PI/180/2)*Math.abs(u),c=n[0]-s*l,h=n[1]-a*l;if(r.dxRange){var f,m=r.dxRange,d=m[0],p=m[1];(c=rM(c,d,p))!==d&&c!==p&&d!==p&&(null==(f=e.origin)||f.preventDefault())}if(r.dyRange){var v,y=r.dyRange,g=y[0],x=y[1];(h=rM(h,g,x))!==g&&h!==x&&g!==x&&(null==(v=e.origin)||v.preventDefault())}this.item.composition.camera.position=new rV(c,h,u)}},i.beginDragTarget=function(t,e){var i,n=this;if("camera"===t.target){var o={touchstart:function(t){n.dragEvent=null,n.bouncingArg=null;var e,r=null==(e=n.item.composition)?void 0:e.camera;i={x:t.x,y:t.y,cameraParam:{position:(null==r?void 0:r.position.toArray())||[0,0,8],fov:(null==r?void 0:r.fov)||60}}},touchmove:function(t){n.handleDragMove(i,t),n.bouncingArg=t},touchend:function(t){var e=n.bouncingArg;!oo(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=i1({},i)),i=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(r).endDragTarget=function(){Object.keys(o).forEach(function(t){e.removeEventListener(t,o[t])})}}},i.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),r=iu(rV.ZERO,.5,.5);return r.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:r}},i.fromData=function(t){e.prototype.fromData.call(this,t),this.interactData=t},r}(rQ),t.InteractComponent=e1([rj(er.InteractComponent)],t.InteractComponent),t.maxSpriteMeshItemCount=8,t.maxSpriteTextureCount=8;var oh={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},of=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return rR(r,e),r.precompile=function(e,r,i){var n=r.getShaderLibrary(),o=r.engine.gpuCapability,a=o.level,s=o.detail,u=(null!=i?i:{}).env;return!n.shaderResults[ou(oh,2)]&&(n.addShader(ol(oh,2,1,u)),n.addShader(ol(oh,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&n.addShader(nA(a,!0))),Promise.resolve()},r}(rJ),om=function(){function t(){this.playableOutputs=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,r=rO(this.playableOutputs);!(e=r()).done;){var i=e.value;this.callProcessFrame(i.sourcePlayable,t),i.processFrame(t)}},e.connect=function(t,e){e.connect(t)},e.addOutput=function(t){this.playableOutputs.push(t)},e.callProcessFrame=function(t,e){for(var r,i=rO(t.getInputs());!(r=i()).done;){var n=r.value;this.callProcessFrame(n,e)}t.processFrame(e)},t}(),od=function(){function t(){this.inputs=[]}var e=t.prototype;return e.connect=function(t){this.inputs.push(t)},e.getInputs=function(){return this.inputs},e.getInput=function(t){if(!(t>this.inputs.length-1))return this.inputs[t]},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.onGraphStart=function(){},e.onGraphStop=function(){},e.onPlayablePlay=function(){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.fromData=function(t){},t}(),op=function(){function t(){}var e=t.prototype;return e.setSourcePlayeble=function(t){this.sourcePlayable=t},e.onGraphStart=function(){},e.processFrame=function(t){},t}(),ov=function(){function t(){}return t.prototype.fromData=function(t){},t}(),oy=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e.clipSeed=0,e}rR(e,t);var r=e.prototype;return r.createOutput=function(){return new op},r.createMixerPlayable=function(){return new od},r.createPlayable=function(){for(var t,e=this.createMixerPlayable(),r=rO(this.clips);!(t=r()).done;){var i=t.value;e.connect(i.playable)}return e},r.createClip=function(t,e){var r=new og;return r.playable=new t,r.name=e||"TimelineClip"+r.id,this.addClip(r),r},r.getClips=function(){return this.clips},r.findClip=function(t){for(var e,r=rO(this.clips);!(e=r()).done;){var i=e.value;if(i.name===t)return i}},r.addClip=function(t){t.playable.bindingItem=this.bindingItem,t.id=(this.clipSeed++).toString(),this.clips.push(t)},e}(ov),og=function(){this.start=0,this.duration=0};function ox(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var oT=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,r){return this.findCurveValue(t,e)?this.curveValues[t+e].value=r:this.curveValues[t+e]={componentType:t,propertyName:e,value:r},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(e$(e,oE))return e.animationStream},t}(),oE=function(t){function e(){var e;return(e=t.call(this)||this).animationStream=new oT(ox(e)),e}return rR(e,t),e}(od),o_=new rD,oC=new rV(1,1,1),oA=new rV,oR=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.processFrame=function(t){this.bindingItem.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.bindingItem.duration,r=this.time/e;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){oC.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(oC.y=this.sizeYOverLifetime.getValue(r),oC.z=this.sizeZOverLifetime.getValue(r)):oC.z=oC.y=oC.x;var i=this.originalTransform.scale;this.bindingItem.transform.setScale(oC.x*i.x,oC.y*i.y,oC.z*i.z)}if(this.rotationOverLifetime){var n=function(i){return t.rotationOverLifetime.asRotation?i.getValue(r):i.getIntegrateValue(0,r,e)},o=n(this.rotationOverLifetime.z),a=this.rotationOverLifetime.separateAxes;o_.x=a?n(this.rotationOverLifetime.x):0,o_.y=a?n(this.rotationOverLifetime.y):0,o_.z=o;var s=o_.addEulers(this.originalTransform.rotation,o_);this.bindingItem.transform.setRotation(s.x,s.y,s.z)}this.positionOverLifetime&&(it(oA,this,this.gravity,this.time,e,this.originalTransform.position,this.velocity),this.originalTransform.path&&oA.add(this.originalTransform.path.getValue(r)),this.bindingItem.transform.setPosition(oA.x,oA.y,oA.z))},r.fromData=function(t){var e,r=this.bindingItem.transform.scale;this.originalTransform={position:this.bindingItem.transform.position.clone(),rotation:this.bindingItem.transform.getRotation().clone(),scale:new rV(r.x,r.y,r.x)};var i=t.positionOverLifetime,n=t.rotationOverLifetime,o=t.sizeOverLifetime;if(i&&0!==Object.keys(i).length){this.positionOverLifetime=i,i.path&&(this.originalTransform.path=iC(i.path));var a=i.linearX||i.linearY||i.linearZ;a&&(this.linearVelOverLifetime={x:i.linearX&&iC(i.linearX),y:i.linearY&&iC(i.linearY),z:i.linearZ&&iC(i.linearZ),asMovement:i.asMovement,enabled:!!a});var s=i.orbitalX||i.orbitalY||i.orbitalZ;s&&(this.orbitalVelOverLifetime={x:i.orbitalX&&iC(i.orbitalX),y:i.orbitalY&&iC(i.orbitalY),z:i.orbitalZ&&iC(i.orbitalZ),center:ie(i.orbCenter),asRotation:i.asRotation,enabled:!!s}),this.speedOverLifetime=i.speedOverLifetime&&iC(i.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=iC(o.x||1),this.sizeYOverLifetime=iC(o.y||1),this.sizeZOverLifetime=iC(o.z||1)):this.sizeXOverLifetime=iC(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:iC(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=iC(n.x||0),u.y=iC(n.y||0)}this.gravity=rV.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=iC(null!=(e=null==i?void 0:i.gravityOverLifetime)?e:0),this.direction=(null==i?void 0:i.direction)?rV.fromArray(i.direction).normalize():new rV,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},e}(oE),oS=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.createPlayable=function(){var t=new oR;return t.fromData(this.transformAnimationData),t},r.fromData=function(t){this.transformAnimationData=t},e}(ov),oO=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.onGraphStart=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},r.onPlayablePlay=function(){this.bindingItem.transform.setValid(!0),this.showRendererComponents()},r.onPlayableDestroy=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},r.hideRendererComponents=function(){for(var t,e=rO(this.bindingItem.rendererComponents);!(t=e()).done;){var r=t.value;r.enabled&&(r.enabled=!1)}},r.showRendererComponents=function(){for(var t,e=rO(this.bindingItem.rendererComponents);!(t=e()).done;){var r=t.value;r.enabled||(r.enabled=!0)}},e}(od),ob=function(e){function r(t){var r;return(r=e.call(this,t)||this).reusable=!1,r.timelineStarted=!1,r.playableGraph=new om,r.time=0,r.tracks=[],r.trackSeed=0,r}rR(r,e);var i=r.prototype;return i.start=function(){for(var t,e=rO(this.tracks);!(t=e()).done;)for(var r,i=t.value,n=rO(i.getClips());!(r=n()).done;){var o=r.value;o.start=this.item.start,o.duration=this.item.duration}this.compileTracks(this.playableGraph)},i.update=function(e){if(!this.item.stopped&&this.item.composition){if(!this.timelineStarted){for(var r,i=rO(this.tracks);!(r=i()).done;)for(var n,o=r.value,a=rO(o.getClips());!(n=a()).done;)n.value.playable.onGraphStart();this.timelineStarted=!0}var s=this.time;if(this.item.delaying&&s>=0&&s<=this.item.duration){this.item.delaying=!1;for(var u,l=rO(this.tracks);!(u=l()).done;)for(var c,h=u.value,f=rO(h.getClips());!(c=f()).done;)c.value.playable.onPlayablePlay()}if(t.VFXItem.isParticle(this.item)?this.item.isEnded(s)&&this.item.content.destoryed:this.item.isEnded(s)){var m=this.item.endBehavior;if(!this.item.ended&&(this.item.ended=!0,this.item.onEnd(),0===m)){for(var d,p=rO(this.tracks);!(d=p()).done;)for(var v,y=d.value,g=rO(y.getClips());!(v=g()).done;)v.value.playable.onPlayableDestroy();if(this.item.delaying=!0,!this.item.reusable&&!this.reusable){this.item.dispose();return}}}if(!this.item.delaying){var x=this.time/this.item.duration;this.item.lifetime=x;for(var T,E=rO(this.tracks);!(T=E()).done;)for(var _,C=T.value,A=rO(C.getClips());!(_=A()).done;)_.value.playable.setTime(this.time);this.playableGraph.evaluate(e)}}},i.setTime=function(t){this.time=t},i.getTime=function(){return this.time},i.toLocalTime=function(t){var e=t-this.options.start,r=this.options.duration;return e-r>.001&&(5===this.options.endBehavior?e%=r:4===this.options.endBehavior&&(e=Math.min(r,e))),e},i.createTrack=function(t,e){var r=new t;return r.bindingItem=this.item,r.id=(this.trackSeed++).toString(),r.name=e||"Track"+r.id,this.tracks.push(r),r},i.getTracks=function(){return this.tracks},i.findTrack=function(t){for(var e,r=rO(this.tracks);!(e=r()).done;){var i=e.value;if(i.name===t)return i}},i.rebuildGraph=function(){this.playableGraph=new om,this.compileTracks(this.playableGraph)},i.compileTracks=function(t){for(var e,r=rO(this.tracks);!(e=r()).done;){var i=e.value,n=i.createPlayable(),o=i.createOutput();t.addOutput(o),o.setSourcePlayeble(n)}},i.fromData=function(t){if(e.prototype.fromData.call(this,t),this.options={start:this.item.start,duration:this.item.duration,looping:5===this.item.endBehavior,endBehavior:this.item.endBehavior||0},this.id=this.item.id,this.name=this.item.name,this.createTrack(oy,"ActivationTrack").createClip(oO,"ActivationTimelineClip"),t.tracks)for(var r,i=t.tracks,n=rO(i);!(r=n()).done;)for(var o,a=r.value,s=this.createTrack(oy),u=rO(a.clips);!(o=u()).done;){var l=o.value;switch(l.dataType){case"TransformAnimationPlayableAsset":s.name="AnimationTrack",s.createClip(oR,"AnimationTimelineClip").playable.fromData(l.animationClip);break;case"SpriteColorAnimationPlayableAsset":s.name="SpriteColorTrack",s.createClip(oM,"SpriteColorClip").playable.fromData(l.animationClip)}}},i.toData=function(){e.prototype.toData.call(this)},r}(rK);e1([rY()],ob.prototype,"time",void 0);var ow=[[0,0,1,1,void 0]],oL=[1,1,1,1],oI=0,oM=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}rR(r,e);var i=r.prototype;return i.onPlayablePlay=function(){this.spriteMaterial=this.bindingItem.getComponent(t.SpriteComponent).material},i.processFrame=function(t){var e,r=ir(oL,1),i=this.time/this.bindingItem.duration,n=this.opacityOverLifetime,o=this.colorOverLifetime;o&&(r=re(o,i,!0),e=!0),n&&(r[3]*=n.getValue(i),e=!0),e&&(io(this.renderColor,r,this.startColor),this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor))},i.fromData=function(t){this.clipData=t;var e,r=t.colorOverLifetime;return r&&(this.opacityOverLifetime=iC(null!=(e=r.opacity)?e:1),r.color&&r.color[0]===tq.GRADIENT_COLOR&&(this.colorOverLifetime=rr(r.color[1]))),this.startColor=t.startColor||[1,1,1,1],this},r}(od);t.SpriteComponent=function(e){function r(t,r){var i;return(i=e.call(this,t)||this).color=[1,1,1,1],i.visible=!0,i.getHitTestParams=function(t){var e=i.interaction;if(t||e){var r,n=i.getBoundingBox();if(n)return{behavior:(null==(r=i.interaction)?void 0:r.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:i.renderer.side===tD.FRONT}}},r&&i.fromData(r),i}rR(r,e);var i=r.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){this.color=t,this.material.setVector4("_Color",new r$().setFromArray(t))},i.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("uSampler0",t)},i.render=function(t){if(this.getVisible()){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),t.drawGeometry(r,e)}},i.start=function(){this.priority=this.item.listIndex,this.timelineComponent=this.item.getComponent(ob),this.item.getHitTestParams=this.getHitTestParams},i.update=function(t){var e=this.timelineComponent.getTime(),r=this.item.duration,i=this.textureSheetAnimation;if(i){var n,o,a,s,u=i.total||i.row*i.col,l=0,c=0,h=1,f=1;if(this.splits){var m=this.splits[0];n=m[4],l=m[0],c=m[1],n?(h=m[3],f=m[2]):(h=m[2],f=m[3])}if(n?(o=1/i.row*h,a=1/i.col*f):(o=1/i.col*h,a=1/i.row*f),i.animate){var d=Math.round(Math.min(Math.max(e/r,0),1)*(u-1)),p=Math.floor(d/i.col),v=d-p*i.col;s=n?[o*p,a*(i.col-v)]:[o*v,a*(1+p)]}else s=[0,a];this.material.getVector4("_TexOffset").setFromArray([l+s[0],f+c-s[1],o,a])}},i.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},i.getItemInitData=function(t,e,r,i){var n=t.geoData;n||(n=t.geoData=this.getItemGeometryData(t,e));var o=n.index,a=o.length,s=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new o.constructor(a);if(!this.wireframe)for(var u=0;u<a;u++)s[u]=r+o[u];return{atlasOffset:n.atlasOffset,index:s}},i.setItem=function(){var e=[],r=this.renderer.texture;r&&e8(e,r);var i=(r=this.renderer.texture)?e.indexOf(r):-1,n=this.getItemInitData(this,0,0,i),o=this.renderer,a=this.material.getVector4("_TexParams");a.x=o.occlusion?+o.transparentOcclusion:1,a.y=+this.preMultiAlpha,a.z=o.renderMode;var s={atlasOffset:new Float32Array(n.atlasOffset.length),index:new Uint16Array(n.index.length)};s.atlasOffset.set(n.atlasOffset),s.index.set(n.index);var u=this.material,l=this.geometry,c=s.index;l.setIndexData(c),l.setAttributeData("atlasOffset",s.atlasOffset),l.setDrawCount(n.index.length);for(var h=0;h<e.length;h++){var f=e[h];u.setTexture("uSampler"+h,f)}for(var m=this.emptyTexture,d=e.length;d<t.maxSpriteMeshItemCount;d++)u.setTexture("uSampler"+d,m)},i.createGeometry=function(t){var e=12*this.splits.length;return nL.create(this.engine,{attributes:{aPos:{type:ij.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:ij.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},i.createMaterial=function(t,e){var r=t.side,i=t.occlusion,n=t.blending,o=t.maskMode,a=t.mask,s={shader:ol(t,e,1)};this.preMultiAlpha=iq(n);var u=ng.create(this.engine,s),l={side:r,blending:!0,blendMode:n,mask:a,maskMode:o,depthTest:!0,depthMask:i};return u.blending=l.blending,u.stencilRef=void 0!==l.mask?[l.mask,l.mask]:void 0,u.depthTest=l.depthTest,u.depthMask=l.depthMask,iJ(u,l.blendMode),i0(u,l.maskMode),i$(u,l.side),u.hasUniform("_Color")||u.setVector4("_Color",new r$(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new r$),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new r$),u},i.getItemGeometryData=function(t,e){var r=t.splits,i=t.renderer,n=t.textureSheetAnimation;if(i.shape){for(var o=i.shape,a=o.index,s=o.aPoint,u=new Float32Array(s),l=[],c=[],h=0;h<u.length;h+=6)u[h]*=1,u[h+1]*=1,c.push(s[h+2],s[h+3]),l.push(u[h],u[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(l)),{index:a,atlasOffset:c}}var f=[],m=[],d=2,p=2;1===r.length&&(d=1,p=1);for(var v=[],y=0;y<d;y++)for(var g=0;g<p;g++){var x=(2*g+y)*4,T=n?[0,0,1,1,r[0][4]]:r[2*g+y],E=T[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],_=((y+y+1)/d-1)/2,C=((g+g+1)/p-1)/2,A=T[0],R=T[1],S=T[4]?T[3]:T[2],O=T[4]?T[2]:T[3],b=[-.5/d+_,.5/p+C,-.5/d+_,-.5/p+C,.5/d+_,.5/p+C,.5/d+_,-.5/p+C];f.push(E[0]*S+A,E[1]*O+R,E[2]*S+A,E[3]*O+R,E[4]*S+A,E[5]*O+R,E[6]*S+A,E[7]*O+R),v.push(1*b[0],1*b[1],0,1*b[2],1*b[3],0,1*b[4],1*b[5],0,1*b[6],1*b[7],0),m.push(x,1+x,2+x,2+x,1+x,3+x)}return this.geometry.setAttributeData("aPos",new Float32Array(v)),{index:m,atlasOffset:f}},i.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},i.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),r=iu(rV.ZERO,.5,.5);return r.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:r}}},i.fromData=function(t){e.prototype.fromData.call(this,t);var r,i,n,o,a,s,u=t.interaction,l=t.options,c=t.listIndex,h=t.renderer;h||(h={}),this.interaction=u,this.renderer={renderMode:null!=(r=h.renderMode)?r:tH.BILLBOARD,blending:null!=(i=h.blending)?i:tF.ALPHA,texture:null!=(n=h.texture)?n:this.engine.emptyTexture,occlusion:!!h.occlusion,transparentOcclusion:!!h.transparentOcclusion||h.maskMode===tU.MASK,side:null!=(o=h.side)?o:tD.DOUBLE,shape:h.shape,mask:null!=(a=h.mask)?a:0,maskMode:null!=(s=h.maskMode)?s:tU.NONE,order:void 0===c?0:c},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||ow,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=oa(this);var f=this.createGeometry(ij.TRIANGLES),m=this.createMaterial(this.renderInfo,2);this.worldMatrix=rF.fromIdentity(),this.material=m,this.geometry=f,this.name="MSprite"+oI++;var d=l.startColor||[1,1,1,1];this.material.setVector4("_Color",new r$().setFromArray(d)),this.material.setVector4("_TexOffset",new r$().setFromArray([0,0,1,1])),this.setItem()},i.toData=function(){e.prototype.toData.call(this)},r}(rQ),t.SpriteComponent=e1([rj(er.SpriteComponent)],t.SpriteComponent);var oP="lookup_texture",oV="offscreen_canvas",oN={},oF=function(){function e(e,r){this.particleCount=0;var i,n,o,a,s,u,l,c,h,f=(null!=(l=e.renderer)?l:{}).env,m=r.speedOverLifetime,d=r.colorOverLifetime,p=r.linearVelOverLifetime,v=r.orbitalVelOverLifetime,y=r.sizeOverLifetime,g=r.rotationOverLifetime,x=r.sprite,T=r.gravityModifier,E=r.maxCount,_=r.textureFlip,C=r.useSprite,A=r.name,R=r.gravity,S=r.forceTarget,O=r.side,b=r.occlusion,w=r.anchor,L=r.blending,I=r.maskMode,M=r.mask,P=r.transparentOcclusion,V=r.meshSlots,N=r.renderMode,F=void 0===N?0:N,D=r.diffuse,U=void 0===D?nc.createWithData(e):D,z=e.gpuCapability.detail,k=z.halfFloatTexture,B=z.maxVertexUniforms,G=[["RENDER_MODE",+F],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",f===iX]],X=e.gpuCapability.level,H=iL(),Y=iL(),j=B>0,W={},Z=0,q=0;this.useSprite=C,j&&G.push(["ENABLE_VERTEX_TEXTURE",!0]),m&&(G.push(["SPEED_OVER_LIFETIME",!0]),q|=2,W.uSpeedLifetimeValue=m.toUniform(H)),(null==x?void 0:x.animate)&&(G.push(["USE_SPRITE",!0]),q|=4,W.uFSprite=W.uSprite=new Float32Array([x.col,x.row,x.total,x.blend?1:0]),this.useSprite=!0),(null==d?void 0:d.color)&&(G.push(["COLOR_OVER_LIFETIME",!0]),q|=16,W.uColorOverLifetime=e$(d.color,nc)?d.color:nc.createWithData(e,rs(d.color))),(null==d?void 0:d.opacity)?W.uOpacityOverLifetimeValue=d.opacity.toUniform(H):W.uOpacityOverLifetimeValue=iC(1).toUniform(H),["x","y","z"].forEach(function(t,e){var r=0,i=0;(null==p?void 0:p[t])&&(W["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=p[t].toUniform(H),r=1,q|=1<<7+e,p.enabled=!0),G.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==v?void 0:v[t])&&(W["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(H),i=1,q|=1<<10+e,c=!0,v.enabled=!0),G.push(["ORB_VEL_"+t.toUpperCase(),i])}),(null==p?void 0:p.asMovement)&&(G.push(["AS_LINEAR_MOVEMENT",!0]),q|=32),c&&((null==v?void 0:v.asRotation)&&(G.push(["AS_ORBITAL_MOVEMENT",!0]),q|=64),W.uOrbCenter=new Float32Array((null==v?void 0:v.center)||[0,0,0])),W.uSizeByLifetimeValue=null==y?void 0:y.x.toUniform(H),(null==y?void 0:y.separateAxes)&&(G.push(["SIZE_Y_BY_LIFE",1]),q|=16384,W.uSizeYByLifetimeValue=null==y?void 0:null==(h=y.y)?void 0:h.toUniform(H)),(null==g?void 0:g.z)&&(W.uRZByLifeTimeValue=g.z.toUniform(H),q|=32768,G.push(["ROT_Z_LIFETIME",1])),(null==g?void 0:g.x)&&(W.uRXByLifeTimeValue=g.x.toUniform(H),q|=65536,G.push(["ROT_X_LIFETIME",1])),(null==g?void 0:g.y)&&(W.uRYByLifeTimeValue=g.y.toUniform(H),q|=131072,G.push(["ROT_Y_LIFETIME",1])),(null==g?void 0:g.asRotation)&&(G.push(["ROT_LIFETIME_AS_MOVEMENT",1]),q|=262144),W.uGravityModifierValue=T.toUniform(H),S&&(G.push(["FINAL_TARGET",!0]),q|=524288,W.uFinalTarget=new Float32Array(S.target||[0,0,0]),W.uForceCurve=S.curve.toUniform(H)),k&&Y.max?(q|=1048576,W.uFCurveValueTexture=nh(e,ig.getAllData(Y,!0),Y.index,1)):W.uFCurveValues=ig.getAllData(Y);var K=H.max+H.curves.length-32>B;if(2===X&&(H.max=-1,H.index=V?V[0]:oU(H.index),Y.index>0&&(Y.max=-1,Y.index=V?V[1]:oU(Y.index))),K&&k&&j){var Q=nh(e,ig.getAllData(H,!0),H.index,1);W.uVCurveValueTexture=Q,Z=1}else W.uVCurveValues=ig.getAllData(H);var J=["-p:",F,q,H.index,H.max,Y.index,Y.max].join("+");G.push(["VERT_CURVE_VALUE_COUNT",H.index],["FRAG_CURVE_VALUE_COUNT",Y.index],["VERT_MAX_KEY_FRAME_COUNT",H.max],["FRAG_MAX_KEY_FRAME_COUNT",Y.max]);var $={fragment:nk,vertex:"#define LOOKUP_TEXTURE_CURVE "+Z+"\n"+nB,glslVersion:1===X?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:J,marcos:G,name:"particle#"+A},tt=iq(L);W.uTexOffset=new Float32Array(U?[1/U.getWidth(),1/U.getHeight()]:[0,0]),W.uMaskTex=U,W.uColorParams=new Float32Array([U?1:0,+tt,0,+(!!b&&!P)]),W.uParams=[0,0,0,0],W.uAcceleration=[(null==R?void 0:R[0])||0,(null==R?void 0:R[1])||0,(null==R?void 0:R[2])||0,0];var te=ng.create(e,{shader:$,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});te.blending=!0,te.depthTest=!0,te.depthMask=!!b,te.stencilRef=M?[M,M]:void 0,i0(te,I),iJ(te,L),i$(te,O);var tr={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"};Object.keys(W).map(function(t){var e=W[t];if(e$(e,nc)){te.setTexture(t,e);return}var r=[];switch(tr[t]){case"vec4":te.setVector4(t,r$.fromArray(e));break;case"vec3":te.setVector3(t,rV.fromArray(e));break;case"vec2":te.setVector2(t,rP.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new r$(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}te.setVector4Array(t,r),r.length=0;break;default:console.warn("uniform "+t+"'s type not in typeMap")}}),te.setVector3("emissionColor",new rV(0,0,0)),te.setFloat("emissionIntensity",0);var ti=nL.create(e,(i=4*E,n=this.useSprite,o="particle#"+A,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:i})),tn=nP.create(e,{name:"MParticle_"+A,material:te,geometry:ti});this.anchor=w,this.mesh=tn,this.geometry=tn.firstGeometry(),this.forceTarget=S,this.sizeOverLifetime=y,this.speedOverLifetime=m,this.linearVelOverLifetime=p,this.orbitalVelOverLifetime=v,this.orbitalVelOverLifetime=v,this.gravityModifier=T,this.maxCount=E,this.textureOffsets=_?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var r=e.prototype;return r.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),r=32*t+4;return[e[r],e[r+1],e[r+2],e[r+3]]},r.getPointPosition=function(t){var e=this.geometry,r=48*t,i=e.getAttributeData("aPos"),n=e.getAttributeData("aOffset"),o=this.time-n[16*t+2],a=n[16*t+3],s=this.mesh.material,u=s.getVector4("uAcceleration").toVector3(),l=rV.fromArray(i,r),c=rV.fromArray(i,r+3),h=it(new rV,this,u,o,a,l,c);if(this.forceTarget){var f=s.getVector3("uFinalTarget"),m=this.forceTarget.curve.getValue(o/a),d=1-m;h.x=h.x*d+f.x*m,h.y=h.y*d+f.y*m,h.z=h.z*d+f.z*m}return h},r.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},r.resetGeometryData=function(t){for(var e=t.getAttributeNames(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new r.constructor(0))},r.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},r.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},r.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i,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 l={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},c=this.useSprite;c&&(l.aSprite=new Float32Array(12));var h=new rV,f=new rN,m=new rV(1,1,1);e.transform.assignWorldTRS(h,f,m);var d=iP.getRotation(f,new rD),p=h.toArray(),v=d.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],T=e.vel,E=e.color,_=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],C=Math.random();c&&(i=e.sprite);for(var A=0;A<4;A++){var R=2*A,S=3*A,O=4*A,b=12*A,w=8*A;l.aPos.set(p,b),T.fill(l.aPos,b+3),l.aRot.set(v,w),l.aRot[w+3]=C,l.aRot.set(E,w+4),c&&l.aSprite.set(i,S);var L=e.uv||x;if(L){var I=c?1-y[R+1]:y[R+1];g[0]=L[0]+y[R]*L[2],g[1]=L[1]+I*L[3]}l.aOffset.set(g,O);for(var M=A+A,P=(_[M]-this.anchor.x)*m.x,V=(_[M+1]-this.anchor.y)*m.y,N=0;N<3;N++)l.aPos[b+6+N]=e.dirX.getElement(N)*P,l.aPos[b+9+N]=e.dirY.getElement(N)*V}var F=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(s){var D=e7(a.getIndexData(),6*n,u,6*r);D.set(F,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,F);Object.keys(l).forEach(function(e){var i=l[e],n=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var c=e7(a.getAttributeData(e),o*n,u,4*r*n);c.set(i,i.length*t),a.setAttributeData(e,c)}else a.setAttributeSubData(e,i.length*t,i)}),this.particleCount=Math.max(n,this.particleCount),a.setDrawCount(6*this.particleCount)}},e}(),oD=[10,32,64,160];function oU(t){for(var e=0;e<oD.length;e++){var r=oD[e];if(r>t)return r}return t||oD[0]}function oz(t,e,r){void 0===e&&(e="");var i,n,o,a=t.content,s=+((null==(i=a.renderer)?void 0:i.renderMode)||0),u=[["RENDER_MODE",s],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",e===iX]],l=r.level,c=r.detail,h=iL(),f=iL(),m=c.maxVertexUniforms>0,d=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,p=0,v=0;m&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,iw(h,d));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&&iw(h,x);var T=a.positionOverLifetime;["x","y","z"].forEach(function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==T?void 0:T[i])&&(iw(h,T[i]),r=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),r]);var a=0;(null==T?void 0:T[n])&&(iw(h,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);var E=a.sizeOverLifetime;iw(h,null==E?void 0:E.x),(null==E?void 0:E.separateAxes)&&(u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,iw(h,null==E?void 0:E.y));var _=a.rotationOverLifetime;(null==_?void 0:_.z)&&(iw(h,null==_?void 0:_.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),(null==_?void 0:_.separateAxes)&&(_.x&&(iw(h,_.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),_.y&&(iw(h,_.y),v|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==_?void 0:_.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),v|=262144),iw(h,null==T?void 0:T.gravityOverLifetime),(null==T?void 0:T.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,iw(h,T.forceCurve));var C=c.halfFloatTexture;C&&f.max&&(v|=1048576);var A=c.maxVertexUniforms,R=h.max+h.curves.length-32>A;oN[oP]&&(R=!0),2===l&&(h.max=-1,f.index>0&&(f.max=-1)),R&&C&&m&&(p=1);var S={fragment:nk,vertex:"#define LOOKUP_TEXTURE_CURVE "+p+"\n"+nB,shared:!0,cacheId:["-p:",s,v,h.index,h.max,f.index,f.max].join("+"),marcos:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",h.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",h.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:S,vertex:h.index,fragment:f.index}}function ok(t,e,r){var i,n=null==(i=t.cacheId)?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.marcos)for(var o=0;o<t.marcos.length;o++){var a=t.marcos[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}}var oB=new rV,oG=new rV,oX=function(){function e(e,r){this.pointStart=[];var i,n=r.colorOverLifetime,o=r.colorOverTrail,a=r.maxTrailCount,s=r.opacityOverLifetime,u=void 0===s?iC(1):s,l=r.widthOverTrail,c=r.name,h=r.occlusion,f=r.blending,m=r.maskMode,d=r.textureMap,p=r.texture,v=r.transparentOcclusion,y=r.minimumVertexDistance,g=r.lifetime,x=r.matrix,T=e.gpuCapability,E=T.detail,_=T.level,C=Math.max(r.pointCountPerTrail,2),A=iL(),R=E.maxVertexTextures>0,S=(null!=(i=e.renderer)?i:{}).env,O={},b=[["ENABLE_VERTEX_TEXTURE",R],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",S===iX]],w=a>64,L=0;n&&(b.push(["COLOR_OVER_LIFETIME",!0]),L|=1,O.uColorOverLifetime=nc.createWithData(e,rs(n))),o&&(b.push(["COLOR_OVER_TRAIL",!0]),L|=4,O.uColorOverTrail=nc.createWithData(e,rs(o))),w?(b.push(["ATTR_TRAIL_START",1]),L|=8):O.uTrailStart=new Float32Array(a),O.uOpacityOverLifetimeValue=u.toUniform(A);var I=l.toUniform(A);b.push(["VERT_CURVE_VALUE_COUNT",A.index],["VERT_MAX_KEY_FRAME_COUNT",A.max]),O.uVCurveValues=ig.getAllData(A);var M={shader:{vertex:nG,fragment:nk,marcos:b,glslVersion:1===_?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+L+"+"+A.index+"+"+A.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},P=C*a*2,V=(C-1)*a,N=Float32Array.BYTES_PER_ELEMENT,F=12*N,D={attributes:{aColor:{size:4,stride:F,data:new Float32Array(12*P)},aSeed:{size:1,stride:F,offset:4*N,dataSource:"aColor"},aInfo:{size:3,stride:F,offset:5*N,dataSource:"aColor"},aPos:{size:4,stride:F,offset:8*N,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#"+c,bufferUsage:ij.DYNAMIC_DRAW};if(w)D.attributes.aTrailStart={size:1,data:new Float32Array(P)};else{var U=new Float32Array(P);D.attributes.aTrailStartIndex={size:1,data:U};for(var z=0;z<a;z++)for(var k=2*C,B=z*k,G=0;G<k;G++)U[B+G]=z}var X=iq(f),H=ng.create(e,M);H.blending=!0,H.depthMask=h,H.depthTest=!0,i0(H,m),iJ(H,f);var Y=this.mesh=nP.create(e,{name:"MTrail_"+c,material:H,geometry:nL.create(e,D)}),j=null!=p?p:nc.createWithData(e);Object.keys(O).map(function(t){var e=O[t];if(e$(e,nc))H.setTexture(t,e);else if("uTrailStart"===t)H.setFloats("uTrailStart",e);else if("uVCurveValues"===t){var r=[];r.push(new r$(e[0],e[1],e[2],e[3])),r.push(new r$(e[4],e[5],e[6],e[7])),H.setVector4Array(t,r)}else H.setVector4(t,r$.fromArray(e))}),H.setFloat("uTime",0),H.setVector4("uWidthOverTrail",r$.fromArray(I)),H.setVector2("uTexOffset",new rP(0,0)),H.setVector4("uTextureMap",r$.fromArray(void 0===d?[0,0,1,1]:d)),H.setVector4("uParams",new r$(0,C-1,0,0)),H.setTexture("uMaskTex",j),H.setVector4("uColorParams",new r$(p?1:0,+X,0,+(h&&!v))),this.maxTrailCount=a,this.pointCountPerTrail=C,this.checkVertexDistance=y>0,this.minimumVertexDistance=Math.pow(y||.001,2),this.useAttributeTrailStart=w,this.lifetime=g,x&&(this.mesh.worldMatrix=x),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(a)}var r=e.prototype;return r.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=i%n,u=(i-1)%n,l=(i-2)%n,c=this.getTrailPosition(t,u,oB);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var h=t*n+s,f=oW(c,e),m=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],p=r.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),o.setAttributeSubData("aDir",6*h,v),o.setAttributeSubData("aTime",2*h,new Float32Array([m,m]));var y=r.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(d,4),g[7]=0,g.set(x,8),g[11]=.5*p,g.set(y,12),g.set(d,16),g[19]=1,g.set(x,20),g[23]=-.5*p,o.setAttributeSubData("aColor",24*h,g),u>=0){var T=new Float32Array(oW(this.getTrailPosition(t,l,oG),c,e)),E=(t*n+u)*6;o.setAttributeSubData("aDir",E,T),o.setAttributeSubData("aDir",E+3,T);var _=t*n*2,C=new Uint16Array([2*u+_,2*u+1+_,2*s+_,2*s+_,2*u+1+_,2*s+1+_]),A=(t*a+(i-1)%a)*6;o.setIndexSubData(A,C)}i=++this.trailCursors[t];var R=this.mesh.material,S=R.getVector4("uParams"),O=d[2];if(this.useAttributeTrailStart){for(var b=2*n,w=new Float32Array(b),L=0;L<b;L++)w[L]=O;o.setAttributeSubData("aTrailStart",t*w.length,w)}else{var I=R.getFloats("uTrailStart");void 0!=I&&(I[t]=O,R.setFloats("uTrailStart",I))}S&&(S.y=Math.max(S.y,i-1)-Math.max(0,i-n),R.setVector4("uParams",S))}},r.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=(t*i+e)*24+8,o=this.geometry.getAttributeData("aColor");return r.x=o[n],r.y=o[1+n],r.z=o[2+n],r}},r.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},r.minusTime=function(t){for(var e=this.geometry.getAttributeData("aTime"),r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},r.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,r=this.geometry.getIndexData();r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),this.trailCursors[t]=0}},r.getPointStartPos=function(t){return this.pointStart[t]},r.setPointStartPos=function(t,e){this.pointStart[t]=e},r.onUpdate=function(t){},rC(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}(),oH=new rV,oY=new rV,oj=new rV;function oW(t,e,r){return t||r?(t?r?(oY.subtractVectors(e,t).normalize(),oY.subtractVectors(r,e),oj.copyFrom(oY).normalize(),oH.addVectors(oY,oj)):oH.subtractVectors(e,t):oH.subtractVectors(r,e),oH.normalize().toArray()):[0,0,0]}var oZ=function(e){function r(){return e.apply(this,arguments)}return rR(r,e),r.precompile=function(e,r,i){var n=e[0],o={rotationOverLifetime:{x:!1,y:!1,z:!1},positionOverLifetime:{speedOverLifetime:!1,linearX:!1,linearY:!1,linearZ:!1,orbitalX:!1,orbitalY:!1,orbitalZ:!1,forceCurve:!1},colorOverLifetime:{opacity:!1,color:!1},sizeOverLifetime:{x:!1,y:!1}},a={colorOverLifetime:{opacity:1,color:[tq.RGBA_COLOR,[255,255,255,255]]},positionOverLifetime:{speedOverLifetime:1},sizeOverLifetime:{x:1,y:1}},s=r.engine.gpuCapability,u=s.level,l=(null!=i?i:{}).env,c=r.getShaderLibrary(),h=[],f=[],m=[],d=0,p=0;return n.items.forEach(function(e){t.Item.isParticle(e)&&(f.push(e),function(e){if(t.Item.isParticle(e)){var r=e.content;r.rotationOverLifetime||(r.rotationOverLifetime={});var i=r.rotationOverLifetime;i.z||(i.z=[tq.CONSTANT,0]),i.separateAxes||(delete i.y,delete i.x),r.sizeOverLifetime||(r.sizeOverLifetime={});var n=r.sizeOverLifetime;n.separateAxes||delete n.y,n.size&&(n.x=n.size,delete n.size),n.x||(n.x=[tq.CONSTANT,1])}}(e),2===u&&Object.keys(o).forEach(function(t){var r=o[t],i=e.content[t];i&&Object.keys(r).forEach(function(e){i[e]&&(r[e]=!0,e8(h,t))})}))}),f.forEach(function(e){var r=e.content;2===u&&(h.forEach(function(t){var e=o[t],i=r[t]||(r[t]={});Object.keys(e).forEach(function(r){if(e[r]&&!i[r]){var n=a[t]&&a[t][r]||0;i[r]=isNaN(n)?n:[tq.CONSTANT,n]}})}),o.positionOverLifetime.forceCurve&&(r.positionOverLifetime.forceTarget=!0),(o.rotationOverLifetime.x||o.rotationOverLifetime.y)&&(r.rotationOverLifetime.separateAxes=!0),o.sizeOverLifetime.y&&(r.sizeOverLifetime.separateAxes=!0));var i=oz(e,l,s),n=i.shader,f=i.fragment,v=i.vertex;if(m.push(n),d=Math.max(d,f),p=Math.max(p,v),e.content.trails){var y,g,x,T,E,_,C,A,R,S,O=(y=e.content.trails,g=e.content.options.maxCount,x=e.name,void 0===(T=l)&&(T=""),E=0,_=oN[oP]?1:0,C=[["ENABLE_VERTEX_TEXTURE",s.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",_],["ENV_EDITOR",T===iX]],A=iL(),y.colorOverLifetime&&(C.push(["COLOR_OVER_LIFETIME",!0]),E|=1),y.colorOverTrail&&(C.push(["COLOR_OVER_TRAIL",!0]),E|=4),g>64&&(C.push(["ATTR_TRAIL_START",1]),E|=8),iw(A,y.opacityOverLifetime),iw(A,y.widthOverTrail),C.push(["VERT_CURVE_VALUE_COUNT",A.index],["VERT_MAX_KEY_FRAME_COUNT",A.max]),{vertex:nG,fragment:nk,marcos:C,shared:!0,name:"trail#"+x,cacheId:"-t:+"+E+"+"+A.index+"+"+A.max});O.vertex=iQ(null!=(R=O.marcos)?R:[],O.vertex,t.ShaderType.vertex,u),O.fragment=iQ(null!=(S=O.marcos)?S:[],O.fragment,t.ShaderType.fragment,u),O.glslVersion=2===u?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,c.addShader(O)}}),m.forEach(function(e){var r,i;2===u?(ok(e,p,d),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,e.vertex=iQ(null!=(r=e.marcos)?r:[],e.vertex,t.ShaderType.vertex,u),e.fragment=iQ(null!=(i=e.marcos)?i:[],e.fragment,t.ShaderType.fragment,u),c.addShader(e)}),2===u&&f.forEach(function(t){t.content.options.meshSlots=[p,d]}),Promise.resolve()},r}(rJ),oq=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}return t.prototype.generate=function(t){var e=oK(this.arc,this.arcMode,t)*rb,r=new rV(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),i=Math.tan(this.angle*rb),n=r.clone().multiply(i);return n.z+=1,{position:r.multiply(rx(0,1)),direction:n.normalize()}},t}();function oK(t,e,r){if(e===t0.RANDOM)t=rx(0,t);else if(e===t0.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===t0.BIDIRECTIONAL_CYCLE){var n=r.index/(r.total+1),o=n-Math.floor(n);t*=Math.floor(n)%2?1-o:o}else e===t0.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var oQ=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}return t.prototype.generate=function(t){var e=oK(this.arc,this.arcMode,t)*rb,r=new rV(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),oJ=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=rx(-this._d,this._d),r=rx(-this._h,this._h);return{direction:new rV(0,0,1),position:new rV(e,r,0)}},t}(),o$=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=oK(this.arc,this.arcMode,t)*rb,r=new rV(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(e),s=new rV;return e<o?s.set(i,i*a,0):e>=o&&e<Math.PI-o?s.set(n/a,n,0):e<Math.PI+o?s.set(-i,-i*a,0):e<2*Math.PI-o?s.set(-n/a,-n,0):s.set(i,i*a,0),{direction:r,position:s}},t}(),o0=function(){function t(t){this._d=(t.width||1)/2,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===t0.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):rx(0,1);return{direction:new rV(0,1,0),position:new rV(this._d*(e-.5),0,0)}},t}(),o1=new rF,o2=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}return t.prototype.generate=function(t){var e=this.donutRadius,r=this.radius-e,i=rx(0,2*Math.PI),n=oK(this.arc,this.arcMode,t)*rb,o=o1.setFromRotationZ(n),a=new rV(Math.cos(i),Math.sin(i),0),s=new rV(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),o3=new rF,o4=function(){function t(t){var e=this;Object.keys(t).forEach(function(r){e[r]=t[r]})}var e=t.prototype;return e.getHorizontalAngle=function(){return rx(-90,90)},e.generate=function(t){var e=oK(this.arc,this.arcMode,t)*rb,r=this.getHorizontalAngle()*rb,i=this.radius,n=new rV(Math.cos(r),0,Math.sin(r)),o=o3.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(i),direction:o}},t}(),o5=function(t){function e(){return t.apply(this,arguments)}return rR(e,t),e.prototype.getHorizontalAngle=function(){return rx(0,90)},e}(o4),o6=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=rM(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=Math.floor(oK(e.length/2-1,this.arcMode,t)),i=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,o=new rV(i,n,0);return{position:new rV(i*this.width,n*this.height,0),direction:o.normalize()}},t}(),o8=function(){function t(){}return t.prototype.generate=function(){return{position:new rV,direction:new rV}},t}(),o9=((el={})[tz.NONE]=o8,el[tz.CONE]=oq,el[tz.SPHERE]=o4,el[tz.HEMISPHERE]=o5,el[tz.CIRCLE]=oQ,el[tz.DONUT]=o2,el[tz.RECTANGLE]=oJ,el[tz.EDGE]=o0,el[tz.RECTANGLE_EDGE]=o$,el[tz.TEXTURE]=o6,el);function o7(t){if(!t)return new o8;var e=i1({radius:1,arc:360,angle:0,arcMode:t0.RANDOM},t),r=t.type,i=o9[r];if(!i)throw Error("invalid shape:"+r);var n=new i(e);if(r!==tz.NONE){var o=t.alignSpeedDirection,a=t.upDirection;n.alignSpeedDirection=o,n.upDirection=rV.fromArray(void 0===a?[0,0,1]:a).normalize()}return n}function at(t,e,r,i,n){var o,a;if(n===function(t,e,r,i){for(var n=0,o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,r,i)>0)for(o=e;o<r;o+=i)a=af(o,t[o],t[o+1],a);else for(o=r-i;o>=e;o-=i)a=af(o,t[o],t[o+1],a);return a&&aa(a,a.next)&&(am(a),a=a.next),a}function ae(t,e){if(!t)return t;e||(e=t);var r,i=t;do if(r=!1,!i.steiner&&(aa(i,i.next)||0===ao(i.prev,i,i.next))){if(am(i),(i=e=i.prev)===i.next)break;r=!0}else i=i.next;while(r||i!==e);return e}function ar(t,e){return t.x-e.x}function ai(t,e,r,i,n){return(t=((t=((t=((t=((t=32767*(t-r)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-i)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function an(t,e,r,i,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(i-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function ao(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function aa(t,e){return t.x===e.x&&t.y===e.y}function as(t,e,r,i){var n=al(ao(t,e,r)),o=al(ao(t,e,i)),a=al(ao(r,i,t)),s=al(ao(r,i,e));return!!(n!==o&&a!==s||0===n&&au(t,r,e)||0===o&&au(t,i,e)||0===a&&au(r,t,i)||0===s&&au(r,e,i))}function au(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function al(t){return t>0?1:t<0?-1:0}function ac(t,e){return 0>ao(t.prev,t,t.next)?ao(t,e,t.next)>=0&&ao(t,t.prev,e)>=0:0>ao(t,e,t.prev)||0>ao(t,t.next,e)}function ah(t,e){var r=new ad(t.i,t.x,t.y),i=new ad(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function af(t,e,r,i){var n=new ad(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function am(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 ad(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var ap=0;function av(t,e,r,i){r=r||2,ap=i||0;var n,o,a,s,u,l,c,h=e&&e.length,f=h?e[0]*r:t.length,m=at(t,0,f,r,!0),d=[];if(!m||m.next===m.prev)return d;if(h&&(m=function(t,e,r,i){var n,o,a,s,u,l=[];for(n=0,o=e.length;n<o;n++)a=e[n]*i,s=n<o-1?e[n+1]*i:t.length,(u=at(t,a,s,i,!1))===u.next&&(u.steiner=!0),l.push(function(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}(u));for(l.sort(ar),n=0;n<l.length;n++)(function(t,e){if(e=function(t,e){var r,i,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 l=o.x+(s-o.y)*(o.next.x-o.x)/(o.next.y-o.y);if(l<=a&&l>u){if(u=l,l===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 c,h=n,f=n.x,m=n.y,d=1/0;o=n;do a>=o.x&&o.x>=f&&a!==o.x&&an(s<m?a:u,s,f,m,s<m?u:a,s,o.x,o.y)&&(c=Math.abs(s-o.y)/(a-o.x),ac(o,t)&&(c<d||c===d&&(o.x>n.x||o.x===n.x&&(r=n,i=o,0>ao(r.prev,r,i.prev)&&0>ao(i.next,r,r.next))))&&(n=o,d=c)),o=o.next;while(o!==h);return n}(t,e)){var r=ah(e,t);ae(e,e.next),ae(r,r.next)}})(l[n],r),r=ae(r,r.next);return r}(t,e,m,r)),t.length>80*r){n=a=t[0],o=s=t[1];for(var p=r;p<f;p+=r)u=t[p],l=t[p+1],u<n&&(n=u),l<o&&(o=l),u>a&&(a=u),l>s&&(s=l);c=0!==(c=Math.max(a-n,s-o))?1/c:0}return function t(e,r,i,n,o,a,s){if(e){!s&&a&&function(t,e,r,i){var n=t;do null===n.z&&(n.z=ai(n.x,n.y,e,r,i)),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,r,i,n,o,a,s,u,l=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,i=r,s=0,e=0;e<l&&(s++,i=i.nextZ);e++);for(u=l;s>0||u>0&&i;)0!==s&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,u--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,l*=2}while(a>1)}(n)}(e,n,o,a);for(var u,l,c=e;e.prev!==e.next;){if(u=e.prev,l=e.next,a?function(t,e,r,i){var n=t.prev,o=t.next;if(ao(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,l=n.y>t.y?n.y>o.y?n.y:o.y:t.y>o.y?t.y:o.y,c=ai(a,s,e,r,i),h=ai(u,l,e,r,i),f=t.prevZ,m=t.nextZ;f&&f.z>=c&&m&&m.z<=h;){if(f!==t.prev&&f!==t.next&&an(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&ao(f.prev,f,f.next)>=0||(f=f.prevZ,m!==t.prev&&m!==t.next&&an(n.x,n.y,t.x,t.y,o.x,o.y,m.x,m.y)&&ao(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;f&&f.z>=c;){if(f!==t.prev&&f!==t.next&&an(n.x,n.y,t.x,t.y,o.x,o.y,f.x,f.y)&&ao(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;m&&m.z<=h;){if(m!==t.prev&&m!==t.next&&an(n.x,n.y,t.x,t.y,o.x,o.y,m.x,m.y)&&ao(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}(e,n,o,a):function(t){var e=t.prev,r=t.next;if(ao(e,t,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(an(e.x,e.y,t.x,t.y,r.x,r.y,i.x,i.y)&&ao(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}(e)){r.push(u.i/i+ap),r.push(e.i/i+ap),r.push(l.i/i+ap),am(e),e=l.next,c=l.next;continue}if((e=l)===c){s?1===s?t(e=function(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!aa(n,o)&&as(n,i,i.next,o)&&ac(n,o)&&ac(o,n)&&(e.push(n.i/r+ap),e.push(i.i/r+ap),e.push(o.i/r+ap),am(i),am(i.next),i=t=o),i=i.next}while(i!==t);return ae(i)}(ae(e),r,i),r,i,n,o,a,2):2===s&&function(e,r,i,n,o,a){var s=e;do{for(var u,l,c=s.next.next;c!==s.prev;){if(s.i!==c.i&&(u=s,l=c,u.next.i!==l.i&&u.prev.i!==l.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&as(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(u,l)&&(ac(u,l)&&ac(l,u)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next;while(r!==t);return i}(u,l)&&(ao(u.prev,u,l.prev)||ao(u,l.prev,l))||aa(u,l)&&ao(u.prev,u,u.next)>0&&ao(l.prev,l,l.next)>0))){var h=ah(s,c);s=ae(s,s.next),h=ae(h,h.next),t(s,r,i,n,o,a),t(h,r,i,n,o,a);return}c=c.next}s=s.next}while(s!==e)}(e,r,i,n,o,a):t(ae(e),r,i,n,o,a,1);break}}}}(m,d,r,n,o,c),d}function ay(t,e){for(var r,i,n=t.s,o=t.p,a=n[1],s=o[1],u=0,l=0;l<a.length;l++)u+=a[l].length-1;var c,h=new Float32Array(6*u),f=e.indexBase,m=e.uvTransform,d=0,p=0,v=0,y=1,g=1;m&&(p=m[0],v=m[1],y=(c=m[4])?m[3]:m[2],g=c?m[2]:m[3]);for(var x=[0,0],T=0===c?0:-Math.PI/2,E=0;E<a.length;E++)for(var _=a[E],C=s[E],A=s[E+1]||s[0],R=[0,0],S=0;S<_.length-1;S++)(function(t,e,r,i,n,o,a,s){var u=1-e,l=u*u*u,c=3*e*u*u,h=3*e*e*u,f=e*e*e;t[0]=l*r[0]+c*n+h*a+f*i[0],t[1]=l*r[1]+c*o+h*s+f*i[1]})(R,_[S],C,A,C[4],C[5],A[2],A[3]),r=R[0],i=R[1],h[d++]=r/2,h[d++]=i/2,m?(x[0]=r,x[1]=i,ax(x,x,T),h[d++]=p+(x[0]+1)/2*y,h[d++]=v+(x[1]+1)/2*g):(h[d++]=(r+1)/2,h[d++]=(i+1)/2),d+=2;var O=av(Array.from(h),null,6,void 0===f?0:f);return{aPoint:h,index:new Uint16Array(O)}}function ag(t,e){for(var r,i=[],n=(r=[],t.gs?t.gs.forEach(function(t){r.push({p:[tq.SHAPE_POINTS,t.p],s:[tq.SHAPE_SPLITS,t.s]})}):t.g?r.push({p:[tq.SHAPE_POINTS,t.g.p],s:[tq.SHAPE_SPLITS,t.g.s]}):r.push(t),r),o=0,a=0,s=0,u=0;u<n.length;u++){var l=ay(n[u],{indexBase:o,uvTransform:e});o+=l.aPoint.length/5,i.push(l),a+=l.aPoint.length,s+=l.index.length}if(1===i.length)return i[0];for(var c=new Float32Array(a),h=new Uint16Array(s),f=0,m=0,d=0;f<i[f];f++){var p=i[f];c.set(p.aPoint,m),m+=p.aPoint.length,h.set(p.index,d),d+=p.index.length}return{aPoint:c,index:h}}function ax(t,e,r){var i=Math.cos(r),n=Math.sin(r),o=e[0],a=e[1];return t[0]=i*o+n*a,t[1]=-n*o+i*a,t}var aT=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+r||1,this.count=e$(i,ic)?i:iC(i),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(this)},t}(),aE=function(t){this.content=t},a_=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 r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},e.shiftNode=function(t){var e=new aE(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(0>=this.sort(r.content,e.content)))return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e;if(!r.next)return this.insertNode(r,e),this.last=e;r=r.next}},e.pushNode=function(t){var e=new aE(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(0>=this.sort(e.content,r.content)))return this.insertNode(r,e),r===this.last&&(this.last=e),e;if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var r=this.first=e.next;r&&(r.pre=null)}else if((e=this.last)===t){var i=this.last=e.pre;i&&(i.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 r=this.first,i=0;if(r)do t.call(e||this,r.content,i++);while(r=r.next)},e.forEachReverse=function(t,e){var r=this.last,i=this.length-1;if(r)do t.call(e||this,r.content,i--);while(r=r.pre)},t}(),aC=function(t){function e(e,r,i){(n=t.call(this,e)||this).name="ParticleSystemRenderer",n.particleMesh=new oF(e,r),void 0!==i&&(n.trailMesh=new oX(e,i));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}rR(e,t);var r=e.prototype;return r.start=function(){this._priority=this.item.listIndex,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=rO(this.meshes);!(t=e()).done;)t.value.start()},r.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new r$(e,this.item.duration,0,0))},r.render=function(t){for(var e,r=rO(this.meshes);!(e=r()).done;)e.value.render(t)},r.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},r.updateTime=function(t,e){this.particleMesh.time=t,this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},r.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},r.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},r.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},r.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(r){t.push(e[r])}),this.trailMesh){var r=this.trailMesh.mesh.material.textures;Object.keys(r).forEach(function(e){t.push(r[e])})}return t},r.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},r.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},r.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},r.hasTrail=function(){return void 0!==this.trailMesh},r.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},r.addTrailPoint=function(t,e,r){var i;null==(i=this.trailMesh)||i.addPoint(t,e,r)},r.setTrailStartPosition=function(t,e){var r;null==(r=this.trailMesh)||r.setPointStartPos(t,e)},r.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(rQ);t.ParticleSystem=function(e){function r(r,i){var n;return(n=e.call(this,r)||this).destoryed=!1,n.getHitTestParams=function(e){var r=n.interaction;if(e||r)return{type:t.HitTestType.custom,collect:function(t){return n.raycast({radius:(null==r?void 0:r.radius)||.4,multiple:!!(null==r?void 0:r.multiple),removeParticle:(null==r?void 0:r.behavior)===t$.removeParticle,ray:t})}}},i&&n.fromData(i),n}rR(r,e);var i=r.prototype;return i.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),r=this.item.transform.rotation.clone(),i=this.props.emitterTransform&&this.props.emitterTransform.path;i&&(i[0]===tq.CONSTANT_VEC3?e.add(i[1]):t=iC(i)),this.basicTransform={position:e,rotation:r,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)}},i.updateEmitterTransform=function(t){var e=this.transform.parentTransform,r=this.basicTransform,i=r.path,n=r.position.clone();if(i){var o=this.item.duration;n.add(i.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)}},i.addParticle=function(t,e){var r,i=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(i.length<e)r=n[1]=i.length;else{var o=i.first;i.removeNode(o),r=n[1]=o.content[1]}i.pushNode(n),this.renderer.setParticlePoint(r,t),this.clearPointTrail(r),this.transform.parentTransform&&this.renderer.setTrailStartPosition(r,this.transform.parentTransform.position.clone())},i.setVisible=function(t){this.renderer.setVisible(t)},i.setOpacity=function(t){var e,r=this.renderer.particleMesh.mesh.material,i=this.renderer.particleMesh.mesh.geometry,n=(null==(e=r.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new r$(n[0],n[1],n[2],t));for(var o=i.getAttributeData("aColor")||[],a=0;a<o.length;a+=32)o[8*a+7]=t},i.setColor=function(t,e,r,i){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 r$(s[0],s[1],s[2],i));for(var u=a.getAttributeData("aColor")||[],l=0;l<u.length;l+=32)u[8*l+4]=t,u[8*l+5]=e,u[8*l+6]=r,u[8*l+7]=i},i.setParentTransform=function(t){},i.getTextures=function(){return this.renderer.getTextures()},i.start=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.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 a_(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1},i.onUpdate=function(t){var e=this;if(this.started&&!this.frozen){var r=this.lastUpdate+t/1e3,i=this.options,n=this.loopStartTime,o=this.emission;this.lastUpdate=r,this.upDirectionWorld=null,this.renderer.updateTime(r,t);var a=this.particleLink,s=(r-n)/this.item.duration,u=this.timePassed,l=!1,c=function(){e.trails&&!l&&(l=!0,a.forEach(function(t){var r=t[0],i=t[1],n=t[2],o=t[3];r<u?e.clearPointTrail(i):u>n&&e.updatePointTrail(i,s,o,n)}))};if(this.ended){if(this.item.endBehavior!==tQ.loop&&0===this.item.endBehavior){var h=a.last;h&&h.content[0]<this.lastUpdate&&(this.destoryed=!0)}}else{var f=this.item.duration,m=this.lifetime;if(u<f){var d=1/o.rateOverTime.getValue(m),p=Math.floor((u-this.lastEmitTime)/d),v=d/p,y=i.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<p&&x<y&&!g();x++){var T=this.createPoint(m);T.delay+=r+x*v,this.addParticle(T,y),this.lastEmitTime=u}for(var E=o.bursts,_=(null==E?void 0:E.length)-1,C=0;_>=0&&C<y&&!g();_--){var A=E[_],R=!A.disabled&&A.getGeneratorOptions(u,m);if(R){var S=[0,0,0],O=o.burstOffsets[_],b=O&&O[R.cycleIndex]||S;A.once&&this.removeBurst(_);for(var w=0;w<R.count&&C<y&&!g();w++){var L,I=this.initPoint(this.shape.generate({total:R.total,index:R.index,burstIndex:w,burstCount:R.count}));I.delay+=r,C++,(L=I.transform).translate.apply(L,[].concat(b)),this.addParticle(I,y)}}}}else this.item.endBehavior===tQ.loop?(c(),this.loopStartTime=r-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.onIterate(this)):(this.ended=!0,this.onEnd(this),4===this.item.endBehavior&&(this.frozen=!0))}c()}},i.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}})}))},i.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,r=[],i=this.particleCount,n=0;if(!(t&&e))return r;for(var o=t.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var l=this.getPointPosition(u);r.push({center:l,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>i&&(a=!0)}return r},i.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],o=new rV,a=!1;if(i&&i.content)do{var s=i.content,u=s[0],l=s[1];s[2];var c=s[3];if(u>this.timePassed){var h=this.getPointPosition(c),f=t.ray,m=!1;f&&(m=!!f.intersectSphere({center:h,radius:t.radius},o)),m&&(t.removeParticle&&(r.removeParticlePoint(l),this.clearPointTrail(l),e.removeNode(i),i.content=[0]),n.push(h),t.multiple||(a=!0))}else break}while((i=i.pre)&&!a);return n}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.updatePointTrail=function(t,e,r,i){var n=this.renderer;if(n.hasTrail()){var o=this.trails,a=this.getPointPosition(r),s=o.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=r.transform.getWorldScale().toArray(),l=1,c=o.lifetime.getValue(e);if(o.sizeAffectsWidth&&(l*=u[0]),o.sizeAffectsLifetime&&(c*=u[0]),o.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var h=n.getTrailStartPosition(t);h&&a.subtract(h)}n.addTrailPoint(t,a,{color:s,lifetime:c,size:l,time:i})}},i.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,o=t.gravity,a=this.options.forceTarget,s=this.lastUpdate-n,u=new rV,l=rV.fromArray(void 0===o?[]:o);e.assignWorldTRS(u);var c=it(new rV,this.options,l,s,i,u,r);if(a){var h=a.target||[0,0,0],f=a.curve.getValue(s/i),m=1-f;c.x=c.x*m+h[0]*f,c.y=c.y*m+h[1]*f,c.z=c.z*m+h[2]*f}return c},i.onEnd=function(t){},i.onIterate=function(t){},i.initPoint=function(t){var e,r,i,n,o=this.options,a=this.lifetime,s=this.shape,u=o.startSpeed.getValue(a),l=o.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),c=new iP({position:l.transformPoint(t.position,new rV),valid:!0}),h=t.direction;if(h=l.transformNormal(h,aA).normalize(),o.startTurbulence&&o.turbulence){for(var f=0;f<3;f++)aw.setElement(f,o.turbulence[f].getValue(a));aL.setFromVector3(aw.negate()),aM.setFromEuler(aL).transformNormal(h).normalize()}s.alignSpeedDirection?(ab.copyFrom(h),this.upDirectionWorld||(s.upDirection?this.upDirectionWorld=s.upDirection.clone():this.upDirectionWorld=rV.Z.clone(),l.transformNormal(this.upDirectionWorld)),aO.crossVectors(ab,this.upDirectionWorld).normalize(),aO.isZero()&&aO.set(1,0,0)):(aO.set(1,0,0),ab.set(0,1,0));var m=this.textureSheetAnimation;m&&m.animate&&((n=aI)[0]=m.animationDelay.getValue(a),n[1]=m.animationDuration.getValue(a),n[2]=m.cycles.getValue(a)),o.start3DRotation?aS.set(o.startRotationX.getValue(a),o.startRotationY.getValue(a),o.startRotationZ.getValue(a)):o.startRotation?aS.set(0,0,o.startRotation.getValue(a)):aS.set(0,0,0),c.setRotation(aS.x,aS.y,aS.z);var d=o.startColor.getValue(a);if(3===d.length&&(d[3]=1),o.start3DSize)aR.x=o.startSizeX.getValue(a),aR.y=o.startSizeY.getValue(a);else{var p=o.startSize.getValue(a),v=o.sizeAspect.getValue(a);aR.x=p,aR.y=0===v?0:p/v}var y=h.clone();if(y.multiply(u),!o.particleFollowParent){var g=new rV;this.transform.assignWorldTRS(void 0,void 0,g),aR.x*=g.x,aR.y*=g.y}return c.setScale(aR.x,aR.y,1),{size:aR,vel:y,color:d,delay:o.startDelay.getValue(a),lifetime:o.startLifetime.getValue(a),uv:(r=Math.floor(Math.random()*(e=this.uvs).length),i=e[r],i),gravity:o.gravity,sprite:n,dirY:ab,dirX:aO,transform:c}},i.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&e$(e,Array)){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return -1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.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))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},i.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destoryed=!1;var r,i,n,o,a,s,u,l,c,h,f,m,d=t.options,p=t.positionOverLifetime,v=t.shape,y=p.gravityOverLifetime,g=ie(p.gravity),x=t.textureSheetAnimation,T=x?{animationDelay:iC(x.animationDelay||0),animationDuration:iC(x.animationDuration||1),cycles:iC(x.cycles||1),animate:x.animate,col:x.col,row:x.row,total:x.total||x.col*x.row}:void 0,E=!!(v&&v.turbulenceX||v.turbulenceY||v.turbulenceZ);E&&(n=[iC(null!=(o=v.turbulenceX)?o:0),iC(null!=(a=v.turbulenceY)?a:0),iC(null!=(s=v.turbulenceZ)?s:0)]),this.name="ParticleSystem",this.shape=o7(v),this.emission={rateOverTime:iC(t.emission.rateOverTime),burstOffsets:(r=null!=(u=t.emission.burstOffsets)?u:[],i={},Array.isArray(r)&&r.forEach(function(t){var e=e$(t,Array),r=e?t[0]:t.index,n=i[r];n||(n=i[r]=[]),e?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])}),i),bursts:(t.emission.bursts||[]).map(function(t){return new aT(t)})},this.textureSheetAnimation=T;var _=t.renderer||{},C={},A=t.rotationOverLifetime;A&&(C.asRotation=!!A.asRotation,C.z=A.z?iC(A.z):iC(0),A.separateAxes&&(C.x=A.x&&iC(A.x),C.y=A.y&&iC(A.y))),p.forceTarget&&(l={target:p.target||[0,0,0],curve:iC(p.forceCurve||[tq.LINE,[[0,0],[1,1]]])});var R={x:p.linearX&&iC(p.linearX||0),y:p.linearY&&iC(p.linearY||0),z:p.linearZ&&iC(p.linearZ||0),asMovement:p.asMovement},S={x:p.orbitalX&&iC(p.orbitalX),y:p.orbitalY&&iC(p.orbitalY),z:p.orbitalZ&&iC(p.orbitalZ),center:p.orbCenter,asRotation:p.asRotation},O=t.sizeOverLifetime||{},b=t.colorOverLifetime,w=(null==O?void 0:O.separateAxes)?{separateAxes:!0,x:iC(O.x),y:iC(O.y)}:{separateAxes:!1,x:iC(("size"in O?O.size:O.x)||1)};_.anchor=_.anchor||[0,0];var L=rP.fromArray(_.anchor);this.options={particleFollowParent:!!d.particleFollowParent,startLifetime:iC(d.startLifetime),startDelay:iC(d.startDelay||0),startSpeed:iC(p.startSpeed||0),startColor:iC(d.startColor),looping:!1,maxCount:null!=(c=d.maxCount)?c:0,gravityModifier:iC(y||0),gravity:g,start3DSize:!!d.start3DSize,startTurbulence:E,turbulence:n,speedOverLifetime:p.speedOverLifetime&&iC(p.speedOverLifetime),linearVelOverLifetime:R,orbitalVelOverLifetime:S,forceTarget:l},d.startRotationZ&&(this.options.startRotation=iC(d.startRotationZ||0)),(d.startRotationX||d.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=iC(d.startRotationX||0),this.options.startRotationY=iC(d.startRotationY||0),this.options.startRotationZ=iC(d.startRotationZ||0)),d.start3DSize?(this.options.startSizeX=iC(d.startSizeX),this.options.startSizeY=iC(d.startSizeY)):(this.options.startSize=iC(d.startSize),this.options.sizeAspect=iC(d.sizeAspect||1));var I={meshSlots:d.meshSlots,name:this.name,matrix:rF.IDENTITY,shaderCachePrefix:"",renderMode:_.renderMode||tH.BILLBOARD,side:_.side||tD.DOUBLE,gravity:g,blending:_.blending||tF.ALPHA,rotationOverLifetime:C,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:T,occlusion:!!_.occlusion,transparentOcclusion:!!_.transparentOcclusion,maxCount:d.maxCount,mask:_.mask,maskMode:null!=(h=_.maskMode)?h:tU.NONE,forceTarget:l,diffuse:_.texture,sizeOverLifetime:w,anchor:L};if(b){var M=b.color,P=b.opacity;I.colorOverLifetime={},P&&(I.colorOverLifetime.opacity=iC(b.opacity)),M&&(M[0]===tq.GRADIENT_COLOR?I.colorOverLifetime.color=b.color[1]:M[0]===tq.RGBA_COLOR?I.colorOverLifetime.color=nc.createWithData(this.engine,{data:new Uint8Array(M[1]),width:1,height:1}):e$(M,nc)&&(I.colorOverLifetime.color=M))}var V=[],N=[0,0,1,1];if(t.splits){var F=t.splits[0];N=(f=F[4])?[F[0],F[1],F[3],F[2]]:[F[0],F[1],F[2],F[3]]}if(T&&!T.animate)for(var D=f?T.row:T.col,U=f?T.col:T.row,z=T.total||D*U,k=0,B=0;B<D;B++)for(var G=0;G<U&&k<z;G++,k++)V.push([B*N[2]/D+N[0],G*N[3]/U+N[1],N[2]/D,N[3]/U]);else V.push(N);this.uvs=V,I.textureFlip=f;var X=t.trails;X&&(this.trails={lifetime:iC(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},m={name:"Trail",matrix:rF.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:d.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture,opacityOverLifetime:iC(X.opacityOverLifetime||1),widthOverTrail:iC(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion,textureMap:X.textureMap,mask:_.mask,maskMode:_.maskMode},X.colorOverLifetime&&X.colorOverLifetime[0]===tq.GRADIENT_COLOR&&(m.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===tq.GRADIENT_COLOR&&(m.colorOverTrail=X.colorOverTrail[1])),this.renderer=new aC(this.engine,I,m),this.meshes=this.renderer.meshes;var H=t.interaction;H&&(this.interaction={multiple:H.multiple,radius:H.radius,behavior:H.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this,this.renderer.item=this.item,this.item.components.push(this.renderer),this.item.rendererComponents.push(this.renderer),this.item.getComponent(ob).createTrack(oy).createClip(aP)},rC(r,[{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}}]),r}(rZ),t.ParticleSystem=e1([rj(er.ParticleSystem)],t.ParticleSystem);var aA=new rV,aR=new rP,aS=new rD,aO=new rV,ab=new rV,aw=new rV,aL=new rD,aI=[0,0,0],aM=new rF,aP=function(e){function r(){return e.apply(this,arguments)}rR(r,e);var i=r.prototype;return i.onPlayablePlay=function(){this.particleSystem=this.bindingItem.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=this.bindingItem.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform())},i.processFrame=function(t){var e=this.particleSystem;e&&(e.setVisible(!0),e.onUpdate(t))},r}(od),aV=function(t){function e(){return t.apply(this,arguments)}return rR(e,t),e}(rJ);function aN(t,e){return e&&("object"===e0(e)||"function"==typeof e)?e:ox(t)}var aF=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=t.textWidth,i=t.textOverflow,n=void 0===i?t8.display:i,o=t.textBaseline,a=void 0===o?t9.top:o,s=t.textAlign,u=void 0===s?t7.left:s,l=t.text,c=t.letterSpace,h=void 0===c?0:c,f=t.autoWidth,m=t.fontSize,d=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=l.length*(m+h),this.width=void 0===r?100:r,this.height=void 0===e?100:e,this.letterSpace=h,this.overFlow=n,this.textBaseline=a,this.textAlign=u,this.lineHeight=void 0===d?m:d}var e=t.prototype;return e.getOffsetY=function(t){var e=0,r=(t.fontSize+t.outlineWidth)*t.fontScale;switch(this.textBaseline){case t9.top:e=r;break;case t9.middle:e=(this.height+r)/2;break;case t9.bottom:e=this.height-r/2}return e},e.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case t7.left:r=t.outlineWidth*t.fontScale;break;case t7.middle:r=(this.width*t.fontScale-e)/2;break;case t7.right:r=this.width*t.fontScale-e}return r},e.setSize=function(t,e){this.width=t,this.height=e},t}(),aD=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,r,i,n,o,a,s=t.textColor,u=t.fontSize,l=t.outline,c=t.shadow,h=t.fontWeight,f=t.fontStyle,m=t.fontFamily;this.textColor=void 0===s?[1,1,1,1]:s,this.textWeight=void 0===h?"normal":h,this.fontStyle=void 0===f?"normal":f,this.fontFamily=void 0===m?"sans-serif":m,this.fontSize=void 0===u?40:u,l&&(this.isOutlined=!0,this.outlineColor=null!=(e=l.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(r=l.outlineWidth)?r:1,this.fontOffset+=this.outlineWidth),c&&(this.hasShadow=!0,this.shadowBlur=null!=(i=c.shadowBlur)?i:2,this.shadowColor=null!=(n=c.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(o=c.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(a=c.shadowOffsetY)?a:0),this.fontStyle!==ee.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},aU=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)return this.elements.shift();if(oN[oV])return window._createOffscreenCanvas(10,10);var t=document.createElement("canvas");return t.getContext("2d",{willReadFrequently:!0}),t},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?e8(this.elements,t):t.remove()},t}()),az=["serif","sans-serif","monospace","courier"];t.TextComponent=function(t){function e(e,r){if((i=t.call(this,e,r)||this).isDirty=!0,i.canvas=aU.getCanvas(),aU.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),!r)return aN(i);var i,n=r.options;return i.textStyle=new aD(n),i.textLayout=new aF(n),i.text=n.text,i.updateTexture(),i}rR(e,t);var r=e.prototype;return r.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}},r.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},r.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},r.setText=function(t){this.text!==t&&(this.text=t,this.isDirty=!0)},r.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},r.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},r.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},r.setFontFamily=function(t){this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0)},r.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},r.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},r.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},r.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},r.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},r.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},r.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},r.update=function(e){t.prototype.update.call(this,e),this.updateTexture()},r.updateTexture=function(){if(this.isDirty&&this.context&&this.canvas){var t=this.context,e=this.textStyle,r=this.textLayout,i=e.fontScale,n=(r.width+e.fontOffset)*i,o=r.height*i,a=e.fontSize*i,s=r.lineHeight*i;this.char=(this.text||"").split(""),this.canvas.width=n,this.canvas.height=o,t.clearRect(0,0,n,this.canvas.height),t.fillStyle="rgba(255, 255, 255, 0.0039)",t.fillRect(0,0,n,this.canvas.height),e.fontDesc=this.getFontDesc(),t.font=e.fontDesc,e.hasShadow&&this.setupShadow(),e.isOutlined&&this.setupOutline(),t.fillStyle="rgba("+e.textColor[0]+", "+e.textColor[1]+", "+e.textColor[2]+", "+e.textColor[3]+")";for(var u=[],l=0,c=r.getOffsetY(e)+(s-a)/3,h=[],f=[],m=0;m<this.char.length;m++){var d=this.char[m],p=t.measureText(d);((l+=r.letterSpace*i)+p.width>n&&m>0||"\n"===d)&&(u.push({y:c,width:l,chars:h,charOffsetX:f}),l=0,c+=s,h=[],f=[]),"\n"!==d&&(h.push(d),f.push(l),l+=p.width)}u.push({y:c,width:l,chars:h,charOffsetX:f}),u.forEach(function(i){var n=r.getOffsetX(e,i.width);i.chars.forEach(function(r,o){e.isOutlined&&t.strokeText(r,n+i.charOffsetX[o],i.y),t.fillText(r,n+i.charOffsetX[o],i.y)})}),e.hasShadow&&(t.shadowColor="transparent");var v=t.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",nc.createWithData(this.engine,{data:new Uint8Array(v.data),width:v.width,height:v.height},{flipY:!0,magFilter:ij.LINEAR,minFilter:ij.LINEAR,wrapS:ij.CLAMP_TO_EDGE,wrapT:ij.CLAMP_TO_EDGE})),this.isDirty=!1}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.options;this.textStyle=new aD(r),this.textLayout=new aF(r),this.text=r.text,this.updateTexture()},r.getFontDesc=function(){var t=this.textStyle,e=""+(t.fontSize*t.fontScale).toString()+"px ";return az.includes(t.fontFamily)?e+=t.fontFamily:e+='"'+t.fontFamily+'"',t.textWeight!==et.normal&&(e=t.textWeight+" "+e),t.fontStyle!==ee.normal&&(e=t.fontStyle+" "+e),e},r.setupOutline=function(){var t=this.context,e=this.textStyle;t.strokeStyle="rgba("+255*e.outlineColor[0]+", "+255*e.outlineColor[1]+", "+255*e.outlineColor[2]+", "+e.outlineColor[3]+")",t.lineWidth=2*e.outlineWidth},r.setupShadow=function(){var t=this.context,e=this.textStyle;t.shadowColor="rgba("+255*e.shadowColor[0]+", "+255*e.shadowColor[1]+", "+255*e.shadowColor[2]+", "+e.shadowColor[3]+")",t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=-e.shadowOffsetY},e}(t.SpriteComponent),t.TextComponent=e1([rj(er.TextComponent)],t.TextComponent);var ak=function(t){function e(){return t.apply(this,arguments)}return rR(e,t),e}(rJ),aB=1;function aG(t,e){var r=t.type,i=t.pluginName;if(!i)switch(r){case tX.null:i="cal";break;case tX.sprite:i="sprite";break;case tX.particle:i="particle";break;case tX.interact:i="interact";break;case tX.camera:i="camera";break;case tX.text:i="text";break;case tX.tree:i="tree";break;default:throw Error("invalid vfx item type")}return e.pluginSystem.createPluginItem(i,t,e)}t.EffectComponent=function(e){function r(t){var r;return(r=e.call(this,t)||this).worldMatrix=rF.fromIdentity(),r.triangles=[],r.destroyed=!1,r.visible=!1,r.getHitTestParams=function(t){var e=r.getBoundingBox();if(e)return{type:e.type,triangles:e.area}},r.id="Mesh"+aB++,r.name="<unnamed>",r._priority=0,r}rR(r,e);var i=r.prototype;return i.setVisible=function(t){this.visible=t},i.start=function(){this.item.getHitTestParams=this.getHitTestParams},i.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},i.getVisible=function(){return this.visible},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},i.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.hitTestGeometry!==this.geometry&&(this.triangles=function(t){for(var e=t.getIndexData(),r=t.getAttributeData("aPos"),i=[],n=0;n<e.length;n+=3){var o=3*e[n],a=3*e[n+1],s=3*e[n+2],u={x:r[o],y:r[o+1],z:r[o+2]},l={x:r[a],y:r[a+1],z:r[a+2]},c={x:r[s],y:r[s+1],z:r[s+2]};i.push({p0:u,p1:l,p2:c})}return i}(this.geometry),this.hitTestGeometry=this.geometry);for(var r,i=[],n=rO(this.triangles);!(r=n()).done;){var o=r.value;i.push({p0:o.p0,p1:o.p1,p2:o.p2})}return i.forEach(function(t){t.p0=e.transformPoint(t.p0,new rV),t.p1=e.transformPoint(t.p1,new rV),t.p2=e.transformPoint(t.p2,new rV)}),{type:t.HitTestType.triangle,area:i}},i.fromData=function(t){e.prototype.fromData.call(this,t),this.material=this.materials[0]},i.toData=function(){this.taggedProperties.id=this.guid},i.dispose=function(t){this.destroyed||(this.destroyed=!0,e.prototype.dispose.call(this))},rC(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(rQ),e1([rY()],t.EffectComponent.prototype,"geometry",void 0),t.EffectComponent=e1([rj(er.EffectComponent)],t.EffectComponent),t.VFXItem=function(e){function r(t,r){var i;return(i=e.call(this,t)||this).children=[],i.transform=new iP,i.duration=0,i.start=0,i.ended=!1,i.delaying=!0,i.type=tX.base,i.stopped=!1,i.components=[],i.itemBehaviours=[],i.rendererComponents=[],i.visible=!0,i._contentVisible=!1,i.speed=1,i.name="VFXItem",i.transform.name=i.name,i.transform.engine=t,i.addComponent(ob),r&&i.fromData(r),i}rR(r,e);var i=r.prototype;return i.setSpeed=function(t){this.speed=t},i.getSpeed=function(){return this.speed},i.addComponent=function(t){var e=new t(this.engine);return e.item=this,this.components.push(e),e.onAttached(),e},i.getComponent=function(t){for(var e,r,i=rO(this.components);!(r=i()).done;){var n=r.value;if(e$(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,r=[],i=rO(this.components);!(e=i()).done;){var n=e.value;e$(n,t)&&r.push(n)}return r},i.setParent=function(t){t!==this&&(this.parent&&e9(this.parent.children,this),this.parent=t,t&&(r.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition)))},i.stop=function(){this.stopped=!0},i.onEnd=function(){},i.setColor=function(t,e,r,i){},i.setOpacity=function(t){},i.getVisible=function(){return this.visible},i.setVisible=function(t){this.visible!==t&&(this.visible=!!t)},i.getWorldTransform=function(t){var e=null!=t?t:new iP({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.getNodeTransform=function(t){for(var e=0;e<this.components.length;e++){var r=this.components[1];if(r.getNodeTransform)return r.getNodeTransform(t)}return this.transform},i.translate=function(t,e,r){this.transform.translate(t,e,r)},i.rotate=function(t,e,r){var i=new rD(t,e,r),n=rN.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},i.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,o=i.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition(2*t*n/a,-2*e*o/s,r)}},i.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},i.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},i.setScale=function(t,e,r){this.transform.setScale(t,e,r)},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.getCurrentPosition=function(){var t=new rV;return this.transform.assignWorldTRS(t),t},i.isEnded=function(t){return t-this.duration>.001},i.find=function(t){if(this.name===t)return this;for(var e,r=rO(this.children);!(e=r()).done;){var i=e.value;if(i.name===t)return i}for(var n,o=rO(this.children);!(n=o()).done;){var a=n.value.find(t);if(a)return a}},i.fromData=function(t){e.prototype.fromData.call(this,t);var r=t.id,i=t.name,n=t.delay,o=t.parentId,a=t.endBehavior,s=t.transform,u=t.listIndex,l=t.duration,c=void 0===l?0:l;if(this.props=t,this.type=t.type,this.id=r.toString(),this.name=i,this.start=n||this.start,s&&(s.position=new rV().copyFrom(s.position),s.rotation=new rD().copyFrom(null!=(h=s.eulerHint)?h:s.rotation),s.scale=new rV().copyFrom(s.scale),s.size&&(s.size=new rP().copyFrom(s.size)),s.anchor&&(s.anchor=new rP().copyFrom(s.anchor)),this.transform.setTransform(s)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=o,this.duration=c,this.endBehavior=a,this.lifetime=-(this.start/this.duration),this.listIndex=void 0===u?0:u,this.oldId=t.oldId,t.content||(t.content={options:{}}),this.getComponent(ob).fromData(t.content),c<=0)throw Error("Item duration can't be less than 0, see "+iH["Item duration can't be less than 0"]);if(t.components)for(var h,f,m=rO(t.components);!(f=m()).done;){var d=f.value;this.components.push(d),e$(d,rQ)?this.rendererComponents.push(d):e$(d,rK)&&this.itemBehaviours.push(d)}},i.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=er.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.taggedProperties.parentId=null==(r=this.parent)?void 0:r.guid),!this.taggedProperties.components){this.taggedProperties.components=[];for(var e,r,i,n=rO(this.components);!(i=n()).done;){var o=i.value;e$(o,t.EffectComponent)&&this.taggedProperties.components.push(o)}}this.taggedProperties.content={}},i.translateByPixel=function(t,e){if(this.composition){var r=this.composition.renderer.canvas.getBoundingClientRect(),i=r.width,n=r.height,o=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(o),s=a.x,u=a.y;this.transform.translate(2*t*s/i,-2*e*u/n,0)}},i.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=rO(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this.composition=null,this._contentVisible=!1,this.transform.setValid(!1)}},i.resetChildrenParent=function(){for(var t,e,r=rO(this.children);!(e=r()).done;){var i=e.value;this.parent&&i.setParent(this.parent)}this.parent&&e9(null==(t=this.parent)?void 0:t.children,this)},r.isComposition=function(t){return t.type===tX.composition},r.isSprite=function(t){return t.type===tX.sprite},r.isParticle=function(t){return t.type===tX.particle},r.isNull=function(t){return t.type===tX.null},r.isTree=function(t){return t.type===tX.tree},r.isCamera=function(t){return t.type===tX.camera},r.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},rC(r,[{key:"content",get:function(){return this._content}},{key:"reusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"lifetimeStarted",get:function(){return!this.delaying}}]),r}(rW),t.VFXItem=e1([rj(er.VFXItemData)],t.VFXItem),t.Item=void 0,(J=t.Item||(t.Item={})).is=function(t,e){return t.type===e},J.isComposition=function(t){return t.type===tX.composition},J.isParticle=function(t){return t.type===tX.particle},J.isNull=function(t){return t.type===tX.null};var aX={},aH=[],aY={};function aj(t,e,r,i){aY[t]=r,aX[t]=e,i&&e8(aH,t)}var aW=function(){function e(t){var e={},r=[],i=function(t){var i=aX[t];r.includes(i)||(r.push(i),e[t]=i)};aH.forEach(i),t.forEach(i),this.plugins=Object.keys(e).map(function(t){var e,r=aX[t];if(!r)throw Error("plugin '"+t+"' not found."+((e=aZ[t])?"\nInstall Plugin: npm i "+e+"@latest --save\nImport Plugin: import '"+e+"'":""));var i=new r;return i.name=t,i}).sort(function(t,e){return t.order-e.order})}var r=e.prototype;return r.initializeComposition=function(t,e){this.plugins.forEach(function(r){return r.onCompositionConstructed(t,e)})},r.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},r.resetComposition=function(t,e){this.plugins.forEach(function(r){return r.onCompositionReset(t,e)})},r.createPluginItem=function(e,r,i){var n=aY[e];if(!n)throw Error("plugin "+e+" no registered constructor");var o=new n(i.getEngine(),r,i);if(o.composition=i,!e$(o,t.VFXItem))throw Error("plugin "+e+" invalid constructor type");return o},r.processRawJSON=function(t,e){var r=this;return eJ(function(){return e2(this,function(i){return[2,r.callStatic("processRawJSON",t,e)]})})()},r.callStatic=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n=this;return eJ(function(){var e,i,o,a,s,u;return e2(this,function(l){for(o=0,e=[],i=n.plugins;o<i.length;o++)t in(a=aX[i[o].name])&&e.push(Promise.resolve(null==(u=a[t])?void 0:(s=u).call.apply(s,[].concat([a],r))));return[2,Promise.all(e)]})})()},r.precompile=function(t,e,r){var i=this;return eJ(function(){return e2(this,function(n){return[2,i.callStatic("precompile",t,e,r)]})})()},r.loadResources=function(t,e){var r=this;return eJ(function(){return e2(this,function(i){return[2,r.callStatic("prepareResource",t,e)]})})()},e}(),aZ={"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"},aq=function(){return(aq=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};function aK(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function aQ(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function aJ(t,e,r){if(r||2==arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;for(var a$={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},a0=new Uint8Array(16),a1=[],a2=0;a2<256;++a2)a1.push((a2+256).toString(16).slice(1));function a3(t,e){if(!t.includes(e))return t.push(e),!0}function a4(t){if(Number.isFinite(t))return[eR.CONSTANT,t];if(t){if("lines"===t[0])return[eR.LINE,t[1]];if("curve"===t[0])return[eR.CURVE,t[1]];if("static"===t[0])return[eR.CONSTANT,t[1]]}}function a5(t,e){return Array.isArray(t)&&"random"===t[0]?[eR.CONSTANT,t[1][e]]:a4(t)}function a6(t){return t&&"color"===t[0]?a7(t[1],!0):[1,1,1,1]}function a8(t){return t&&"random"===t[0]?[eR.RANDOM,t[1]]:a4(t)}function a9(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach(function(i){var n,o=(n=/^(-)?([\d+.]+)%$/.exec(i))?+n[2]/100*(n[1]?-1:1):+i,a=a7(t[i],e);r.push([o,a[0],a[1],a[2],a[3]])}),r=r.sort(function(t,e){return t[0]-e[0]}),[eR.GRADIENT_COLOR,r]}}function a7(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255])}else e$(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=function(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}(r)),r}function st(t,e){return Array.isArray(t)?("gradient"===t[0]||"color"===t[0])&&a9(t[1],e):a9(t,e)}function se(t){if(t){if(3===t.length)return[eR.CONSTANT_VEC3,t];if("path"===t[0])return[eR.LINEAR_PATH,t[1]];if("bezier"===t[0])return[eR.BEZIER_PATH,t[1]]}}function sr(t){var e,r;try{for(var i=aK(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;t[o]=Number(t[o])}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}function si(t){var e,r;try{for(var i=aK(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;void 0===t[o]&&delete t[o]}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}($=eh||(eh={})).S="S",$.APlus="A+",$.A="A",$.BPlus="B+",$.B="B",(tt=ef||(ef={}))[tt.ALPHA=0]="ALPHA",tt[tt.ADD=1]="ADD",tt[tt.MULTIPLY=2]="MULTIPLY",tt[tt.BRIGHTNESS=3]="BRIGHTNESS",tt[tt.SUBTRACTION=4]="SUBTRACTION",tt[tt.STRONG_LIGHT=5]="STRONG_LIGHT",tt[tt.WEAK_LIGHT=6]="WEAK_LIGHT",tt[tt.SUPERPOSITION=7]="SUPERPOSITION",(te=em||(em={}))[te.DOUBLE=1032]="DOUBLE",te[te.FRONT=1028]="FRONT",te[te.BACK=1029]="BACK",(tr=ed||(ed={}))[tr.NONE=0]="NONE",tr[tr.MASK=1]="MASK",tr[tr.OBSCURED=2]="OBSCURED",tr[tr.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(ti=ep||(ep={}))[ti.NONE=0]="NONE",ti[ti.SPHERE=1]="SPHERE",ti[ti.CONE=2]="CONE",ti[ti.HEMISPHERE=3]="HEMISPHERE",ti[ti.CIRCLE=4]="CIRCLE",ti[ti.DONUT=5]="DONUT",ti[ti.RECTANGLE=6]="RECTANGLE",ti[ti.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",ti[ti.EDGE=8]="EDGE",ti[ti.TEXTURE=9]="TEXTURE",(tn=ev||(ev={}))[tn.GYROSCOPE=0]="GYROSCOPE",tn[tn.SPINE=1]="SPINE",(to=ey||(ey={}))[to.CLICK=0]="CLICK",to[to.MESSAGE=1]="MESSAGE",to[to.DRAG=2]="DRAG",(ta=eg||(eg={}))[ta.NONE=0]="NONE",ta[ta.NOTIFY=1]="NOTIFY",ta[ta.RESUME_PLAYER=2]="RESUME_PLAYER",ta[ta.REMOVE=3]="REMOVE",ta[ta.PAUSE=4]="PAUSE",(ts=ex||(ex={})).base="0",ts.sprite="1",ts.particle="2",ts.null="3",ts.interact="4",ts.plugin="5",ts.camera="6",ts.composition="7",ts.spine="spine",ts.mesh="mesh",ts.tree="tree",ts.text="text",ts.light="light",ts.skybox="skybox",ts.effect="effect",(tu=eT||(eT={}))[tu.BILLBOARD=0]="BILLBOARD",tu[tu.MESH=1]="MESH",tu[tu.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",tu[tu.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(tl=eE||(eE={}))[tl.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",tl[tl.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",tl[tl.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",tl[tl.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",tl[tl.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",tl[tl.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",tl[tl.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",tl[tl.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",tl[tl.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(tc=e_||(e_={}))[tc.portrait=1]="portrait",tc[tc.landscape=0]="landscape",(th=eC||(eC={}))[th.destroy=0]="destroy",th[th.pause=1]="pause",th[th.restart=5]="restart",th[th.forward=2]="forward",th[th.pause_destroy=3]="pause_destroy",th[th.freeze=4]="freeze",(tf=eA||(eA={})).video="video",tf.image="image",(tm=eR||(eR={}))[tm.CONSTANT=0]="CONSTANT",tm[tm.CONSTANT_VEC2=1]="CONSTANT_VEC2",tm[tm.CONSTANT_VEC3=2]="CONSTANT_VEC3",tm[tm.CONSTANT_VEC4=3]="CONSTANT_VEC4",tm[tm.RANDOM=4]="RANDOM",tm[tm.LINE=5]="LINE",tm[tm.CURVE=6]="CURVE",tm[tm.BEZIER_PATH=7]="BEZIER_PATH",tm[tm.RGBA_COLOR=8]="RGBA_COLOR",tm[tm.GRADIENT_COLOR=9]="GRADIENT_COLOR",tm[tm.SHAPE_POINTS=10]="SHAPE_POINTS",tm[tm.SHAPE_SPLITS=11]="SHAPE_SPLITS",tm[tm.LINEAR_PATH=12]="LINEAR_PATH",tm[tm.COLORS=13]="COLORS",tm[tm.BINARY=20]="BINARY",tm[tm.BEZIER_CURVE=21]="BEZIER_CURVE",tm[tm.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",(td=eS||(eS={}))[td.AUTO=0]="AUTO",td[td.EASE=1]="EASE",td[td.EASE_IN=2]="EASE_IN",td[td.EASE_OUT=3]="EASE_OUT",td[td.LINE=4]="LINE",td[td.HOLD=5]="HOLD",td[td.LINE_OUT=6]="LINE_OUT",(tp=eO||(eO={}))[tp.destroy=0]="destroy",tp[tp.loop=5]="loop",tp[tp.freeze=4]="freeze",(tv=eb||(eb={}))[tv.destroyChildren=6]="destroyChildren",(ty=ew||(ew={}))[ty.none=0]="none",ty[ty.removeParticle=1]="removeParticle",(tg=eL||(eL={}))[tg.RANDOM=0]="RANDOM",tg[tg.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",tg[tg.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",tg[tg.UNIFORM_BURST=3]="UNIFORM_BURST",(tx=eI||(eI={})).point="point",tx.spot="spot",tx.directional="directional",tx.ambient="ambient",(tT=eM||(eM={}))[tT.box=2]="box",tT[tT.sphere=3]="sphere",(tE=eP||(eP={})).orthographic="orthographic",tE.perspective="perspective",(t_=eV||(eV={})).unlit="unlit",t_.pbr="pbr",t_.hair="hair",(tC=eN||(eN={}))[tC.opaque=100]="opaque",tC[tC.masked=101]="masked",tC[tC.translucent=102]="translucent",tC[tC.additive=103]="additive",(tA=eF||(eF={})).none="none",tA.uv="uv",tA.normal="normal",tA.basecolor="basecolor",tA.alpha="alpha",tA.metallic="metallic",tA.roughness="roughness",tA.ao="ao",tA.emissive="emissive",(tR=eD||(eD={}))[tR.display=0]="display",tR[tR.clip=1]="clip",tR[tR.ellipsis=2]="ellipsis",(tS=eU||(eU={}))[tS.top=0]="top",tS[tS.middle=1]="middle",tS[tS.bottom=2]="bottom",(tO=ez||(ez={}))[tO.left=0]="left",tO[tO.middle=1]="middle",tO[tO.right=2]="right",(tb=ek||(ek={})).normal="normal",tb.bold="bold",tb.lighter="lighter",(tw=eB||(eB={})).normal="normal",tw.italic="italic",tw.oblique="oblique",(tL=eG||(eG={})).VFXItemData="VFXItemData",tL.EffectComponent="EffectComponent",tL.Material="Material",tL.Shader="Shader",tL.SpriteComponent="SpriteComponent",tL.ParticleSystem="ParticleSystem",tL.InteractComponent="InteractComponent",tL.CameraController="CameraController",tL.Geometry="Geometry",tL.Texture="Texture",tL.TextComponent="TextComponent",tL.MeshComponent="MeshComponent",tL.SkyboxComponent="SkyboxComponent",tL.LightComponent="LightComponent",tL.CameraComponent="CameraComponent",tL.ModelPluginComponent="ModelPluginComponent",tL.TreeComponent="TreeComponent",(tI=eX||(eX={}))[tI.POINTS=0]="POINTS",tI[tI.LINES=1]="LINES",tI[tI.LINE_LOOP=2]="LINE_LOOP",tI[tI.LINE_STRIP=3]="LINE_STRIP",tI[tI.TRIANGLES=4]="TRIANGLES",tI[tI.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",tI[tI.TRIANGLE_FAN=6]="TRIANGLE_FAN";var sn=Math.cos,so=Math.sin,sa=Math.PI/180,ss=180/Math.PI;function su(){return(function(t,e,r){if(a$.randomUUID&&!t)return a$.randomUUID();var i,n=(t=t||{}).random||(t.rng||function(){if(!ec&&!(ec="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 ec(a0)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===i&&(i=0),a1[n[i+0]]+a1[n[i+1]]+a1[n[i+2]]+a1[n[i+3]]+"-"+a1[n[i+4]]+a1[n[i+5]]+"-"+a1[n[i+6]]+a1[n[i+7]]+"-"+a1[n[i+8]]+a1[n[i+9]]+"-"+a1[n[i+10]]+a1[n[i+11]]+a1[n[i+12]]+a1[n[i+13]]+a1[n[i+14]]+a1[n[i+15]]})().replace(/-/g,"")}function sl(t,e){return t?[t[0]-.5,.5-t[1]]:e?sc[e]:[0,0]}var sc=((eH={})[eE.PARTICLE_ORIGIN_CENTER]=[0,0],eH[eE.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],eH[eE.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],eH[eE.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],eH[eE.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],eH[eE.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],eH[eE.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],eH[eE.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],eH[eE.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],eH);function sh(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:se(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:a4(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:a4(n.linearX),linearY:a4(n.linearY),linearZ:a4(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:a4(n.orbitalX),orbitalY:a4(n.orbitalY),orbitalZ:a4(n.orbitalZ),speedOverLifetime:a4(n.speedOverLifetime)};si(o);var a={options:{startColor:a6(i.startColor)},positionOverLifetime:o};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var s=t.rotationOverLifetime;if(s){var u=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=a4(s.x),u.y=a4(s.y),u.z=a4(s.z)):u.z=a4(s.angularVelocity)}var l=t.colorOverLifetime;if(l){var c=a.colorOverLifetime={opacity:a4(l.opacity)};l.color&&(c.color=st(l.color))}var h=t.sizeOverLifetime;return h&&(a.sizeOverLifetime={separateAxes:h.separateAxes,size:a4(h.size),x:a4(h.x),y:a4(h.y),z:a4(h.z)}),a}function sf(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===ex.null&&t.endBehavior===eO.destroy&&(t.endBehavior=eO.freeze)})}),t.version="2.1",t}function sm(t){var e,r,i,n,o,a,s,u,l,c,h,f,m=aq(aq({},t),{items:[],components:[],materials:[],shaders:[],geometries:[]});if(null!==(o=m.textures)&&void 0!==o||(m.textures=[]),m.textures.forEach(function(t){t.id=su(),t.dataType=eG.Texture}),m.textures.length<m.images.length)for(var d=m.textures.length;d<m.images.length;d++)m.textures.push({id:su(),dataType:eG.Texture,source:d,flipY:!0});var p={},v=function(t){(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===ex.particle&&t.content.filter&&delete t.content.filter});var e,r,i={};try{for(var n=(e=void 0,aK(t.items)),o=n.next();!o.done;o=n.next()){var a=o.value;i[a.id]=su(),a.oldId=a.id,a.id=i[a.id]}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}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=i[n]+"^"+o}else e.parentId=i[e.parentId]}m.items.push(e),t.items[r]={id:e.id}})};try{for(var y=aK(t.compositions),g=y.next();!g.done;g=y.next()){var x=g.value;v(x)}}catch(t){e={error:t}}finally{try{g&&!g.done&&(r=y.return)&&r.call(y)}finally{if(e)throw e.error}}try{for(var T=aK(m.items),E=T.next();!E.done;E=T.next()){var _=E.value;if(_.content){if(_.content.renderer&&void 0!==_.content.renderer.texture){var C=_.content.renderer.texture;_.content.renderer.texture={id:m.textures[C].id}}if(_.content.trails&&void 0!==_.content.trails.texture){var C=_.content.trails.texture;_.content.trails.texture={id:m.textures[C].id}}}if(_.transform){var A=aJ([],aQ(null!==(a=_.transform.position)&&void 0!==a?a:[0,0,0]),!1),R=aJ([],aQ(null!==(s=_.transform.rotation)&&void 0!==s?s:[0,0,0]),!1),S=aJ([],aQ(null!==(u=_.transform.scale)&&void 0!==u?u:[1,1,1]),!1);if(Object.assign(_,{transform:{position:{x:A[0],y:A[1],z:A[2]},eulerHint:{x:R[0],y:R[1],z:R[2]},scale:{x:S[0],y:S[1],z:S[0]}}}),_.type===ex.sprite&&(_.transform.size={x:S[0],y:S[1]},_.transform.scale={x:1,y:1,z:1}),_.type===ex.sprite){var O=_.content;O.renderer||(O.renderer={});var b=O.renderer,w=sl(b.anchor,b.particleOrigin),L=_.transform.size;b.anchor||void 0===b.particleOrigin||(_.transform.position.x+=-w[0]*(null!==(l=null==L?void 0:L.x)&&void 0!==l?l:1),_.transform.position.y+=-w[1]*(null!==(c=null==L?void 0:L.y)&&void 0!==c?c:1)),_.transform.anchor={x:w[0]*(null!==(h=null==L?void 0:L.x)&&void 0!==h?h:1),y:w[1]*(null!==(f=null==L?void 0:L.y)&&void 0!==f?f:1)}}}if(_.type===ex.particle){var O=_.content;O.renderer||(O.renderer={});var b=O.renderer;O.renderer.anchor=sl(b.anchor,b.particleOrigin)}_.content.tracks=[];var I=_.content.tracks;_.type!==ex.particle&&I.push({clips:[{dataType:"TransformAnimationPlayableAsset",animationClip:{sizeOverLifetime:_.content.sizeOverLifetime,rotationOverLifetime:_.content.rotationOverLifetime,positionOverLifetime:_.content.positionOverLifetime}}]}),_.type===ex.sprite&&I.push({clips:[{dataType:"SpriteColorAnimationPlayableAsset",animationClip:{colorOverLifetime:_.content.colorOverLifetime,startColor:_.content.options.startColor}}]}),_.content.options.target&&(_.content.options.target=p[_.content.options.target]);var M=su();switch((_.type===ex.sprite||_.type===ex.particle||_.type===ex.mesh||_.type===ex.skybox||_.type===ex.light||"camera"===_.type||_.type===ex.tree||_.type===ex.interact||_.type===ex.camera||_.type===ex.text)&&(_.components=[],m.components.push(_.content),_.content.id=M,_.content.item={id:_.id},_.dataType=eG.VFXItemData,_.components.push({id:_.content.id})),_.type){case ex.sprite:_.content.dataType=eG.SpriteComponent;break;case ex.particle:_.content.dataType=eG.ParticleSystem;break;case ex.mesh:_.content.dataType=eG.MeshComponent;break;case ex.skybox:_.content.dataType=eG.SkyboxComponent;break;case ex.light:_.content.dataType=eG.LightComponent;break;case"camera":_.content.dataType=eG.CameraComponent;break;case ex.tree:_.content.dataType=eG.TreeComponent;break;case ex.interact:_.content.dataType=eG.InteractComponent;break;case ex.camera:_.content.dataType=eG.CameraController;break;case ex.text:_.content.dataType=eG.TextComponent}}}catch(t){i={error:t}}finally{try{E&&!E.done&&(n=T.return)&&n.call(T)}finally{if(i)throw i.error}}return m.version="3.0",m}var sd=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,sp=/^(\d+)\.(\d+)$/,sv=!1;function sy(t){if(!t||"object"!=typeof t)throw Error("expect a json object");if(!(l=null===(u=t.version)||void 0===u?void 0:u.split("."))||Number(l[0])>2||2===Number(l[0])&&Number(l[1])>=2||t.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===ex.mesh||t.type===ex.light)&&(t.endBehavior=1===t.endBehavior?eO.destroy:t.endBehavior)})}),sd.test(t.version)){var e,r,i,n,o,a,s;return sv=(null===(c=/^(\d+)/.exec(t.version))||void 0===c?void 0:c[0])==="0",sm(sf((sg="1.0",i=t.plugins||[],(null===(e=t.bins)||void 0===e?void 0:e.length)&&(sg="1.3"),n=(t.requires||[]).slice(),o=t.images.map(function(e,r){return sx(e,r,t.imageTags||[])}),a=t.textures||o.map(function(t,e){return{source:e,flipY:!0}}),s={plugins:i,shapes:t.shapes||[],type:"ge",version:sg,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map(function(t){return sT(t,{plugins:i,requires:n})}),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:a,bins:(t.bins||[]).slice()},t._textures&&(s._textures=t._textures),s)))}var u,l,c,h,f=null===(h=sp.exec(t.version))||void 0===h?void 0:h[1];if(f)return 3>Number(f)?sm(sf(t)):t;throw Error("invalid json version "+t.version)}var sg="1.0";function sx(t,e,r){var i=r[e],n=t.oriY;if("string"==typeof t)return{renderLevel:i,url:t,oriY:n};if(t.template)return{url:t.url,template:t.template,webp:t.webp,renderLevel:i,oriY:n};if(t.compressed)return{url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{url:t.url,webp:t.webp,renderLevel:i,oriY:n};if(t&&t.sourceType)return t;throw Error("invalid image type")}function sT(t,e){void 0===e&&(e={});var r,i={id:t.id+"",camera:aq({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return s_(t,e)}),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var o=null===(r=t.meta)||void 0===r?void 0:r.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(i.previewSize=o),i}var sE=[0,0,0,1];function s_(t,e){void 0===e&&(e={});var r,i,n,o,a,s,u,l,c,h,f,m,d=ex.base,p=t.endBehavior,v=NaN;if(t.content?(d=t.type||ex.plugin,m=t.pn,f=t.pluginName,c=t.content,l=t.content,isNaN(m)&&!f&&(f=c.options.type),t.duration&&(v=t.duration),u=t.transform||T(l.transform)):t.particle?(d=ex.particle,u=T((l=t.particle).transform,sv,!0),c=function(t){var e,r=t.options,i=t.transform,n={type:ep.NONE};if(t.shape){var o=null===(e=t.shape.shape)||void 0===e?void 0:e.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(n=aq(aq({},t.shape),{type:ep[o]}),t.shape.upDirection){var a=aQ(t.shape.upDirection,3),s=a[0],u=a[1],l=a[2];0===s&&0===u&&0===l&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=a8(r.turbulenceX),n.turbulenceY=a8(r.turbulenceY),n.turbulenceZ=a8(r.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map(function(t){return sr(t)})),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map(function(t){return sr(t)})),c.rateOverTime&&(c.rateOverTime=a8(c.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:c,options:{startLifetime:a8(r.startLifetime),start3DSize:!!r.start3DSize,startSize:a8(r.startSize),startSizeX:a8(r.startSizeX),startSizeY:a8(r.startSizeY),sizeAspect:a8(r.sizeAspect),maxCount:r.maxCount,startDelay:a8(r.startDelay),startColor:function(t,e){if(t){if("colors"===t[0])return[eR.COLORS,t[1].map(function(t){return a7(t,e)})];if("gradient"===t[0])return a9(t[1],e);if("color"===t[0])return[eR.RGBA_COLOR,a7(t[1],e)]}}(r.startColor,!0),startRotationZ:a8(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};r.start3DRotation&&(h.options.startRotationX=a8(r.startRotationX),h.options.startRotationY=a8(r.startRotationY)),i&&i.path&&(h.emitterTransform={path:se(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:a8(f.x),y:a8(f.y)}:h.sizeOverLifetime={size:a8(f.size)});var m=t.velocityOverLifetime||{},d=m.speedOverLifetime;d=d?a4(d):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:a4(r.gravityModifier),startSpeed:a8(r.startSpeed),speedOverLifetime:d,asMovement:m.asMovement,linearX:a8(m.linearX),linearY:a8(m.linearY),linearZ:a8(m.linearZ),asRotation:m.asRotation,orbCenter:m.orbCenter,orbitalX:a8(m.orbitalX),orbitalY:a8(m.orbitalY),orbitalZ:a8(m.orbitalZ),forceTarget:m.forceTarget,target:m.target,forceCurve:a4(m.forceCurve)},si(h.positionOverLifetime);var p=t.rotationOverLifetime;p&&(h.rotationOverLifetime={separateAxes:p.separateAxes,asRotation:p.asRotation,z:a8(p.separateAxes?p.z:p.angularVelocity)},p.separateAxes&&(h.rotationOverLifetime.y=a4(p.y),h.rotationOverLifetime.x=a4(p.x)));var v=t.colorOverLifetime;if(v){var y=h.colorOverLifetime={opacity:a4(v.opacity)};v.color&&(y.color=st(v.color))}var g=t.textureSheetAnimation;g&&(h.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:a4(g.cycles),animationDelay:a5(g.animationDelay,0),animationDuration:a5(g.animationDuration,0)});var x=t.trails;x&&(h.trails={lifetime:a8(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:a4(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&st(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&st(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:a8(x.opacityOverLifetime)}),h.trails&&si(h.trails);var T=t.interaction;return T&&(h.interaction={behavior:T.behavior,radius:T.radius,multiple:T.multiple}),h}(l)):t.sprite?(d=ex.sprite,u=T((l=t.sprite).transform,!1,!0),i=sh(r=l,u),(n=r.textureSheetAnimation)&&(i.textureSheetAnimation={row:n.row,col:n.col,total:n.total||void 0,animate:n.animate}),i.renderer=r.renderer,r.splits&&(i.splits=r.splits),r.interaction&&(i.interaction=r.interaction),c=i):t.cal?(d=ex.null,u=T((l=t.cal).transform,!1,!0),c=sh(l,u)):t.ui?(d=ex.interact,u=T((l=t.ui).transform),c=function(t){var e,r=t.options;switch(r.type){case"click":e={type:ey.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&a6(r.previewColor),behavior:r.behavior||eg.NOTIFY};break;case"drag":e={type:ey.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:ey.MESSAGE}}return{options:e}}(l),u.scale=[l.options.width||1,l.options.height||1,1]):t.model&&(l=t.model,1===t.model.options.type&&(d=ex.camera,u=T(l.transform),c=function(t){var e,r,i=t.options,n={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},o=t.velocityOverLifetime;if(o||(null===(e=t.transform)||void 0===e?void 0:e.path)){var a={path:se(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:a4(null==o?void 0:o.translateX),linearY:a4(null==o?void 0:o.translateY),linearZ:a4(null==o?void 0:o.translateZ)};si(a),n.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:a4(null==s?void 0:s.rotateX),y:a4(null==s?void 0:s.rotateY),z:s.separateAxes?a4(null==s?void 0:s.rotateZ):a4(s.rotation)};si(u),n.rotationOverLifetime=u}return n}(l))),null===(o=c.renderer)||void 0===o?void 0:o.anchor){var y=new Float32Array(c.renderer.anchor);.5==y[0]&&.5==y[1]?delete c.renderer.anchor:e.requires&&a3(e.requires,"anchor")}if(l){var g=null===(a=l.options)||void 0===a?void 0:a.looping;p=g?Array.isArray(g)?g[1]?eO.loop:eO.destroy:eO.loop:p||(null===(s=null==l?void 0:l.options)||void 0===s?void 0:s.endBehavior)||eO.destroy,l.options.renderLevel&&(h=l.options.renderLevel),isNaN(v)&&(v=l.options.duration)}var x={type:d,name:t.name,delay:t.delay,duration:v,id:t.id+"",transform:u,endBehavior:p,renderLevel:h,content:c};return f?e.plugins?(a3(e.plugins,f),x.pn=e.plugins.indexOf(f)):x.pluginName=f:Number.isInteger(m)&&(x.pn=m),t.parentId&&(x.parentId=t.parentId+""),x;function T(t,e,r){if(t){var i={},n=t.rotation;if(n&&(e?i.rotation=[-n[0],-n[1],-n[2]]:i.rotation=[n[0],n[1],n[2]],r)){var o,a,s,u,l,c,h,f,m,d,p,v,y,g,x,T,E,_,C,A,R,S,O,b,w=(o=i.rotation[0],a=i.rotation[1],s=i.rotation[2],u=sn(o*sa/2),l=sn(a*sa/2),c=sn(s*sa/2),h=so(o*sa/2),f=so(a*sa/2),m=so(s*sa/2),sE[0]=h*l*c+u*f*m,sE[1]=u*f*c-h*l*m,sE[2]=u*l*m+h*f*c,sE[3]=u*l*c-h*f*m,sE);i.rotation=(d=[],p=w[0],v=w[1],y=w[2],g=w[3],x=p+p,T=v+v,E=y+y,_=p*x,C=v*x,A=v*T,R=y*E,S=g*E,O=y*x-g*T,d[1]=Math.asin((b=-O)>1?1:b<-1?-1:b)*ss,.9999999>Math.abs(O)?(d[0]=Math.atan2(y*T+g*x,1-_-A)*ss,d[2]=Math.atan2(C+S,1-A-R)*ss):(d[0]=0,d[2]=Math.atan2(-(C-S),1-_-R)*ss),d)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}return{}}}var sC=((eY={})[tN.S]=[tN.S,tN.BPlus,tN.APlus],eY[tN.A]=[tN.A,tN.BPlus,tN.APlus],eY[tN.B]=[tN.B,tN.BPlus],eY);function sA(t,e){if(!t||!e)return!0;var r=sC[e];return!!r&&r.includes(t)}function sR(t){return rg(t)&&"jsonScene"in t}function sS(t){return rg(t)&&"url"in t}function sO(t){return rg(t)&&"options"in t}function sb(t,e){var r,i,n=null!=(i=null==t?void 0:t.background)?i:{},o=n.name,a=n.url;return o&&(e&&e[o]?r=e[o]:a&&(r=a)),r}function sw(t,e,r){return sL.apply(this,arguments)}function sL(){return(sL=eJ(function(t,e,r){var i,n,o,a;return e2(this,function(s){switch(s.label){case 0:if("string"!=typeof t)return[3,2];return[4,i6(t)];case 1:return i=s.sent(),[3,3];case 2:i=t,s.label=3;case 3:if(!i)throw Error("image not provided.");if(!e)return[2,i];if(n=i,!((o=sb(e,r))&&rp(o)&&o!==i.src))return[3,7];if(!rp(o))return[3,5];return[4,i6(o)];case 4:return a=s.sent(),[3,6];case 5:a=o,s.label=6;case 6:n=a,s.label=7;case 7:return[2,n]}})})).apply(this,arguments)}var sI=1,sM=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new i2),this.options=t,this.downloader=e,this.assets={},this.id=sI++,this.timers=[],this.updateOptions(t)}var r=e.prototype;return r.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout;this.timeout=void 0===e?10:e},r.updateSceneData=function(t){var e=this.options.variables;e&&0!==Object.keys(e).length&&t.forEach(function(t){if(t.type===tX.text){var r=e[t.name];r&&(t.content.options.text=r)}})},r.loadScene=function(t,e,r){var i=this;return eJ(function(){var n,o,a,s,u,l,c,h,f,m,d,p,v,y;return e2(this,function(g){return a=rp(t)?t:i.id,s=performance.now(),u=[],h=null!=(c=null==(l=null==e?void 0:e.engine.gpuCapability)?void 0:null==(n=l.detail)?void 0:n.asyncShaderCompile)&&c,m=null!=(f=null==l?void 0:l.detail.compressedTexture)?f:0,p=!1,v=new Promise(function(t,e){d=window.setTimeout(function(){p=!0,i.removeTimer(d),e(Error("Load time out: totalTime: "+(performance.now()-s).toFixed(4)+"ms "+u.join(" ")+", url: "+a))},1e3*i.timeout),i.timers.push(d)}),y=eJ(function(t,e){var r,i;return e2(this,function(n){switch(n.label){case 0:if(p)return[3,4];r=performance.now(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e()];case 2:return i=n.sent(),u.push("["+t+": "+(performance.now()-r).toFixed(2)+"]"),[2,i];case 3:throw Error("Load error in "+t+", "+n.sent());case 4:throw Error("Load canceled.")}})}),[2,Promise.race([v,eJ(function(){var n,l,c,f,p,v,g,x,T,E,_,C,A,R,S,O,b,w,L;return e2(this,function(I){switch(I.label){case 0:if(!rg(t))return[3,1];return o=t,i.baseUrl=location.href,[3,3];case 1:return t=new URL(t,location.href).href,i.baseUrl=t,[4,y("loadJSON",function(){return i.loadJSON(t)})];case 2:o=I.sent(),I.label=3;case 3:if(!sR(o))return[3,6];if(n=i1({},o),!(i.options&&i.options.variables&&0!==Object.keys(i.options.variables).length))return[3,5];for(f=0,l=o.jsonScene.images,c=n.images;f<l.length;f++)e$(c[f],HTMLCanvasElement)&&(c[f]=l[f]);return[4,y("processImages",function(){return i.processImages(c,n.usedImages,m)})];case 4:for(p=0,n.images=I.sent();p<n.images.length;p++)n.textureOptions[p].image=n.images[p];i.updateSceneData(n.jsonScene.items),I.label=5;case 5:return[3,12];case 6:return[4,y("processJSON",function(){return i.processJSON(o)})];case 7:return g=(v=I.sent()).usedImages,x=v.jsonScene,T=v.pluginSystem,_=void 0===(E=x.bins)?[]:E,C=x.images,A=x.compositions,R=x.fonts,[4,Promise.all([y("processBins",function(){return i.processBins(_)}),y("processImages",function(){return i.processImages(C,g,m)}),y((h?"async":"sync")+" compile",function(){return i.precompile(A,T,e,r)})])];case 8:return O=(S=I.sent())[0],b=S[1],[4,y("processFontURL",function(){return i.processFontURL(R)})];case 9:return I.sent(),[4,y("processTextures",function(){return i.processTextures(b,O,x)})];case 10:return w=I.sent(),i.updateSceneData(x.items),n={url:t,renderLevel:i.options.renderLevel,storage:{},pluginSystem:T,jsonScene:x,usedImages:g,images:b,textureOptions:w,bins:O},[4,y("processPlugins",function(){return T.loadResources(n,i.options)})];case 11:I.sent(),I.label=12;case 12:return L=performance.now()-s,rm.info("Load asset: totalTime: "+L.toFixed(4)+"ms "+u.join(" ")+", url: "+a),window.clearTimeout(d),i.removeTimer(d),n.totalTime=L,n.startTime=s,[2,n]}})})()])]})})()},r.precompile=function(t,e,r,i){return eJ(function(){var n;return e2(this,function(o){switch(o.label){case 0:if(!r||!r.getShaderLibrary())return[2];return n=null==r?void 0:r.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,r,i)];case 1:return o.sent(),[4,new Promise(function(t){n.compileAllShaders(function(){t(null)})})];case 2:return o.sent(),[2]}})})()},r.processJSON=function(t){var e=this;return eJ(function(){var r,i,n,o,a,s,u,l,c;return e2(this,function(h){switch(h.label){case 0:return r=sy(t),t.compositions.forEach(function(t,e){t.globalVolume&&(r.compositions[e].globalVolume=t.globalVolume)}),n=void 0===(i=r.plugins)?[]:i,o=r.compositions,a=r.imgUsage,s=r.images,[4,(u=new aW(n)).processRawJSON(r,e.options)];case 1:return h.sent(),l=e.options.renderLevel,c={},a?function(t,e,r,i,n){for(var o=0;o<e.length;o++){var a=r[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];sA(i[u].renderLevel,n)&&(t[u]=!0)}}}(c,o,a,s,l):null==s||s.forEach(function(t,e){c[e]=!0}),[2,{usedImages:c,jsonScene:r,pluginSystem:u}]}})})()},r.processBins=function(t){var e=this;return eJ(function(){var r,i;return e2(this,function(n){return r=e.options.renderLevel,i=e.baseUrl,[2,Promise.all(t.map(function(n){if(e$(n,ArrayBuffer))return n;if(sA(n.renderLevel,r))return e.loadBins(new URL(n.url,i).href);throw Error("Invalid bins source: "+JSON.stringify(t))}))]})})()},r.processFontURL=function(t){var r=this;return eJ(function(){return e2(this,function(i){return t?[2,Promise.all(t.map(eJ(function(t){var i,n,o;return e2(this,function(a){switch(a.label){case 0:if(!(t.fontURL&&!e.fonts.has(t.fontFamily)))return[3,4];i=new URL(t.fontURL,r.baseUrl).href,o=new FontFace(null!=(n=t.fontFamily)?n:"","url("+i+")"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,o.load()];case 2:return a.sent(),document.fonts.add(o),e.fonts.add(t.fontFamily),[3,4];case 3:return a.sent(),rm.warn("Invalid fonts source: "+JSON.stringify(i)),[3,4];case 4:return[2]}})})))]:[2]})})()},r.processImages=function(e,r,i){var n=this;return eJ(function(){var o,a,s,u;return e2(this,function(l){return a=(o=n.options).useCompressedTexture,s=o.variables,u=n.baseUrl,[2,Promise.all(e.map(eJ(function(e,o){var l,c,h,f,m,d,p,v,y,g,x,T,E,_,C,A;return e2(this,function(R){switch(R.label){case 0:if(!r[o])return[2,void 0];if(l=e.url,c=e.webp,h=new URL(l,u).href,f=c&&new URL(c,u).href,!("template"in e))return[3,8];if(!(d=(m=e.template).background))return[3,7];p=sb(m,s),v=d.type===tZ.video,y=d&&v?ne:i6,R.label=1;case 1:return R.trys.push([1,6,,7]),[4,ni(p,y)];case 2:if(!e$(g=R.sent(),HTMLVideoElement))return[3,3];return[2,g];case 3:return d&&Array.isArray(p)&&s&&(s[d.name]=g.src),[4,sw(g,m,s)];case 4:return[2,R.sent()];case 5:return[3,7];case 6:throw R.sent(),Error("Failed to load. Check the template or if the URL is "+(v?"video":"image")+" type, URL: "+p+".");case 7:return[3,9];case 8:if("compressed"in e&&a&&i){if(x=e.compressed,i===ot.ASTC?T=x.astc:i===ot.PVRTC&&(T=x.pvrtc),T)return E=new URL(T,u).href,n.assets[o]={url:E,type:t.TextureSourceType.compressed},[2,n.loadBins(E)]}else if("sourceType"in e)return[2,e];else if(e$(e,HTMLImageElement)||e$(e,HTMLCanvasElement)||e$(e,HTMLVideoElement)||e$(e,nc))return[2,e];R.label=9;case 9:return[4,i4(h,f)];case 10:return C=(_=R.sent()).url,A=_.image,n.assets[o]={url:C,type:t.TextureSourceType.image},[2,A]}})})))]})})()},r.processTextures=function(e,r,i){var n=this;return eJ(function(){var o;return e2(this,function(a){return[2,Promise.all((null!=(o=i.textures)?o:e.map(function(t,e){return{source:e}})).map(eJ(function(o,a){var s,u,l;return e2(this,function(c){switch(c.label){case 0:if(e$(o,nc))return[2,o];if(!("mipmaps"in o))return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,no(o,r,i.bins)];case 2:return[2,c.sent()];case 3:throw Error("load texture "+a+" fails, error message: "+c.sent());case 4:if("number"!=typeof(s=o.source))return[3,5];return u=e[s],[3,7];case 5:if("string"!=typeof s)return[3,7];return[4,i6(function(t,e,r){void 0===e&&(e="base64File"),void 0===r&&(r="");for(var i=atob(t.split(",")[1]||t),n=[],o=0;o<i.length;o+=512){for(var a=i.slice(o,o+512),s=Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);var l=new Uint8Array(s);n.push(l)}return new File([new Blob(n,{type:r})],e,{type:r})}(s))];case 6:u=c.sent(),c.label=7;case 7:if(u)return(l=function(e,r){var i;if(e$(e,nc))return e.source;if(e$(e,HTMLImageElement)||"object"==typeof e&&null!==e&&(null==(i=e.tagName)?void 0:i.toUpperCase())==="CANVAS")return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:ij.LINEAR,magFilter:ij.LINEAR};if(e$(e,HTMLVideoElement))return{sourceType:t.TextureSourceType.video,video:e,minFilter:ij.LINEAR,magFilter:ij.LINEAR};if(e$(e,ArrayBuffer))return i1({},nm(e),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:ij.CLAMP_TO_EDGE,wrapT:ij.CLAMP_TO_EDGE,minFilter:ij.NEAREST,magFilter:ij.NEAREST};throw Error("Invalid texture options")}(u,n.assets[a])).id=o.id,l.dataType=er.Texture,[2,l.sourceType===t.TextureSourceType.compressed?l:i1({},l,o)];throw Error("Invalid texture source: "+s)}})})))]})})()},r.loadJSON=function(t){var e=this;return eJ(function(){return e2(this,function(r){return[2,new Promise(function(r,i){e.downloader.downloadJSON(t,r,function(e,r){i("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+r)})})]})})()},r.loadBins=function(t){var e=this;return eJ(function(){return e2(this,function(r){return[2,new Promise(function(r,i){e.downloader.downloadBinary(t,r,function(e,r){i("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+r)})})]})})()},r.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},r.dispose=function(){for(var t in this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets){var e,r=this.assets[t];null==r||null==(e=r.dispose)||e.call(r)}this.assets={},this.timers=[]},e}();sM.fonts=new Set;var sP=new rV(1,1,1),sV=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=rF.fromIdentity(),this.projectionMatrix=rF.fromIdentity(),this.viewProjectionMatrix=rF.fromIdentity(),this.inverseViewMatrix=rF.fromIdentity(),this.dirty=!0;var r=e.near,i=e.far,n=e.fov,o=e.aspect,a=e.clipMode,s=void 0===a?tj.portrait:a,u=e.position,l=e.rotation;this.options={near:void 0===r?.1:r,far:void 0===i?20:i,fov:void 0===n?60:n,aspect:void 0===o?1:o,clipMode:s,position:rV.fromArray(void 0===u?[0,0,8]:u),rotation:rD.fromArray(void 0===l?[0,0,0]:l)},this.dirty=!0,this.updateMatrix()}var e=t.prototype;return 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 rV(0,0,t),r=this.getViewProjectionMatrix(),i=this.getInverseViewProjectionMatrix(),n=r.projectPoint(e).z;return i.projectPoint(new rV(1,1,n))},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 rN;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,r=t.far,i=t.fov,n=t.clipMode,o=t.aspect,a=t.position,s=t.rotation;this.near=e,this.far=r,this.fov=i,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,r=t.aspect,i=t.near,n=t.far,o=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*rb,r,i,n,o===tj.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),sP),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){iP.getRotation(t,this.options.rotation)},rC(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}(),sN=function(e){function r(){var t;return t=e.apply(this,arguments)||this,t.items=[],t}rR(r,e);var i=r.prototype;return i.start=function(){var t=this.item.props.startTime;this.startTime=void 0===t?0:t,this.timelineComponents=[],this.timelineComponent=this.item.getComponent(ob);for(var e,r=rO(this.items);!(e=r()).done;){var i=e.value.getComponent(ob);i&&(this.timelineComponents.push(i),(0!==this.item.endBehavior||this.timelineComponent.reusable)&&(i.reusable=!0))}},i.update=function(t){for(var e,r=this.timelineComponent.getTime(),i=rO(this.timelineComponents);!(e=i()).done;){var n=e.value,o=n.toLocalTime(r);n.setTime(o)}},i.resetStatus=function(){this.item.ended=!1,this.item.delaying=!0},i.createContent=function(){var e=this.items;if(this.items.length=0,this.item.composition)for(var i=this.item.engine.assetLoader,n=this.item.props.items?this.item.props.items:[],o=0;o<n.length;o++){var a=void 0,s=n[o];if(t.Item.isComposition(s)){var u=s.content.options.refId,l=this.item.composition.refCompositionProps.get(u);if(!l)throw Error("引用的Id: "+u+" 的预合成不存在");l.content=s.content,(a=new t.VFXItem(this.engine,i1({},l,{id:s.id,name:s.name,delay:s.delay,duration:s.duration,endBehavior:s.endBehavior,parentId:s.parentId,transform:s.transform,oldId:s.oldId}))).type=tX.composition,a.composition=this.item.composition,a.addComponent(r).refId=u,a.transform.parentTransform=this.transform,this.item.composition.refContent.push(a),5===a.endBehavior&&(this.item.composition.autoRefTex=!1),a.getComponent(r).createContent()}else"ECS"===s.type||s.type===tX.sprite||s.type===tX.text||s.type===tX.particle||s.type===tX.mesh||s.type===tX.skybox||s.type===tX.light||"camera"===s.type||s.type===tX.tree||s.type===tX.interact||s.type===tX.camera?(a=i.loadGUID(s.id)).composition=this.item.composition:((a=new t.VFXItem(this.engine,s)).composition=this.item.composition,a=aG(s,this.item.composition));a.parent=this.item,a.transform.parentTransform=s.type===tX.camera?new iP:this.transform,t.VFXItem.isExtraCamera(a)&&(this.item.composition.extraCamera=a),e.push(a)}},i.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},i.hitTest=function(e,r,i,n,o,a){for(var s,u=[],l=(null==a?void 0:a.stop)||rd,c=(null==a?void 0:a.skip)||rd,h=(null==a?void 0:a.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<h;f++){var m=(s=this,function(a){var h=s.items[a];if(h.lifetime>=0&&!h.ended&&!t.VFXItem.isComposition(h)&&!c(h)){var f=h.getHitTestParams(o);if(f){var m=!1,d=new rV;if(f.type===t.HitTestType.triangle)for(var p=f.triangles,v=f.backfaceCulling,y=0;y<p.length;y++){var g=p[y];if(e.intersectTriangle(g,d,v)){m=!0,u.push(d);break}}else if(f.type===t.HitTestType.box){var x=f.center,T=f.size,E=x.clone().addScaledVector(T,.5),_=x.clone().addScaledVector(T,-.5);e.intersectBox({min:E,max:_},d)&&(m=!0,u.push(d))}else if(f.type===t.HitTestType.sphere){var C=f.center,A=f.radius;e.intersectSphere({center:C,radius:A},d)&&(m=!0,u.push(d))}else if(f.type===t.HitTestType.custom){var R=f.collect(e,new rP(r,i));R&&R.length>0&&(R.forEach(function(t){u.push(t)}),m=!0)}if(m){var S={compContent:s.item,id:h.id,name:h.name,position:u[u.length-1],parentId:h.parentId,hitPositions:u,behavior:f.behavior};if(n.push(S),l(S))return{v:n}}}}}(f));if("object"===e0(m))return m.v}return n},r}(rK),sF=function(){function e(e,r,i){var n,o=this;this.compositionSourceManager=i,this.speed=1,this.loaderData={},this.refContent=[],this.refCompositionProps=new Map,this.assigned=!1,this.destroyed=!1,this.paused=!1,this.lastVideoUpdateTime=0,this.postLoaders=[];var a=e.reusable,s=void 0!==a&&a,u=e.speed,l=e.baseRenderOrder,c=e.renderer,h=e.onPlayerPause,f=e.onMessageItem,m=e.onEnd,d=e.event,p=e.width,v=e.height;r.jsonScene.imgUsage=void 0,s&&(this.keepResource=!0,r.textures=void 0,r.consumed=!0);var y=this.compositionSourceManager,g=y.sourceContent,x=y.pluginSystem,T=y.imgUsage,E=y.totalTime,_=y.renderLevel,C=y.refCompositionProps;rh(g),this.renderer=c,this.refCompositionProps=C;var A=new t.VFXItem(this.getEngine(),g);A.name="rootItem",A.type=tX.composition,A.composition=this,this.rootComposition=A.addComponent(sN),this.rootTimeline=A.getComponent(ob);var R=!s&&T;this.transform=new iP({name:this.name}),this.transform.engine=this.getEngine(),A.transform=this.transform,this.globalVolume=g.globalVolume,this.width=p,this.height=v,this.renderOrder=void 0===l?0:l,this.id=g.id,this.renderer=c,this.texInfo=null!=R?R:{},this.event=d,this.statistic={loadTime:null!=E?E:0,loadStart:null!=(n=r.startTime)?n:0,firstFrameTime:0},this.reusable=s,this.speed=void 0===u?1:u,this.renderLevel=_,this.autoRefTex=!this.keepResource&&R&&5!==A.endBehavior,this.rootItem=A,this.name=g.name,this.pluginSystem=x,this.pluginSystem.initializeComposition(this,r),this.camera=new sV(this.name,i1({},null==g?void 0:g.camera,{aspect:p/v})),this.url=r.url,this.assigned=!0,this.globalTime=0,this.onPlayerPause=h,this.onMessageItem=f,this.onEnd=m,this.createRenderFrame(),this.rendererOptions=null,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout(function(){null==o.onEnd||o.onEnd.call(o,o)},0)},this.pluginSystem.resetComposition(this,this.renderFrame)}var r=e.prototype;return r.getDuration=function(){return this.rootItem.duration},r.restart=function(){this.prepareRender(),this.reset(),this.transform.setValid(!0),this.rootComposition.resetStatus(),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.rootTimeline.timelineStarted?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.resume(),this.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime)},r.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new n2({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.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime,!0),e&&this.pause()},r.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},r.forwardTime=function(t,e){void 0===e&&(e=!1);for(var r=1e3*t-1e3*this.rootTimeline.getTime(),i=r<0,n=Math.abs(r),o=i?-15:15;n>15;n-=15)this.update(o,e);this.update(i?-n:n,e)},r.reset=function(){var e=this,r=new t.VFXItem(this.getEngine(),this.compositionSourceManager.sourceContent);r.type=tX.composition,r.composition=this,this.rootComposition=r.addComponent(sN),this.rootTimeline=r.getComponent(ob),this.transform=new iP({name:this.name}),this.transform.engine=this.getEngine(),r.transform=this.transform,this.rootItem=r,this.rendererOptions=null,this.globalTime=0,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout(function(){null==e.onEnd||e.onEnd.call(e,e)},0)},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(r){r.prepareRenderFrame(t,e)&&t.postLoaders.push(r)});for(var r,i=rO(this.rootComposition.items);!(r=i()).done;)for(var n,o=r.value.getComponents(rQ),a=rO(o);!(n=a()).done;){var s=n.value;s.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(s)}for(var u,l=rO(this.refContent);!(u=l()).done;)for(var c,h=u.value,f=rO(h.getComponent(sN).items);!(c=f()).done;)for(var m,d=c.value.getComponents(rQ),p=rO(d);!(m=p()).done;){var v=m.value;v.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(v)}this.postLoaders.forEach(function(r){return r.postProcessFrame(t,e)})},r.shouldRestart=function(){var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&5===r},r.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},r.update=function(t,e){if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var r,i,n=this.getUpdateTime(t*this.speed);if(this.globalTime+=n,this.rootTimeline.isActiveAndEnabled){var o=this.rootTimeline.toLocalTime(this.globalTime/1e3);this.rootTimeline.setTime(o)}this.updateVideo(),this.updatePluginLoaders(t),this.callStart(this.rootItem),this.callUpdate(this.rootItem,n),this.callLateUpdate(this.rootItem,n),null==(i=this.extraCamera)||null==(r=i.getComponent(ob))||r.update(t),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},r.getUpdateTime=function(t){var e=1e3*this.startTime,r=1e3*this.rootTimeline.getTime();return t<0&&r+t<e?e-r:t},r.callStart=function(t){for(var e,r=rO(t.itemBehaviours);!(e=r()).done;){var i=e.value;i.isActiveAndEnabled&&!i.started&&(i.start(),i.started=!0)}for(var n,o=rO(t.rendererComponents);!(n=o()).done;){var a=n.value;a.isActiveAndEnabled&&!a.started&&(a.start(),a.started=!0)}for(var s,u=rO(t.children);!(s=u()).done;){var l=s.value;this.callStart(l)}},r.callUpdate=function(e,r){for(var i,n=rO(e.itemBehaviours);!(i=n()).done;){var o=i.value;o.isActiveAndEnabled&&o.started&&o.update(r)}for(var a,s=rO(e.rendererComponents);!(a=s()).done;){var u=a.value;u.isActiveAndEnabled&&u.started&&u.update(r)}for(var l,c=rO(e.children);!(l=c()).done;){var h=l.value;t.VFXItem.isComposition(h)&&h.ended&&5===h.endBehavior?(h.getComponent(sN).resetStatus(),this.callUpdate(h,0)):this.callUpdate(h,r)}},r.callLateUpdate=function(t,e){for(var r,i=rO(t.itemBehaviours);!(r=i()).done;){var n=r.value;n.isActiveAndEnabled&&n.started&&n.lateUpdate(e)}for(var o,a=rO(t.rendererComponents);!(o=a()).done;){var s=o.value;s.isActiveAndEnabled&&s.started&&s.lateUpdate(e)}for(var u,l=rO(t.children);!(u=l()).done;){var c=u.value;this.callLateUpdate(c,e)}},r.buildItemTree=function(e){if(e.composition){for(var r,i=new Map,n=e.getComponent(sN).items,o=rO(n);!(r=o()).done;){var a=r.value;i.set(a.id,a)}for(var s,u=rO(n);!(s=u()).done;){var l=s.value;if(void 0===l.parentId)l.setParent(e);else{var c=this.getParentIdWithoutSuffix(l.parentId),h=i.get(c);if(h)t.VFXItem.isTree(h)&&l.parentId.includes("^")?(l.parent=h,l.transform.parentTransform=h.getNodeTransform(l.parentId)):(l.parent=h,l.transform.parentTransform=h.transform),h.children.push(l);else throw Error("元素引用了不存在的元素,请检查数据")}}for(var f,m=rO(n);!(f=m()).done;){var d=f.value;t.VFXItem.isComposition(d)&&this.buildItemTree(d)}}},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(r){return r.onCompositionUpdate(e,t)})},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return is((t-r.z)/i,(e-r.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,r,i){if(this.isDestroyed)return[];var n,o=[],a=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(sN))||n.hitTest(a,t,e,o,r,i),this.refContent.forEach(function(n){var s;null==(s=n.getComponent(sN))||s.hitTest(a,t,e,o,r,i)}),o},r.addInteractiveItem=function(t,e){if(e===tB.MESSAGE)return null==this.onMessageItem||this.onMessageItem.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.id},r.removeInteractiveItem=function(t,e){e===tB.MESSAGE&&(null==this.onMessageItem||this.onMessageItem.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},r.destroyTextures=function(e){for(var r=0;r<e.length;r++){var i,n=e[r];if(n){if(n.sourceType===t.TextureSourceType.data&&!this.texInfo[n.getInstanceId()]){n!==(null==(i=this.rendererOptions)?void 0:i.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?4!==t.endBehavior&&t.getComponent(sN).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(r){return r.onCompositionItemRemoved(e,t)})}):(e9(this.items,t),this.pluginSystem.plugins.forEach(function(r){return r.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,r,i=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=rd)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(r=this.pluginSystem)||r.destroyComposition(this),this.update=function(){rm.error("Update disposed composition: "+i.name+".")},this.onPlayerPause=rd,this.dispose=rd,o&&this.keepResource&&o.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==iX&&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,r){this.renderFrame.editorTransform.set(t,t,e,r)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Can not translate position when container not assigned");return}this.rootItem.translateByPixel(t,e)},r.translate=function(t,e,r){this.rootItem.translate(t,e,r)},r.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},r.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},r.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},r.scale=function(t,e,r){this.rootItem.scale(t,e,r)},r.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},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 eJ(function(){return e2(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]}})})()},rC(e,[{key:"handleEnd",set:function(t){console.warn("The handleEnd property is deprecated. Use onEnd instead."),this.onEnd=t}},{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.rootTimeline.getTime()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(),sD=0,sU=function(){function t(t,e){this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var r=t.jsonScene,i=t.renderLevel,n=t.textureOptions,o=t.pluginSystem,a=t.totalTime,s=r.compositions,u=r.imgUsage,l=r.compositionId;if(!n)throw Error("scene.textures expected");for(var c,h=rO(s);!(c=h()).done;){var f=c.value;f.id===l?this.composition=f:this.refCompositions.set(f.id,f)}if(!this.composition)throw Error("Invalid composition id: "+l);this.jsonScene=r,this.renderLevel=i,this.pluginSystem=o,this.totalTime=null!=a?a:0,this.imgUsage=null!=u?u:{},this.textures=n,sD=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=t.id,r=t.duration,i=t.name,n=t.endBehavior,o=t.camera,a=t.globalVolume,s=t.startTime,u=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:u,camera:o,startTime:void 0===s?0:s,globalVolume:a}},e.assembleItems=function(t){var e=this,r=[];this.mask++;for(var i,n={},o=rO(this.jsonScene.components);!(i=o()).done;){var a=i.value;n[a.id]=a}for(var s,u=rO(t.items);!(s=u()).done;){var l=s.value,c=this.engine.jsonSceneData[l.id];if(sA(c.renderLevel,this.renderLevel)){if(c.type===tX.sprite||c.type===tX.particle)for(var h,f=rO(c.components);!(h=f()).done;){var m=n[h.value.id];this.preProcessItemContent(m)}else{var d=c.content;d&&this.preProcessItemContent(d)}var p=c.pn,v=this.jsonScene.plugins,y=void 0===v?[]:v;if(c.listIndex=sD++,void 0!==p&&Number.isInteger(p)&&(c.pluginName=y[p]),c.type===tX.composition){var g=c.content.options.refId;if(!this.refCompositions.get(g))throw Error("Invalid Ref Composition id: "+g);var x=this.getContent(this.refCompositions.get(g));this.refCompositionProps.has(g)||this.refCompositionProps.set(g,x),x.items.forEach(function(t){e.processMask(t.content)}),c.items=x.items}r.push(c)}}return r},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var e,r=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=ag(null==(e=this.jsonScene)?void 0:e.shapes[t.renderer.shape],r):t.renderer.shape&&rg(t.renderer.shape)&&(t.renderer.shape=ag(t.renderer.shape,r))}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,r=null!=(e=this.imgUsage)?e:{};t&&r&&(r.hasOwnProperty(t)||(r[t]=0),r[t]++)},e.processMask=function(t){var e=t.maskMode;e!==tU.NONE&&(t.mask||(e===tU.MASK?t.mask=++this.mask:e!==tU.OBSCURED&&e!==tU.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}(),sz=function(){function t(){}return t.collectSerializableObject=function(t,e){if(!e[t.getInstanceId()]){t.toData(),e[t.getInstanceId()]=t;for(var r,i=rH(t),n=rO(Object.keys(i));!(r=n()).done;){var o=r.value,a=t.taggedProperties[o];if(void 0===a&&(a=t[o]),e$(a,rW))this.collectSerializableObject(a,e);else if(e$(a,Array))for(var s,u=rO(a);!(s=u()).done;){var l=s.value;e$(l,rW)&&this.collectSerializableObject(l,e)}else if(e$(a,Object))for(var c,h=rO(Object.keys(a));!(c=h()).done;){var f=a[c.value];e$(f,rW)&&this.collectSerializableObject(f,e)}}}},t.serializeEffectObject=function(e){var r={},i=e.engine,n=i1({},i.jsonSceneData);t.collectSerializableObject(e,r);for(var o,a=rO(Object.keys(r));!(o=a()).done;){var s=r[o.value];n[s.getInstanceId()]||(n[s.getInstanceId()]={}),t.serializeTaggedProperties(s,n[s.getInstanceId()])}return n},t.serializeTaggedProperties=function(e,r){e.toData(),r||(r={});for(var i,n=rH(e),o=rO(Object.keys(n));!(i=o()).done;){var a=i.value,s=e[a];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(s)?r[a]=s:e$(s,Array)?(r[a]||(r[a]=[]),t.serializeArrayProperty(s,r[a],0)):e$(s,rW)?r[a]={id:s.getInstanceId()}:e$(s,Object)&&(r[a]||(r[a]={}),t.serializeObjectProperty(s,r[a],0))}for(var u,l=rO(Object.keys(e.taggedProperties));!(u=l()).done;){var c=u.value,h=e.taggedProperties[c];"number"==typeof h||"string"==typeof h||"boolean"==typeof h||t.checkTypedArray(h)?r[c]=h:e$(h,Array)?(r[c]||(r[c]=[]),t.serializeArrayProperty(h,r[c],0)):e$(h,rW)?r[c]={id:h.getInstanceId()}:e$(h,Object)&&(r[c]||(r[c]={}),t.serializeObjectProperty(h,r[c],0))}return r},t.deserializeTaggedProperties=function(e,r){for(var i,n=r.taggedProperties,o=rH(r),a=r.engine,s=rO(Object.keys(e));!(i=s()).done;){var u=i.value;if(!o[u]){var l=e[u];n[u]=t.deserializeProperty(l,a,0)}}for(var c,h=rO(Object.keys(o));!(c=h()).done;){var f=c.value,m=e[f];void 0!==m&&(r[f]=t.deserializeProperty(m,a,0))}r.fromData(n)},t.deserializeTaggedPropertiesAsync=function(e,r){return eJ(function(){var i,n,o,a,s,u,l,c,h,f,m;return e2(this,function(d){switch(d.label){case 0:i=r.taggedProperties,n=rH(r),o=r.engine,a=rO(Object.keys(e)),d.label=1;case 1:if((s=a()).done)return[3,4];if(n[u=s.value])return[3,3];return l=e[u],[4,t.deserializePropertyAsync(l,o,0)];case 2:i[u]=d.sent(),d.label=3;case 3:return[3,1];case 4:c=rO(Object.keys(n)),d.label=5;case 5:if((h=c()).done)return[3,8];if(void 0===(m=e[f=h.value]))return[3,7];return[4,t.deserializePropertyAsync(m,o,0)];case 6:r[f]=d.sent(),d.label=7;case 7:return[3,5];case 8:return r.fromData(i),[2]}})})()},t.checkTypedArray=function(t){return e$(t,Int8Array)||e$(t,Uint8Array)||e$(t,Uint8ClampedArray)||e$(t,Int16Array)||e$(t,Uint16Array)||e$(t,Int32Array)||e$(t,Uint32Array)||e$(t,Float32Array)||e$(t,Float64Array)},t.checkDataPath=function(t){return e$(t,Object)&&1===Object.keys(t).length&&t.id&&32===t.id.length},t.checkGLTFNode=function(t){return e$(t,Object)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.deserializeProperty=function(e,r,i){if(i>14){console.error("序列化数据的内嵌对象层数大于上限");return}if("number"==typeof e||"string"==typeof e||"boolean"==typeof e)return e;if(e$(e,Array)){for(var n,o=[],a=rO(e);!(n=a()).done;){var s=n.value;o.push(t.deserializeProperty(s,r,i+1))}return o}if(t.checkDataPath(e))return r.assetLoader.loadGUID(e.id);if(e$(e,rW)||t.checkTypedArray(e)||t.checkGLTFNode(e))return e;if(e$(e,Object)){for(var u,l={},c=rO(Object.keys(e));!(u=c()).done;){var h=u.value;l[h]=t.deserializeProperty(e[h],r,i+1)}return l}},t.deserializePropertyAsync=function(e,r,i){return eJ(function(){var n,o,a,s,u,l,c,h,f;return e2(this,function(m){switch(m.label){case 0:if(i>14)return console.error("序列化数据的内嵌对象层数大于上限"),[2];if(!("number"==typeof e||"string"==typeof e||"boolean"==typeof e))return[3,1];return[2,e];case 1:if(!e$(e,Array))return[3,6];n=[],o=rO(e),m.label=2;case 2:if((a=o()).done)return[3,5];return s=a.value,u=n.push,[4,t.deserializePropertyAsync(s,r,i+1)];case 3:u.apply(n,[m.sent()]),m.label=4;case 4:return[3,2];case 5:return[2,n];case 6:if(!t.checkDataPath(e))return[3,8];return[4,r.assetLoader.loadGUIDAsync(e.id)];case 7:return[2,m.sent()];case 8:if(!(e$(e,rW)||t.checkTypedArray(e)||t.checkGLTFNode(e)))return[3,9];return[2,e];case 9:if(!e$(e,Object))return[3,14];l={},c=rO(Object.keys(e)),m.label=10;case 10:if((h=c()).done)return[3,13];return f=h.value,[4,t.deserializePropertyAsync(e[f],r,i+1)];case 11:l[f]=m.sent(),m.label=12;case 12:return[3,10];case 13:return[2,l];case 14:return[2]}})})()},t.serializeObjectProperty=function(e,r,i){if(i>14){console.error("序列化数据的内嵌对象层数大于上限");return}r||(r={});for(var n,o=rO(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)?r[a]=s:e$(s,Array)?(r[a]||(r[a]=[]),t.serializeArrayProperty(s,r[a],i+1)):e$(s,rW)?r[a]={id:s.getInstanceId()}:e$(s,Object)&&(r[a]||(r[a]={}),t.serializeObjectProperty(s,r[a],i+1))}},t.serializeArrayProperty=function(e,r,i){if(i>14){console.error("序列化数据的内嵌对象层数大于上限");return}r||(r=[]);for(var n=0;n<e.length;n++){var o=e[n];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?r[n]=o:e$(o,Array)?(r[n]||(r[n]=[]),this.serializeArrayProperty(o,r[n],i+1)):e$(o,rW)?r[n]={id:o.getInstanceId()}:e$(o,Object)&&(r[n]||(r[n]={}),t.serializeObjectProperty(o,r[n],i+1))}},t}(),sk=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 r,i=this.findData(e);if(!i){console.error("未找到 uuid: "+e+"的对象数据");return}switch(i.dataType){case er.Material:r=ng.create(this.engine);break;case er.Geometry:r=nL.create(this.engine);break;case er.Texture:return nc.create(this.engine,i);default:var n=t.getClass(i.dataType);n&&(r=new n(this.engine))}if(!r){console.error("未找到 DataType: "+i.dataType+"的构造函数");return}return r.setInstanceId(i.id),this.engine.addInstance(r),sz.deserializeTaggedProperties(i,r),r},e.loadGUIDAsync=function(e){var r=this;return eJ(function(){var i,n,o;return e2(this,function(a){switch(a.label){case 0:if(r.engine.objectInstance[e])return[2,r.engine.objectInstance[e]];if(n=r.findData(e))return[3,2];if(!r.engine.database)return console.error("未找到 uuid: "+e+"的对象数据"),[2,void 0];return[4,r.engine.database.loadGUID(e)];case 1:if(!(i=a.sent()))return console.error("未找到 uuid: "+e+"的磁盘数据"),[2,void 0];return r.engine.addInstance(i),[2,i];case 2:switch(n.dataType){case er.Material:i=ng.create(r.engine);break;case er.Geometry:i=nL.create(r.engine);break;case er.Texture:return[2,i=nc.create(r.engine,n)];default:(o=t.getClass(n.dataType))&&(i=new o(r.engine))}if(!i)return console.error("未找到 DataType: "+n.dataType+"的构造函数"),[2,void 0];return i.setInstanceId(n.id),r.engine.addInstance(i),[4,sz.deserializeTaggedPropertiesAsync(n,i)];case 3:return a.sent(),[2,i]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return rB[t]},t}(),sB=function(){function t(){}return t.prototype.loadGUID=function(t){return eJ(function(){return e2(this,function(t){return[2,void 0]})})()},t}(),sG=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new sk(this),this.createDefaultTexture()}var r=e.prototype;return r.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},r.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},r.findEffectsObjectData=function(t){return this.jsonSceneData[t]},r.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},r.getInstance=function(t){return this.objectInstance[t]},r.removeInstance=function(t){delete this.objectInstance[t]},r.addPackageDatas=function(t){var e=t.jsonScene;if(e.items)for(var r,i=rO(e.items);!(r=i()).done;){var n=r.value;this.addEffectsObjectData(n)}if(e.materials)for(var o,a=rO(e.materials);!(o=a()).done;){var s=o.value;this.addEffectsObjectData(s)}if(e.shaders)for(var u,l=rO(e.shaders);!(u=l()).done;){var c=u.value;this.addEffectsObjectData(c)}if(e.geometries)for(var h,f=rO(e.geometries);!(h=f()).done;){var m=h.value;this.addEffectsObjectData(m)}if(e.components)for(var d,p=rO(e.components);!(d=p()).done;){var v=d.value;this.addEffectsObjectData(v)}if(t.textureOptions)for(var y,g=rO(t.textureOptions);!(y=g()).done;){var x=y.value;this.addEffectsObjectData(x)}},r.createVFXItemsAsync=function(t){var e=this;return eJ(function(){var r,i,n,o;return e2(this,function(a){switch(a.label){case 0:r=rO(t.jsonScene.items),a.label=1;case 1:if((i=r()).done)return[3,4];if(!("ECS"===(o=(n=i.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]}})})()},r.addTexture=function(t){this.destroyed||e8(this.textures,t)},r.removeTexture=function(t){this.destroyed||e9(this.textures,t)},r.addMaterial=function(t){this.destroyed||e8(this.materials,t)},r.removeMaterial=function(t){this.destroyed||e9(this.materials,t)},r.addGeometry=function(t){this.destroyed||e8(this.geometries,t)},r.removeGeometry=function(t){this.destroyed||e9(this.geometries,t)},r.addMesh=function(t){this.destroyed||e8(this.meshes,t)},r.removeMesh=function(t){this.destroyed||e9(this.meshes,t)},r.addRenderPass=function(t){this.destroyed||e8(this.renderPasses,t)},r.removeRenderPass=function(t){this.destroyed||e9(this.renderPasses,t)},r.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},r.createDefaultTexture=function(){var e={type:ij.UNSIGNED_BYTE,format:ij.RGBA,internalFormat:ij.RGBA,wrapS:ij.MIRRORED_REPEAT,wrapT:ij.MIRRORED_REPEAT,minFilter:ij.NEAREST,magFilter:ij.NEAREST};this.emptyTexture=nc.create(this,i1({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},e)),this.transparentTexture=nc.create(this,i1({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},e))},r.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&&rm.warn("Release GPU memory: "+t.join(", ")),this.renderPasses.forEach(function(t){t.dispose()}),this.meshes.forEach(function(t){t.dispose()}),this.geometries.forEach(function(t){t.dispose()}),this.materials.forEach(function(t){t.dispose()}),this.textures.forEach(function(t){t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},rC(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(),sX=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this._deltaTime=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=rM(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._deltaTime=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},r=function(){t.intervalId=e(r),t.paused||t.tick()};r()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this._deltaTime=0,this.tickers=[]},e.pause=function(){this.paused=!0,this._deltaTime=0},e.resume=function(){this.paused=!1,this._deltaTime=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this._deltaTime=t-this.lastTime,this._deltaTime>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e=0,r=this.tickers.length;e<r;e++)(0,this.tickers[e])(this._deltaTime)}}},e.add=function(t){if("function"!=typeof t)throw Error("Ticker: The tick object must implement the tick method.");this.tickers.push(t)},rC(t,[{key:"deltaTime",get:function(){return this._deltaTime}}]),t}();aj("camera",iV,t.VFXItem,!0),aj("text",ak,t.VFXItem,!0),aj("sprite",of,t.VFXItem,!0),aj("particle",oZ,t.VFXItem,!0),aj("cal",aV,t.VFXItem,!0),aj("interact",iG,t.VFXItem,!0);var sH=((ej={})[ij.ONE]=eK.OneFactor,ej[ij.ZERO]=eK.ZeroFactor,ej[ij.SRC_COLOR]=eK.SrcColorFactor,ej[ij.SRC_ALPHA]=eK.SrcAlphaFactor,ej[ij.ONE_MINUS_SRC_COLOR]=eK.OneMinusSrcColorFactor,ej[ij.ONE_MINUS_SRC_ALPHA]=eK.OneMinusSrcAlphaFactor,ej[ij.DST_COLOR]=eK.DstColorFactor,ej[ij.DST_ALPHA]=eK.DstAlphaFactor,ej[ij.ONE_MINUS_DST_COLOR]=eK.OneMinusDstColorFactor,ej[ij.ONE_MINUS_DST_ALPHA]=eK.OneMinusDstAlphaFactor,ej),sY=((eW={})[ij.NEVER]=eK.NeverStencilFunc,eW[ij.EQUAL]=eK.EqualStencilFunc,eW[ij.LESS]=eK.LessStencilFunc,eW[ij.LEQUAL]=eK.LessEqualStencilFunc,eW[ij.ALWAYS]=eK.AlwaysStencilFunc,eW[ij.NOTEQUAL]=eK.NotEqualStencilFunc,eW[ij.GREATER]=eK.GreaterStencilFunc,eW[ij.GEQUAL]=eK.GreaterEqualStencilFunc,eW),sj=((eZ={})[ij.KEEP]=eK.KeepStencilOp,eZ[ij.ZERO]=eK.ZeroStencilOp,eZ[ij.REPLACE]=eK.ReplaceStencilOp,eZ[ij.INCR]=eK.IncrementStencilOp,eZ[ij.DECR]=eK.DecrementStencilOp,eZ[ij.INCR_WRAP]=eK.IncrementWrapStencilOp,eZ[ij.DECR_WRAP]=eK.IncrementWrapStencilOp,eZ[ij.INVERT]=eK.InvertStencilOp,eZ),sW=((eq={})[ij.NEVER]=eK.NeverDepth,eq[ij.ALWAYS]=eK.AlwaysDepth,eq[ij.EQUAL]=eK.EqualDepth,eq[ij.LESS]=eK.LessDepth,eq[ij.LEQUAL]=eK.LessEqualDepth,eq[ij.GREATER]=eK.GreaterDepth,eq[ij.GEQUAL]=eK.GreaterEqualDepth,eq[ij.NOTEQUAL]=eK.NotEqualDepth,eq),sZ=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],sq=function(e){function r(r,i){(n=e.call(this,r,i)||this).textures={},n.material=new eK.RawShaderMaterial,n.uniforms={};for(var n,o=null==i?void 0:i.shader,a=r.gpuCapability.level,s=0;s<t.maxSpriteMeshItemCount;s++)n.uniforms["uSampler"+s]=new eK.Uniform(null);return n.uniforms.uEditorTransform=new eK.Uniform([1,1,0,0]),n.uniforms.effects_ObjectToWorld=new eK.Uniform(new eK.Matrix4().identity()),n.uniforms.effects_MatrixInvV=new eK.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.uniforms.effects_MatrixVP=new eK.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),n.uniforms.effects_MatrixV=new eK.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),n.material=new eK.RawShaderMaterial({vertexShader:iQ(o.marcos,o.vertex,t.ShaderType.vertex,n.engine.gpuCapability.level),fragmentShader:iQ(o.marcos,o.fragment,t.ShaderType.fragment,n.engine.gpuCapability.level),alphaToCoverage:!1,depthFunc:eK.LessDepth,polygonOffsetFactor:eK.ZeroFactor,polygonOffsetUnits:eK.ZeroFactor,polygonOffset:!1,uniforms:n.uniforms}),1===a?n.material.glslVersion=eK.GLSL1:n.material.glslVersion=eK.GLSL3,n}rR(r,e);var i=r.prototype;return i.onSetUniformValue=function(t,e){var r;sZ.includes(t)&&(r=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=r||e:this.material.uniforms[t]=new eK.Uniform(r||e)},i.use=function(t,e){var r=this.engine,i=r.composition,n=r.threeCamera;if(n){var o=new eK.Matrix4().multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse);this.setMatrix("effects_MatrixVP",o)}else{var a=i.camera;this.setMatrix("effects_MatrixVP",a.getViewProjectionMatrix()),this.setMatrix("effects_MatrixV",a.getViewMatrix())}},i.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},i.getVector4Array=function(t){return this.uniforms[t].value},i.setVector4Array=function(t,e){for(var r,i=[],n=rO(e);!(r=n()).done;){var o=r.value;i=i.concat(o.toArray())}this.setUniform(t,i)},i.getMatrixArray=function(t){return this.uniforms[t].value},i.setMatrixArray=function(t,e){for(var r,i=[],n=rO(e);!(r=n()).done;){var o=r.value;i=i.concat(o.elements)}this.setUniform(t,i)},i.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},i.getMatrix=function(t){return this.uniforms[t].value},i.setMatrix=function(t,e){this.setUniform(t,e)},i.setMatrix3=function(t,e){this.setUniform(t,e)},i.getVector2=function(t){return this.uniforms[t].value},i.setVector2=function(t,e){this.setUniform(t,e)},i.getVector3=function(t){return this.uniforms[t].value},i.setVector3=function(t,e){this.setUniform(t,e)},i.getVector4=function(t){return this.uniforms[t].value},i.setVector4=function(t,e){this.setUniform(t,e)},i.getColor=function(t){return this.uniforms[t].value},i.setColor=function(t,e){this.setUniform(t,e)},i.getQuaternion=function(t){return this.uniforms[t].value},i.setQuaternion=function(t,e){this.setUniform(t,e)},i.getFloat=function(t){return this.uniforms[t].value},i.setFloat=function(t,e){this.setUniform(t,e)},i.getFloats=function(t){return this.uniforms[t].value},i.setFloats=function(t,e){this.setUniform(t,e)},i.getInt=function(t){return this.uniforms[t].value},i.setInt=function(t,e){this.setUniform(t,e)},i.hasUniform=function(t){return!!this.uniforms[t]},i.setUniform=function(t,e){var r=new eK.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=r},i.enableMacro=function(t){throw Error("Method not implemented.")},i.disableMacro=function(t){throw Error("Method not implemented.")},i.isMacroEnabled=function(t){throw Error("Method not implemented.")},i.clone=function(t){throw Error("Method not implemented.")},i.cloneUniforms=function(t){throw Error("Method not implemented.")},i.fromData=function(t){throw Error("Method not implemented.")},i.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},rC(r,[{key:"blending",get:function(){return this.material.blending!==eK.NoBlending},set:function(t){this.material.blending=t?eK.CustomBlending:eK.NoBlending}},{key:"blendFunction",get:function(){var t=this.material,e=t.blendSrc,r=t.blendDst;return[e,r,t.blendSrcAlpha||e,t.blendDstAlpha||r]},set:function(t){if(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.material.blendSrc=sH[e],this.material.blendDst=sH[r],this.material.blendSrcAlpha=sH[i],this.material.blendDstAlpha=sH[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],r=t[1];this.material.blendEquation=e,this.material.blendEquationAlpha=r}}},{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=sW[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],r=t[1];this.material.polygonOffsetFactor=e,this.material.polygonOffsetUnits=r}}},{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=sY[t[0]])}},{key:"stencilOpFail",get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=sj[t[0]])}},{key:"stencilOpZFail",get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=sj[t[0]])}},{key:"stencilOpZPass",get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=sj[t[0]])}},{key:"culling",get:function(){return this.material.side!==eK.DoubleSide},set:function(t){this.material.side=t?eK.FrontSide:eK.DoubleSide}},{key:"cullFace",get:function(){return this.material.side},set:function(t){t===tD.FRONT?this.material.side=eK.FrontSide:t===tD.BACK&&(this.material.side=eK.BackSide)}}]),r}(ng),sK=1,sQ=function(t){function e(e,r){if((i=t.call(this,e)||this).attributes={},i.destroyed=!1,i.attributesName=[],!r)return aN(i);var i,n=r.drawStart,o=r.drawCount,a=r.indices,s=r.mode,u=r.name,l=void 0===u?"effectsGeometry:"+sK++:u;i.name=l,i.mode=null!=s?s:ij.TRIANGLES;var c=[],h={},f=new eK.BufferGeometry;return Object.keys(r.attributes).forEach(function(t){var e=r.attributes[t];if("dataSource"in e){var n=e.dataSource;if(n){void 0===h[n]&&i.setAttributeType(n,e,f,h,r.maxVertex);var o=e.size,a=e.offset,s=e.normalize,u=h[n],l=u.buffer,m=u.dataLength,d=new eK.InterleavedBufferAttribute(l,o,(null!=a?a:0)/m,s);f.setAttribute(t,d),h[t]={buffer:l,attribute:d,type:u.type,dataLength:m}}}else i.setAttributeType(t,e,f,h,r.maxVertex);c.push(t)}),a&&a.data&&f.setIndex(new eK.BufferAttribute(a.data,1)),i.geometry=f,i.attributes=h,i.attributesName=c,i.drawStart=void 0===n?0:n,i.drawCount=null!=o?o:0,i}rR(e,t);var r=e.prototype;return r.getAttributeData=function(t){if(void 0!=this.attributes[t])return this.attributes[t].buffer.array},r.setAttributeData=function(t,e){if(void 0!=this.attributes[t]){var r=this.attributes[t].buffer;if(e.length>r.array.length){var i=new eK.InterleavedBuffer(e,r.stride);r=this.attributes[t].attribute.data=i,this.geometry.setAttribute(t,this.attributes[t].attribute)}else r.set(e,0),r.updateRange.count=e.length,r.updateRange.offset=0;this.geometry.attributes[t].needsUpdate=!0}},r.setAttributeSubData=function(t,e,r){void 0!=this.attributes[t]&&(this.attributes[t].buffer.set(r,e),this.geometry.attributes[t].needsUpdate=!0)},r.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*nw[e.type]},r.getAttributeNames=function(){return this.attributesName},r.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},r.setIndexData=function(t){t&&(this.geometry.setIndex(new eK.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},r.setIndexSubData=function(t,e){var r=this.geometry.getIndex();if(null!==r){var i=t+e.length;if(r.count<i){var n=new e.constructor(end);n.set(r.array),r.array=n}r.array.set(e,t),this.geometry.index.needsUpdate=!0}},r.setDrawStart=function(t){this.drawStart=t},r.getDrawStart=function(){return this.drawStart},r.setDrawCount=function(t){this.drawCount=t},r.getDrawCount=function(){return this.drawCount},r.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},r.setAttributeType=function(t,e,r,i,n){var o=e.stride,a=e.size,s=e.offset,u=e.normalize,l=e.type,c=void 0===l?ij.FLOAT:l,h=e.data;if(c&&!h&&(h=nI(c)),h){var f=e$(h,Float32Array)?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,m=(void 0===o?0:o)/f,d=(n=(null!=n?n:0)*m)||a*f;d&&0===h.length&&(h=e$(h,Float32Array)?new Float32Array(d):new Uint16Array(d));var p=new eK.InterleavedBuffer(h,m),v=new eK.InterleavedBufferAttribute(p,a,(null!=s?s:0)/f,u);r.setAttribute(t,v),i[t]={buffer:p,attribute:v,type:c,dataLength:f}}},rC(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}(nL),sJ=function(e){function r(t,r){if(!r)return aN(i);var i,n=r.material,o=r.geometry,a=r.priority;return(i=e.call(this,t,r)||this).geometry=o,i.material=n,o.mode===ij.LINES?i.mesh=new eK.LineSegments(o.geometry,n.material):i.mesh=new eK.Mesh(o.geometry,n.material),i.priority=void 0===a?0:a,i}rR(r,e);var i=r.prototype;return i.setVisible=function(t){this.mesh.visible=t},i.getVisible=function(){return this.mesh.visible},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e,this.mesh.material=e.material},i.start=function(){e.prototype.start.call(this),this.engine.threeGroup.add(this.mesh)},i.restore=function(){},i.render=function(t){!this.isDestroyed&&this.getVisible()&&(this.material.setMatrix("effects_ObjectToWorld",this.worldMatrix),this.material.use(t,t.renderingData.currentFrame.globalUniforms))},i.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},rC(r,[{key:"priority",get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)}}]),r}(nP),s$=function(e){function r(r,i,n){if(void 0===n&&(n={}),o=e.call(this,r)||this,i){var o,a=i.width,s=i.height;o.texture=o.createTextureByType(i1({},n,{sourceType:t.TextureSourceType.data,data:i})),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}rR(r,e);var i=r.prototype;return i.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},i.startVideo=function(){var e=this;return eJ(function(){var r;return e2(this,function(i){switch(i.label){case 0:if(e.sourceType!==t.TextureSourceType.video||!(r=e.texture.source.data).paused)return[3,2];return[4,r.play()];case 1:i.sent(),i.label=2;case 2:return[2]}})})()},i.assembleOptions=function(e){var i=e.target,n=void 0===i?ij.TEXTURE_2D:i;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),i1({target:n,format:eK.RGBAFormat,type:eK.UnsignedByteType},e,{minFilter:r.toThreeJsTextureFilter(e.minFilter),magFilter:r.toThreeJsTextureFilter(e.magFilter),wrapS:r.toThreeJsTextureWrap(e.wrapS),wrapT:r.toThreeJsTextureWrap(e.wrapT)})},i.dispose=function(){this.texture.dispose()},i.createTextureByType=function(e){var r=this.assembleOptions(e),i=r.flipY,n=r.type,o=r.wrapS,a=r.wrapT,s=r.minFilter,u=r.magFilter,l=r.sourceType,c=eK.UVMapping,h=r.format,f=void 0;if(this.sourceType=l,l===t.TextureSourceType.data){var m=e.data;f=new eK.DataTexture(m.data,m.width,m.height,h,n,c,o,a,u,s),this.width=m.width,this.height=m.height}else if(l===t.TextureSourceType.image){var d=e.image;f=new eK.Texture(d,c,o,a,u,s,h,n),this.width=d.width,this.height=d.height}else if(l===t.TextureSourceType.compressed){var p=0,v=0,y=e.mipmaps.map(function(t){var e=t.data,r=t.width,i=t.height;return p=p<r?r:p,v=v<i?i:v,{data:e,width:r,height:i,colorSpace:"srgb"}});h=eK.RGBA_ASTC_4x4_Format,f=new eK.CompressedTexture(y,p,v,h,n,c,o,a,u,s),this.width=p,this.height=v}else if(l===t.TextureSourceType.video)f=new eK.VideoTexture(e.video,c,o,a,u,s,h,n);else if(l===t.TextureSourceType.framebuffer){var g=e.data;if(g){var x,T,E=null!=(x=g.width)?x:0,_=null!=(T=g.height)?T:0;f=new eK.FramebufferTexture(E,_,h),this.width=E,this.height=_}}else l===t.TextureSourceType.none&&((f=new eK.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=eK.MirroredRepeatWrapping,f.wrapT=eK.MirroredRepeatWrapping,this.width=this.height=1);if(f)return f.flipY=!!i,f;throw Error("使用未知的数据类型创建纹理")},r.toThreeJsTextureFilter=function(t){return t===ij.LINEAR?eK.LinearFilter:eK.NearestFilter},r.toThreeJsTextureWrap=function(t){switch(t){case ij.MIRRORED_REPEAT:return eK.MirroredRepeatWrapping;case ij.REPEAT:return eK.RepeatWrapping;default:return eK.ClampToEdgeWrapping}},r}(nc),s0=function(t){function e(e,r,i){var n;return(n=t.call(this,e,r,i)||this).rootItem.getComponent(sN).resetStatus(),n}rR(e,t);var r=e.prototype;return r.updateVideo=function(){this.textures.map(function(t){return t.startVideo()})},r.prepareRender=function(){var t=this.renderer;this.renderFrame._renderPasses[0].meshes.length=0;for(var e,r=rO(this.rootComposition.items);!(e=r()).done;)for(var i,n=e.value.getComponents(rQ),o=rO(n);!(i=o()).done;){var a=i.value;a.isActiveAndEnabled&&a.render(t)}for(var s,u=rO(this.refContent);!(s=u()).done;)for(var l,c=s.value,h=rO(c.getComponent(sN).items);!(l=h()).done;)for(var f,m=l.value.getComponents(rQ),d=rO(m);!(f=d()).done;){var p=f.value;p.isActiveAndEnabled&&p.render(t)}},r.getRendererOptions=function(){var t=s$.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}(sF);s0.shape={};var s1=function(t){function e(e){var r;return(r=t.call(this)||this).gpuCapability=new n9(e),r}return rR(e,t),e.prototype.setOptions=function(t){var e=t.threeCamera,r=t.threeGroup,i=t.composition;this.threeCamera=e,this.threeGroup=r,this.composition=i},e}(sG),s2=function(t){function e(e){var r;return(r=t.call(this)||this).engine=new s1(e),r.renderingData={currentFrame:{}},r}return rR(e,t),e}(or),s3=function(t){function e(e,r){(i=t.call(this)||this).compositions=[],i.baseCompositionIndex=0,i.env="";var i,n=r.width,o=r.height,a=r.camera;return i.renderer=new s2(e),i.width=n,i.height=o,i.camera=a,i}rR(e,t);var r=e.prototype;return r.loadScene=function(t,e){var r=this;return eJ(function(){var i,n;return e2(this,function(o){switch(o.label){case 0:if(n=r.baseCompositionIndex,!rv(t))return[3,2];return r.baseCompositionIndex+=t.length,[4,Promise.all(t.map(eJ(function(t,i){var o;return e2(this,function(a){switch(a.label){case 0:return[4,r.createComposition(t,e)];case 1:return(o=a.sent()).setIndex(n+i),[2,o]}})})))];case 1:return i=o.sent(),[3,4];case 2:return r.baseCompositionIndex+=1,[4,r.createComposition(t,e)];case 3:(i=o.sent()).setIndex(n),o.label=4;case 4:return[2,i]}})})()},r.createComposition=function(t,e){void 0===e&&(e={});var r=this;return eJ(function(){var i,n,o,a,s,u,l,c,h;return e2(this,function(f){switch(f.label){case 0:return i=performance.now(),n=i1({autoplay:!0},e),sS(t)?(o=t.url,sO(t)&&(n=i1({},n,t.options||{}))):o=t,r.assetManager?r.assetManager.updateOptions(n):r.assetManager=new sM(n),[4,r.assetManager.loadScene(o,r.renderer,{env:r.env})];case 1:for(a=f.sent(),(s=r.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(l=new sU(a,s),!s.database)return[3,3];return[4,s.createVFXItemsAsync(a)];case 2:f.sent(),f.label=3;case 3:return c=new s0(i1({},n,{width:r.width,height:r.height,renderer:r.renderer}),a,l),r.renderer.engine.setOptions({threeCamera:r.camera,threeGroup:r,composition:c}),n.autoplay?c.play():c.pause(),h=performance.now()-i+c.statistic.loadTime,c.statistic.firstFrameTime=h,rm.info("first frame: ["+c.name+"]"+h.toFixed(4)+"ms"),r.compositions.push(c),[2,c]}})})()},r.update=function(t){this.compositions.forEach(function(e){e.update(t)})},rC(e,[{key:"currentComposition",get:function(){return this.compositions[0]}}]),e}(eK.Group);t.ThreeSpriteComponent=function(t){function e(){return t.apply(this,arguments)}rR(e,t);var r=e.prototype;return r.setVisible=function(t){this.threeMesh.visible=t},r.getVisible=function(){return this.threeMesh.visible},r.dispose=function(){t.prototype.dispose.call(this),this.isActiveAndEnabled||this.threeMesh.clear()},r.fromData=function(e){t.prototype.fromData.call(this,e),this.threeMesh||(this.geometry.mode===ij.LINES?this.threeMesh=new eK.LineSegments(this.geometry.geometry,this.material.material):this.threeMesh=new eK.Mesh(this.geometry.geometry,this.material.material))},r.start=function(){t.prototype.start.call(this),this.engine.threeGroup.add(this.threeMesh)},r.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))},r.onDestroy=function(){this.threeMesh.clear()},rC(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=e1([rj(er.SpriteComponent)],t.ThreeSpriteComponent),oc(8),nc.create=function(t,e){return new s$(t,void 0,e)},nc.createWithData=function(t,e,r){return new s$(t,e,r)},ng.create=function(t,e){return new sq(t,e)},nL.create=function(t,e){return new sQ(t,e)},nP.create=function(t,e){return new sJ(t,e)};var s4="2.0.0-alpha.9";rm.info("THREEJS plugin version: "+s4),t.AbstractPlugin=rJ,t.ActivationPlayable=oO,t.AssetLoader=sk,t.AssetManager=sM,t.BYTES_TYPE_MAP=nw,t.Behaviour=rq,t.BezierSegments=iE,t.COMPRESSED_TEXTURE=ot,t.CONSTANT_MAP_BLEND=sH,t.CONSTANT_MAP_DEPTH=sW,t.CONSTANT_MAP_STENCIL_FUNC=sY,t.CONSTANT_MAP_STENCIL_OP=sj,t.COPY_FRAGMENT_SHADER=nC,t.COPY_MESH_SHADER_ID=nE,t.COPY_VERTEX_SHADER=n_,t.CalculateLoader=aV,t.Camera=sV,t.CameraVFXItemLoader=iV,t.Component=rZ,t.Composition=sF,t.CompositionComponent=sN,t.CompositionSourceManager=sU,t.CurveValue=ig,t.DEFAULT_FONTS=az,t.Database=sB,t.Downloader=i2,t.EFFECTS_COPY_MESH_NAME=nT,t.EVENT_TYPE_CLICK=iN,t.EVENT_TYPE_TOUCH_END=iU,t.EVENT_TYPE_TOUCH_MOVE=iD,t.EVENT_TYPE_TOUCH_START=iF,t.EffectsObject=rW,t.Engine=sG,t.EventSystem=ik,t.Float16ArrayWrapper=r8,t.FrameBuffer=oe,t.GPUCapability=n9,t.Geometry=nL,t.GlobalUniforms=n5,t.GradientValue=iy,t.HELP_LINK=iH,t.InteractBehavior=iz,t.InteractLoader=iG,t.InteractMesh=on,t.ItemBehaviour=rK,t.KTXTexture=nf,t.LineSegments=ix,t.LinearValue=iv,t.Material=ng,t.MaterialDataBlock=np,t.Mesh=nP,t.PLAYER_OPTIONS_ENV_EDITOR=iX,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=aP,t.ParticleLoader=oZ,t.ParticleMesh=oF,t.ParticleSystemRenderer=aC,t.PassTextureCache=nO,t.PathSegments=iT,t.PluginSystem=aW,t.RENDER_PASS_NAME_PREFIX=n0,t.RENDER_PREFER_LOOKUP_TEXTURE=oP,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=im,t.RandomValue=id,t.RandomVectorValue=ip,t.RenderBuffer=n6,t.RenderFrame=n2,t.RenderPass=nF,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=nV,t.Renderer=or,t.RendererComponent=rQ,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=nb,t.SerializationHelper=sz,t.ShaderVariant=nx,t.SpriteColorPlayable=oM,t.SpriteLoader=of,t.StaticValue=ih,t.TEMPLATE_USE_OFFSCREEN_CANVAS=oV,t.TEXTURE_UNIFORM_MAP=sZ,t.TextLoader=ak,t.Texture=nc,t.TextureFactory=nd,t.ThreeComposition=s0,t.ThreeDisplayObject=s3,t.ThreeEngine=s1,t.ThreeMaterial=sq,t.ThreeTexture=s$,t.Ticker=sX,t.TimelineClip=og,t.TimelineComponent=ob,t.Track=oy,t.Transform=iP,t.TransformAnimationPlayable=oR,t.TransformAnimationPlayableAsset=oS,t.ValueGetter=ic,t.addByOrder=rl,t.addItem=e8,t.addItemWithOrder=function(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var o=t[n];if(i)for(;t[n-1][r]<o[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>o[r]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},t.assertExist=rh,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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=it,t.canvasPool=aU,t.colorGradingFrag=nH,t.colorStopsFromGradient=rr,t.colorToArr=rt,t.combineImageTemplate=sw,t.compatibleFrag="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n",t.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",t.createCopyShader=nA,t.createGLContext=function(t,e,r){var i;if(void 0===e&&(e="webgl"),"webgl2"!==e||(i=t.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),i&&"webgl"!==e||(i=t.getContext("webgl",r)),!i)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i},t.createKeyFrameMeta=iL,t.createShaderWithMarcos=iQ,t.createShape=o7,t.createVFXItem=aG,t.createValueGetter=iC,t.deepClone=function t(e){if(rv(e))return e.map(t);if(e&&"object"==typeof e){if(ArrayBuffer.isView(e))return e.slice();for(var r={},i=Object.keys(e),n=0;n<i.length;n++){var o=i[n];r[o]=t(e[o])}return r}return e},t.defaultGlobalVolume=n$,t.defaultPlugins=aH,t.deserializeMipmapTexture=no,t.earcut=av,t.effectsClass=rj,t.effectsClassStore=rB,t.enlargeBuffer=e7,t.ensureVec3=ie,t.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-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=nY,t.gaussianDownVFrag=nj,t.gaussianUpFrag=nW,t.generateEmptyTypedArray=nI,t.generateGUID=rE,t.generateHalfFloatTexture=nh,t.getBackgroundImage=sb,t.getColorFromGradientStops=re,t.getConfig=function(t){return oN[t]},t.getDefaultTemplateCanvasPool=function(){return aU},t.getDefaultTextureFactory=function(){return es||(es=new nd),es},t.getGeometryByShape=ag,t.getGeometryTriangles=ay,t.getImageItemRenderInfo=oa,t.getKTXTextureOptions=nm,t.getKeyFrameMetaByRawValue=iw,t.getMergedStore=rH,t.getParticleMeshShader=oz,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=iq,t.getStandardComposition=sT,t.getStandardImage=sx,t.getStandardItem=s_,t.getStandardJSON=sy,t.getTextureSize=n3,t.glContext=ij,t.gpuTimer=function(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var r=t.createQuery(),i=eJ(function(){return e2(this,function(n){return[2,new Promise(function(n,o){if(r){var a=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(e.GPU_DISJOINT_EXT);a&&!s&&n(t.getQueryParameter(r,t.QUERY_RESULT)/1e3/1e3),(a||s)&&(t.deleteQuery(r),r=null),null!==a&&r&&window.setTimeout(function(){i().then(n).catch},1)}})]})});if(!r)return;return{begin:function(){r&&t.beginQuery(e.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:i}}},t.imageDataFromColor=function(t){rp(t)&&(t=rt(t));for(var e=t,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=e[n];return r},t.imageDataFromGradient=rs,t.initErrors=iY,t.initGLContext=iW,t.integrate="float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}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;}else 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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}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.;}return 0.;}",t.interpolateColor=ri,t.isAndroid=ro,t.isArray=rv,t.isFunction=ry,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=rg,t.isSceneJSON=sR,t.isSceneURL=sS,t.isSceneWithOptions=sO,t.isSimulatorCellPhone=ra,t.isString=rp,t.isUniformStruct=nv,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&nv(t[0])},t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",t.itemFrag=nz,t.itemFrameFrag=nD,t.itemVert=nU,t.loadBinary=i9,t.loadBlob=function(t){return nt.apply(this,arguments)},t.loadImage=i6,t.loadMedia=ni,t.loadVideo=ne,t.loadWebPOptional=i4,t.logger=rm,t.math=r5,t.modifyMaxKeyframeShader=ok,t.nearestPowerOfTwo=function(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))},t.noop=rd,t.parsePercent=rn,t.particleFrag=nk,t.particleOriginTranslateMap=ia,t.particleVert=nB,t.pluginLoaderMap=aX,t.random=rx,t.registerPlugin=aj,t.removeItem=e9,t.rotateVec2=ax,t.screenMeshVert=nX,t.serialize=rY,t.setBlendMode=iJ,t.setConfig=function(t,e){return oN[t]=e},t.setDefaultTextureFactory=function(t){es=t},t.setMaskMode=i0,t.setMaxSpriteMeshItemCount=oc,t.setRayFromCamera=is,t.setSideMode=i$,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=function(e){return(t.maxSpriteTextureCount=Math.min(e.maxFragmentTextures,16),e.maxVertexUniforms>=256)?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void(t.maxSpriteTextureCount=8)},t.setUniformValue=function(t,e,r){t[e]?t[e].value=r:t[e]=new eK.Uniform(r)},t.sortByOrder=ru,t.spec=rk,t.spriteMeshShaderFromFilter=os,t.spriteMeshShaderFromRenderInfo=ol,t.spriteMeshShaderIdFromRenderInfo=ou,t.thresholdFrag=nZ,t.throwDestroyedError=rT,t.trailVert=nG,t.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},t.trianglesFromRect=iu,t.unregisterPlugin=function(t){delete aY[t],delete aX[t],e9(aH,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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}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.vecAssign=ii,t.vecFill=ir,t.vecMulCombine=io,t.vecNormalize=function(t,e){1==arguments.length&&(e=t,t=[]);var r,i=e,n=(r=Math).hypot.apply(r,[].concat(i));if(0===n)return ii(t,i,i.length);for(var o=0;o<i.length;o++)t[o]=i[o]/n;return t},t.version=s4,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
13
13
|
//# sourceMappingURL=index.min.js.map
|