@galacean/effects 2.0.0-alpha.2 → 2.0.0-alpha.20
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/alipay.js +31259 -0
- package/dist/alipay.js.map +1 -0
- package/dist/alipay.mjs +31006 -0
- package/dist/alipay.mjs.map +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/index.js +21619 -21735
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +3 -16
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +22520 -22629
- package/dist/index.mjs.map +1 -1
- package/dist/player.d.ts +76 -14
- package/dist/utils.d.ts +2 -0
- package/dist/weapp.js +21564 -21680
- package/dist/weapp.js.map +1 -1
- package/dist/weapp.mjs +22753 -22862
- package/dist/weapp.mjs.map +1 -1
- package/package.json +13 -5
package/dist/index.min.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
!/*!
|
|
2
2
|
* Name: @galacean/effects
|
|
3
3
|
* Description: Galacean Effects runtime player for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
7
|
-
*/
|
|
8
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ge={})}(this,(function(t){"use strict";var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},e(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i=function(){return i=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},i.apply(this,arguments)};function n(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 o(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?n(t.value):function(t){return t instanceof r?t:new r((function(e){e(t)}))}(t.value).then(a,s)}u((i=i.apply(t,e||[])).next())}))}function a(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 new 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=a.trys,(n=n.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 s(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 new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(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 l(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))}let c;"function"==typeof SuppressedError&&SuppressedError;const h=new Uint8Array(16);function f(){if(!c&&(c="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!c))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return c(h)}const p=[];for(let t=0;t<256;++t)p.push((t+256).toString(16).slice(1));var d,m={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function y(t,e,r){if(m.randomUUID&&!e&&!t)return m.randomUUID();const i=(t=t||{}).random||(t.rng||f)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(let t=0;t<16;++t)e[r+t]=i[t];return e}return function(t,e=0){return p[t[e+0]]+p[t[e+1]]+p[t[e+2]]+p[t[e+3]]+"-"+p[t[e+4]]+p[t[e+5]]+"-"+p[t[e+6]]+p[t[e+7]]+"-"+p[t[e+8]]+p[t[e+9]]+"-"+p[t[e+10]]+p[t[e+11]]+p[t[e+12]]+p[t[e+13]]+p[t[e+14]]+p[t[e+15]]}(i)}function v(t,e){return t.includes(e)||t.push(e),t}function g(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function x(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 T(t,e){var r=[0,0,0,0];if(ht(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]||[0,0,0,255])}else t instanceof 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 E(t,e,r){if(t.length){for(var i=void 0,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){i=C(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 b(t){var e=[];if(t instanceof Array?t.forEach((function(t){var r=u(t,5),i=r[0],n=r[1],o=r[2],a=r[3],s=r[4];e.push({stop:_(i),color:[n,o,a,s]})})):Object.keys(t).forEach((function(r){var i=T(t[r]);e.push({stop:_(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 C(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(a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*o+e[a]*e[a]*r));n[3]=Math.round(t[3]*o+e[3]*r)}return n}function _(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function A(){if("object"==typeof screen&&"object"==typeof document){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0),e=screen.width/t;return Math.min(2*e,2)}return 1}function S(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function R(){return S()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function O(t){ht(t)&&(t=T(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}function w(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=b(t);if(n.length){i.set(n[0].color,0);for(var o=1;o<127;o++){for(var a=o/e,s=void 0,u=void 0,l=0;l<n.length&&(s=n[l],u=n[l+1],!(s.stop<=a&&u.stop>a));l++);var c=C(s.color,u.color,(a-s.stop)/(u.stop-s.stop));i.set(c,4*o)}i.set(n[n.length-1].color,508)}return r}function M(e,r){void 0===r&&(r=t.OrderType.ascending);var i=e.length;if(i<=1||r===t.OrderType.none)return e;if(i<=30){for(var n=1;n<i;n++)I(e,n,r);return e}return P(e,r)}function L(e,r,i){return void 0===i&&(i=t.OrderType.ascending),e.includes(r)?e:(e.push(r),1===e.length||i!==t.OrderType.none&&I(e,e.length-1,i),e)}function I(e,r,i){var n=e[r];if(i!==t.OrderType.ascending)for(;r>=1&&e[r-1].priority<n.priority&&(e[r]=e[r-1],0!=--r););else for(;r>=1&&e[r-1].priority>n.priority&&(e[r]=e[r-1],0!=--r););e[r]=n}function P(e,r,i,n){var o,a;if(void 0===i&&(i=0),void 0===n&&(n=e.length-1),i>=n)return e;for(var s=e[i],l=i,c=n;l<c;){if(r===t.OrderType.ascending){for(;e[c].priority>s.priority&&c>=l;)c--;for(;e[l].priority<=s.priority&&l<c;)l++}else{for(;e[c].priority<s.priority&&c>=l;)c--;for(;e[l].priority>=s.priority&&l<c;)l++}o=u([e[c],e[l]],2),e[l]=o[0],e[c]=o[1]}return a=u([e[l],e[i]],2),e[i]=a[0],e[l]=a[1],P(e,r,i,l-1),P(e,r,c+1,n),e}function F(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}t.OrderType=void 0,(d=t.OrderType||(t.OrderType={}))[d.none=1]="none",d[d.ascending=2]="ascending",d[d.descending=3]="descending";var N=2*Math.PI,D=Math.PI/180,V=180/Math.PI,z=1e-6;function U(t,e){return Math.abs(t-e)<z||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var B=function(t,e,r){return(1-r)*t+r*e};function k(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r,o=Math.min(i,n),a=Math.max(i,n);return Math.min(Math.max(t,o),a)}var G,X=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this},t.prototype.setFromArray=function(t,e){var r,i;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):t instanceof Array?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):t instanceof Array?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):t instanceof Array?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):t instanceof Array?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this},t.prototype.sum=function(){return this.x+this.y},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},t.prototype.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},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},t.prototype.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},t.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},t.prototype.isZero=function(){var t=z,e=(this,this.x),r=this.y;return Math.abs(e)<=t&&Math.abs(r)<=t},t.prototype.toArray=function(){return[this.x,this.y]},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},t.prototype.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.ONE=new t(1,1),t.ZERO=new t(0,0),t}(),H=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}return t.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},t.prototype.setFromArray=function(t,e){var r,i,n;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):t instanceof 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},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},t.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):t instanceof 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},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):t instanceof 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},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):t instanceof 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},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.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},t.prototype.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},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},t.prototype.cross=function(t){return this.crossVectors(this,t)},t.prototype.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},t.prototype.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},t.prototype.distance=function(t){return Math.sqrt(this.distanceSquared(t))},t.prototype.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},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},t.prototype.isZero=function(){var t,e=z,r=(t=this).x,i=t.y,n=t.z;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toVector2=function(){return new X(this.x,this.y)},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t.prototype.applyEuler=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyMatrix=function(t,e){return t.transformPoint(this,e)},t.prototype.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},t.prototype.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.X=new t(1,0,0),t.Y=new t(0,1,0),t.Z=new t(0,0,1),t.ONE=new t(1,1,1),t.ZERO=new t(0,0,0),t}(),j=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}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setFromEuler=function(t){return t.toQuaternion(this),this},t.prototype.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},t.prototype.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},t.prototype.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){f=2*Math.sqrt(1+r-a-c);this.w=(l-s)/f,this.x=.25*f,this.y=(i+o)/f,this.z=(n+u)/f,this.negate()}else if(a>c){f=2*Math.sqrt(1+a-r-c);this.w=(n-u)/f,this.x=(i+o)/f,this.y=.25*f,this.z=(s+l)/f,this.negate()}else{f=2*Math.sqrt(1+c-r-a);this.w=(o-i)/f,this.x=(n+u)/f,this.y=(s+l)/f,this.z=.25*f,this.negate()}return this},t.prototype.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.w=r):(this.x=0,this.y=-t.z,this.z=t.y,this.w=r)):(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()},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(k(this.dot(t),-1,1)))},t.prototype.rotateTowards=function(t,e){var r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,e/r);return this.slerp(t,i),this},t.prototype.identity=function(){return this.set(0,0,0,1)},t.prototype.invert=function(){return this.conjugate()},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.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},t.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},t.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},t.prototype.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},t.prototype.slerp=function(t,e){var r;if(0===e)return this;if(1===e)return this.copyFrom(t);var i=(r=this).x,n=r.y,o=r.z,a=r.w,s=a*t.w+i*t.x+n*t.y+o*t.z;if(s<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,s=-s):this.copyFrom(t),s>=1)return this.w=a,this.x=i,this.y=n,this.z=o,this;var u=1-s*s;if(u<=Number.EPSILON){var l=1-e;return this.w=l*a+e*this.w,this.x=l*i+e*this.x,this.y=l*n+e*this.y,this.z=l*o+e*this.z,this.normalize(),this}var c=Math.sqrt(u),h=Math.atan2(c,s),f=Math.sin((1-e)*h)/c,p=Math.sin(e*h)/c;return this.w=a*f+this.w*p,this.x=i*f+this.x*p,this.y=n*f+this.y*p,this.z=o*f+this.z*p,this},t.prototype.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},t.prototype.rotateVector3=function(t,e){var r,i=(r=this).x,n=r.y,o=r.z,a=r.w,s=t.x,u=t.y,l=t.z,c=a*s+n*l-o*u,h=a*u+o*s-i*l,f=a*l+i*u-n*s,p=-i*s-n*u-o*l,d=null!=e?e:t;return d.x=c*a+p*-i+h*-o-f*-n,d.y=h*a+p*-n+f*-i-c*-o,d.z=f*a+p*-o+c*-n-h*-i,d},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},t.prototype.toEuler=function(t){return t.setFromQuaternion(this)},t.prototype.toMatrix4=function(t){return t.compose(H.ZERO,this,H.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.tempVec0=new H,t}(),Y=function(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},W=function(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))},Z=function(){function t(t,e,r,i,n,o,a,s,u,l,c,h,f,p,d,m){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===p&&(p=0),void 0===d&&(d=0),void 0===m&&(m=1),this.elements=[t,e,r,i,n,o,a,s,u,l,c,h,f,p,d,m]}return t.prototype.set=function(t,e,r,i,n,o,a,s,u,l,c,h,f,p,d,m){var y=this.elements;return y[0]=t,y[1]=e,y[2]=r,y[3]=i,y[4]=n,y[5]=o,y[6]=a,y[7]=s,y[8]=u,y[9]=l,y[10]=c,y[11]=h,y[12]=f,y[13]=p,y[14]=d,y[15]=m,this},t.prototype.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u,l,c,h,f,p,d,m){var y=this.elements;return y[0]=t,y[4]=e,y[8]=r,y[12]=i,y[1]=n,y[5]=o,y[9]=a,y[13]=s,y[2]=u,y[6]=l,y[10]=c,y[14]=h,y[3]=f,y[7]=p,y[11]=d,y[15]=m,this},t.prototype.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)},t.prototype.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},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[e+r];return this},t.prototype.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},t.prototype.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},t.prototype.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)},t.prototype.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)},t.prototype.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)},t.prototype.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)},t.prototype.setFromEuler=function(t){return t.toMatrix4(this),this},t.prototype.setFromQuaternion=function(t){return this.compose(H.ZERO,t,H.ONE)},t.prototype.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},t.prototype.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)},t.prototype.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.prototype.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]},t.prototype.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])},t.prototype.copyFrom=function(t){return this.elements=W([],Y(t.elements),!1),this},t.prototype.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])},t.prototype.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},t.prototype.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[n]*e;return this},t.prototype.multiply=function(t){if("number"==typeof t){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.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],p=r[2],d=r[6],m=r[10],y=r[14],v=r[3],g=r[7],x=r[11],T=r[15],E=i[0],b=i[4],C=i[8],_=i[12],A=i[1],S=i[5],R=i[9],O=i[13],w=i[2],M=i[6],L=i[10],I=i[14],P=i[3],F=i[7],N=i[11],D=i[15];return n[0]=o*E+a*A+s*w+u*P,n[4]=o*b+a*S+s*M+u*F,n[8]=o*C+a*R+s*L+u*N,n[12]=o*_+a*O+s*I+u*D,n[1]=l*E+c*A+h*w+f*P,n[5]=l*b+c*S+h*M+f*F,n[9]=l*C+c*R+h*L+f*N,n[13]=l*_+c*O+h*I+f*D,n[2]=p*E+d*A+m*w+y*P,n[6]=p*b+d*S+m*M+y*F,n[10]=p*C+d*R+m*L+y*N,n[14]=p*_+d*O+m*I+y*D,n[3]=v*E+g*A+x*w+T*P,n[7]=v*b+g*S+x*M+T*F,n[11]=v*C+g*R+x*L+T*N,n[15]=v*_+g*O+x*I+T*D,this},t.prototype.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},t.prototype.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)},t.prototype.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},t.prototype.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],p=t[12],d=t[13],m=t[14],y=t[15],v=c*m*u-d*h*u+d*s*f-a*m*f-c*s*y+a*h*y,g=p*h*u-l*m*u-p*s*f+o*m*f+l*s*y-o*h*y,x=l*d*u-p*c*u+p*a*f-o*d*f-l*a*y+o*c*y,T=p*c*s-l*d*s-p*a*h+o*d*h+l*a*m-o*c*m,E=e*v+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 b=1/E;return t[0]=v*b,t[1]=(d*h*n-c*m*n-d*i*f+r*m*f+c*i*y-r*h*y)*b,t[2]=(a*m*n-d*s*n+d*i*u-r*m*u-a*i*y+r*s*y)*b,t[3]=(c*s*n-a*h*n-c*i*u+r*h*u+a*i*f-r*s*f)*b,t[4]=g*b,t[5]=(l*m*n-p*h*n+p*i*f-e*m*f-l*i*y+e*h*y)*b,t[6]=(p*s*n-o*m*n-p*i*u+e*m*u+o*i*y-e*s*y)*b,t[7]=(o*h*n-l*s*n+l*i*u-e*h*u-o*i*f+e*s*f)*b,t[8]=x*b,t[9]=(p*c*n-l*d*n-p*r*f+e*d*f+l*r*y-e*c*y)*b,t[10]=(o*d*n-p*a*n+p*r*u-e*d*u-o*r*y+e*a*y)*b,t[11]=(l*a*n-o*c*n-l*r*u+e*c*u+o*r*f-e*a*f)*b,t[12]=T*b,t[13]=(l*d*i-p*c*i+p*r*h-e*d*h-l*r*m+e*c*m)*b,t[14]=(p*a*i-o*d*i-p*r*s+e*d*s+o*r*m-e*a*m)*b,t[15]=(o*c*i-l*a*i+l*r*s-e*c*s-o*r*h+e*a*h)*b,this},t.prototype.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},t.prototype.compose=function(t,e,r,i){void 0===i&&(i=H.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,p=a+a,d=s+s,m=o*f,y=o*p,v=o*d,g=a*p,x=a*d,T=s*d,E=u*f,b=u*p,C=u*d,_=r.x,A=r.y,S=r.z;return n[0]=(1-(g+T))*_,n[1]=(y+C)*_,n[2]=(v-b)*_,n[3]=0,n[4]=(y-C)*A,n[5]=(1-(m+T))*A,n[6]=(x+E)*A,n[7]=0,n[8]=(v+b)*S,n[9]=(x-E)*S,n[10]=(1-(m+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},t.prototype.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();this.determinant()<0&&(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},t.prototype.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},t.prototype.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]))},t.prototype.getTransform=function(){var t=new H,e=new j,r=new H;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},t.prototype.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},t.prototype.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},t.prototype.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)},t.prototype.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},t.prototype.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()},t.prototype.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},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!U(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return W([],Y(this.elements),!1)},t.prototype.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,p,d,m,y){return new t(e,o,l,p,r,a,c,d,i,s,h,m,n,u,f,y)},t.IDENTITY=new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),t.ZERO=new t(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),t.tempVec0=new H,t.tempVec1=new H,t.tempVec2=new H,t.tempMat0=new t,t}();!function(t){t[t.XYZ=0]="XYZ",t[t.XZY=1]="XZY",t[t.YXZ=2]="YXZ",t[t.YZX=3]="YZX",t[t.ZXY=4]="ZXY",t[t.ZYX=5]="ZYX"}(G||(G={}));var q=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}return t.prototype.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},t.prototype.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},t.prototype.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 G.XYZ:this.y=Math.asin(k(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,h),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(c,s),this.z=0);break;case G.YXZ:this.x=Math.asin(-k(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(o,h),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-l,i),this.z=0);break;case G.ZXY:this.x=Math.asin(k(c,-1,1)),Math.abs(c)<.9999999?(this.y=Math.atan2(-l,h),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,i));break;case G.ZYX:this.y=Math.asin(-k(l,-1,1)),Math.abs(l)<.9999999?(this.x=Math.atan2(c,h),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,s));break;case G.YZX:this.z=Math.asin(k(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-l,i)):(this.x=0,this.y=Math.atan2(o,h));break;case G.XZY:this.z=Math.asin(-k(n,-1,1)),Math.abs(n)<.9999999?(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*=V,this.y*=V,this.z*=V,this.order=e,this},t.prototype.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},t.prototype.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},t.prototype.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])&&void 0!==i?i:0,this.y=null!==(n=t[e+1])&&void 0!==n?n:0,this.z=null!==(o=t[e+2])&&void 0!==o?o:0,this.order=null!==(a=t[e+3])&&void 0!==a?a:r,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.order)},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},t.prototype.add=function(t){return this.order!=t.order?(console.error("add euler with different order"),this):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},t.prototype.addEulers=function(t,e){return t.order!=e.order?(console.error("add euler with different order"),this):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order,this)},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.reorder=function(t){var e=new j;return e.setFromEuler(this),this.setFromQuaternion(e,t)},t.prototype.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},t.prototype.toVector3=function(t){return t.set(this.x,this.y,this.z)},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toQuaternion=function(t){var e,r=(e=this).x,i=e.y,n=e.z,o=e.order,a=Math.cos(r*D*.5),s=Math.cos(i*D*.5),u=Math.cos(n*D*.5),l=Math.sin(r*D*.5),c=Math.sin(i*D*.5),h=Math.sin(n*D*.5);switch(o){case G.XYZ:t.set(l*s*u+a*c*h,a*c*u-l*s*h,a*s*h+l*c*u,a*s*u-l*c*h);break;case G.YXZ:t.set(l*s*u+a*c*h,a*c*u-l*s*h,a*s*h-l*c*u,a*s*u+l*c*h);break;case G.ZXY:t.set(l*s*u-a*c*h,a*c*u+l*s*h,a*s*h+l*c*u,a*s*u-l*c*h);break;case G.ZYX:t.set(l*s*u-a*c*h,a*c*u+l*s*h,a*s*h-l*c*u,a*s*u+l*c*h);break;case G.YZX:t.set(l*s*u+a*c*h,a*c*u+l*s*h,a*s*h-l*c*u,a*s*u-l*c*h);break;case G.XZY:t.set(l*s*u-a*c*h,a*c*u-l*s*h,a*s*h+l*c*u,a*s*u+l*c*h);break;default:console.error("unknown euler order: "+o)}return t},t.prototype.toMatrix4=function(t){var e,r=t.elements,i=(e=this).x,n=e.y,o=e.z,a=e.order,s=Math.cos(i*D),u=Math.sin(i*D),l=Math.cos(n*D),c=Math.sin(n*D),h=Math.cos(o*D),f=Math.sin(o*D);if(a===G.XYZ){var p=s*h,d=s*f,m=u*h,y=u*f;r[0]=l*h,r[4]=-l*f,r[8]=c,r[1]=d+m*c,r[5]=p-y*c,r[9]=-u*l,r[2]=y-p*c,r[6]=m+d*c,r[10]=s*l}else if(a===G.YXZ){var v=l*h,g=l*f,x=c*h,T=c*f;r[0]=v+T*u,r[4]=x*u-g,r[8]=s*c,r[1]=s*f,r[5]=s*h,r[9]=-u,r[2]=g*u-x,r[6]=T+v*u,r[10]=s*l}else if(a===G.ZXY){v=l*h,g=l*f,x=c*h,T=c*f;r[0]=v-T*u,r[4]=-s*f,r[8]=x+g*u,r[1]=g+x*u,r[5]=s*h,r[9]=T-v*u,r[2]=-s*c,r[6]=u,r[10]=s*l}else if(a===G.ZYX){p=s*h,d=s*f,m=u*h,y=u*f;r[0]=l*h,r[4]=m*c-d,r[8]=p*c+y,r[1]=l*f,r[5]=y*c+p,r[9]=d*c-m,r[2]=-c,r[6]=u*l,r[10]=s*l}else if(a===G.YZX){var E=s*l,b=s*c,C=u*l,_=u*c;r[0]=l*h,r[4]=_-E*f,r[8]=C*f+b,r[1]=f,r[5]=s*h,r[9]=-u*h,r[2]=-c*h,r[6]=b*f+C,r[10]=E-_*f}else if(a===G.XZY){E=s*l,b=s*c,C=u*l,_=u*c;r[0]=l*h,r[4]=-f,r[8]=c*h,r[1]=E*f+_,r[5]=s*h,r[9]=b*f-C,r[2]=C*f-b,r[6]=u*h,r[10]=_*f+E}else console.error("toMatrix4: Invalid order "+a);return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[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.DEFAULT_ORDER=G.ZYX,t.tempQuat0=new j,t.tempMat0=new Z,t}(),K=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}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this.w=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):t instanceof 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},t.prototype.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},t.prototype.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},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):t instanceof 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},t.prototype.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},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):t instanceof 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},t.prototype.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},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):t instanceof 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},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z+this.w},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.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},t.prototype.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},t.prototype.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},t.prototype.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},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.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},t.prototype.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},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.isZero=function(){var t,e=z,r=(t=this).x,i=t.y,n=t.z,o=t.w;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e&&Math.abs(o)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector3=function(){return new H(this.x,this.y,this.z)},t.prototype.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},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},t.prototype.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.ONE=new t(1,1,1,1),t.ZERO=new t(0,0,0,0),t}(),Q=function(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},J=function(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(){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]}return t.prototype.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},t.prototype.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},t.prototype.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)},t.prototype.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])},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[e+r];return this},t.prototype.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,p=i*s,d=n*o,m=n*a,y=n*s,v=this.elements;return v[0]=1-(h+p),v[1]=l+y,v[2]=c-m,v[3]=l-y,v[4]=1-(u+p),v[5]=f+d,v[6]=c+m,v[7]=f-d,v[8]=1-(u+h),this},t.prototype.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},t.prototype.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])},t.prototype.copyFrom=function(t){return this.elements=J([],Q(t.elements),!1),this},t.prototype.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},t.prototype.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},t.prototype.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},t.prototype.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},t.prototype.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.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],p=r[8],d=i[0],m=i[3],y=i[6],v=i[1],g=i[4],x=i[7],T=i[2],E=i[5],b=i[8];return n[0]=o*d+a*v+s*T,n[3]=o*m+a*g+s*E,n[6]=o*y+a*x+s*b,n[1]=u*d+l*v+c*T,n[4]=u*m+l*g+c*E,n[7]=u*y+l*x+c*b,n[2]=h*d+f*v+p*T,n[5]=h*m+f*g+p*E,n[8]=h*y+f*x+p*b,this},t.prototype.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)},t.prototype.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,p=e*c+n*h+s*f;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var d=1/p;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},t.prototype.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},t.prototype.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},t.prototype.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!U(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return J([],Q(this.elements),!1)},t.prototype.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}(),tt=function(){function t(t,e){void 0===t&&(t=H.ZERO),void 0===e&&(e=H.X),this.origin=new H,this.direction=new H,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}return t.prototype.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},t.prototype.clone=function(){return new t(this.origin,this.direction)},t.prototype.copyFrom=function(t){return this.set(t.origin,t.direction)},t.prototype.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},t.prototype.at=function(t,e){var r=e||new H;return r.copyFrom(this.origin),r.addScaledVector(this.direction,t)},t.prototype.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},t.prototype.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},t.prototype.intersectBox=function(t,e){var r,i,n,o,a,s,u,l,c,h,f=(r=this.origin).x,p=r.y,d=r.z,m=(i=this.direction).x,y=i.y,v=i.z,g=(n=t.min).x,x=n.y,T=n.z,E=(o=t.max).x,b=o.y,C=o.z,_=1/m,A=1/y,S=1/v;if(_>=0?(a=(g-f)*_,s=(E-f)*_):(a=(E-f)*_,s=(g-f)*_),A>=0?(u=(x-p)*A,l=(b-p)*A):(u=(b-p)*A,l=(x-p)*A),!(a>l||u>s||((u>a||a!=a)&&(a=u),(l<s||s!=s)&&(s=l),(u>a||a!=a)&&(a=u),(l<s||s!=s)&&(s=l),S>=0?(c=(T-d)*S,h=(C-d)*S):(c=(C-d)*S,h=(T-d)*S),a>h||c>s||((c>a||a!=a)&&(a=c),(h<s||s!=s)&&(s=h),s<0))))return a>=0?this.at(a,e):this.at(s,e)},t.prototype.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 H).copyFrom(this.origin):void 0;var o=-(this.origin.dot(r)+i)/n;return o>=0?this.at(o,e):void 0},t.prototype.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)}},t.prototype.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 p=n*this.direction.dot(l);if(!(p<0)){u.cross(c);var d=n*this.direction.dot(u);if(!(d<0||p+d>f)){var m=-n*c.dot(h);if(!(m<0))return this.at(m/f,r)}}},t.tempVec0=new H,t.tempVec1=new H,t.tempVec2=new H,t.tempVec3=new H,t}(),et=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}return t.prototype.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,this},t.prototype.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},t.prototype.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},t.prototype.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.r=null!==(r=t[e])&&void 0!==r?r:0,this.g=null!==(i=t[e+1])&&void 0!==i?i:0,this.b=null!==(n=t[e+2])&&void 0!==n?n:0,this.a=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.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)},t.prototype.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)},t.prototype.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):t instanceof 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},t.prototype.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):t instanceof 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},t.prototype.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):t instanceof 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},t.prototype.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):t instanceof 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},t.prototype.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.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},t.prototype.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},t.prototype.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},t.prototype.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},t.prototype.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},t.prototype.toArray=function(){return[this.r,this.g,this.b,this.a]},t.prototype.toVector4=function(){return new K(this.r,this.g,this.b,this.a)},t.prototype.toHSV=function(){var e,r=(e=this).r,i=e.g,n=e.b,o=e.a,a=Math.max(r,i,n),s=Math.min(r,i,n),u=a-s,l=0,c=0;return 0!==a&&(c=u/a),a!=s&&(a==r?(l=(i-n)/u,i<n&&(l+=6)):a==i?l=(n-r)/u+2:a==n&&(l=(r-i)/u+4),l*=60),new t(l,c,a,o)},t.prototype.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},t.prototype.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.BLACK=new t(0,0,0,1),t.BLUE=new t(0,0,1,1),t.CLEAR=new t(0,0,0,0),t.CYAN=new t(0,1,1,1),t.GRAY=new t(.5,.5,.5,1),t.GREEN=new t(0,1,0,1),t.MAGENTA=new t(1,0,1,1),t.RED=new t(1,0,0,1),t.WHITE=new t(1,1,1,1),t.YELLOW=new t(1,.92,.016,1),t}(),rt=function(){function t(t,e){void 0===t&&(t=new H(1/0,1/0,1/0)),void 0===e&&(e=new H(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}return t.prototype.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},t.prototype.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},t.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},t.prototype.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),this},t.prototype.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},t.prototype.clone=function(){return(new t).copyFrom(this)},t.prototype.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},t.prototype.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},t.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},t.prototype.getCenter=function(t){return void 0===t&&(t=new H),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},t.prototype.getSize=function(t){return void 0===t&&(t=new H),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},t.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},t.prototype.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},t.prototype.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},t.prototype.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.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},t.prototype.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)},t.prototype.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},t.prototype.getParameter=function(t,e){return void 0===e&&(e=new H),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))},t.prototype.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)},t.prototype.intersectsSphere=function(t){var e=new H;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},t.prototype.clampPoint=function(t,e){return void 0===e&&(e=new H),e.copyFrom(t).clamp(this.min,this.max)},t.prototype.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},t.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},t.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.applyMatrix4=function(t,e){if(void 0===e&&(e=new H),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},t.prototype.getOBBPoints=function(t,e){if(void 0===e&&(e=new H),this.isEmpty())return[];var r=[];return r[0]=new H(this.min.x,this.min.y,this.min.z),r[1]=new H(this.min.x,this.min.y,this.max.z),r[2]=new H(this.min.x,this.max.y,this.min.z),r[3]=new H(this.min.x,this.max.y,this.max.z),r[4]=new H(this.max.x,this.min.y,this.min.z),r[5]=new H(this.max.x,this.min.y,this.max.z),r[6]=new H(this.max.x,this.max.y,this.min.z),r[7]=new H(this.max.x,this.max.y,this.max.z),r.forEach((function(r){r.subtract(e),r.applyMatrix(t),r.add(e)})),r},t.prototype.getBoundingSphere=function(t){this.getCenter(t.center);var e=new H;return t.radius=.5*this.getSize(e).length(),t},t.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},t.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),it=function(){function t(t,e){void 0===t&&(t=H.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}return t.prototype.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},t.prototype.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 rt).setFromPoints(t);o.getCenter(r),this.radius=o.getSize().length()/2}return this},t.prototype.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},t.prototype.isEmpty=function(){return this.radius<0},t.prototype.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},t.prototype.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},t.prototype.distanceToPoint=function(t){return t.distance(this.center)-this.radius},t.prototype.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},t.prototype.intersectsBox=function(t){return t.intersectsSphere(this)},t.prototype.clampPoint=function(t,e){var r=this.center.distanceSquared(t);return void 0===e&&(e=new H),e.copyFrom(t),r>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},t.prototype.getBoundingBox=function(t){return void 0===t&&(t=new rt),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},t.prototype.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],o=Math.sqrt(Math.max(r,i,n));return this.center.applyMatrix(t),this.radius=this.radius*o,this},t.prototype.translate=function(t){return this.center.add(t),this},t.prototype.expandByPoint=function(t){var e=(new H).subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=.5*(i-this.radius);this.center.add(e.multiply(n/i)),this.radius+=n}return this},t.prototype.union=function(t){var e=new H,r=new H;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},t.prototype.intersect=function(t){var e=(new H).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)},t.prototype.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},t.prototype.clone=function(){return(new t).copyFrom(this)},t}(),nt=Object.freeze({__proto__:null,get EulerOrder(){return G},Euler:q,Quaternion:j,Vector2:X,Vector3:H,Vector4:K,Matrix3:$,Matrix4:Z,Ray:tt,PI2:N,DEG2RAD:D,RAD2DEG:V,NumberEpsilon:z,isZero:function(t){return isNaN(t)||Math.abs(t)<z},isEqual:U,damp:function(t,e,r,i){return B(t,e,1-Math.exp(-r*i))},lerp:B,degToRad:function(t){return t*D},radToDeg:function(t){return t*V},clamp:k,Color:et,Box3:rt,Sphere:it});new q,new H(1,1,1),new H(0,0,0);var ot,at="[Galacean Effects]";function st(t){return["%c".concat(at),"background: #AA0100; color: white","".concat(t)]}var ut,lt={error:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.error.apply(console,l(l([],u(st(t)),!1),[e],!1)),null==ot||ot("error",t,e)},info:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.debug.apply(console,l([],u(st(t)),!1)),null==ot||ot("info",t,e)},warn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.warn.apply(console,l([],u(st(t)),!1)),null==ot||ot("warn",t,e)},register:function(t){t&&_t(t)&&(ot=t)}};function ct(){}function ht(t){return"string"==typeof t}t.DestroyOptions=void 0,(ut=t.DestroyOptions||(t.DestroyOptions={}))[ut.destroy=0]="destroy",ut[ut.keep=1]="keep",ut[ut.force=0]="force";var ft,pt,dt,mt,yt,vt,gt,xt,Tt,Et,bt,Ct=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function _t(t){return"[object Function]"===Object.prototype.toString.call(t)}function At(t){return"[object Object]"===Object.prototype.toString.call(t)}function St(t,e){return t+Math.random()*(e-t)}function Rt(){throw Error("destroyed item cannot be used again")}function Ot(){return y().replace(/-/g,"")}
|
|
9
|
-
/*!
|
|
10
|
-
* Name: @galacean/effects-specification
|
|
11
|
-
* Description: Galacean Effects JSON Specification
|
|
12
|
-
* Author: Ant Group CO., Ltd.
|
|
13
|
-
* Version: v1.0.1
|
|
14
|
-
*/!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(ft||(ft={})),function(t){t[t.ALPHA=0]="ALPHA",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.BRIGHTNESS=3]="BRIGHTNESS",t[t.SUBTRACTION=4]="SUBTRACTION",t[t.STRONG_LIGHT=5]="STRONG_LIGHT",t[t.WEAK_LIGHT=6]="WEAK_LIGHT",t[t.SUPERPOSITION=7]="SUPERPOSITION"}(pt||(pt={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(dt||(dt={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(mt||(mt={})),function(t){t[t.NONE=0]="NONE",t[t.SPHERE=1]="SPHERE",t[t.CONE=2]="CONE",t[t.HEMISPHERE=3]="HEMISPHERE",t[t.CIRCLE=4]="CIRCLE",t[t.DONUT=5]="DONUT",t[t.RECTANGLE=6]="RECTANGLE",t[t.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",t[t.EDGE=8]="EDGE",t[t.TEXTURE=9]="TEXTURE"}(yt||(yt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(vt||(vt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(gt||(gt={})),function(t){t[t.NONE=0]="NONE",t[t.NOTIFY=1]="NOTIFY",t[t.RESUME_PLAYER=2]="RESUME_PLAYER",t[t.REMOVE=3]="REMOVE",t[t.PAUSE=4]="PAUSE"}(xt||(xt={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.filter="8",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox"}(Tt||(Tt={})),function(t){t[t.BILLBOARD=0]="BILLBOARD",t[t.MESH=1]="MESH",t[t.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",t[t.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(Et||(Et={})),function(t){t[t.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",t[t.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",t[t.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",t[t.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",t[t.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",t[t.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",t[t.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",t[t.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",t[t.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(bt||(bt={}));var wt,Mt,Lt,It,Pt,Ft,Nt,Dt;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(wt||(wt={})),function(t){t[t.destroy=0]="destroy",t[t.pause=1]="pause",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.pause_destroy=3]="pause_destroy"}(Mt||(Mt={})),function(t){t[t.CONSTANT=0]="CONSTANT",t[t.CONSTANT_VEC2=1]="CONSTANT_VEC2",t[t.CONSTANT_VEC3=2]="CONSTANT_VEC3",t[t.CONSTANT_VEC4=3]="CONSTANT_VEC4",t[t.RANDOM=4]="RANDOM",t[t.LINE=5]="LINE",t[t.CURVE=6]="CURVE",t[t.BEZIER_PATH=7]="BEZIER_PATH",t[t.RGBA_COLOR=8]="RGBA_COLOR",t[t.GRADIENT_COLOR=9]="GRADIENT_COLOR",t[t.SHAPE_POINTS=10]="SHAPE_POINTS",t[t.SHAPE_SPLITS=11]="SHAPE_SPLITS",t[t.LINEAR_PATH=12]="LINEAR_PATH",t[t.COLORS=13]="COLORS",t[t.BINARY=20]="BINARY",t[t.BEZIER_CURVE=21]="BEZIER_CURVE",t[t.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH"}(Lt||(Lt={})),function(t){t[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"}(It||(It={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(Pt||(Pt={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(Ft||(Ft={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Nt||(Nt={})),function(t){t[t.RANDOM=0]="RANDOM",t[t.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",t[t.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",t[t.UNIFORM_BURST=3]="UNIFORM_BURST"}(Dt||(Dt={}));var Vt,zt,Ut,Bt,kt,Gt,Xt,Ht,jt;!function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Vt||(Vt={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(zt||(zt={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Ut||(Ut={})),function(t){t.none="none",t.uv="uv",t.normal="normal",t.basecolor="basecolor",t.alpha="alpha",t.metallic="metallic",t.roughness="roughness",t.ao="ao",t.emissive="emissive"}(Bt||(Bt={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(kt||(kt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Gt||(Gt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Xt||(Xt={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Ht||(Ht={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(jt||(jt={}));var Yt=Object.freeze({__proto__:null,get BezierKeyframeType(){return It},get BlendingMode(){return pt},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return wt},get CompositionEndBehavior(){return Mt},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 jt},get InteractBehavior(){return xt},get InteractType(){return gt},get ItemEndBehavior(){return Pt},get ItemType(){return Tt},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return mt},get MaterialBlending(){return Ut},get MaterialType(){return zt},get ModelBoundingType(){return Vt},get ParentItemEndBehavior(){return Ft},get ParticleInteractionBehavior(){return Nt},get ParticleOrigin(){return bt},get PluginType(){return vt},get RenderLevel(){return ft},get RenderMode(){return Et},get RenderMode3D(){return Bt},get ShapeArcMode(){return Dt},get ShapeType(){return yt},get SideMode(){return dt},get TextAlignment(){return Xt},get TextBaseline(){return Gt},get TextOverflow(){return kt},get TextWeight(){return Ht},get ValueType(){return Lt}}),Wt={},Zt={},qt={};function Kt(t){var e=t.constructor.name;if(qt[e])return qt[e];qt[e]={};for(var r=qt[e],i=t,n=e;n;){var o=Zt[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 Qt(t){return function(t,e){return function(r,i){var n=function(t){var e=t.constructor.name;return Zt[e]||(Zt[e]={}),Zt[e]}(r);n[i]||(n[i]={type:t,sourceName:e})}}(0,t)}function Jt(t){return function(e,r){Wt[t]&&console.warn("Class "+t+" 重复注册"),Wt[t]=e}}var $t,te=function(){function t(t){this.engine=t,this.guid=Ot(),this.taggedProperties={},this.engine.addInstance(this)}return t.prototype.getInstanceId=function(){return this.guid},t.prototype.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},t.prototype.toData=function(){},t.prototype.fromData=function(t){t.id&&this.setInstanceId(t.id)},t.prototype.dispose=function(){},n([Qt()],t.prototype,"guid",void 0),t}(),ee=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),Object.defineProperty(e.prototype,"transform",{get:function(){return this.item.transform},enumerable:!1,configurable:!0}),e.prototype.onAttached=function(){},e.prototype.onDestroy=function(){},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},e.prototype.dispose=function(){this.onDestroy(),this.item&&g(this.item.components,this)},e}(te),re=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._enabled=!0,e}return r(e,t),Object.defineProperty(e.prototype,"isActiveAndEnabled",{get:function(){return this.item.getVisible()&&this.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onBehaviourEnable()},enumerable:!1,configurable:!0}),e.prototype.onBehaviourEnable=function(){},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e)},e.prototype.toData=function(){t.prototype.toData.call(this)},n([Qt()],e.prototype,"_enabled",void 0),e}(ee),ie=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.started=!1,e}return r(e,t),e.prototype.onEnable=function(){},e.prototype.start=function(){},e.prototype.update=function(t){},e.prototype.lateUpdate=function(t){},e.prototype.onAttached=function(){this.item.itemBehaviours.push(this)},e.prototype.dispose=function(){this.item&&g(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},e.prototype.onBehaviourEnable=function(){this.onEnable(),this.started||(this.start(),this.started=!0)},e}(re),ne=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.started=!1,e.materials=[],e._enabled=!0,e}return r(e,t),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},set:function(t){this._priority=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onEnable()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isActiveAndEnabled",{get:function(){return this.item.getVisible()&&this.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t},enumerable:!1,configurable:!0}),e.prototype.onEnable=function(){},e.prototype.start=function(){},e.prototype.update=function(t){},e.prototype.lateUpdate=function(t){},e.prototype.render=function(t){},e.prototype.onAttached=function(){this.item.rendererComponents.push(this)},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e)},e.prototype.toData=function(){t.prototype.toData.call(this)},e.prototype.dispose=function(){this.item&&g(this.item.rendererComponents,this),t.prototype.dispose.call(this)},n([Qt()],e.prototype,"materials",void 0),n([Qt()],e.prototype,"_priority",void 0),n([Qt()],e.prototype,"_enabled",void 0),e}(ee);function oe(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 new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i}function ae(t){var e=this,r=t.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var i=t.createQuery(),n=function(){return o(e,void 0,void 0,(function(){return a(this,(function(e){return[2,new Promise((function(e,o){if(i){var a=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(r.GPU_DISJOINT_EXT);if(a&&!s){var u=t.getQueryParameter(i,t.QUERY_RESULT);e(u/1e3/1e3)}(a||s)&&(t.deleteQuery(i),i=null),null!==a&&i&&window.setTimeout((function(){n().then(e).catch}),1)}}))]}))}))};if(!i)return;return{begin:function(){i&&t.beginQuery(r.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(r.TIME_ELAPSED_EXT)},getTime:n}}}t.ShaderType=void 0,($t=t.ShaderType||(t.ShaderType={}))[$t.vertex=0]="vertex",$t[$t.fragment=1]="fragment";var se,ue=[],le={};function ce(){"function"==typeof WebGL2RenderingContext?fe(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(fe(WebGLRenderingContext),fe(WebGLRenderingContext.prototype)):ue.push("iOS16 lockdown mode, WebGL Constants not in global"),ue.length||"HALF_FLOAT"in le||(le.HALF_FLOAT=5131)}function he(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function fe(t){for(var e in t)/^[A-Z_]/.test(e)&&(le[e]=t[e])}function pe(t){switch(t){case pt.ALPHA:case pt.ADD:case pt.SUBTRACTION:case pt.STRONG_LIGHT:case pt.WEAK_LIGHT:return 1;case pt.SUPERPOSITION:return 2;case pt.BRIGHTNESS:return 3;case pt.MULTIPLY:return 0;default:return 1}}ue.length||ce();var de,me,ye=((se={})[t.ShaderType.vertex]={in:"attribute",out:"varying"},se[t.ShaderType.fragment]={in:"varying"},se);function ve(t,e,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),t&&(t.forEach((function(t){var e=u(t,2),r=e[0],i=e[1];!0===i?n.push("#define ".concat(r)):Number.isFinite(i)&&n.push("#define ".concat(r," ").concat(i))})),o=n.length?n.join("\n")+"\n":"");var a="WEBGL".concat(i),s=(o+="\n#ifndef ".concat(a,"\n#define ").concat(a,"\n#endif"))+"\n"+e,l=s.match(/#version\s+\b\d{3}\b\s*(es)?/),c=l?l[0]:"";if(c&&c.includes("300")){var h=new RegExp("".concat(c),"g");1===i&&(s=s.replace(/\b(in|out)\b/g,(function(t){var e;return null!==(e=ye[r][t])&&void 0!==e?e:t}))),s=s.replace(h,"\n")}return s}function ge(t,e){switch(e){case void 0:case pt.ALPHA:t.blendFunction=[le.ONE,le.ONE_MINUS_SRC_ALPHA,le.ONE,le.ONE_MINUS_SRC_ALPHA];break;case pt.ADD:t.blendFunction=[le.ONE,le.ONE,le.ONE,le.ONE];break;case pt.SUBTRACTION:t.blendFunction=[le.ONE,le.ONE,le.ZERO,le.ONE],t.blendEquation=[le.FUNC_REVERSE_SUBTRACT,le.FUNC_REVERSE_SUBTRACT];break;case pt.SUPERPOSITION:t.blendFunction=[le.ONE,le.ONE,le.ONE,le.ONE];break;case pt.MULTIPLY:t.blendFunction=[le.DST_COLOR,le.ONE_MINUS_SRC_ALPHA,le.DST_COLOR,le.ONE_MINUS_SRC_ALPHA];break;case pt.BRIGHTNESS:t.blendFunction=[le.ONE,le.ONE_MINUS_SRC_ALPHA,le.ONE,le.ONE_MINUS_SRC_ALPHA];break;case pt.STRONG_LIGHT:t.blendFunction=[le.DST_COLOR,le.DST_ALPHA,le.ZERO,le.ONE];break;case pt.WEAK_LIGHT:t.blendFunction=[le.DST_COLOR,le.ZERO,le.ZERO,le.ONE];break;default:console.warn("blendMode ".concat(e," not in specification, please set blend params separately"))}}function xe(t,e){e===dt.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=le.CW,t.cullFace=e===dt.BACK?le.BACK:le.FRONT)}function Te(t,e){switch(e){case void 0:t.stencilTest=!1;break;case mt.MASK:t.stencilTest=!0,t.stencilFunc=[le.ALWAYS,le.ALWAYS],t.stencilOpZPass=[le.REPLACE,le.REPLACE];break;case mt.OBSCURED:t.stencilTest=!0,t.stencilFunc=[le.EQUAL,le.EQUAL];break;case mt.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[le.NOTEQUAL,le.NOTEQUAL];break;case mt.NONE:t.stencilTest=!1;break;default:console.warn("maskMode ".concat(e," not in specification, please set stencil params seperately"))}}t.TextureLoadAction=void 0,(de=t.TextureLoadAction||(t.TextureLoadAction={}))[de.whatever=0]="whatever",de[de.clear=2]="clear",t.TextureSourceType=void 0,(me=t.TextureSourceType||(t.TextureSourceType={}))[me.none=0]="none",me[me.data=1]="data",me[me.image=2]="image",me[me.compressed=3]="compressed",me[me.video=4]="video",me[me.canvas=5]="canvas",me[me.framebuffer=6]="framebuffer",me[me.mipmaps=7]="mipmaps";var Ee=function(){function t(){this.callbacks={}}return t.prototype.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},t.prototype.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},t.prototype.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},t.prototype.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()}},t.prototype.start=function(t,e,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},t.prototype.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}(),be=!1;function Ce(t,e){return o(this,void 0,void 0,(function(){return a(this,(function(r){switch(r.label){case 0:return!be&&e?[3,2]:[4,_e(t)];case 1:case 5:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,_e(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),be=!0,[4,_e(t)];case 6:return[2]}}))}))}function _e(t){return o(this,void 0,void 0,(function(){var e,r;return a(this,(function(i){if(e="",t instanceof HTMLImageElement){if(t.complete)return[2,t];e=t.src}else t instanceof Blob?(e=URL.createObjectURL(t),r=!0):"string"==typeof t&&(e=t);if(!e)throw new Error("Invalid url type: ".concat(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: ".concat(e,", reason: ").concat(JSON.stringify(t)))},n.src=e}))]}))}))}function Ae(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){return[2,new Promise((function(e,r){(new Ee).downloadBinary(t,e,(function(e,i){r("Couldn't load bins ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))}function Se(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var r;return a(this,(function(i){return r=document.createElement("video"),"string"==typeof t?r.src=t:r.srcObject=t,r.crossOrigin="anonymous",r.muted=!0,e.loop&&r.addEventListener("ended",(function(){return r.play()})),S()&&r.setAttribute("renderer","standard"),r.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var i=r.play();i?i.then((function(){return t(r)})):r.addEventListener("loadeddata",(function e(){t(r),r.removeEventListener("loadeddata",e)}),!0),r.addEventListener("error",(function(t){e(t)}))}))]}))}))}function Re(e,r,n){return void 0===n&&(n=[]),o(this,void 0,void 0,(function(){var o,s,u,l,c,h,f;return a(this,(function(a){switch(a.label){case 0:return 34067!==e.target?[3,2]:(u=(o=e).mipmaps,l=o.target,c=u.map((function(t){return Promise.all(t.map((function(t){return Oe(t,r)})))})),[4,Promise.all(c)]);case 1:return h=a.sent(),f=n[u[0][0][1][0]].url,[2,i(i({keepImageSource:!1},e),{mipmaps:h,sourceFrom:{target:l,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:u.map((function(t){return t.map((function(t){return[t[1][1],t[1][2]]}))}))}})];case 2:return u=(s=e).mipmaps,l=s.target,c=u.map((function(t){return Oe(t,r)})),[4,Promise.all(c)];case 3:return h=a.sent(),f=n[u[0][1][0]].url,[2,i(i({keepImageSource:!1},e),{mipmaps:h,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:l,bin:f,type:t.TextureSourceType.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})]}}))}))}function Oe(t,e){return o(this,void 0,void 0,(function(){var r,i,n,o,s;return a(this,(function(a){if(r=u(t[1],3),i=r[0],n=r[1],o=r[2],!(s=e[i]))throw new Error("invalid bin pointer: ".concat(JSON.stringify(t)));return[2,_e(new Blob([new Uint8Array(s,n,o)]))]}))}))}var we=1,Me=function(e){function n(t){var r=e.call(this,t)||this;return r.destroyed=!1,r.id="Tex"+we++,r}return r(n,e),Object.defineProperty(n.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),n.prototype.getWidth=function(){return this.width||0},n.prototype.getHeight=function(){return this.height||0},n.prototype.uploadCurrentVideoFrame=function(){},n.prototype.offloadData=function(){},n.prototype.reloadData=function(){},n.prototype.initialize=function(){},n.prototype.assembleOptions=function(e){var r=e.target,n=void 0===r?le.TEXTURE_2D:r,o=e.format,a=void 0===o?le.RGBA:o;return e.sourceType||(e.sourceType="image"in e?t.TextureSourceType.image:"data"in e?t.TextureSourceType.data:"video"in e?t.TextureSourceType.video:0),i({minFilter:le.NEAREST,magFilter:le.NEAREST,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE,target:n,format:le.RGBA,internalFormat:a,type:le.UNSIGNED_BYTE},e)},n}(te);function Le(t,e,r,i){var n,o,a=e.length/r/i;return o=n=4===a||0===a?le.RGBA:3===a?le.RGB:2===a?le.LUMINANCE_ALPHA:le.LUMINANCE,Me.createWithData(t,{data:e,width:r,height:i},{type:le.HALF_FLOAT,format:n,internalFormat:o,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE})}var Ie=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);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?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:lt.warn("Number of faces expected"+e+", but found "+this.numberOfFaces):lt.warn("Texture arrays not currently supported"):lt.warn("Only 2D textures currently supported")}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,r+=3-(s+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function Pe(e){var r=new Ie(e,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,l=r.glFormat,c=i>=Math.floor(Math.log2(Math.max(n,o))+1);return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?le.TEXTURE_CUBE_MAP:le.TEXTURE_2D,internalFormat:u,format:l,mipmaps:r.mipmaps(c)}}var Fe,Ne=function(){function e(){this.reloadPending={}}return e.prototype.reload=function(t){return o(this,void 0,void 0,(function(){var e,r;return a(this,(function(i){switch(i.label){case 0:return e=t.id,this.reloadPending[e]?[2]:t.sourceFrom?(this.reloadPending[e]=!0,[4,this.loadSource(t.sourceFrom)]):[3,2];case 1:return r=i.sent(),t.updateSource(r),this.reloadPending[e]=!1,[3,3];case 2:throw new Error("No source from");case 3:return[2]}}))}))},e.prototype.canOffloadTexture=function(e){if(e){var r=e.type;if(r===t.TextureSourceType.compressed||r===t.TextureSourceType.image){var i=e,n=i.target,o=i.map,a=e.url;return n===le.TEXTURE_CUBE_MAP?"object"==typeof o&&!!o:ht(a)&&a.length>0}if(r===t.TextureSourceType.mipmaps){var s=e,u=s.bin,l=s.mipmaps,c=e,h=(n=c.target,c.maps),f=e.urls;return u?l.length>0:n===le.TEXTURE_CUBE_MAP?h.every((function(t){return"object"==typeof t&&t})):f.every((function(t){return ht(t)&&t.length>0}))}}return!1},e.prototype.loadSource=function(e,r){return o(this,void 0,void 0,(function(){var n,o,s,u,l,c,h,f,p,d,m,y,v,g,x,T,E,b=this;return a(this,(function(a){switch(a.label){case 0:return n=e.type,o=e.target,s=e.map,u=e.url,c=(l=e).bin,h=l.mipmaps,f=e.urls,p=e.maps,o!==le.TEXTURE_CUBE_MAP||n===t.TextureSourceType.mipmaps?[3,2]:[4,this.loadCubeMap(s)];case 1:return d=a.sent(),[2,i(i({},r),{cube:d,target:le.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:i({},s),target:le.TEXTURE_CUBE_MAP}})];case 2:return n!==t.TextureSourceType.image?[3,4]:[4,_e(u)];case 3:return m=a.sent(),[2,i(i({},r),{image:m,sourceType:t.TextureSourceType.image,sourceFrom:{type:n,url:u,target:le.TEXTURE_2D}})];case 4:return n!==t.TextureSourceType.video?[3,6]:[4,Se(u)];case 5:return y=a.sent(),[2,i(i({},r),{video:y,sourceType:t.TextureSourceType.video})];case 6:return n!==t.TextureSourceType.compressed?[3,8]:[4,Ae(u)];case 7:return v=a.sent(),[2,i(i(i({},Pe(v)),r),{sourceFrom:{url:u,type:t.TextureSourceType.compressed}})];case 8:return n!==t.TextureSourceType.mipmaps?[3,17]:c?[4,Ae(c)]:[3,13];case 9:return g=a.sent(),x=null!=o?o:le.TEXTURE_2D,T=x===le.TEXTURE_2D?h.slice():h.map((function(t){return t.slice()})),E=void 0,o!==le.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(h.map((function(t){return b.loadMipmapImages(t,g)})))];case 10:return E=a.sent(),[3,12];case 11:E=this.loadMipmapImages(h,g),a.label=12;case 12:return[2,i(i({},r),{mipmaps:E,target:x,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:c,mipmaps:T,target:x,type:t.TextureSourceType.mipmaps}})];case 13:return o!==le.TEXTURE_2D&&o?[3,15]:[4,Promise.all(f.map((function(t){return _e(t)})))];case 14:return E=a.sent(),[2,i(i({},r),{mipmaps:E,target:le.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,urls:f.slice(),target:le.TEXTURE_2D}})];case 15:return o!==le.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(p.map((function(t){return b.loadCubeMap(t)})))];case 16:return E=a.sent(),[2,i(i({},r),{mipmaps:E,target:le.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:n,maps:p.map((function(t){return i({},t)})),target:le.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: ".concat(n))}}))}))},e.prototype.loadMipmapImages=function(t,e){return o(this,void 0,void 0,(function(){return a(this,(function(r){return[2,Promise.all(t.map((function(t){return _e(new Blob([new Uint8Array(e,t[0],t[1])]))})))]}))}))},e.prototype.loadCubeMap=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){return[2,Promise.all(t.map((function(t){return _e(t)})))]}))}))},e}();function De(){return Fe||(Fe=new Ne),Fe}var Ve,ze=function(){function t(t){this.destroyed=!1;var e=t.name,r=void 0===e?"defaultDataBlock":e;this.name=r}return t.prototype.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(r){e.setUniformValue(r,t[r])}))},t.prototype.invalidAllFlags=function(){},t.prototype.updateUniformSubData=function(t,e,r){},t}();function Ue(t){return"object"==typeof t&&t&&void 0===t.length&&t instanceof Me}t.MaterialRenderType=void 0,(Ve=t.MaterialRenderType||(t.MaterialRenderType={}))[Ve.normal=0]="normal",Ve[Ve.transformFeedback=1]="transformFeedback";var Be,ke,Ge=1,Xe=function(e){function n(r,n){var o=e.call(this,r)||this;if(o.destroyed=!1,o.initialized=!1,n){var a=n.name,s=void 0===a?"Material"+Ge++:a,u=n.renderType,l=void 0===u?t.MaterialRenderType.normal:u,c=n.shader,h=n.uniformSemantics;o.name=s,o.renderType=l,o.shaderSource=c,o.props=n,o.uniformSemantics=i({},h)}else o.name="Material"+Ge++,o.renderType=t.MaterialRenderType.normal;return o}return r(n,e),Object.defineProperty(n.prototype,"blending",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendFunction",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendEquation",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilRef",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpZPass",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"culling",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"frontFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cullFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendColor",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthRange",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"polygonOffsetFill",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"polygonOffset",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sampleAlphaToCoverage",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"colorMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpFail",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpZFail",{set:function(t){},enumerable:!1,configurable:!0}),n.prototype.initialize=function(){},n.prototype.use=function(t,e){},n}(te),He="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,(Be=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[Be.noShader=0]="noShader",Be[Be.success=1]="success",Be[Be.fail=2]="fail",Be[Be.compiling=3]="compiling",t.GLSLVersion=void 0,(ke=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",ke.GLSL3="300 es";var je=function(t){function e(e,r){var i=t.call(this,e)||this;return i.source=r,i}return r(e,t),e}(te),Ye="effects-internal-copy",We="effects-internal-copy-mesh",Ze="\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}",qe="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".concat(He,"\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 Ke(e,r){var i=2===e,n=i?"#version 300 es":"";return{name:Ye,vertex:ve([],n+"\n"+Ze,t.ShaderType.vertex,e),fragment:ve([],n+"\n"+qe,t.ShaderType.fragment,e),glslVersion:i?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:We+ +r}}var Qe,Je={format:le.RGBA,type:le.UNSIGNED_BYTE,minFilter:le.LINEAR,magFilter:le.LINEAR,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE},$e=Symbol("dispose"),tr=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}return e.prototype.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(Je).forEach((function(t){var r,i=null!==(r=e[t])&&void 0!==r?r:Je[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;F(c),l=Me.create(c,a),this.textureCache[u]=l,this.textureRef[u]=1,l[$e]=l.dispose,l.dispose=function(){return r.removeTexture(u)}}return l},e.prototype.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[$e](),r.dispose=r[$e]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.prototype.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var r=t.textureCache[e];r[$e](),r.dispose=r[$e]})),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),er=function(){function t(t){void 0===t&&(t={}),this.semantics=i({},t)}return t.prototype.toObject=function(){return i({},this.semantics)},t.prototype.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},t.prototype.getSemanticValue=function(t,e){var r=this.semantics[t];return _t(r)?r(e):r},t.prototype.hasSemanticValue=function(t){return t in this.semantics},t.prototype.dispose=function(){var t=this;Object.keys(this.semantics).forEach((function(e){delete t.semantics[e]}))},t}(),rr=((Qe={})[le.FLOAT]=Float32Array.BYTES_PER_ELEMENT,Qe[le.INT]=Int32Array.BYTES_PER_ELEMENT,Qe[le.SHORT]=Int16Array.BYTES_PER_ELEMENT,Qe[le.BYTE]=Int8Array.BYTES_PER_ELEMENT,Qe),ir=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.initialize=function(){},e.prototype.flush=function(){},e}(te);function nr(t){return t===le.INT?new Int32Array(0):t===le.SHORT?new Int16Array(0):new Float32Array(0)}var or,ar,sr=1,ur=function(e){function i(t,r){var i=e.call(this,t)||this;if(i.destroyed=!1,i.visible=!0,r){var n=r.material,o=r.geometry,a=r.name,s=void 0===a?"<unnamed>":a,u=r.priority,l=void 0===u?0:u,c=r.worldMatrix,h=void 0===c?Z.fromIdentity():c;i.id="Mesh"+sr++,i.name=s,i.geometry=o,i.material=n,i.priority=l,i.worldMatrix=h}else i.id="Mesh"+sr++,i.name="<unnamed>",i.worldMatrix=Z.fromIdentity(),i._priority=0;return i}return r(i,e),Object.defineProperty(i.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),i.prototype.setVisible=function(t){this.visible=t},i.prototype.getVisible=function(){return this.visible},i.prototype.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.prototype.firstGeometry=function(){return this.geometry},i.prototype.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},i.prototype.restore=function(){},i.prototype.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)}},i}(ne),lr=1e3;t.RenderPassAttachmentStorageType=void 0,(or=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[or.none=0]="none",or[or.color=1]="color",or[or.stencil_8_opaque=2]="stencil_8_opaque",or[or.depth_16_opaque=3]="depth_16_opaque",or[or.depth_stencil_opaque=4]="depth_stencil_opaque",or[or.depth_16_texture=5]="depth_16_texture",or[or.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(ar=t.TextureStoreAction||(t.TextureStoreAction={}))[ar.store=0]="store",ar[ar.clear=2]="clear";var cr,hr=function(){function e(e,r){if(this.destroyed=!1,r){var n=r.texture,o=r.size;if(n instanceof Me)this.texture=n,this.externalTexture=!0;else if(n){var a=n.wrapT,s=n.wrapS,u=n.minFilter,l=n.magFilter,c=n.internalFormat,h=n.format,f=void 0===h?le.RGBA:h,p=n.type,d=void 0===p?le.UNSIGNED_BYTE:p;this.externalTexture=!1,this.textureOptions={size:o,format:f,type:d,internalFormat:c||f,wrapT:a,wrapS:s,minFilter:u,magFilter:l,name:r.name},this.texture=Me.create(e,i(i({},this.textureOptions),{sourceType:t.TextureSourceType.framebuffer,data:{width:o[0],height:o[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"storageType",{get:function(){return t.RenderPassAttachmentStorageType.color},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.texture.getWidth()||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.texture.getHeight()||0},enumerable:!1,configurable:!0}),e}();t.RenderPassDestroyAttachmentType=void 0,(cr=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[cr.force=0]="force",cr[cr.keep=1]="keep",cr[cr.keepExternal=2]="keepExternal",cr[cr.destroy=0]="destroy";var fr=1,pr=function(){function e(e,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var n=r.name,o=void 0===n?"RenderPass_"+fr++:n,a=r.clearAction,s=r.semantics,u=r.depthStencilAttachment,l=r.storeAction,c=r.priority,h=void 0===c?0:c,f=r.meshOrder,p=void 0===f?t.OrderType.ascending:f,d=r.meshes,m=void 0===d?[]:d,y=r.delegate,v=void 0===y?{}:y;this.name=o,this.renderer=e,this.priority=h,this.meshOrder=p,this.meshes=M(m.slice(),this.meshOrder),this.depthStencilType=(null==u?void 0:u.storageType)||t.RenderPassAttachmentStorageType.none,this.clearAction=i({},a),this.storeAction=i({colorAction:t.TextureStoreAction.store,depthAction:t.TextureStoreAction.store,stencilAction:t.TextureStoreAction.store},l),this.semantics=new er(s),this.options=r,this.delegate=v,this.setViewportOptions(r)}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewport",{get:function(){return this.getViewport()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilAttachment",{get:function(){return this.getStencilAttachment()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthAttachment",{get:function(){return this.getDepthAttachment()},enumerable:!1,configurable:!0}),e.prototype.addMesh=function(t){L(this.meshes,t,this.meshOrder)},e.prototype.removeMesh=function(t){g(this.meshes,t)},e.prototype.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,l([0,0],u(t),!1)),M(this.meshes,this.meshOrder),this.meshes},e.prototype.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.prototype.configure=function(t){if(this.frameBuffer)t.setFrameBuffer(this.frameBuffer);else{var e=u(this.getViewport(),4),r=e[0],i=e[1],n=e[2],o=e[3];t.setViewport(r,i,n,o)}},e.prototype.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.prototype.frameCleanup=function(t){},e.prototype.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 hr(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}}))})},e.prototype.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.prototype.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)},e.prototype._resetAttachments=function(){var e,r,n=this,o=this.renderer,a=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null===(e=this.frameBuffer)||void 0===e||e.dispose({depthStencilAttachment:t.RenderPassDestroyAttachmentType.keepExternal}),this.frameBuffer=null);var s=this.viewportScale,u=this.isCustomViewport?this.customViewport:[0,0,o.getWidth()*s,o.getHeight()*s],l=[u[2],u[3]],c=this.name;if(null===(r=a.attachments)||void 0===r?void 0:r.length){var h=a.attachments.map((function(t,e){var r;return new hr(n.renderer.engine,i({size:l,name:(null===(r=t.texture)||void 0===r?void 0:r.name)||"".concat(c,"##color_").concat(e)},t))}));this.attachments=h;var f=Yr.create({storeAction:this.storeAction,name:c,viewport:u,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:a.depthStencilAttachment||{storageType:t.RenderPassAttachmentStorageType.none}},o);f.bind(),f.unbind(),this.frameBuffer=f}else this.attachments.length=0},e.prototype.getViewport=function(){var t,e=(null===(t=this.frameBuffer)||void 0===t?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]},e.prototype.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}},e.prototype.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}},e.prototype.getDepthTexture=function(t,e){var r;if(!this.depthTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.prototype.getStencilTexture=function(t,e){var r;if(!this.stencilTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.prototype.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.prototype.dispose=function(e){var r,i;if(!this.destroyed){var 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:t.RenderPassDestroyAttachmentType.force;this.attachments.forEach((function(e){e.externalTexture&&o===t.RenderPassDestroyAttachmentType.keepExternal||o===t.RenderPassDestroyAttachmentType.keep||e.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:t.RenderPassDestroyAttachmentType.force,s=this.frameBuffer;if(s)s.dispose({depthStencilAttachment:a}),s.externalStorage&&a===t.RenderPassDestroyAttachmentType.keepExternal||a===t.RenderPassDestroyAttachmentType.keep||(null===(r=this.stencilTexture)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose());this.options=this.renderer=null,this.initialize=Rt}},e}(),dr="#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);}",mr="precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;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.xyz,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}",yr="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;}",vr="#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",gr="#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}}",xr="#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}",Tr="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",Er="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;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));}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;}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);}",br="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);}",Cr="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);}",_r="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);}",Ar="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);}",Sr=function(e){function i(r,i){var n=e.call(this,r,i)||this,o=n.renderer.engine,a=ir.create(o,{mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=Xe.create(o,{shader:{vertex:Tr,fragment:Ar,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=ur.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}return r(i,e),i.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFrameBuffer(this.frameBuffer)},i.prototype.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])},i}(pr),Rr=function(e){function i(r,i,n){var o=e.call(this,r,n)||this;o.type=i;var a=o.renderer.engine,s="PostProcess",u=ir.create(a,{name:s,mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),l={vertex:Tr,fragment:"H"==i?br:Cr,glslVersion:t.GLSLVersion.GLSL1},c=Xe.create(a,{name:s,shader:l});return c.blending=!1,c.depthTest=!1,c.culling=!1,o.screenMesh=ur.create(a,{name:s,geometry:u,material:c,priority:0}),o.priority=5e3,o}return r(i,e),i.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},i.prototype.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",Fr(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFrameBuffer().getColorTextures()[0])},i}(pr),Or=function(e){function i(t,r){var i=e.call(this,t,r)||this,n="PostProcess",o=i.renderer.engine,a=ir.create(o,{name:n,mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s={vertex:Tr,fragment:_r},u=Xe.create(o,{name:n,shader:s});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=ur.create(o,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}return r(i,e),i.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},i.prototype.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",Fr(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(pr),wr=function(e){function i(r,i){var n=e.call(this,r,{})||this,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new hr(a);var s=ir.create(a,{name:o,mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=Xe.create(a,{name:o,shader:{vertex:Tr,fragment:Er,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=ur.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}return r(i,e),i.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFrameBuffer(null)},i.prototype.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.bloomIntensity,n=r.brightness,o=r.saturation,a=r.contrast,s=r.useBloom,u=r.useToneMapping;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",n),this.screenMesh.material.setFloat("_Saturation",o),this.screenMesh.material.setFloat("_Contrast",a),this.screenMesh.material.setInt("_UseBloom",s),s&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i)),this.screenMesh.material.setInt("_UseToneMapping",u),e.renderMeshes([this.screenMesh])},i}(pr),Mr={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},Lr="_effects_default_",Ir=1,Pr=function(){function e(e){var r;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var n=e.camera,o=e.keepColorBuffer,a=e.renderer,s=e.editorTransform,u=void 0===s?[1,1,0,0]:s,l=e.globalVolume,c=e.clearAction,h=void 0===c?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:c,f=a.engine;l&&(this.globalVolume=i(i({},Mr),l)),this.globalUniforms=new Dr;var p,d=[],m={};if(this.renderer=a,this.globalVolume){var y=this.globalVolume.useHDR?le.HALF_FLOAT:le.UNSIGNED_BYTE;d=[{texture:{format:le.RGBA,type:y,magFilter:le.LINEAR,minFilter:le.LINEAR}}],p={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var v=[new pr(a,{name:Lr,priority:lr,meshOrder:t.OrderType.ascending,depthStencilAttachment:p,attachments:d,clearAction:m})];if(this.setRenderPasses(v),this.globalVolume){var g=this.globalVolume.useBloom,x=new hr(f);if(g){var T=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],E=new Array(7),b=(y=this.globalVolume.useHDR?le.HALF_FLOAT:le.UNSIGNED_BYTE,new Sr(a,{name:"BloomThresholdPass",attachments:[{texture:{format:le.RGBA,type:y,minFilter:le.LINEAR,magFilter:le.LINEAR}}]}));b.sceneTextureHandle=x,this.addRenderPass(b);for(var C=0;C<7;C++){E[C]=new hr(f);var _=new Rr(a,"H",{name:"GaussianDownPassH"+C,viewport:T,attachments:[{texture:{format:le.RGBA,type:y,minFilter:le.LINEAR,magFilter:le.LINEAR}}]}),A=new Rr(a,"V",{name:"GaussianDownPassV"+C,viewport:T,attachments:[{texture:{format:le.RGBA,type:y,minFilter:le.LINEAR,magFilter:le.LINEAR}}]});A.gaussianResult=E[C],this.addRenderPass(_),this.addRenderPass(A),T[2]/=2,T[3]/=2}T[2]*=4,T[3]*=4;for(C=0;C<6;C++){var S=new Or(a,{name:"GaussianUpPass"+C,viewport:T,attachments:[{texture:{format:le.RGBA,type:y,minFilter:le.LINEAR,magFilter:le.LINEAR}}]});S.gaussianDownSampleResult=E[5-C],this.addRenderPass(S),T[2]*=2,T[3]*=2}}var R=void 0;R=g?new wr(a,x):new wr(a),this.addRenderPass(R)}this.semantics=new er(e.semantics),this.clearAction=h,this.name="RenderFrame".concat(Ir++);var O=v[0],w={type:le.UNSIGNED_BYTE,format:le.RGBA,internalFormat:le.RGBA,wrapS:le.MIRRORED_REPEAT,wrapT:le.MIRRORED_REPEAT,minFilter:le.NEAREST,magFilter:le.NEAREST};this.emptyTexture=Me.create(f,i({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},w)),this.transparentTexture=Me.create(f,i({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},w)),this.camera=n,this.keepColorBuffer=o,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=K.fromArray(u),e.clearAction||this.resetClearActions(),this.passTextureCache=new tr(f);var M=f.gpuCapability,L=M.detail,I=Ke(M.level,L.readableDepthStencilTextures&&L.writableFragDepth);null===(r=this.renderer.getShaderLibrary())||void 0===r||r.addShader(I)}return Object.defineProperty(e.prototype,"renderPasses",{get:function(){return this._renderPasses.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},e.prototype.removeMeshFromDefaultRenderPass=function(t){},e.prototype.dispose=function(e){var r,i;(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var 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=null===(r=this.resource.depthStencil)||void 0===r?void 0:r.texture)||void 0===i||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},e.prototype.resetRenderPassDefaultAttachment=function(t,e){for(var r,i,n,o=this.resource,a=o.color_a,s=o.color_b,u=e;u<t.length;u++){var l=t[u],c=null===(r=l.attachments[0])||void 0===r?void 0:r.texture;if(c&&n===c){var h=c===a?s:a;l.resetColorAttachments([h])}(c=null===(i=l.attachments[0])||void 0===i?void 0:i.texture)&&(n=c)}},e.prototype.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(Lr)||!r.meshes.includes(t)||(e=i,!1)})),e},e.prototype.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)},e.prototype.getRPAttachments=function(t,e){var r;if(1===(null==t?void 0:t.length)){var i=t[0],n=i.texture,o=i.persistent,a=n.format,s=null!==(r=null==e?void 0:e.getInitAttachments())&&void 0!==r?r:[];if(a===le.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},e.prototype.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)},e.prototype.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.prototype.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.prototype.createResource=function(){var e,r=this.renderer.engine;if(!this.resource){var i=r.gpuCapability,n=i.detail,o=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?le.LINEAR:le.NEAREST,l=Me.create(r,{sourceType:t.TextureSourceType.framebuffer,format:le.RGBA,name:"frame_a",minFilter:u,magFilter:u}),c=Me.create(r,{sourceType:t.TextureSourceType.framebuffer,format:le.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 pr(this.renderer,{depthStencilAttachment:{storageType:h},attachments:[{texture:l}]}).initialize(this.renderer),p=new Nr(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===(e=f.getDepthAttachment())||void 0===e?void 0:e.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:c,finalCopyRP:p,depthStencil:f.depthAttachment,resRP:f}}},e.prototype.createCopyMesh=function(t){var e=Ye,r=this.renderer.engine,i=ir.create(r,{name:e,mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=Ke(r.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=Xe.create(r,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:e,shader:n});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==t?void 0:t.blend)&&(o.blending=!0,o.blendFunction=[le.SRC_ALPHA,le.ONE_MINUS_SRC_ALPHA,le.SRC_ALPHA,le.ONE_MINUS_SRC_ALPHA]),ur.create(r,{name:e,geometry:i,material:o,priority:0})},e.prototype.removeRenderPass=function(t){g(this._renderPasses,t)},e}();function Fr(t){return t?new X(t.getWidth(),t.getHeight()):new X}var Nr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(null)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Fr(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(pr),Dr=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},Vr=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 Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t}(),zr="function"==typeof WebGL2RenderingContext,Ur=function(){function t(t){this.setupCapability(t)}return t.prototype.setupCapability=function(t){var e,r=zr&&t instanceof 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=Br(t,t.HALF_FLOAT)),i&&!s&&(s=Br(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?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:Hr(t),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)},t.prototype.framebufferTexture2D=function(t,e,r,i,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&r>0)throw new Error("draw multiple color buffers not available");var a=o?o["COLOR_ATTACHMENT".concat(r,"_WEBGL")]:t["COLOR_ATTACHMENT".concat(r)];a?t.framebufferTexture2D(e,a,i,n,0):console.error("invalid color attachment index: "+r)},t.prototype.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1!==this.level||r){var i=e.map((function(e,i){return e?r?r["COLOR_ATTACHMENT".concat(i,"_WEBGL")]:t["COLOR_ATTACHMENT".concat(i)]:t.NONE}));r?r.drawBuffersWEBGL(i):t.drawBuffers(i)}else if(e.length>1)throw Error("draw buffers not available")},t.prototype.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function Br(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 kr,Gr,Xr={NONE:0,PVRTC:1,ASTC:2};function Hr(t){return t.getExtension("WEBGL_compressed_texture_astc")?Xr.ASTC:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?Xr.PVRTC:Xr.NONE}t.FilterMode=void 0,(kr=t.FilterMode||(t.FilterMode={}))[kr.Nearest=0]="Nearest",kr[kr.Linear=1]="Linear",t.RenderTextureFormat=void 0,(Gr=t.RenderTextureFormat||(t.RenderTextureFormat={}))[Gr.RGBA32=0]="RGBA32",Gr[Gr.RGBAHalf=1]="RGBAHalf";var jr,Yr=function(){function t(){}return t.prototype.resize=function(t,e,r,i){},t.prototype.resetColorTextures=function(t){},t.prototype.unbind=function(){},t.prototype.bind=function(){},Object.defineProperty(t.prototype,"stencilStorage",{get:function(){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthStorage",{get:function(){},enumerable:!1,configurable:!0}),t.prototype.getDepthTexture=function(){},t.prototype.getStencilTexture=function(){},t.prototype.getColorTextures=function(){return[]},t.prototype.dispose=function(t){},t}(),Wr=function(){function t(){}return t.prototype.setGlobalFloat=function(t,e){},t.prototype.setGlobalInt=function(t,e){},t.prototype.setGlobalMatrix=function(t,e){},t.prototype.getFrameBuffer=function(){return null},t.prototype.setFrameBuffer=function(t){},t.prototype.setViewport=function(t,e,r,i){},t.prototype.resize=function(t,e){},t.prototype.clear=function(t){},t.prototype.getWidth=function(){return 0},t.prototype.getHeight=function(){return 0},t.prototype.addLostHandler=function(t){},t.prototype.addRestoreHandler=function(t){},t.prototype.lost=function(t){},t.prototype.restore=function(){},t.prototype.getShaderLibrary=function(){},t.prototype.renderRenderFrame=function(t){},t.prototype.renderMeshes=function(t){},t.prototype.drawGeometry=function(t,e){},t.prototype.getTemporaryRT=function(t,e,r,i,n,o){return null},t.prototype.dispose=function(t){},t}(),Zr=function(){function t(){}return t.collectSerializableObject=function(t,e){var r,i,n,o,a,u;if(!e[t.getInstanceId()]){t.toData(),e[t.getInstanceId()]=t;var l=Kt(t);try{for(var c=s(Object.keys(l)),h=c.next();!h.done;h=c.next()){var f=h.value,p=t.taggedProperties[f];if(void 0===p&&(p=t[f]),p instanceof te)this.collectSerializableObject(p,e);else if(p instanceof Array)try{for(var d=(n=void 0,s(p)),m=d.next();!m.done;m=d.next()){var y=m.value;y instanceof te&&this.collectSerializableObject(y,e)}}catch(t){n={error:t}}finally{try{m&&!m.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}else if(p instanceof Object)try{for(var v=(a=void 0,s(Object.keys(p))),g=v.next();!g.done;g=v.next()){var x=p[g.value];x instanceof te&&this.collectSerializableObject(x,e)}}catch(t){a={error:t}}finally{try{g&&!g.done&&(u=v.return)&&u.call(v)}finally{if(a)throw a.error}}}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}},t.serializeEffectObject=function(e){var r,n,o={},a=e.engine,u=i({},a.jsonSceneData);t.collectSerializableObject(e,o);try{for(var l=s(Object.keys(o)),c=l.next();!c.done;c=l.next()){var h=o[c.value];u[h.getInstanceId()]||(u[h.getInstanceId()]={}),t.serializeTaggedProperties(h,u[h.getInstanceId()])}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}return u},t.serializeTaggedProperties=function(e,r){var i,n,o,a;e.toData(),r||(r={});var u=Kt(e);try{for(var l=s(Object.keys(u)),c=l.next();!c.done;c=l.next()){"number"==typeof(p=e[d=c.value])||"string"==typeof p||"boolean"==typeof p||t.checkTypedArray(p)?r[d]=p:p instanceof Array?(r[d]||(r[d]=[]),t.serializeArrayProperty(p,r[d],0)):p instanceof te?r[d]={id:p.getInstanceId()}:p instanceof Object&&(r[d]||(r[d]={}),t.serializeObjectProperty(p,r[d],0))}}catch(t){i={error:t}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(i)throw i.error}}try{for(var h=s(Object.keys(e.taggedProperties)),f=h.next();!f.done;f=h.next()){var p,d=f.value;"number"==typeof(p=e.taggedProperties[d])||"string"==typeof p||"boolean"==typeof p||t.checkTypedArray(p)?r[d]=p:p instanceof Array?(r[d]||(r[d]=[]),t.serializeArrayProperty(p,r[d],0)):p instanceof te?r[d]={id:p.getInstanceId()}:p instanceof Object&&(r[d]||(r[d]={}),t.serializeObjectProperty(p,r[d],0))}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=h.return)&&a.call(h)}finally{if(o)throw o.error}}return r},t.deserializeTaggedProperties=function(e,r){var i,n,o,a,u=r.taggedProperties,l=Kt(r),c=r.engine;try{for(var h=s(Object.keys(e)),f=h.next();!f.done;f=h.next()){if(!l[y=f.value]){var p=e[y];u[y]=t.deserializeProperty(p,c,0)}}}catch(t){i={error:t}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}try{for(var d=s(Object.keys(l)),m=d.next();!m.done;m=d.next()){var y;void 0!==(p=e[y=m.value])&&(r[y]=t.deserializeProperty(p,c,0))}}catch(t){o={error:t}}finally{try{m&&!m.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}r.fromData(u)},t.deserializeTaggedPropertiesAsync=function(e,r){return o(this,void 0,void 0,(function(){var i,n,o,u,l,c,h,f,p,d,m,y,v,g,x,T,E,b,C;return a(this,(function(a){switch(a.label){case 0:i=r.taggedProperties,n=Kt(r),o=r.engine,a.label=1;case 1:a.trys.push([1,6,7,8]),u=s(Object.keys(e)),l=u.next(),a.label=2;case 2:return l.done?[3,5]:(m=l.value,n[m]?[3,4]:(y=e[m],c=i,h=m,[4,t.deserializePropertyAsync(y,o,0)]));case 3:c[h]=a.sent(),a.label=4;case 4:return l=u.next(),[3,2];case 5:return[3,8];case 6:return f=a.sent(),T={error:f},[3,8];case 7:try{l&&!l.done&&(E=u.return)&&E.call(u)}finally{if(T)throw T.error}return[7];case 8:a.trys.push([8,13,14,15]),p=s(Object.keys(n)),d=p.next(),a.label=9;case 9:return d.done?[3,12]:(m=d.value,void 0===(y=e[m])?[3,11]:(v=r,g=m,[4,t.deserializePropertyAsync(y,o,0)]));case 10:v[g]=a.sent(),a.label=11;case 11:return d=p.next(),[3,9];case 12:return[3,15];case 13:return x=a.sent(),b={error:x},[3,15];case 14:try{d&&!d.done&&(C=p.return)&&C.call(p)}finally{if(b)throw b.error}return[7];case 15:return r.fromData(i),[2]}}))}))},t.checkTypedArray=function(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array},t.checkDataPath=function(t){return t instanceof Object&&1===Object.keys(t).length&&t.id&&32===t.id.length},t.checkGLTFNode=function(t){return t instanceof Object&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.deserializeProperty=function(e,r,i){var n,o,a,u;if(i>10)console.error("序列化数据的内嵌对象层数大于上限");else{if("number"==typeof e||"string"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){var l=[];try{for(var c=s(e),h=c.next();!h.done;h=c.next()){var f=h.value;l.push(t.deserializeProperty(f,r,i+1))}}catch(t){n={error:t}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}return l}if(t.checkDataPath(e))return r.assetLoader.loadGUID(e.id);if(e instanceof te||t.checkTypedArray(e)||t.checkGLTFNode(e))return e;if(e instanceof Object){l={};try{for(var p=s(Object.keys(e)),d=p.next();!d.done;d=p.next()){var m=d.value;l[m]=t.deserializeProperty(e[m],r,i+1)}}catch(t){a={error:t}}finally{try{d&&!d.done&&(u=p.return)&&u.call(p)}finally{if(a)throw a.error}}return l}}},t.deserializePropertyAsync=function(e,r,i){return o(this,void 0,void 0,(function(){var n,o,u,l,c,h,f,p,d,m,y,v,g,x,T,E,b;return a(this,(function(a){switch(a.label){case 0:return i>10?(console.error("序列化数据的内嵌对象层数大于上限"),[2]):"number"!=typeof e&&"string"!=typeof e&&"boolean"!=typeof e?[3,1]:[2,e];case 1:if(!(e instanceof Array))return[3,10];f=[],a.label=2;case 2:a.trys.push([2,7,8,9]),n=s(e),o=n.next(),a.label=3;case 3:return o.done?[3,6]:(u=o.value,c=(l=f).push,[4,t.deserializePropertyAsync(u,r,i+1)]);case 4:c.apply(l,[a.sent()]),a.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return h=a.sent(),x={error:h},[3,9];case 8:try{o&&!o.done&&(T=n.return)&&T.call(n)}finally{if(x)throw x.error}return[7];case 9:return[2,f];case 10:return t.checkDataPath(e)?[4,r.assetLoader.loadGUIDAsync(e.id)]:[3,12];case 11:return[2,f=a.sent()];case 12:return e instanceof te||t.checkTypedArray(e)||t.checkGLTFNode(e)?[2,e]:[3,13];case 13:if(!(e instanceof Object))return[3,22];f={},a.label=14;case 14:a.trys.push([14,19,20,21]),p=s(Object.keys(e)),d=p.next(),a.label=15;case 15:return d.done?[3,18]:(m=d.value,y=f,v=m,[4,t.deserializePropertyAsync(e[m],r,i+1)]);case 16:y[v]=a.sent(),a.label=17;case 17:return d=p.next(),[3,15];case 18:return[3,21];case 19:return g=a.sent(),E={error:g},[3,21];case 20:try{d&&!d.done&&(b=p.return)&&b.call(p)}finally{if(E)throw E.error}return[7];case 21:return[2,f];case 22:return[2]}}))}))},t.serializeObjectProperty=function(e,r,i){var n,o;if(i>10)console.error("序列化数据的内嵌对象层数大于上限");else{r||(r={});try{for(var a=s(Object.keys(e)),u=a.next();!u.done;u=a.next()){var l=u.value,c=e[l];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(e)?r[l]=c:c instanceof Array?(r[l]||(r[l]=[]),t.serializeArrayProperty(c,r[l],i+1)):c instanceof te?r[l]={id:c.getInstanceId()}:c instanceof Object&&(r[l]||(r[l]={}),t.serializeObjectProperty(c,r[l],i+1))}}catch(t){n={error:t}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}}},t.serializeArrayProperty=function(e,r,i){if(i>10)console.error("序列化数据的内嵌对象层数大于上限");else{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:o instanceof Array?(r[n]||(r[n]=[]),this.serializeArrayProperty(o,r[n],i+1)):o instanceof te?r[n]={id:o.getInstanceId()}:o instanceof Object&&(r[n]||(r[n]={}),t.serializeObjectProperty(o[n],r[n],i+1))}}},t}(),qr=function(){function e(t){this.engine=t}return e.prototype.loadGUID=function(r){if(this.engine.objectInstance[r])return this.engine.objectInstance[r];var i,n=this.findData(r);if(n){switch(n.dataType){case t.DataType.Material:i=Xe.create(this.engine);break;case t.DataType.Geometry:i=ir.create(this.engine);break;case t.DataType.Texture:return i=Me.create(this.engine,n);case t.DataType.Shader:i=this.engine.getShaderLibrary().createShader(n);break;default:var o=e.getClass(n.dataType);o&&(i=new o(this.engine))}if(i)return i.setInstanceId(n.id),this.engine.addInstance(i),Zr.deserializeTaggedProperties(n,i),i;console.error("未找到 DataType: "+n.dataType+"的构造函数")}else console.error("未找到 uuid: "+r+"的对象数据")},e.prototype.loadGUIDAsync=function(r){return o(this,void 0,void 0,(function(){var i,n,o;return a(this,(function(a){switch(a.label){case 0:return this.engine.objectInstance[r]?[2,this.engine.objectInstance[r]]:(n=this.findData(r))?[3,2]:this.engine.database?[4,this.engine.database.loadGUID(r)]:(console.error("未找到 uuid: "+r+"的对象数据"),[2,void 0]);case 1:return(i=a.sent())?(this.engine.addInstance(i),[2,i]):(console.error("未找到 uuid: "+r+"的磁盘数据"),[2,void 0]);case 2:switch(n.dataType){case t.DataType.Material:i=Xe.create(this.engine);break;case t.DataType.Geometry:i=ir.create(this.engine);break;case t.DataType.Texture:return[2,i=Me.create(this.engine,n)];case t.DataType.Shader:i=this.engine.getShaderLibrary().createShader(n);break;default:(o=e.getClass(n.dataType))&&(i=new o(this.engine))}return i?(i.setInstanceId(n.id),this.engine.addInstance(i),[4,Zr.deserializeTaggedPropertiesAsync(n,i)]):(console.error("未找到 DataType: "+n.dataType+"的构造函数"),[2,void 0]);case 3:return a.sent(),[2,i]}}))}))},e.prototype.findData=function(t){return this.engine.jsonSceneData[t]},e.getClass=function(t){return Wt[t]},e}(),Kr=function(){function t(){}return t.prototype.loadGUID=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,void 0]}))}))},t}();t.DataType=void 0,(jr=t.DataType||(t.DataType={}))[jr.VFXItemData=0]="VFXItemData",jr[jr.EffectComponent=1]="EffectComponent",jr[jr.Material=2]="Material",jr[jr.Shader=3]="Shader",jr[jr.SpriteComponent=4]="SpriteComponent",jr[jr.ParticleSystem=5]="ParticleSystem",jr[jr.InteractComponent=6]="InteractComponent",jr[jr.CameraController=7]="CameraController",jr[jr.Geometry=8]="Geometry",jr[jr.Texture=9]="Texture",jr[jr.TextComponent=10]="TextComponent",jr[jr.MeshComponent=1e4]="MeshComponent",jr[jr.SkyboxComponent=10001]="SkyboxComponent",jr[jr.LightComponent=10002]="LightComponent",jr[jr.CameraComponent=10003]="CameraComponent",jr[jr.ModelPluginComponent=10004]="ModelPluginComponent",jr[jr.TreeComponent=10005]="TreeComponent";var Qr,Jr,$r=function(){function t(){this.order=100,this.name=""}return t.precompile=function(t,e){return Promise.resolve()},t.prototype.onCompositionConstructed=function(t,e){},t.prototype.onCompositionItemLifeBegin=function(t,e){},t.prototype.onCompositionItemLifeEnd=function(t,e){},t.prototype.onCompositionItemRemoved=function(t,e){},t.prototype.onCompositionReset=function(t,e){},t.prototype.onCompositionWillReset=function(t,e){},t.prototype.onCompositionDestroyed=function(t){},t.prototype.onCompositionUpdate=function(t,e){},t.prototype.prepareRenderFrame=function(t,e){return!1},t.prototype.postProcessFrame=function(t,e){},t}(),ti=(Qr=new Float32Array(1),Jr=new Int32Array(Qr.buffer),function(t){Qr[0]=t;var e=Jr[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?r|=((i|=2048)>>114-n)+(i>>113-n&1):(r|=n-112<<10|i>>1,r+=1&i)}),ei=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]=ti(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=ti(t[r])},t}();var ri,ii=new q,ni=new Z;function oi(t,e,r,i,n,o,a){var s=t,u=i/n,l=i,c=e.speedOverLifetime;c&&(l=c.getIntegrateValue(0,i,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;s.copyFrom(o),s.addScaledVector(a,l),s.addScaledVector(r,h);var f=e.linearVelOverLifetime||{},p=e.orbitalVelOverLifetime||{},d=["x","y","z"];if(p.enabled){var m=new H;p.center&&m.setFromArray(p.center);var y=s.clone().subtract(m),v=p.asRotation,g=d.map((function(t){var e=p[t];return e?v?e.getValue(u):e.getIntegrateValue(0,i,n):0}));ii.setFromArray(g).negate(),ni.setFromEuler(ii);var x=ni.transformPoint(y);s.addVectors(m,x)}if(f.enabled)for(var T=f.asMovement,E=0;E<3;E++){var b=f[d[E]];if(b){var C=T?b.getValue(u):b.getIntegrateValue(0,i,n);s.setElement(E,s.getElement(E)+C)}}return s}function ai(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function si(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function ui(t,e,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)t[n]=e[n+i];return t}function li(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(i=0;i<e.length;i++)t[i]=e[i]}else if(r&&t!==r)for(i=0;i<r.length;i++)t[i]=r[i];return t}var ci,hi=((ri={})[bt.PARTICLE_ORIGIN_CENTER]=[0,0],ri[bt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],ri[bt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],ri[bt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],ri[bt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],ri[bt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],ri[bt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],ri[bt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],ri[bt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],ri);function fi(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function pi(t,e,r){var i=r.position,n=new H(t,e,0),o=new H;return r.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(i),new tt(i,o)}function di(t,e,r){var i=t.x,n=t.y,o=t.z,a=new H(i-e,n+r,o),s=new H(i-e,n-r,o),u=new H(i+e,n-r,o),l=new H(i+e,n+r,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:l}]}var mi="not_implement",yi=function(){function t(t){this.onCreate(t)}return t.prototype.onCreate=function(t){throw Error(mi)},t.prototype.getIntegrateValue=function(t,e,r){throw Error(mi)},t.prototype.getIntegrateByTime=function(t,e){throw Error(mi)},t.prototype.getValue=function(t){throw Error(mi)},t.prototype.toUniform=function(t){throw Error(mi)},t.prototype.map=function(t){throw Error(mi)},t.prototype.scaleXCoord=function(t){return this},t}(),vi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onCreate=function(t){this.value=t},e.prototype.getIntegrateValue=function(t,e,r){return this.value*(e-t)},e.prototype.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},e.prototype.getValue=function(t){return this.value},e.prototype.toUniform=function(){return new Float32Array([0,this.value,0,0])},e.prototype.map=function(t){var e=this.value;return this.value=t(e),this},e}(yi),gi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onCreate=function(t){this.items=t},e.prototype.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},e.prototype.map=function(t){return this.items=this.items.map(t),this},e}(yi),xi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.getValue=function(t){return St(this.min,this.max)},e.prototype.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(yi),Ti=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.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},e.prototype.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(yi),Ei=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},e.prototype.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},e.prototype.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},e.prototype.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},e.prototype.getIntegrateByTime=function(t,e){return Mi(e,0,this.xCoord,this.min,this.max)-Mi(t,0,this.xCoord,this.min,this.max)},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e.prototype.scaleXCoord=function(t){return this.xCoord=t,this},e}(yi),bi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onCreate=function(t){this.stops=b(t)},e.prototype.getStops=function(){return this.stops},e.prototype.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 C(n.color,o.color,a,!0)}}return e[r].color.slice()},e}(yi),Ci=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.getAllData=function(t,e){for(var r=new(e?ei: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.prototype.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{i=t.map((function(t){if(Ct(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,n=i.time,o=i.value,a=i.inTangent,s=void 0===a?0:a,u=i.outTangent,l=void 0===u?0:u;return e=Math.min(e,o),r=Math.max(r,o),[n,o,s,l]}throw new Error("invalid keyframe")}));var o=r-e;if(this.keys=i,0!==o)for(n=0;n<i.length;n++){var a=i[n];a[1]=(a[1]-e)/o}var s=i[0];s[0]>0&&(s[2]=0,i.unshift([0,s[1],0,0]));var u=i[i.length-1];u[0]<1&&(u[3]=0,i.push([1,u[1],0,0])),this.min=e,this.dist=o}this.isCurveValue=!0},e.prototype.getValue=function(t){var e=this,r=e.keys,i=e.min,n=e.dist,o=r;if(t<=o[0][0])return o[0][1]*n+i;for(var a=o.length-1,s=0;s<a;s++){var u=o[s],l=o[s+1];if(t>u[0]&&t<=l[0])return Li(t,u,l)*n+i}return o[a][1]*n+i},e.prototype.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},e.prototype.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},e.prototype.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?Pi:Ii,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},e.prototype.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},e.prototype.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])},e.prototype.map=function(t){return this.keys.forEach((function(e){e[1]=t(e[1])})),this},e.prototype.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(yi),_i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.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},e.prototype.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]},e.prototype.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},e.prototype.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},e.prototype.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?Mi:wi,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},e.prototype.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},e.prototype.toUniform=function(t){var e=t.index,r=this.keys,i=Math.ceil(r.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},e.prototype.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},e.prototype.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(yi),Ai=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onCreate=function(t){this.keys=t[0],this.values=t[1]},e.prototype.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;if(0===a)s=(t-n[0])/(o[0]-n[0]);else s=(Li(t,n,o)-n[1])/a;return this.calculateVec(i,s)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},e.prototype.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}(yi),Si=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onCreate=function(e){t.prototype.onCreate.call(this,e),this.cps=e[2]},e.prototype.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}(Ai),Ri=((ci={})[Lt.RANDOM]=function(t){return t[0]instanceof Array?new Ti(t):new xi(t)},ci[Lt.CONSTANT]=function(t){return new vi(t)},ci[Lt.CONSTANT_VEC2]=function(t){return new vi(t)},ci[Lt.CONSTANT_VEC3]=function(t){return new vi(t)},ci[Lt.CONSTANT_VEC4]=function(t){return new vi(t)},ci[Lt.CURVE]=function(t){return new Ci(t)},ci[Lt.RGBA_COLOR]=function(t){return new vi(t)},ci[Lt.COLORS]=function(t){return new gi(t.map((function(t){return T(t,!1)})))},ci[Lt.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Ei([t[0][1],t[1][1]]):new _i(t)},ci[Lt.GRADIENT_COLOR]=function(t){return new bi(t)},ci[Lt.LINEAR_PATH]=function(t){return new Ai(t)},ci[Lt.BEZIER_PATH]=function(t){return new Si(t)},ci);function Oi(t){if(!t||!isNaN(+t))return new vi(t||0);if(t instanceof yi)return t;if(_t(Ri[t[0]]))return Ri[t[0]](t[1]);throw new Error("ValueType: ".concat(t[0]," is not support"))}function wi(t,e,r,i,n){var o=t-e;return(i+i+(n-i)*o/(r-e))*o/2}function Mi(t,e,r,i,n){var o=t*t,a=e*e;return(2*(o*t)*(i-n)+3*o*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function Li(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,l=u-2*s+a,c=u-s,h=-2*u+3*s;return(2*u-3*s+1)*e[1]+l*n+c*o+h*r[1]}function Ii(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 Pi(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,p=f*i;return(-30*p*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/p}function Fi(t,e){if(e){var r=e[0],i=e[1];if(r===Lt.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===Lt.LINE){if(2===(n=i.length)&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++;var o=Math.ceil(n/2);t.lineSegCount+=o,t.curves.push(i),t.index+=o,t.max=Math.max(t.max,o)}}}function Ni(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var Di,Vi=new j,zi=1,Ui=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new H(0,0,0),this.quat=new j(0,0,0,1),this.rotation=new q(0,0,0),this.scale=new H(1,1,1),this.anchor=new H(0,0,0),this.size=new X(1,1),this.children=[],this.worldMatrix=Z.fromIdentity(),this.localMatrix=Z.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new H(0,0,0),quat:new j(0,0,0,1),scale:new H(1,1,1)},this.name="transform_".concat(zi++),t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}return t.getRotation=function(t,e){var r=Vi.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},Object.defineProperty(t.prototype,"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)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentMatrixDirty",{get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())},enumerable:!1,configurable:!0}),t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.scaleBy=function(t,e,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.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())},t.prototype.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&&(r instanceof H?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),a)a instanceof j?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;i instanceof q?this.setRotation(i.x*l,i.y*l,i.z*l):this.setRotation(i[0]*l,i[1]*l,i[2]*l)}n&&(n instanceof H?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),u&&(u instanceof X?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},t.prototype.addChild=function(t){v(this.children,t)},t.prototype.removeChild=function(t){g(this.children,t)},t.prototype.getRotation=function(){return t.getRotation(this.quat,new q)},t.prototype.getQuaternion=function(){return this.quat},t.prototype.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.localMatrix.multiply(new Z(this.size.x,0,0,0,0,this.size.y,0,0,0,0,1,0,0,0,0,1)),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},t.prototype.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},t.prototype.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},t.prototype.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},t.prototype.getWorldScale=function(){var t=this.worldTRSCache;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return this.worldTRSCache.scale.clone()},t.prototype.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},t.prototype.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new q)},t.prototype.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)},t.prototype.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},t.prototype.getValid=function(){return this.valid},t.prototype.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},t.prototype.fromData=function(t){var e={position:(new H).copyFrom(t.position),rotation:new q(t.rotation.x,t.rotation.y,t.rotation.z),scale:(new H).copyFrom(t.scale)};this.setTransform(e)},t.prototype.dispose=function(){},t.prototype.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}},t.prototype.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t}(),Bi=function(e){function i(t,r){var i=e.call(this,t)||this;return r&&i.fromData(r),i}return r(i,e),i.prototype.start=function(){this.options.position=this.transform.position.clone(),this.options.rotation=this.transform.getRotation().clone()},i.prototype.update=function(){var t=this.item.lifetime;if(!(t<0)&&this.item.transform.getValid()){var e=new j,r=new H,i=new q;r.copyFrom(this.options.position),i.copyFrom(this.options.rotation);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(t=k(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=Ui.getRotation(e,i),this.updateCamera()}},i.prototype.fromData=function(t){e.prototype.fromData.call(this,t);var r=t.options,i=r.near,n=r.far,o=r.fov,a=r.clipMode;if(this.clipMode=a,this.options={position:new H,rotation:new q,near:Oi(i),far:Oi(n),fov:Oi(o)},t.positionOverLifetime){var s=t.positionOverLifetime,u=s.path,l=s.linearX,c=void 0===l?0:l,h=s.linearY,f=void 0===h?0:h,p=s.linearZ,d=void 0===p?0:p;this.translateOverLifetime={path:u&&Oi(u),x:Oi(c),y:Oi(f),z:Oi(d)}}if(t.rotationOverLifetime){var m=t.rotationOverLifetime,y=m.separateAxes,v=m.x,g=void 0===v?0:v,x=m.y,T=void 0===x?0:x,E=m.z,b=void 0===E?0:E;this.rotationOverLifetime={separateAxes:y,x:Oi(g),y:Oi(T),z:Oi(b)}}},i.prototype.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}},i=n([Jt(t.DataType.CameraController)],i)}(ie),ki=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}($r);t.HitTestType=void 0,(Di=t.HitTestType||(t.HitTestType={}))[Di.triangle=1]="triangle",Di[Di.box=2]="box",Di[Di.sphere=3]="sphere",Di[Di.custom=4]="custom";var Gi="click",Xi="touchstart",Hi="touchmove",ji="touchend",Yi=xt,Wi=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}return t.prototype.bindListeners=function(){var t,e,r,i,n,o,a=this;o=function(t){return t};var s="mousedown",u="mousemove",l="mouseup",c=function(t,e,r,i,o){void 0===i&&(i=0),void 0===o&&(o=0);var s=a.target,u=s.width,l=s.height,c=performance.now(),h=0,f=0;if(n){var p=c-n.ts;h=(i-n.dx)/p||0,f=(o-n.dy)/p||0,n={dx:i,dy:o,ts:c}}return{x:e,y:r,vx:h,vy:f,dx:i,dy:o,ts:c,width:u,height:l,origin:t}};R()&&(o=function(t){var e=t,r=e.touches,i=e.changedTouches;return r[0]||i[0]},s="touchstart",u="touchmove",l="touchend"),this.nativeHandlers=((t={})[s]=function(t){if(a.enabled){var s=o(t),u=Zi(s);e=u.x,r=u.y,n=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:e,y:r},a.dispatchEvent(Xi,c(t,e,r))}},t[u]=function(t){if(i&&a.enabled){var n=Zi(o(t));e=n.x,r=n.y,a.dispatchEvent(Hi,c(t,e,r,e-i.x,r-i.y))}},t[l]=function(t){if(i&&a.enabled){!a.allowPropagation&&t.cancelable&&(t.preventDefault(),t.stopPropagation());var n=o(t),s=Zi(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);e=s.x,r=s.y,u<4&&a.dispatchEvent(Gi,c(t,e,r)),a.dispatchEvent(ji,c(t,e,r,e-i.x,r-i.y))}i=0},t),Object.keys(this.nativeHandlers).forEach((function(t){var e;null===(e=a.target)||void 0===e||e.addEventListener(String(t),a.nativeHandlers[t])}))},t.prototype.dispatchEvent=function(t,e){var r=this.handlers[t];null==r||r.forEach((function(t){return t(e)}))},t.prototype.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),v(r,e),function(){g(r,e)}},t.prototype.removeEventListener=function(t,e){var r=this.handlers[t];r&&g(r,e)},t.prototype.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var r;null===(r=t.target)||void 0===r||r.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function Zi(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 qi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}($r),Ki=6,Qi="editor",Ji={"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"},$i=1,tn=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()}return e.prototype.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new H,n=new j,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)},e.prototype.createMaterial=function(e){var r,i=[["ENV_EDITOR",(null===(r=this.engine.renderer)||void 0===r?void 0:r.env)===Qi]],n=Oi(this.color).getValue(0),o=this.engine.gpuCapability.level,a={shader:{vertex:ve(i,"\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",t.ShaderType.vertex,o),fragment:ve(i,"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n",t.ShaderType.fragment,o),glslVersion:t.GLSLVersion.GLSL1,cacheId:"".concat(e.cachePrefix,"_effects_interact")},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=Xe.create(this.engine,a);return s.depthTest=!1,s.setVector4("uPos",new K(0,0,0,0)),s.setVector2("uSize",new X(1,1)),s.setVector4("uColor",new K(n[0]/255,n[1]/255,n[2]/255,n[3])),s.setQuaternion("uQuat",new j(0,0,0,0)),s},e.prototype.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return ir.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:le.LINES,maxVertex:4})},e.prototype.createMesh=function(t,e){return ur.create(this.engine,{name:"Interact_preview"+$i++,priority:0,worldMatrix:Z.fromIdentity(),geometry:t,material:e})},e}(),en=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.getHitTestParams=function(e){if(t.clickable){var r=t.item.props.content.options.behavior,i=t.getBoundingBox();return i?{type:i.type,triangles:i.area,behavior:r}:void 0}},t}var a;return r(o,e),a=o,o.prototype.start=function(){var t,e,r,i=this.item.props.content.options,n=(null!==(e=null===(t=this.item.engine)||void 0===t?void 0:t.renderer)&&void 0!==e?e:{}).env,o=this.item.composition,a=this.interactData.options,s=a.type,u=a.showPreview;if(s===gt.CLICK&&(this.clickable=!0,u&&n===Qi)){var l=this.item.composition.getRendererOptions();this.previewContent=new tn(this.item.props.content,l,this.transform,this.engine)}null===(r=this.item.composition)||void 0===r||r.addInteractiveItem(this.item,i.type),i.type===gt.DRAG&&(n!==Qi||i.enableInEditor)&&o.event&&this.beginDragTarget(i,o.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},o.prototype.update=function(t){var e;if(null===(e=this.previewContent)||void 0===e||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,rn(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg)}},o.prototype.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},o.prototype.onDestroy=function(){var t;this.item&&this.item.composition&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.clickable=!1,null===(t=this.previewContent)||void 0===t||t.mesh.dispose(),this.endDragTarget())},o.prototype.endDragTarget=function(){},o.prototype.handleDragMove=function(t,e){var r,i;if(t&&t.cameraParam&&this.item.composition){var n=this.item.props.content.options,o=t.cameraParam,a=o.position,s=o.fov,l=e.dy,c=e.dx*e.width/e.height,h=a[2],f=Math.tan(s*Math.PI/180/2)*Math.abs(h),p=l*f,d=c*f,m=a[0]-d,y=a[1]-p;if(n.dxRange){var v=u(n.dxRange,2);(m=k(m,g=v[0],x=v[1]))!==g&&m!==x&&g!==x&&(null===(r=e.origin)||void 0===r||r.preventDefault())}if(n.dyRange){var g,x,T=u(n.dyRange,2);(y=k(y,g=T[0],x=T[1]))!==g&&y!==x&&g!==x&&(null===(i=e.origin)||void 0===i||i.preventDefault())}this.item.composition.camera.position=new H(m,y,h)}},o.prototype.beginDragTarget=function(t,e){var r=this;if("camera"===t.target){var n,o={touchstart:function(t){var e;r.dragEvent=null,r.bouncingArg=null;var i=null===(e=r.item.composition)||void 0===e?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}},touchmove:function(t){r.handleDragMove(n,t),r.bouncingArg=t},touchend:function(t){var e=r.bouncingArg;if(!rn(e,3)&&e){e.vx*=5,e.vy*=5,r.dragEvent=i({},n)}n=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(a).endDragTarget=function(){Object.keys(o).forEach((function(t){e.removeEventListener(t,o[t])}))}}},o.prototype.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),r=di(H.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}},o.prototype.fromData=function(t){e.prototype.fromData.call(this,t),this.interactData=t},o=a=n([Jt(t.DataType.InteractComponent)],o)}(ne);function rn(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}function nn(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)}function on(t){var e=t.renderer,r=e.blending,i=e.side,n=e.occlusion,o=e.mask,a=e.maskMode,s=e.order,u=+r,l=t.cachePrefix||"-";return{side:i,occlusion:n,blending:r,mask:o,maskMode:a,cachePrefix:l,cacheId:"".concat(l,".").concat(+i,"+").concat(+n,"+").concat(u,"+").concat(s,"+").concat(a,".").concat(o)}}function an(e,r){var i=null!=r?r:{},n=i.count,o=void 0===n?2:n,a=i.env,s=void 0===a?"":a,u=i.ignoreBlend,l=i.wireframe,c=[["MAX_ITEM_COUNT",o],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",s===Qi],["USE_BLEND",!u],["MAX_FRAG_TEX",t.maxSpriteTextureCount>=16?16:8]],h=l?dr:yr.replace(/#pragma\s+FILTER_FRAG/,""),f=mr.replace(/#pragma\s+FILTER_VERT/,"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}");return{fragment:ve(c,h,t.ShaderType.fragment,e),vertex:ve(c,f,t.ShaderType.vertex,e),glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,marcos:c,shared:!0}}function sn(t,e){return"".concat(t.cachePrefix,"_effects_sprite_").concat(e)}function un(t,e,r,i){var n=t.wireframe,o=an(r,{count:e,wireframe:n,env:i});return o.shared=!0,n||(o.cacheId=sn(t,e)),o}t.maxSpriteMeshItemCount=8,t.maxSpriteTextureCount=8;var ln={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},cn=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="sprite",t}return r(i,e),i.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[sn(ln,2)]||(n.addShader(un(ln,2,1,u)),n.addShader(un(ln,t.maxSpriteMeshItemCount,1,u)),s.writableFragDepth&&n.addShader(Ke(a,!0))),Promise.resolve()},i}($r),hn=function(){function t(){this.playableOutputs=[]}return t.prototype.evaluate=function(t){var e,r;try{for(var i=s(this.playableOutputs),n=i.next();!n.done;n=i.next()){var o=n.value;this.callProcessFrame(o.sourcePlayable,t),o.processFrame(t)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.connect=function(t,e){e.connect(t)},t.prototype.addOutput=function(t){this.playableOutputs.push(t)},t.prototype.callProcessFrame=function(t,e){var r,i;try{for(var n=s(t.getInputs()),o=n.next();!o.done;o=n.next()){var a=o.value;this.callProcessFrame(a,e)}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}t.processFrame(e)},t}(),fn=function(){function t(){this.inputs=[]}return t.prototype.connect=function(t){this.inputs.push(t)},t.prototype.getInputs=function(){return this.inputs},t.prototype.getInput=function(t){if(!(t>this.inputs.length-1))return this.inputs[t]},t.prototype.setTime=function(t){this.time=t},t.prototype.getTime=function(){return this.time},t.prototype.onGraphStart=function(){},t.prototype.onGraphStop=function(){},t.prototype.onPlayablePlay=function(){},t.prototype.processFrame=function(t){},t.prototype.onPlayableDestroy=function(){},t.prototype.fromData=function(t){},t}(),pn=function(){function t(){}return t.prototype.setSourcePlayeble=function(t){this.sourcePlayable=t},t.prototype.onGraphStart=function(){},t.prototype.processFrame=function(t){},t}(),dn=function(){function t(){this.clips=[],this.clipSeed=0}return t.prototype.createOutput=function(){return new pn},t.prototype.createMixerPlayable=function(){return new fn},t.prototype.createPlayebleTree=function(){var t,e,r=this.createMixerPlayable();try{for(var i=s(this.clips),n=i.next();!n.done;n=i.next()){var o=n.value;r.connect(o.playable)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return r},t.prototype.createClip=function(t,e){var r=new mn;return r.playable=new t,r.name=e||"TimelineClip"+r.id,this.addClip(r),r},t.prototype.getClips=function(){return this.clips},t.prototype.findClip=function(t){var e,r;try{for(var i=s(this.clips),n=i.next();!n.done;n=i.next()){var o=n.value;if(o.name===t)return o}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.addClip=function(t){t.playable.bindingItem=this.bindingItem,t.id=(this.clipSeed++).toString(),this.clips.push(t)},t}(),mn=function(){this.start=0,this.duration=0},yn=function(){function t(t){this.curveValues={},this.playable=t}return t.prototype.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]},t.prototype.findCurveValue=function(t,e){return this.curveValues[t+e]},t.prototype.getInputStream=function(t){var e=this.playable.getInput(t);if(e instanceof vn)return e.animationStream},t}(),vn=function(t){function e(){var e=t.call(this)||this;return e.animationStream=new yn(e),e}return r(e,t),e}(fn),gn=new q,xn=new H(1,1,1),Tn=new H,En=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.processFrame=function(t){this.bindingItem.composition&&this.sampleAnimation()},e.prototype.sampleAnimation=function(){var t=this,e=this.bindingItem.duration,r=this.time/e;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){xn.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(xn.y=this.sizeYOverLifetime.getValue(r),xn.z=this.sizeZOverLifetime.getValue(r)):xn.z=xn.y=xn.x;var i=this.originalTransform.scale;this.bindingItem.transform.setScale(xn.x*i.x,xn.y*i.y,xn.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;gn.x=a?n(this.rotationOverLifetime.x):0,gn.y=a?n(this.rotationOverLifetime.y):0,gn.z=o;var s=gn.addEulers(this.originalTransform.rotation,gn);this.bindingItem.transform.setRotation(s.x,s.y,s.z)}if(this.positionOverLifetime){var u=Tn;oi(u,this,this.gravity,this.time,e,this.originalTransform.position,this.velocity),this.originalTransform.path&&u.add(this.originalTransform.path.getValue(r)),this.bindingItem.transform.setPosition(u.x,u.y,u.z)}},e.prototype.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 H(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=Oi(i.path));var a=i.linearX||i.linearY||i.linearZ;a&&(this.linearVelOverLifetime={x:i.linearX&&Oi(i.linearX),y:i.linearY&&Oi(i.linearY),z:i.linearZ&&Oi(i.linearZ),asMovement:i.asMovement,enabled:!!a});var s=i.orbitalX||i.orbitalY||i.orbitalZ;s&&(this.orbitalVelOverLifetime={x:i.orbitalX&&Oi(i.orbitalX),y:i.orbitalY&&Oi(i.orbitalY),z:i.orbitalZ&&Oi(i.orbitalZ),center:ai(i.orbCenter),asRotation:i.asRotation,enabled:!!s}),this.speedOverLifetime=i.speedOverLifetime&&Oi(i.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Oi(o.x||1),this.sizeYOverLifetime=Oi(o.y||1),this.sizeZOverLifetime=Oi(o.z||1)):this.sizeXOverLifetime=Oi(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:Oi(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=Oi(n.x||0),u.y=Oi(n.y||0)}this.gravity=H.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=Oi(null!==(e=null==i?void 0:i.gravityOverLifetime)&&void 0!==e?e:0),this.direction=(null==i?void 0:i.direction)?H.fromArray(i.direction).normalize():new H,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},e}(vn),bn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onGraphStart=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},e.prototype.onPlayablePlay=function(){this.bindingItem.transform.setValid(!0),this.showRendererComponents()},e.prototype.onPlayableDestroy=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},e.prototype.hideRendererComponents=function(){var t,e;try{for(var r=s(this.bindingItem.rendererComponents),i=r.next();!i.done;i=r.next()){var n=i.value;n.enabled&&(n.enabled=!1)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.showRendererComponents=function(){var t,e;try{for(var r=s(this.bindingItem.rendererComponents),i=r.next();!i.done;i=r.next()){var n=i.value;n.enabled||(n.enabled=!0)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e}(fn),Cn=function(t){function e(e){var r=t.call(this,e)||this;return r.reusable=!1,r.timelineStarted=!1,r.playableGraph=new hn,r.time=0,r.tracks=[],r.trackSeed=0,r}return r(e,t),e.prototype.start=function(){var t,e,r,i;try{for(var n=s(this.tracks),o=n.next();!o.done;o=n.next()){var a=o.value;try{for(var u=(r=void 0,s(a.getClips())),l=u.next();!l.done;l=u.next()){var c=l.value;c.start=this.item.start,c.duration=this.item.duration}}catch(t){r={error:t}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.compileTracks(this.playableGraph)},e.prototype.update=function(t){var e,r,i,n,o,a,u,l,c,h,f,p,d,m,y,v;if(!this.item.stopped&&this.item.composition){if(!this.timelineStarted){try{for(var g=s(this.tracks),x=g.next();!x.done;x=g.next()){var T=x.value;try{for(var E=(i=void 0,s(T.getClips())),b=E.next();!b.done;b=E.next()){b.value.playable.onGraphStart()}}catch(t){i={error:t}}finally{try{b&&!b.done&&(n=E.return)&&n.call(E)}finally{if(i)throw i.error}}}}catch(t){e={error:t}}finally{try{x&&!x.done&&(r=g.return)&&r.call(g)}finally{if(e)throw e.error}}this.timelineStarted=!0}var C=this.time;if(this.item.delaying&&C>=0&&C<=this.item.duration){this.item.delaying=!1;try{for(var _=s(this.tracks),A=_.next();!A.done;A=_.next()){T=A.value;try{for(var S=(u=void 0,s(T.getClips())),R=S.next();!R.done;R=S.next()){R.value.playable.onPlayablePlay()}}catch(t){u={error:t}}finally{try{R&&!R.done&&(l=S.return)&&l.call(S)}finally{if(u)throw u.error}}}}catch(t){o={error:t}}finally{try{A&&!A.done&&(a=_.return)&&a.call(_)}finally{if(o)throw o.error}}}if(Ma.isParticle(this.item)?this.item.isEnded(C)&&this.item.content.destoryed:this.item.isEnded(C)){var O=this.item.endBehavior;if(!this.item.ended&&(this.item.ended=!0,this.item.onEnd(),0===O)){try{for(var w=s(this.tracks),M=w.next();!M.done;M=w.next()){T=M.value;try{for(var L=(f=void 0,s(T.getClips())),I=L.next();!I.done;I=L.next()){I.value.playable.onPlayableDestroy()}}catch(t){f={error:t}}finally{try{I&&!I.done&&(p=L.return)&&p.call(L)}finally{if(f)throw f.error}}}}catch(t){c={error:t}}finally{try{M&&!M.done&&(h=w.return)&&h.call(w)}finally{if(c)throw c.error}}if(this.item.delaying=!0,!this.item.reusable&&!this.reusable)return void this.item.dispose()}}if(!this.item.delaying){var P=this.time/this.item.duration;this.item.lifetime=P;try{for(var F=s(this.tracks),N=F.next();!N.done;N=F.next()){T=N.value;try{for(var D=(y=void 0,s(T.getClips())),V=D.next();!V.done;V=D.next()){V.value.playable.setTime(this.time)}}catch(t){y={error:t}}finally{try{V&&!V.done&&(v=D.return)&&v.call(D)}finally{if(y)throw y.error}}}}catch(t){d={error:t}}finally{try{N&&!N.done&&(m=F.return)&&m.call(F)}finally{if(d)throw d.error}}this.playableGraph.evaluate(t)}}},e.prototype.setTime=function(t){this.time=t},e.prototype.getTime=function(){return this.time},e.prototype.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},e.prototype.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},e.prototype.getTracks=function(){return this.tracks},e.prototype.findTrack=function(t){var e,r;try{for(var i=s(this.tracks),n=i.next();!n.done;n=i.next()){var o=n.value;if(o.name===t)return o}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.rebuildGraph=function(){this.playableGraph=new hn,this.compileTracks(this.playableGraph)},e.prototype.compileTracks=function(t){var e,r;try{for(var i=s(this.tracks),n=i.next();!n.done;n=i.next()){var o=n.value,a=o.createPlayebleTree(),u=o.createOutput();t.addOutput(u),u.setSourcePlayeble(a)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e),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(dn,"ActivationTrack").createClip(bn,"ActivationTimelineClip")},e.prototype.toData=function(){t.prototype.toData.call(this)},n([Qt()],e.prototype,"time",void 0),e}(ie),_n=[[0,0,1,1,void 0]],An=[1,1,1,1],Sn=0,Rn=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.renderColor=[1,1,1,1],e}return r(e,t),e.prototype.onPlayablePlay=function(){this.spriteMaterial=this.bindingItem.getComponent(On).material},e.prototype.processFrame=function(t){var e,r=si(An,1),i=this.time/this.bindingItem.duration,n=this.opacityOverLifetime,o=this.colorOverLifetime;o&&(r=E(o,i,!0),e=!0),n&&(r[3]*=n.getValue(i),e=!0),e&&(li(this.renderColor,r,this.startColor),this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor))},e.prototype.fromData=function(t){var e;this.clipData=t;var r=t.colorOverLifetime;return r&&(this.opacityOverLifetime=Oi(null!==(e=r.opacity)&&void 0!==e?e:1),r.color&&r.color[0]===Lt.GRADIENT_COLOR&&(this.colorOverLifetime=b(r.color[1]))),this.startColor=t.startColor||[1,1,1,1],this},e}(fn),On=function(e){function i(t,r){var i=e.call(this,t)||this;return i.color=[1,1,1,1],i.visible=!0,i.getHitTestParams=function(t){var e,r=i.interaction;if(t||r){var n=i.getBoundingBox();if(n)return{behavior:(null===(e=i.interaction)||void 0===e?void 0:e.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:i.renderer.side===dt.FRONT}}},r&&i.fromData(r),i}return r(i,e),i.prototype.setVisible=function(t){this.visible=t},i.prototype.getVisible=function(){return this.visible},i.prototype.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.prototype.start=function(){this.priority=this.item.listIndex,this.timelineComponent=this.item.getComponent(Cn),this.item.getHitTestParams=this.getHitTestParams},i.prototype.update=function(t){var e=this.timelineComponent.getTime(),r=this.item.duration,i=Math.min(Math.max(e/r,0),1),n=this.textureSheetAnimation;if(n){var o=n.total||n.row*n.col,a=0,s=0,u=1,l=1,c=void 0;if(this.splits){var h=this.splits[0];c=h[4],a=h[0],s=h[1],c?(u=h[3],l=h[2]):(u=h[2],l=h[3])}var f=void 0,p=void 0;c?(f=1/n.row*u,p=1/n.col*l):(f=1/n.col*u,p=1/n.row*l);var d=void 0;if(n.animate){var m=Math.round(i*(o-1)),y=Math.floor(m/n.col),v=m-y*n.col;d=c?[f*y,p*(n.col-v)]:[f*v,p*(1+y)]}else d=[0,p];this.material.getVector4("_TexOffset").setFromArray([a+d[0],l+s-d[1],f,p])}},i.prototype.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},i.prototype.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.prototype.setItem=function(){var e=[],r=this.renderer.texture;r&&v(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 p=this.emptyTexture,d=e.length;d<t.maxSpriteMeshItemCount;d++)u.setTexture("uSampler"+d,p)},i.prototype.createGeometry=function(t){var e=12*this.splits.length;return ir.create(this.engine,{attributes:{aPos:{type:le.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:le.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},i.prototype.createMaterial=function(t,e){var r=t.side,i=t.occlusion,n=t.blending,o=t.maskMode,a=t.mask,s={shader:un(t,e,1)};this.preMultiAlpha=pe(n);var u=Xe.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,ge(u,l.blendMode),Te(u,l.maskMode),xe(u,l.side),u.hasUniform("_Color")||u.setVector4("_Color",new K(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new K),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new K),u},i.prototype.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=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],p=[],d=[],m=2,y=2;1===r.length&&(m=1,y=1);for(var v=[],g=0;g<m;g++)for(var x=0;x<y;x++){var T=4*(2*x+g),E=n?[0,0,1,1,r[0][4]]:r[2*x+g],b=E[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],C=((g+g+1)/m-1)/2,_=((x+x+1)/y-1)/2,A=E[0],S=E[1],R=E[4]?E[3]:E[2],O=E[4]?E[2]:E[3],w=[f[0]/m+C,f[1]/y+_,f[2]/m+C,f[3]/y+_,f[4]/m+C,f[5]/y+_,f[6]/m+C,f[7]/y+_];p.push(b[0]*R+A,b[1]*O+S,b[2]*R+A,b[3]*O+S,b[4]*R+A,b[5]*O+S,b[6]*R+A,b[7]*O+S),v.push(1*w[0],1*w[1],0,1*w[2],1*w[3],0,1*w[4],1*w[5],0,1*w[6],1*w[7],0),d.push(T,1+T,2+T,2+T,1+T,3+T)}return this.geometry.setAttributeData("aPos",new Float32Array(v)),{index:d,atlasOffset:p}},i.prototype.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},i.prototype.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),r=di(H.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.prototype.fromData=function(t){var r,i,n,o,a,s;e.prototype.fromData.call(this,t);var u=t.interaction,l=t.options,c=t.listIndex,h=void 0===c?0:c,f=t.renderer;f||(f={}),this.interaction=u,this.renderer={renderMode:null!==(r=f.renderMode)&&void 0!==r?r:Et.BILLBOARD,blending:null!==(i=f.blending)&&void 0!==i?i:pt.ALPHA,texture:null!==(n=f.texture)&&void 0!==n?n:this.engine.emptyTexture,occlusion:!!f.occlusion,transparentOcclusion:!!f.transparentOcclusion||f.maskMode===mt.MASK,side:null!==(o=f.side)&&void 0!==o?o:dt.DOUBLE,shape:f.shape,mask:null!==(a=f.mask)&&void 0!==a?a:0,maskMode:null!==(s=f.maskMode)&&void 0!==s?s:mt.NONE,order:h},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||_n,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=on(this);var p=this.createGeometry(le.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=Z.fromIdentity(),this.material=d,this.geometry=p,this.name="MSprite"+Sn++;var m=l.startColor||[1,1,1,1];this.material.setVector4("_Color",(new K).setFromArray(m)),this.material.setVector4("_TexOffset",(new K).setFromArray([0,0,1,1])),this.setItem(),this.item.getComponent(Cn).createTrack(dn,"SpriteColorTrack").createClip(Rn,"SpriteColorClip").playable.fromData({colorOverLifetime:t.colorOverLifetime,startColor:t.options.startColor})},i.prototype.toData=function(){e.prototype.toData.call(this)},i=n([Jt(t.DataType.SpriteComponent)],i)}(ne),wn="lookup_texture",Mn="offscreen_canvas",Ln={};function In(t){return Ln[t]}var Pn=function(){function e(e,r){var i,n;this.particleCount=0;var o=(null!==(i=e.renderer)&&void 0!==i?i:{}).env,a=r.speedOverLifetime,s=r.colorOverLifetime,u=r.linearVelOverLifetime,l=r.orbitalVelOverLifetime,c=r.sizeOverLifetime,h=r.rotationOverLifetime,f=r.sprite,p=r.gravityModifier,d=r.maxCount,m=r.textureFlip,y=r.useSprite,v=r.name;r.filter;var g,x=r.gravity,T=r.forceTarget,E=r.side,b=r.occlusion,C=r.anchor,_=r.blending,A=r.maskMode,S=r.mask,R=r.transparentOcclusion,O=r.meshSlots,M=r.renderMode,L=void 0===M?0:M,I=r.diffuse,P=void 0===I?Me.createWithData(e):I,F=e.gpuCapability.detail,N=F.halfFloatTexture,D=F.maxVertexUniforms,V=[["RENDER_MODE",+L],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",o===Qi]],z=e.gpuCapability.level,U={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},B={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},k=D>0,G={},j=0,Y=0;this.useSprite=y,k&&V.push(["ENABLE_VERTEX_TEXTURE",!0]),a&&(V.push(["SPEED_OVER_LIFETIME",!0]),Y|=2,G.uSpeedLifetimeValue=a.toUniform(U)),(null==f?void 0:f.animate)&&(V.push(["USE_SPRITE",!0]),Y|=4,G.uFSprite=G.uSprite=new Float32Array([f.col,f.row,f.total,f.blend?1:0]),this.useSprite=!0),(null==s?void 0:s.color)&&(V.push(["COLOR_OVER_LIFETIME",!0]),Y|=16,G.uColorOverLifetime=s.color instanceof Me?s.color:Me.createWithData(e,w(s.color))),(null==s?void 0:s.opacity)?G.uOpacityOverLifetimeValue=s.opacity.toUniform(U):G.uOpacityOverLifetimeValue=Oi(1).toUniform(U),["x","y","z"].forEach((function(t,e){var r=0,i=0;(null==u?void 0:u[t])&&(G["uLinear".concat(t.toUpperCase(),"ByLifetimeValue")]=u[t].toUniform(U),r=1,Y|=1<<7+e,u.enabled=!0),V.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]),(null==l?void 0:l[t])&&(G["uOrb".concat(t.toUpperCase(),"ByLifetimeValue")]=l[t].toUniform(U),i=1,Y|=1<<10+e,g=!0,l.enabled=!0),V.push(["ORB_VEL_".concat(t.toUpperCase()),i])})),(null==u?void 0:u.asMovement)&&(V.push(["AS_LINEAR_MOVEMENT",!0]),Y|=32),g&&((null==l?void 0:l.asRotation)&&(V.push(["AS_ORBITAL_MOVEMENT",!0]),Y|=64),G.uOrbCenter=new Float32Array((null==l?void 0:l.center)||[0,0,0])),G.uSizeByLifetimeValue=null==c?void 0:c.x.toUniform(U),(null==c?void 0:c.separateAxes)&&(V.push(["SIZE_Y_BY_LIFE",1]),Y|=16384,G.uSizeYByLifetimeValue=null===(n=null==c?void 0:c.y)||void 0===n?void 0:n.toUniform(U)),(null==h?void 0:h.z)&&(G.uRZByLifeTimeValue=h.z.toUniform(U),Y|=32768,V.push(["ROT_Z_LIFETIME",1])),(null==h?void 0:h.x)&&(G.uRXByLifeTimeValue=h.x.toUniform(U),Y|=65536,V.push(["ROT_X_LIFETIME",1])),(null==h?void 0:h.y)&&(G.uRYByLifeTimeValue=h.y.toUniform(U),Y|=1<<17,V.push(["ROT_Y_LIFETIME",1])),(null==h?void 0:h.asRotation)&&(V.push(["ROT_LIFETIME_AS_MOVEMENT",1]),Y|=1<<18),G.uGravityModifierValue=p.toUniform(U),T&&(V.push(["FINAL_TARGET",!0]),Y|=1<<19,G.uFinalTarget=new Float32Array(T.target||[0,0,0]),G.uForceCurve=T.curve.toUniform(U)),N&&B.max?(Y|=1<<20,G.uFCurveValueTexture=Le(e,Ci.getAllData(B,!0),B.index,1)):G.uFCurveValues=Ci.getAllData(B);var W=U.max+U.curves.length-32>D;if(2===z&&(U.max=-1,U.index=O?O[0]:Nn(U.index),B.index>0&&(B.max=-1,B.index=O?O[1]:Nn(B.index))),W&&N&&k){var Z=Le(e,Ci.getAllData(U,!0),U.index,1);G.uVCurveValueTexture=Z,j=1}else G.uVCurveValues=Ci.getAllData(U);var q=["-p:",L,Y,U.index,U.max,B.index,B.max].join("+");V.push(["VERT_CURVE_VALUE_COUNT",U.index],["FRAG_CURVE_VALUE_COUNT",B.index],["VERT_MAX_KEY_FRAME_COUNT",U.max],["FRAG_MAX_KEY_FRAME_COUNT",B.max]);var Q=vr,J="#define LOOKUP_TEXTURE_CURVE ".concat(j,"\n").concat(gr),$={shader:{fragment:ve(V,Q,t.ShaderType.fragment,z),vertex:ve(V,J,t.ShaderType.vertex,z),glslVersion:1===z?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:q,marcos:V,name:"particle#".concat(v)},uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},tt=pe(_);G.uTexOffset=new Float32Array(P?[1/P.getWidth(),1/P.getHeight()]:[0,0]),G.uMaskTex=P,G.uColorParams=new Float32Array([P?1:0,+tt,0,+(!!b&&!R)]),G.uParams=[0,0,0,0],G.uAcceleration=[(null==x?void 0:x[0])||0,(null==x?void 0:x[1])||0,(null==x?void 0:x[2])||0,0];var et=Xe.create(e,$);et.blending=!0,et.depthTest=!0,et.depthMask=!!b,et.stencilRef=S?[S,S]:void 0,Te(et,A),ge(et,_),xe(et,E);var rt={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(G).map((function(t){var e=G[t];if(e instanceof Me)et.setTexture(t,e);else{var r=[];switch(rt[t]){case"vec4":et.setVector4(t,K.fromArray(e));break;case"vec3":et.setVector3(t,H.fromArray(e));break;case"vec2":et.setVector2(t,X.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new K(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}et.setVector4Array(t,r),r.length=0;break;default:console.warn("uniform ".concat(t,"'s type not in typeMap"))}}})),et.setVector3("emissionColor",new H(0,0,0)),et.setFloat("emissionIntensity",0);var it=ir.create(e,function(t,e,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,o={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)}};e&&(o.aSprite={size:3,stride:3*i,data:new Float32Array(0)});return{attributes:o,indices:{data:new Uint16Array(0)},name:r,maxVertex:t}}(4*d,this.useSprite,"particle#".concat(v))),nt=ur.create(e,{name:"MParticle_".concat(v),material:et,geometry:it});this.anchor=C,this.mesh=nt,this.geometry=nt.firstGeometry(),this.forceTarget=T,this.sizeOverLifetime=c,this.speedOverLifetime=a,this.linearVelOverLifetime=u,this.orbitalVelOverLifetime=l,this.orbitalVelOverLifetime=l,this.gravityModifier=p,this.maxCount=d,this.textureOffsets=m?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}return e.prototype.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]]},e.prototype.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=H.fromArray(i,r),c=H.fromArray(i,r+3),h=oi(new H,this,u,o,a,l,c);if(this.forceTarget){var f=s.getVector3("uFinalTarget"),p=this.forceTarget.curve.getValue(o/a),d=1-p;h.x=h.x*d+f.x*p,h.y=h.y*d+f.y*p,h.z=h.z*d+f.z*p}return h},e.prototype.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.prototype.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))},e.prototype.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},e.prototype.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.prototype.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i=t+1,n=4*i,o=this.geometry,a=i>this.maxParticleBufferCount,s=1;this.particleCount>300?s=(this.particleCount+100)/this.particleCount:this.particleCount>100?s=1.4:this.particleCount>0&&(s=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},l=this.useSprite;l&&(u.aSprite=new Float32Array(12));var c=new H,h=new j,f=new H(1,1,1);e.transform.assignWorldTRS(c,h,f);var p=Ui.getRotation(h,new q),d=c.toArray(),m=p.toArray(),y=this.textureOffsets,v=[0,0,e.delay,e.lifetime],g=[0,0,1,1],T=e.vel,E=e.color,b=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],C=Math.random(),_=void 0;l&&(_=e.sprite);for(var A=0;A<4;A++){var S=2*A,R=3*A,O=4*A,w=12*A,M=8*A;u.aPos.set(d,w),T.fill(u.aPos,w+3),u.aRot.set(m,M),u.aRot[M+3]=C,u.aRot.set(E,M+4),l&&u.aSprite.set(_,R);var L=e.uv||g;if(L){var I=l?1-y[S+1]:y[S+1];v[0]=L[0]+y[S]*L[2],v[1]=L[1]+I*L[3]}u.aOffset.set(v,O);for(var P=A+A,F=(b[P]-this.anchor.x)*f.x,N=(b[P+1]-this.anchor.y)*f.y,D=0;D<3;D++)u.aPos[w+6+D]=e.dirX.getElement(D)*F,u.aPos[w+9+D]=e.dirY.getElement(D)*N}var V=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(a){var z=x(o.getIndexData(),6*i,s,6*r);z.set(V,6*t),o.setIndexData(z),this.maxParticleBufferCount=z.length/6}else o.setIndexSubData(6*t,V);Object.keys(u).forEach((function(e){var i=u[e],l=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var c=x(o.getAttributeData(e),n*l,s,4*r*l);c.set(i,i.length*t),o.setAttributeData(e,c)}else o.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),o.setDrawCount(6*this.particleCount)}},e}(),Fn=[10,32,64,160];function Nn(t){for(var e=0;e<Fn.length;e++){var r=Fn[e];if(r>t)return r}return t||Fn[0]}function Dn(t,e,r){var i,n;void 0===e&&(e="");var o=t.content,a=+((null===(i=o.renderer)||void 0===i?void 0:i.renderMode)||0),s=[["RENDER_MODE",a],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",e===Qi]],u=r.level,l=r.detail,c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},h={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=l.maxVertexUniforms>0,p=(null!==(n=o.positionOverLifetime)&&void 0!==n?n:{}).speedOverLifetime,d=0,m=0;f&&s.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(s.push(["SPEED_OVER_LIFETIME",!0]),m|=2,Fi(c,p));var y=o.textureSheetAnimation;y&&y.animate&&(s.push(["USE_SPRITE",!0]),m|=4);var v=o.colorOverLifetime;v&&v.color&&(s.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=v&&v.opacity;g&&Fi(c,g);var x,T=o.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])&&(Fi(c,T[i]),r=1,m|=1<<7+e),s.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]);var o=0;(null==T?void 0:T[n])&&(Fi(c,T[n]),o=1,m|=1<<10+e,x=!0),s.push(["ORB_VEL_".concat(t.toUpperCase()),o])})),(null==T?void 0:T.asMovement)&&(s.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),x&&(null==T?void 0:T.asRotation)&&(s.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64);var E=o.sizeOverLifetime;Fi(c,null==E?void 0:E.x),(null==E?void 0:E.separateAxes)&&(s.push(["SIZE_Y_BY_LIFE",1]),m|=16384,Fi(c,null==E?void 0:E.y));var b=o.rotationOverLifetime;(null==b?void 0:b.z)&&(Fi(c,null==b?void 0:b.z),m|=32768,s.push(["ROT_Z_LIFETIME",1])),(null==b?void 0:b.separateAxes)&&(b.x&&(Fi(c,b.x),m|=65536,s.push(["ROT_X_LIFETIME",1])),b.y&&(Fi(c,b.y),m|=1<<17,s.push(["ROT_Y_LIFETIME",1]))),(null==b?void 0:b.asRotation)&&(s.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=1<<18),Fi(c,null==T?void 0:T.gravityOverLifetime),(null==T?void 0:T.forceTarget)&&(s.push(["FINAL_TARGET",!0]),m|=1<<19,Fi(c,T.forceCurve));var C=l.halfFloatTexture;C&&h.max&&(m|=1<<20);var _=l.maxVertexUniforms,A=c.max+c.curves.length-32>_;In(wn)&&(A=!0),2===u&&(c.max=-1,h.index>0&&(h.max=-1)),A&&C&&f&&(d=1);var S=["-p:",a,m,c.index,c.max,h.index,h.max].join("+"),R={fragment:vr,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(d,"\n").concat(gr),shared:!0,cacheId:S,marcos:s,name:"particle#".concat(t.name)};return s.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",h.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",h.max]),{shader:R,vertex:c.index,fragment:h.index}}function Vn(t,e,r){var i,n=null===(i=t.cacheId)||void 0===i?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 zn=new H,Un=new H,Bn=function(){function e(e,r){var i;this.pointStart=[];var n=r.colorOverLifetime,o=r.colorOverTrail,a=r.maxTrailCount,s=r.opacityOverLifetime,u=void 0===s?Oi(1):s,l=r.widthOverTrail,c=r.name,h=r.occlusion,f=r.blending,p=r.maskMode,d=r.textureMap,m=void 0===d?[0,0,1,1]:d,y=r.texture,v=r.transparentOcclusion,g=r.minimumVertexDistance,x=r.lifetime,T=r.matrix,E=e.gpuCapability,b=E.detail,C=E.level,_=Math.max(r.pointCountPerTrail,2),A={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},S=b.maxVertexTextures>0,R=(null!==(i=e.renderer)&&void 0!==i?i:{}).env,O={},M=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",R===Qi]],L=a>64,I=0;n&&(M.push(["COLOR_OVER_LIFETIME",!0]),I|=1,O.uColorOverLifetime=Me.createWithData(e,w(n))),o&&(M.push(["COLOR_OVER_TRAIL",!0]),I|=4,O.uColorOverTrail=Me.createWithData(e,w(o))),L?(M.push(["ATTR_TRAIL_START",1]),I|=8):O.uTrailStart=new Float32Array(a),O.uOpacityOverLifetimeValue=u.toUniform(A);var P=l.toUniform(A);M.push(["VERT_CURVE_VALUE_COUNT",A.index],["VERT_MAX_KEY_FRAME_COUNT",A.max]),O.uVCurveValues=Ci.getAllData(A);var F={shader:{vertex:ve(M,xr,t.ShaderType.vertex,C),fragment:ve(M,vr,t.ShaderType.fragment,C),marcos:M,glslVersion:1===C?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#".concat(c),cacheId:"-t:+".concat(I,"+").concat(A.index,"+").concat(A.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},N=_*a*2,D=(_-1)*a,V=Float32Array.BYTES_PER_ELEMENT,z=12*V,U={attributes:{aColor:{size:4,stride:z,data:new Float32Array(12*N)},aSeed:{size:1,stride:z,offset:4*V,dataSource:"aColor"},aInfo:{size:3,stride:z,offset:5*V,dataSource:"aColor"},aPos:{size:4,stride:z,offset:8*V,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(N)},aDir:{size:3,data:new Float32Array(3*N)}},indices:{data:new Uint16Array(6*N)},drawCount:6*D,name:"trail#".concat(c),bufferUsage:le.DYNAMIC_DRAW};if(L)U.attributes.aTrailStart={size:1,data:new Float32Array(N)};else{var B=new Float32Array(N);U.attributes.aTrailStartIndex={size:1,data:B};for(var k=0;k<a;k++)for(var G=2*_,H=k*G,j=0;j<G;j++)B[H+j]=k}var Y=pe(f),W=Xe.create(e,F);W.blending=!0,W.depthMask=h,W.depthTest=!0,Te(W,p),ge(W,f);var Z=this.mesh=ur.create(e,{name:"MTrail_".concat(c),material:W,geometry:ir.create(e,U)}),q=null!=y?y:Me.createWithData(e);Object.keys(O).map((function(t){var e=O[t];if(e instanceof Me)W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){var r=[];r.push(new K(e[0],e[1],e[2],e[3])),r.push(new K(e[4],e[5],e[6],e[7])),W.setVector4Array(t,r)}else W.setVector4(t,K.fromArray(e))})),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",K.fromArray(P)),W.setVector2("uTexOffset",new X(0,0)),W.setVector4("uTextureMap",K.fromArray(m)),W.setVector4("uParams",new K(0,_-1,0,0)),W.setTexture("uMaskTex",q),W.setVector4("uColorParams",new K(y?1:0,+Y,0,+(h&&!v))),this.maxTrailCount=a,this.pointCountPerTrail=_,this.checkVertexDistance=g>0,this.minimumVertexDistance=Math.pow(g||.001,2),this.useAttributeTrailStart=L,this.lifetime=x,T&&(this.mesh.worldMatrix=T),this.geometry=Z.firstGeometry(),this.trailCursors=new Uint16Array(a)}return Object.defineProperty(e.prototype,"time",{get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)},enumerable:!1,configurable:!0}),e.prototype.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,zn);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var h=t*n+s,f=Hn(c,e),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,y=6*h,v=new Float32Array(6);v.set(f,0),v.set(f,3),o.setAttributeSubData("aDir",y,v),o.setAttributeSubData("aTime",2*h,new Float32Array([p,p]));var g=r.color||[1,1,1,1],x=new Float32Array(24),T=e.toArray();if(x.set(g,0),x.set(d,4),x[7]=0,x.set(T,8),x[11]=.5*m,x.set(g,12),x.set(d,16),x[19]=1,x.set(T,20),x[23]=-.5*m,o.setAttributeSubData("aColor",24*h,x),u>=0){var E=this.getTrailPosition(t,l,Un),b=new Float32Array(Hn(E,c,e)),C=6*(t*n+u);o.setAttributeSubData("aDir",C,b),o.setAttributeSubData("aDir",C+3,b);var _=t*n*2,A=new Uint16Array([2*u+_,2*u+1+_,2*s+_,2*s+_,2*u+1+_,2*s+1+_]),S=6*(t*a+(i-1)%a);o.setIndexSubData(S,A)}i=++this.trailCursors[t];var R=this.mesh.material,O=R.getVector4("uParams"),w=d[2];if(this.useAttributeTrailStart){for(var M=2*n,L=new Float32Array(M),I=0;I<M;I++)L[I]=w;o.setAttributeSubData("aTrailStart",t*L.length,L)}else{var P=R.getFloats("uTrailStart");null!=P&&(P[t]=w,R.setFloats("uTrailStart",P))}O&&(O.y=Math.max(O.y,i-1)-Math.max(0,i-n),R.setVector4("uParams",O))}},e.prototype.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=24*(t*i+e)+8,o=this.geometry.getAttributeData("aColor");return r.x=o[n],r.y=o[1+n],r.z=o[2+n],r}},e.prototype.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},e.prototype.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},e.prototype.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),this.trailCursors[t]=0}},e.prototype.getPointStartPos=function(t){return this.pointStart[t]},e.prototype.setPointStartPos=function(t,e){this.pointStart[t]=e},e.prototype.onUpdate=function(t){},e}(),kn=new H,Gn=new H,Xn=new H;function Hn(t,e,r){var i=kn;return t||r?(t?r?(Gn.subtractVectors(e,t).normalize(),Gn.subtractVectors(r,e),Xn.copyFrom(Gn).normalize(),i.addVectors(Gn,Xn)):i.subtractVectors(e,t):i.subtractVectors(r,e),i.normalize().toArray()):[0,0,0]}var jn=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return r(i,e),i.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:[Lt.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=[],p=[],d=0,m=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=[Lt.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=[Lt.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,v(h,t))}))})))})),f.forEach((function(e){var r,i,n=e.content;2===u&&(h.forEach((function(t){var e=o[t],r=n[t]||(n[t]={});Object.keys(e).forEach((function(i){if(e[i]&&!r[i]){var n=a[t]&&a[t][i]||0;r[i]=isNaN(n)?n:[Lt.CONSTANT,n]}}))})),o.positionOverLifetime.forceCurve&&(n.positionOverLifetime.forceTarget=!0),(o.rotationOverLifetime.x||o.rotationOverLifetime.y)&&(n.rotationOverLifetime.separateAxes=!0),o.sizeOverLifetime.y&&(n.sizeOverLifetime.separateAxes=!0));var f=Dn(e,l,s),y=f.shader,v=f.fragment,g=f.vertex;if(p.push(y),d=Math.max(d,v),m=Math.max(m,g),e.content.trails){var x=function(t,e,r,i,n){void 0===i&&(i="");var o=0,a=In(wn)?1:0,s=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",a],["ENV_EDITOR",i===Qi]],u={curves:[],index:0,max:0,lineSegCount:0,curveCount:0};return t.colorOverLifetime&&(s.push(["COLOR_OVER_LIFETIME",!0]),o|=1),t.colorOverTrail&&(s.push(["COLOR_OVER_TRAIL",!0]),o|=4),e>64&&(s.push(["ATTR_TRAIL_START",1]),o|=8),Fi(u,t.opacityOverLifetime),Fi(u,t.widthOverTrail),s.push(["VERT_CURVE_VALUE_COUNT",u.index],["VERT_MAX_KEY_FRAME_COUNT",u.max]),{vertex:xr,fragment:vr,marcos:s,shared:!0,name:"trail#"+r,cacheId:"-t:+".concat(o,"+").concat(u.index,"+").concat(u.max)}}(e.content.trails,e.content.options.maxCount,e.name,l,s);x.vertex=ve(null!==(r=x.marcos)&&void 0!==r?r:[],x.vertex,t.ShaderType.vertex,u),x.fragment=ve(null!==(i=x.marcos)&&void 0!==i?i:[],x.fragment,t.ShaderType.fragment,u),x.glslVersion=2===u?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,c.addShader(x)}})),p.forEach((function(e){var r,i;2===u?(Vn(e,m,d),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,e.vertex=ve(null!==(r=e.marcos)&&void 0!==r?r:[],e.vertex,t.ShaderType.vertex,u),e.fragment=ve(null!==(i=e.marcos)&&void 0!==i?i:[],e.fragment,t.ShaderType.fragment,u),c.addShader(e)})),2===u&&f.forEach((function(t){t.content.options.meshSlots=[m,d]})),Promise.resolve()},i}($r);var Yn=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=Wn(this.arc,this.arcMode,t)*D,r=Math.cos(e)*this.radius,i=Math.sin(e)*this.radius,n=new H(r,i,0),o=Math.tan(this.angle*D),a=n.clone().multiply(o);return a.z+=1,{position:n.multiply(St(0,1)),direction:a.normalize()}},t}();function Wn(t,e,r){if(e===Dt.RANDOM)t=St(0,t);else if(e===Dt.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===Dt.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);t*=Math.floor(i)%2?1-n:n}else e===Dt.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var Zn,qn=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=Wn(this.arc,this.arcMode,t)*D,r=new H(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),Kn=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=St(-this._d,this._d),r=St(-this._h,this._h);return{direction:new H(0,0,1),position:new H(e,r,0)}},t}(),Qn=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=Wn(this.arc,this.arcMode,t)*D,r=new H(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(e),s=new H;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}(),Jn=function(){function t(t){this._d=(t.width||1)/2,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Dt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):St(0,1);return{direction:new H(0,1,0),position:new H(this._d*(e-.5),0,0)}},t}(),$n=new Z,to=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=St(0,2*Math.PI),n=Wn(this.arc,this.arcMode,t)*D,o=$n.setFromRotationZ(n),a=new H(Math.cos(i),Math.sin(i),0),s=new H(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),eo=new Z,ro=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.getHorizontalAngle=function(){return St(-90,90)},t.prototype.generate=function(t){var e=Wn(this.arc,this.arcMode,t)*D,r=this.getHorizontalAngle()*D,i=this.radius,n=new H(Math.cos(r),0,Math.sin(r)),o=eo.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(i),direction:o}},t}(),io=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.getHorizontalAngle=function(){return St(0,90)},e}(ro),no=function(){function t(t){var e=t.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(e.anchors),this.width=t.width||1,this.height=t.height||1,this.block=e.block,this.arcMode=t.arcMode,this.random=k(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=e.length/2-1,i=Math.floor(Wn(r,this.arcMode,t)),n=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,o=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new H(n,o,0);return{position:new H(n*this.width,o*this.height,0),direction:a.normalize()}},t}(),oo=function(){function t(){}return t.prototype.generate=function(){return{position:new H,direction:new H}},t}(),ao=((Zn={})[yt.NONE]=oo,Zn[yt.CONE]=Yn,Zn[yt.SPHERE]=ro,Zn[yt.HEMISPHERE]=io,Zn[yt.CIRCLE]=qn,Zn[yt.DONUT]=to,Zn[yt.RECTANGLE]=Kn,Zn[yt.EDGE]=Jn,Zn[yt.RECTANGLE_EDGE]=Qn,Zn[yt.TEXTURE]=no,Zn);function so(t){if(!t)return new oo;var e=i({radius:1,arc:360,angle:0,arcMode:Dt.RANDOM},t),r=t.type,n=ao[r];if(!n)throw Error("invalid shape:"+r);var o=new n(e);if(r!==yt.NONE){var a=t,s=a.alignSpeedDirection,u=a.upDirection,l=void 0===u?[0,0,1]:u;o.alignSpeedDirection=s,o.upDirection=H.fromArray(l).normalize()}return o}function uo(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=Ro(o,t[o],t[o+1],a);else for(o=r-i;o>=e;o-=i)a=Ro(o,t[o],t[o+1],a);return a&&Eo(a,a.next)&&(Oo(a),a=a.next),a}function lo(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!Eo(i,i.next)&&0!==To(i.prev,i,i.next))i=i.next;else{if(Oo(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function co(t){var e=t.prev,r=t,i=t.next;if(To(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(go(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&To(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function ho(t,e,r,i){var n=t.prev,o=t,a=t.next;if(To(n,o,a)>=0)return!1;for(var s=n.x<o.x?n.x<a.x?n.x:a.x:o.x<a.x?o.x:a.x,u=n.y<o.y?n.y<a.y?n.y:a.y:o.y<a.y?o.y:a.y,l=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,c=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,h=yo(s,u,e,r,i),f=yo(l,c,e,r,i),p=t.prevZ,d=t.nextZ;p&&p.z>=h&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&go(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&To(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&go(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&To(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&go(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&To(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&go(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&To(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function fo(t,e){return t.x-e.x}function po(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===a)return r;var u,l=r,c=r.x,h=r.y,f=1/0;i=r;do{n>=i.x&&i.x>=c&&n!==i.x&&go(o<h?n:a,o,c,h,o<h?a:n,o,i.x,i.y)&&(u=Math.abs(o-i.y)/(n-i.x),Ao(i,t)&&(u<f||u===f&&(i.x>r.x||i.x===r.x&&mo(r,i)))&&(r=i,f=u)),i=i.next}while(i!==l);return r}(t,e),e){var r=So(e,t);lo(e,e.next),lo(r,r.next)}}function mo(t,e){return To(t.prev,t,e.prev)<0&&To(e.next,t,t.next)<0}function yo(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vo(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}function go(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 xo(t,e){return t.next.i!==e.i&&t.prev.i!==e.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&&bo(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Ao(t,e)&&Ao(e,t)&&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}(t,e)&&(To(t.prev,t,e.prev)||To(t,e.prev,e))||Eo(t,e)&&To(t.prev,t,t.next)>0&&To(e.prev,e,e.next)>0)}function To(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Eo(t,e){return t.x===e.x&&t.y===e.y}function bo(t,e,r,i){var n=_o(To(t,e,r)),o=_o(To(t,e,i)),a=_o(To(r,i,t)),s=_o(To(r,i,e));return n!==o&&a!==s||(!(0!==n||!Co(t,r,e))||(!(0!==o||!Co(t,i,e))||(!(0!==a||!Co(r,t,i))||!(0!==s||!Co(r,e,i)))))}function Co(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 _o(t){return t>0?1:t<0?-1:0}function Ao(t,e){return To(t.prev,t,t.next)<0?To(t,e,t.next)>=0&&To(t,t.prev,e)>=0:To(t,e,t.prev)<0||To(t,t.next,e)<0}function So(t,e){var r=new wo(t.i,t.x,t.y),i=new wo(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 Ro(t,e,r,i){var n=new wo(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 Oo(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 wo(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 Mo=0;function Lo(t,e,r,i){r=r||2,Mo=i||0;var n,o,a,s,u,l,c,h=e&&e.length,f=h?e[0]*r:t.length,p=uo(t,0,f,r,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(t,e,r,i){var n,o,a,s=[];for(n=0,o=e.length;n<o;n++)(a=uo(t,e[n]*i,n<o-1?e[n+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),s.push(vo(a));for(s.sort(fo),n=0;n<s.length;n++)po(s[n],r),r=lo(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=a=t[0],o=s=t[1];for(var m=r;m<f;m+=r)(u=t[m])<n&&(n=u),(l=t[m+1])<o&&(o=l),u>a&&(a=u),l>s&&(s=l);c=0!==(c=Math.max(a-n,s-o))?1/c:0}return Io(p,d,r,n,o,c),d}function Io(t,e,r,i,n,o,a){if(t){!a&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=yo(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)}(t,i,n,o);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?ho(t,i,n,o):co(t))e.push(s.i/r+Mo),e.push(t.i/r+Mo),e.push(u.i/r+Mo),Oo(t),t=u.next,l=u.next;else if((t=u)===l){a?1===a?Io(t=Po(lo(t),e,r),e,r,i,n,o,2):2===a&&Fo(t,e,r,i,n,o):Io(lo(t),e,r,i,n,o,1);break}}}function Po(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!Eo(n,o)&&bo(n,i,i.next,o)&&Ao(n,o)&&Ao(o,n)&&(e.push(n.i/r+Mo),e.push(i.i/r+Mo),e.push(o.i/r+Mo),Oo(i),Oo(i.next),i=t=o),i=i.next}while(i!==t);return lo(i)}function Fo(t,e,r,i,n,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&xo(a,s)){var u=So(a,s);return a=lo(a,a.next),u=lo(u,u.next),Io(a,e,r,i,n,o),void Io(u,e,r,i,n,o)}s=s.next}a=a.next}while(a!==t)}var No=2;function Do(t,e){for(var r=t.s,i=t.p,n=r[1],o=i[1],a=0,s=0;s<n.length;s++){a+=(T=n[s]).length-1}var u,l=new Float32Array(a*Ki),c=e.indexBase,h=void 0===c?0:c,f=e.uvTransform,p=0,d=0,m=0,y=1,v=1;f&&(d=f[0],m=f[1],u=f[4],y=u?f[3]:f[2],v=u?f[2]:f[3]);var g=[0,0],x=0===u?0:-Math.PI/2;for(s=0;s<n.length;s++)for(var T=n[s],E=o[s],b=o[s+1]||o[0],C=T,_=[0,0],A=0;A<C.length-1;A++){Uo(_,C[A],E,b,E[4],E[5],b[2],b[3]),R(_[0],_[1])}var S=Lo(Array.from(l),null,Ki,h);return{aPoint:l,index:new Uint16Array(S)};function R(t,e){l[p++]=t/2,l[p++]=e/2,f?(g[0]=t,g[1]=e,zo(g,g,x),l[p++]=d+(g[0]+1)/2*y,l[p++]=m+(g[1]+1)/2*v):(l[p++]=(t+1)/2,l[p++]=(e+1)/2),p+=No}}function Vo(t,e){for(var r=[],i=function(t){var e=[];return t.gs?t.gs.forEach((function(t){e.push({p:[Lt.SHAPE_POINTS,t.p],s:[Lt.SHAPE_SPLITS,t.s]})})):t.g?e.push({p:[Lt.SHAPE_POINTS,t.g.p],s:[Lt.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,o=0,a=0,s=0;s<i.length;s++){n+=(f=Do(i[s],{indexBase:n,uvTransform:e})).aPoint.length/5,r.push(f),o+=f.aPoint.length,a+=f.index.length}if(1===r.length)return r[0];for(var u=new Float32Array(o),l=new Uint16Array(a),c=(s=0,0),h=0;s<r[s];s++){var f=r[s];u.set(f.aPoint,c),c+=f.aPoint.length,l.set(f.index,h),h+=f.index.length}return{aPoint:u,index:l}}function zo(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}function Uo(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;return t[0]=l*r[0]+c*n+h*a+f*i[0],t[1]=l*r[1]+c*o+h*s+f*i[1],t}var Bo=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=i instanceof yi?i:Oi(i),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}return t.prototype.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},t.prototype.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},t.prototype.clone=function(){return new t(this)},t}(),ko=function(t){this.content=t},Go=function(){function t(t){this.sort=t,this.length=0}return t.prototype.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},t.prototype.insertNode=function(t,e){var r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},t.prototype.shiftNode=function(t){var e=new ko(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(this.sort(r.content,e.content)<=0))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}},t.prototype.pushNode=function(t){var e=new ko(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(this.sort(e.content,r.content)<=0))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}},t.prototype.removeNode=function(t){var e=this.first;if(this.length--,e===t)(r=this.first=e.next)&&(r.pre=null);else if((e=this.last)===t){var r;(r=this.last=e.pre)&&(r.next=null)}else if(t){var i=t.pre,n=t.next;i.next=n,n&&(n.pre=i)}t.pre=null,t.next=null},t.prototype.forEach=function(t,e){var r=this.first,i=0;if(r)do{t.call(e||this,r.content,i++)}while(r=r.next)},t.prototype.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}(),Xo=function(t){function e(e,r,i){var n=t.call(this,e)||this;n.name="ParticleSystemRenderer",n.particleMesh=new Pn(e,r),void 0!==i&&(n.trailMesh=new Bn(e,i));var 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}return r(e,t),e.prototype.start=function(){var t,e;this._priority=this.item.listIndex,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);try{for(var r=s(this.meshes),i=r.next();!i.done;i=r.next()){i.value.start()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new K(e,this.item.duration,0,0))},e.prototype.render=function(t){var e,r;try{for(var i=s(this.meshes),n=i.next();!n.done;n=i.next()){n.value.render(t)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.reset=function(){var t;this.particleMesh.clearPoints(),null===(t=this.trailMesh)||void 0===t||t.clearAllTrails()},e.prototype.updateTime=function(t,e){this.particleMesh.time=t,this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},e.prototype.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null===(e=this.trailMesh)||void 0===e||e.minusTime(t)},e.prototype.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},e.prototype.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null===(e=this.trailMesh)||void 0===e||e.mesh.setVisible(t)},e.prototype.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},e.prototype.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},e.prototype.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},e.prototype.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},e.prototype.hasTrail=function(){return void 0!==this.trailMesh},e.prototype.clearTrail=function(t){var e;null===(e=this.trailMesh)||void 0===e||e.clearTrail(t)},e.prototype.addTrailPoint=function(t,e,r){var i;null===(i=this.trailMesh)||void 0===i||i.addPoint(t,e,r)},e.prototype.setTrailStartPosition=function(t,e){var r;null===(r=this.trailMesh)||void 0===r||r.setPointStartPos(t,e)},e.prototype.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(ne),Ho=function(e){function i(r,i){var n=e.call(this,r)||this;return n.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)===Nt.removeParticle,ray:t})}}},i&&n.fromData(i),n}return r(i,e),Object.defineProperty(i.prototype,"timePassed",{get:function(){return this.lastUpdate-this.loopStartTime},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"lifetime",{get:function(){return this.timePassed/this.item.duration},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"particleCount",{get:function(){return this.particleLink.length},enumerable:!1,configurable:!0}),i.prototype.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]===Lt.CONSTANT_VEC3?e.add(i[1]):t=Oi(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.prototype.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.prototype.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.prototype.setVisible=function(t){this.renderer.setVisible(t)},i.prototype.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?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new K(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.prototype.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?void 0:n.toArray())||[1,1,1,1];o.setVector4("uOpacityOverLifetimeValue",new K(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.prototype.setParentTransform=function(t){},i.prototype.getTextures=function(){return this.renderer.getTextures()},i.prototype.start=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},i.prototype.stop=function(){this.ended=!0,this.started=!1},i.prototype.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 Go((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1},i.prototype.onUpdate=function(t){var e,r=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,n=this.options,o=this.loopStartTime,a=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var s=this.particleLink,c=(i-o)/this.item.duration,h=this.timePassed,f=!1,p=function(){r.trails&&!f&&(f=!0,s.forEach((function(t){var e=u(t,4),i=e[0],n=e[1],o=e[2],a=e[3];i<h?r.clearPointTrail(n):h>o&&r.updatePointTrail(n,c,a,o)})))};if(this.ended){if(this.item.endBehavior!==Pt.loop&&0===this.item.endBehavior){var d=s.last;d&&d.content[0]<this.lastUpdate&&(this.destoryed=!0)}}else{var m=this.item.duration,y=this.lifetime;if(h<m){var v=1/a.rateOverTime.getValue(y),g=Math.floor((h-this.lastEmitTime)/v),x=g,T=v/g,E=i,b=n.maxCount;this.updateEmitterTransform(h);for(var C=function(){var t=s.first;return r.emissionStopped||s.length===b&&t&&t.content[0]-o>h},_=0;_<x&&_<b&&!C();_++){(I=this.createPoint(y)).delay+=E+_*T,this.addParticle(I,b),this.lastEmitTime=h}for(var A=a.bursts,S=(null==A?void 0:A.length)-1,R=0;S>=0&&R<b&&!C();S--){var O=A[S],w=!O.disabled&&O.getGeneratorOptions(h,y);if(w){var M=a.burstOffsets[S],L=M&&M[w.cycleIndex]||[0,0,0];O.once&&this.removeBurst(S);for(_=0;_<w.count&&R<b&&!C();_++){var I;(I=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:_,burstCount:w.count}))).delay+=E,R++,(e=I.transform).translate.apply(e,l([],u(L),!1)),this.addParticle(I,b)}}}}else if(this.item.endBehavior===Pt.loop)p(),this.loopStartTime=i-m,this.lastEmitTime-=m,this.lastUpdate-=m,a.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=m,t[2]-=m,t[3].delay-=m})),this.renderer.minusTimeForLoop(m),this.onIterate(this);else{this.ended=!0,this.onEnd(this),4===this.item.endBehavior&&(this.frozen=!0)}}p()}},i.prototype.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.prototype.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.prototype.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],o=new H,a=!1;if(i&&i.content)do{var s=u(i.content,4),l=s[0],c=s[1];s[2];var h=s[3];if(!(l>this.timePassed))break;var f=this.getPointPosition(h),p=t.ray,d=!1;p&&(d=!!p.intersectSphere({center:f,radius:t.radius},o)),d&&(t.removeParticle&&(r.removeParticlePoint(c),this.clearPointTrail(c),e.removeNode(i),i.content=[0]),n.push(f),t.multiple||(a=!0))}while((i=i.pre)&&!a);return n}},i.prototype.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.prototype.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.prototype.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,o=t.gravity,a=void 0===o?[]:o,s=this.options.forceTarget,u=this.lastUpdate-n,l=new H,c=H.fromArray(a);e.assignWorldTRS(l);var h=oi(new H,this.options,c,u,i,l,r);if(s){var f=s.target||[0,0,0],p=s.curve.getValue(u/i),d=1-p;h.x=h.x*d+f[0]*p,h.y=h.y*d+f[1]*p,h.z=h.z*d+f[2]*p}return h},i.prototype.onEnd=function(t){},i.prototype.onIterate=function(t){},i.prototype.initPoint=function(t){var e=this.options,r=this.lifetime,i=this.shape,n=e.startSpeed.getValue(r),o=e.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),a=o.transformPoint(t.position,new H),s=new Ui({position:a,valid:!0}),u=t.direction;if(u=o.transformNormal(u,jo).normalize(),e.startTurbulence&&e.turbulence){for(var l=0;l<3;l++)Ko.setElement(l,e.turbulence[l].getValue(r));Qo.setFromVector3(Ko.negate()),$o.setFromEuler(Qo).transformNormal(u).normalize()}var c,h=Zo,f=qo;i.alignSpeedDirection?(f.copyFrom(u),this.upDirectionWorld||(i.upDirection?this.upDirectionWorld=i.upDirection.clone():this.upDirectionWorld=H.Z.clone(),o.transformNormal(this.upDirectionWorld)),h.crossVectors(f,this.upDirectionWorld).normalize(),h.isZero()&&h.set(1,0,0)):(h.set(1,0,0),f.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((c=Jo)[0]=p.animationDelay.getValue(r),c[1]=p.animationDuration.getValue(r),c[2]=p.cycles.getValue(r));var d=Wo;e.start3DRotation?d.set(e.startRotationX.getValue(r),e.startRotationY.getValue(r),e.startRotationZ.getValue(r)):e.startRotation?d.set(0,0,e.startRotation.getValue(r)):d.set(0,0,0),s.setRotation(d.x,d.y,d.z);var m=e.startColor.getValue(r);3===m.length&&(m[3]=1);var y=Yo;if(e.start3DSize)y.x=e.startSizeX.getValue(r),y.y=e.startSizeY.getValue(r);else{var v=e.startSize.getValue(r),g=e.sizeAspect.getValue(r);y.x=v,y.y=0===g?0:v/g}var x=u.clone();if(x.multiply(n),!e.particleFollowParent){var T=new H;this.transform.assignWorldTRS(void 0,void 0,T),y.x*=T.x,y.y*=T.y}return s.setScale(y.x,y.y,1),{size:y,vel:x,color:m,delay:e.startDelay.getValue(r),lifetime:e.startLifetime.getValue(r),uv:ea(this.uvs,!0),gravity:e.gravity,sprite:c,dirY:f,dirX:h,transform:s}},i.prototype.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&e instanceof Array){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return-1},i.prototype.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.prototype.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.prototype.stopParticleEmission=function(){this.emissionStopped=!0},i.prototype.resumeParticleEmission=function(){this.emissionStopped=!1},i.prototype.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},i.prototype.fromData=function(t){var r,i,n,o,a,s;e.prototype.fromData.call(this,t);var u=t;this.props=u,this.destoryed=!1;var l,c=u.options,h=u.positionOverLifetime,f=u.shape,p=h.gravityOverLifetime,d=ai(h.gravity),m=u.textureSheetAnimation,y=m?{animationDelay:Oi(m.animationDelay||0),animationDuration:Oi(m.animationDuration||1),cycles:Oi(m.cycles||1),animate:m.animate,col:m.col,row:m.row,total:m.total||m.col*m.row}:void 0,v=!!(f&&f.turbulenceX||f.turbulenceY||f.turbulenceZ);v&&(l=[Oi(null!==(r=f.turbulenceX)&&void 0!==r?r:0),Oi(null!==(i=f.turbulenceY)&&void 0!==i?i:0),Oi(null!==(n=f.turbulenceZ)&&void 0!==n?n:0)]),this.name="ParticleSystem",this.shape=so(f),this.emission={rateOverTime:Oi(u.emission.rateOverTime),burstOffsets:ta(null!==(o=u.emission.burstOffsets)&&void 0!==o?o:[]),bursts:(u.emission.bursts||[]).map((function(t){return new Bo(t)}))},this.textureSheetAnimation=y;var g,x=u.renderer||{},T={},E=u.rotationOverLifetime;E&&(T.asRotation=!!E.asRotation,T.z=E.z?Oi(E.z):Oi(0),E.separateAxes&&(T.x=E.x&&Oi(E.x),T.y=E.y&&Oi(E.y))),h.forceTarget&&(g={target:h.target||[0,0,0],curve:Oi(h.forceCurve||[Lt.LINE,[[0,0],[1,1]]])});var b={x:h.linearX&&Oi(h.linearX||0),y:h.linearY&&Oi(h.linearY||0),z:h.linearZ&&Oi(h.linearZ||0),asMovement:h.asMovement},C={x:h.orbitalX&&Oi(h.orbitalX),y:h.orbitalY&&Oi(h.orbitalY),z:h.orbitalZ&&Oi(h.orbitalZ),center:h.orbCenter,asRotation:h.asRotation},_=u.sizeOverLifetime||{},A=u.colorOverLifetime,S=(null==_?void 0:_.separateAxes)?{separateAxes:!0,x:Oi(_.x),y:Oi(_.y)}:{separateAxes:!1,x:Oi(("size"in _?_.size:_.x)||1)};x.anchor=x.anchor||[0,0];var R=X.fromArray(x.anchor);this.options={particleFollowParent:!!c.particleFollowParent,startLifetime:Oi(c.startLifetime),startDelay:Oi(c.startDelay||0),startSpeed:Oi(h.startSpeed||0),startColor:Oi(c.startColor),looping:!1,maxCount:null!==(a=c.maxCount)&&void 0!==a?a:0,gravityModifier:Oi(p||0),gravity:d,start3DSize:!!c.start3DSize,startTurbulence:v,turbulence:l,speedOverLifetime:h.speedOverLifetime&&Oi(h.speedOverLifetime),linearVelOverLifetime:b,orbitalVelOverLifetime:C,forceTarget:g},c.startRotationZ&&(this.options.startRotation=Oi(c.startRotationZ||0)),(c.startRotationX||c.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=Oi(c.startRotationX||0),this.options.startRotationY=Oi(c.startRotationY||0),this.options.startRotationZ=Oi(c.startRotationZ||0)),c.start3DSize?(this.options.startSizeX=Oi(c.startSizeX),this.options.startSizeY=Oi(c.startSizeY)):(this.options.startSize=Oi(c.startSize),this.options.sizeAspect=Oi(c.sizeAspect||1));var O={meshSlots:c.meshSlots,name:this.name,matrix:Z.IDENTITY,filter:u.filter,shaderCachePrefix:"",renderMode:x.renderMode||Et.BILLBOARD,side:x.side||dt.DOUBLE,gravity:d,blending:x.blending||pt.ALPHA,rotationOverLifetime:T,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:y,occlusion:!!x.occlusion,transparentOcclusion:!!x.transparentOcclusion,maxCount:c.maxCount,mask:x.mask,maskMode:null!==(s=x.maskMode)&&void 0!==s?s:mt.NONE,forceTarget:g,diffuse:x.texture,sizeOverLifetime:S,anchor:R};if(A){var w=A.color,M=A.opacity;O.colorOverLifetime={},M&&(O.colorOverLifetime.opacity=Oi(A.opacity)),w&&(w[0]===Lt.GRADIENT_COLOR?O.colorOverLifetime.color=A.color[1]:w[0]===Lt.RGBA_COLOR?O.colorOverLifetime.color=Me.createWithData(this.engine,{data:new Uint8Array(w[1]),width:1,height:1}):w instanceof Me&&(O.colorOverLifetime.color=w))}var L,I=[],P=[0,0,1,1];if(u.splits){var F=u.splits[0];P=(L=F[4])?[F[0],F[1],F[3],F[2]]:[F[0],F[1],F[2],F[3]]}if(y&&!y.animate)for(var N=L?y.row:y.col,D=L?y.col:y.row,V=y.total||N*D,z=0,U=0;U<N;U++)for(var B=0;B<D&&z<V;B++,z++)I.push([U*P[2]/N+P[0],B*P[3]/D+P[1],P[2]/N,P[3]/D]);else I.push(P);this.uvs=I,O.textureFlip=L;var k,G=u.trails;G&&(this.trails={lifetime:Oi(G.lifetime),dieWithParticles:!1!==G.dieWithParticles,sizeAffectsWidth:!!G.sizeAffectsWidth,sizeAffectsLifetime:!!G.sizeAffectsLifetime,inheritParticleColor:!!G.inheritParticleColor,parentAffectsPosition:!!G.parentAffectsPosition},k={name:"Trail",matrix:Z.IDENTITY,minimumVertexDistance:G.minimumVertexDistance||.02,maxTrailCount:c.maxCount,pointCountPerTrail:Math.round(G.maxPointPerTrail)||32,blending:G.blending,texture:G.texture,opacityOverLifetime:Oi(G.opacityOverLifetime||1),widthOverTrail:Oi(G.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!G.occlusion,transparentOcclusion:!!G.transparentOcclusion,textureMap:G.textureMap,mask:x.mask,maskMode:x.maskMode},G.colorOverLifetime&&G.colorOverLifetime[0]===Lt.GRADIENT_COLOR&&(k.colorOverLifetime=G.colorOverLifetime[1]),G.colorOverTrail&&G.colorOverTrail[0]===Lt.GRADIENT_COLOR&&(k.colorOverTrail=G.colorOverTrail[1])),this.renderer=new Xo(this.engine,O,k),this.meshes=this.renderer.meshes;var H=u.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(Cn).createTrack(dn).createClip(ia)},i=n([Jt(t.DataType.ParticleSystem)],i)}(ee),jo=new H,Yo=new X,Wo=new q,Zo=new H,qo=new H,Ko=new H,Qo=new q,Jo=[0,0,0],$o=new Z;function ta(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var r=t instanceof Array,i=r?t[0]:t.index,n=e[i];n||(n=e[i]=[]),r?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function ea(t,e){var r=Math.floor(Math.random()*t.length),i=t[r];return e||t.splice(r,1),i}var ra,ia=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.onPlayablePlay=function(){this.particleSystem=this.bindingItem.getComponent(Ho),this.particleSystem&&(this.particleSystem.name=this.bindingItem.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform())},e.prototype.processFrame=function(t){var e=this.particleSystem;e&&(this.bindingItem.parent,e.setVisible(!0),e.onUpdate(t))},e}(fn),na=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}($r),oa=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=void 0===e?100:e,i=t.textWidth,n=void 0===i?100:i,o=t.textOverflow,a=void 0===o?kt.display:o,s=t.textBaseline,u=void 0===s?Gt.top:s,l=t.textAlign,c=void 0===l?Xt.left:l,h=t.text,f=t.letterSpace,p=void 0===f?0:f,d=t.autoWidth,m=void 0!==d&&d,y=t.fontSize,v=t.lineHeight,g=void 0===v?y:v,x=y+p;this.autoWidth=m,this.maxTextWidth=h.length*x,this.width=n,this.height=r,this.letterSpace=p,this.overFlow=a,this.textBaseline=u,this.textAlign=c,this.lineHeight=g}return t.prototype.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},t.prototype.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},t.prototype.setSize=function(t,e){this.width=t,this.height=e},t}(),aa=function(t){var e,r,i,n,o,a;this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var s=t.textColor,u=void 0===s?[1,1,1,1]:s,l=t.fontSize,c=void 0===l?40:l,h=t.outline,f=t.shadow,p=t.fontWeight,d=void 0===p?"normal":p,m=t.fontStyle,y=void 0===m?"normal":m,v=t.fontFamily,g=void 0===v?"sans-serif":v;this.textColor=u,this.textWeight=d,this.fontStyle=y,this.fontFamily=g,this.fontSize=c,h&&(this.isOutlined=!0,this.outlineColor=null!==(e=h.outlineColor)&&void 0!==e?e:[1,1,1,1],this.outlineWidth=null!==(r=h.outlineWidth)&&void 0!==r?r:1,this.fontOffset+=this.outlineWidth),f&&(this.hasShadow=!0,this.shadowBlur=null!==(i=f.shadowBlur)&&void 0!==i?i:2,this.shadowColor=null!==(n=f.shadowColor)&&void 0!==n?n:[0,0,0,1],this.shadowOffsetX=null!==(o=f.shadowOffsetX)&&void 0!==o?o:0,this.shadowOffsetY=null!==(a=f.shadowOffsetY)&&void 0!==a?a:0),this.fontStyle!==jt.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},sa=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,p=0,d=!1;for(f=0;f<s;++f){for(var m=0;m<h;m+=4)if(255!==l[p+m]){d=!0;break}if(d)break;p+=h}for(r.ascent=s-f,p=c-h,d=!1,f=u;f>s;--f){for(m=0;m<h;m+=4)if(255!==l[p+m]){d=!0;break}if(d)break;p-=h}return r.descent=f-s,r.fontSize=r.ascent+r.descent,t._fonts[e]=r,r},Object.defineProperty(t,"_canvas",{get:function(){var e;return In(Mn)?(e=window._createOffscreenCanvas(10,10),t.__canvas=e):t.__canvas||((e=document.createElement("canvas")).width=e.height=10,t.__canvas=e),t.__canvas},enumerable:!1,configurable:!0}),t._fonts={},t.METRICS_STRING="|ÉqÅ",t.BASELINE_SYMBOL="M",t.BASELINE_MULTIPLIER=1.4,t.HEIGHT_MULTIPLIER=2,t}(),ua=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];t.QTextWrapMode=void 0,(ra=t.QTextWrapMode||(t.QTextWrapMode={}))[ra.Default=0]="Default",ra[ra.Clip=1]="Clip",ra[ra.Ellipsis=2]="Ellipsis";var la=function(){function e(e,r){var i,n,o,a,s,u,l,c,h,f;this.left=0,this.top=0,this.fontSize=48,this.fontFamily="Arial",this.color="black",this.letterSpacing=0,this.maxLineWidth=0,this.wrap=t.QTextWrapMode.Clip,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=e,this.left=null!==(i=r.left)&&void 0!==i?i:0,this.top=null!==(n=r.top)&&void 0!==n?n:0,this.maxLineWidth=null!==(o=r.maxWidth)&&void 0!==o?o:0,this.letterSpacing=null!==(a=r.letterSpacing)&&void 0!==a?a:0,this.originX="left",this.originY="top",this.color=null!==(s=r.color)&&void 0!==s?s:"black",this.fontFamily=null!==(u=r.fontFamily)&&void 0!==u?u:"Arial",this.fontSize=null!==(l=r.fontSize)&&void 0!==l?l:48,this.wrap=null!==(c=r.wrap)&&void 0!==c?c:t.QTextWrapMode.Clip,this.fontStyle=null!==(h=r.fontStyle)&&void 0!==h?h:"normal",this.textAlign="left",this.textBaseline="alphabetic",this.fontWeight="normal",this.angle=null!==(f=r.angle)&&void 0!==f?f:0,this.name=r.name||""}return e.prototype.update=function(){this.updateDimension()},e.prototype.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.prototype.init=function(t){this.viewer=t,this.updateDimension()},e.prototype.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.prototype.updateDimension=function(){var t=this.viewer.renderContext;this.configTextStyle(t),this.configTextLayout(t);var e=this.getFontDesc();this.fontProperties=sa.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.prototype.configTextStyle=function(t){t.font=this.getFontDesc(),t.fillStyle=this.color},e.prototype.getFontDesc=function(){for(var t="number"==typeof this.fontSize?"".concat(this.fontSize,"px"):this.fontSize,e=this.fontFamily.split(","),r=e.length-1;r>=0;r--){var i=e[r].trim();/([\"\'])[^\'\"]+\1/.test(i)||ua.includes(i)||(i='"'.concat(i,'"')),e[r]=i}return e.push("Arial, Helvetica, sans-serif"),"".concat(this.fontStyle," ").concat(this.fontVariant," ").concat(this.fontWeight," ").concat(t," ").concat(e.join(","))},e.prototype.configTextLayout=function(t){t.textBaseline=this.textBaseline,t.textAlign=this.textAlign},e.prototype.setRenderTransform=function(t){t.scale(this.scaleX,this.scaleY),t.translate(this.left,this.top)},e.prototype.renderText=function(t){this.drawCharsInTextBox(t,{min:[0,0],max:[0+this.width,0+this.height]})},e.prototype.drawCharsInTextBox=function(e,r){var i=this.chars,n=0;if(i.length>0){var o=i[i.length-1];n=o.left+o.width}var a=r.max[0]-r.min[0],s=0;"left"===this.textAlign?s=0:"center"===this.textAlign?s=.5*(a-n):"right"===this.textAlign&&(s=a-n),this.addOffsetToChars(i,s);var u=this.cloneChars(this.clipCharsWithTextBox(i,r)),l=u;this.wrap===t.QTextWrapMode.Ellipsis&&0===(l=this.replaceCharWithEllipsis(e,u,r)).length&&0!==i.length&&this.addEllipsisToChars(e,l,r),this.drawCharsFromLeft(e,l)},e.prototype.addEllipsisToChars=function(t,e,r){var i,n,o,a=t.measureText(this.ellipsis).width;if("left"===this.textAlign)e.push({char:this.ellipsis,left:r.min[0],top:0,width:a,heigh:null!==(i=this.height)&&void 0!==i?i: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]-a,top:0,width:a,heigh:null!==(n=this.height)&&void 0!==n?n:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else{var s=.5*(r.max[0]+r.min[0]);e.push({char:this.ellipsis,left:s-.5*a,top:0,width:a,heigh:null!==(o=this.height)&&void 0!==o?o:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0})}},e.prototype.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.prototype.addOffsetToChars=function(t,e){return t.forEach((function(t){t.left+=e})),t},e.prototype.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.prototype.cloneChars=function(t){return t.map((function(t){return i({},t)}))},e.prototype.replaceCharWithEllipsis=function(t,e,r){var n=t.measureText(this.ellipsis).width;if(e.length>0){if(0!==e[0].index)(o=i({},e[0])).char=this.ellipsis,o.isEllipsis=!0,o.width=n,e=this.findEllipsisPositionAndReplaceCharsFromLeft(e,o,r);var o,a=e.length-1,s=this.chars.length;if(e[a].index!==s-1)(o=i({},e[0])).char=this.ellipsis,o.isEllipsis=!0,o.width=n,e=this.findEllipsisPositionAndReplaceCharsFromRight(e,o,r)}return e},e.prototype.findEllipsisPositionAndReplaceCharsFromLeft=function(t,e,r){for(var i=0,n=0;n<t.length;++n){var o=t[n];if(i=n,o.left+o.width-e.width>=r.min[0])break}var a=t[i];e.left=a.left+a.width-e.width;for(n=0;n<i+1;++n)t.shift();return[e].concat(t)},e.prototype.findEllipsisPositionAndReplaceCharsFromRight=function(t,e,r){for(var i=t.length-1,n=i;n>=0;--n){if(i=n,t[n].left+e.width<=r.max[0])break}e.left=t[i].left;for(n=t.length-1;n>=i;--n)t.pop();return t.concat([e])},e.prototype.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.prototype.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)},e}(),ca=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="".concat(e*this.scaleX,"px"),a.style.height="".concat(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)}return t.prototype.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="".concat(t*this.scaleX,"px"),this.renderCanvas.style.height="".concat(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)},t.prototype.clearText=function(){this.textList=[]},t.prototype.clearCanvasWithContext=function(t){t.clearRect(0,0,this.width,this.height)},t.prototype.clearCanvas=function(){this.clearCanvasWithContext(this.renderContext)},t.prototype.addObject=function(t){t.init(this),this.textList.push(t)},t.prototype.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 ha(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 ".concat(t," fail")))})),n.open((null==e?void 0:e.method)||"get",t),n.send(null==e?void 0:e.data)}))}function fa(t,e,r,i,n){return o(this,void 0,void 0,(function(){var o,s,u,l,c,h,f,p,d,m;return a(this,(function(a){switch(a.label){case 0:return o={},s=[],i=i||{},r=r||{},e.asImage?(u=e.content.replace(/\$/g,""),l=r[u]||e.variables[u],c=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},l?[2,_e(l).then(c)]:[2,pa(t).then(c)]):(h=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=i instanceof Array,a=n?i[0]:i;s.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)?ha(t,{responseType:"blob"}).then(da,e):Promise.resolve(t)}}(a,n&&i[1]).then((function(e){return o[t]=e})))}else o[t]=i})),[4,Promise.all(s)]);case 1:return a.sent(),[4,_e(t)];case 2:return f=a.sent(),p=e.content.replace(/\$([\w_]+)\$/g,(function(t,e){return o[e]})).replace('width="'.concat(e.width,'px"'),'width="'.concat(e.width*h,'px"')).replace('height="'.concat(e.height,'px"'),'height="'.concat(e.height*h,'px"')),[4,_e("data:image/svg+xml,".concat(encodeURIComponent(p)))];case 3:return d=a.sent(),(m=(null==i?void 0:i.canvas)||document.createElement("canvas")).width=f.width*h,m.height=f.height*h,[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(f,0,0,f.width,f.height,0,0,m.width,m.height),i.drawImage(d,0,0,d.width,d.height,(e.x||0)*h,(e.y||0)*h,e.width*h/e.backgroundWidth*f.width,e.height*h/e.backgroundHeight*f.height),t(m)}))]}}))}))}function pa(t){return ht(t)?_e(t):Promise.resolve(t)}function da(t){return new Promise((function(e,r){var i=new FileReader;i.readAsDataURL(t),i.onload=function(){e(i.result)},i.onerror=r}))}var ma=["serif","sans-serif","monospace","courier"],ya=800,va=600,ga=new Map,xa=new(function(){function t(){this.elements=[]}return t.prototype.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements=[]},t.prototype.getCanvas=function(){if(this.elements.length)return this.elements.shift();if(In(Mn))return window._createOffscreenCanvas(10,10);var t=document.createElement("canvas");return t.getContext("2d",{willReadFrequently:!0}),t},t.prototype.saveCanvas=function(t){t.width=t.height=1,this.elements.length<3?v(this.elements,t):t.remove()},t}());function Ta(t,e){var r,i,n;if(null===(r=null==t?void 0:t.background)||void 0===r?void 0:r.name){var o=t.background.name;e&&e[o]?n=e[o]:(null===(i=t.background)||void 0===i?void 0:i.url)&&(n=t.background.url)}return n}function Ea(e,r,n,s,u){var l;return o(this,void 0,void 0,(function(){var o,c,h,f,p,d,m,y,v,g,x;return a(this,(function(a){switch(a.label){case 0:if(!r)throw Error("image not provided");return o=(null==u?void 0:u.templateScale)||1,c=o,h=o,f=r,p=r.width,d=r.height,n?(p=n.width,d=n.height,r.width===p&&r.height===d||(c*=r.width/n.width,h*=r.height/n.height),(m=Ta(n,s))&&m!==r.src?ht(m)?[4,_e(m)]:[3,2]:[3,4]):[3,5];case 1:return y=a.sent(),[3,3];case 2:y=m,a.label=3;case 3:f=y,a.label=4;case 4:(v=n.content)&&(g=function(e,r,i){var n=e.fonts,o=[];return e.texts.forEach((function(a){var s,u=a.t,l=a.x,c=a.y,h={weight:400,family:"serif",size:48,style:jt.normal};void 0!==a.f&&(h=n[a.f]);var f=a.n;f&&r&&r.hasOwnProperty(f)&&(u="".concat(r[f]));var p=new la(u,{left:l,top:c,fontSize:h.size,fontFamily:h.family,fontWeight:"".concat(h.weight),fontStyle:"normal",name:f});if(void 0!==a.r&&(p.angle=a.r*Math.PI/180),p.active=null!==(s=null==i?void 0:i.debug)&&void 0!==s&&s,void 0!==a.w&&(p.width=a.w),void 0!==h.letterSpace&&(p.letterSpacing=h.letterSpace),a.of===kt.display?p.wrap=t.QTextWrapMode.Default:a.of===kt.clip?p.wrap=t.QTextWrapMode.Clip:a.of===kt.ellipsis&&(p.wrap=t.QTextWrapMode.Ellipsis),void 0!==a.c){var d=e.colors[a.c][1],m=1;void 0!==d[3]&&(m=d[3]/255),p.color="rgba(".concat(d[0],", ").concat(d[1],", ").concat(d[2],", ").concat(m,")")}a.a===Xt.left?p.textAlign="left":a.a===Xt.middle?p.textAlign="center":a.a===Xt.right&&(p.textAlign="right"),h.style===jt.normal?p.fontStyle="normal":h.style===jt.italic?p.fontStyle="italic":h.style===jt.oblique&&(p.fontStyle="oblique"),void 0!==h.weight&&(p.fontWeight=String(h.weight)),(null==i?void 0:i.borderColor)&&(p.borderColor=i.borderColor),void 0!==(null==i?void 0:i.borderWidth)&&(p.borderWidth=i.borderWidth),o.push(p)})),o}(v,s,i(i({},u),{scaleX:c,scaleY:h})),g.forEach((function(t){e.addObject(t)}))),a.label=5;case 5:return e.flipY=null!==(l=null==u?void 0:u.flipY)&&void 0!==l&&l,e.initDimension(p,d,c,h),e.background=f,e.render(),(x=null==u?void 0:u.textLayouts)&&(x.length=0,e.textList.forEach((function(t){var e=t.getLayout(),r={x:e.x,y:e.y,width:e.width,height:e.height};x.push(r)}))),[2]}}))}))}function ba(t){return o(this,void 0,void 0,(function(){var e,r,i;return a(this,(function(n){switch(n.label){case 0:if(!t.content||!t.content.fonts)return[3,4];e=t.content.fonts,r=function(t){var r,i,n,o,s;return a(this,(function(a){switch(a.label){case 0:return r=e[t].family,i=e[t].url,n=!1,ma.includes(r)?n=!0:void 0!==document.fonts&&document.fonts.forEach((function(t){t.family===r&&(n=!0)})),n||void 0===i||""===i?[3,2]:(o="url(".concat(i,")"),void 0===document.fonts?[3,2]:[4,(s=new FontFace("".concat(r),o)).load()]);case 1:a.sent(),document.fonts.add(s),a.label=2;case 2:return[2]}}))},i=0,n.label=1;case 1:return i<e.length?[5,r(i)]:[3,4];case 2:n.sent(),n.label=3;case 3:return++i,[3,1];case 4:return[2]}}))}))}function Ca(t,e,r,n,s){return o(this,void 0,void 0,(function(){var o,u,l;return a(this,(function(a){switch(a.label){case 0:return o=i(i({},n),{flipY:s}),u=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=ga.get(r.canvas))){var a=new ca(r.canvas,t,e,n,n,o);ga.set(r.canvas,a),i=a}}else{var s=xa.getCanvas();i=new ca(s,ya,va,n,n,o)}return i}(ya,ya,o),void 0===e?[3,2]:[4,ba(e)];case 1:a.sent(),a.label=2;case 2:return u.clearText(),"string"!=typeof t?[3,5]:[4,_e(t)];case 3:return l=a.sent(),[4,Ea(u,l,e,r,o)];case 4:return a.sent(),[2,u.renderCanvas];case 5:return[4,Ea(u,t,e,r,o)];case 6:return a.sent(),[2,u.renderCanvas]}}))}))}function _a(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return 2===e.v?[2,Ca(t,e,r,{templateScale:null==i?void 0:i.templateScale,toData:!0},n)]:[2,fa(t,e,r,i,n)]}))}))}var Aa=function(e){function i(t,r){var i=e.call(this,t,r)||this;if(i.isDirty=!0,i.canvas=xa.getCanvas(),xa.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),!r)return i;var n=r.options;return i.textStyle=new aa(n),i.textLayout=new oa(n),i.text=n.text,i.updateTexture(),i}return r(i,e),i.prototype.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}},i.prototype.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},i.prototype.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},i.prototype.setText=function(t){this.text!==t&&(this.text=t,this.isDirty=!0)},i.prototype.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},i.prototype.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},i.prototype.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},i.prototype.setFontFamily=function(t){this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0)},i.prototype.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},i.prototype.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},i.prototype.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},i.prototype.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},i.prototype.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},i.prototype.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},i.prototype.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},i.prototype.update=function(t){e.prototype.update.call(this,t),this.updateTexture()},i.prototype.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(".concat(e.textColor[0],", ").concat(e.textColor[1],", ").concat(e.textColor[2],", ").concat(e.textColor[3],")");for(var u=[],l=(s-a)/3,c=0,h=r.getOffsetY(e)+l,f=[],p=[],d=0;d<this.char.length;d++){var m=this.char[d],y=t.measureText(m);((c+=r.letterSpace*i)+y.width>n&&d>0||"\n"===m)&&(u.push({y:h,width:c,chars:f,charOffsetX:p}),c=0,h+=s,f=[],p=[]),"\n"!==m&&(f.push(m),p.push(c),c+=y.width)}u.push({y:h,width:c,chars:f,charOffsetX:p}),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",Me.createWithData(this.engine,{data:new Uint8Array(v.data),width:v.width,height:v.height},{flipY:!0,magFilter:le.LINEAR,minFilter:le.LINEAR,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE})),this.isDirty=!1}},i.prototype.fromData=function(t){e.prototype.fromData.call(this,t);var r=t.options;this.textStyle=new aa(r),this.textLayout=new oa(r),this.text=r.text,this.updateTexture()},i.prototype.getFontDesc=function(){var t=this.textStyle,e="".concat((t.fontSize*t.fontScale).toString(),"px ");return ma.includes(t.fontFamily)?e+=t.fontFamily:e+='"'.concat(t.fontFamily,'"'),t.textWeight!==Ht.normal&&(e="".concat(t.textWeight," ").concat(e)),t.fontStyle!==jt.normal&&(e="".concat(t.fontStyle," ").concat(e)),e},i.prototype.setupOutline=function(){var t=this.context,e=this.textStyle;t.strokeStyle="rgba(".concat(255*e.outlineColor[0],", ").concat(255*e.outlineColor[1],", ").concat(255*e.outlineColor[2],", ").concat(e.outlineColor[3],")"),t.lineWidth=2*e.outlineWidth},i.prototype.setupShadow=function(){var t=this.context,e=this.textStyle;t.shadowColor="rgba(".concat(255*e.shadowColor[0],", ").concat(255*e.shadowColor[1],", ").concat(255*e.shadowColor[2],", ").concat(e.shadowColor[3],")"),t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=-e.shadowOffsetY},i=n([Jt(t.DataType.TextComponent)],i)}(On),Sa=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e}($r),Ra=1,Oa=function(e){function i(t){var r=e.call(this,t)||this;return r.worldMatrix=Z.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"+Ra++,r.name="<unnamed>",r._priority=0,r}return r(i,e),Object.defineProperty(i.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),i.prototype.setVisible=function(t){this.visible=t},i.prototype.start=function(){this.item.getHitTestParams=this.getHitTestParams},i.prototype.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.prototype.getVisible=function(){return this.visible},i.prototype.firstGeometry=function(){return this.geometry},i.prototype.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},i.prototype.getBoundingBox=function(){var e,r,i=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);var n=[];try{for(var o=s(this.triangles),a=o.next();!a.done;a=o.next()){var u=a.value;n.push({p0:u.p0,p1:u.p1,p2:u.p2})}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n.forEach((function(t){t.p0=i.transformPoint(t.p0,new H),t.p1=i.transformPoint(t.p1,new H),t.p2=i.transformPoint(t.p2,new H)})),{type:t.HitTestType.triangle,area:n}},i.prototype.fromData=function(t){e.prototype.fromData.call(this,t),this.material=this.materials[0]},i.prototype.toData=function(){this.taggedProperties.id=this.guid},i.prototype.dispose=function(t){this.destroyed||(this.destroyed=!0,e.prototype.dispose.call(this))},n([Qt()],i.prototype,"geometry",void 0),i=n([Jt(t.DataType.EffectComponent)],i)}(ne);var wa,Ma=function(e){function i(t,r){var i=e.call(this,t)||this;return i.children=[],i.transform=new Ui,i.duration=0,i.start=0,i.ended=!1,i.delaying=!0,i.type=Tt.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(Cn),r&&i.fromData(r),i}var o;return r(i,e),o=i,i.isComposition=function(t){return t.type===Tt.composition},i.isSprite=function(t){return t.type===Tt.sprite},i.isParticle=function(t){return t.type===Tt.particle},i.isNull=function(t){return t.type===Tt.null},i.isTree=function(t){return t.type===Tt.tree},i.isCamera=function(t){return t.type===Tt.camera},i.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},Object.defineProperty(i.prototype,"content",{get:function(){return this._content},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"reusable",{get:function(){var t,e;return null!==(e=null===(t=this.composition)||void 0===t?void 0:t.reusable)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"lifetimeStarted",{get:function(){return!this.delaying},enumerable:!1,configurable:!0}),i.prototype.setSpeed=function(t){this.speed=t},i.prototype.getSpeed=function(){return this.speed},i.prototype.addComponent=function(t){var e=new t(this.engine);return e.item=this,this.components.push(e),e.onAttached(),e},i.prototype.getComponent=function(t){var e,r,i;try{for(var n=s(this.components),o=n.next();!o.done;o=n.next()){var a=o.value;if(a instanceof t){i=a;break}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return i},i.prototype.getComponents=function(t){var e,r,i=[];try{for(var n=s(this.components),o=n.next();!o.done;o=n.next()){var a=o.value;a instanceof t&&i.push(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return i},i.prototype.setParent=function(t){t!==this&&(this.parent&&g(this.parent.children,this),this.parent=t,t&&(o.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition)))},i.prototype.stop=function(){this.stopped=!0},i.prototype.onEnd=function(){},i.prototype.setColor=function(t,e,r,i){},i.prototype.setOpacity=function(t){},i.prototype.getVisible=function(){return this.visible},i.prototype.setVisible=function(t){this.visible!==t&&(this.visible=!!t)},i.prototype.getWorldTransform=function(t){var e=null!=t?t:new Ui({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.prototype.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.prototype.translate=function(t,e,r){this.transform.translate(t,e,r)},i.prototype.rotate=function(t,e,r){var i=new q(t,e,r),n=j.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},i.prototype.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},i.prototype.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.prototype.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},i.prototype.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},i.prototype.setScale=function(t,e,r){this.transform.setScale(t,e,r)},i.prototype.getBoundingBox=function(){},i.prototype.getHitTestParams=function(t){},i.prototype.getCurrentPosition=function(){var t=new H;return this.transform.assignWorldTRS(t),t},i.prototype.isEnded=function(t){return t-this.duration>.001},i.prototype.find=function(t){var e,r,i,n;if(this.name===t)return this;try{for(var o=s(this.children),a=o.next();!a.done;a=o.next()){if((c=a.value).name===t)return c}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}try{for(var u=s(this.children),l=u.next();!l.done;l=u.next()){var c;return(c=l.value).find(t)}}catch(t){i={error:t}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}},i.prototype.fromData=function(t){var r,i;e.prototype.fromData.call(this,t);var n=t.id,o=t.name,a=t.delay,u=t.parentId,l=t.endBehavior,c=t.transform,h=t.listIndex,f=void 0===h?0:h,p=t.duration,d=void 0===p?0:p;this.props=t,this.type=t.type,this.id=n.toString(),this.name=o,this.start=a||this.start,c&&(c.position=(new H).copyFrom(c.position),c.rotation=(new q).copyFrom(c.rotation),c.scale=(new H).copyFrom(c.scale),c.size&&(c.size=(new X).copyFrom(c.size)),c.anchor&&(c.anchor=(new X).copyFrom(c.anchor)),this.transform.setTransform(c)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=u,this.duration=d,this.endBehavior=l,this.lifetime=-this.start/this.duration,this.listIndex=f,this.oldId=t.oldId,t.content||(t.content={options:{}});var m=this.getComponent(Cn);(m.fromData(t.content),this.type!==Tt.particle)&&m.createTrack(dn,"AnimationTrack").createClip(En,"AnimationTimelineClip").playable.fromData(t.content);if(d<=0)throw Error("Item duration can't be less than 0, see ".concat(Ji["Item duration can't be less than 0"]));if(t.components)try{for(var y=s(t.components),v=y.next();!v.done;v=y.next()){var g=v.value;this.components.push(g),g instanceof ne?this.rendererComponents.push(g):g instanceof ie&&this.itemBehaviours.push(g)}}catch(t){r={error:t}}finally{try{v&&!v.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}},i.prototype.toData=function(){var e,r,i,n;if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=t.DataType.VFXItemData,"rootItem"!==(null===(i=this.parent)||void 0===i?void 0:i.name)&&(this.taggedProperties.parentId=null===(n=this.parent)||void 0===n?void 0:n.guid),!this.taggedProperties.components){this.taggedProperties.components=[];try{for(var o=s(this.components),a=o.next();!a.done;a=o.next()){var u=a.value;u instanceof Oa&&this.taggedProperties.components.push(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}}this.taggedProperties.content={}},i.prototype.translateByPixel=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.translate(2*t*n/a,-2*e*o/s,0)}},i.prototype.dispose=function(){var t,e;if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);try{for(var r=s(this.components.slice()),i=r.next();!i.done;i=r.next()){i.value.dispose()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.components=[],this._content=void 0,this.composition=null,this._contentVisible=!1,this.transform.setValid(!1)}},i.prototype.resetChildrenParent=function(){var t,e,r;try{for(var i=s(this.children),n=i.next();!n.done;n=i.next()){var o=n.value;this.parent&&o.setParent(this.parent)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.parent&&g(null===(r=this.parent)||void 0===r?void 0:r.children,this)},i=o=n([Jt(t.DataType.VFXItemData)],i)}(te);function La(t,e){var r=t.type,i=t.pluginName;if(!i)switch(r){case Tt.null:case Tt.base:i="cal";break;case Tt.sprite:i="sprite";break;case Tt.particle:i="particle";break;case Tt.interact:i="interact";break;case Tt.camera:i="camera";break;case Tt.filter:i="filter";break;case Tt.text:i="text";break;case Tt.tree:i="tree";break;default:throw new Error("invalid vfx item type")}return e.pluginSystem.createPluginItem(i,t,e)}t.Item=void 0,(wa=t.Item||(t.Item={})).is=function(t,e){return t.type===e},wa.isFilter=function(t){return t.type===Tt.filter},wa.isComposition=function(t){return t.type===Tt.composition},wa.isParticle=function(t){return t.type===Tt.particle},wa.isNull=function(t){return t.type===Tt.null};var Ia={},Pa=[],Fa={};function Na(t,e,r,i){Fa[t]=r,Ia[t]=e,i&&v(Pa,t)}var Da,Va,za,Ua,Ba,ka,Ga,Xa,Ha,ja,Ya,Wa=function(){function t(t){var e={},r=[],i=function(t){var i=Ia[t];r.includes(i)||(r.push(i),e[t]=i)};Pa.forEach(i),t.forEach(i),this.plugins=Object.keys(e).map((function(t){var e=Ia[t];if(!e)throw new Error("plugin '".concat(t,"' not found.")+function(t){var e=Za[t];return e?"\nInstall Plugin: npm i ".concat(e,"@latest --save\nImport Plugin: import '").concat(e,"'"):""}
|
|
15
|
-
/*!
|
|
16
|
-
* Name: @galacean/effects-specification
|
|
17
|
-
* Description: Galacean Effects JSON Specification
|
|
18
|
-
* Author: Ant Group CO., Ltd.
|
|
19
|
-
* Version: v1.0.1
|
|
20
|
-
*/(t));var r=new e;return r.name=t,r})).sort((function(t,e){return t.order-e.order}))}return t.prototype.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionConstructed(t,e)}))},t.prototype.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},t.prototype.resetComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionReset(t,e)}))},t.prototype.createPluginItem=function(t,e,r){var i=Fa[t];if(!i)throw new Error("plugin ".concat(t," no registered constructor"));var n=new i(r.getEngine(),e,r);if(n.composition=r,!(n instanceof Ma))throw new Error("plugin ".concat(t," invalid constructor type"));return n},t.prototype.processRawJSON=function(t,e){return o(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.callStatic("processRawJSON",t,e)]}))}))},t.prototype.callStatic=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return o(this,void 0,void 0,(function(){var r,i,n,o,s;return a(this,(function(a){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],s=Ia[o.name],t in s&&r.push(Promise.resolve(s[t].apply(s,l([],u(e),!1))));return[2,Promise.all(r)]}))}))},t.prototype.precompile=function(t,e,r){return o(this,void 0,void 0,(function(){return a(this,(function(i){return[2,this.callStatic("precompile",t,e,r)]}))}))},t.prototype.loadResources=function(t,e){return o(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.callStatic("prepareResource",t,e)]}))}))},t}(),Za={"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"};!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(Da||(Da={})),function(t){t[t.ALPHA=0]="ALPHA",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.BRIGHTNESS=3]="BRIGHTNESS",t[t.SUBTRACTION=4]="SUBTRACTION",t[t.STRONG_LIGHT=5]="STRONG_LIGHT",t[t.WEAK_LIGHT=6]="WEAK_LIGHT",t[t.SUPERPOSITION=7]="SUPERPOSITION"}(Va||(Va={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(za||(za={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Ua||(Ua={})),function(t){t[t.NONE=0]="NONE",t[t.SPHERE=1]="SPHERE",t[t.CONE=2]="CONE",t[t.HEMISPHERE=3]="HEMISPHERE",t[t.CIRCLE=4]="CIRCLE",t[t.DONUT=5]="DONUT",t[t.RECTANGLE=6]="RECTANGLE",t[t.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",t[t.EDGE=8]="EDGE",t[t.TEXTURE=9]="TEXTURE"}(Ba||(Ba={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(ka||(ka={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Ga||(Ga={})),function(t){t[t.NONE=0]="NONE",t[t.NOTIFY=1]="NOTIFY",t[t.RESUME_PLAYER=2]="RESUME_PLAYER",t[t.REMOVE=3]="REMOVE",t[t.PAUSE=4]="PAUSE"}(Xa||(Xa={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.filter="8",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox"}(Ha||(Ha={})),function(t){t[t.BILLBOARD=0]="BILLBOARD",t[t.MESH=1]="MESH",t[t.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",t[t.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(ja||(ja={})),function(t){t[t.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",t[t.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",t[t.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",t[t.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",t[t.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",t[t.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",t[t.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",t[t.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",t[t.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(Ya||(Ya={}));var qa,Ka,Qa,Ja,$a,ts,es,rs,is,ns,os,as,ss,us,ls,cs,hs,fs=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=fs]="landscape"}(qa||(qa={})),function(t){t[t.destroy=0]="destroy",t[t.pause=1]="pause",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.pause_destroy=3]="pause_destroy"}(Ka||(Ka={})),function(t){t[t.CONSTANT=0]="CONSTANT",t[t.CONSTANT_VEC2=1]="CONSTANT_VEC2",t[t.CONSTANT_VEC3=2]="CONSTANT_VEC3",t[t.CONSTANT_VEC4=3]="CONSTANT_VEC4",t[t.RANDOM=4]="RANDOM",t[t.LINE=5]="LINE",t[t.CURVE=6]="CURVE",t[t.BEZIER_PATH=7]="BEZIER_PATH",t[t.RGBA_COLOR=8]="RGBA_COLOR",t[t.GRADIENT_COLOR=9]="GRADIENT_COLOR",t[t.SHAPE_POINTS=10]="SHAPE_POINTS",t[t.SHAPE_SPLITS=11]="SHAPE_SPLITS",t[t.LINEAR_PATH=12]="LINEAR_PATH",t[t.COLORS=13]="COLORS",t[t.BINARY=20]="BINARY",t[t.BEZIER_CURVE=21]="BEZIER_CURVE",t[t.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH"}(Qa||(Qa={})),function(t){t[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"}(Ja||(Ja={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}($a||($a={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(ts||(ts={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(es||(es={})),function(t){t[t.RANDOM=0]="RANDOM",t[t.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",t[t.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",t[t.UNIFORM_BURST=3]="UNIFORM_BURST"}(rs||(rs={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(is||(is={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(ns||(ns={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(os||(os={})),function(t){t.none="none",t.uv="uv",t.normal="normal",t.basecolor="basecolor",t.alpha="alpha",t.metallic="metallic",t.roughness="roughness",t.ao="ao",t.emissive="emissive"}(as||(as={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(ss||(ss={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(us||(us={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(ls||(ls={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(cs||(cs={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(hs||(hs={}));var ps=function(){return ps=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},ps.apply(this,arguments)};function ds(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 new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ms(t,e){if(!t.includes(e))return t.push(e),!0}function ys(t,e,r){if(t)for(var i in t)Object.hasOwnProperty.call(t,i)&&e.call(r,t[i],i);return t}function vs(t){if(Number.isFinite(t))return[Qa.CONSTANT,t];if(t){if("lines"===t[0])return[Qa.LINE,t[1]];if("curve"===t[0])return[Qa.CURVE,t[1]];if("static"===t[0])return[Qa.CONSTANT,t[1]]}}function gs(t,e){return Array.isArray(t)&&"random"===t[0]?[Qa.CONSTANT,t[1][e]]:vs(t)}function xs(t){return t&&"color"===t[0]?Cs(t[1],!0):[1,1,1,1]}function Ts(t,e){if(t){if("colors"===t[0])return[Qa.COLORS,t[1].map((function(t){return Cs(t,e)}))];if("gradient"===t[0])return bs(t[1],e);if("color"===t[0])return[Qa.RGBA_COLOR,Cs(t[1],e)]}}function Es(t){return t&&"random"===t[0]?[Qa.RANDOM,t[1]]:vs(t)}function bs(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach((function(i){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(i),o=Cs(t[i],e);r.push([n,o[0],o[1],o[2],o[3]])})),r=r.sort((function(t,e){return t[0]-e[0]})),[Qa.GRADIENT_COLOR,r]}}function Cs(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]||[0,0,0,255])}else t instanceof 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 _s(t,e){return Array.isArray(t)?("gradient"===t[0]||"color"===t[0])&&bs(t[1],e):bs(t,e)}function As(t){if(t){if(3===t.length)return[Qa.CONSTANT_VEC3,t];if("path"===t[0])return[Qa.LINEAR_PATH,t[1]];if("bezier"===t[0])return[Qa.BEZIER_PATH,t[1]]}}function Ss(t){var e,r;try{for(var i=ds(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 Rs(t){var e,r;try{for(var i=ds(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}"function"==typeof SuppressedError&&SuppressedError;var Os=Math.cos,ws=Math.sin,Ms=Math.PI/180,Ls=180/Math.PI;function Is(t){var e,r=t.options,i=t.transform,n={type:Ba.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=ps(ps({},t.shape),{type:Ba[o]}),t.shape.upDirection){var a=function(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}(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=Es(r.turbulenceX),n.turbulenceY=Es(r.turbulenceY),n.turbulenceZ=Es(r.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(t){return Ss(t)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(t){return Ss(t)}))),c.rateOverTime&&(c.rateOverTime=Es(c.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:c,options:{startLifetime:Es(r.startLifetime),start3DSize:!!r.start3DSize,startSize:Es(r.startSize),startSizeX:Es(r.startSizeX),startSizeY:Es(r.startSizeY),sizeAspect:Es(r.sizeAspect),maxCount:r.maxCount,startDelay:Es(r.startDelay),startColor:Ts(r.startColor,!0),startRotationZ:Es(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(h.options.startRotationX=Es(r.startRotationX),h.options.startRotationY=Es(r.startRotationY)),t.filter){var f={};ys(t.filter,(function(t,e){var r;f[e]=(r=t,Array.isArray(r)&&"string"==typeof r[0]&&(Es(r)||As(r)||Ts(r))||r)})),h.filter=f}i&&i.path&&(h.emitterTransform={path:As(i.path)});var p=t.sizeOverLifetime;p&&(p.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:Es(p.x),y:Es(p.y)}:h.sizeOverLifetime={size:Es(p.size)});var d=t.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?vs(m):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:vs(r.gravityModifier),startSpeed:Es(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:Es(d.linearX),linearY:Es(d.linearY),linearZ:Es(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Es(d.orbitalX),orbitalY:Es(d.orbitalY),orbitalZ:Es(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:vs(d.forceCurve)},Rs(h.positionOverLifetime);var y=t.rotationOverLifetime;y&&(h.rotationOverLifetime={separateAxes:y.separateAxes,asRotation:y.asRotation,z:Es(y.separateAxes?y.z:y.angularVelocity)},y.separateAxes&&(h.rotationOverLifetime.y=vs(y.y),h.rotationOverLifetime.x=vs(y.x)));var v=t.colorOverLifetime;if(v){var g=h.colorOverLifetime={opacity:vs(v.opacity)};v.color&&(g.color=_s(v.color))}var x=t.textureSheetAnimation;x&&(h.textureSheetAnimation={row:x.row,col:x.col,total:x.total,animate:x.animate,cycles:vs(x.cycles),animationDelay:gs(x.animationDelay,0),animationDuration:gs(x.animationDuration,0)});var T=t.trails;T&&(h.trails={lifetime:Es(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:vs(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&_s(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&_s(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:Es(T.opacityOverLifetime)}),h.trails&&Rs(h.trails);var E=t.interaction;return E&&(h.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),h}function Ps(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:As(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:vs(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:vs(n.linearX),linearY:vs(n.linearY),linearZ:vs(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:vs(n.orbitalX),orbitalY:vs(n.orbitalY),orbitalZ:vs(n.orbitalZ),speedOverLifetime:vs(n.speedOverLifetime)};Rs(o);var a={options:{startColor:xs(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=vs(s.x),u.y=vs(s.y),u.z=vs(s.z)):u.z=vs(s.angularVelocity)}var l=t.colorOverLifetime;if(l){var c=a.colorOverLifetime={opacity:vs(l.opacity)};l.color&&(c.color=_s(l.color))}var h=t.sizeOverLifetime;return h&&(a.sizeOverLifetime={separateAxes:h.separateAxes,size:vs(h.size),x:vs(h.x),y:vs(h.y),z:vs(h.z)}),a}function Fs(t,e){var r=Ps(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 Ns=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],Ds=["path","position"];function Vs(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===Ha.null&&t.endBehavior===$a.destroy&&(t.endBehavior=$a.freeze)}))})),t.version="2.1",t}var zs=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,Us=/^(\d+)\.(\d+)$/,Bs=!1;function ks(t){var e,r;if(!t||"object"!=typeof t)throw Error("expect a json object");if(function(t){var e,r=null===(e=t.version)||void 0===e?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==Ha.mesh&&t.type!==Ha.light||(t.endBehavior=1===t.endBehavior?$a.destroy:t.endBehavior)}))}))}(t),zs.test(t.version))return Bs="0"===(null===(e=/^(\d+)/.exec(t.version))||void 0===e?void 0:e[0]),Vs(function(t){var e,r;Gs="1.0";var i=t.plugins||[];(null===(e=t.bins)||void 0===e?void 0:e.length)&&(Gs="1.3");var n=(t.requires||[]).slice(),o=t.images.map((function(e,r){return Xs(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:Gs,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return Hs(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);return s}(t));var i=null===(r=Us.exec(t.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?Vs(t):t;throw Error("invalid json version "+t.version)}var Gs="1.0";function Xs(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,type:t.type,webp:t.webp,renderLevel:i,oriY:n,loop:t.loop};if(t&&t.sourceType)return t;throw Error("invalid image type")}function Hs(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Object.assign({clipMode:fs},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Zs(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 js,Ys=[0,0,0,1],Ws=.5;function Zs(t,e){var r,i,n;void 0===e&&(e={});var o,a,s,u,l,c,h=Ha.base,f=t.endBehavior,p=NaN;if(t.content?(h=t.type||Ha.plugin,c=t.pn,l=t.pluginName,s=t.content,a=t.content,isNaN(c)&&!l&&(l=s.options.type),t.duration&&(p=t.duration),o=t.transform||v(a.transform),h===Ha.filter&&(Gs<"1.1"&&(Gs="1.1"),(s=Fs(a,o)).filter=function(t){var e={};return ys(t,(function(t,r){Ns.includes(r)?e[r]=vs(t):Ds.includes(r)?e[r]=As(t):e[r]=t})),e}(a.filter))):t.particle?(h=Ha.particle,o=v((a=t.particle).transform,Bs,!0),s=Is(a)):t.sprite?(h=Ha.sprite,s=Fs(a=t.sprite,o=v(a.transform,!1,!0))):t.cal?(h=Ha.null,s=Ps(a=t.cal,o=v(a.transform,!1,!0))):t.ui?(h=Ha.interact,o=v((a=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:Ga.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&xs(r.previewColor),behavior:r.behavior||Xa.NOTIFY};break;case"drag":e={type:Ga.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:Ga.MESSAGE}}return{options:e}}(a),o.scale=[a.options.width||1,a.options.height||1,1]):t.model&&(a=t.model,1===t.model.options.type&&(h=Ha.camera,o=v(a.transform),s=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:As(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:vs(null==o?void 0:o.translateX),linearY:vs(null==o?void 0:o.translateY),linearZ:vs(null==o?void 0:o.translateZ)};Rs(a),n.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:vs(null==s?void 0:s.rotateX),y:vs(null==s?void 0:s.rotateY),z:s.separateAxes?vs(null==s?void 0:s.rotateZ):vs(s.rotation)};Rs(u),n.rotationOverLifetime=u}return n}(a))),null===(r=s.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(s.renderer.anchor);d[0]==Ws&&d[1]==Ws?delete s.renderer.anchor:e.requires&&ms(e.requires,"anchor")}if(a){var m=null===(i=a.options)||void 0===i?void 0:i.looping;f=m?Array.isArray(m)?m[1]?$a.loop:$a.destroy:$a.loop:f||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||$a.destroy,a.options.renderLevel&&(u=a.options.renderLevel),isNaN(p)&&(p=a.options.duration)}var y={type:h,name:t.name,delay:t.delay,duration:p,id:t.id+"",transform:o,endBehavior:f,renderLevel:u,content:s};return l?e.plugins?(ms(e.plugins,l),y.pn=e.plugins.indexOf(l)):y.pluginName=l:Number.isInteger(c)&&(y.pn=c),t.parentId&&(y.parentId=t.parentId+""),y;function v(t,e,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var o=(a=Ys,s=i.rotation[0],u=i.rotation[1],l=i.rotation[2],c=Os(s*Ms/2),h=Os(u*Ms/2),f=Os(l*Ms/2),p=ws(s*Ms/2),d=ws(u*Ms/2),m=ws(l*Ms/2),a[0]=p*h*f+c*d*m,a[1]=c*d*f-p*h*m,a[2]=c*h*m+p*d*f,a[3]=c*h*f-p*d*m,a);i.rotation=function(t,e){var r,i,n,o=e[0],a=e[1],s=e[2],u=e[3],l=o+o,c=a+a,h=s+s,f=o*l,p=a*l,d=a*c,m=s*h,y=u*h,v=1-d-m,g=p-y,x=p+y,T=1-f-m,E=s*l-u*c,b=s*c+u*l,C=1-f-d;return t[1]=Math.asin((i=-1,(r=-E)>(n=1)?n:r<i?i:r))*Ls,Math.abs(E)<.9999999?(t[0]=Math.atan2(b,C)*Ls,t[2]=Math.atan2(x,v)*Ls):(t[0]=0,t[2]=Math.atan2(-g,T)*Ls),t}([],o)}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}var a,s,u,l,c,h,f,p,d,m;return{}}}var qs=((js={})[ft.S]=[ft.S,ft.BPlus,ft.APlus],js[ft.A]=[ft.A,ft.BPlus,ft.APlus],js[ft.B]=[ft.B,ft.BPlus],js);function Ks(t,e){if(!t||!e)return!0;var r=qs[e];return!!r&&r.includes(t)}function Qs(t){return At(t)&&"jsonScene"in t}function Js(t,e){return t?[t[0]-.5,.5-t[1]]:e?hi[e]:[0,0]}var $s=1,tu=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new Ee),this.options=t,this.downloader=e,this.assets={},this.id=$s++,this.timers=[],this.updateOptions(t)}return e.prototype.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=void 0===e?10:e;this.timeout=r},e.prototype.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===Tt.text){var r=e[t.name];r&&(t.content.options.text=r)}}))})),t},e.prototype.loadScene=function(e,r,n){var l,c,h;return o(this,void 0,void 0,(function(){var f,p,d,m,v,g,x,T,E,b,C,_,A=this;return a(this,(function(S){return p=ht(e)?e:this.id,d=performance.now(),m=[],v=null==r?void 0:r.engine.gpuCapability,g=null!==(c=null===(l=null==v?void 0:v.detail)||void 0===l?void 0:l.asyncShaderCompile)&&void 0!==c&&c,x=null!==(h=null==v?void 0:v.detail.compressedTexture)&&void 0!==h?h:0,E=!1,b=new Promise((function(t,e){T=window.setTimeout((function(){E=!0,A.removeTimer(T);var t=performance.now()-d;e("Load time out: totalTime: ".concat(t.toFixed(4),"ms ").concat(m.join(" "),", url: ").concat(p))}),1e3*A.timeout),A.timers.push(T)})),C=function(t,e){return o(A,void 0,void 0,(function(){var r,i,n;return a(this,(function(o){switch(o.label){case 0:if(E)return[3,4];r=performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e()];case 2:return i=o.sent(),m.push("[".concat(t,": ").concat((performance.now()-r).toFixed(2),"]")),[2,i];case 3:throw n=o.sent(),new Error("load error in ".concat(t,", ").concat(n));case 4:throw new Error("load canceled.")}}))}))},_=function(){return o(A,void 0,void 0,(function(){var o,l,c,h,v,E,b,_,A,S,R,O,w,M,L,I,P,F,N,D=this;return a(this,(function(a){switch(a.label){case 0:return At(e)?(f=e,this.baseUrl=location.href,[3,3]):[3,1];case 1:return e=new URL(e,location.href).href,this.baseUrl=e,[4,C("loadJSON",(function(){return D.loadJSON(e)}))];case 2:f=a.sent(),a.label=3;case 3:if(!Qs(f))return[3,6];if(o=i({},f),!this.options||!this.options.variables||0===Object.keys(this.options.variables).length)return[3,5];for(l=f.jsonScene.images,c=o.images,v=0;v<l.length;v++)c[v]instanceof HTMLCanvasElement&&(c[v]=l[v]);return h=o,[4,C("processImages",(function(){return D.processImages(c,o.usedImages,x)}))];case 4:for(h.images=a.sent(),v=0;v<o.images.length;v++)o.textureOptions[v].image=o.images[v];o.jsonScene.compositions=this.updateSceneData(o.jsonScene.compositions),a.label=5;case 5:return[3,12];case 6:return[4,C("processJSON",(function(){return D.processJSON(f)}))];case 7:return E=a.sent(),b=E.usedImages,_=E.jsonScene,A=E.pluginSystem,S=_.bins,R=void 0===S?[]:S,O=_.images,w=_.compositions,M=_.fonts,[4,Promise.all([C("processBins",(function(){return D.processBins(R)})),C("processImages",(function(){return D.processImages(O,b,x)})),C("".concat(g?"async":"sync"," compile"),(function(){return D.precompile(w,A,r,n)}))])];case 8:return L=u.apply(void 0,[a.sent(),2]),I=L[0],P=L[1],[4,C("processFontURL",(function(){return D.processFontURL(M)}))];case 9:return a.sent(),[4,C("processTextures",(function(){return D.processTextures(P,I,_)}))];case 10:return F=a.sent(),_.compositions=this.updateSceneData(_.compositions),o={url:e,renderLevel:this.options.renderLevel,storage:{},pluginSystem:A,jsonScene:_,usedImages:b,images:P,textureOptions:F,bins:I},[4,C("processPlugins",(function(){return A.loadResources(o,D.options)}))];case 11:a.sent(),a.label=12;case 12:return N=performance.now()-d,lt.info("Load asset: totalTime: ".concat(N.toFixed(4),"ms ").concat(m.join(" "),", url: ").concat(p)),window.clearTimeout(T),this.removeTimer(T),o.totalTime=N,o.startTime=d,Number(o.jsonScene.version)<3&&(console.warn("The current json version "+o.jsonScene.version+" is less than 3.0, try to convert to the new version."),o=function(e){var r,i,n,o,a,u,l,c,h,f,p,d;e.jsonScene.version="3.0";var m=e.jsonScene;m.items||(m.items=[]);try{for(var v=s(e.jsonScene.compositions),g=v.next();!g.done;g=v.next()){for(var x=g.value,T=0;T<x.items.length;T++)m.items.push(x.items[T]);3!==x.endBehavior&&1!==x.endBehavior||(x.endBehavior=4)}}catch(t){r={error:t}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}var E={};try{for(var b=s(m.items),C=b.next();!C.done;C=b.next())E[(D=C.value).id]=Ot(),D.oldId=D.id,D.id=E[D.id]}catch(t){n={error:t}}finally{try{C&&!C.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}try{for(var _=s(m.items),A=_.next();!A.done;A=_.next())if((D=A.value).parentId)if(D.parentId.includes("^")){var S=D.parentId.split("^")[0],R=D.parentId.split("^")[1];D.parentId=E[S]+"^"+R}else D.parentId=E[D.parentId]}catch(t){a={error:t}}finally{try{A&&!A.done&&(u=_.return)&&u.call(_)}finally{if(a)throw a.error}}try{for(var O=s(e.jsonScene.compositions),w=O.next();!w.done;w=O.next())for(x=w.value,T=0;T<x.items.length;T++)x.items[T]={id:x.items[T].id}}catch(t){l={error:t}}finally{try{w&&!w.done&&(c=O.return)&&c.call(O)}finally{if(l)throw l.error}}try{for(var M=s(e.textureOptions),L=M.next();!L.done;L=M.next()){var I=L.value;I.id=Ot(),I.dataType=t.DataType.Texture}}catch(t){h={error:t}}finally{try{L&&!L.done&&(f=M.return)&&f.call(M)}finally{if(h)throw h.error}}m.components||(m.components=[]);var P=m.components;try{for(var F=s(m.items),N=F.next();!N.done;N=F.next()){var D;if((D=N.value).content){if(D.content.renderer&&void 0!==D.content.renderer.texture){var V=D.content.renderer.texture;D.content.renderer.texture={id:e.textureOptions[V].id}}D.content.trails&&void 0!==D.content.trails.texture&&(V=D.content.trails.texture,D.content.trails.texture={id:e.textureOptions[V].id})}if(D.transform){var z=D.transform.position,U=D.transform.rotation,B=D.transform.scale;if(z||(z=[0,0,0]),U||(U=[0,0,0]),B||(B=[1,1,1]),D.transform={position:{x:z[0],y:z[1],z:z[2]},rotation:{x:U[0],y:U[1],z:U[2]},scale:{x:B[0],y:B[1],z:B[0]}},D.type===Tt.sprite&&(D.transform.size={x:B[0],y:B[1]},D.transform.scale={x:1,y:1,z:1}),D.type===Tt.sprite){(X=D.content).renderer||(X.renderer={});var k=Js((H=X.renderer).anchor,H.particleOrigin),G=D.transform.size;H.anchor||void 0===H.particleOrigin||(D.transform.position.x+=-k[0]*G.x,D.transform.position.y+=-k[1]*G.y),D.transform.anchor={x:k[0]*G.x,y:k[1]*G.y}}}if(D.type===Tt.particle){var X;(X=D.content).renderer||(X.renderer={});var H=X.renderer;X.renderer.anchor=Js(H.anchor,H.particleOrigin)}3!==D.endBehavior&&1!==D.endBehavior||(D.endBehavior=4);var j=y().replace(/-/g,"");D.type===Tt.sprite?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.SpriteComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.particle?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.ParticleSystem,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.mesh?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.MeshComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.skybox?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.SkyboxComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.light?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.LightComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):"camera"===D.type?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.CameraComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.tree?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.TreeComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.interact?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.InteractComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.camera?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.CameraController,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.text&&(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.TextComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id}))}}catch(t){p={error:t}}finally{try{N&&!N.done&&(d=F.return)&&d.call(F)}finally{if(p)throw p.error}}return e}(o)),[2,o]}}))}))},[2,Promise.race([b,_()])]}))}))},e.prototype.precompile=function(t,e,r,i){return o(this,void 0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:return r&&r.getShaderLibrary()?(n=null==r?void 0:r.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,r,i)]):[2];case 1:return o.sent(),[4,new Promise((function(t){n.compileAllShaders((function(){t(null)}))}))];case 2:return o.sent(),[2]}}))}))},e.prototype.processJSON=function(t){return o(this,void 0,void 0,(function(){var e,r,i,n,o,s,u,l,c;return a(this,(function(a){switch(a.label){case 0:return e=ks(t),t.compositions.forEach((function(t,r){t.globalVolume&&(e.compositions[r].globalVolume=t.globalVolume)})),r=e.plugins,i=void 0===r?[]:r,n=e.compositions,o=e.imgUsage,s=e.images,[4,(u=new Wa(i)).processRawJSON(e,this.options)];case 1:return a.sent(),l=this.options.renderLevel,c={},o?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];Ks(i[u].renderLevel,n)&&(t[u]=!0)}}}(c,n,o,s,l):null==s||s.forEach((function(t,e){c[e]=!0})),[2,{usedImages:c,jsonScene:e,pluginSystem:u}]}}))}))},e.prototype.processBins=function(t){return o(this,void 0,void 0,(function(){var e,r,i=this;return a(this,(function(n){return e=this.options.renderLevel,r=t.map((function(r){if(r instanceof ArrayBuffer)return r;if(Ks(r.renderLevel,e))return i.loadBins(r.url);throw new Error("Invalid bins source: ".concat(JSON.stringify(t)))})),[2,Promise.all(r)]}))}))},e.prototype.processFontURL=function(t){return o(this,void 0,void 0,(function(){var r,i=this;return a(this,(function(n){return t?(r=t.map((function(t){return o(i,void 0,void 0,(function(){var r,i;return a(this,(function(n){switch(n.label){case 0:if(!t.fontURL||e.fonts.has(t.fontFamily))return[3,4];r=new FontFace(null!==(i=t.fontFamily)&&void 0!==i?i:"","url("+t.fontURL+")"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.load()];case 2:return n.sent(),document.fonts.add(r),e.fonts.add(t.fontFamily),[3,4];case 3:return n.sent(),lt.warn("Invalid fonts source: ".concat(JSON.stringify(t.fontURL))),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},e.prototype.processImages=function(e,r,i){return o(this,void 0,void 0,(function(){var n,s,u,l,c,h=this;return a(this,(function(f){return n=this.options,s=n.useCompressedTexture,u=n.variables,l=this.baseUrl,c=e.map((function(e,n){return o(h,void 0,void 0,(function(){var o,c,h,f,p,d,m,y,v,g,x,T,E,b,C,_,A,S,R;return a(this,(function(a){switch(a.label){case 0:if(!r[n])return[3,19];if(o=e.url,c=e.webp,h=new URL(o,l).href,f=c&&new URL(c,l).href,!("template"in e))return[3,16];if(p=e.template,d=void 0,!("v"in p)||2!==p.v||!p.background)return[3,9];if(!((m=Ta(p,u))instanceof Array))return[3,6];y=p.background.name,a.label=1;case 1:return a.trys.push([1,3,,5]),A={},[4,_e(m[0])];case 2:return A.image=a.sent(),A.url=m[0],d=A,[3,5];case 3:return a.sent(),S={},[4,_e(m[1])];case 4:return S.image=a.sent(),S.url=m[1],d=S,[3,5];case 5:return u&&(u[y]=d.url),[3,8];case 6:return"string"!=typeof m?[3,8]:(R={},[4,_e(m)]);case 7:R.image=a.sent(),R.url=m,d=R,a.label=8;case 8:return[3,11];case 9:return[4,Ce(h,f)];case 10:d=a.sent(),a.label=11;case 11:v=void 0,a.label=12;case 12:return a.trys.push([12,14,,15]),[4,_a(d.image,p,u,this.options,-1===e.oriY)];case 13:return v=a.sent(),[3,15];case 14:throw a.sent(),new Error("image template fail: ".concat(h));case 15:return[2,v];case 16:if("type"in e&&"video"===e.type)return g=e.loop,[2,Se(e.url,{loop:g})];if("compressed"in e&&s&&i){if(x=e.compressed,T=void 0,i===Xr.ASTC?T=x.astc:i===Xr.PVRTC&&(T=x.pvrtc),T)return E=new URL(T,l).href,this.assets[n]={url:E,type:t.TextureSourceType.compressed},[2,this.loadBins(E)]}else{if("sourceType"in e)return[2,e];if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof Me)return[2,e]}a.label=17;case 17:return[4,Ce(h,f)];case 18:return b=a.sent(),C=b.url,_=b.image,this.assets[n]={url:C,type:t.TextureSourceType.image},[2,_];case 19:return[2,void 0]}}))}))})),[2,Promise.all(c)]}))}))},e.prototype.processTextures=function(e,r,n){var s;return o(this,void 0,void 0,(function(){var u,l,c=this;return a(this,(function(h){return u=null!==(s=n.textures)&&void 0!==s?s:e.map((function(t,e){return{source:e}})),l=u.map((function(s,u){return o(c,void 0,void 0,(function(){var o,l,c,h;return a(this,(function(a){switch(a.label){case 0:if(s instanceof Me)return[2,s];if(!("mipmaps"in s))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,Re(s,r,n.bins)];case 2:return[2,a.sent()];case 3:throw o=a.sent(),new Error("load texture ".concat(u," fails, error message: ").concat(o));case 4:return"number"!=typeof(l=s.source)?[3,5]:(c=e[l],[3,7]);case 5:return"string"!=typeof l?[3,7]:[4,_e(eu(l))];case 6:c=a.sent(),a.label=7;case 7:if(c)return h=function(e,r){if(e instanceof Me)return e.source;if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement)return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:le.LINEAR,magFilter:le.LINEAR};if(e instanceof HTMLVideoElement)return{sourceType:t.TextureSourceType.video,video:e,minFilter:le.LINEAR,magFilter:le.LINEAR};if(e instanceof ArrayBuffer)return i(i({},Pe(e)),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE,minFilter:le.NEAREST,magFilter:le.NEAREST};throw new Error("Invalid texture options")}(c,this.assets[u]),[2,h.sourceType===t.TextureSourceType.compressed?h:i(i({},h),s)];throw new Error("Invalid texture source: ".concat(l))}}))}))})),[2,Promise.all(l)]}))}))},e.prototype.loadJSON=function(t){return o(this,void 0,void 0,(function(){var e=this;return a(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.loadBins=function(t){return o(this,void 0,void 0,(function(){var e=this;return a(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},e.prototype.dispose=function(){var t;for(var e in this.timers.length&&this.timers.map((function(t){return window.clearTimeout(t)})),this.assets){var r=this.assets[e];null===(t=null==r?void 0:r.dispose)||void 0===t||t.call(r)}this.assets={},this.timers=[]},e.fonts=new Set,e}();function eu(t,e,r){void 0===e&&(e="base64File"),void 0===r&&(r="");for(var i=t.split(",")[1]||t,n=atob(i),o=[],a=0;a<n.length;a+=512){for(var s=n.slice(a,a+512),u=new Array(s.length),l=0;l<s.length;l++)u[l]=s.charCodeAt(l);var c=new Uint8Array(u);o.push(c)}var h=new Blob(o,{type:r});return new File([h],e,{type:r})}var ru,iu,nu=new H(1,1,1),ou=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=Z.fromIdentity(),this.projectionMatrix=Z.fromIdentity(),this.viewProjectionMatrix=Z.fromIdentity(),this.inverseViewMatrix=Z.fromIdentity(),this.dirty=!0;var r=e.near,i=void 0===r?.1:r,n=e.far,o=void 0===n?20:n,a=e.fov,s=void 0===a?60:a,u=e.aspect,l=void 0===u?1:u,c=e.clipMode,h=void 0===c?wt.portrait:c,f=e.position,p=void 0===f?[0,0,8]:f,d=e.rotation,m=void 0===d?[0,0,0]:d;this.options={near:i,far:o,fov:s,aspect:l,clipMode:h,position:H.fromArray(p),rotation:q.fromArray(m)},this.dirty=!0,this.updateMatrix()}return Object.defineProperty(t.prototype,"near",{get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"far",{get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fov",{get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aspect",{get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipMode",{get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"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)},enumerable:!1,configurable:!0}),t.prototype.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},t.prototype.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},t.prototype.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},t.prototype.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null===(t=this.inverseProjectionMatrix)||void 0===t?void 0:t.clone()},t.prototype.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},t.prototype.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},t.prototype.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},t.prototype.getInverseVPRatio=function(t){var e=new H(0,0,t),r=this.getViewProjectionMatrix(),i=e.applyMatrix(r).z;return new H(1,1,i).applyMatrix(r)},t.prototype.setQuat=function(t){void 0===this.options.quat?(this.options.quat=t.clone(),this.dirty=!0):(this.options.quat,this.options.quat.equals(t)||(this.options.quat.copyFrom(t),this.dirty=!0)),this.dirty&&this.setRotationByQuat(t)},t.prototype.getQuat=function(){var t=this.options.quat;if(void 0===t){t=new j;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},t.prototype.getOptions=function(){return this.options},t.prototype.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()},t.prototype.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*D,r,i,n,o===wt.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),nu),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},t.prototype.setRotationByQuat=function(t){Ui.getRotation(t,this.options.rotation)},t}(),au=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t}return r(n,e),n.prototype.start=function(){var t,e,r=this.item.props.startTime,i=void 0===r?0:r;this.startTime=i,this.timelineComponents=[],this.timelineComponent=this.item.getComponent(Cn);try{for(var n=s(this.items),o=n.next();!o.done;o=n.next()){var a=o.value.getComponent(Cn);a&&(this.timelineComponents.push(a),(0!==this.item.endBehavior||this.timelineComponent.reusable)&&(a.reusable=!0))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},n.prototype.update=function(t){var e,r,i=this.timelineComponent.getTime();try{for(var n=s(this.timelineComponents),o=n.next();!o.done;o=n.next()){var a=o.value,u=a.toLocalTime(i);a.setTime(u)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},n.prototype.resetStatus=function(){this.item.ended=!1,this.item.delaying=!0},n.prototype.createContent=function(){var e=this.items;if(this.items.length=0,this.item.composition){var r=this.item.engine.assetLoader;this.item.composition.compositionSourceManager.jsonScene;for(var o=this.item.props.items?this.item.props.items:[],a=0;a<o.length;a++){var s=void 0,u=o[a];if(t.Item.isComposition(u)){var l=u.content.options.refId,c=this.item.composition.refCompositionProps.get(l);if(!c)throw new Error("引用的Id: ".concat(l," 的预合成不存在"));c.content=u.content,(s=new Ma(this.engine,i(i({},c),{id:u.id,name:u.name,delay:u.delay,duration:u.duration,endBehavior:u.endBehavior,parentId:u.parentId,transform:u.transform,oldId:u.oldId}))).type=Tt.composition,s.composition=this.item.composition,s.addComponent(n).refId=l,s.transform.parentTransform=this.transform,this.item.composition.refContent.push(s),5===s.endBehavior&&(this.item.composition.autoRefTex=!1),s.getComponent(n).createContent()}else if("ECS"===u.type||u.type===Tt.sprite||u.type===Tt.text||u.type===Tt.particle||u.type===Tt.mesh||u.type===Tt.skybox||u.type===Tt.light||"camera"===u.type||u.type===Tt.tree||u.type===Tt.interact||u.type===Tt.camera)(s=r.loadGUID(u.id)).composition=this.item.composition;else if((s=new Ma(this.engine,u)).composition=this.item.composition,u.type===Tt.text){var h=new Aa(this.engine,u.content);h.item=s,s.components.push(h),s.rendererComponents.push(h),s._content=h}else s=La(u,this.item.composition);s.parent=this.item,s.transform.parentTransform=u.type===Tt.camera?new Ui:this.transform,Ma.isExtraCamera(s)&&(this.item.composition.extraCamera=s),e.push(s)}}},n.prototype.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},n.prototype.hitTest=function(e,r,i,n,o,a){for(var s=[],u=(null==a?void 0:a.stop)||ct,l=(null==a?void 0:a.skip)||ct,c=(null==a?void 0:a.maxCount)||this.items.length,h=0;h<this.items.length&&n.length<c;h++){var f=this.items[h];if(f.lifetime>=0&&!f.ended&&!Ma.isComposition(f)&&!l(f)){var p=f.getHitTestParams(o);if(p){var d=!1,m=new H;if(p.type===t.HitTestType.triangle)for(var y=p.triangles,v=p.backfaceCulling,g=0;g<y.length;g++){var x=y[g];if(e.intersectTriangle(x,m,v)){d=!0,s.push(m);break}}else if(p.type===t.HitTestType.box){var T=p.center,E=p.size,b=T.clone().addScaledVector(E,.5),C=T.clone().addScaledVector(E,-.5);e.intersectBox({min:b,max:C},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.sphere){T=p.center;var _=p.radius;e.intersectSphere({center:T,radius:_},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.custom){var A=p.collect(e,new X(r,i));A&&A.length>0&&(A.forEach((function(t){s.push(t)})),d=!0)}if(d){var S={compContent:this.item,id:f.id,name:f.name,position:s[s.length-1],parentId:f.parentId,hitPositions:s,behavior:p.behavior};if(n.push(S),u(S))return n}}}}return n},n}(ie),su=function(){function e(t,e,r){var n,o=this;this.compositionSourceManager=r,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=t.reusable,s=void 0!==a&&a,u=t.speed,l=void 0===u?1:u,c=t.baseRenderOrder,h=void 0===c?0:c,f=t.renderer,p=t.onPlayerPause,d=t.onMessageItem,m=t.onEnd,y=t.event,v=t.width,g=t.height;e.jsonScene.imgUsage=void 0,s&&(this.keepResource=!0,e.textures=void 0,e.consumed=!0);var x=this.compositionSourceManager,T=x.sourceContent,E=x.pluginSystem,b=x.imgUsage,C=x.totalTime,_=x.renderLevel,A=x.refCompositionProps;F(T),this.renderer=f,this.refCompositionProps=A;var S=new Ma(this.getEngine(),T);S.name="rootItem",S.type=Tt.composition,S.composition=this,this.rootComposition=S.addComponent(au),this.rootTimeline=S.getComponent(Cn);var R=!s&&b;this.transform=new Ui({name:this.name}),this.transform.engine=this.getEngine(),S.transform=this.transform,this.globalVolume=T.globalVolume,this.width=v,this.height=g,this.renderOrder=h,this.id=T.id,this.renderer=f,this.texInfo=null!=R?R:{},this.event=y,this.statistic={loadTime:null!=C?C:0,loadStart:null!==(n=e.startTime)&&void 0!==n?n:0,firstFrameTime:0},this.reusable=s,this.speed=l,this.renderLevel=_,this.autoRefTex=!this.keepResource&&R&&5!==S.endBehavior,this.rootItem=S,this.name=T.name,this.pluginSystem=E,this.pluginSystem.initializeComposition(this,e),this.camera=new ou(this.name,i(i({},null==T?void 0:T.camera),{aspect:v/g})),this.url=e.url,this.assigned=!0,this.globalTime=0,this.onPlayerPause=p,this.onMessageItem=d,this.onEnd=m,this.createRenderFrame(),this.rendererOptions=null,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout((function(){var t;null===(t=o.onEnd)||void 0===t||t.call(o,o)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)}return Object.defineProperty(e.prototype,"handleEnd",{set:function(t){console.warn("The handleEnd property is deprecated. Use onEnd instead."),this.onEnd=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this.compositionSourceManager.textures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this.rootComposition.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){var t;return null!==(t=this.rootComposition.startTime)&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this.rootTimeline.getTime()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getDuration=function(){return this.rootItem.duration},e.prototype.restart=function(){this.rootComposition.items,this.prepareRender(),this.reset(),this.transform.setValid(!0),this.rootComposition.resetStatus(),this.forwardTime(this.startTime)},e.prototype.setIndex=function(t){this.renderOrder=t},e.prototype.getIndex=function(){return this.renderOrder},e.prototype.setSpeed=function(t){this.speed=t},e.prototype.getSpeed=function(){return this.speed},e.prototype.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootTimeline.timelineStarted?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},e.prototype.pause=function(){this.paused=!0},e.prototype.getPaused=function(){return this.paused},e.prototype.resume=function(){this.paused=!1},e.prototype.gotoAndPlay=function(t){this.resume(),this.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime)},e.prototype.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},e.prototype.createRenderFrame=function(){this.renderFrame=new Pr({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},e.prototype.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()},e.prototype.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},e.prototype.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)},e.prototype.reset=function(){var t=this,e=new Ma(this.getEngine(),this.compositionSourceManager.sourceContent);e.type=Tt.composition,e.composition=this,this.rootComposition=e.addComponent(au),this.rootTimeline=e.getComponent(Cn),this.transform=new Ui({name:this.name}),this.transform.engine=this.getEngine(),e.transform=this.transform,this.rootItem=e,this.rendererOptions=null,this.globalTime=0,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout((function(){var e;null===(e=t.onEnd)||void 0===e||e.call(t,t)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)},e.prototype.prepareRender=function(){var t,e,r,i,n,o,a,u,l,c,h=this,f=this.renderFrame;f._renderPasses[0].meshes.length=0,this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(t){t.prepareRenderFrame(h,f)&&h.postLoaders.push(t)}));try{for(var p=s(this.rootComposition.items),d=p.next();!d.done;d=p.next()){var m=d.value.getComponents(ne);try{for(var y=(r=void 0,s(m)),v=y.next();!v.done;v=y.next()){(A=v.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(A)}}catch(t){r={error:t}}finally{try{v&&!v.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(e=p.return)&&e.call(p)}finally{if(t)throw t.error}}try{for(var g=s(this.refContent),x=g.next();!x.done;x=g.next()){var T=x.value;try{for(var E=(a=void 0,s(T.getComponent(au).items)),b=E.next();!b.done;b=E.next()){m=b.value.getComponents(ne);try{for(var C=(l=void 0,s(m)),_=C.next();!_.done;_=C.next()){var A;(A=_.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(A)}}catch(t){l={error:t}}finally{try{_&&!_.done&&(c=C.return)&&c.call(C)}finally{if(l)throw l.error}}}}catch(t){a={error:t}}finally{try{b&&!b.done&&(u=E.return)&&u.call(E)}finally{if(a)throw a.error}}}}catch(t){n={error:t}}finally{try{x&&!x.done&&(o=g.return)&&o.call(g)}finally{if(n)throw n.error}}this.postLoaders.forEach((function(t){return t.postProcessFrame(h,f)}))},e.prototype.shouldRestart=function(){var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&5===r},e.prototype.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},e.prototype.update=function(t,e){var r,i;if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var 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=null===(r=this.extraCamera)||void 0===r?void 0:r.getComponent(Cn))||void 0===i||i.update(t),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},e.prototype.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},e.prototype.callStart=function(t){var e,r,i,n,o,a;try{for(var u=s(t.itemBehaviours),l=u.next();!l.done;l=u.next()){var c=l.value;c.isActiveAndEnabled&&!c.started&&(c.start(),c.started=!0)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}try{for(var h=s(t.rendererComponents),f=h.next();!f.done;f=h.next()){var p=f.value;p.isActiveAndEnabled&&!p.started&&(p.start(),p.started=!0)}}catch(t){i={error:t}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}try{for(var d=s(t.children),m=d.next();!m.done;m=d.next()){var y=m.value;this.callStart(y)}}catch(t){o={error:t}}finally{try{m&&!m.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}},e.prototype.callUpdate=function(t,e){var r,i,n,o,a,u;try{for(var l=s(t.itemBehaviours),c=l.next();!c.done;c=l.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.update(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var f=s(t.rendererComponents),p=f.next();!p.done;p=f.next()){var d=p.value;d.isActiveAndEnabled&&d.started&&d.update(e)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}try{for(var m=s(t.children),y=m.next();!y.done;y=m.next()){var v=y.value;Ma.isComposition(v)&&v.ended&&5===v.endBehavior?(v.getComponent(au).resetStatus(),this.callUpdate(v,0)):this.callUpdate(v,e)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(u=m.return)&&u.call(m)}finally{if(a)throw a.error}}},e.prototype.callLateUpdate=function(t,e){var r,i,n,o,a,u;try{for(var l=s(t.itemBehaviours),c=l.next();!c.done;c=l.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.lateUpdate(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var f=s(t.rendererComponents),p=f.next();!p.done;p=f.next()){var d=p.value;d.isActiveAndEnabled&&d.started&&d.lateUpdate(e)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}try{for(var m=s(t.children),y=m.next();!y.done;y=m.next()){var v=y.value;this.callLateUpdate(v,e)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(u=m.return)&&u.call(m)}finally{if(a)throw a.error}}},e.prototype.buildItemTree=function(t){var e,r,i,n,o,a;if(t.composition){var u=new Map,l=t.getComponent(au).items;try{for(var c=s(l),h=c.next();!h.done;h=c.next()){var f=h.value;u.set(f.id,f)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}try{for(var p=s(l),d=p.next();!d.done;d=p.next()){if(void 0===(f=d.value).parentId)f.setParent(t);else{var m=this.getParentIdWithoutSuffix(f.parentId),y=u.get(m);if(!y)throw Error("元素引用了不存在的元素,请检查数据");Ma.isTree(y)&&f.parentId.includes("^")?(f.parent=y,f.transform.parentTransform=y.getNodeTransform(f.parentId)):(f.parent=y,f.transform.parentTransform=y.transform),y.children.push(f)}}}catch(t){i={error:t}}finally{try{d&&!d.done&&(n=p.return)&&n.call(p)}finally{if(i)throw i.error}}try{for(var v=s(l),g=v.next();!g.done;g=v.next()){f=g.value;Ma.isComposition(f)&&this.buildItemTree(f)}}catch(t){o={error:t}}finally{try{g&&!g.done&&(a=v.return)&&a.call(v)}finally{if(o)throw o.error}}}},e.prototype.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},e.prototype.updateVideo=function(){var t,e=performance.now();e-this.lastVideoUpdateTime>33&&((null!==(t=this.textures)&&void 0!==t?t:[]).forEach((function(t){return null==t?void 0:t.uploadCurrentVideoFrame()})),this.lastVideoUpdateTime=e)},e.prototype.updateCamera=function(){this.camera.updateMatrix()},e.prototype.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},e.prototype.getItemByName=function(t){return this.rootItem.find(t)},e.prototype.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return pi((t-r.z)/i,(e-r.w)/n,this.camera)},e.prototype.getEngine=function(){var t;return null===(t=this.renderer)||void 0===t?void 0:t.engine},e.prototype.hitTest=function(t,e,r,i){var n;if(this.isDestroyed)return[];var o=[],a=this.getHitTestRay(t,e);return null===(n=this.rootItem.getComponent(au))||void 0===n||n.hitTest(a,t,e,o,r,i),this.refContent.forEach((function(n){var s;null===(s=n.getComponent(au))||void 0===s||s.hitTest(a,t,e,o,r,i)})),o},e.prototype.addInteractiveItem=function(t,e){var r;if(e===gt.MESSAGE)return null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.id},e.prototype.removeInteractiveItem=function(t,e){var r;e===gt.MESSAGE&&(null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},e.prototype.destroyTextures=function(e){for(var r,i=0;i<e.length;i++){var n=e[i];if(n)if(n.sourceType!==t.TextureSourceType.data||this.texInfo[n.getInstanceId()]){if(this.autoRefTex)--this.texInfo[n.getInstanceId()]||n.dispose()}else n!==(null===(r=this.rendererOptions)||void 0===r?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n!==this.getEngine().emptyTexture&&n.dispose()}},e.prototype.destroyItem=function(t){var e=this;t.type==Tt.composition?4!==t.endBehavior&&t.getComponent(au).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(g(this.items,t),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},e.prototype.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()},e.prototype.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=ct)})),this.rootItem.dispose(),this.renderFrame.dispose(),null===(e=this.rendererOptions)||void 0===e||e.emptyTexture.dispose(),null===(r=this.pluginSystem)||void 0===r||r.destroyComposition(this),this.update=function(){lt.error("Update disposed composition: ".concat(i.name,"."))},this.onPlayerPause=ct,this.dispose=ct,o&&this.keepResource&&o.forEach((function(t){return t.dispose=n[t.id]})),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==Qi&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},e.prototype.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},e.prototype.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Can not translate position when container not assigned")},e.prototype.translate=function(t,e,r){this.rootItem.translate(t,e,r)},e.prototype.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},e.prototype.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},e.prototype.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},e.prototype.scale=function(t,e,r){this.rootItem.scale(t,e,r)},e.prototype.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},e.prototype.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},e.prototype.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},e.prototype.reloadTexture=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return this.textureOffloaded?[4,Promise.all(this.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:t.sent(),this.textureOffloaded=!1,t.label=2;case 2:return[2]}}))}))},e}(),uu=0,lu=function(){function t(t,e){var r,i;this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var n=t.jsonScene,o=t.renderLevel,a=t.textureOptions,u=t.pluginSystem,l=t.totalTime,c=n.compositions,h=n.imgUsage,f=n.compositionId;if(!a)throw new Error("scene.textures expected");var p=a;try{for(var d=s(c),m=d.next();!m.done;m=d.next()){var y=m.value;y.id===f?this.composition=y:this.refCompositions.set(y.id,y)}}catch(t){r={error:t}}finally{try{m&&!m.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}if(!this.composition)throw new Error("Invalid composition id: "+f);this.jsonScene=n,this.renderLevel=o,this.pluginSystem=u,this.totalTime=null!=l?l:0,this.imgUsage=null!=h?h:{},this.textures=p,uu=0,this.sourceContent=this.getContent(this.composition)}return t.prototype.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=void 0===s?0:s,l=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:l,camera:o,startTime:u,globalVolume:a}},t.prototype.assembleItems=function(t){var e,r,i,n,o,a,u=this,l=[];this.mask++;var c={};try{for(var h=s(this.jsonScene.components),f=h.next();!f.done;f=h.next()){var p=f.value;c[p.id]=p}}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}try{for(var d=s(t.items),m=d.next();!m.done;m=d.next()){var y=m.value,v=this.engine.jsonSceneData[y.id],g=v;if(Ks(v.renderLevel,this.renderLevel)){if(g.type===Tt.sprite||g.type===Tt.particle)try{for(var x=(o=void 0,s(g.components)),T=x.next();!T.done;T=x.next()){var E=c[T.value.id];this.preProcessItemContent(E)}}catch(t){o={error:t}}finally{try{T&&!T.done&&(a=x.return)&&a.call(x)}finally{if(o)throw o.error}}else{var b=g.content;b&&this.preProcessItemContent(b)}var C=v.pn,_=this.jsonScene.plugins,A=void 0===_?[]:_;if(g.listIndex=uu++,void 0!==C&&Number.isInteger(C)&&(g.pluginName=A[C]),g.type===Tt.composition){var S=v.content.options.refId;if(!this.refCompositions.get(S))throw new Error("Invalid Ref Composition id: "+S);var R=this.getContent(this.refCompositions.get(S));this.refCompositionProps.has(S)||this.refCompositionProps.set(S,R),R.items.forEach((function(t){u.processMask(t.content)})),g.items=R.items}l.push(g)}}}catch(t){i={error:t}}finally{try{m&&!m.done&&(n=d.return)&&n.call(d)}finally{if(i)throw i.error}}return l},t.prototype.preProcessItemContent=function(t){var e;if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var r=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=Vo(null===(e=this.jsonScene)||void 0===e?void 0:e.shapes[t.renderer.shape],r):t.renderer.shape&&At(t.renderer.shape)&&(t.renderer.shape=Vo(t.renderer.shape,r))}t.trails&&(t.trails=this.changeTex(t.trails))},t.prototype.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},t.prototype.addTextureUsage=function(t){var e,r=t,i=null!==(e=this.imgUsage)&&void 0!==e?e:{};r&&i&&(i.hasOwnProperty(r)||(i[r]=0),i[r]++)},t.prototype.processMask=function(t){if(t.maskMode!==mt.NONE&&!t.mask){var e=t.maskMode;e===mt.MASK?t.mask=++this.mask:e!==mt.OBSCURED&&e!==mt.REVERSE_OBSCURED||(t.mask=this.mask)}},t.prototype.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}(),cu=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new qr(this),this.createDefaultTexture()}return e.prototype.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.prototype.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.prototype.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.prototype.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.prototype.getInstance=function(t){return this.objectInstance[t]},e.prototype.removeInstance=function(t){delete this.objectInstance[t]},e.prototype.addPackageDatas=function(t){var e,r,i,n,o,a,u,l,c,h,f,p,d=t.jsonScene;if(d.items)try{for(var m=s(d.items),y=m.next();!y.done;y=m.next()){var v=y.value;this.addEffectsObjectData(v)}}catch(t){e={error:t}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(e)throw e.error}}if(d.materials)try{for(var g=s(d.materials),x=g.next();!x.done;x=g.next()){var T=x.value;this.addEffectsObjectData(T)}}catch(t){i={error:t}}finally{try{x&&!x.done&&(n=g.return)&&n.call(g)}finally{if(i)throw i.error}}if(d.shaders)try{for(var E=s(d.shaders),b=E.next();!b.done;b=E.next()){var C=b.value;this.addEffectsObjectData(C)}}catch(t){o={error:t}}finally{try{b&&!b.done&&(a=E.return)&&a.call(E)}finally{if(o)throw o.error}}if(d.geometries)try{for(var _=s(d.geometries),A=_.next();!A.done;A=_.next()){var S=A.value;this.addEffectsObjectData(S)}}catch(t){u={error:t}}finally{try{A&&!A.done&&(l=_.return)&&l.call(_)}finally{if(u)throw u.error}}if(d.components)try{for(var R=s(d.components),O=R.next();!O.done;O=R.next()){var w=O.value;this.addEffectsObjectData(w)}}catch(t){c={error:t}}finally{try{O&&!O.done&&(h=R.return)&&h.call(R)}finally{if(c)throw c.error}}if(t.textureOptions)try{for(var M=s(t.textureOptions),L=M.next();!L.done;L=M.next()){var I=L.value;this.addEffectsObjectData(I)}}catch(t){f={error:t}}finally{try{L&&!L.done&&(p=M.return)&&p.call(M)}finally{if(f)throw f.error}}},e.prototype.createVFXItemsAsync=function(t){return o(this,void 0,void 0,(function(){var e,r,i,n,o,u,l;return a(this,(function(a){switch(a.label){case 0:e=t.jsonScene,a.label=1;case 1:a.trys.push([1,6,7,8]),r=s(e.items),i=r.next(),a.label=2;case 2:return i.done?[3,5]:"ECS"!==(n=i.value).type&&n.type!==Tt.sprite&&n.type!==Tt.particle&&n.type!==Tt.mesh&&n.type!==Tt.skybox&&n.type!==Tt.light&&"camera"!==n.type&&n.type!==Tt.tree&&n.type!==Tt.interact&&n.type!==Tt.camera?[3,4]:this.database?[4,this.assetLoader.loadGUIDAsync(n.id)]:[3,4];case 3:a.sent(),a.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=a.sent(),u={error:o},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(u)throw u.error}return[7];case 8:return[2]}}))}))},e.prototype.addTexture=function(t){this.destroyed||v(this.textures,t)},e.prototype.removeTexture=function(t){this.destroyed||g(this.textures,t)},e.prototype.addMaterial=function(t){this.destroyed||v(this.materials,t)},e.prototype.removeMaterial=function(t){this.destroyed||g(this.materials,t)},e.prototype.addGeometry=function(t){this.destroyed||v(this.geometries,t)},e.prototype.removeGeometry=function(t){this.destroyed||g(this.geometries,t)},e.prototype.addMesh=function(t){this.destroyed||v(this.meshes,t)},e.prototype.removeMesh=function(t){this.destroyed||g(this.meshes,t)},e.prototype.addRenderPass=function(t){this.destroyed||v(this.renderPasses,t)},e.prototype.removeRenderPass=function(t){this.destroyed||g(this.renderPasses,t)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.prototype.createDefaultTexture=function(){var e={type:le.UNSIGNED_BYTE,format:le.RGBA,internalFormat:le.RGBA,wrapS:le.MIRRORED_REPEAT,wrapT:le.MIRRORED_REPEAT,minFilter:le.NEAREST,magFilter:le.NEAREST};this.emptyTexture=Me.create(this,i({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},e)),this.transparentTexture=Me.create(this,i({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},e))},e.prototype.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass ".concat(this.renderPasses.length)),this.meshes.length>0&&t.push("Mesh ".concat(this.meshes.length)),this.geometries.length>0&&t.push("Geom ".concat(this.geometries.length)),this.textures.length>0&&t.push("Tex ".concat(this.textures.length)),t.length>0&<.warn("Release GPU memory: ".concat(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}},e}(),hu=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this._deltaTime=0,this.setFPS(t),this.tickers=[]}return Object.defineProperty(t.prototype,"deltaTime",{get:function(){return this._deltaTime},enumerable:!1,configurable:!0}),t.prototype.getFPS=function(){return this.targetFPS},t.prototype.setFPS=function(t){this.targetFPS=k(t,1,120),this.interval=Math.floor(1e3/t)-2},t.prototype.getPaused=function(){return this.paused},t.prototype.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()}},t.prototype.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this._deltaTime=0,this.tickers=[]},t.prototype.pause=function(){this.paused=!0,this._deltaTime=0},t.prototype.resume=function(){this.paused=!1,this._deltaTime=0},t.prototype.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)}}}},t.prototype.add=function(t){if("function"!=typeof t)throw new Error("Ticker: The tick object must implement the tick method.");this.tickers.push(t)},t}();Na("camera",ki,Ma,!0),Na("text",Sa,Ma,!0),Na("sprite",cn,Ma,!0),Na("particle",jn,Ma,!0),Na("cal",na,Ma,!0),Na("interact",qi,Ma,!0);var fu=((ru={})[le.RGBA]=34842,ru[le.RGB]=34843,ru[le.ALPHA]=33325,ru[le.RED]=33325,ru[le.LUMINANCE_ALPHA]=33327,ru[le.LUMINANCE]=33325,ru),pu=((iu={})[le.RGBA]=34836,iu[le.RGB]=34837,iu[le.ALPHA]=33326,iu[le.RED]=33326,iu[le.LUMINANCE_ALPHA]=33328,iu[le.LUMINANCE]=33326,iu),du=function(e){function n(t,r){var i=e.call(this,t)||this;return i.initialized=!1,r&&i.fromData(r),i}return r(n,e),n.prototype.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},n.prototype.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this);var e=t.getGLPipelineContext();this.pipelineContext=e;var r=e.gl,i=this.source,n=i.target,o=void 0===n?r.TEXTURE_2D:n,a=i.name;this.textureBuffer=r.createTexture(),this.textureBuffer&&Tu(this.textureBuffer,a),this.target=o,this.update(this.source),this.release(),this.initialized=!0}},n.prototype.clone=function(){var t=new n(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},n.prototype.release=function(){switch(this.source.sourceType){case t.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case t.TextureSourceType.data:delete this.source.data;break;case t.TextureSourceType.compressed:case t.TextureSourceType.mipmaps:delete this.source.mipmaps}},n.prototype.update=function(e){var r,i,n,o,a=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var s=this.target,l=this.source,c=this.pipelineContext.gl,h=this.engine.gpuCapability.detail,f=l.sourceType,p=l.data,d=l.cube,m=l.image,y=l.video,v=l.mipmaps,g=l.mipmaps,x=e.data,T=e.cube,E=e.generateMipmap,b=e.mipmaps,C=l,_=C.format,A=C.type,S=C.internalFormat,R=0,O=0;if(this.bind(f===t.TextureSourceType.video),A===le.HALF_FLOAT?((A=h.halfFloatTexture)||lt.error("Half float texture is not support."),he(c)&&S===_&&(_===le.LUMINANCE&&(_=le.RED),S=fu[_]),h.halfFloatLinear||(l.minFilter=l.magFilter=c.NEAREST,lt.warn("Half float linear not support, change to NEAREST."))):A===c.FLOAT&&((A=h.floatTexture)||lt.error("Float texture is not support."),he(c)&&S===_&&(_===le.LUMINANCE&&(_=le.RED),S=pu[_]),h.floatLinear||(l.minFilter=c.NEAREST,l.magFilter=c.NEAREST,lt.warn("Float linear not support, change to NEAREST."))),void 0===l.premultiplyAlpha&&(l.premultiplyAlpha=!1),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l.premultiplyAlpha),void 0===l.flipY&&(l.flipY=!1),c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,l.flipY),f===t.TextureSourceType.framebuffer)x&&(R=null!==(n=x.width)&&void 0!==n?n:0,O=null!==(o=x.height)&&void 0!==o?o:0,R&&O&&(this.width!==R||this.height!==O)&&c.texImage2D(s,0,S,R,O,0,_,A,null));else if(f===t.TextureSourceType.data)s===c.TEXTURE_CUBE_MAP?T.forEach((function(t,e){var r=u(a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),2),i=r[0],n=r[1];R=Math.max(i,R),O=Math.max(n,O)})):(r=u(this.texImage2DData(c,s,0,S,_,A,p),2),R=r[0],O=r[1]);else if(f===t.TextureSourceType.image||f===t.TextureSourceType.video){if(s===c.TEXTURE_CUBE_MAP)d.forEach((function(t,e){var r=u(a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),2),i=r[0],n=r[1];R=Math.max(i,R),O=Math.max(n,O)}));else if(s===c.TEXTURE_2D){var w=null!=m?m:y;i=u(this.texImage2D(c,s,0,S,_,A,w),2),R=i[0],O=i[1]}E&&(mu(R)&&mu(O)||he(c))&&c.generateMipmap(s)}else if(f===t.TextureSourceType.mipmaps){var M;s===c.TEXTURE_2D?v.forEach((function(t,e){var r;M="data"in t?a.texImage2DData(c,s,e,S,_,A,t):a.texImage2D(c,s,e,S,_,A,t),0===e&&(r=u(M,2),R=r[0],O=r[1])})):s===c.TEXTURE_CUBE_MAP&&g.forEach((function(t,e){t.forEach((function(t,r){var i;M="data"in t?a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,S,_,A,t):a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,S,_,A,t),0===e&&(i=u(M,2),R=i[0],O=i[1])}))}))}else f===t.TextureSourceType.compressed&&b&&(R=b[0].width,O=b[0].height,b.forEach((function(t,e){c.compressedTexImage2D(s,e,S,t.width,t.height,0,t.data)})));this.width=R,this.height=O,this.setTextureFilters(c,s,l)},n.prototype.setTextureFilters=function(t,e,r){var i=r.anisotropic,n=void 0===i?4:i,o=r.wrapS,a=void 0===o?t.CLAMP_TO_EDGE:o,s=r.wrapT,u=void 0===s?t.CLAMP_TO_EDGE:s,l=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&l.setTextureAnisotropic(t,this.target,n);var c=he(t)||mu(this.width)&&mu(this.height),h=r.minFilter?r.minFilter:t.NEAREST,f=r.magFilter?r.magFilter:t.NEAREST;t.texParameteri(e,t.TEXTURE_MIN_FILTER,h),t.texParameteri(e,t.TEXTURE_MAG_FILTER,f),t.texParameteri(e,t.TEXTURE_WRAP_S,c?a:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?u:t.CLAMP_TO_EDGE)},n.prototype.fromData=function(t){e.prototype.fromData.call(this,t);var r=t,i=this.assembleOptions(r),n=i.sourceType,o=i.sourceFrom,a=i.name,s=void 0===a?"":a;this.source=i,this.sourceType=n,this.sourceFrom=o,this.name=s,this.guid=t.id},n.prototype.texImage2D=function(e,r,i,n,o,a,s){var u,l=this,c=this.source,h=c.sourceType,f=c.minFilter,p=c.magFilter;c.flipY;var d=c.wrapS,m=c.wrapT,y=null!==(u=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==u?u:2048,v=s;if(h!==t.TextureSourceType.video){var g=f!==e.NEAREST||p!==e.NEAREST||d!==e.CLAMP_TO_EDGE||m!==e.CLAMP_TO_EDGE;(g=g||s.width>y||s.height>y)&&setTimeout((function(){v=l.resizeImage(s)}))}e.texImage2D(r,i,n,o,a,v);var x=[v.width,v.height];if(h===t.TextureSourceType.video){var T=s;return[T.videoWidth,T.videoHeight]}return x},n.prototype.texImage2DData=function(t,e,r,i,n,o,a){var s=a.data,u=a.width,l=a.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return t.texImage2D(e,r,i,u,l,0,n,o,c),[u,l]},n.prototype.resizeImage=function(t,e,r){var i,n=null!==(i=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==i?i:2048;if(he(this.pipelineContext.gl)&&t.width<n&&t.height<n)return t;var o=function(t,e,r,i){var n=t.width,o=t.height,a=Math.min(e,r||fi(n)),s=Math.min(e,i||fi(o));if(s!==o||a!==n){var u=xa.getCanvas(),l=u.getContext("2d");return u.width=a,u.height=s,null==l||l.drawImage(t,0,0,n,o,0,0,a,s),lt.warn("Image resize from ".concat(n,"x").concat(o," to ").concat(a,"x").concat(s)),u}}(t,n,e,r);return o||t},n.prototype.reloadData=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return this.offloaded?[4,De().reload(this)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},n.prototype.offloadData=function(){if(this.initialized&&De().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var r=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);else if(t===e.TEXTURE_CUBE_MAP)for(var i=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<i.length;n++)e.texImage2D(i[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},n.prototype.uploadCurrentVideoFrame=function(){return o(this,void 0,void 0,(function(){var e;return a(this,(function(r){switch(r.label){case 0:return this.source.sourceType===t.TextureSourceType.video&&this.source.video&&this.initialized?(e=this.source.video).paused?[4,e.play()]:[3,2]:[3,3];case 1:r.sent(),r.label=2;case 2:return this.update({video:this.source.video}),[2,!0];case 3:return[2,!1]}}))}))},n.prototype.updateSource=function(t){this.source=this.assembleOptions(i(i({},this.source),t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},n.prototype.restore=function(){},n.prototype.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.source.sourceType===t.TextureSourceType.video&&this.source.video&&this.initialized&&(this.source.video.pause(),this.source.video.src="",this.source.video.load()),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){lt.error("This texture has been destroyed.")},this.initialize=Rt,void 0!==this.engine&&this.engine.removeTexture(this)},n}(Me);function mu(t){return 0==(t&t-1)&&0!==t}var yu,vu=function(){function t(t,e){this.engine=t,this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}return t.prototype.bind=function(){this.bindVertexArray(this.vao)},t.prototype.unbind=function(){this.bindVertexArray(null)},t.prototype.createVertexArray=function(t){var e=null;return he(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),e&&Tu(e,t),e},t.prototype.bindVertexArray=function(t){var e;he(this.gl)?this.gl.bindVertexArray(t):null===(e=this.vaoExt)||void 0===e||e.bindVertexArrayOES(t)},t.prototype.dispose=function(){var t;he(this.gl)?this.gl.deleteVertexArray(this.vao):null===(t=this.vaoExt)||void 0===t||t.deleteVertexArrayOES(this.vao)},t}(),gu=1,xu=function(){function e(e){this.engine=e,this.textures=[],this.renderBuffers=[],this.frameBuffers=[],this.destroyed=!1;var r={width:1,height:1,data:new Uint8Array([255])},i=e.getGLPipelineContext(),n=i.gl;this.gl=n,this.pipelineContext=i,this.emptyTexture2D=new du(e,{data:r,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new du(e,{target:n.TEXTURE_CUBE_MAP,cube:[r,r,r,r,r,r],sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+gu,gu++}return Object.defineProperty(e.prototype,"height",{get:function(){var t;return null===(t=this.gl)||void 0===t?void 0:t.drawingBufferHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var t;return null===(t=this.gl)||void 0===t?void 0:t.drawingBufferWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canvas",{get:function(){return this.gl.canvas},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.copy2=function(t,e){var r=this.gl;if(r){this.sourceFbo||(this.sourceFbo=r.createFramebuffer()),this.targetFbo||(this.targetFbo=r.createFramebuffer());var i=this.pipelineContext,n=r.COLOR_ATTACHMENT0;i.bindFramebuffer(r.FRAMEBUFFER,this.sourceFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,t.textureBuffer,0),i.bindFramebuffer(r.FRAMEBUFFER,this.targetFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,e.textureBuffer,0),i.bindFramebuffer(r.READ_FRAMEBUFFER,this.sourceFbo),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.targetFbo);var o=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?r.NEAREST:r.LINEAR;r.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),r.COLOR_BUFFER_BIT,o),i.bindFramebuffer(r.FRAMEBUFFER,null),i.bindFramebuffer(r.READ_FRAMEBUFFER,null),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}},e.prototype.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.prototype.createGLRenderBuffer=function(t){var e=this.gl.createRenderbuffer();return e&&v(this.renderBuffers,t),e},e.prototype.resize=function(t,e){var r=this.gl;(r&&r.drawingBufferWidth!==t||r.drawingBufferHeight!==e)&&(r.canvas.width=t,r.canvas.height=e,r.viewport(0,0,t,e),this.frameBuffers.forEach((function(r){var i=r.viewport;r.isCustomViewport||r.resize(i[0],i[1],t*r.viewportScale,e*r.viewportScale)})))},e.prototype.drawGeometry=function(t,e){if(this.gl){var r=t,i=e,n=i.shader.program;if(n){var o=n.setupAttributes(r),a=this.gl,s=r.indicesBuffer,u=r.drawStart,l=r.mode,c=r.drawCount;if(s){var h=s.type,f=s.elementCount;(c=isNaN(c)?f:c)>0&&a.drawElements(l,c,h,null!=u?u:0)}else c>0&&a.drawArrays(l,u,c);null==o||o.unbind()}else console.warn("Material "+i.name+" 的shader着色器程序未初始化。")}else console.warn("GLGPURenderer没有绑定gl对象, 无法绘制geometry")},e.prototype.createGLFrameBuffer=function(t,e){var r=this.gl.createFramebuffer();return r&&(v(this.frameBuffers,t),Tu(r,e,e)),r},e.prototype.createVAO=function(t){return new vu(this.engine,t)},e.prototype.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),g(this.textures,t),delete t.textureBuffer)},e.prototype.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},e.prototype.deleteGLFrameBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),g(this.frameBuffers,t),delete t.fbo)},e.prototype.deleteGLRenderBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),g(this.renderBuffers,t),delete t.buffer)},e.prototype.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.frameBuffers.forEach((function(e){return t.deleteGLFrameBuffer(e)})),this.frameBuffers.length=0,this.renderBuffers.forEach((function(e){return t.deleteGLRenderBuffer(e)})),this.renderBuffers.length=0,this.textures.forEach((function(e){return t.deleteGLTexture(e)})),this.textures.length=0)},e.prototype.lost=function(t){lt.error("gl lost, destroy glRenderer by default",t.target),this.deleteResource()},e.prototype.dispose=function(t){this.deleteResource();var e=this.gl;if(e&&t){var r=e.getExtension("WEBGL_lose_context");null==r||r.loseContext()}this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},e}();function Tu(t,e,r){void 0!==e&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,r&&(t.__SPECTOR_Object_TAG.id=r)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var Eu,bu=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var r=e.target,i=void 0===r?le.ARRAY_BUFFER:r,n=e.type,o=void 0===n?le.FLOAT:n,a=e.name,s=e.usage,u=void 0===s?le.STATIC_DRAW:s,l=e.data,c=e.elementCount,h=function(t){var e,r;return null!==(r=null===(e=Cu[t])||void 0===e?void 0:e.BYTES_PER_ELEMENT)&&void 0!==r?r:0}(o);this.target=i,this.type=o,this.usage=u,this.glBuffer=this.createGLBuffer(a),this.bytesPerElement=h,l?this.bufferData(l):c&&this.bufferData(h*c)}return Object.defineProperty(t.prototype,"elementCount",{get:function(){return this.byteLength/this.bytesPerElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return e&&Tu(e,t),e},t.prototype.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},t.prototype.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var r=this.pipelineContext.gl,i=this.target;r.bindBuffer(i,this.glBuffer),0===e?r.bufferData(i,1,this.usage):(r.bufferData(i,e,this.usage),"number"!=typeof t&&r.bufferSubData(i,0,t))}else this.byteLength=0},t.prototype.bufferSubData=function(t,e){if(this.pipelineContext){var r=this.pipelineContext.gl,i=this.target,n=t*this.bytesPerElement,o=n+e.byteLength;r.bindBuffer(i,this.glBuffer),o>this.byteLength&&(this.byteLength=o,r.bufferData(i,o,this.usage)),r.bufferSubData(i,n,e)}else this.byteLength=0},t.prototype.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},t.prototype.readSubData=function(t,e){return!!he(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},t}(),Cu=((yu={})[le.INT]=Int32Array,yu[le.FLOAT]=Float32Array,yu[le.SHORT]=Int16Array,yu[le.BYTE]=Int8Array,yu[le.UNSIGNED_BYTE]=Uint8Array,yu[le.UNSIGNED_INT]=Uint32Array,yu[le.UNSIGNED_SHORT]=Uint16Array,yu);var _u=((Eu={})[Uint8Array.BYTES_PER_ELEMENT]=le.UNSIGNED_BYTE,Eu[Uint16Array.BYTES_PER_ELEMENT]=le.UNSIGNED_SHORT,Eu[Uint32Array.BYTES_PER_ELEMENT]=le.UNSIGNED_INT,Eu),Au=1,Su=function(t){function e(e,r){var i=t.call(this,e)||this;return i.drawCount=0,i.buffers={},i.vaos={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,r&&i.processProps(r),i}return r(e,t),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInitialized",{get:function(){return this.initialized},enumerable:!1,configurable:!0}),e.prototype.getOptions=function(){return i({},this.options)},e.prototype.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;F(e),e.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new bu(r,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(r,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},e.prototype.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},e.prototype.setAttributeData=function(t,e){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t),i=this.attributes[t].dataSource;if(r){var n=r.usage,o=r.target;this.bufferProps[i]={data:e,usage:n,target:o,elementCount:e.length},this.dirtyFlags[i].discard=!0,this.dirtyFlags[i].dirty=!0}}},e.prototype.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},e.prototype.setAttributeSubData=function(t,e,r){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t);if(i&&null!=i.data){var n=e,o=e+r.length;if(i.data.length<o){var a=new r.constructor(o);a.set(i.data),i.data=a,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var s=this.dirtyFlags[t];s.start=Math.min(s.start,n),s.end=Math.max(s.end,o-1)}i.data.set(r,n),this.dirtyFlags[t].dirty=!0}}},e.prototype.getIndexData=function(){return this.indices},e.prototype.setIndexData=function(t){(t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array)&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},e.prototype.setIndexSubData=function(t,e){var r;if(this.indices){var i=t,n=t+e.length;if(this.indices.length<n){var o=new e.constructor(n);o.set(this.indices),this.indices=o,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var a=this.dirtyFlags.index;a.start=Math.min(a.start,i),a.end=Math.max(a.end,n-1)}null===(r=this.indices)||void 0===r||r.set(e,i),this.dirtyFlags.index.dirty=!0}},e.prototype.getAttributeStride=function(t){var e=this.attributes[t],r=e.stride,i=e.size,n=e.type;return r||i*rr[n]},e.prototype.getAttributeNames=function(){return this.attributesName},e.prototype.setDrawStart=function(t){this.drawStart=t},e.prototype.getDrawStart=function(){return this.drawStart},e.prototype.setDrawCount=function(t){this.drawCount=t},e.prototype.getDrawCount=function(){return this.drawCount},e.prototype.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},e.prototype.createIndicesBuffer=function(t,e){var r=_u[e.BYTES_PER_ELEMENT],i={data:e,target:le.ELEMENT_ARRAY_BUFFER,type:r,name:"".concat(this.name,"##index")};return new bu(t,i)},e.prototype.flush=function(){var t=this;if(this.initialized){var e=this.attributes,r=this.bufferProps,i=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var o,a,s=t.dirtyFlags[n];if("index"==n)o=t.indicesBuffer,a=i;else{var u=e[n].dataSource;o=t.buffers[u],a=r[u].data}if((s.dirty||s.discard)&&o&&a){if(s.discard)o.bufferData(a);else{var l=s.start*a.BYTES_PER_ELEMENT+a.byteOffset,c=s.end-s.start+1,h=new a.constructor(a.buffer,l,c);o.bufferSubData(s.start,h)}s.start=Number.POSITIVE_INFINITY,s.end=0,s.dirty=s.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(i){var n=t.attributesReleasable[i],o=e[i].dataSource;r[o]&&n&&(r[o].data=void 0)})),this.indicesReleasable}},e.prototype.processProps=function(t){var e=t,r=e.drawStart,i=void 0===r?0:r,n=e.drawCount,o=e.mode,a=e.indices,s=e.name,u=void 0===s?"effectsGeometry:".concat(Au++):s,l=e.bufferUsage,c=void 0===l?le.STATIC_DRAW:l;this.name=u;var h={},f=[],p={},d={},m={},y=c;this.drawStart=i,void 0!==n&&(this.drawCount=n),this.mode=isNaN(o)?le.TRIANGLES:o,Object.keys(e.attributes).forEach((function(t){var r=e.attributes[t],i=r.size,n=r.stride,o=r.offset,a=r.normalize,s=r,u=s.type,l=void 0===u?le.FLOAT:u,c=s.releasable,v=r.data;if(!l||"dataSource"in r||v||(v=nr(l)),v){var g=v instanceof Float32Array?le.FLOAT:le.INT;h[t]={data:v,usage:y,target:le.ARRAY_BUFFER,name:t},p[t]={size:i,stride:n,offset:o,type:null!=l?l:g,normalize:!!a,dataSource:t},m[t]=null!=c&&c,d[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=r.dataSource;x&&(p[t]={size:i,stride:n,offset:o,type:l,dataSource:x,normalize:!!a})}f.push(t)})),d.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==a?void 0:a.data,this.indicesReleasable=!0===(null==a?void 0:a.releasable),this.bufferProps=h,this.attributes=p,this.attributesName=f,this.attributesReleasable=m,this.dirtyFlags=d,this.options=e,this.initialized=!1},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var r=function(t){for(var e=atob(t),r=new Uint8Array(e.length),i=0;i<e.length;i++)r[i]=e.charCodeAt(i);var n=r.buffer;return n}(e.buffer),i=e.vertexData.vertexCount,n=e.vertexData.channels[0],o=e.vertexData.channels[1],a=e.vertexData.channels[2],s=new Float32Array(r,n.offset,n.dimension*i),u=new Float32Array(r,o.offset,o.dimension*i),l=new Float32Array(r,a.offset,a.dimension*i),c=new Uint16Array(r,e.indexOffset),h={mode:le.TRIANGLES,attributes:{aPos:{type:le.FLOAT,size:3,data:s},aUV:{type:le.FLOAT,size:2,data:u},aNormal:{type:le.FLOAT,size:3,data:l}}};h.indices={data:c},h.drawCount=c.length,this.processProps(h)},e.prototype.dispose=function(){var t,e=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach((function(t){e.buffers[t].dispose()})),this.buffers={},null===(t=this.indicesBuffer)||void 0===t||t.dispose(),Object.keys(this.vaos).forEach((function(t){var r;null===(r=e.vaos[t])||void 0===r||r.dispose(),e.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},e}(ir);var Ru=function(){function t(){this.reset()}return t.prototype.setBlendColor=function(t){var e=u(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.blendColor[0]===r&&this.blendColor[1]===i&&this.blendColor[2]===n&&this.blendColor[3]===o||(this.blendColor[0]=r,this.blendColor[1]=i,this.blendColor[2]=n,this.blendColor[3]=o)},t.prototype.setBlending=function(t){this.blending!==t&&(this.blending=t)},t.prototype.setBlendFunctionParameters=function(t){var e=u(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.blendFunctionParameters[0]===r&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===n&&this.blendFunctionParameters[3]===o||(this.blendFunctionParameters[0]=r,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=n,this.blendFunctionParameters[3]=o)},t.prototype.setBlendEquationParameters=function(t){var e=u(t,2),r=e[0],i=e[1];this.blendEquationParameters[0]===r&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=r,this.blendEquationParameters[1]=i)},t.prototype.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},t.prototype.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},t.prototype.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},t.prototype.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},t.prototype.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},t.prototype.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},t.prototype.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},t.prototype.setColorMask=function(t){var e=u(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.colorMask[0]===r&&this.colorMask[1]===i&&this.colorMask[2]===n&&this.colorMask[3]===o||(this.colorMask[0]=r,this.colorMask[1]=i,this.colorMask[2]=n,this.colorMask[3]=o)},t.prototype.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},t.prototype.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},t.prototype.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},t.prototype.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},t.prototype.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},t.prototype.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},t.prototype.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},t.prototype.setCulling=function(t){this.culling!==t&&(this.culling=t)},t.prototype.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},t.prototype.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},t.prototype.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[le.ONE,le.ONE_MINUS_SRC_ALPHA,le.ONE,le.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[le.FUNC_ADD,le.FUNC_ADD],this.depthTest=!1,this.depthMask=!1,this.depthRange=[0,1],this.depthFunc=le.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[le.ALWAYS,le.ALWAYS],this.stencilOpFail=[le.KEEP,le.KEEP],this.stencilOpZFail=[le.KEEP,le.KEEP],this.stencilOpZPass=[le.KEEP,le.KEEP],this.culling=!1,this.frontFace=le.CW,this.cullFace=le.FRONT},t.prototype.apply=function(t){if(t.toggle(le.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(le.BLEND,this.blending),t.toggle(le.DEPTH_TEST,this.depthTest),t.toggle(le.STENCIL_TEST,this.stencilTest),t.toggle(le.CULL_FACE,this.culling),t.toggle(le.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(le.BACK,this.stencilMask[1]),t.stencilMaskSeparate(le.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(le.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(le.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(le.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(le.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,r=e.blendColor,i=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(r[0],r[1],r[2],r[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),Ou=K,wu=Z,Mu=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.floats={},t.ints={},t.vector2s={},t.vector3s={},t.vector4s={},t.colors={},t.quaternions={},t.matrices={},t.matrice3s={},t.textures={},t.floatArrays={},t.vector4Arrays={},t.matrixArrays={},t.samplers=[],t.uniforms=[],t.uniformDirtyFlag=!0,t.glMaterialState=new Ru,t}return r(n,e),Object.defineProperty(n.prototype,"blending",{get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendColor",{get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendFunction",{get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendEquation",{get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthTest",{get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthMask",{get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthRange",{get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthFunc",{get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"polygonOffsetFill",{get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"polygonOffset",{get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sampleAlphaToCoverage",{get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"colorMask",{get:function(){return this.glMaterialState.colorMask},set:function(t){t&&this.glMaterialState.setColorMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilTest",{get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilMask",{get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilRef",{get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilFunc",{get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpFail",{get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpZFail",{get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpZPass",{get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"culling",{get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"frontFace",{get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cullFace",{get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)},enumerable:!1,configurable:!0}),n.prototype.enableKeyword=function(t){throw new Error("Method not implemented.")},n.prototype.disableKeyword=function(t){throw new Error("Method not implemented.")},n.prototype.isKeywordEnabled=function(t){throw new Error("Method not implemented.")},n.prototype.createMaterialStates=function(t){this.sampleAlphaToCoverage=!!t.sampleAlphaToCoverage,this.depthTest=t.depthTest,this.depthMask=t.depthMask,this.depthRange=t.depthRange,this.depthFunc=t.depthFunc,this.colorMask=t.colorMask,this.polygonOffset=t.polygonOffset,this.polygonOffsetFill=t.polygonOffsetFill,this.blending=t.blending,this.blendFunction=t.blendFunction,this.stencilTest=t.stencilTest},Object.defineProperty(n.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),n.prototype.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;if(e.addMaterial(this),!this.shader){var r=e.getGLPipelineContext();this.shader=r.shaderLibrary.createShader(this.shaderSource)}this.shader.initialize(e),Object.keys(this.textures).forEach((function(e){var r=t.textures[e];_t(r.initialize)?r.initialize():lt.error("".concat(JSON.stringify(r)," is not valid Texture to initialize"))})),this.initialized=!0}},n.prototype.setupStates=function(t){this.glMaterialState.apply(t)},n.prototype.use=function(t,e){var r,i,n,o,a,u=t.engine.getGLPipelineContext();if(this.shader.program.bind(),this.setupStates(u),e){try{for(var l=s(e.uniforms),c=l.next();!c.done;c=l.next())a=c.value,this.checkUniform(a)}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var h=s(e.samplers),f=h.next();!f.done;f=h.next())a=f.value,this.samplers.includes(a)||(this.samplers.push(a),this.uniformDirtyFlag=!0)}catch(t){n={error:t}}finally{try{f&&!f.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}}if(this.uniformDirtyFlag&&(this.shader.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirtyFlag=!1),e){for(a in e.floats)this.shader.setFloat(a,e.floats[a]);for(a in e.ints)this.shader.setInt(a,e.ints[a]);for(a in e.matrices)this.shader.setMatrix(a,e.matrices[a])}for(a in this.textures)this.textures[a].textureBuffer||this.textures[a].initialize();for(a in this.floats)this.shader.setFloat(a,this.floats[a]);for(a in this.ints)this.shader.setInt(a,this.ints[a]);for(a in this.floatArrays)this.shader.setFloats(a,this.floatArrays[a]);for(a in this.textures)this.shader.setTexture(a,this.textures[a]);for(a in this.vector2s)this.shader.setVector2(a,this.vector2s[a]);for(a in this.vector3s)this.shader.setVector3(a,this.vector3s[a]);for(a in this.vector4s)this.shader.setVector4(a,this.vector4s[a]);for(a in this.colors)this.shader.setColor(a,this.colors[a]);for(a in this.quaternions)this.shader.setQuaternion(a,this.quaternions[a]);for(a in this.matrices)this.shader.setMatrix(a,this.matrices[a]);for(a in this.matrice3s)this.shader.setMatrix3(a,this.matrice3s[a]);for(a in this.vector4Arrays)this.shader.setVector4Array(a,this.vector4Arrays[a]);for(a in this.matrixArrays)this.shader.setMatrixArray(a,this.matrixArrays[a])},n.prototype.getFloat=function(t){return this.floats[t]},n.prototype.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},n.prototype.getInt=function(t){return this.ints[t]},n.prototype.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},n.prototype.getFloats=function(t){return this.floatArrays[t]},n.prototype.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},n.prototype.getVector2=function(t){return this.vector2s[t]},n.prototype.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},n.prototype.getVector3=function(t){return this.vector3s[t]},n.prototype.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},n.prototype.getVector4=function(t){return this.vector4s[t]},n.prototype.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},n.prototype.getColor=function(t){return this.colors[t]},n.prototype.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},n.prototype.getQuaternion=function(t){return this.quaternions[t]},n.prototype.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},n.prototype.getMatrix=function(t){return this.matrices[t]},n.prototype.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},n.prototype.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},n.prototype.getVector4Array=function(t){return this.vector4Arrays[t]},n.prototype.setVector4Array=function(t,e){var r,i;this.checkUniform(t),this.vector4Arrays[t]=[];try{for(var n=s(e),o=n.next();!o.done;o=n.next()){var a=o.value;this.vector4Arrays[t].push(a.x,a.y,a.z,a.w)}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},n.prototype.getMatrixArray=function(t){return this.matrixArrays[t]},n.prototype.setMatrixArray=function(t,e){var r,i;this.checkUniform(t),this.matrixArrays[t]=[];try{for(var n=s(e),o=n.next();!o.done;o=n.next())for(var a=o.value,u=0;u<16;u++)this.matrixArrays[t].push(a.elements[u])}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},n.prototype.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},n.prototype.getTexture=function(t){return this.textures[t]},n.prototype.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirtyFlag=!0),this.textures[t]=e},n.prototype.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},n.prototype.clone=function(t){var e=t||this.props,r=this.engine;F(r);var i=new n(r,e);return i.glMaterialState=Object.assign(new Ru,i.glMaterialState),i.floats=this.floats,i.ints=this.ints,i.vector2s=this.vector2s,i.vector3s=this.vector3s,i.vector4s=this.vector4s,i.colors=this.colors,i.quaternions=this.quaternions,i.matrices=this.matrices,i.textures=this.textures,i.floatArrays=this.floatArrays,i.vector4Arrays=this.vector4Arrays,i.matrixArrays=this.matrixArrays,i.samplers=this.samplers,i.uniforms=this.uniforms,i.uniformDirtyFlag=!0,i},n.prototype.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var r,n=i({vector2s:{},matrices:{},textures:{},floatArrays:{},blending:!1,zTest:!1,zWrite:!1},t);for(r in this.blending=n.blending,this.depthTest=n.zTest,this.depthMask=n.zWrite,n.floats)this.setFloat(r,n.floats[r]);for(r in n.ints)this.setInt(r,n.ints[r]);for(r in n.vector4s){var o=n.vector4s[r];this.setVector4(r,new K(o.x,o.y,o.z,o.w))}for(r in n.colors){var a=n.colors[r];this.setColor(r,new et(a.r,a.g,a.b,a.a))}for(r in n.textures){var s=n.textures[r];this.setTexture(r,s)}t.shader&&(this.shader=t.shader,this.shaderSource=this.shader.source),this.initialized=!1},n.prototype.toData=function(){var e=this.taggedProperties;for(var r in this.shader&&(e.shader=this.shader),e.floats={},e.ints={},e.vector4s={},e.dataType=t.DataType.Material,this.blending&&(e.blending=this.blending),this.depthTest&&(e.zTest=this.depthTest),this.depthMask&&(e.zWrite=this.depthMask),this.floats)e.floats[r]=this.floats[r];for(var i in this.ints)e.ints[i]=this.ints[i];for(var n in this.vector4s)e.vector4s[n]=this.vector4s[n];for(var o in this.colors)e.colors[o]=this.colors[o];return e},n.prototype.cloneUniforms=function(t){var e,r=t;for(e in r.floats)this.setFloat(e,r.floats[e]);for(e in r.ints)this.setInt(e,r.ints[e]);for(e in r.floatArrays)this.setFloats(e,r.floatArrays[e]);for(e in r.textures)this.setTexture(e,r.textures[e]);for(e in r.vector2s)this.setVector2(e,r.vector2s[e]);for(e in r.vector3s)this.setVector3(e,r.vector3s[e]);for(e in r.vector4s)this.setVector4(e,r.vector4s[e]);for(e in r.colors)this.setColor(e,r.colors[e]);for(e in r.quaternions)this.setQuaternion(e,r.quaternions[e]);for(e in r.matrices)this.setMatrix(e,r.matrices[e]);for(e in r.vector4Arrays){for(var i=[],n=0;n<r.vector4Arrays[e].length;n+=4)i.push(new Ou(r.vector4Arrays[e][n],r.vector4Arrays[e][n+1],r.vector4Arrays[e][n+2],r.vector4Arrays[e][n+3]));this.setVector4Array(e,i)}for(e in r.matrixArrays){var o=[];for(n=0;n<r.matrixArrays[e].length;n+=16){for(var a=wu.fromIdentity(),s=0;s<16;s++)a.elements[s]=r.matrixArrays[e][n+s];o.push(a)}this.setMatrixArray(e,o)}},n.prototype.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirtyFlag=!0)},n.prototype.dispose=function(e){var r,i=this;this.destroyed||(null===(r=this.shader)||void 0===r||r.dispose(),(null==e?void 0:e.textures)!==t.DestroyOptions.keep&&Object.keys(this.textures).forEach((function(t){var e=i.textures[t];e!==i.engine.emptyTexture&&e.dispose()})),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=Rt,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},n}(Xe),Lu=function(){function e(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}return e.prototype.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},e.prototype.copyTexture=function(e,r){this.renderer&&(e.initialize(),r.initialize(),r.updateSource({sourceType:t.TextureSourceType.framebuffer,data:{width:r.getWidth()||e.getWidth(),height:r.getHeight()||e.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(e,r):this.copy1(e,r))},e.prototype.copy2=function(t,e){var r,i=this.renderer.getFrameBuffer();null===(r=this.renderer)||void 0===r||r.glRenderer.copy2(t,e),this.renderer.setFrameBuffer(i)},e.prototype.copy1=function(t,e){var r=this.copyRenderPass;if(r){var i=this.renderer;if(i){var n=r.frameBuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),i.glRenderer.resetColorAttachments(n,[e]),r.meshes[0].material.setTexture("uTex",t),i.renderRenderPass(r)}}},e.prototype.createCopyRenderPass=function(){var e="mri-copy-mesh",r={texture:{format:le.RGBA}},i=this.renderer.engine,n=new Su(i,{name:e,mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=i.gpuCapability.level,a=new Mu(i,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:ve([],"\n precision highp float;\n attribute vec2 aPos;\n varying vec2 vTex;\n void main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n }\n ",t.ShaderType.vertex,o),fragment:ve([],"\n precision highp float;\n varying vec2 vTex;\n uniform sampler2D uTex;\n void main(){gl_FragColor = texture2D(uTex,vTex);}\n ",t.ShaderType.fragment,o),glslVersion:2===o?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var s=new ur(i,{name:e,geometry:n,material:a,priority:0});return new Iu(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[r],meshes:[s]})},e.prototype.dispose=function(){var t;this.renderer&&(null===(t=this.copyRenderPass)||void 0===t||t.dispose(),this.renderer=void 0)},e}(),Iu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.configure=function(t){this.currentFrameBuffer=t.getFrameBuffer(),t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFrameBuffer(this.currentFrameBuffer)},e}(pr),Pu=function(){function t(t,e,r){var i=this;void 0===e&&(e="webgl"),void 0===r&&(r={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],F(t),this.gl=oe(t,e,r),this.contextLostListener=function(t){var e,r,n;try{for(var o=s(i.lostHandlers),a=o.next();!a.done;a=o.next()){a.value.lost(t)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}null===(n=i.canvas)||void 0===n||n.removeEventListener("webglcontextlost",i.contextLostListener)},this.contextRestoredListener=function(t){var e,r,n;try{for(var o=s(i.restoreHandlers),a=o.next();!a.done;a=o.next()){a.value.restore()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}null===(n=i.canvas)||void 0===n||n.addEventListener("webglcontextlost",i.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}return t.prototype.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},t.prototype.addLostHandler=function(t){this.lostHandlers.push(t)},t.prototype.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},t.prototype.addRestoreHandler=function(t){this.restoreHandlers.push(t)},t.prototype.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),Fu=function(t){function e(e){var r=t.call(this)||this;return r.gpuCapability=new Ur(e),r}return r(e,t),e.prototype.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},e.prototype.getGLRenderer=function(){return this.renderer},e.prototype.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},e.prototype.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(cu),Nu=function(t){function e(e,r){var i=t.call(this,e)||this;return i.initialized=!1,void 0!==r&&i.initialize(r),i}return r(e,t),e.prototype.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderBuffer(this))},e.prototype.setSize=function(t,e){if(this.initialized){if(t!==this.size[0]||e!==this.size[1]){var r=this.renderer,i=r.gl;r.pipelineContext.bindRenderBuffer(i.RENDERBUFFER,this.buffer),t&&e?i.renderbufferStorage(i.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):lt.error("Invalid render buffer size: ".concat(t,"x").concat(e))}}else lt.error("Can't set size for uninitialized render buffer")},e.prototype.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderBuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Rt},e}(Vr),Du=1,Vu=function(e){function i(r,i){var n,o=e.call(this)||this;o.attachmentTextures=[],o.renderer=i,o.engine=i.engine;var a=r.depthStencilAttachment,s=r.viewport,u=r.isCustomViewport,l=r.storeAction,c=r.viewportScale,h=void 0===c?1:c,f=r.name,p=void 0===f?"GLFrameBuffer".concat(Du++):f;return o.depthStencilStorageType=null!==(n=null==a?void 0:a.storageType)&&void 0!==n?n:t.RenderPassAttachmentStorageType.none,o.viewport=s,o.isCustomViewport=!!u,o.viewportScale=h,o.name=p,o.storeAction=l,o.updateProps(r),o}return r(i,e),Object.defineProperty(i.prototype,"stencilStorage",{get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthStorage",{get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),i.prototype.getDepthTexture=function(){return this.depthTexture},i.prototype.getStencilTexture=function(){return this.stencilTexture},i.prototype.getColorTextures=function(){return this.colorTextures},i.prototype.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(e){e.initialize(),v(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&v(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&v(this.attachmentTextures,this.depthTexture.textureBuffer)},i.prototype.updateProps=function(e){var r,i,n=this.renderer,o=this.engine.gpuCapability,a=null!==(r=e.depthStencilAttachment)&&void 0!==r?r:{storageType:t.RenderPassAttachmentStorageType.none},s=e.attachments.length>0;this.externalStorage=!1;var u=!0;if(e.attachments.length>1&&!o.detail.drawBuffers)throw Error("multiple color attachments not support");var l=null===(i=e.depthStencilAttachment)||void 0===i?void 0:i.texture,c=o.detail.readableDepthStencilTextures;if(this.colorTextures=e.attachments.slice(),!s&&a.storageType!==t.RenderPassAttachmentStorageType.none)throw Error("use depth stencil attachment without color attachments");s&&(this.fbo=n.glRenderer.createGLFrameBuffer(this,this.name));var h=a.storageType;if(h===t.RenderPassAttachmentStorageType.depth_stencil_opaque){if(a.storage){if(!(a.storage instanceof Nu))throw Error("invalid depth stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new Nu({format:le.DEPTH_STENCIL,attachment:le.DEPTH_STENCIL_ATTACHMENT,storageType:h},n.glRenderer);u=!1}else if(h===t.RenderPassAttachmentStorageType.depth_16_opaque)if(a.storage){if(!(a.storage instanceof Nu))throw Error("invalid depth attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new Nu({attachment:le.DEPTH_ATTACHMENT,format:le.DEPTH_COMPONENT16,storageType:h},n.glRenderer);else if(h===t.RenderPassAttachmentStorageType.stencil_8_opaque)if(a.storage){if(!(a.storage instanceof Nu))throw Error("invalid stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new Nu({attachment:le.STENCIL_ATTACHMENT,format:le.STENCIL_INDEX8,storageType:h},n.glRenderer);else if(h===t.RenderPassAttachmentStorageType.depth_16_texture){if(!c)throw Error("depth texture is not support in framebuffer");this.depthTexture=null!=l?l:new du(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:le.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:le.UNSIGNED_SHORT,name:"".concat(this.name,"##depthTex")}),this.depthTexture.initialize()}else if(h===t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture){if(!c)throw Error("depth stencil texture is not support in framebuffer");this.depthTexture=this.stencilTexture=null!=l?l:new du(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:le.DEPTH_STENCIL,internalFormat:o.internalFormatDepth24_stencil8,type:o.UNSIGNED_INT_24_8,name:"".concat(this.name,"##dpthStclTex")}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},i.prototype.getStoreAttachments=function(e,r){var i=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(e&&he(i)&&n>0){var o=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&v(o,r?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&v(o,r?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var a=0;a<n;a++)v(o,i["COLOR_ATTACHMENT".concat(a)]);return o}},i.prototype.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},i.prototype.bind=function(){var t=this,e=this.renderer.glRenderer.gl,r=this.renderer.pipelineContext;if(this.fbo){var i=e.FRAMEBUFFER,n=u(this.viewport,4),o=n[0],a=n[1],s=n[2],l=n[3];r.bindFramebuffer(i,this.fbo),r.viewport(o,a,s,l);var c=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(e){var i=r.textureUnitDict[e];i!==c&&i&&t.attachmentTextures.includes(i)&&(r.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)r.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var f=this,p=f.depthStencilRenderBuffer,d=f.depthTexture,m=f.stencilTexture;if(r.activeTexture(e.TEXTURE0),p)p.setSize(s,l),e.framebufferRenderbuffer(i,p.attachment,e.RENDERBUFFER,p.buffer);else if(d){d.source.data={width:s,height:l},d.update({data:{width:s,height:l,data:new Uint16Array(0)}});var y=d&&m?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(i,y,e.TEXTURE_2D,d.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var v=e.checkFramebufferStatus(i);if(v!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed, status: ".concat(v,", error: ").concat(e.getError()));this.ready=!0}}},i.prototype.resetColorTextures=function(t){var e,r,i=t,n=this.renderer.glRenderer.gl,o=this.engine.gpuCapability,a=this.viewport,u=[];if(i){try{for(var l=s(i),c=l.next();!c.done;c=l.next()){c.value.initialize()}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}this.colorTextures=i.slice()}this.renderer.pipelineContext.activeTexture(n.TEXTURE0),this.colorTextures.forEach((function(t,e){var r={width:a[2],height:a[3],data:new Uint8Array(0)};t.update({data:r}),o.framebufferTexture2D(n,n.FRAMEBUFFER,e,n.TEXTURE_2D,t.textureBuffer),u.push(!0)})),o.drawBuffers(n,u),this.updateAttachmentTextures()},i.prototype.resize=function(t,e,r,i){var n=u(this.viewport,4),o=n[0],a=n[1],s=n[2],l=n[3];o===t&&a===e&&s===r&&l===i||(this.viewport=[t,e,r,i],this.ready=!1,this.bind())},i.prototype.dispose=function(e){var r,i,n=this.renderer;if(n){n.glRenderer.deleteGLFrameBuffer(this),delete this.fbo;var o=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force;(o===t.RenderPassDestroyAttachmentType.force||o===t.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)&&(null===(r=this.depthStencilRenderBuffer)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose()),this.renderer=this.stencilRenderBuffer=this.depthStencilRenderBuffer=null}},i}(Yr);var zu,Uu,Bu=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return e>>>0},ku=((zu={})[le.FLOAT]=1,zu[le.INT]=1,zu[le.UNSIGNED_INT]=1,zu[le.SHORT]=1,zu[le.BOOL]=1,zu[le.UNSIGNED_SHORT]=1,zu[le.FLOAT_VEC2]=2,zu[le.FLOAT_VEC3]=3,zu[le.FLOAT_VEC4]=4,zu[le.FLOAT_MAT2]=4,zu[le.FLOAT_MAT3]=9,zu[le.FLOAT_MAT4]=16,zu[le.FLOAT_MAT2x3]=6,zu[le.FLOAT_MAT2x4]=8,zu[le.FLOAT_MAT4x3]=12,zu[le.FLOAT_MAT4x2]=8,zu[le.FLOAT_MAT3x4]=12,zu[le.FLOAT_MAT3x2]=6,zu[le.INT_VEC2]=2,zu[le.INT_VEC3]=3,zu[le.INT_VEC4]=4,zu[le.UNSIGNED_INT_VEC2]=2,zu[le.UNSIGNED_INT_VEC3]=3,zu[le.UNSIGNED_INT_VEC4]=4,zu[le.BOOL_VEC2]=2,zu[le.BOOL_VEC3]=3,zu[le.BOOL_VEC4]=4,zu),Gu=Yu(Float32Array),Xu=Yu(Int32Array),Hu=Yu(Uint8Array);function ju(t){return function(e,r,i,n){var o={start:r[1],dirty:!0};if(r[2]>1){var a=e;if(a.length){for(var s=n[1]||a.length,u=r[4]/t.BYTES_PER_ELEMENT,l=o.buffer=new t(s*u),c=n[0]||0,h=0;h<s;h++)l[h*u]=a[h+c];o.start+=c*u}}else o.buffer=new t([e]);return o}}function Yu(t){return function(e,r,i,n){for(var o=r[8],a=r[2],s=r[5],u=1===a?o:r[4],l=s?u/s:1,c=u/t.BYTES_PER_ELEMENT/l,h=o/t.BYTES_PER_ELEMENT/c,f=ku[r[0]],p=f/l,d=(n[0]||0)*f,m=n[1]?l*n[1]:h,y=new t(c*m),v={start:r[1]+u*(n[0]||0),dirty:!0,buffer:y},g=0,x=0,T=d;g<m;g++){for(var E=0;E<p;E++)y[x+E]=e[T+E];x+=c,T+=p}return v}}function Wu(t,e){for(var r=[],i=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),o=function(n){var o=t.getActiveUniformBlockName(e,n),a={index:t.getUniformBlockIndex(e,o),usedByVertexShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:o,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,r[n]=a;for(var s=a.uniformIndices,u=[],l=0;l<s.length;l++){var c=t.getActiveUniform(e,s[l]).name.replace("[0]","");a.uniforms[c]=[0,0,0,0,0,0,0,l,0],u[l]=c,i.push(c)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach((function(r,i){t.getActiveUniforms(e,s,r).forEach((function(t,e){var r=u[e];a.uniforms[r][i]=+t}))}));for(l=0;l<u.length;l++){var h=a.uniforms[u[l]],f=a.uniforms[u[l+1]],p=f?f[1]:a.size;h[8]=p-h[1]}a.id=function(t){var e=t.name,r=t.size,i=t.uniforms,n=t.uniformIndices;return Object.keys(i).map((function(t){return"".concat(t,"[").concat(i[t].join(":"),"]")})).join("+"),Bu("".concat(e,"+"),"".concat(r,"+"),"".concat(n.length,"+"))}(a)+""},a=0;a<n;++a)o(a);return{blockSpecs:r,blockUniformNames:i}}(Uu={})[le.FLOAT]=ju(Float32Array),Uu[le.INT]=ju(Int32Array),Uu[le.UNSIGNED_INT]=ju(Uint32Array),Uu[le.SHORT]=ju(Int16Array),Uu[le.BOOL]=ju(Uint8Array),Uu[le.UNSIGNED_SHORT]=ju(Uint16Array),Uu[le.FLOAT_VEC2]=Gu,Uu[le.FLOAT_VEC3]=Gu,Uu[le.FLOAT_VEC4]=Gu,Uu[le.FLOAT_MAT2]=Gu,Uu[le.FLOAT_MAT3]=Gu,Uu[le.FLOAT_MAT4]=Gu,Uu[le.FLOAT_MAT2x3]=Gu,Uu[le.FLOAT_MAT2x4]=Gu,Uu[le.FLOAT_MAT4x3]=Gu,Uu[le.FLOAT_MAT4x2]=Gu,Uu[le.FLOAT_MAT3x4]=Gu,Uu[le.FLOAT_MAT3x2]=Gu,Uu[le.INT_VEC2]=Xu,Uu[le.INT_VEC3]=Xu,Uu[le.INT_VEC4]=Xu,Uu[le.UNSIGNED_INT_VEC2]=Xu,Uu[le.UNSIGNED_INT_VEC3]=Xu,Uu[le.UNSIGNED_INT_VEC4]=Xu,Uu[le.BOOL_VEC2]=Hu,Uu[le.BOOL_VEC3]=Hu,Uu[le.BOOL_VEC4]=Hu;var Zu=function(){function t(t,e,r,i){var n=this;this.engine=t,this.program=e,this.shared=r,this.id=i,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var o=this.pipelineContext.gl;if(this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),he(o)){var a=Wu(o,e),s=a.blockSpecs;a.blockUniformNames,s.forEach((function(t){return n.uniformBlockMap[t.name]=t}))}this.pipelineContext.useProgram(null)}return t.prototype.bind=function(){this.pipelineContext.useProgram(this.program)},t.prototype.setupAttributes=function(t){var e,r,i=this,n=this.id,o=this.pipelineContext.gl;return t.vaos[n]?r=t.vaos[n]:((r=new vu(this.engine,"".concat(t.name,"-").concat(n)))||console.error("创建vao对象失败"),t.vaos[n]=r),r&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var r=i.attribInfoMap[e],n=t.attributes[e];if(n){var a=t.buffers[n.dataSource];if(!a)throw Error("no buffer named ".concat(n.dataSource||e));a.bind(),o.enableVertexAttribArray(r.loc),o.vertexAttribPointer(r.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null===(e=t.indicesBuffer)||void 0===e||e.bind(),r&&(r.ready=!0)),r},t.prototype.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var o=t.getActiveAttrib(e,n),a=o.name,s=o.type,u=o.size,l=t.getAttribLocation(e,a);r[a]={type:s,name:a,size:u,loc:l}}return r},t.prototype.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),qu=function(e){function i(t,r){var i=e.call(this,t,r)||this;return i.initialized=!1,i.uniformLocations={},i.samplerChannels={},i}return r(i,e),i.prototype.initialize=function(t){this.initialized||t.getGLPipelineContext().shaderLibrary.compileShader(this)},i.prototype.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.prototype.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.prototype.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.prototype.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.prototype.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.prototype.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.prototype.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.prototype.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.prototype.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.prototype.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.prototype.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.prototype.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.prototype.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.prototype.fillShaderInformation=function(t,e){var r=e.slice();t=t.concat(r);for(var i,n=this.pipelineContext.getUniforms(this.program.program,t),o=0;o<t.length;o++)this.uniformLocations[t[o]]=n[o];for(i=0;i<r.length;i++){null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--)}for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},i.prototype.toData=function(){var e=this.taggedProperties;e.dataType=t.DataType.Shader,e.id=this.guid,e.vertex=this.source.vertex,e.fragment=this.source.fragment},i.prototype.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null===(t=this.program)||void 0===t||t.dispose()},i}(je),Ku=0,Qu=function(){function e(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}return e.prototype.compileAllShaders=function(t){var e,r,i=this;if(this.shaderAllDone)t&&t([]);else{var n=[];try{for(var o=s(Object.keys(this.cachedShaders)),a=o.next();!a.done;a=o.next()){var u=a.value;this.cachedShaders[u].initialized||n.push(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}t?n.length?Promise.all(n.map((function(t){return new Promise((function(e){return i.compileShader(i.cachedShaders[t],e)}))}))).then(t).catch((function(){return 0})):t([]):n.map((function(t){return i.compileShader(i.cachedShaders[t])})),this.shaderAllDone=!0}},e.prototype.addShader=function(e){var r=this.computeShaderCacheId(e);if(this.cachedShaders[r])return r;this.shaderAllDone=!1;var n=e.glslVersion===t.GLSLVersion.GLSL3?"#version 300 es\n":"",o=e.vertex?n+e.vertex:"",a=e.fragment?n+e.fragment:"",s=!1;return(e.shared||e.cacheId)&&(s=!0),this.cachedShaders[r]=new qu(this.engine,i(i({},e),{vertex:o,fragment:a,name:e.name||r,shared:s})),this.cachedShaders[r].id=r,r},e.prototype.createShader=function(t){var e=this.addShader(t);return this.cachedShaders[e]},e.prototype.compileShader=function(e,r){var i=this,n=e.source,o=!1;(n.shared||n.cacheId)&&(o=!0);var a={vertex:n.vertex,fragment:n.fragment,name:n.name,shared:o},s=this.pipelineContext.gl,u={shared:a.shared,status:t.ShaderCompileResultStatus.compiling},l=this.createProgram(s,a.vertex,a.fragment,u),c=this.glAsyncCompileExt,h=performance.now(),f=function(r){u.status=t.ShaderCompileResultStatus.success,u.compileTime=performance.now()-h,e.program=r,e.initialized=!0,e.pipelineContext=i.pipelineContext,void 0!==i.programMap[e.id]&&console.warn("find duplicated shader id",e.id),i.programMap[e.id]=r},p=function(){var n=(!r||!c||c&&1==s.getProgramParameter(u.program,c.COMPLETION_STATUS_KHR))&&l();if(n){if(u.status!==t.ShaderCompileResultStatus.fail){Tu(n,a.name);var h=new Zu(i.engine,n,o,e.id);if(s.validateProgram(n),s.getProgramParameter(n,s.VALIDATE_STATUS))f(h);else{var d=s.getProgramInfoLog(n);(null==d?void 0:d.includes("the same texture"))?f(h):(u.status=t.ShaderCompileResultStatus.fail,u.error=d,console.error("compileProgramError: "+d,"\nvertex:\n",a.vertex,"\nfragment:\n",a.fragment),s.deleteProgram(n))}}r&&r(u)}else r&&requestAnimationFrame(p)};e.compileResult=u,p()},e.prototype.computeShaderCacheId=function(t){var e,r=t.vertex?t.vertex:"",i=t.fragment?t.fragment:"";return e=t.shared||t.cacheId?t.cacheId||"shared_".concat(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=0,i=0;i<arguments.length;i++)for(var n=t[i],o=0;o<n.length;o++)r=Math.imul(31,r)+n.charCodeAt(o)|0;return r}(r,i)):"instanced_"+Ku++,e},e.prototype.createProgram=function(e,r,i,n){var o=e.createProgram(),a=this.createGLShader(e,e.VERTEX_SHADER,r),s=this.createGLShader(e,e.FRAGMENT_SHADER,i);return o&&a&&s?(e.attachShader(o,a),e.attachShader(o,s),e.linkProgram(o),n.program=o,n.status=t.ShaderCompileResultStatus.compiling,function(){if(delete n.program,!e.getProgramParameter(o,e.LINK_STATUS)){var u=Ju(e,a,"vertex",r),l=Ju(e,s,"fragment",i);return n.status=t.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),l&&(n.error=l.error,n.status=l.status),o}return o}):(n.status=t.ShaderCompileResultStatus.fail,function(){return null})},e.prototype.createGLShader=function(t,e,r){var i=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Bu(null!=r?r:""),o=i.get(n);if(o)return o;var a=t.createShader(e);return a&&(t.shaderSource(a,r),t.compileShader(a),i.set(n,a)),a},e.prototype.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},e.prototype.restore=function(){},e.prototype.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach((function(e){t.programMap[e].dispose()})),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},e}();function Ju(e,r,i,n){if(!e.getShaderParameter(r,e.COMPILE_STATUS)){var o=e.getShaderInfoLog(r);return console.error("compile "+i+" error: "+o,(null!=n?n:"").split("\n").map((function(t,e){return"".concat(e+1," ").concat(t)})).join("\n")),{error:o,status:t.ShaderCompileResultStatus.fail}}}var $u=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new Qu(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}return t.prototype.dispose=function(){this.shaderLibrary.dispose(),this.reset()},t.prototype.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=le.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderBuffer={}},t.prototype.toggle=function(t,e){e?this.enable(t):this.disable(t)},t.prototype.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},t.prototype.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},t.prototype.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},t.prototype.bindRenderBuffer=function(t,e){this.currentRenderBuffer[t]!==e&&(this.currentRenderBuffer[t]=e,this.gl.bindRenderbuffer(t,e))},t.prototype.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},t.prototype.useProgram=function(t){this.set1("useProgram",t)},t.prototype.clear=function(t){this.gl.clear(t)},t.prototype.clearDepth=function(t){this.set1("clearDepth",t)},t.prototype.depthFunc=function(t){this.set1("depthFunc",t)},t.prototype.depthMask=function(t){this.set1("depthMask",t)},t.prototype.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},t.prototype.depthRange=function(t,e){this.set2("depthRange",t,e)},t.prototype.clearStencil=function(t){this.set1("clearStencil",t)},t.prototype.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},t.prototype.stencilFunc=function(t,e,r){this.stencilFuncSeparate(this.gl.FRONT,t,e,r),this.stencilFuncSeparate(this.gl.BACK,t,e,r)},t.prototype.stencilFuncSeparate=function(t,e,r,i){this.set4("stencilFuncSeparate",t,e,r,i)},t.prototype.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},t.prototype.stencilOp=function(t,e,r){this.stencilOpSeparate(this.gl.FRONT,t,e,r),this.stencilOpSeparate(this.gl.BACK,t,e,r)},t.prototype.stencilOpSeparate=function(t,e,r,i){this.set4("stencilOpSeparate",t,e,r,i)},t.prototype.cullFace=function(t){this.set1("cullFace",t)},t.prototype.frontFace=function(t){this.set1("frontFace",t)},t.prototype.clearColor=function(t,e,r,i){this.set4("clearColor",t,e,r,i)},t.prototype.colorMask=function(t,e,r,i){this.set4("colorMask",t,e,r,i)},t.prototype.blendColor=function(t,e,r,i){this.set4("blendColor",t,e,r,i)},t.prototype.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},t.prototype.blendFuncSeparate=function(t,e,r,i){this.set4("blendFuncSeparate",t,e,r,i)},t.prototype.blendEquation=function(t){this.set1("blendEquation",t)},t.prototype.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},t.prototype.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},t.prototype.viewport=function(t,e,r,i){this.set4("viewport",t,e,r,i)},t.prototype.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},t.prototype.bindTexture=function(t,e,r){(this.currentTextureBinding!==e||r)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},t.prototype.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},t.prototype.set2=function(t,e,r){var i=this.glCapabilityCache[t];i||(i=this.glCapabilityCache[t]={x:NaN,y:NaN}),i.x===e&&i.y===r||this.gl[t](i.x=e,i.y=r)},t.prototype.set3=function(t,e,r,i){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===r&&n.z===i||this.gl[t](n.x=e,n.y=r,n.z=i)},t.prototype.set4=function(t,e,r,i,n){var o=this.glCapabilityCache[t];o||(o=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),o.x===e&&o.y===r&&o.z===i&&o.w===n||this.gl[t](o.x=e,o.y=r,o.z=i,o.w=n)},t.prototype.get=function(t){return this.glCapabilityCache[t]},t.prototype.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},t.prototype.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},t.prototype.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},t.prototype.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},t.prototype.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},t.prototype.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},t.prototype.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},t.prototype.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},t.prototype.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},t.prototype.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},t.prototype.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},t.prototype.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},t.prototype.setTexture=function(t,e,r){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var i=r.target;this.gl.bindTexture(i,r.textureBuffer),this.gl.uniform1i(t,e)}},t.prototype.getUniforms=function(t,e){for(var r=[],i=0;i<e.length;i++)r.push(this.gl.getUniformLocation(t,e[i]));return r},t.prototype.setFloat4=function(t,e,r,i,n){t&&this.gl.uniform4f(t,e,r,i,n)},t.prototype.setFloat3=function(t,e,r,i){t&&this.gl.uniform3f(t,e,r,i)},t.prototype.setFloat2=function(t,e,r){t&&this.gl.uniform2f(t,e,r)},t}(),tl=function(e){function n(r,n,o){var a=e.call(this)||this;a.canvas=r,a.temporaryRTs={};var s=i({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},o);a.context=new Pu(r,n,s);var u=a.context.gl;return F(u),a.engine=new Fu(u),a.engine.renderer=a,a.pipelineContext=new $u(a.engine,u),a.glRenderer=new xu(a.engine),a.extension=new Lu(a),a.renderingData={currentFrame:{}},a.frameBuffer=new Vu({storeAction:{},viewport:[0,0,a.width,a.height],attachments:[new du(a.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:a.width,height:a.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},a),a}return r(n,e),Object.defineProperty(n.prototype,"isDestroyed",{get:function(){var t=this.glRenderer;return!t||t.isDestroyed},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){var t,e;return null!==(e=null===(t=this.glRenderer)||void 0===t?void 0:t.height)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){var t,e;return null!==(e=null===(t=this.glRenderer)||void 0===t?void 0:t.width)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),n.prototype.renderRenderFrame=function(t){var e,r,i,n,o,a,u=t;u.resource&&u.resource.color_b.initialize(),u.emptyTexture.initialize(),u.transparentTexture.initialize();var l=u._renderPasses;if(this.isDestroyed)return console.error("renderer is destroyed",this);u.renderer.getShaderLibrary().compileAllShaders(),this.setFrameBuffer(null),this.clear(u.clearAction),this.renderingData.currentFrame=u,this.renderingData.currentCamera=u.camera,M(l);try{for(var c=s(l),h=c.next();!h.done;h=c.next()){var f=(m=h.value).delegate;null===(o=f.willBeginRenderPass)||void 0===o||o.call(f,m,this.renderingData),this.renderRenderPass(m),null===(a=f.didEndRenderPass)||void 0===a||a.call(f,m,this.renderingData)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}try{for(var p=s(l),d=p.next();!d.done;d=p.next()){var m;(m=d.value).frameCleanup(this)}}catch(t){i={error:t}}finally{try{d&&!d.done&&(n=p.return)&&n.call(p)}finally{if(i)throw i.error}}},n.prototype.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},n.prototype.renderMeshes=function(t){var e,r,i,n,o=this.renderingData.currentPass.delegate;try{for(var a=s(t),u=a.next();!u.done;u=a.next()){var l=u.value;null===(i=o.willRenderMesh)||void 0===i||i.call(o,l,this.renderingData),l.render(this),null===(n=o.didRenderMesh)||void 0===n||n.call(o,l,this.renderingData)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}},n.prototype.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},n.prototype.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},n.prototype.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},n.prototype.drawGeometry=function(t,e){if(t&&e){e.initialize(),t.initialize();var r=this.renderingData;r.currentFrame.globalUniforms&&r.currentCamera&&(this.setGlobalMatrix("effects_MatrixInvV",r.currentCamera.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",r.currentCamera.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",r.currentCamera.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",r.currentCamera.getProjectionMatrix()));var i=Date.now()%1e8*.001*1;this.setGlobalFloat("_GlobalTime",i),r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,e)}},n.prototype.setFrameBuffer=function(t){t?(this.frameBuffer=t,this.frameBuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},n.prototype.getFrameBuffer=function(){return this.frameBuffer},n.prototype.getTemporaryRT=function(e,r,i,n,o,a){if(this.temporaryRTs[e])return this.temporaryRTs[e];var s,u,l=t.RenderPassAttachmentStorageType.none;o===t.FilterMode.Linear?s=le.LINEAR:o===t.FilterMode.Nearest&&(s=le.NEAREST),a===t.RenderTextureFormat.RGBA32?u=le.UNSIGNED_BYTE:a===t.RenderTextureFormat.RGBAHalf&&(u=le.HALF_FLOAT),0===n?l=t.RenderPassAttachmentStorageType.none:16===n?l=t.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(l=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var c=new du(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:le.RGBA,format:le.RGBA,type:u}),h=new Vu({name:e,storeAction:{},viewport:[0,0,r,i],viewportScale:1,isCustomViewport:!0,attachments:[c],depthStencilAttachment:{storageType:l}},this);return this.temporaryRTs[e]=h,h},n.prototype.setViewport=function(t,e,r,i){this.pipelineContext.viewport(t,e,r,i)},n.prototype.clear=function(e){var r=this.pipelineContext,i=0;if(e.colorAction===t.TextureLoadAction.clear){var n=e.clearColor;n&&r.clearColor(n[0],n[1],n[2],n[3]),r.colorMask(!0,!0,!0,!0),i=le.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(r.stencilMask(255),r.clearStencil(e.clearStencil||0),i|=le.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var o=e.clearDepth;r.depthMask(!0),r.clearDepth(Number.isFinite(o)?o:1),i|=le.DEPTH_BUFFER_BIT}i&&r.clear(i)},n.prototype.addLostHandler=function(t){this.context.addLostHandler(t)},n.prototype.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},n.prototype.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},n.prototype.getWidth=function(){return this.width},n.prototype.getHeight=function(){return this.height},n.prototype.dispose=function(t){var e;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null===(e=this.glRenderer)||void 0===e||e.dispose(t),this.canvas=null,this.engine.dispose()},n.prototype.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},n.prototype.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context");this.engine=new Fu(t),this.engine.renderer=this,this.pipelineContext=new $u(this.engine,t),this.glRenderer=new xu(this.engine),this.extension=new Lu(this)},n.prototype.resize=function(t,e){var r=this.glRenderer;r&&(this.width===t&&this.height===e||r.resize(t,e))},n.prototype.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},n}(Wr),el="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",rl="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",il="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",nl="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",ol="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",al="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg";var sl=new Map,ul=!1,ll=1,cl=function(){function e(t){var e,r,n=this;this.compositions=[],this.displayScale=1,this.resumePending=!1,this.disposed=!1,this.speed=1,this.baseCompositionIndex=0,this.lost=function(t){var e,r;null===(e=n.ticker)||void 0===e||e.pause(),n.compositions.forEach((function(e){return e.lost(t)})),n.renderer.lost(t),null===(r=n.handleWebGLContextLost)||void 0===r||r.call(n,t),fl(n,!1)},this.restore=function(){return o(n,void 0,void 0,(function(){var t,e,r,i=this;return a(this,(function(n){switch(n.label){case 0:return this.renderer.restore(),t=this,[4,Promise.all(this.compositions.map((function(t){return o(i,void 0,void 0,(function(){var e,r,i,n,o,s,u,l,c,h,f,p;return a(this,(function(a){switch(a.label){case 0:return e=t.time,r=t.url,i=t.speed,n=t.keepResource,o=t.reusable,s=t.renderOrder,u=t.transform,l=t.videoState,[4,this.loadScene(r)];case 1:(c=a.sent()).speed=i,c.reusable=o,c.keepResource=n,c.renderOrder=s,c.transform=u,h=0,a.label=2;case 2:return h<l.length?l[h]?((f=c.textures[h].source.video).currentTime=null!==(p=l[h])&&void 0!==p?p:0,[4,f.play()]):[3,4]:[3,5];case 3:a.sent(),a.label=4;case 4:return h++,[3,2];case 5:return c.rootItem.getComponent(au).resetStatus(),c.gotoAndPlay(e),[2,c]}}))}))})))];case 1:return t.compositions=n.sent(),null===(e=this.handleWebGLContextRestored)||void 0===e||e.call(this),null===(r=this.ticker)||void 0===r||r.resume(),[2]}}))}))},this.handleResume=function(){var t;null===(t=n.handlePlayableUpdate)||void 0===t||t.call(n,{player:n,playing:!0})},this.handleClick=function(t){var e=t.x,r=t.y;n.compositions.forEach((function(t){var o,a=t.hitTest(e,r);if(a.length)for(var s=0;s<a.length;s++){var u=a[s].behavior||xt.NOTIFY;u===xt.NOTIFY?null===(o=n.handleItemClicked)||void 0===o||o.call(n,i(i({},a[s]),{composition:t.name,player:n})):u===xt.RESUME_PLAYER&&n.resume()}}))};var u=t.container,l=t.canvas,c=t.gl,h=t.fps,f=t.name,p=t.pixelRatio,d=t.manualRender,m=t.interactive,y=t.reportGPUTime,v=t.onMessageItem,g=t.onPausedByItem,x=t.onItemClicked,T=t.onPlayableUpdate,E=t.onRenderError,b=t.onWebGLContextLost,C=t.onWebGLContextRestored,_=t.renderFramework,R=t.env,O=void 0===R?"":R,w=t.notifyTouch;if(ue.length)throw new Error("Errors before player create: ".concat(ue.map((function(t,e){return"\n ".concat(e+1,": ").concat(t)}))));var M=null!==(r=null!==(e=t.renderOptions)&&void 0!==e?e:t)&&void 0!==r?r:{},L=M.willCaptureImage,I=M.premultiplyAlpha;if(!ul&&"debug-disable"!==_){var P,F=S()||(P=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===P[1]||"16"===P[1]&&"5"===P[2])?"webgl":"webgl2";if(_&&(F="webgl"===_?"webgl":"webgl2"),this.handleWebGLContextLost=b,this.handleWebGLContextRestored=C,this.reportGPUTime=y,this.handleItemClicked=x,this.handleMessageItem=v,this.handlePlayableUpdate=T,this.handleRenderError=E,this.handlePlayerPause=function(t){n.pause(),null==g||g({name:t.name,player:n})},this.pixelRatio=Number.isFinite(p)?p:A(),this.offscreenMode=!0,this.env=O,l)this.canvas=l;else if(c){this.canvas=c.canvas;var N=c instanceof WebGLRenderingContext?"webgl":"webgl2";F!==N&&(lt.error("The gl context(".concat(N,") is inconsistent with renderFramework or default version(").concat(F,")")),F=N)}else pl(u),this.canvas=document.createElement("canvas"),u.appendChild(this.canvas);this.renderer=Wr.create(this.canvas,F,{preserveDrawingBuffer:L,premultipliedAlpha:I}),this.renderer.env=O,this.renderer.addLostHandler({lost:this.lost}),this.renderer.addRestoreHandler({restore:this.restore}),this.gpuCapability=this.renderer.engine.gpuCapability,sl.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&<.warn("Create player with different webgl version: old=".concat(t.gpuCapability.type,", new=").concat(n.gpuCapability.type))})),d||(this.ticker=new hu(h),this.ticker.add(this.tick.bind(this))),this.event=new Wi(this.canvas,!!w),this.event.bindListeners(),this.event.addEventListener(Gi,this.handleClick),this.interactive=null!=m&&m,this.name=f||"".concat(ll++),c||this.resize(),nn(this.gpuCapability.detail),this.container=this.canvas.parentElement,sl.set(this.canvas,this),function(){var t,e,r=[];try{for(var i=s(sl.values()),n=i.next();!n.done;n=i.next()){var o=n.value;o.paused||r.push(o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}r.length>1&<.error("Current running player count: ".concat(r.length,", see ").concat(al),r)}(),fl(this,!0)}}return e.prototype.setSpeed=function(t){isNaN(t)||(this.speed=t)},e.prototype.getSpeed=function(){return this.speed},e.prototype.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},e.prototype.getCompositions=function(){return this.compositions},Object.defineProperty(e.prototype,"hasPlayable",{get:function(){return this.compositions.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){var t;return null===(t=this.ticker)||void 0===t?void 0:t.getPaused()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"interactive",{get:function(){return this.event.enabled},set:function(t){this.event.enabled=t},enumerable:!1,configurable:!0}),e.prototype.loadScene=function(t,e){var r;return o(this,void 0,void 0,(function(){var i,n,s=this;return a(this,(function(u){switch(u.label){case 0:return n=this.baseCompositionIndex,Ct(t)?(this.baseCompositionIndex+=t.length,[4,Promise.all(t.map((function(t,r){return o(s,void 0,void 0,(function(){var i;return a(this,(function(o){switch(o.label){case 0:return[4,this.createComposition(t,e)];case 1:return(i=o.sent()).setIndex(n+r),[2,i]}}))}))})))]):[3,2];case 1:return i=u.sent(),[3,4];case 2:return this.baseCompositionIndex+=1,[4,this.createComposition(t,e)];case 3:(i=u.sent()).setIndex(n),u.label=4;case 4:return null===(r=this.ticker)||void 0===r||r.start(),[2,i]}}))}))},e.prototype.createComposition=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var r,n,o,s,u,l,c,h,f,p,d=this;return a(this,(function(a){switch(a.label){case 0:return r=this.renderer,n=this.renderer.engine,o=performance.now(),s=i({autoplay:!0},e),hl(t)?(u=t.scene,s=i(i({},s),t.options||{})):u=t,this.assetManager?this.assetManager.updateOptions(s):this.assetManager=new tu(s),n.clearResources(),[4,this.assetManager.loadScene(u,this.renderer,{env:this.env})];case 1:for(l=a.sent(),n.addPackageDatas(l),c=0;c<l.textureOptions.length;c++)l.textureOptions[c]=n.assetLoader.loadGUID(l.textureOptions[c].id),l.textureOptions[c].initialize();return h=new lu(l,n),n.database?[4,n.createVFXItemsAsync(l)]:[3,3];case 2:a.sent(),a.label=3;case 3:if(this.disposed)throw new Error("Disposed player can not used to create Composition");return f=new su(i(i({},s),{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,onPlayerPause:this.handlePlayerPause,onMessageItem:this.handleMessageItem}),l,h),this.ticker&&f.renderLevel===ft.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),[4,new Promise((function(t){d.renderer.getShaderLibrary().compileAllShaders((function(){t(null)}))}))];case 4:return a.sent(),s.autoplay?(this.autoPlaying=!0,f.play()):f.pause(),p=performance.now()-o+f.statistic.loadTime,f.statistic.firstFrameTime=p,lt.info("first frame: [".concat(f.name,"]").concat(p.toFixed(4),"ms")),this.compositions.push(f),[2,f]}}))}))},e.prototype.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.play()})),null===(t=this.ticker)||void 0===t||t.start()},e.prototype.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.gotoAndPlay(t)})),this.ticker?this.ticker.start():this.doTick(0,!0)},e.prototype.gotoAndStop=function(t){var e,r;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(e){e.gotoAndStop(t)})),this.ticker&&!(null===(e=this.ticker)||void 0===e?void 0:e.getPaused())||this.doTick(0,!0),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1})},e.prototype.playSequence=function(t){for(var e,r=function(e){var r=t[e],i=r.onEnd;r.onEnd=function(){null==i||i.call(r,r),t[e+1].play()}},i=0;i<t.length-1;i++)r(i);t[0].play(),null===(e=this.ticker)||void 0===e||e.start()},e.prototype.pause=function(t){var e,r;this.paused||(null===(e=this.ticker)||void 0===e||e.pause(),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},e.prototype.resume=function(){var t;return o(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return this.resumePending?[2]:this.paused?(this.resumePending=!0,[4,Promise.all(this.compositions.map((function(t){return t.reloadTexture()})))]):[3,2];case 1:e.sent(),this.resumePending=!1,this.handleResume(),e.label=2;case 2:return null===(t=this.ticker)||void 0===t||t.resume(),[2]}}))}))},e.prototype.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},e.prototype.doTick=function(e,r){var i,n,o,a=this;e=Math.min(e,33)*this.speed;var s=this.compositions,u=!1;s.sort((function(t,e){return t.getIndex()-e.getIndex()})),this.compositions=[];for(var l=0;l<s.length;l++){var c=s[l];c.textureOffloaded?(u=!0,lt.error("Composition ".concat(c.name," texture offloaded, skip render.")),this.compositions.push(c)):(!c.isDestroyed&&c.renderer&&c.update(e,!1),c.isDestroyed||this.compositions.push(c))}if(this.baseCompositionIndex=this.compositions.length,u)return null===(i=this.handleRenderError)||void 0===i||i.call(this,new Error("play when texture offloaded")),null===(n=this.ticker)||void 0===n?void 0:n.pause();if(!this.paused||r){var h=this.gpuCapability.level,f=this.renderer.context.gl,p=2===h&&this.reportGPUTime?ae(f):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<s.length||r){this.renderer.setFrameBuffer(null),this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(l=0;l<s.length;l++)!s[l].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(s[l].renderFrame)}null==p||p.end(),null==p||p.getTime().then((function(t){var e;return null===(e=a.reportGPUTime)||void 0===e?void 0:e.call(a,null!=t?t:0)})).catch,this.autoPlaying&&(null===(o=this.handlePlayableUpdate)||void 0===o||o.call(this,{player:this,playing:!0}))}},e.prototype.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},e.prototype.resize=function(){var t,e,r,i,n,o=this.canvas.parentElement;if(o){var a=this.getTargetSize(o);e=a[0],r=a[1],i=a[2],n=a[3]}else e=i=this.canvas.width,r=n=this.canvas.height;var s=e/r;if(e&&r){var u=document.documentElement.clientWidth;i>2*u&<.error("DPI overflowed, width ".concat(i," is more than 2x document width ").concat(u,", see ").concat(rl));var l=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>l||n>l)&&(lt.error("Container size overflowed ".concat(i,"x").concat(n,", see ").concat(el)),s>1?(i=Math.round(l),n=Math.round(l/s)):(n=Math.round(l),i=Math.round(l*s))),this.renderer.resize(i,n),this.canvas.style.width=e+"px",this.canvas.style.height=r+"px",lt.info("Resize player ".concat(this.name," [").concat(i,",").concat(n,",").concat(e,",").concat(r,"].")),null===(t=this.compositions)||void 0===t||t.forEach((function(t){t.camera.aspect=s}))}},e.prototype.clearCanvas=function(e){e?this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},e.prototype.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},e.prototype.dispose=function(t){var e,r;if(lt.info("call player destroy: ".concat(this.name)),!this.disposed){sl.delete(this.canvas),this.pause(),null===(e=this.ticker)||void 0===e||e.stop(),null===(r=this.assetManager)||void 0===r||r.dispose(),this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.event.dispose(),this.renderer.dispose(!t),fl(this,!1),this.canvas instanceof HTMLCanvasElement&&!t&&this.renderer.context&&(xa.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i,n=(i=this.name,"Never use destroyed player: ".concat(i," again, see ").concat(ol)),o=function(){return function(t){throw new Error(t)}(n)},a=function(){return t=n,Promise.reject(t);var t};this.tick=o,this.resize=o,this.loadScene=a,this.play=a,this.gotoAndPlay=a,this.gotoAndStop=a,this.playSequence=o,this.destroyCurrentCompositions=o,this.resume=a,this.disposed=!0}},e.prototype.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},e.prototype.getTargetSize=function(t){pl(t);var e,r,i=this.displayAspect;i?t.clientWidth/t.clientHeight>i?e=(r=t.clientHeight*this.displayScale)*i:r=(e=t.clientWidth*this.displayScale)/i:(e=t.clientWidth,r=t.clientHeight);var n=this.pixelRatio,o=e,a=r;if(e=Math.round(e*n),(r=Math.round(r*n))<1||r<1){if(!this.offscreenMode)throw Error("Invalid container size ".concat(e,"x").concat(r,", see ").concat(il));e=r=o=a=1}return[o,a,e,r]},e}();function hl(t){return At(t)&&"scene"in t&&"options"in t}function fl(t,e){Object.keys(Ia).forEach((function(r){var i=Ia[r],n=e?i.onPlayerCreated:i.onPlayerDestroy;null==n||n(t)}))}function pl(t){if(null==t)throw new Error("Container is not an HTMLElement, see ".concat(nl))}Me.create=function(t,e){return new du(t,e)},Me.createWithData=function(e,r,i){void 0===r&&(r=O("#fff")),void 0===i&&(i={});var n=i,o=n.type,a=void 0===o?le.UNSIGNED_BYTE:o,s=n.format,u=void 0===s?le.RGBA:s,l=n.internalFormat,c=n.wrapS,h=void 0===c?le.MIRRORED_REPEAT:c,f=n.wrapT,p=void 0===f?le.MIRRORED_REPEAT:f,d=n.minFilter,m=void 0===d?le.NEAREST:d,y=n.magFilter,v=void 0===y?le.NEAREST:y,g=n.flipY,x=void 0!==g&&g;return new du(e,{data:r,type:a,sourceType:t.TextureSourceType.data,format:u,internalFormat:l||u,wrapS:h,wrapT:p,minFilter:m,magFilter:v,flipY:x})},Xe.create=function(t,e){return new Mu(t,e)},ir.create=function(t,e){return new Su(t,e)},ur.create=function(t,e){return new ur(t,e)},Vr.create=function(t){return new Nu(t)},Yr.create=function(t,e){return new Vu(t,e)},Wr.create=function(t,e,r){return new tl(t,e,r)},cu.create=function(t){return new Fu(t)};var dl="2.0.0-alpha.2";lt.info("player version: "+dl),t.AbstractPlugin=$r,t.ActivationClipPlayable=bn,t.AnimationClipPlayable=En,t.AssetLoader=qr,t.AssetManager=tu,t.BYTES_TYPE_MAP=rr,t.Behaviour=re,t.BezierSegments=Si,t.COMPRESSED_TEXTURE=Xr,t.COPY_FRAGMENT_SHADER=qe,t.COPY_MESH_SHADER_ID=We,t.COPY_VERTEX_SHADER=Ze,t.CalculateLoader=na,t.Camera=ou,t.CameraController=Bi,t.CameraVFXItemLoader=ki,t.Component=ee,t.Composition=su,t.CompositionComponent=au,t.CompositionSourceManager=lu,t.CurveValue=Ci,t.DEFAULT_FONTS=ma,t.Database=Kr,t.Downloader=Ee,t.EFFECTS_COPY_MESH_NAME=Ye,t.EVENT_TYPE_CLICK=Gi,t.EVENT_TYPE_TOUCH_END=ji,t.EVENT_TYPE_TOUCH_MOVE=Hi,t.EVENT_TYPE_TOUCH_START=Xi,t.EffectComponent=Oa,t.EffectsObject=te,t.Engine=cu,t.EventSystem=Wi,t.FILTER_NAME_NONE="none",t.Float16ArrayWrapper=ei,t.FrameBuffer=Yr,t.GLEngine=Fu,t.GLGeometry=Su,t.GLRenderer=tl,t.GPUCapability=Ur,t.Geometry=ir,t.GlobalUniforms=Dr,t.GradientValue=bi,t.HELP_LINK=Ji,t.InteractBehavior=Yi,t.InteractComponent=en,t.InteractLoader=qi,t.InteractMesh=tn,t.ItemBehaviour=ie,t.KTXTexture=Ie,t.LineSegments=_i,t.LinearValue=Ei,t.Material=Xe,t.MaterialDataBlock=ze,t.Mesh=ur,t.PLAYER_OPTIONS_ENV_EDITOR=Qi,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=ia,t.ParticleLoader=jn,t.ParticleMesh=Pn,t.ParticleSystem=Ho,t.ParticleSystemRenderer=Xo,t.PassTextureCache=tr,t.PathSegments=Ai,t.Player=cl,t.PluginSystem=Wa,t.QCanvasViewer=ca,t.QText=la,t.RENDER_PASS_NAME_PREFIX=Lr,t.RENDER_PREFER_LOOKUP_TEXTURE=wn,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=gi,t.RandomValue=xi,t.RandomVectorValue=Ti,t.RenderBuffer=Vr,t.RenderFrame=Pr,t.RenderPass=pr,t.RenderPassPriorityNormal=lr,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=hr,t.Renderer=Wr,t.RendererComponent=ne,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=Ki,t.SemanticMap=er,t.SerializationHelper=Zr,t.Shader=je,t.SpriteColorPlayable=Rn,t.SpriteComponent=On,t.SpriteLoader=cn,t.StaticValue=vi,t.TEMPLATE_USE_OFFSCREEN_CANVAS=Mn,t.TextComponent=Aa,t.TextLoader=Sa,t.Texture=Me,t.TextureFactory=Ne,t.Ticker=hu,t.TimelineClip=mn,t.TimelineComponent=Cn,t.Track=dn,t.Transform=Ui,t.VFXItem=Ma,t.ValueGetter=yi,t.addByOrder=L,t.addItem=v,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=F,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new 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=oi,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=xa,t.colorGradingFrag=Er,t.colorStopsFromGradient=b,t.colorToArr=T,t.combineImageTemplate=_a,t.combineImageTemplate1=fa,t.combineImageTemplate1Async=function(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,fa(t,e,r,i,n)]}))}))},t.combineImageTemplate2=Ca,t.combineImageTemplate2Async=function(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,Ca(t,e,r,i,n)]}))}))},t.combineImageTemplateAsync=function(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,_a(t,e,r,i,n)]}))}))},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=He,t.createCopyShader=Ke,t.createGLContext=oe,t.createKeyFrameMeta=Ni,t.createShaderWithMarcos=ve,t.createShape=so,t.createVFXItem=La,t.createValueGetter=Oi,t.deepClone=function t(e){if(Ct(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=Mr,t.defaultPlugins=Pa,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=Re,t.disableAllPlayer=function(t){ul=!!t},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=Lo,t.effectsClass=Jt,t.effectsClassStore=Wt,t.enlargeBuffer=x,t.ensureVec3=ai,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=br,t.gaussianDownVFrag=Cr,t.gaussianUpFrag=_r,t.generateEmptyTypedArray=nr,t.generateGUID=Ot,t.generateHalfFloatTexture=Le,t.getActivePlayers=function(){return Array.from(sl.values())},t.getBackgroundImage=Ta,t.getColorFromGradientStops=E,t.getConfig=In,t.getDefaultTemplateCanvasPool=function(){return xa},t.getDefaultTextureFactory=De,t.getGeometryByShape=Vo,t.getGeometryTriangles=Do,t.getImageItemRenderInfo=on,t.getKTXTextureOptions=Pe,t.getKeyFrameMetaByRawValue=Fi,t.getMergedStore=Kt,t.getParticleMeshShader=Dn,t.getPixelRatio=A,t.getPlayerByCanvas=function(t){return sl.get(t)},t.getPreMultiAlpha=pe,t.getStandardComposition=Hs,t.getStandardImage=Xs,t.getStandardItem=Zs,t.getStandardJSON=ks,t.getTextureSize=Fr,t.glContext=le,t.gpuTimer=ae,t.imageDataFromColor=O,t.imageDataFromGradient=w,t.initErrors=ue,t.initGLContext=ce,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=C,t.isAndroid=S,t.isArray=Ct,t.isCanvasUsedByPlayer=function(t){return sl.has(t)},t.isFunction=_t,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=At,t.isScene=Qs,t.isSceneWithOptions=hl,t.isSimulatorCellPhone=R,t.isString=ht,t.isUniformStruct=Ue,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&Ue(t[0])},t.isWebGL2=he,t.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",t.itemFrag=yr,t.itemFrameFrag=dr,t.itemVert=mr,t.loadBinary=Ae,t.loadBlob=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){return[2,new Promise((function(e,r){(new Ee).downloadBlob(t,e,(function(e,i){r("Couldn't load blob ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))},t.loadImage=_e,t.loadVideo=Se,t.loadWebPOptional=Ce,t.logger=lt,t.math=nt,t.modifyMaxKeyframeShader=Vn,t.nearestPowerOfTwo=fi,t.noop=ct,t.parsePercent=_,t.particleFrag=vr,t.particleOriginTranslateMap=hi,t.particleVert=gr,t.pluginLoaderMap=Ia,t.random=St,t.registerPlugin=Na,t.removeItem=g,t.requestAsync=ha,t.rotateVec2=zo,t.screenMeshVert=Tr,t.serialize=Qt,t.setBlendMode=ge,t.setConfig=function(t,e){return Ln[t]=e},t.setDefaultTextureFactory=function(t){Fe=t},t.setMaskMode=Te,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=pi,t.setSideMode=xe,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=nn,t.sortByOrder=M,t.spec=Yt,t.spriteMeshShaderFromFilter=an,t.spriteMeshShaderFromRenderInfo=un,t.spriteMeshShaderIdFromRenderInfo=sn,t.thresholdFrag=Ar,t.throwDestroyedError=Rt,t.trailVert=xr,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=di,t.unregisterPlugin=function(t){delete Fa[t],delete Ia[t],g(Pa,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=ui,t.vecFill=si,t.vecMulCombine=li,t.vecNormalize=function(t,e){1===arguments.length&&(e=t,t=[]);var r=e,i=Math.hypot.apply(Math,l([],u(r),!1));if(0===i)return ui(t,r,r.length);for(var n=0;n<r.length;n++)t[n]=r[n]/i;return t},t.version=dl,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
6
|
+
* Version: v2.0.0-alpha.20
|
|
7
|
+
*/function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ge={})}(this,function(t){"use strict";function e(t,e,i,r,n,s,a){try{var o=t[s](a),u=o.value}catch(t){i(t);return}o.done?e(u):Promise.resolve(u).then(r,n)}function i(t){return function(){var i=this,r=arguments;return new Promise(function(n,s){var a=t.apply(i,r);function o(t){e(a,n,s,o,u,"next",t)}function u(t){e(a,n,s,o,u,"throw",t)}o(void 0)})}}function r(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):r(t,e)}function n(t,e,i,r){var n,s=arguments.length,a=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,i,a):n(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a}function s(t,e){var i,r,n,s,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return s={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(o){return function(u){return function(o){if(i)throw TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}"function"==typeof SuppressedError&&SuppressedError;for(var a,o,u,l,h,c,f,d,p,m,v,y,g,x,T,E,b,A,S,C,_,R,O,w,M,I,L,P,F,V,N,D,z,U,k,B,G,X,H,Y,W,j,Z,q,K,Q,J,$,tt,te,ti,tr,tn,ts,ta,to,tu,tl,th,tc,tf,td,tp,tm,tv,ty,tg,tx,tT,tE,tb,tA,tS,tC,t_,tR,tO,tw,tM,tI,tL,tP,tF,tV,tN,tD,tz,tU,tk,tB,tG,tX,tH,tY,tW,tj,tZ,tq,tK,tQ,tJ,t$,t0,t1,t2,t3,t4,t5,t6,t8,t9,t7,et,ee,ei,er,en,es=new Uint8Array(16),ea=[],eo=0;eo<256;++eo)ea.push((eo+256).toString(16).slice(1));var eu={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function el(t,e){return t.includes(e)||t.push(e),t}function eh(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function ec(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var s=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(s);return a.set(t),a}return t}function ef(t,e){var i=[0,0,0,0];if(eM(t)){t=t.replace(/[\s\t\r\n]/g,"");var n=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(n){var s=+n[4];i=[+n[1],+n[2],+n[3],isNaN(s)?255:255*s]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16),255])}else r(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function ed(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var s=t[n-1],a=t[n];if(s.stop<=e&&e<=a.stop){r=em(s.color,a.color,(e-s.stop)/(a.stop-s.stop));break}}return r||(r=t[t.length-1].color),i?r.map(function(t){return t/255}):r}return[0,0,0,0]}function ep(t){var e=[];if(r(t,Array)?t.forEach(function(t){var i=t[0],r=t[1],n=t[2],s=t[3],a=t[4];e.push({stop:ev(i),color:[r,n,s,a]})}):Object.keys(t).forEach(function(i){var r=ef(t[i]);e.push({stop:ev(i),color:r})}),(e=e.sort(function(t,e){return t.stop-e.stop})).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var i=e[e.length-1];1!==i.stop&&e.push({stop:1,color:i.color.slice()})}return e}function em(t,e,i,r){var n=[],s=1-i;if(r)for(var a=0;a<4;a++)n[a]=t[a]*s+e[a]*i;else{for(var o=0;o<3;o++)n[o]=Math.round(Math.sqrt(t[o]*t[o]*s+e[o]*e[o]*i));n[3]=Math.round(t[3]*s+e[3]*i)}return n}function ev(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function ey(){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}function eg(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function ex(){return eg()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function eT(t){eM(t)&&(t=ef(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}function eE(t){var e={width:128,height:1,data:new Uint8Array(512)},i=e.data,r=ep(t);if(r.length){i.set(r[0].color,0);for(var n=1;n<127;n++){for(var s=n/128,a=void 0,o=void 0,u=0;u<r.length&&(a=r[u],o=r[u+1],!(a.stop<=s)||!(o.stop>s));u++);var l=em(a.color,o.color,(s-a.stop)/(o.stop-a.stop));i.set(l,4*n)}i.set(r[r.length-1].color,508)}return e}function eb(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(!(i<=30))return function t(e,i,r,n){if(void 0===r&&(r=0),void 0===n&&(n=e.length-1),r>=n)return e;for(var s,a,o=e[r],u=r,l=n;u<l;){if(2===i){for(;e[l].priority>o.priority&&l>=u;)l--;for(;e[u].priority<=o.priority&&u<l;)u++}else{for(;e[l].priority<o.priority&&l>=u;)l--;for(;e[u].priority>=o.priority&&u<l;)u++}s=[e[l],e[u]],e[u]=s[0],e[l]=s[1]}return a=[e[u],e[r]],e[r]=a[0],e[u]=a[1],t(e,i,r,u-1),t(e,i,l+1,n),e}(t,e);for(var r=1;r<i;r++)eS(t,r,e);return t}function eA(t,e,i){return void 0===i&&(i=2),t.includes(e)||(t.push(e),1===t.length||1!==i&&eS(t,t.length-1,i)),t}function eS(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function eC(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw Error(e)}function e_(t){return/^[^\d.][\w-]*$/.test(t)}function eR(t){return["%c[Galacean Effects]","color: #AA0100",""+t]}t.OrderType=void 0,(a=t.OrderType||(t.OrderType={}))[a.none=1]="none",a[a.ascending=2]="ascending",a[a.descending=3]="descending";var eO={error:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).error.apply(e,[].concat(eR(t),[r])),null==td||td("error",t,r)},info:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).debug.apply(e,[].concat(eR(t))),null==td||td("info",t,r)},warn:function(t){for(var e,i=arguments.length,r=Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];(e=console).warn.apply(e,[].concat(eR(t))),null==td||td("warn",t,r)},register:function(t){t&&eL(t)&&(td=t)}};function ew(){}function eM(t){return"string"==typeof t}t.DestroyOptions=void 0,(o=t.DestroyOptions||(t.DestroyOptions={}))[o.destroy=0]="destroy",o[o.keep=1]="keep",o[o.force=0]="force";var eI=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function eL(t){return"[object Function]"===Object.prototype.toString.call(t)}function eP(t){return"[object Object]"===Object.prototype.toString.call(t)}function eF(t){var e;return"object"==typeof t&&null!==t&&(null==(e=t.tagName)?void 0:e.toUpperCase())==="CANVAS"}function eV(t,e){return t+Math.random()*(e-t)}function eN(){throw Error("Destroyed item cannot be used again.")}function eD(){return(function(t,e,i){if(eu.randomUUID&&!t)return eu.randomUUID();var r,n=(t=t||{}).random||(t.rng||function(){if(!tf&&!(tf="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 tf(es)})();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,void 0===r&&(r=0),ea[n[r+0]]+ea[n[r+1]]+ea[n[r+2]]+ea[n[r+3]]+"-"+ea[n[r+4]]+ea[n[r+5]]+"-"+ea[n[r+6]]+ea[n[r+7]]+"-"+ea[n[r+8]]+ea[n[r+9]]+"-"+ea[n[r+10]]+ea[n[r+11]]+ea[n[r+12]]+ea[n[r+13]]+ea[n[r+14]]+ea[n[r+15]]})().replace(/-/g,"")}function ez(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=atob(t.split(",")[1]||t),n=[],s=0;s<r.length;s+=512){for(var a=r.slice(s,s+512),o=Array(a.length),u=0;u<a.length;u++)o[u]=a.charCodeAt(u);var l=new Uint8Array(o);n.push(l)}return new File([new Blob(n,{type:i})],e,{type:i})}function eU(t,e){e.forEach(function(e){Object.getOwnPropertyNames(e.prototype).forEach(function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)})})}function ek(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function eB(t,e,i){return e&&ek(t.prototype,e),i&&ek(t,i),t}function eG(t,e){return(eG=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function eX(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&eG(t,e)}function eH(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=Array(e);i<e;i++)r[i]=t[i];return r}function eY(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return eH(t,void 0);var i=Object.prototype.toString.call(t).slice(8,-1);if("Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return eH(t,void 0)}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var eW=Math.PI/180,ej=180/Math.PI;function eZ(t,e){return 1e-6>Math.abs(t-e)||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var eq=function(t,e,i){return(1-i)*t+i*e};function eK(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i;return Math.min(Math.max(t,Math.min(r,n)),Math.max(r,n))}var eQ=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):r(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):r(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):r(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):r(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=this.x,e=this.y;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();eQ.ONE=new eQ(1,1),eQ.ZERO=new eQ(0,0);var eJ=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):r(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):r(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):r(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):r(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,s=e.x,a=e.y,o=e.z;return this.x=r*o-n*a,this.y=n*s-i*o,this.z=i*a-r*s,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=this.x,e=this.y,i=this.z;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new eQ(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();eJ.X=new eJ(1,0,0),eJ.Y=new eJ(0,1,0),eJ.Z=new eJ(0,0,1),eJ.ONE=new eJ(1,1,1),eJ.ZERO=new eJ(0,0,0);var e$=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),s=t.tempVec0;return s.copyFrom(e).normalize(),this.x=s.x*n,this.y=s.y*n,this.z=s.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],s=e[1],a=e[5],o=e[9],u=e[2],l=e[6],h=e[10],c=i+a+h;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(l-o)*f,this.y=(n-u)*f,this.z=(s-r)*f}else if(i>a&&i>h){var d=2*Math.sqrt(1+i-a-h);this.w=(l-o)/d,this.x=.25*d,this.y=(r+s)/d,this.z=(n+u)/d,this.negate()}else if(a>h){var p=2*Math.sqrt(1+a-i-h);this.w=(n-u)/p,this.x=(r+s)/p,this.y=.25*p,this.z=(o+l)/p,this.negate()}else{var m=2*Math.sqrt(1+h-i-a);this.w=(s-r)/m,this.x=(n+u)/m,this.y=(o+l)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0):(this.x=0,this.y=-t.z,this.z=t.y)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x),this.w=i,this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(eK(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);return 0===i||this.slerp(t,Math.min(1,e/i)),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,s=t.w,a=e.x,o=e.y,u=e.z,l=e.w;return this.x=i*l+s*a+r*u-n*o,this.y=r*l+s*o+n*a-i*u,this.z=n*l+s*u+i*o-r*a,this.w=s*l-i*a-r*o-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this.x,r=this.y,n=this.z,s=this.w,a=s*t.w+i*t.x+r*t.y+n*t.z;if(a<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,a=-a):this.copyFrom(t),a>=1)return this.w=s,this.x=i,this.y=r,this.z=n,this;var o=1-a*a;if(o<=Number.EPSILON){var u=1-e;return this.w=u*s+e*this.w,this.x=u*i+e*this.x,this.y=u*r+e*this.y,this.z=u*n+e*this.z,this.normalize(),this}var l=Math.sqrt(o),h=Math.atan2(l,a),c=Math.sin((1-e)*h)/l,f=Math.sin(e*h)/l;return this.w=s*c+this.w*f,this.x=i*c+this.x*f,this.y=r*c+this.y*f,this.z=n*c+this.z*f,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this.x,r=this.y,n=this.z,s=this.w,a=t.x,o=t.y,u=t.z,l=s*a+r*u-n*o,h=s*o+n*a-i*u,c=s*u+i*o-r*a,f=-i*a-r*o-n*u,d=null!=e?e:t;return d.x=l*s+-(f*i)+-(h*n)- -(c*r),d.y=h*s+-(f*r)+-(c*i)- -(l*n),d.z=c*s+-(f*n)+-(l*r)- -(h*i),d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(eJ.ZERO,this,eJ.ONE)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromAxisAngle=function(e,i){return new t().setFromAxisAngle(e,i)},t.fromVector4=function(e){return new t().setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromRotationMatrix=function(e){return new t().setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return new t().setFromUnitVectors(e,i)},t}();e$.tempVec0=new eJ;var e0=function(){function t(t,e,i,r,n,s,a,o,u,l,h,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===l&&(l=0),void 0===h&&(h=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,s,a,o,u,l,h,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,s,a,o,u,l,h,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=s,v[6]=a,v[7]=o,v[8]=u,v[9]=l,v[10]=h,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,s,a,o,u,l,h,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=s,v[9]=a,v[13]=o,v[2]=u,v[6]=l,v[10]=h,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),s=Math.sin(i),a=1-n,o=r.x,u=r.y,l=r.z,h=a*o,c=a*u;return this.set(h*o+n,h*u+s*l,h*l-s*u,0,h*u-s*l,c*u+n,c*l+s*o,0,h*l+s*u,c*l-s*o,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(eJ.ZERO,t,eJ.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,s=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,i),a.normalize(),n.crossVectors(r,a),n.normalize(),s.crossVectors(a,n);var o=this.elements;return o[0]=n.x,o[1]=s.x,o[2]=a.x,o[3]=0,o[4]=n.y,o[5]=s.y,o[6]=a.y,o[7]=0,o[8]=n.z,o[9]=s.z,o[10]=a.z,o[11]=0,o[12]=-n.dot(e),o[13]=-s.dot(e),o[14]=-a.dot(e),o[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<16;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,s=i[0],a=i[4],o=i[8],u=i[12],l=i[1],h=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],T=i[15],E=r[0],b=r[4],A=r[8],S=r[12],C=r[1],_=r[5],R=r[9],O=r[13],w=r[2],M=r[6],I=r[10],L=r[14],P=r[3],F=r[7],V=r[11],N=r[15];return n[0]=s*E+a*C+o*w+u*P,n[4]=s*b+a*_+o*M+u*F,n[8]=s*A+a*R+o*I+u*V,n[12]=s*S+a*O+o*L+u*N,n[1]=l*E+h*C+c*w+f*P,n[5]=l*b+h*_+c*M+f*F,n[9]=l*A+h*R+c*I+f*V,n[13]=l*S+h*O+c*L+f*N,n[2]=d*E+p*C+m*w+v*P,n[6]=d*b+p*_+m*M+v*F,n[10]=d*A+p*R+m*I+v*V,n[14]=d*S+p*O+m*L+v*N,n[3]=y*E+g*C+x*w+T*P,n[7]=y*b+g*_+x*M+T*F,n[11]=y*A+g*R+x*I+T*V,n[15]=y*S+g*O+x*L+T*N,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],s=t[1],a=t[5],o=t[9],u=t[13],l=t[2],h=t[6],c=t[10],f=t[14];return t[3]*(+n*o*h-r*u*h-n*a*c+i*u*c+r*a*f-i*o*f)+t[7]*(+e*o*f-e*u*c+n*s*c-r*s*f+r*u*l-n*o*l)+t[11]*(+e*u*h-e*a*f-n*s*h+i*s*f+n*a*l-i*u*l)+t[15]*(-r*a*l-e*o*h+e*a*c+r*s*h-i*s*c+i*o*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],i=t[1],r=t[2],n=t[3],s=t[4],a=t[5],o=t[6],u=t[7],l=t[8],h=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=h*m*u-p*c*u+p*o*f-a*m*f-h*o*v+a*c*v,g=d*c*u-l*m*u-d*o*f+s*m*f+l*o*v-s*c*v,x=l*p*u-d*h*u+d*a*f-s*p*f-l*a*v+s*h*v,T=d*h*o-l*p*o-d*a*c+s*p*c+l*a*m-s*h*m,E=e*y+i*g+r*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 b=1/E;return t[0]=y*b,t[1]=(p*c*n-h*m*n-p*r*f+i*m*f+h*r*v-i*c*v)*b,t[2]=(a*m*n-p*o*n+p*r*u-i*m*u-a*r*v+i*o*v)*b,t[3]=(h*o*n-a*c*n-h*r*u+i*c*u+a*r*f-i*o*f)*b,t[4]=g*b,t[5]=(l*m*n-d*c*n+d*r*f-e*m*f-l*r*v+e*c*v)*b,t[6]=(d*o*n-s*m*n-d*r*u+e*m*u+s*r*v-e*o*v)*b,t[7]=(s*c*n-l*o*n+l*r*u-e*c*u-s*r*f+e*o*f)*b,t[8]=x*b,t[9]=(d*h*n-l*p*n-d*i*f+e*p*f+l*i*v-e*h*v)*b,t[10]=(s*p*n-d*a*n+d*i*u-e*p*u-s*i*v+e*a*v)*b,t[11]=(l*a*n-s*h*n-l*i*u+e*h*u+s*i*f-e*a*f)*b,t[12]=T*b,t[13]=(l*p*r-d*h*r+d*i*c-e*p*c-l*i*m+e*h*m)*b,t[14]=(d*a*r-s*p*r-d*i*o+e*p*o+s*i*m-e*a*m)*b,t[15]=(s*h*r-l*a*r+l*i*o-e*h*o-s*i*c+e*a*c)*b,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=eJ.ZERO);var n=this.elements,s=e.x,a=e.y,o=e.z,u=e.w,l=-r.x,h=-r.y,c=-r.z,f=s+s,d=a+a,p=o+o,m=s*f,v=s*d,y=s*p,g=a*d,x=a*p,T=o*p,E=u*f,b=u*d,A=u*p,S=i.x,C=i.y,_=i.z;return n[0]=(1-(g+T))*S,n[1]=(v+A)*S,n[2]=(y-b)*S,n[3]=0,n[4]=(v-A)*C,n[5]=(1-(m+T))*C,n[6]=(x+E)*C,n[7]=0,n[8]=(y+b)*_,n[9]=(x-E)*_,n[10]=(1-(m+g))*_,n[11]=0,n[12]=l*n[0]+h*n[4]+c*n[8]-l+t.x,n[13]=l*n[1]+h*n[5]+c*n[9]-h+t.y,n[14]=l*n[2]+h*n[6]+c*n[10]-c+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,s=this.elements,a=n.set(s[0],s[1],s[2]).length(),o=n.set(s[4],s[5],s[6]).length(),u=n.set(s[8],s[9],s[10]).length();0>this.determinant()&&(a=-a),e.x=s[12],e.y=s[13],e.z=s[14];var l=t.tempMat0;l.copyFrom(this);var h=1/a,c=1/o,f=1/u;return l.elements[0]*=h,l.elements[1]*=h,l.elements[2]*=h,l.elements[4]*=c,l.elements[5]*=c,l.elements[6]*=c,l.elements[8]*=f,l.elements[9]*=f,l.elements[10]*=f,i.setFromRotationMatrix(l),r.x=a,r.y=o,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new eJ,e=new e$,i=new eJ;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,s){var a=1/(e-t),o=1/(i-r),u=1/(s-n),l=-(e+t)*a,h=-(i+r)*o,c=-(s+n)*u;a*=2,o*=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]=o,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=l,f[13]=h,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var s=1/Math.tan(.5*t),a=1/(i-r),o=this.elements;return o[0]=n?s:s/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n?s*e:s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(r+i)*a,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*r*i*a,o[15]=0,(null===r||r===1/0)&&(o[10]=-1,o[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;a.x=s[0]*i+s[4]*r+s[8]*n+s[12],a.y=s[1]*i+s[5]*r+s[9]*n+s[13],a.z=s[2]*i+s[6]*r+s[10]*n+s[14];var o=s[3]*i+s[7]*r+s[11]*n+s[15];return a.multiply(1/o)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[4]*r+s[8]*n+s[12],a.y=s[1]*i+s[5]*r+s[9]*n+s[13],a.z=s[2]*i+s[6]*r+s[10]*n+s[14],a},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[4]*r+s[8]*n,a.y=s[1]*i+s[5]*r+s[9]*n,a.z=s[2]*i+s[6]*r+s[10]*n,a.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,s=t.w,a=this.elements,o=null!=e?e:t;return o.x=a[0]*i+a[4]*r+a[8]*n+a[12]*s,o.y=a[1]*i+a[5]*r+a[9]*n+a[13]*s,o.z=a[2]*i+a[6]*r+a[10]*n+a[14]*s,o.w=a[3]*i+a[7]*r+a[11]*n+a[15]*s,o},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!eZ(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return new t().lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,s){return new t().perspective(e,i,r,n,s)},t.fromColumnVectors=function(e,i,r,n){return new t().setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return new t().setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromScale=function(e,i,r){return new t().setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return new t().setFromTranslation(e,i,r)},t.fromRotationX=function(e){return new t().setFromRotationX(e)},t.fromRotationY=function(e){return new t().setFromRotationY(e)},t.fromRotationZ=function(e){return new t().setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return new t().setFromRotationAxis(e,i)},t.fromEuler=function(e){return new t().setFromEuler(e)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromShear=function(e,i,r){return new t().setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return new t().setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,s,a,o,u,l,h,c,f,d,p,m,v){return new t(e,s,l,d,i,a,h,p,r,o,c,m,n,u,f,v)},t}();e0.IDENTITY=new e0(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),e0.ZERO=new e0(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),e0.tempVec0=new eJ,e0.tempVec1=new eJ,e0.tempVec2=new eJ,e0.tempMat0=new e0,(u=tp||(tp={}))[u.XYZ=0]="XYZ",u[u.XZY=1]="XZY",u[u.YXZ=2]="YXZ",u[u.YZX=3]="YZX",u[u.ZXY=4]="ZXY",u[u.ZYX=5]="ZYX";var e1=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],s=i[8],a=i[1],o=i[5],u=i[9],l=i[2],h=i[6],c=i[10];switch(e){case tp.XYZ:this.y=Math.asin(eK(s,-1,1)),.9999999>Math.abs(s)?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(h,o),this.z=0);break;case tp.YXZ:this.x=Math.asin(-eK(u,-1,1)),.9999999>Math.abs(u)?(this.y=Math.atan2(s,c),this.z=Math.atan2(a,o)):(this.y=Math.atan2(-l,r),this.z=0);break;case tp.ZXY:this.x=Math.asin(eK(h,-1,1)),.9999999>Math.abs(h)?(this.y=Math.atan2(-l,c),this.z=Math.atan2(-n,o)):(this.y=0,this.z=Math.atan2(a,r));break;case tp.ZYX:this.y=Math.asin(-eK(l,-1,1)),.9999999>Math.abs(l)?(this.x=Math.atan2(h,c),this.z=Math.atan2(a,r)):(this.x=0,this.z=Math.atan2(-n,o));break;case tp.YZX:this.z=Math.asin(eK(a,-1,1)),.9999999>Math.abs(a)?(this.x=Math.atan2(-u,o),this.y=Math.atan2(-l,r)):(this.x=0,this.y=Math.atan2(s,c));break;case tp.XZY:this.z=Math.asin(-eK(n,-1,1)),.9999999>Math.abs(n)?(this.x=Math.atan2(h,o),this.y=Math.atan2(s,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=ej,this.y*=ej,this.z*=ej,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,s,a;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(s=t[e+2])?s:0,this.order=null!=(a=t[e+3])?a:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?console.error("add euler with different order"):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addEulers=function(t,e){return t.order!=e.order?console.error("add euler with different order"):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new e$;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this.x,i=this.y,r=this.z,n=this.order,s=Math.cos(e*eW*.5),a=Math.cos(i*eW*.5),o=Math.cos(r*eW*.5),u=Math.sin(e*eW*.5),l=Math.sin(i*eW*.5),h=Math.sin(r*eW*.5);switch(n){case tp.XYZ:t.set(u*a*o+s*l*h,s*l*o-u*a*h,s*a*h+u*l*o,s*a*o-u*l*h);break;case tp.YXZ:t.set(u*a*o+s*l*h,s*l*o-u*a*h,s*a*h-u*l*o,s*a*o+u*l*h);break;case tp.ZXY:t.set(u*a*o-s*l*h,s*l*o+u*a*h,s*a*h+u*l*o,s*a*o-u*l*h);break;case tp.ZYX:t.set(u*a*o-s*l*h,s*l*o+u*a*h,s*a*h-u*l*o,s*a*o+u*l*h);break;case tp.YZX:t.set(u*a*o+s*l*h,s*l*o+u*a*h,s*a*h-u*l*o,s*a*o-u*l*h);break;case tp.XZY:t.set(u*a*o-s*l*h,s*l*o-u*a*h,s*a*h+u*l*o,s*a*o+u*l*h);break;default:console.error("unknown euler order: "+n)}return t},e.toMatrix4=function(t){var e=t.elements,i=this.x,r=this.y,n=this.z,s=this.order,a=Math.cos(i*eW),o=Math.sin(i*eW),u=Math.cos(r*eW),l=Math.sin(r*eW),h=Math.cos(n*eW),c=Math.sin(n*eW);if(s===tp.XYZ){var f=a*h,d=a*c,p=o*h,m=o*c;e[0]=u*h,e[4]=-u*c,e[8]=l,e[1]=d+p*l,e[5]=f-m*l,e[9]=-o*u,e[2]=m-f*l,e[6]=p+d*l,e[10]=a*u}else if(s===tp.YXZ){var v=u*h,y=u*c,g=l*h,x=l*c;e[0]=v+x*o,e[4]=g*o-y,e[8]=a*l,e[1]=a*c,e[5]=a*h,e[9]=-o,e[2]=y*o-g,e[6]=x+v*o,e[10]=a*u}else if(s===tp.ZXY){var T=u*h,E=u*c,b=l*h,A=l*c;e[0]=T-A*o,e[4]=-a*c,e[8]=b+E*o,e[1]=E+b*o,e[5]=a*h,e[9]=A-T*o,e[2]=-a*l,e[6]=o,e[10]=a*u}else if(s===tp.ZYX){var S=a*h,C=a*c,_=o*h,R=o*c;e[0]=u*h,e[4]=_*l-C,e[8]=S*l+R,e[1]=u*c,e[5]=R*l+S,e[9]=C*l-_,e[2]=-l,e[6]=o*u,e[10]=a*u}else if(s===tp.YZX){var O=a*u,w=a*l,M=o*u,I=o*l;e[0]=u*h,e[4]=I-O*c,e[8]=M*c+w,e[1]=c,e[5]=a*h,e[9]=-o*h,e[2]=-l*h,e[6]=w*c+M,e[10]=O-I*c}else if(s===tp.XZY){var L=a*u,P=a*l,F=o*u,V=o*l;e[0]=u*h,e[4]=-c,e[8]=l*h,e[1]=L*c+V,e[5]=a*h,e[9]=P*c-F,e[2]=F*c-P,e[6]=o*h,e[10]=V*c+L}else console.error("toMatrix4: Invalid order "+s);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),new t().setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),new t().setFromArray(e,i,r)},t}();e1.DEFAULT_ORDER=tp.ZYX,e1.tempQuat0=new e$,e1.tempMat0=new e0,(l=tm||(tm={})).S="S",l.APlus="A+",l.A="A",l.BPlus="B+",l.B="B",(h=tv||(tv={}))[h.ALPHA=0]="ALPHA",h[h.ADD=1]="ADD",h[h.MULTIPLY=2]="MULTIPLY",h[h.BRIGHTNESS=3]="BRIGHTNESS",h[h.SUBTRACTION=4]="SUBTRACTION",h[h.STRONG_LIGHT=5]="STRONG_LIGHT",h[h.WEAK_LIGHT=6]="WEAK_LIGHT",h[h.SUPERPOSITION=7]="SUPERPOSITION",(c=ty||(ty={}))[c.DOUBLE=1032]="DOUBLE",c[c.FRONT=1028]="FRONT",c[c.BACK=1029]="BACK",(f=tg||(tg={}))[f.NONE=0]="NONE",f[f.MASK=1]="MASK",f[f.OBSCURED=2]="OBSCURED",f[f.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",(d=tx||(tx={}))[d.NONE=0]="NONE",d[d.SPHERE=1]="SPHERE",d[d.CONE=2]="CONE",d[d.HEMISPHERE=3]="HEMISPHERE",d[d.CIRCLE=4]="CIRCLE",d[d.DONUT=5]="DONUT",d[d.RECTANGLE=6]="RECTANGLE",d[d.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",d[d.EDGE=8]="EDGE",d[d.TEXTURE=9]="TEXTURE",(p=tT||(tT={}))[p.GYROSCOPE=0]="GYROSCOPE",p[p.SPINE=1]="SPINE",(m=tE||(tE={}))[m.CLICK=0]="CLICK",m[m.MESSAGE=1]="MESSAGE",m[m.DRAG=2]="DRAG",(v=tb||(tb={}))[v.NONE=0]="NONE",v[v.NOTIFY=1]="NOTIFY",v[v.RESUME_PLAYER=2]="RESUME_PLAYER",v[v.REMOVE=3]="REMOVE",v[v.PAUSE=4]="PAUSE",(y=tA||(tA={})).base="0",y.sprite="1",y.particle="2",y.null="3",y.interact="4",y.plugin="5",y.camera="6",y.composition="7",y.spine="spine",y.mesh="mesh",y.tree="tree",y.text="text",y.light="light",y.skybox="skybox",y.effect="effect",y.node="node",(g=tS||(tS={}))[g.BILLBOARD=0]="BILLBOARD",g[g.MESH=1]="MESH",g[g.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",g[g.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD",(x=tC||(tC={}))[x.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",x[x.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",x[x.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",x[x.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",x[x.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",x[x.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",x[x.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",x[x.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",x[x.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM",(T=t_||(t_={})).Opaque="Opaque",T.Transparent="Transparent",(E=tR||(tR={})).Both="Both",E.Back="Back",E.Front="Front",(b=tO||(tO={}))[b.portrait=1]="portrait",b[b.landscape=0]="landscape",(A=tw||(tw={}))[A.destroy=0]="destroy",A[A.pause=1]="pause",A[A.restart=5]="restart",A[A.forward=2]="forward",A[A.pause_destroy=3]="pause_destroy",A[A.freeze=4]="freeze",(S=tM||(tM={})).video="video",S.image="image",(C=tI||(tI={}))[C.CONSTANT=0]="CONSTANT",C[C.CONSTANT_VEC2=1]="CONSTANT_VEC2",C[C.CONSTANT_VEC3=2]="CONSTANT_VEC3",C[C.CONSTANT_VEC4=3]="CONSTANT_VEC4",C[C.RANDOM=4]="RANDOM",C[C.LINE=5]="LINE",C[C.CURVE=6]="CURVE",C[C.BEZIER_PATH=7]="BEZIER_PATH",C[C.RGBA_COLOR=8]="RGBA_COLOR",C[C.GRADIENT_COLOR=9]="GRADIENT_COLOR",C[C.SHAPE_POINTS=10]="SHAPE_POINTS",C[C.SHAPE_SPLITS=11]="SHAPE_SPLITS",C[C.LINEAR_PATH=12]="LINEAR_PATH",C[C.COLORS=13]="COLORS",C[C.BINARY=20]="BINARY",C[C.BEZIER_CURVE=21]="BEZIER_CURVE",C[C.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",C[C.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",(_=tL||(tL={}))[_.AUTO=0]="AUTO",_[_.EASE=1]="EASE",_[_.EASE_IN=2]="EASE_IN",_[_.EASE_OUT=3]="EASE_OUT",_[_.LINE=4]="LINE",_[_.HOLD=5]="HOLD",_[_.LINE_OUT=6]="LINE_OUT",(R=tP||(tP={}))[R.destroy=0]="destroy",R[R.loop=5]="loop",R[R.freeze=4]="freeze",(O=tF||(tF={}))[O.destroyChildren=6]="destroyChildren",(w=tV||(tV={}))[w.none=0]="none",w[w.removeParticle=1]="removeParticle",(M=tN||(tN={}))[M.RANDOM=0]="RANDOM",M[M.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",M[M.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",M[M.UNIFORM_BURST=3]="UNIFORM_BURST",(I=tD||(tD={})).point="point",I.spot="spot",I.directional="directional",I.ambient="ambient",(L=tz||(tz={}))[L.box=2]="box",L[L.sphere=3]="sphere",(P=tU||(tU={})).orthographic="orthographic",P.perspective="perspective",(F=tk||(tk={})).unlit="unlit",F.pbr="pbr",F.hair="hair",(V=tB||(tB={}))[V.opaque=100]="opaque",V[V.masked=101]="masked",V[V.translucent=102]="translucent",V[V.additive=103]="additive",(N=tG||(tG={})).none="none",N.uv="uv",N.normal="normal",N.basecolor="basecolor",N.alpha="alpha",N.metallic="metallic",N.roughness="roughness",N.ao="ao",N.emissive="emissive",(D=tX||(tX={}))[D.display=0]="display",D[D.clip=1]="clip",D[D.ellipsis=2]="ellipsis",(z=tH||(tH={}))[z.top=0]="top",z[z.middle=1]="middle",z[z.bottom=2]="bottom",(U=tY||(tY={}))[U.left=0]="left",U[U.middle=1]="middle",U[U.right=2]="right",(k=tW||(tW={})).normal="normal",k.bold="bold",k.lighter="lighter",(B=tj||(tj={})).normal="normal",B.italic="italic",B.oblique="oblique",(G=tZ||(tZ={})).VFXItemData="VFXItemData",G.EffectComponent="EffectComponent",G.Material="Material",G.Shader="Shader",G.SpriteComponent="SpriteComponent",G.ParticleSystem="ParticleSystem",G.InteractComponent="InteractComponent",G.CameraController="CameraController",G.Geometry="Geometry",G.Texture="Texture",G.AnimationClip="AnimationClip",G.TextComponent="TextComponent",G.TrackAsset="TrackAsset",G.TimelineAsset="TimelineAsset",G.TransformPlayableAsset="TransformPlayableAsset",G.SpriteColorPlayableAsset="SpriteColorPlayableAsset",G.BinaryAsset="BinaryAsset",G.MeshComponent="MeshComponent",G.SkyboxComponent="SkyboxComponent",G.LightComponent="LightComponent",G.CameraComponent="CameraComponent",G.ModelPluginComponent="ModelPluginComponent",G.TreeComponent="TreeComponent",G.AnimationComponent="AnimationComponent",G.SpineComponent="SpineComponent",G.TimelineClip="TimelineClip",(X=tq||(tq={}))[X.POINTS=0]="POINTS",X[X.LINES=1]="LINES",X[X.LINE_LOOP=2]="LINE_LOOP",X[X.LINE_STRIP=3]="LINE_STRIP",X[X.TRIANGLES=4]="TRIANGLES",X[X.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",X[X.TRIANGLE_FAN=6]="TRIANGLE_FAN",(H=tK||(tK={}))[H.Float16=0]="Float16",H[H.Float32=1]="Float32",H[H.Int8=2]="Int8",H[H.Int16=3]="Int16",H[H.Int32=4]="Int32",H[H.UInt8=5]="UInt8",H[H.UInt16=6]="UInt16",H[H.UInt32=7]="UInt32",(Y=tQ||(tQ={}))[Y.None=-1]="None",Y[Y.UInt8=0]="UInt8",Y[Y.UInt16=1]="UInt16",Y[Y.UInt32=2]="UInt32",(W=tJ||(tJ={})).Position="POSITION",W.Uv="TEXCOORD0",W.Uv2="TEXCOORD1",W.Normal="NORMAL",W.Tangent="TANGENT",W.Color="COLOR",W.Joints="JOINTS",W.Weights="WEIGHTS",W.PositionBS0="POSITION_BS0",W.PositionBS1="POSITION_BS1",W.PositionBS2="POSITION_BS2",W.PositionBS3="POSITION_BS3",W.PositionBS4="POSITION_BS4",W.PositionBS5="POSITION_BS5",W.PositionBS6="POSITION_BS6",W.PositionBS7="POSITION_BS7",W.NormalBS0="NORMAL_BS0",W.NormalBS1="NORMAL_BS1",W.NormalBS2="NORMAL_BS2",W.NormalBS3="NORMAL_BS3",W.TangentBS0="TANGENT_BS0",W.TangentBS1="TANGENT_BS1",W.TangentBS2="TANGENT_BS2",W.TangentBS3="TANGENT_BS3";var e2=Object.freeze({__proto__:null,get RenderLevel(){return tm},get BlendingMode(){return tv},get SideMode(){return ty},get MaskMode(){return tg},get ShapeType(){return tx},get PluginType(){return tT},get InteractType(){return tE},get InteractBehavior(){return tb},get ItemType(){return tA},get RenderMode(){return tS},get ParticleOrigin(){return tC},get RenderType(){return t_},get RenderFace(){return tR},get CameraClipMode(){return tO},get CompositionEndBehavior(){return tw},get BackgroundType(){return tM},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:0,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return tI},get BezierKeyframeType(){return tL},get ItemEndBehavior(){return tP},get ParentItemEndBehavior(){return tF},get ParticleInteractionBehavior(){return tV},get ShapeArcMode(){return tN},get LightType(){return tD},get ModelBoundingType(){return tz},get CameraType(){return tU},get MaterialType(){return tk},get MaterialBlending(){return tB},get RenderMode3D(){return tG},get TextOverflow(){return tX},get TextBaseline(){return tH},get TextAlignment(){return tY},get TextWeight(){return tW},get FontStyle(){return tj},get DataType(){return tZ},get GeometryType(){return tq},get VertexFormatType(){return tK},get IndexFormatType(){return tQ},get VertexBufferSemantic(){return tJ},BuiltinObjectGUID:{WhiteTexture:"whitetexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"}}),e3={},e4={},e5={};function e6(t){return function(e,i){e5[t]&&console.warn("Class "+t+" is already registered."),e5[t]=e}}function e8(t){var e=t.constructor.name;if(e4[e])return e4[e];e4[e]={};for(var i=e4[e],r=t,n=e;n;){var s=e3[n];for(var a in s)i[a]=s[a];var o=Object.getPrototypeOf(r);if("Object"===(n=Object.getPrototypeOf(o).constructor.name))break;r=o}return i}function e9(t,e){return function(i,r){var n,s=(e3[n=i.constructor.name]||(e3[n]={}),e3[n]);s[r]||(s[r]={type:t,sourceName:e})}}var e7=function(){function t(t){this.engine=t,this.guid=eD(),this.taggedProperties={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){t.id&&this.setInstanceId(t.id)},e.dispose=function(){},t.is=function(e){return r(e,t)&&"guid"in e},t}();n([e9(void 0,void 0)],e7.prototype,"guid",void 0);var it=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onAttached=function(){},i.onDestroy=function(){},i.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},i.dispose=function(){this.onDestroy(),this.item&&eh(this.item.components,this)},eB(e,[{key:"transform",get:function(){return this.item.transform}}]),e}(e7),ie=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e._enabled=!0,e}eX(e,t);var i=e.prototype;return i.onBehaviourEnable=function(){},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.toData=function(){t.prototype.toData.call(this)},eB(e,[{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onBehaviourEnable()}}]),e}(it);n([e9(void 0,void 0)],ie.prototype,"_enabled",void 0);var ii=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e}eX(e,t);var i=e.prototype;return i.onEnable=function(){},i.start=function(){},i.update=function(t){},i.lateUpdate=function(t){},i.onAttached=function(){this.item.itemBehaviours.push(this)},i.dispose=function(){this.item&&eh(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},i.onBehaviourEnable=function(){this.onEnable(),this.started||(this.start(),this.started=!0)},e}(ie),ir=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.started=!1,e.materials=[],e._priority=0,e._enabled=!0,e}eX(e,t);var i=e.prototype;return i.onEnable=function(){},i.start=function(){},i.update=function(t){},i.lateUpdate=function(t){},i.render=function(t){},i.onAttached=function(){this.item.rendererComponents.push(this)},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.toData=function(){t.prototype.toData.call(this)},i.dispose=function(){this.item&&eh(this.item.rendererComponents,this),t.prototype.dispose.call(this)},eB(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"enabled",get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onEnable()}},{key:"isActiveAndEnabled",get:function(){return this.item.getVisible()&&this.enabled}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(it);n([e9(void 0,void 0)],ir.prototype,"materials",void 0),n([e9(void 0,void 0)],ir.prototype,"_priority",void 0),n([e9(void 0,void 0)],ir.prototype,"_enabled",void 0);var is=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t.precompile=function(t,e){return Promise.resolve()},t}();t.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}eX(e,t);var i=e.prototype;return i.update=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.position=this.transform.position,t.rotation=this.transform.rotation}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(ii),t.CameraController=n([e6(tZ.CameraController)],t.CameraController);var ia=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(is);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 io="click",iu="touchstart",il="touchmove",ih="touchend",ic=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var e=t.prototype;return e.bindListeners=function(){var t,e,i,r,n,s,a=this;n=function(t){return t};var o="mousedown",u="mousemove",l="mouseup",h=function(t,e,i,n,s){void 0===n&&(n=0),void 0===s&&(s=0);var o=a.target,u=o.width,l=o.height,h=performance.now(),c=0,f=0;if(r){var d=h-r.ts;c=(n-r.dx)/d||0,f=(s-r.dy)/d||0,r={dx:n,dy:s,ts:h}}return{x:e,y:i,vx:c,vy:f,dx:n,dy:s,ts:h,width:u,height:l,origin:t}};ex()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},o="touchstart",u="touchmove",l="touchend"),this.nativeHandlers=((s={})[o]=function(s){if(a.enabled){var o=n(s),u=id(o);t=u.x,e=u.y,r=i={clientX:o.clientX,clientY:o.clientY,ts:performance.now(),x:t,y:e},a.dispatchEvent(iu,h(s,t,e))}},s[u]=function(r){if(i&&a.enabled){var s=id(n(r));t=s.x,e=s.y,a.dispatchEvent(il,h(r,t,e,t-i.x,e-i.y))}},s[l]=function(r){if(i&&a.enabled){!a.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var s=n(r),o=id(s),u=Math.abs(i.clientX-s.clientX)+Math.abs(i.clientY-s.clientY);t=o.x,e=o.y,u<4&&a.dispatchEvent(io,h(r,t,e)),a.dispatchEvent(ih,h(r,t,e,t-i.x,e-i.y))}i=0},s),Object.keys(this.nativeHandlers).forEach(function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.nativeHandlers[t])})},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach(function(t){return t(e)})},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),el(i,e),function(){eh(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&eh(i,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach(function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={},this.target=null)},t}();function id(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),s=n.left,a=n.top;return{x:(i-s)/n.width*2-1,y:1-(r-a)/n.height*2}}var ip=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(is),im=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,s;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(s=t[e+3])?s: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):r(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):r(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):r(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):r(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=this.x,e=this.y,i=this.z,r=this.w;return 1e-6>=Math.abs(t)&&1e-6>=Math.abs(e)&&1e-6>=Math.abs(i)&&1e-6>=Math.abs(r)},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new eJ(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t}();im.ONE=new im(1,1,1,1),im.ZERO=new im(0,0,0,0);var iv=function(){function t(t,e,i,r,n,s,a,o,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,s,a,o,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,s,a,o,u){var l=this.elements;return l[0]=t,l[3]=r,l[6]=a,l[1]=e,l[4]=n,l[7]=o,l[2]=i,l[5]=s,l[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,s,a,o,u){var l=this.elements;return l[0]=t,l[3]=e,l[6]=i,l[1]=r,l[4]=n,l[7]=s,l[2]=a,l[5]=o,l[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,s=e+e,a=i+i,o=r+r,u=e*s,l=e*a,h=e*o,c=i*a,f=i*o,d=r*o,p=n*s,m=n*a,v=n*o,y=this.elements;return y[0]=1-(c+d),y[1]=l+v,y[2]=h-m,y[3]=l-v,y[4]=1-(u+d),y[5]=f+p,y[6]=h+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],s=r[3],a=r[6],o=r[1],u=r[4],l=r[7];return r[0]=e*n+i*o,r[3]=e*s+i*u,r[6]=e*a+i*l,r[1]=-i*n+e*o,r[4]=-i*s+e*u,r[7]=-i*a+e*l,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"!=typeof t)return this.multiplyMatrices(this,t);for(var e=0;e<9;e++)this.elements[e]*=t;return this},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,s=i[0],a=i[3],o=i[6],u=i[1],l=i[4],h=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],T=r[2],E=r[5],b=r[8];return n[0]=s*p+a*y+o*T,n[3]=s*m+a*g+o*E,n[6]=s*v+a*x+o*b,n[1]=u*p+l*y+h*T,n[4]=u*m+l*g+h*E,n[7]=u*v+l*x+h*b,n[2]=c*p+f*y+d*T,n[5]=c*m+f*g+d*E,n[8]=c*v+f*x+d*b,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],l=t[8];return e*(s*l-u*a)+n*(u*r-i*l)+o*(i*a-s*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],l=t[8],h=l*s-u*a,c=u*r-l*i,f=a*i-s*r,d=e*h+n*c+o*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=h*p,t[1]=(o*a-l*n)*p,t[2]=(u*n-o*s)*p,t[3]=c*p,t[4]=(l*e-o*r)*p,t[5]=(o*i-u*e)*p,t[6]=f*p,t[7]=(n*r-a*e)*p,t[8]=(s*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[3]*r+s[6]*n,a.y=s[1]*i+s[4]*r+s[7]*n,a.z=s[2]*i+s[5]*r+s[8]*n,a},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!eZ(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return new t().setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return new t().setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromQuaternion=function(e){return new t().setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,s,a,o,u,l){return new t(e,n,o,i,s,u,r,a,l)},t}(),iy=function(){function t(t,e){void 0===t&&(t=eJ.ZERO),void 0===e&&(e=eJ.X),this.origin=new eJ,this.direction=new eJ,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new eJ;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,s,a,o,u=this.origin,l=u.x,h=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,T=t.max,E=T.x,b=T.y,A=T.z,S=1/d,C=1/p,_=1/m;if(S>=0?(i=(y-l)*S,r=(E-l)*S):(i=(E-l)*S,r=(y-l)*S),C>=0?(n=(g-h)*C,s=(b-h)*C):(n=(b-h)*C,s=(g-h)*C),!(i>s)&&!(n>r)&&((n>i||i!=i)&&(i=n),(s<r||r!=r)&&(r=s),(n>i||i!=i)&&(i=n),(s<r||r!=r)&&(r=s),_>=0?(a=(x-c)*_,o=(A-c)*_):(a=(A-c)*_,o=(x-c)*_),!(i>o)&&!(a>r))&&((a>i||i!=i)&&(i=a),(o<r||r!=r)&&(r=o),!(r<0)))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new eJ).copyFrom(this.origin):void 0;var s=-(this.origin.dot(i)+r)/n;return s>=0?this.at(s,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),s=n.dot(this.direction),a=n.dot(n)-s*s,o=e.radius*e.radius;if(!(a>o)){var u=Math.sqrt(o-a),l=s-u,h=s+u;if(!(h<0))return l>=0?this.at(l,i):this.at(h,i)}},e.intersectTriangle=function(e,i,r){var n,s=e.p0,a=e.p1,o=e.p2,u=t.tempVec0.subtractVectors(a,s),l=t.tempVec1.subtractVectors(o,s),h=t.tempVec2.subtractVectors(this.origin,s),c=t.tempVec3.crossVectors(u,l),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}l.crossVectors(h,l);var d=n*this.direction.dot(l);if(!(d<0)){u.cross(h);var p=n*this.direction.dot(u);if(!(p<0)&&!(d+p>f)){var m=-n*h.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();iy.tempVec0=new eJ,iy.tempVec1=new eJ,iy.tempVec2=new eJ,iy.tempVec3=new eJ;var ig=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,s;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(s=t[e+3])?s:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,s=t/60,a=n*(1-Math.abs(s%2-1)),o=0,u=0,l=0;s>=0&&s<=1?(o=n,u=a):s>=1&&s<=2?(o=a,u=n):s>=2&&s<=3?(u=n,l=a):s>=3&&s<=4?(u=a,l=n):s>=4&&s<=5?(o=a,l=n):s>=5&&s<=6&&(o=n,l=a);var h=i-n;return this.set(o+h,u+h,l+h,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):r(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):r(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):r(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):r(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 im(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this.r,i=this.g,r=this.b,n=this.a,s=Math.max(e,i,r),a=Math.min(e,i,r),o=s-a,u=0,l=0;return 0!==s&&(l=o/s),s!=a&&(s==e?(u=(i-r)/o,i<r&&(u+=6)):s==i?u=(r-e)/o+2:s==r&&(u=(e-i)/o+4),u*=60),new t(u,l,s,n)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),s=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+s:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return new t().setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),new t().setFromArray(e,i)},t.fromHexString=function(e){return new t().setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),new t().setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();ig.BLACK=new ig(0,0,0,1),ig.BLUE=new ig(0,0,1,1),ig.CLEAR=new ig(0,0,0,0),ig.CYAN=new ig(0,1,1,1),ig.GRAY=new ig(.5,.5,.5,1),ig.GREEN=new ig(0,1,0,1),ig.MAGENTA=new ig(1,0,1,1),ig.RED=new ig(1,0,0,1),ig.WHITE=new ig(1,1,1,1),ig.YELLOW=new ig(1,.92,.016,1);var ix=function(){function t(t,e){void 0===t&&(t=new eJ(1/0,1/0,1/0)),void 0===e&&(e=new eJ(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,s=-1/0,a=-1/0,o=0,u=t.length;o<u;o+=3){var l=t[o],h=t[o+1],c=t[o+2];l<e&&(e=l),h<i&&(i=h),c<r&&(r=c),l>n&&(n=l),h>s&&(s=h),c>a&&(a=c)}return this.min.set(e,i,r),this.max.set(n,s,a),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return new t().copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new eJ),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new eJ),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,s=0,a=n.length;s<a;s++)this.expandByObject(n[s]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new eJ),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){var e=new eJ;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new eJ),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new eJ),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new eJ),this.isEmpty())return[];var i=[];return i[0]=new eJ(this.min.x,this.min.y,this.min.z),i[1]=new eJ(this.min.x,this.min.y,this.max.z),i[2]=new eJ(this.min.x,this.max.y,this.min.z),i[3]=new eJ(this.min.x,this.max.y,this.max.z),i[4]=new eJ(this.max.x,this.min.y,this.min.z),i[5]=new eJ(this.max.x,this.min.y,this.max.z),i[6]=new eJ(this.max.x,this.max.y,this.min.z),i[7]=new eJ(this.max.x,this.max.y,this.max.z),i.forEach(function(i){i.subtract(e),i.applyMatrix(t),i.add(e)}),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new eJ;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),iT=function(){function t(t,e){void 0===t&&(t=eJ.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var s=new ix().setFromPoints(t);s.getCenter(i),this.radius=s.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new eJ),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return(void 0===t&&(t=new ix),this.isEmpty())?t.makeEmpty():(t.set(this.center,this.center),t.expandByScalar(this.radius)),t},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return this.center.applyMatrix(t),this.radius=this.radius*Math.sqrt(Math.max(i,r,n)),this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=new eJ().subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=(r-this.radius)*.5;this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new eJ,i=new eJ;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=new eJ().subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return new t().copyFrom(this)},t}(),iE=Object.freeze({__proto__:null,get EulerOrder(){return tp},Euler:e1,Quaternion:e$,Vector2:eQ,Vector3:eJ,Vector4:im,Matrix3:iv,Matrix4:e0,Ray:iy,PI2:2*Math.PI,DEG2RAD:eW,RAD2DEG:ej,NumberEpsilon:1e-6,isZero:function(t){return isNaN(t)||1e-6>Math.abs(t)},isEqual:eZ,damp:function(t,e,i,r){return eq(t,e,1-Math.exp(-i*r))},lerp:eq,degToRad:function(t){return t*eW},radToDeg:function(t){return t*ej},clamp:eK,Color:ig,Box3:ix,Sphere:iT}),ib="editor",iA={"Item duration can't be less than 0":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#smO1b"};function iS(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"!==e||(r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context."),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}function iC(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var r=t.createQuery(),n=i(function(){return s(this,function(i){return[2,new Promise(function(i,s){if(r){var a=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),o=t.getParameter(e.GPU_DISJOINT_EXT);a&&!o&&i(t.getQueryParameter(r,t.QUERY_RESULT)/1e3/1e3),(a||o)&&(t.deleteQuery(r),r=null),null!==a&&r&&window.setTimeout(function(){n().then(i).catch},1)}})]})});if(!r)return;return{begin:function(){r&&t.beginQuery(e.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:n}}}var i_=[],iR={};function iO(){"function"==typeof WebGL2RenderingContext?iM(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(iM(WebGLRenderingContext),iM(WebGLRenderingContext.prototype)):i_.push("iOS16 lockdown mode, WebGL Constants not in global"),i_.length||"HALF_FLOAT"in iR||(iR.HALF_FLOAT=5131)}function iw(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function iM(t){for(var e in t)/^[A-Z_]/.test(e)&&(iR[e]=t[e])}function iI(t){switch(t){case tK.Float32:return WebGLRenderingContext.FLOAT;case tK.Int16:return WebGLRenderingContext.SHORT;case tK.Int8:return WebGLRenderingContext.BYTE;case tK.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case tK.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}}function iL(t){switch(t){case tv.ALPHA:case tv.ADD:case tv.SUBTRACTION:case tv.STRONG_LIGHT:case tv.WEAK_LIGHT:return 1;case tv.SUPERPOSITION:return 2;case tv.BRIGHTNESS:return 3;case tv.MULTIPLY:return 0;default:return 1}}i_.length||iO(),t.ShaderType=void 0,(Z=t.ShaderType||(t.ShaderType={}))[Z.vertex=0]="vertex",Z[Z.fragment=1]="fragment";var iP=((t$={})[t.ShaderType.vertex]={in:"attribute",out:"varying"},t$[t.ShaderType.fragment]={in:"varying"},t$);function iF(t,e,i,r){var n=[],s="";n.push("#define GE_RUNTIME"),t&&(t.forEach(function(t){var e=t[0],i=t[1];!0===i?n.push("#define "+e):Number.isFinite(i)&&n.push("#define "+e+" "+i)}),s=n.length?n.join("\n")+"\n":"");var a="WEBGL"+r,o=(s=s+("\n#ifndef "+a)+"\n#define "+a+"\n#endif")+"\n"+e,u=o.match(/#version\s+\b\d{3}\b\s*(es)?/),l=u?u[0]:"";if(l&&l.includes("300")){var h=RegExp(""+l,"g");1===r&&(o=o.replace(/\b(in|out)\b/g,function(t){var e;return null!=(e=iP[i][t])?e:t})),o=o.replace(h,"\n")}return o}function iV(t,e){switch(e){case void 0:case tv.ALPHA:t.blendFunction=[iR.ONE,iR.ONE_MINUS_SRC_ALPHA,iR.ONE,iR.ONE_MINUS_SRC_ALPHA];break;case tv.ADD:t.blendFunction=[iR.ONE,iR.ONE,iR.ONE,iR.ONE];break;case tv.SUBTRACTION:t.blendFunction=[iR.ONE,iR.ONE,iR.ZERO,iR.ONE],t.blendEquation=[iR.FUNC_REVERSE_SUBTRACT,iR.FUNC_REVERSE_SUBTRACT];break;case tv.SUPERPOSITION:t.blendFunction=[iR.ONE,iR.ONE,iR.ONE,iR.ONE];break;case tv.MULTIPLY:t.blendFunction=[iR.DST_COLOR,iR.ONE_MINUS_SRC_ALPHA,iR.DST_COLOR,iR.ONE_MINUS_SRC_ALPHA];break;case tv.BRIGHTNESS:t.blendFunction=[iR.ONE,iR.ONE_MINUS_SRC_ALPHA,iR.ONE,iR.ONE_MINUS_SRC_ALPHA];break;case tv.STRONG_LIGHT:t.blendFunction=[iR.DST_COLOR,iR.DST_ALPHA,iR.ZERO,iR.ONE];break;case tv.WEAK_LIGHT:t.blendFunction=[iR.DST_COLOR,iR.ZERO,iR.ZERO,iR.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function iN(t,e){e===ty.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=iR.CW,t.cullFace=e===ty.BACK?iR.BACK:iR.FRONT)}function iD(t,e){switch(e){case void 0:t.stencilTest=!1;break;case tg.MASK:t.stencilTest=!0,t.stencilFunc=[iR.ALWAYS,iR.ALWAYS],t.stencilOpZPass=[iR.REPLACE,iR.REPLACE];break;case tg.OBSCURED:t.stencilTest=!0,t.stencilFunc=[iR.EQUAL,iR.EQUAL];break;case tg.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[iR.NOTEQUAL,iR.NOTEQUAL];break;case tg.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}function iz(){return(iz=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}).apply(this,arguments)}t.TextureLoadAction=void 0,(q=t.TextureLoadAction||(t.TextureLoadAction={}))[q.whatever=0]="whatever",q[q.clear=2]="clear",t.TextureSourceType=void 0,(K=t.TextureSourceType||(t.TextureSourceType={}))[K.none=0]="none",K[K.data=1]="data",K[K.image=2]="image",K[K.compressed=3]="compressed",K[K.video=4]="video",K[K.canvas=5]="canvas",K[K.framebuffer=6]="framebuffer",K[K.mipmaps=7]="mipmaps";var iU=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.download=function(t,e,i,r){var n=this;if(void 0===e&&(e="json"),!this.start(t,i,r)){var s=new XMLHttpRequest,a=function(){n.finish(t,s.status,s.response)};s.responseType=e,s.addEventListener("load",function(){200==s.status||0==s.status?n.finish(t,200,s.response):a()}),s.addEventListener("error",a),s.open("GET",t,!0),s.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(t,e,i){var r=this.callbacks[t];delete this.callbacks[t];for(var n=200==e||0==e?[i]:[e,i],s=n.length-1,a=r.length;s<a;s+=2)r[s].apply(null,n)},t}(),ik=!1;function iB(t,e){return iG.apply(this,arguments)}function iG(){return(iG=i(function(t,e){return s(this,function(i){switch(i.label){case 0:if(!(ik||!e))return[3,2];return[4,iX(t)];case 1:case 5:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,iX(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),ik=!0,[4,iX(t)];case 6:return[2]}})})).apply(this,arguments)}function iX(t){return iH.apply(this,arguments)}function iH(){return(iH=i(function(t){var e,i;return s(this,function(n){if(e="",r(t,HTMLImageElement)){if(t.complete)return[2,t];e=t.src}else r(t,Blob)?(e=URL.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise(function(t,r){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&URL.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e})]})})).apply(this,arguments)}function iY(t){return iW.apply(this,arguments)}function iW(){return(iW=i(function(t){return s(this,function(e){return[2,new Promise(function(e,i){new iU().downloadBinary(t,e,function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function ij(){return(ij=i(function(t){return s(this,function(e){return[2,new Promise(function(e,i){new iU().downloadBlob(t,e,function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)})})]})})).apply(this,arguments)}function iZ(t){return iq.apply(this,arguments)}function iq(){return(iq=i(function(t){var e;return s(this,function(i){return e=document.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,eg()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,i){var r=e.play();r?r.then(function(){return t(e)}):e.addEventListener("loadeddata",function i(){t(e),e.removeEventListener("loadeddata",i)},!0),e.addEventListener("error",function(t){i(t)})})]})})).apply(this,arguments)}function iK(t,e){return iQ.apply(this,arguments)}function iQ(){return(iQ=i(function(t,e){return s(this,function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:case 4:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 5:return[2,e(t)]}})})).apply(this,arguments)}function iJ(t,e,i){return i$.apply(this,arguments)}function i$(){return(i$=i(function(e,i,r,n){var a,o,u,l,h,c,f,d,p,m,v,y,g,x,T;return s(this,function(s){switch(s.label){case 0:if(void 0===n&&(n=[]),34067!==e.target)return[3,1];for(a=e.mipmaps,o=e.target,u=[],l=eY(a);!(h=l()).done;){for(c=h.value,f=[],d=eY(c);!(p=d()).done;)m=p.value,v=r.assetLoader.loadGUID(m.id),f.push(v.data);u.push(f)}return[2,iz({keepImageSource:!1},e,{mipmaps:u,sourceFrom:{target:o,type:t.TextureSourceType.mipmaps}})];case 1:return y=e.mipmaps,g=e.target,[4,Promise.all(y.map(function(t){return function(t,e){return i0.apply(this,arguments)}(t,i)}))];case 2:return x=s.sent(),T=n[y[0][1][0]].url,[2,iz({keepImageSource:!1},e,{mipmaps:x,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:g,bin:T,type:t.TextureSourceType.mipmaps,mipmaps:y.map(function(t){return[t[1][1],t[1][2]]})}})];case 3:return[2]}})})).apply(this,arguments)}function i0(){return(i0=i(function(t,e){var i,r,n,a,o;return s(this,function(s){if(r=(i=t[1])[0],n=i[1],a=i[2],!(o=e[r]))throw Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,iX(new Blob([new Uint8Array(o,n,a)]))]})})).apply(this,arguments)}var i1=1,i2=function(e){function r(t){var i;return(i=e.call(this,t)||this).destroyed=!1,i.id="Tex"+i1++,i}eX(r,e);var n=r.prototype;return n.getWidth=function(){return this.width||0},n.getHeight=function(){return this.height||0},n.uploadCurrentVideoFrame=function(){},n.offloadData=function(){},n.reloadData=function(){},n.initialize=function(){},n.assembleOptions=function(e){var i=e.target,r=void 0===i?iR.TEXTURE_2D:i,n=e.format,s=void 0===n?iR.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),iz({minFilter:iR.NEAREST,magFilter:iR.NEAREST,wrapS:iR.CLAMP_TO_EDGE,wrapT:iR.CLAMP_TO_EDGE,target:r,format:iR.RGBA,internalFormat:s,type:iR.UNSIGNED_BYTE},e)},r.fromImage=function(e,n){return i(function(){var i,a;return s(this,function(s){switch(s.label){case 0:return[4,iX(e)];case 1:return i=s.sent(),(a=r.create(n,{sourceType:t.TextureSourceType.image,image:i,id:eD()})).initialize(),[2,a]}})})()},eB(r,[{key:"isDestroyed",get:function(){return this.destroyed}}]),r}(e7);function i3(t,e,i,r){var n,s,a=e.length/i/r;return s=n=4===a||0===a?iR.RGBA:3===a?iR.RGB:2===a?iR.LUMINANCE_ALPHA:iR.LUMINANCE,i2.createWithData(t,{data:e,width:i,height:r},{type:iR.HALF_FLOAT,format:n,internalFormat:s,wrapS:iR.CLAMP_TO_EDGE,wrapT:iR.CLAMP_TO_EDGE})}var i4={type:iR.UNSIGNED_BYTE,format:iR.RGBA,internalFormat:iR.RGBA,wrapS:iR.MIRRORED_REPEAT,wrapT:iR.MIRRORED_REPEAT,minFilter:iR.NEAREST,magFilter:iR.NEAREST};function i5(e){return i2.create(e,iz({id:"whitetexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},i4))}function i6(e){return i2.create(e,iz({id:"transparenttexture00000000000000000000",data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},i4))}var i8=function(){function t(t,e,i){void 0===i&&(i=0),this.arrayBuffer=t,this.baseOffset=i;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==r[0]||75!==r[1]||84!==r[2]||88!==r[3]||32!==r[4]||49!==r[5]||49!==r[6]||187!==r[7]||13!==r[8]||10!==r[9]||26!==r[10]||10!==r[11])throw Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,s=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===s.getUint32(0,!0);if(this.glType=s.getUint32(1*n,a),this.glTypeSize=s.getUint32(2*n,a),this.glFormat=s.getUint32(3*n,a),this.glInternalFormat=s.getUint32(4*n,a),this.glBaseInternalFormat=s.getUint32(5*n,a),this.pixelWidth=s.getUint32(6*n,a),this.pixelHeight=s.getUint32(7*n,a),this.pixelDepth=s.getUint32(8*n,a),this.numberOfArrayElements=s.getUint32(9*n,a),this.numberOfFaces=s.getUint32(10*n,a),this.numberOfMipmapLevels=s.getUint32(11*n,a),this.bytesOfKeyValueData=s.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0===this.pixelHeight||0!==this.pixelDepth){eO.warn("Only 2D textures currently supported.");return}if(0!==this.numberOfArrayElements){eO.warn("Texture arrays not currently supported.");return}if(this.numberOfFaces!==e){eO.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+".");return}0===this.glType?this.loadType=0:this.loadType=2}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,s=t?this.numberOfMipmapLevels:1,a=0;a<s;a++){for(var o=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var l=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,o);e.push({data:l,width:r,height:n}),i+=o+4+(3-(o+3)%4)}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function i9(e){var i=new i8(e,1),r=i.numberOfMipmapLevels,n=i.pixelWidth,s=i.pixelHeight,a=i.glType,o=i.numberOfFaces,u=i.glInternalFormat,l=i.glFormat;return{sourceType:t.TextureSourceType.compressed,type:a,target:6===o?iR.TEXTURE_CUBE_MAP:iR.TEXTURE_2D,internalFormat:u,format:l,mipmaps:i.mipmaps(r>=Math.floor(Math.log2(Math.max(n,s))+1))}}var i7=function(){function e(){this.reloadPending={}}var r=e.prototype;return r.reload=function(t){var e=this;return i(function(){var i,r;return s(this,function(n){switch(n.label){case 0:if(i=t.id,e.reloadPending[i])return[2];if(!t.sourceFrom)return[3,2];return e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw Error("No source from.");case 3:return[2]}})})()},r.canOffloadTexture=function(e){if(e){var i=e.type;if(i===t.TextureSourceType.compressed||i===t.TextureSourceType.image){var r=e.target,n=e.map,s=e.url;return r===iR.TEXTURE_CUBE_MAP?"object"==typeof n&&!!n:eM(s)&&s.length>0}if(i===t.TextureSourceType.mipmaps){var a=e.bin,o=e.mipmaps,u=e.target,l=e.maps,h=e.urls;return a?o.length>0:u===iR.TEXTURE_CUBE_MAP?l.every(function(t){return"object"==typeof t&&t}):h.every(function(t){return eM(t)&&t.length>0})}}return!1},r.loadSource=function(e,r){var n=this;return i(function(){var i,a,o,u,l,h,c,f,d,p,m,v,y,g,x,T,E,b;return s(this,function(s){switch(s.label){case 0:if(i=e.type,a=e.target,o=e.map,u=e.url,l=e.bin,h=e.mipmaps,c=e.urls,f=e.maps,!(a===iR.TEXTURE_CUBE_MAP&&i!==t.TextureSourceType.mipmaps))return[3,2];return[4,n.loadCubeMap(o)];case 1:return d=s.sent(),[2,iz({},r,{cube:d,target:iR.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:iz({},o),target:iR.TEXTURE_CUBE_MAP}})];case 2:if(i!==t.TextureSourceType.image)return[3,4];return[4,iX(u)];case 3:return p=s.sent(),[2,iz({},r,{image:p,sourceType:t.TextureSourceType.image,sourceFrom:{type:i,url:u,target:iR.TEXTURE_2D}})];case 4:if(i!==t.TextureSourceType.video)return[3,6];return[4,iZ(u)];case 5:return m=s.sent(),[2,iz({},r,{video:m,sourceType:t.TextureSourceType.video})];case 6:if(i!==t.TextureSourceType.compressed)return[3,8];return[4,iY(u)];case 7:return v=s.sent(),[2,iz({},i9(v),r,{sourceFrom:{url:u,type:t.TextureSourceType.compressed}})];case 8:if(i!==t.TextureSourceType.mipmaps)return[3,17];if(!l)return[3,13];return[4,iY(l)];case 9:if(y=s.sent(),x=(g=null!=a?a:iR.TEXTURE_2D)===iR.TEXTURE_2D?h.slice():h.map(function(t){return t.slice()}),a!==iR.TEXTURE_CUBE_MAP)return[3,11];return[4,Promise.all(h.map(function(t){return n.loadMipmapImages(t,y)}))];case 10:return T=s.sent(),[3,12];case 11:T=n.loadMipmapImages(h,y),s.label=12;case 12:return[2,iz({},r,{mipmaps:T,target:g,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:l,mipmaps:x,target:g,type:t.TextureSourceType.mipmaps}})];case 13:if(!(a===iR.TEXTURE_2D||!a))return[3,15];return[4,Promise.all(c.map(function(t){return iX(t)}))];case 14:return E=s.sent(),[2,iz({},r,{mipmaps:E,target:iR.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:c.slice(),target:iR.TEXTURE_2D}})];case 15:if(a!==iR.TEXTURE_CUBE_MAP)return[3,17];return[4,Promise.all(f.map(function(t){return n.loadCubeMap(t)}))];case 16:return b=s.sent(),[2,iz({},r,{mipmaps:b,target:iR.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:f.map(function(t){return iz({},t)}),target:iR.TEXTURE_CUBE_MAP}})];case 17:throw Error("Invalid resource type: "+i+".")}})})()},r.loadMipmapImages=function(t,e){return i(function(){return s(this,function(i){return[2,Promise.all(t.map(function(t){return iX(new Blob([new Uint8Array(e,t[0],t[1])]))}))]})})()},r.loadCubeMap=function(t){return i(function(){return s(this,function(e){return[2,Promise.all(t.map(function(t){return iX(t)}))]})})()},e}();function rt(){return t0||(t0=new i7),t0}var re=function(){function t(t){this.destroyed=!1;var e=t.name;this.name=void 0===e?"defaultDataBlock":e}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach(function(i){e.setUniformValue(i,t[i])})},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function ri(t){return"object"==typeof t&&t&&void 0===t.length&&r(t,i2)}t.MaterialRenderType=void 0,(Q=t.MaterialRenderType||(t.MaterialRenderType={}))[Q.normal=0]="normal",Q[Q.transformFeedback=1]="transformFeedback";var rr=1,rn=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.destroyed=!1,r.initialized=!1,i){var n=i.name,s=void 0===n?"Material"+rr++:n,a=i.renderType,o=i.shader,u=i.uniformSemantics;r.name=s,r.renderType=void 0===a?0:a,r.shaderSource=o,r.props=i,r.uniformSemantics=iz({},u)}else r.name="Material"+rr++,r.renderType=0;return r}eX(e,t);var i=e.prototype;return i.initialize=function(){},i.use=function(t,e){},eB(e,[{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"colorMask",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(e7),rs=($=new Int32Array((J=new Float32Array(1)).buffer),function(t){J[0]=t;var e=$[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?(r|=2048,i|=(r>>114-n)+(r>>113-n&1)):(i|=n-112<<10|r>>1,i+=1&r)}),ra=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=rs(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=rs(t[i])},t}(),ro=new e1,ru=new e0;function rl(t,e,i,r,n,s,a){var o=r/n,u=r,l=e.speedOverLifetime;l&&(u=l.getIntegrateValue(0,r,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;t.copyFrom(s),t.addScaledVector(a,u),t.addScaledVector(i,h);var c=e.linearVelOverLifetime||{},f=e.orbitalVelOverLifetime||{};if(f.enabled){var d=new eJ;f.center&&d.setFromArray(f.center);var p=t.clone().subtract(d),m=f.asRotation,v=["x","y","z"].map(function(t){var e=f[t];return e?m?e.getValue(o):e.getIntegrateValue(0,r,n):0});ro.setFromArray(v).negate(),ru.setFromEuler(ro);var y=ru.transformPoint(p);t.addVectors(d,y)}if(c.enabled){var g=c.asMovement,x=c.x,T=c.y,E=c.z;if(x){var b=g?x.getValue(o):x.getIntegrateValue(0,r,n);t.x=t.x+b}if(T){var A=g?T.getValue(o):T.getIntegrateValue(0,r,n);t.y=t.y+A}if(E){var S=g?E.getValue(o):E.getIntegrateValue(0,r,n);t.z=t.z+S}}return t}function rh(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function rc(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function rf(t,e,i,r){void 0===r&&(r=0);for(var n=0;n<i;n++)t[n]=e[n+r];return t}function rd(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var s=0;s<e.length;s++)t[s]=e[s]}else if(i&&t!==i)for(var a=0;a<i.length;a++)t[a]=i[a];return t}var rp=((t1={})[tC.PARTICLE_ORIGIN_CENTER]=[0,0],t1[tC.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t1[tC.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t1[tC.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t1[tC.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t1[tC.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t1[tC.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t1[tC.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t1[tC.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t1);function rm(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function rv(t,e,i){var r=i.position,n=new eJ(t,e,0),s=new eJ;return i.getInverseViewProjectionMatrix().projectPoint(n,s),s.subtract(r),new iy(r,s)}function ry(t,e,i){var r=t.x,n=t.y,s=t.z,a=new eJ(r-e,n+i,s),o=new eJ(r-e,n-i,s),u=new eJ(r+e,n-i,s),l=new eJ(r+e,n+i,s);return[{p0:a,p1:o,p2:u},{p0:a.clone(),p1:u.clone(),p2:l}]}function rg(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function rx(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function rT(t,e,i){return(rT=!function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}()?function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&eG(n,i.prototype),n}:Reflect.construct).apply(null,arguments)}var rE={getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t),r=i.xIndex,n=i.yIndex;return new eQ(e[r],e[n])},getPointIndexInCurve:function(t){var e=t[0],i=t[2],r=e===tL.LINE?0:e===tL.EASE_OUT?0:e===tL.EASE_IN?2:e===tL.EASE?2:e===tL.HOLD&&i===tL.EASE_IN?2:0;return{xIndex:r,yIndex:r+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tL.HOLD&&this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!!(e===tL.HOLD&&this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[tL.EASE,tL.EASE_IN,tL.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[tL.EASE,tL.EASE_OUT,tL.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tL.HOLD&&[tL.HOLD,tL.LINE_OUT,tL.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===tL.HOLD&&[tL.HOLD,tL.LINE,tL.EASE_IN].includes(i)}},rb=function(t,e){this.points=t,this.totalLength=e},rA={},rS={};function rC(t,e,i){return(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t}function r_(t,e,i){return 3*(1-3*i+3*e)*t*t+2*(3*i-6*e)*t+3*e}var rR=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,i,r){var n=rx(e.x-t.x,3)+"_"+rx(e.y-t.y,3)+"_"+rx(e.z-t.z,3)+"&"+(rx(i.x-t.x,3)+"_"+rx(i.y-t.y,3))+"_"+rx(i.z-t.z,3)+"&"+(rx(r.x-t.x,3)+"_"+rx(r.y-t.y,3))+"_"+rx(r.z-t.z,3);if(rS[n])return{data:rS[n],interval:t};for(var s=[],a=null,o=0,u=0,l=0;l<300;l+=1){var h=new eJ,c=l/299;u=0,h.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),h.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),h.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==a&&(u+=Math.pow(h.x-a.x,2)+Math.pow(h.y-a.y,2)+Math.pow(h.z-a.z,2)),a=h,o+=u=Math.sqrt(u),s[l]={partialLength:u,point:h}}var f=new rb(s,o);return rS[n]=f,{data:f,interval:new eJ(t.x,t.y,t.z)}}(t,e,i,r),s=n.data,a=n.interval;this.lengthData=s,this.interval=a,this.totalLength=s.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(rg(1-t,0))return e.points[299].point.clone().add(this.interval);if(rg(e.totalLength,0))return this.p1.clone();var i=new eJ,r=rx(e.totalLength*t,4),n=this.catching.lastAddedLength,s=this.catching.lastPoint;if(rg(n,r))return e.points[s].point.clone().add(this.interval);var a=!0,o=1;for(r<n&&(o=-1);a;){if(r>=n){if(299===s){i.x=e.points[s].point.x,i.y=e.points[s].point.y,i.z=e.points[s].point.z;break}if(r<n+e.points[s+1].partialLength){var u=(r-n)/e.points[s+1].partialLength;i.x=e.points[s].point.x+(e.points[s+1].point.x-e.points[s].point.x)*u,i.y=e.points[s].point.y+(e.points[s+1].point.y-e.points[s].point.y)*u,i.z=e.points[s].point.z+(e.points[s+1].point.z-e.points[s].point.z)*u;break}}o>0&&s<299?(s+=o,n+=rx(e.points[s].partialLength,5)):o<0&&s>0?(n-=rx(e.points[s].partialLength,5),s+=o):a=!1}return this.catching.lastPoint=s,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),rO=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new e$,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):rg(1-t,0)?this.temp.copyFrom(this.p2):(rI.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),rw=function(){function t(t,e,i,r){this.mX1=t,this.mY1=e,this.mX2=i,this.mY2=r,this.precomputed=!1,this.mSampleValues=Array(11)}var e=t.prototype;return e.precompute=function(){this.precomputed=!0,(this.mX1!==this.mY1||this.mX2!==this.mY2)&&this.calcSampleValues()},e.getValue=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:isNaN(this.mY1)||isNaN(this.mY2)?0:0===t||1===t?t:(this.precomputed||this.precompute(),rC(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=rC(.1*t,this.mX1,this.mX2)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=.1;var n=i+(t-e[--r])/(e[r+1]-e[r])*.1,s=r_(n,this.mX1,this.mX2);return s>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var s=r_(e,i,r);if(0===s)break;var a=rC(e,i,r)-t;e-=a/s}return e}(t,n,this.mX1,this.mX2):0===s?n:function(t,e,i,r,n){var s,a,o=0;do(s=rC(a=e+(i-e)/2,r,n)-t)>0?i=a:e=a;while(Math.abs(s)>1e-7&&++o<10);return a}(t,i,i+.1,this.mX1,this.mX2)},t}();function rM(t,e){var i,r,n,s=function(t,e,i){var r=t[1],n=rE.isHoldOutKeyframe(t),s=rE.isHoldInKeyframe(e),a=!s&&rE.isRightSideEase(t),o=!n&&rE.isLeftSideEase(e);if(a&&!o&&!s){var u=new eQ(r[r.length-4],r[r.length-3]),l=new eQ(r[r.length-2],r[r.length-1]),h=rE.getPointInCurve(e),c=new eQ(h.x,h.y),f=new eQ(c.x-(c.x-u.x)/10,c.y);return{type:"ease",p0:u,p1:l,p2:f,p3:c}}if(!a&&o&&!n){var d=e[1],p=rE.getPointInCurve(t),m=new eQ(p.x,p.y),v=new eQ(d[0],d[1]),y=new eQ(d[2],d[3]),g=new eQ(m.x+(y.x-m.x)/10,m.y);return{type:"ease",p0:m,p1:g,p2:v,p3:y}}if(a&&o){var x=e[1];return{type:"ease",p0:new eQ(r[r.length-4],r[r.length-3]),p1:new eQ(r[r.length-2],r[r.length-1]),p2:new eQ(x[0],x[1]),p3:new eQ(x[2],x[3])}}var T=rE.getPointInCurve(t),E=rE.getPointInCurve(e);if(n?E.y=T.y:s&&(T.y=E.y),!i)return{type:"line",p0:T,p1:E,isHold:n||s,leftHoldLine:n,rightHoldLine:s};var b=new eQ((E.x-T.x)/3+T.x,(E.y-T.y)/3+T.y),A=new eQ((E.x-T.x)/3*2+T.x,(E.y-T.y)/3*2+T.y);return{type:"ease",p0:T,p1:b,p2:A,p3:E,isHold:n||s,leftHoldLine:n,rightHoldLine:s}}(t,e,!0),a=s.p0,o=s.p1,u=s.p2,l=s.p3;eC(u),eC(l);var h=l.x-a.x,c=l.y-a.y,f=rx((o.x-a.x)/h,5),d=rx((u.x-a.x)/h,5);rg(c,0)?i=r=NaN:(i=rx((o.y-a.y)/c,5),r=rx((u.y-a.y)/c,5)),f<0&&(console.error("Invalid bezier points, x1 < 0",a,o,u,l),f=0),d<0&&(console.error("Invalid bezier points, x2 < 0",a,o,u,l),d=0),f>1&&(console.error("Invalid bezier points, x1 >= 1",a,o,u,l),f=1),d>1&&(console.error("Invalid bezier points, x2 >= 1",a,o,u,l),d=1);var p=("bez_"+f+"_"+i+"_"+d+"_"+r).replace(/\./g,"p");return rA[p]?n=rA[p]:(n=new rw(f,i,d,r),rA[p]=n),{points:[a,o,u,l],timeInterval:h,valueInterval:c,curve:n}}var rI=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,s=e.y,a=e.z,o=e.w,u=i.x,l=i.y,h=i.z,c=i.w;if(0===r){t.x=n,t.y=s,t.z=a,t.w=o;return}if(1===r){t.x=u,t.y=l,t.z=h,t.w=c;return}if(o!==c||n!==u||s!==l||a!==h){var f=1-r,d=n*u+s*l+a*h+o*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,s=s*f+l*g,a=a*f+h*g,o=o*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+s*s+a*a+o*o);n*=x,s*=x,a*=x,o*=x}}t.x=n,t.y=s,t.z=a,t.w=o},t}(),rL="not_implement",rP=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw Error(rL)},e.getIntegrateValue=function(t,e,i){throw Error(rL)},e.getIntegrateByTime=function(t,e){throw Error(rL)},e.getValue=function(t){throw Error(rL)},e.getMaxTime=function(){throw Error(rL)},e.toUniform=function(t){throw Error(rL)},e.map=function(t){throw Error(rL)},e.scaleXCoord=function(t){return this},e.toData=function(){throw Error(rL)},t.getAllData=function(t,e){for(var i=new(e?ra:Float32Array)(4*t.index),r=0,n=0,s=t.curves;r<s.length;r++){var a=s[r].toData();i.set(a,n),n+=a.length}return e?i.data:i},t}(),rF=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return .5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(rP),rV=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(rP),rN=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){return eV(this.min,this.max)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(rP),rD=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var s=Math.random();r[n]=e[n]*(1-s)+i[n]*s}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(rP),rz=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,s=this.xCoord*i;return((r+e/s*(n-r)+r)*e-(r+t/s*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return rZ(e,0,this.xCoord,this.min,this.max)-rZ(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(rP),rU=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=ep(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],s=e[r+1];if(n.stop<=t&&s.stop>t){var a=(t-n.stop)/(s.stop-n.stop);return em(n.color,s.color,a,!0)}}return e[i].color.slice()},e}(rP),rk=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map(function(t){return t.slice?t.slice(0,2):[t.time,t.value]}).sort(function(t,e){return t[0]-e[0]});var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],s=e[r+1],a=n[0],o=s[0];if(t>=a&&t<=o){var u=(t-a)/(o-a),l=n[1];return l+u*(s[1]-l)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,s=e?rZ:rj,a=0;a<n;a++){var o=i[a],u=i[a+1],l=o[0],h=u[0];if(t>l&&t<=h)return r+s(t,l,h,o[1],u[1]);r+=s(h,l,h,o[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=Math.ceil(this.keys.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},i.map=function(t){return this.keys.forEach(function(e){return e[1]=t(e[1])}),this},i.scaleXCoord=function(t){return this.keys.forEach(function(e){return e[0]=t*e[0]}),this},e}(rP),rB=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.curveMap={},this.keys=[];for(var e=0;e<t.length-1;e++){var i=rM(t[e],t[e+1]),r=i.points,n=i.curve,s=i.timeInterval,a=i.valueInterval,o=r[0],u=r[r.length-1];this.keys.push([].concat(o.toArray(),r[1].toArray())),this.keys.push([].concat(u.toArray(),r[2].toArray())),this.curveMap[o.x+"&"+u.x]={points:r,timeInterval:s,valueInterval:a,curve:n}}},i.getValue=function(t){var e=0,i=Object.keys(this.curveMap),r=Number(i[0].split("&")[0]),n=Number(i[i.length-1].split("&")[1]);if(t<=r)return this.getCurveValue(i[0],r);if(t>=n)return this.getCurveValue(i[i.length-1],n);for(var s=0;s<i.length;s++){var a=i[s].split("&"),o=a[0],u=a[1];if(t>=Number(o)&&t<Number(u)){e=this.getCurveValue(i[s],t);break}}return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,s=Object.keys(this.curveMap);if(r<=Number(s[0].split("&")[0]))return 0;for(var a=0;a<s.length;a++){var o=s[a].split("&"),u=o[0],l=o[1];if(r>=Number(l)&&(n+=i*this.getCurveIntegrateValue(s[a],Number(l))),r>=Number(u)&&r<Number(l)){n+=i*this.getCurveIntegrateValue(s[a],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,s=i.valueInterval,a=0,o=(e-r.x)/20,u=0;u<=20;u++){var l=u*o/n,h=r.y+s*i.curve.getValue(l);0===u||20===u?a+=h:u%2==1?a+=4*h:a+=2*h}return o/3*a},i.getCurveValue=function(t,e){var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,s=i.valueInterval,a=(e-r.x)/n,o=i.curve.getValue(a);return r.y+s*o},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){var t=Object.keys(this.curveMap);return Number(t[t.length-1].split("&")[1])},e}(rP),rG=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],s=e[r+1];if(n[0]<=t&&s[0]>=t){var a=s[1]-n[1],o=void 0;return o=0===a?(t-n[0])/(s[0]-n[0]):(function(t,e,i){var r=i[0]-e[0],n=e[3]*r,s=i[2]*r,a=(t-e[0])/r,o=a*a,u=o*a;return(2*u-3*o+1)*e[1]+(u-2*o+a)*n+(u-o)*s+(-2*u+3*o)*i[1]}(t,n,s)-n[1])/a,this.calculateVec(r,o)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],s=0;s<i.length;s++)n[s]=i[s]*(1-e)+r[s]*e;return n},e}(rP),rX=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=new eJ(i[n][0],i[n][1],i[n][2]),u=new eJ(i[n+1][0],i[n+1][1],i[n+1][2]),l=new eJ(r[2*n][0],r[2*n][1],r[2*n][2]),h=new eJ(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=rM(s,a),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new rR(o,u,l,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=rx(t,5),i=0,r=new eJ,n=Object.keys(this.curveSegments);if(!n.length)return r;var s=Number(n[0].split("&")[0]),a=Number(n[n.length-1].split("&")[1]);if(e<=s)return this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)return this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<n.length;o++){var u=n[o].split("&"),l=u[0],h=u[1];if(e>=Number(l)&&e<Number(h)){var c=this.curveSegments[n[o]].pathCurve;i=this.getPercValue(n[o],e),r=c.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,s=rx((e-r.x)/n,4);return eK(i.easingCurve.getValue(s),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(rP),rH=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=e$.fromArray(i[n]),u=e$.fromArray(i[n+1]),l=e$.fromArray(r[2*n]),h=e$.fromArray(r[2*n+1]),c=rM(s,a),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new rO(o,u,l,h);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=rx(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),s=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=s)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<r.length;a++){var o=r[a].split("&"),u=o[0],l=o[1];if(i>=Number(u)&&i<Number(l)){var h=this.curveSegments[r[a]].pathCurve;return e=this.getPercValue(r[a],i),h.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,s=rx((e-r.x)/n,4);return eK(i.easingCurve.getValue(s),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(rP),rY=((t2={})[tI.RANDOM]=function(t){return r(t[0],Array)?new rD(t):new rN(t)},t2[tI.CONSTANT]=function(t){return new rF(t)},t2[tI.CONSTANT_VEC2]=function(t){return new rF(t)},t2[tI.CONSTANT_VEC3]=function(t){return new rF(t)},t2[tI.CONSTANT_VEC4]=function(t){return new rF(t)},t2[tI.RGBA_COLOR]=function(t){return new rF(t)},t2[tI.COLORS]=function(t){return new rV(t.map(function(t){return ef(t,!1)}))},t2[tI.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new rz([t[0][1],t[1][1]]):new rk(t)},t2[tI.GRADIENT_COLOR]=function(t){return new rU(t)},t2[tI.LINEAR_PATH]=function(t){return new rG(t)},t2[tI.BEZIER_CURVE]=function(t){return 1===t.length?new rF(t[0][1][1]):new rB(t)},t2[tI.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new rF(rT(eJ,[].concat(t[1][0]))):new rX(t)},t2[tI.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new rF(rT(e$,[].concat(t[1][0]))):new rH(t)},t2);function rW(t){if(!t||!isNaN(+t))return new rF(t||0);if(r(t,rP))return t;if(eL(rY[t[0]]))return rY[t[0]](t[1]);throw Error("ValueType: "+t[0]+" is not supported, see "+iA["ValueType: 21/22 is not supported"]+".")}function rj(t,e,i,r,n){var s=t-e;return(r+r+(n-r)*s/(i-e))*s/2}function rZ(t,e,i,r,n){var s=t*t,a=e*e;return(s*t*2*(r-n)+3*s*(e*n-i*r)-a*e*(2*r+n)+3*a*i*r)/(6*(e-i))}function rq(t,e){if(e){var i=e[0],r=e[1];if(i===tI.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===tI.LINE){var s=r.length;if(2===s&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&s++,r[r.length-1][0]<1&&s++;var a=Math.ceil(s/2);t.lineSegCount+=a,t.curves.push(r),t.index+=a,t.max=Math.max(t.max,a)}else if(i===tI.BEZIER_CURVE){var o=r.length-1;t.index+=2*o,t.curves.push(r),t.max=Math.max(t.max,2*o),t.curveCount+=2*o}}}function rK(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}t.ShaderCompileResultStatus=void 0,(tt=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[tt.noShader=0]="noShader",tt[tt.success=1]="success",tt[tt.fail=2]="fail",tt[tt.compiling=3]="compiling",t.GLSLVersion=void 0,(te=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",te.GLSL3="300 es";var rQ=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return eX(e,t),e}(e7);t.Shader=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=eY(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var s=this.engine.getShaderLibrary().createShader(this.shaderData,e);return s.shader=this,s},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(e7),t.Shader=n([e6("Shader")],t.Shader);var rJ="effects-internal-copy",r$="effects-internal-copy-mesh",r0="\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}",r1="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 r2(e,i){var r=2===e,n=r?"#version 300 es":"";return{name:rJ,vertex:n+"\n"+r0,fragment:n+"\n"+r1,glslVersion:r?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,macros:[["WEBGL2",!!r],["DEPTH_TEXTURE",!!i]],cacheId:r$+ +i}}var r3={format:iR.RGBA,type:iR.UNSIGNED_BYTE,minFilter:iR.LINEAR,magFilter:iR.LINEAR,wrapS:iR.CLAMP_TO_EDGE,wrapT:iR.CLAMP_TO_EDGE},r4=Symbol("dispose"),r5=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}var i=e.prototype;return i.requestColorAttachmentTexture=function(e){var i=this,r=e.width,n=e.height,s=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:r,height:n},name:s},o=[s];Object.getOwnPropertyNames(r3).forEach(function(t){var i,r=null!=(i=e[t])?i:r3[t];a[t]=r,o.push(t,r)});var u=o.join(":"),l=this.textureCache[u];if(l)this.textureRef[u]++;else{var h=this.engine;eC(h),l=i2.create(h,a),this.textureCache[u]=l,this.textureRef[u]=1,l[r4]=l.dispose,l.dispose=function(){return i.removeTexture(u)}}return l},i.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[r4](),i.dispose=i[r4]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},i.dispose=function(){var t=this;Object.keys(this.textureCache).forEach(function(e){var i=t.textureCache[e];i[r4](),i.dispose=i[r4]}),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),r6=function(){function t(t){void 0===t&&(t={}),this.semantics=iz({},t)}var e=t.prototype;return e.toObject=function(){return iz({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var i=this.semantics[t];return eL(i)?i(e):i},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach(function(e){delete t.semantics[e]})},t}(),r8=((t3={})[iR.FLOAT]=Float32Array.BYTES_PER_ELEMENT,t3[iR.INT]=Int32Array.BYTES_PER_ELEMENT,t3[iR.SHORT]=Int16Array.BYTES_PER_ELEMENT,t3[iR.BYTE]=Int8Array.BYTES_PER_ELEMENT,t3),r9=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(e7);function r7(t){return t===iR.INT?new Int32Array(0):t===iR.SHORT?new Int16Array(0):new Float32Array(0)}var nt=1,ne=function(e){function i(t,i){var r;if((r=e.call(this,t)||this).destroyed=!1,r.visible=!0,i){var n=i.material,s=i.geometry,a=i.name,o=i.priority,u=i.worldMatrix,l=void 0===u?e0.fromIdentity():u;r.id="Mesh"+nt++,r.name=void 0===a?"<unnamed>":a,r.geometry=s,r.material=n,r.priority=void 0===o?0:o,r.worldMatrix=l}else r.id="Mesh"+nt++,r.name="<unnamed>",r.worldMatrix=e0.fromIdentity(),r._priority=0;return r}eX(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){!this.isDestroyed&&this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.restore=function(){},r.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var i=null==e?void 0:e.material;i!==t.DestroyOptions.keep&&this.material.dispose(i),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},eB(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ir);t.RenderPassAttachmentStorageType=void 0,(ti=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[ti.none=0]="none",ti[ti.color=1]="color",ti[ti.stencil_8_opaque=2]="stencil_8_opaque",ti[ti.depth_16_opaque=3]="depth_16_opaque",ti[ti.depth_stencil_opaque=4]="depth_stencil_opaque",ti[ti.depth_16_texture=5]="depth_16_texture",ti[ti.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(tr=t.TextureStoreAction||(t.TextureStoreAction={}))[tr.store=0]="store",tr[tr.clear=2]="clear";var ni=function(){function e(e,i){if(this.destroyed=!1,i){var n=i.texture,s=i.size;if(r(n,i2))this.texture=n,this.externalTexture=!0;else if(n){var a=n.wrapT,o=n.wrapS,u=n.minFilter,l=n.magFilter,h=n.internalFormat,c=n.format,f=void 0===c?iR.RGBA:c,d=n.type,p=void 0===d?iR.UNSIGNED_BYTE:d;this.externalTexture=!1,this.textureOptions={size:s,format:f,type:p,internalFormat:h||f,wrapT:a,wrapS:o,minFilter:u,magFilter:l,name:i.name},this.texture=i2.create(e,iz({},this.textureOptions,{sourceType:t.TextureSourceType.framebuffer,data:{width:s[0],height:s[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},eB(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),e}();t.RenderPassDestroyAttachmentType=void 0,(tn=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[tn.force=0]="force",tn[tn.keep=1]="keep",tn[tn.keepExternal=2]="keepExternal",tn[tn.destroy=0]="destroy";var nr=1,nn=function(){function e(e,i){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=i.name,n=void 0===r?"RenderPass_"+nr++:r,s=i.clearAction,a=i.semantics,o=i.depthStencilAttachment,u=i.storeAction,l=i.priority,h=i.meshOrder,c=void 0===h?t.OrderType.ascending:h,f=i.meshes,d=i.delegate;this.name=n,this.renderer=e,this.priority=void 0===l?0:l,this.meshOrder=c,this.meshes=eb((void 0===f?[]:f).slice(),this.meshOrder),this.depthStencilType=(null==o?void 0:o.storageType)||0,this.clearAction=iz({},s),this.storeAction=iz({colorAction:0,depthAction:0,stencilAction:0},u),this.semantics=new r6(a),this.options=i,this.delegate=void 0===d?{}:d,this.setViewportOptions(i)}var i=e.prototype;return i.addMesh=function(t){eA(this.meshes,t,this.meshOrder)},i.removeMesh=function(t){eh(this.meshes,t)},i.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),eb(this.meshes,this.meshOrder),this.meshes},i.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},i.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],s=e[3];t.setViewport(i,r,n,s)}},i.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},i.frameCleanup=function(t){},i.resetColorAttachments=function(e){var i=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var r=e.map(function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new ni(i.renderer.engine,{texture:e})});this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments=r,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(e.map(function(t){return t})))}else this.resetAttachments({attachments:e.map(function(t){return{texture:t}})})},i.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},i.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},i._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach(function(t){return!t.externalTexture&&t.dispose()}),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var s=this.viewportScale,a=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*s,r.getHeight()*s],o=[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 r;return new ni(i.renderer.engine,iz({size:o,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))});this.attachments=l;var h=nL.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}},r);h.bind(),h.unbind(),this.framebuffer=h}else this.attachments.length=0},i.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var i=this.renderer,r=this.viewportScale;return i?[0,0,i.getWidth()*r,i.getHeight()*r]:[0,0,0,0]},i.getDepthAttachment=function(){var t=this.framebuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:t.getDepthTexture()?this.getDepthTexture(t.getDepthTexture(),t.externalStorage):void 0}},i.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}},i.getDepthTexture=function(t,e){if(!this.depthTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.depthTexture=n),n}return this.depthTexture},i.getStencilTexture=function(t,e){if(!this.stencilTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},i.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},i.dispose=function(e){if(!this.destroyed){var i,r,n=(null==e?void 0:e.meshes)||void 0;n!==t.DestroyOptions.keep&&this.meshes.forEach(function(t){t.dispose(n)}),this.meshes.length=0;var s=(null==e?void 0:e.colorAttachment)?e.colorAttachment:0;this.attachments.forEach(function(t){t.externalTexture&&2===s||1===s||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,o=this.framebuffer;o&&(o.dispose({depthStencilAttachment:a}),o.externalStorage&&2===a||1===a||(null==(i=this.stencilTexture)||i.dispose(),null==(r=this.depthTexture)||r.dispose())),this.options=this.renderer=null,this.initialize=eN}},eB(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),e}(),ns="#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;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",na="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}",no="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",nu="#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;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\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",nl="#version 300 es\nprecision mediump 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#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;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#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}}",nh="#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#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}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}",nc="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",nf="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);}",nd="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);}",np="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);}",nm="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);}",nv="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);}",ny=function(e){function i(i,r){var n,s=(n=e.call(this,i,r)||this).renderer.engine,a=r9.create(s,{mode:iR.TRIANGLE_STRIP,attributes:{aPos:{type:iR.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=rn.create(s,{shader:{vertex:nc,fragment:nv,glslVersion:t.GLSLVersion.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,n.screenMesh=ne.create(s,{geometry:a,material:o,priority:0}),n.priority=5e3,n}eX(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var i=e.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",i),e.renderMeshes([this.screenMesh])},i}(nn),ng=function(e){function i(i,r,n){(s=e.call(this,i,n)||this).type=r;var s,a=s.renderer.engine,o="PostProcess",u=r9.create(a,{name:o,mode:iR.TRIANGLE_STRIP,attributes:{aPos:{type:iR.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),l={vertex:nc,fragment:"H"==r?nd:np,glslVersion:t.GLSLVersion.GLSL1},h=rn.create(a,{name:o,shader:l});return h.blending=!1,h.depthTest=!1,h.culling=!1,s.screenMesh=ne.create(a,{name:o,geometry:u,material:h,priority:0}),s.priority=5e3,s}eX(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",nC(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFramebuffer().getColorTextures()[0])},i}(nn),nx=function(e){function i(t,i){r=e.call(this,t,i)||this;var r,n="PostProcess",s=r.renderer.engine,a=r9.create(s,{name:n,mode:iR.TRIANGLE_STRIP,attributes:{aPos:{type:iR.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=rn.create(s,{name:n,shader:{vertex:nc,fragment:nm}});return o.blending=!1,o.depthTest=!1,o.culling=!1,r.screenMesh=ne.create(s,{name:n,geometry:a,material:o,priority:0}),r.priority=5e3,r}eX(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",nC(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},i}(nn),nT=function(e){function i(i,r){n=e.call(this,i,{})||this;var n,s="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=r||new ni(a);var o=r9.create(a,{name:s,mode:iR.TRIANGLE_STRIP,attributes:{aPos:{type:iR.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=rn.create(a,{name:s,shader:{vertex:nc,fragment:nf,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=ne.create(a,{name:s,geometry:o,material:u,priority:0}),n.priority=5e3,n}eX(i,e);var r=i.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var i=e.renderingData.currentFrame.globalVolume,r=i.useBloom,n=i.bloomIntensity,s=i.brightness,a=i.saturation,o=i.contrast,u=i.useToneMapping,l=i.vignetteIntensity,h=i.vignetteSmoothness,c=i.vignetteRoundness;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",s),this.screenMesh.material.setFloat("_Saturation",a),this.screenMesh.material.setFloat("_Contrast",o),this.screenMesh.material.setInt("_UseBloom",r),r&&(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",h),this.screenMesh.material.setFloat("_VignetteRoundness",c),this.screenMesh.material.setVector2("_VignetteCenter",new eQ(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new eJ(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",u),e.renderMeshes([this.screenMesh])},i}(nn),nE={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,vignetteIntensity:.2,vignetteSmoothness:.4,vignetteRoundness:1,useToneMapping:1},nb="_effects_default_",nA=1,nS=function(){function e(e){this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=e.camera,r=e.keepColorBuffer,n=e.renderer,s=e.editorTransform,a=e.globalVolume,o=e.clearAction,u=void 0===o?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:o,l=n.engine;a&&(this.globalVolume=iz({},nE,a)),this.globalUniforms=new nR;var h=[],c={};if(this.renderer=n,this.globalVolume){var f=this.globalVolume.useHDR?iR.HALF_FLOAT:iR.UNSIGNED_BYTE;h=[{texture:{format:iR.RGBA,type:f,magFilter:iR.LINEAR,minFilter:iR.LINEAR}}],m={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},c={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var d=[new nn(n,{name:nb,priority:1e3,meshOrder:t.OrderType.ascending,depthStencilAttachment:m,attachments:h,clearAction:c})];if(this.setRenderPasses(d),this.globalVolume){var p,m,v,y=this.globalVolume.useBloom,g=new ni(l);if(y){var x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],T=Array(7),E=this.globalVolume.useHDR?iR.HALF_FLOAT:iR.UNSIGNED_BYTE,b=new ny(n,{name:"BloomThresholdPass",attachments:[{texture:{format:iR.RGBA,type:E,minFilter:iR.LINEAR,magFilter:iR.LINEAR}}]});b.sceneTextureHandle=g,this.addRenderPass(b);for(var A=0;A<7;A++){T[A]=new ni(l);var S=new ng(n,"H",{name:"GaussianDownPassH"+A,viewport:x,attachments:[{texture:{format:iR.RGBA,type:E,minFilter:iR.LINEAR,magFilter:iR.LINEAR}}]}),C=new ng(n,"V",{name:"GaussianDownPassV"+A,viewport:x,attachments:[{texture:{format:iR.RGBA,type:E,minFilter:iR.LINEAR,magFilter:iR.LINEAR}}]});C.gaussianResult=T[A],this.addRenderPass(S),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var _=0;_<6;_++){var R=new nx(n,{name:"GaussianUpPass"+_,viewport:x,attachments:[{texture:{format:iR.RGBA,type:E,minFilter:iR.LINEAR,magFilter:iR.LINEAR}}]});R.gaussianDownSampleResult=T[5-_],this.addRenderPass(R),x[2]*=2,x[3]*=2}}v=y?new nT(n,g):new nT(n),this.addRenderPass(v)}this.semantics=new r6(e.semantics),this.clearAction=u,this.name="RenderFrame"+nA++;var O=d[0];this.emptyTexture=i5(l),this.transparentTexture=i6(l),this.camera=i,this.keepColorBuffer=r,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=im.fromArray(void 0===s?[1,1,0,0]:s),e.clearAction||this.resetClearActions(),this.passTextureCache=new r5(l);var w=l.gpuCapability,M=w.detail,I=r2(w.level,M.readableDepthStencilTextures&&M.writableFragDepth);null==(p=this.renderer.getShaderLibrary())||p.addShader(I)}var i=e.prototype;return i.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},i.removeMeshFromDefaultRenderPass=function(t){},i.dispose=function(e){(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var i,r,n=(null==e?void 0:e.passes)?e.passes:void 0;n!==t.DestroyOptions.keep&&this._renderPasses.forEach(function(t){t.dispose(n)}),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(i=r.texture)||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},i.resetRenderPassDefaultAttachment=function(t,e){for(var i=this.resource,r=i.color_a,n=i.color_b,s=e;s<t.length;s++){var a,o,u,l=t[s],h=null==(o=l.attachments[0])?void 0:o.texture;if(h&&a===h){var c=h===r?n:r;l.resetColorAttachments([c])}(h=null==(u=l.attachments[0])?void 0:u.texture)&&(a=h)}},i.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every(function(i,r){return!(i.name.startsWith(nb)&&i.meshes.includes(t))||(e=r,!1)}),e},i.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e)},i.getRPAttachments=function(t,e){if((null==t?void 0:t.length)===1){var i,r=t[0],n=r.texture,s=r.persistent,a=n.format,o=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(a===iR.RGBA&&!s){var u=this.resource.color_a;return 0===o.length?[{texture:u}]:[{texture:o[0].texture===u?this.resource.color_b:u}]}}return t},i.resetClearActions=function(){var e=this.renderPasses.length>1?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;this.clearAction.stencilAction=e,this.clearAction.depthAction=e,this.clearAction.colorAction=e,this.keepColorBuffer&&(this.clearAction.colorAction=t.TextureLoadAction.whatever)},i.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach(function(t){return t.initialize(e.renderer)}),this._renderPasses=t.slice()},i.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},i.createResource=function(){var e=this.renderer.engine;if(!this.resource){var i,r=e.gpuCapability,n=r.detail,s=r.level,a=this.renderer.getWidth(),o=this.renderer.getHeight(),u=2===s?iR.LINEAR:iR.NEAREST,l=i2.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iR.RGBA,name:"frame_a",minFilter:u,magFilter:u}),h=i2.create(e,{sourceType:t.TextureSourceType.framebuffer,format:iR.RGBA,data:{width:a,height:o},minFilter:u,magFilter:u,name:"frame_b"}),c=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new nn(this.renderer,{depthStencilAttachment:{storageType:c},attachments:[{texture:l}]}).initialize(this.renderer),d=new n_(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,colorAction:t.TextureLoadAction.clear},meshOrder:t.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(i=f.getDepthAttachment())?void 0:i.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:h,finalCopyRP:d,depthStencil:f.depthAttachment,resRP:f}}},i.createCopyMesh=function(t){var e=this.renderer.engine,i=r9.create(e,{name:rJ,mode:iR.TRIANGLE_STRIP,attributes:{aPos:{type:iR.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),r=r2(e.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(r);var n=rn.create(e,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:rJ,shader:r});return n.blending=!1,n.depthTest=!1,n.culling=!1,(null==t?void 0:t.blend)&&(n.blending=!0,n.blendFunction=[iR.SRC_ALPHA,iR.ONE_MINUS_SRC_ALPHA,iR.SRC_ALPHA,iR.ONE_MINUS_SRC_ALPHA]),ne.create(e,{name:rJ,geometry:i,material:n,priority:0})},i.removeRenderPass=function(t){eh(this._renderPasses,t)},eB(e,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function nC(t){return t?new eQ(t.getWidth(),t.getHeight()):new eQ}var n_=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.configure=function(t){this.prePassTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",nC(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(nn),nR=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},nO=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return eB(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),nw="function"==typeof WebGL2RenderingContext,nM=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=nw&&r(t,WebGL2RenderingContext)?2:1,n=2===i,s=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),o=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=n?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),n&&!o&&(o=nI(t,t.HALF_FLOAT)),n&&!u&&(u=nI(t,t.FLOAT)),this.internalFormatDepth16=n?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=n?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var l=n||t.getExtension("OES_texture_float")?t.FLOAT:0,h=n?WebGL2RenderingContext.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,c={floatTexture:l,halfFloatTexture:h,maxSample:n?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:n?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0,halfFloatLinear:o,floatLinear:u,maxTextureAnisotropy:s?t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:n||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:n||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:n||!!this.drawBufferExtension,asyncShaderCompile:!!t.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:n||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:n||!!a,writableFragDepth:n||!!t.getExtension("EXT_frag_depth")};this.detail=c,s&&(this.textureMaxAnisotropyExt=s.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var s=this.drawBufferExtension;if(1===this.level&&!s&&i>0)throw Error("Draw multiple color buffers not available.");var a=s?s["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];a?t.framebufferTexture2D(e,a,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1===this.level&&!i){if(!(e.length>1))return;throw Error("Draw buffers not available.")}var r=e.map(function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE});i?i.drawBuffersWEBGL(r):t.drawBuffers(r)},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function nI(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}t.COMPRESSED_TEXTURE=void 0,(ts=t.COMPRESSED_TEXTURE||(t.COMPRESSED_TEXTURE={}))[ts.NONE=0]="NONE",ts[ts.PVRTC=1]="PVRTC",ts[ts.ASTC=2]="ASTC",t.FilterMode=void 0,(ta=t.FilterMode||(t.FilterMode={}))[ta.Nearest=0]="Nearest",ta[ta.Linear=1]="Linear",t.RenderTextureFormat=void 0,(to=t.RenderTextureFormat||(t.RenderTextureFormat={}))[to.RGBA32=0]="RGBA32",to[to.RGBAHalf=1]="RGBAHalf";var nL=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},eB(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),nP=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,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i){},e.getTemporaryRT=function(t,e,i,r,n,s){return null},e.dispose=function(t){},t}(),nF=1,nV=function(){function e(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),s=this.createGeometry();this.mesh=this.createMesh(s,n),this.updateMesh()}var i=e.prototype;return i.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new eJ,n=new e$,s=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,s),e.x=s.x,e.y=s.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},i.createMaterial=function(e){var i,r=[["ENV_EDITOR",(null==(i=this.engine.renderer)?void 0:i.env)===ib]],n=rW(this.color).getValue(0),s={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",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=rn.create(this.engine,s);return a.depthTest=!1,a.setVector4("uPos",new im(0,0,0,0)),a.setVector2("uSize",new eQ(1,1)),a.setVector4("uColor",new im(n[0]/255,n[1]/255,n[2]/255,n[3])),a.setQuaternion("uQuat",new e$(0,0,0,0)),a},i.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return r9.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:iR.LINES,maxVertex:4})},i.createMesh=function(t,e){return ne.create(this.engine,{name:"Interact_preview"+nF++,priority:0,worldMatrix:e0.fromIdentity(),geometry:t,material:e})},e}();function nN(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}function nD(e){return e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void 0}function nz(t){var e=t.renderer,i=e.blending,r=e.side,n=e.occlusion,s=e.mask,a=e.maskMode,o=e.order,u=t.cachePrefix||"-";return{side:r,occlusion:n,blending:i,mask:s,maskMode:a,cachePrefix:u,cacheId:u+"."+ +r+"+"+ +n+"+"+ +i+"+"+o+"+"+a+"."+s}}function nU(e,i){var r=null!=i?i:{},n=r.env,s=r.wireframe,a=[["ENV_EDITOR",(void 0===n?"":n)===ib]];return{fragment:s?ns:no,vertex:na,glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,macros:a,shared:!0}}function nk(t,e){return t.cachePrefix+"_effects_sprite_"+e}function nB(t,e,i,r){var n=t.wireframe,s=nU(i,{wireframe:n,env:r});return s.shared=!0,n||(s.cacheId=nk(t,e)),s}t.InteractComponent=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.getHitTestParams=function(e){if(t.clickable){var i=t.item.props.content.options.behavior,r=t.getBoundingBox();if(r)return{type:r.type,triangles:r.area,behavior:i}}},t}eX(i,e);var r=i.prototype;return r.start=function(){var t=this,e=this.item.props.content.options,i=this.item.engine.renderer.env,r=this.item.composition,n=this.interactData.options,s=n.type,a=n.showPreview;if(s===tE.CLICK&&(this.clickable=!0,a&&i===ib)){var o=this.item.composition.getRendererOptions();this.previewContent=new nV(this.item.props.content,o,this.transform,this.engine)}r.addInteractiveItem(this.item,e.type),this.item.onEnd=function(){return r.removeInteractiveItem(t.item,e.type)},e.type===tE.DRAG&&(i!==ib||e.enableInEditor)&&r.event&&this.beginDragTarget(e,r.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.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,nN(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){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()}},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if(t&&t.cameraParam&&this.item.composition){var i=this.item.props.content.options,r=t.cameraParam,n=r.position,s=r.fov,a=e.dy,o=e.dx*e.width/e.height,u=n[2],l=Math.tan(s*Math.PI/180/2)*Math.abs(u),h=n[0]-o*l,c=n[1]-a*l;if(i.dxRange){var f,d=i.dxRange,p=d[0],m=d[1];(h=eK(h,p,m))!==p&&h!==m&&p!==m&&(null==(f=e.origin)||f.preventDefault())}if(i.dyRange){var v,y=i.dyRange,g=y[0],x=y[1];(c=eK(c,g,x))!==g&&c!==x&&g!==x&&(null==(v=e.origin)||v.preventDefault())}this.item.composition.camera.position=new eJ(h,c,u)}},r.beginDragTarget=function(t,e){var r,n=this;if("camera"===t.target){var s={touchstart:function(t){n.dragEvent=null,n.bouncingArg=null;var e,i=null==(e=n.item.composition)?void 0:e.camera;r={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}},touchmove:function(t){n.handleDragMove(r,t),n.bouncingArg=t},touchend:function(t){var e=n.bouncingArg;!nN(e,3)&&e&&(e.vx*=5,e.vy*=5,n.dragEvent=iz({},r)),r=null}};Object.keys(s).forEach(function(t){e.addEventListener(t,s[t])}),s.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(i).endDragTarget=function(){Object.keys(s).forEach(function(t){e.removeEventListener(t,s[t])})}}},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),i=ry(eJ.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.interactData=t},i}(ir),t.InteractComponent=n([e6(tZ.InteractComponent)],t.InteractComponent),t.maxSpriteMeshItemCount=8;var nG={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},nX=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.name="sprite",t}return eX(i,e),i.precompile=function(e,i,r){var n=i.getShaderLibrary(),s=i.engine.gpuCapability,a=s.level,o=s.detail,u=(null!=r?r:{}).env;return!n.shaderResults[nk(nG,2)]&&(n.addShader(nB(nG,2,1,u)),n.addShader(nB(nG,t.maxSpriteMeshItemCount,1,u)),o.writableFragDepth&&n.addShader(r2(a,!0))),Promise.resolve()},i}(is),nH=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=eY(this.playables);!(e=i()).done;){var r=e.value;this.updatePlayableTime(r,t)}for(var n,s=eY(this.playableOutputs);!(n=s()).done;)n.value.context.deltaTime=t;for(var a,o=eY(this.playableOutputs);!(a=o()).done;){var u=a.value;this.prepareFrameWithRoot(u)}for(var l,h=eY(this.playableOutputs);!(l=h()).done;){var c=l.value;this.processFrameWithRoot(c)}},e.connect=function(t,e,i,r){i.connectInput(r,t,e)},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrameRecursive(t.context,t.getSourceOutputPort()),t.processFrame()},e.prepareFrameWithRoot=function(t){t.sourcePlayable.prepareFrameRecursive(t.context,t.getSourceOutputPort()),t.prepareFrame()},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&(t.overrideTimeNextEvaluation?t.overrideTimeNextEvaluation=!1:t.setTime(t.getTime()+e))},t}(),nY=function(){function t(t,e){void 0===e&&(e=0),this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.overrideTimeNextEvaluation=!1,this.destroyed=!1,this.inputs=[],this.inputOuputPorts=[],this.inputWeight=[],this.outputs=[],this.playState=0,this.traversalMode=0,t.addPlayable(this),this.inputs=Array(e),this.inputOuputPorts=Array(e),this.inputWeight=Array(e)}var e=t.prototype;return e.play=function(){switch(this.playState){case 0:break;case 1:this.playState=0,this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1}},e.pause=function(){0===this.playState&&(this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1)},e.connectInput=function(t,e,i,r){void 0===r&&(r=1),this.setInput(e,t),this.setInputWeight(t,r),e.setOutput(this,i),this.inputOuputPorts.length<t+1&&(this.inputOuputPorts.length=t+1),this.inputOuputPorts[t]=i},e.addInput=function(t,e,i){void 0===i&&(i=1),this.connectInput(this.getInputCount(),t,e,i)},e.getInputCount=function(){return this.inputs.length},e.getInputs=function(){return this.inputs},e.getInput=function(t){return this.inputs[t]},e.getOutputCount=function(){return this.outputs.length},e.getOutputs=function(){return this.outputs},e.getOutput=function(t){return this.outputs[t]},e.getInputWeight=function(t){return this.inputWeight[t]},e.setInputWeight=function(e,i){if(r(e,t)){for(var n=0;n<this.inputs.length;n++)if(this.inputs[n]===e){this.inputWeight[n]=i;return}}else this.inputWeight.length<e+1&&(this.inputWeight.length=e+1),this.inputWeight[e]=i},e.setTime=function(t){this.time=t,this.overrideTimeNextEvaluation=!0},e.getTime=function(){return this.time},e.getPlayState=function(){return this.playState},e.setTraversalMode=function(t){this.traversalMode=t},e.getTraversalMode=function(){return this.traversalMode},e.onPlayablePlay=function(t){},e.onPlayablePause=function(t){},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},e.prepareFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState)switch(this.onPlayablePlayFlag&&(this.onPlayablePlay(t),this.onPlayablePlayFlag=!1),this.onPlayablePauseFlag&&(this.onPlayablePause(t),this.onPlayablePauseFlag=!1),0===e&&this.prepareFrame(t),this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).prepareFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).prepareFrameRecursive(t,this.inputOuputPorts[e])}},e.processFrameRecursive=function(t,e){if(!this.destroyed&&0===this.playState){switch(this.getTraversalMode()){case 0:for(var i=0;i<this.getInputCount();i++)this.getInput(i).processFrameRecursive(t,this.inputOuputPorts[i]);break;case 1:this.getInput(e).processFrameRecursive(t,this.inputOuputPorts[e])}this.processFrame(t)}},e.setOutput=function(t,e){this.outputs.length<e+1&&(this.outputs.length=e+1),this.outputs[e]=t},e.setInput=function(t,e){this.inputs.length<e+1&&(this.inputs.length=e+1),this.inputs[e]=t},t}(),nW=function(){function t(){this.sourceOutputPort=0,this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayeble=function(t,e){void 0===e&&(e=0),this.sourcePlayable=t,this.sourceOutputPort=e},e.getSourceOutputPort=function(){return this.sourceOutputPort},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),nj=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(e7);(tu=t4||(t4={}))[tu.Playing=0]="Playing",tu[tu.Paused=1]="Paused",(tl=t5||(t5={}))[tl.Mix=0]="Mix",tl[tl.Passthrough=1]="Passthrough";var nZ=[[0,0,1,1,void 0]],nq=[1,1,1,1],nK=0,nQ=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}eX(i,e);var n=i.prototype;return n.processFrame=function(e){var i,n=e.output.getUserData();if(r(n,t.VFXItem)){this.spriteMaterial||(this.spriteMaterial=n.getComponent(t.SpriteComponent).material);var s=rc(nq,1),a=this.time/n.duration,o=this.opacityOverLifetime,u=this.colorOverLifetime;u&&(s=ed(u,a,!0),i=!0),o&&(s[3]*=o.getValue(a),i=!0),i&&(rd(this.renderColor,s,this.startColor),this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor))}},n.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;return i&&(this.opacityOverLifetime=rW(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===tI.GRADIENT_COLOR&&(this.colorOverLifetime=ep(i.color[1]))),this.startColor=t.startColor||[1,1,1,1],this},i}(nY);t.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new nQ(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(nj),t.SpriteColorPlayableAsset=n([e6("SpriteColorPlayableAsset")],t.SpriteColorPlayableAsset),t.SpriteComponent=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).frameAnimationTime=0,r.color=[1,1,1,1],r.visible=!0,r.getHitTestParams=function(t){var e=r.interaction;if(t||e){var i,n=r.getBoundingBox();if(n)return{behavior:(null==(i=r.interaction)?void 0:i.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:r.renderer.side===ty.FRONT}}},i&&r.fromData(i),r}eX(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){this.color=t,this.material.setVector4("_Color",new im().setFromArray(t))},r.setTexture=function(t){this.renderer.texture=t,this.material.setTexture("uSampler0",t)},r.render=function(t){if(this.getVisible()){var e=this.material,i=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),t.drawGeometry(i,e)}},r.start=function(){this.item.getHitTestParams=this.getHitTestParams},r.update=function(t){this.frameAnimationTime+=t/1e3;var e=this.frameAnimationTime,i=this.item.duration,r=this.textureSheetAnimation;if(r){var n,s,a,o,u=r.total||r.row*r.col,l=0,h=0,c=1,f=1;if(this.splits){var d=this.splits[0];n=d[4],l=d[0],h=d[1],n?(c=d[3],f=d[2]):(c=d[2],f=d[3])}if(n?(s=1/r.row*c,a=1/r.col*f):(s=1/r.col*c,a=1/r.row*f),r.animate){var p=Math.round(Math.min(Math.max(e/i,0),1)*(u-1)),m=Math.floor(p/r.col),v=p-m*r.col;o=n?[s*m,a*(r.col-v)]:[s*v,a*(1+m)]}else o=[0,a];this.material.getVector4("_TexOffset").setFromArray([l+o[0],f+h-o[1],s,a])}},r.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},r.getItemInitData=function(t,e,i,r){var n=t.geoData;n||(n=t.geoData=this.getItemGeometryData(t,e));var s=n.index,a=s.length,o=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new s.constructor(a);if(!this.wireframe)for(var u=0;u<a;u++)o[u]=i+s[u];return{atlasOffset:n.atlasOffset,index:o}},r.setItem=function(){var e=[],i=this.renderer.texture;i&&el(e,i);var r=(i=this.renderer.texture)?e.indexOf(i):-1,n=this.getItemInitData(this,0,0,r),s=this.renderer,a=this.material.getVector4("_TexParams");a.x=s.occlusion?+s.transparentOcclusion:1,a.y=+this.preMultiAlpha,a.z=s.renderMode;var o={atlasOffset:new Float32Array(n.atlasOffset.length),index:new Uint16Array(n.index.length)};o.atlasOffset.set(n.atlasOffset),o.index.set(n.index);var u=this.material,l=this.geometry,h=o.index;l.setIndexData(h),l.setAttributeData("atlasOffset",o.atlasOffset),l.setDrawCount(n.index.length);for(var c=0;c<e.length;c++){var f=e[c];u.setTexture("uSampler"+c,f)}for(var d=this.emptyTexture,p=e.length;p<t.maxSpriteMeshItemCount;p++)u.setTexture("uSampler"+p,d)},r.createGeometry=function(t){var e=12*this.splits.length;return r9.create(this.engine,{attributes:{aPos:{type:iR.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:iR.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},r.createMaterial=function(t,e){var i=t.side,r=t.occlusion,n=t.blending,s=t.maskMode,a=t.mask,o={shader:nB(t,e,1)};this.preMultiAlpha=iL(n);var u=rn.create(this.engine,o),l={side:i,blending:!0,blendMode:n,mask:a,maskMode:s,depthTest:!0,depthMask:r};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,iV(u,l.blendMode),iD(u,l.maskMode),iN(u,l.side),u.hasUniform("_Color")||u.setVector4("_Color",new im(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new im),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new im),u},r.getItemGeometryData=function(t,e){var i=t.splits,r=t.renderer,n=t.textureSheetAnimation;if(r.shape){for(var s=r.shape,a=s.index,o=s.aPoint,u=new Float32Array(o),l=[],h=[],c=0;c<u.length;c+=6)u[c]*=1,u[c+1]*=1,h.push(o[c+2],o[c+3]),l.push(u[c],u[c+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(l)),{index:a,atlasOffset:h}}var f=[],d=[],p=2,m=2;1===i.length&&(p=1,m=1);for(var v=[],y=0;y<p;y++)for(var g=0;g<m;g++){var x=(2*g+y)*4,T=n?[0,0,1,1,i[0][4]]:i[2*g+y],E=T[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],b=((y+y+1)/p-1)/2,A=((g+g+1)/m-1)/2,S=T[0],C=T[1],_=T[4]?T[3]:T[2],R=T[4]?T[2]:T[3],O=[-.5/p+b,.5/m+A,-.5/p+b,-.5/m+A,.5/p+b,.5/m+A,.5/p+b,-.5/m+A];f.push(E[0]*_+S,E[1]*R+C,E[2]*_+S,E[3]*R+C,E[4]*_+S,E[5]*R+C,E[6]*_+S,E[7]*R+C),v.push(1*O[0],1*O[1],0,1*O[2],1*O[3],0,1*O[4],1*O[5],0,1*O[6],1*O[7],0),d.push(x,1+x,2+x,2+x,1+x,3+x)}return this.geometry.setAttributeData("aPos",new Float32Array(v)),{index:d,atlasOffset:f}},r.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},r.getBoundingBox=function(){if(this.item){var e=this.transform.getWorldMatrix(),i=ry(eJ.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return i.forEach(function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)}),{type:t.HitTestType.triangle,area:i}}},r.fromData=function(t){e.prototype.fromData.call(this,t);var i,r,n,s,a,o,u=t.interaction,l=t.options,h=t.listIndex,c=t.renderer;c||(c={}),this.interaction=u,this.renderer={renderMode:null!=(i=c.renderMode)?i:tS.BILLBOARD,blending:null!=(r=c.blending)?r:tv.ALPHA,texture:null!=(n=c.texture)?n:this.engine.emptyTexture,occlusion:!!c.occlusion,transparentOcclusion:!!c.transparentOcclusion||c.maskMode===tg.MASK,side:null!=(s=c.side)?s:ty.DOUBLE,shape:c.shape,mask:null!=(a=c.mask)?a:0,maskMode:null!=(o=c.maskMode)?o:tg.NONE,order:void 0===h?0:h},this.emptyTexture=this.engine.emptyTexture,this.splits=t.splits||nZ,this.textureSheetAnimation=t.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=nz(this);var f=this.createGeometry(iR.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=e0.fromIdentity(),this.material=d,this.geometry=f,this.name="MSprite"+nK++;var p=l.startColor||[1,1,1,1];this.material.setVector4("_Color",new im().setFromArray(p)),this.material.setVector4("_TexOffset",new im().setFromArray([0,0,1,1])),this.setItem()},r.toData=function(){e.prototype.toData.call(this)},i}(ir),t.SpriteComponent=n([e6(tZ.SpriteComponent)],t.SpriteComponent);var nJ="lookup_texture",n$="offscreen_canvas",n0={},n1=new e$,n2=1,n3=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new eJ(0,0,0),this.quat=new e$(0,0,0,1),this.rotation=new e1(0,0,0),this.scale=new eJ(1,1,1),this.anchor=new eJ(0,0,0),this.size=new eQ(1,1),this.children=[],this.worldMatrix=e0.fromIdentity(),this.localMatrix=e0.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new eJ(0,0,0),quat:new e$(0,0,0,1),scale:new eJ(1,1,1)},this.name="transform_"+n2++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){(this.position.x!==t||this.position.y!==e||this.position.z!==i)&&(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){(0!==t||0!==e||0!==i)&&(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==i)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==i||this.quat.w!==r)&&(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==i)&&(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){(this.size.x!==t||this.size.y!==e)&&(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){(this.anchor.x!==t||this.anchor.y!==e)&&(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,n=t.rotation,s=t.scale,a=t.size,o=t.quat,u=t.name,l=t.anchor;if(u&&(this.name=u),i&&(r(i,eJ)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),o)r(o,e$)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(n){var h=e?-1:1;r(n,e1)?this.setRotation(n.x*h,n.y*h,n.z*h):this.setRotation(n[0]*h,n[1]*h,n[2]*h)}s&&(r(s,eJ)?this.setScale(s.x,s.y,s.z):this.setScale(s[0],s[1],s[2])),a&&this.setSize(a.x,a.y),l&&(r(l,eQ)?this.setAnchor(l.x,l.y):this.setAnchor(l[0],l[1]))},e.addChild=function(t){el(this.children,t)},e.removeChild=function(t){eh(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new e1)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;return this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1),this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new e1)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={position:new eJ().copyFrom(t.position),rotation:new e1(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:new eJ().copyFrom(t.scale)};this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach(function(t){t.parentMatrixDirty=!0})},t.getRotation=function(t,e){var i=n1.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},eB(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}(),n4=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=n5(this.arc,this.arcMode,t)*eW,i=new eJ(Math.cos(e)*this.radius,Math.sin(e)*this.radius,0),r=Math.tan(this.angle*eW),n=i.clone().multiply(r);return n.z+=1,{position:i.multiply(eV(0,1)),direction:n.normalize()}},t}();function n5(t,e,i){if(e===tN.RANDOM)t=eV(0,t);else if(e===tN.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===tN.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),s=n-Math.floor(n);t*=Math.floor(n)%2?1-s:s}else e===tN.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var n6=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=n5(this.arc,this.arcMode,t)*eW,i=new eJ(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),n8=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=eV(-this._d,this._d),i=eV(-this._h,this._h);return{direction:new eJ(0,0,1),position:new eJ(e,i,0)}},t}(),n9=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=n5(this.arc,this.arcMode,t)*eW,i=new eJ(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,s=Math.atan2(n,r),a=Math.tan(e),o=new eJ;return e<s?o.set(r,r*a,0):e>=s&&e<Math.PI-s?o.set(n/a,n,0):e<Math.PI+s?o.set(-r,-r*a,0):e<2*Math.PI-s?o.set(-n/a,-n,0):o.set(r,r*a,0),{direction:i,position:o}},t}(),n7=function(){function t(t){this._d=(t.width||1)/2,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===tN.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):eV(0,1);return{direction:new eJ(0,1,0),position:new eJ(this._d*(e-.5),0,0)}},t}(),st=new e0,se=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=eV(0,2*Math.PI),n=n5(this.arc,this.arcMode,t)*eW,s=st.setFromRotationZ(n),a=new eJ(Math.cos(r),Math.sin(r),0),o=new eJ(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:s.transformNormal(a),position:s.transformPoint(o)}},t}(),si=new e0,sr=function(){function t(t){var e=this;Object.keys(t).forEach(function(i){e[i]=t[i]})}var e=t.prototype;return e.getHorizontalAngle=function(){return eV(-90,90)},e.generate=function(t){var e=n5(this.arc,this.arcMode,t)*eW,i=this.getHorizontalAngle()*eW,r=this.radius,n=new eJ(Math.cos(i),0,Math.sin(i)),s=si.setFromRotationZ(e).transformNormal(n);return{position:s.clone().multiply(r),direction:s}},t}(),sn=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.getHorizontalAngle=function(){return eV(0,90)},e}(sr),ss=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=eK(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=Math.floor(n5(e.length/2-1,this.arcMode,t)),r=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,n=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,s=new eJ(r,n,0);return{position:new eJ(r*this.width,n*this.height,0),direction:s.normalize()}},t}(),sa=function(){function t(){}return t.prototype.generate=function(){return{position:new eJ,direction:new eJ}},t}(),so=((t6={})[tx.NONE]=sa,t6[tx.CONE]=n4,t6[tx.SPHERE]=sr,t6[tx.HEMISPHERE]=sn,t6[tx.CIRCLE]=n6,t6[tx.DONUT]=se,t6[tx.RECTANGLE]=n8,t6[tx.EDGE]=n7,t6[tx.RECTANGLE_EDGE]=n9,t6[tx.TEXTURE]=ss,t6);function su(t){if(!t)return new sa;var e=iz({radius:1,arc:360,angle:0,arcMode:tN.RANDOM},t),i=t.type,r=so[i];if(!r)throw Error("Invalid shape: "+i+".");var n=new r(e);if(i!==tx.NONE){var s=t.alignSpeedDirection,a=t.upDirection;n.alignSpeedDirection=s,n.upDirection=eJ.fromArray(void 0===a?[0,0,1]:a).normalize()}return n}function sl(t,e,i,r,n){var s,a;if(n===function(t,e,i,r){for(var n=0,s=e,a=i-r;s<i;s+=r)n+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return n}(t,e,i,r)>0)for(s=e;s<i;s+=r)a=sE(s,t[s],t[s+1],a);else for(s=i-r;s>=e;s-=r)a=sE(s,t[s],t[s+1],a);return a&&sm(a,a.next)&&(sb(a),a=a.next),a}function sh(t,e){if(!t)return t;e||(e=t);var i,r=t;do if(i=!1,!r.steiner&&(sm(r,r.next)||0===sp(r.prev,r,r.next))){if(sb(r),(r=e=r.prev)===r.next)break;i=!0}else r=r.next;while(i||r!==e);return e}function sc(t,e){return t.x-e.x}function sf(t,e,i,r,n){return(t=((t=((t=((t=((t=32767*(t-i)*n)|t<<8)&16711935)|t<<4)&252645135)|t<<2)&858993459)|t<<1)&1431655765)|(e=((e=((e=((e=((e=32767*(e-r)*n)|e<<8)&16711935)|e<<4)&252645135)|e<<2)&858993459)|e<<1)&1431655765)<<1}function sd(t,e,i,r,n,s,a,o){return(n-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(r-o)-(i-a)*(e-o)>=0&&(i-a)*(s-o)-(n-a)*(r-o)>=0}function sp(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function sm(t,e){return t.x===e.x&&t.y===e.y}function sv(t,e,i,r){var n=sg(sp(t,e,i)),s=sg(sp(t,e,r)),a=sg(sp(i,r,t)),o=sg(sp(i,r,e));return!!(n!==s&&a!==o||0===n&&sy(t,i,e)||0===s&&sy(t,r,e)||0===a&&sy(i,t,r)||0===o&&sy(i,e,r))}function sy(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function sg(t){return t>0?1:t<0?-1:0}function sx(t,e){return 0>sp(t.prev,t,t.next)?sp(t,e,t.next)>=0&&sp(t,t.prev,e)>=0:0>sp(t,e,t.prev)||0>sp(t,t.next,e)}function sT(t,e){var i=new sA(t.i,t.x,t.y),r=new sA(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,s.next=r,r.prev=s,r}function sE(t,e,i,r){var n=new sA(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function sb(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 sA(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var sS=0;function sC(t,e,i,r){i=i||2,sS=r||0;var n,s,a,o,u,l,h,c=e&&e.length,f=c?e[0]*i:t.length,d=sl(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,s,a,o,u,l=[];for(n=0,s=e.length;n<s;n++)a=e[n]*r,o=n<s-1?e[n+1]*r:t.length,(u=sl(t,a,o,r,!1))===u.next&&(u.steiner=!0),l.push(function(t){var e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}(u));for(l.sort(sc),n=0;n<l.length;n++)(function(t,e){if(e=function(t,e){var i,r,n,s=e,a=t.x,o=t.y,u=-1/0;do{if(o<=s.y&&o>=s.next.y&&s.next.y!==s.y){var l=s.x+(o-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(l<=a&&l>u){if(u=l,l===a){if(o===s.y)return s;if(o===s.next.y)return s.next}n=s.x<s.next.x?s:s.next}}s=s.next}while(s!==e);if(!n)return null;if(a===u)return n;var h,c=n,f=n.x,d=n.y,p=1/0;s=n;do a>=s.x&&s.x>=f&&a!==s.x&&sd(o<d?a:u,o,f,d,o<d?u:a,o,s.x,s.y)&&(h=Math.abs(o-s.y)/(a-s.x),sx(s,t)&&(h<p||h===p&&(s.x>n.x||s.x===n.x&&(i=n,r=s,0>sp(i.prev,i,r.prev)&&0>sp(r.next,i,i.next))))&&(n=s,p=h)),s=s.next;while(s!==c);return n}(t,e)){var i=sT(e,t);sh(e,e.next),sh(i,i.next)}})(l[n],i),i=sh(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=a=t[0],s=o=t[1];for(var m=i;m<f;m+=i)u=t[m],l=t[m+1],u<n&&(n=u),l<s&&(s=l),u>a&&(a=u),l>o&&(o=l);h=0!==(h=Math.max(a-n,o-s))?1/h:0}return function t(e,i,r,n,s,a,o){if(e){!o&&a&&function(t,e,i,r){var n=t;do null===n.z&&(n.z=sf(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,s,a,o,u,l=1;do{for(i=t,t=null,s=null,a=0;i;){for(a++,r=i,o=0,e=0;e<l&&(o++,r=r.nextZ);e++);for(u=l;o>0||u>0&&r;)0!==o&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,o--):(n=r,r=r.nextZ,u--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=r}s.nextZ=null,l*=2}while(a>1)}(n)}(e,n,s,a);for(var u,l,h=e;e.prev!==e.next;){if(u=e.prev,l=e.next,a?function(t,e,i,r){var n=t.prev,s=t.next;if(sp(n,t,s)>=0)return!1;for(var a=n.x<t.x?n.x<s.x?n.x:s.x:t.x<s.x?t.x:s.x,o=n.y<t.y?n.y<s.y?n.y:s.y:t.y<s.y?t.y:s.y,u=n.x>t.x?n.x>s.x?n.x:s.x:t.x>s.x?t.x:s.x,l=n.y>t.y?n.y>s.y?n.y:s.y:t.y>s.y?t.y:s.y,h=sf(a,o,e,i,r),c=sf(u,l,e,i,r),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=c;){if(f!==t.prev&&f!==t.next&&sd(n.x,n.y,t.x,t.y,s.x,s.y,f.x,f.y)&&sp(f.prev,f,f.next)>=0||(f=f.prevZ,d!==t.prev&&d!==t.next&&sd(n.x,n.y,t.x,t.y,s.x,s.y,d.x,d.y)&&sp(d.prev,d,d.next)>=0))return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&sd(n.x,n.y,t.x,t.y,s.x,s.y,f.x,f.y)&&sp(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=c;){if(d!==t.prev&&d!==t.next&&sd(n.x,n.y,t.x,t.y,s.x,s.y,d.x,d.y)&&sp(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}(e,n,s,a):function(t){var e=t.prev,i=t.next;if(sp(e,t,i)>=0)return!1;for(var r=t.next.next;r!==t.prev;){if(sd(e.x,e.y,t.x,t.y,i.x,i.y,r.x,r.y)&&sp(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}(e)){i.push(u.i/r+sS),i.push(e.i/r+sS),i.push(l.i/r+sS),sb(e),e=l.next,h=l.next;continue}if((e=l)===h){o?1===o?t(e=function(t,e,i){var r=t;do{var n=r.prev,s=r.next.next;!sm(n,s)&&sv(n,r,r.next,s)&&sx(n,s)&&sx(s,n)&&(e.push(n.i/i+sS),e.push(r.i/i+sS),e.push(s.i/i+sS),sb(r),sb(r.next),r=t=s),r=r.next}while(r!==t);return sh(r)}(sh(e),i,r),i,r,n,s,a,2):2===o&&function(e,i,r,n,s,a){var o=e;do{for(var u,l,h=o.next.next;h!==o.prev;){if(o.i!==h.i&&(u=o,l=h,u.next.i!==l.i&&u.prev.i!==l.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&sv(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(u,l)&&(sx(u,l)&&sx(l,u)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do i.y>s!=i.next.y>s&&i.next.y!==i.y&&n<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next;while(i!==t);return r}(u,l)&&(sp(u.prev,u,l.prev)||sp(u,l.prev,l))||sm(u,l)&&sp(u.prev,u,u.next)>0&&sp(l.prev,l,l.next)>0))){var c=sT(o,h);o=sh(o,o.next),c=sh(c,c.next),t(o,i,r,n,s,a),t(c,i,r,n,s,a);return}h=h.next}o=o.next}while(o!==e)}(e,i,r,n,s,a):t(sh(e),i,r,n,s,a,1);break}}}}(d,p,i,n,s,h),p}function s_(t,e){for(var i,r,n=t.s,s=t.p,a=n[1],o=s[1],u=0,l=0;l<a.length;l++)u+=a[l].length-1;var h,c=new Float32Array(6*u),f=e.indexBase,d=e.uvTransform,p=0,m=0,v=0,y=1,g=1;d&&(m=d[0],v=d[1],y=(h=d[4])?d[3]:d[2],g=h?d[2]:d[3]);for(var x=[0,0],T=0===h?0:-Math.PI/2,E=0;E<a.length;E++)for(var b=a[E],A=o[E],S=o[E+1]||o[0],C=[0,0],_=0;_<b.length-1;_++)(function(t,e,i,r,n,s,a,o){var u=1-e,l=u*u*u,h=3*e*u*u,c=3*e*e*u,f=e*e*e;t[0]=l*i[0]+h*n+c*a+f*r[0],t[1]=l*i[1]+h*s+c*o+f*r[1]})(C,b[_],A,S,A[4],A[5],S[2],S[3]),i=C[0],r=C[1],c[p++]=i/2,c[p++]=r/2,d?(x[0]=i,x[1]=r,sO(x,x,T),c[p++]=m+(x[0]+1)/2*y,c[p++]=v+(x[1]+1)/2*g):(c[p++]=(i+1)/2,c[p++]=(r+1)/2),p+=2;var R=sC(Array.from(c),null,6,void 0===f?0:f);return{aPoint:c,index:new Uint16Array(R)}}function sR(t,e){for(var i,r=[],n=(i=[],t.gs?t.gs.forEach(function(t){i.push({p:[tI.SHAPE_POINTS,t.p],s:[tI.SHAPE_SPLITS,t.s]})}):t.g?i.push({p:[tI.SHAPE_POINTS,t.g.p],s:[tI.SHAPE_SPLITS,t.g.s]}):i.push(t),i),s=0,a=0,o=0,u=0;u<n.length;u++){var l=s_(n[u],{indexBase:s,uvTransform:e});s+=l.aPoint.length/5,r.push(l),a+=l.aPoint.length,o+=l.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(a),c=new Uint16Array(o),f=0,d=0,p=0;f<r[f];f++){var m=r[f];h.set(m.aPoint,d),d+=m.aPoint.length,c.set(m.index,p),p+=m.index.length}return{aPoint:h,index:c}}function sO(t,e,i){var r=Math.cos(i),n=Math.sin(i),s=e[0],a=e[1];return t[0]=r*s+n*a,t[1]=-n*s+r*a,t}var sw=function(){function t(t){var e=t.time,i=t.interval,n=t.count,s=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=r(n,rP)?n:rW(n),this.cycles=+s||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t(this)},t}(),sM=function(t){this.content=t},sI=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do if(t(e.content))return e;while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new sM(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(0>=this.sort(i.content,e.content)))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new sM(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(0>=this.sort(e.content,i.content)))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,s=t.next;n.next=s,s&&(s.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do t.call(e||this,i.content,r++);while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do t.call(e||this,i.content,r--);while(i=i.pre)},t}(),sL=new eJ,sP=new eJ,sF=function(){function e(e,i){this.pointStart=[];var n,s=i.colorOverLifetime,a=i.colorOverTrail,o=i.maxTrailCount,u=i.opacityOverLifetime,l=void 0===u?rW(1):u,h=i.widthOverTrail,c=i.name,f=i.occlusion,d=i.blending,p=i.maskMode,m=i.textureMap,v=i.texture,y=i.transparentOcclusion,g=i.minimumVertexDistance,x=i.lifetime,T=i.matrix,E=e.gpuCapability,b=E.detail,A=E.level,S=Math.max(i.pointCountPerTrail,2),C=rK(),_=b.maxVertexTextures>0,R=(null!=(n=e.renderer)?n:{}).env,O={},w=[["ENABLE_VERTEX_TEXTURE",_],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",R===ib]],M=o>64,I=0;s&&(w.push(["COLOR_OVER_LIFETIME",!0]),I|=1,O.uColorOverLifetime=i2.createWithData(e,eE(s))),a&&(w.push(["COLOR_OVER_TRAIL",!0]),I|=4,O.uColorOverTrail=i2.createWithData(e,eE(a))),M?(w.push(["ATTR_TRAIL_START",1]),I|=8):O.uTrailStart=new Float32Array(o),O.uOpacityOverLifetimeValue=l.toUniform(C);var L=h.toUniform(C);w.push(["VERT_CURVE_VALUE_COUNT",C.index],["VERT_MAX_KEY_FRAME_COUNT",C.max]),O.uVCurveValues=rP.getAllData(C);var P={shader:{vertex:nh,fragment:nu,macros:w,glslVersion:1===A?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+I+"+"+C.index+"+"+C.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},F=S*o*2,V=(S-1)*o,N=Float32Array.BYTES_PER_ELEMENT,D=12*N,z={attributes:{aColor:{size:4,stride:D,data:new Float32Array(12*F)},aSeed:{size:1,stride:D,offset:4*N,dataSource:"aColor"},aInfo:{size:3,stride:D,offset:5*N,dataSource:"aColor"},aPos:{size:4,stride:D,offset:8*N,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(F)},aDir:{size:3,data:new Float32Array(3*F)}},indices:{data:new Uint16Array(6*F)},drawCount:6*V,name:"trail#"+c,bufferUsage:iR.DYNAMIC_DRAW};if(M)z.attributes.aTrailStart={size:1,data:new Float32Array(F)};else{var U=new Float32Array(F);z.attributes.aTrailStartIndex={size:1,data:U};for(var k=0;k<o;k++)for(var B=2*S,G=k*B,X=0;X<B;X++)U[G+X]=k}var H=iL(d),Y=rn.create(e,P);Y.blending=!0,Y.depthMask=f,Y.depthTest=!0,iD(Y,p),iV(Y,d);var W=this.mesh=ne.create(e,{name:"MTrail_"+c,material:Y,geometry:r9.create(e,z)}),j=null!=v?v:i2.createWithData(e);Object.keys(O).map(function(t){var e=O[t];if(r(e,i2))Y.setTexture(t,e);else if("uTrailStart"===t)Y.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],n=0;n<e.length;n+=4){var s=new im(e[n],e[n+1],e[n+2],e[n+3]);i.push(s)}Y.setVector4Array(t,i)}else Y.setVector4(t,im.fromArray(e))}),Y.setFloat("uTime",0),Y.setVector4("uWidthOverTrail",im.fromArray(L)),Y.setVector2("uTexOffset",new eQ(0,0)),Y.setVector4("uTextureMap",im.fromArray(void 0===m?[0,0,1,1]:m)),Y.setVector4("uParams",new im(0,S-1,0,0)),Y.setTexture("uMaskTex",j),Y.setVector4("uColorParams",new im(v?1:0,+H,0,+(f&&!y))),this.maxTrailCount=o,this.pointCountPerTrail=S,this.checkVertexDistance=g>0,this.minimumVertexDistance=Math.pow(g||.001,2),this.useAttributeTrailStart=M,this.lifetime=x,T&&(this.mesh.worldMatrix=T),this.geometry=W.firstGeometry(),this.trailCursors=new Uint16Array(o)}var i=e.prototype;return i.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,s=this.geometry,a=n-1,o=r%n,u=(r-1)%n,l=(r-2)%n,h=this.getTrailPosition(t,u,sL);if(!(h&&this.checkVertexDistance&&(null==h?void 0:h.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+o,f=sz(h,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=new Float32Array(6);v.set(f,0),v.set(f,3),s.setAttributeSubData("aDir",6*c,v),s.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var y=i.color||[1,1,1,1],g=new Float32Array(24),x=e.toArray();if(g.set(y,0),g.set(p,4),g[7]=0,g.set(x,8),g[11]=.5*m,g.set(y,12),g.set(p,16),g[19]=1,g.set(x,20),g[23]=-.5*m,s.setAttributeSubData("aColor",24*c,g),u>=0){var T=new Float32Array(sz(this.getTrailPosition(t,l,sP),h,e)),E=(t*n+u)*6;s.setAttributeSubData("aDir",E,T),s.setAttributeSubData("aDir",E+3,T);var b=t*n*2,A=new Uint16Array([2*u+b,2*u+1+b,2*o+b,2*o+b,2*u+1+b,2*o+1+b]),S=(t*a+(r-1)%a)*6;s.setIndexSubData(S,A)}r=++this.trailCursors[t];var C=this.mesh.material,_=C.getVector4("uParams"),R=p[2];if(this.useAttributeTrailStart){for(var O=2*n,w=new Float32Array(O),M=0;M<O;M++)w[M]=R;s.setAttributeSubData("aTrailStart",t*w.length,w)}else{var I=C.getFloats("uTrailStart");void 0!=I&&(I[t]=R,C.setFloats("uTrailStart",I))}_&&(_.y=Math.max(_.y,r-1)-Math.max(0,r-n),C.setVector4("uParams",_))}},i.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=(t*r+e)*24+8,s=this.geometry.getAttributeData("aColor");return i.x=s[n],i.y=s[1+n],i.z=s[2+n],i}},i.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},i.minusTime=function(t){for(var e=this.geometry.getAttributeData("aTime"),i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},i.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=(this.pointCountPerTrail-1)*6,i=this.geometry.getIndexData();i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},i.getPointStartPos=function(t){return this.pointStart[t]},i.setPointStartPos=function(t,e){this.pointStart[t]=e},i.onUpdate=function(t){},eB(e,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),e}(),sV=new eJ,sN=new eJ,sD=new eJ;function sz(t,e,i){return t||i?(t?i?(sN.subtractVectors(e,t).normalize(),sN.subtractVectors(i,e),sD.copyFrom(sN).normalize(),sV.addVectors(sN,sD)):sV.subtractVectors(e,t):sV.subtractVectors(i,e),sV.normalize().toArray()):[0,0,0]}var sU=function(t){function e(e,i,r){(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new sJ(e,i)),r&&(n.trailMesh=new sF(e,r));var n,s=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(s.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=s,n}eX(e,t);var i=e.prototype;return i.start=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=eY(this.meshes);!(t=e()).done;)t.value.start()},i.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new im(e,this.item.duration,0,0))},i.render=function(t){for(var e,i=eY(this.meshes);!(e=i()).done;)e.value.render(t)},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach(function(i){t.push(e[i])}),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach(function(e){t.push(i[e])})}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(ir);t.ParticleSystem=function(e){function i(i,r){var n;return(n=e.call(this,i)||this).destroyed=!1,n.getHitTestParams=function(e){var i=n.interaction;if(e||i)return{type:t.HitTestType.custom,collect:function(t){return n.raycast({radius:(null==i?void 0:i.radius)||.4,multiple:!!(null==i?void 0:i.multiple),removeParticle:(null==i?void 0:i.behavior)===tV.removeParticle,ray:t})}}},r&&n.fromData(r),n}eX(i,e);var n=i.prototype;return n.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===tI.CONSTANT_VEC3?e.add(r[1]):t=rW(r)),this.basicTransform={position:e,rotation:i,path:t};var n=this.transform.parentTransform,s=e.clone();if(t&&s.add(t.getValue(0)),this.transform.setPosition(s.x,s.y,s.z),this.options.particleFollowParent&&n){var a=n.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},n.updateEmitterTransform=function(t){var e=this.transform.parentTransform,i=this.basicTransform,r=i.path,n=i.position.clone();if(r){var s=this.item.duration;n.add(r.getValue(t/s))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},n.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var s=r.first;r.removeNode(s),i=n[1]=s.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},n.setVisible=function(t){this.renderer.setVisible(t)},n.setOpacity=function(t){var e,i=this.renderer.particleMesh.mesh.material,r=this.renderer.particleMesh.mesh.geometry,n=(null==(e=i.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];i.setVector4("uOpacityOverLifetimeValue",new im(n[0],n[1],n[2],t));for(var s=r.getAttributeData("aColor")||[],a=0;a<s.length;a+=32)s[8*a+7]=t},n.setColor=function(t,e,i,r){var n,s=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,o=(null==(n=s.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];s.setVector4("uOpacityOverLifetimeValue",new im(o[0],o[1],o[2],r));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]=i,u[8*l+7]=r},n.setParentTransform=function(t){},n.getTextures=function(){return this.renderer.getTextures()},n.start=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},n.stop=function(){this.ended=!0,this.started=!1},n.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 sI(function(t,e){return t[0]-e[0]}),this.emission.bursts.forEach(function(t){return t.reset()}),this.frozen=!1},n.onUpdate=function(t){var e=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,r=this.options,n=this.loopStartTime,s=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var a=this.particleLink,o=(i-n)/this.item.duration,u=this.timePassed,l=!1,h=function(){e.trails&&!l&&(l=!0,a.forEach(function(t){var i=t[0],r=t[1],n=t[2],s=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,o,s,n)}))};if(this.ended){if(this.item.endBehavior!==tP.loop&&tP.destroy===this.item.endBehavior){var c=a.last;c&&c.content[0]<this.lastUpdate&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/s.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=p/m,y=r.maxCount;this.updateEmitterTransform(u);for(var g=function(){var t=a.first;return e.emissionStopped||a.length===y&&t&&t.content[0]-n>u},x=0;x<m&&x<y&&!g();x++){var T=this.createPoint(d);T.delay+=i+x*v,this.addParticle(T,y),this.lastEmitTime=u}for(var E=s.bursts,b=(null==E?void 0:E.length)-1,A=0;b>=0&&A<y&&!g();b--){var S=E[b],C=!S.disabled&&S.getGeneratorOptions(u,d);if(C){var _=[0,0,0],R=s.burstOffsets[b],O=R&&R[C.cycleIndex]||_;S.once&&this.removeBurst(b);for(var w=0;w<C.count&&A<y&&!g();w++){var M,I=this.initPoint(this.shape.generate({total:C.total,index:C.index,burstIndex:w,burstCount:C.count}));I.delay+=i,A++,(M=I.transform).translate.apply(M,[].concat(O)),this.addParticle(I,y)}}}}else this.item.endBehavior===tP.loop?(h(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.lastUpdate-=f,s.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),this.item.endBehavior===tP.freeze&&(this.frozen=!0))}h()}},n.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}})}))},n.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!(t&&e))return i;for(var s=t.last,a=!1;!a;){var o=s.content[0],u=s.content[3];if(o>this.timePassed){var l=this.getPointPosition(u);i.push({center:l,size:u.transform.scale}),s.pre?s=s.pre:a=!0}++n>r&&(a=!0)}return i},n.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],s=new eJ,a=!1;if(r&&r.content)do{var o=r.content,u=o[0],l=o[1];o[2];var h=o[3];if(u>this.timePassed){var c=this.getPointPosition(h),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:c,radius:t.radius},s)),d&&(t.removeParticle&&(i.removeParticlePoint(l),this.clearPointTrail(l),e.removeNode(r),r.content=[0]),n.push(c),t.multiple||(a=!0))}else break}while((r=r.pre)&&!a);return n}},n.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},n.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var s=this.trails,a=this.getPointPosition(i),o=s.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),l=1,h=s.lifetime.getValue(e);if(s.sizeAffectsWidth&&(l*=u[0]),s.sizeAffectsLifetime&&(h*=u[0]),s.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&a.subtract(c)}n.addTrailPoint(t,a,{color:o,lifetime:h,size:l,time:r})}},n.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,s=t.gravity,a=this.options.forceTarget,o=this.lastUpdate-n,u=new eJ,l=eJ.fromArray(void 0===s?[]:s);e.assignWorldTRS(u);var h=rl(new eJ,this.options,l,o,r,u,i);if(a){var c=a.target||[0,0,0],f=a.curve.getValue(o/r),d=1-f;h.x=h.x*d+c[0]*f,h.y=h.y*d+c[1]*f,h.z=h.z*d+c[2]*f}return h},n.onEnd=function(t){},n.onIterate=function(t){},n.initPoint=function(t){var e,i,r,n,s,a,o=this.options,u=this.lifetime,l=this.shape,h=o.startSpeed.getValue(u),c=o.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),f=t.position;(null==(n=this.item.composition)?void 0:n.renderer.env)===ib&&(f.x/=this.item.composition.editorScaleRatio,f.y/=this.item.composition.editorScaleRatio);var d=new n3({position:c.transformPoint(f,new eJ),valid:!0}),p=t.direction;if(p=c.transformNormal(p,sk).normalize(),o.startTurbulence&&o.turbulence){for(var m=0;m<3;m++)sY.setElement(m,o.turbulence[m].getValue(u));sW.setFromVector3(sY.negate()),sZ.setFromEuler(sW).transformNormal(p).normalize()}l.alignSpeedDirection?(sH.copyFrom(p),this.upDirectionWorld||(l.upDirection?this.upDirectionWorld=l.upDirection.clone():this.upDirectionWorld=eJ.Z.clone(),c.transformNormal(this.upDirectionWorld)),sX.crossVectors(sH,this.upDirectionWorld).normalize(),sX.isZero()&&sX.set(1,0,0)):(sX.set(1,0,0),sH.set(0,1,0));var v=this.textureSheetAnimation;v&&v.animate&&((a=sj)[0]=v.animationDelay.getValue(u),a[1]=v.animationDuration.getValue(u),a[2]=v.cycles.getValue(u)),o.start3DRotation?sG.set(o.startRotationX.getValue(u),o.startRotationY.getValue(u),o.startRotationZ.getValue(u)):o.startRotation?sG.set(0,0,o.startRotation.getValue(u)):sG.set(0,0,0),d.setRotation(sG.x,sG.y,sG.z);var y=o.startColor.getValue(u);if(3===y.length&&(y[3]=1),o.start3DSize)sB.x=o.startSizeX.getValue(u),sB.y=o.startSizeY.getValue(u);else{var g=o.startSize.getValue(u),x=o.sizeAspect.getValue(u);sB.x=g,sB.y=0===x?0:g/x}var T=p.clone();if(T.multiply(h),!o.particleFollowParent){var E=new eJ;this.transform.assignWorldTRS(void 0,void 0,E),sB.x*=E.x,sB.y*=E.y}return(null==(s=this.item.composition)?void 0:s.renderer.env)===ib&&(sB.x/=this.item.composition.editorScaleRatio,sB.y/=this.item.composition.editorScaleRatio),d.setScale(sB.x,sB.y,1),{size:sB,vel:T,color:y,delay:o.startDelay.getValue(u),lifetime:o.startLifetime.getValue(u),uv:(i=Math.floor(Math.random()*(e=this.uvs).length),r=e[i],r),gravity:o.gravity,sprite:a,dirY:sH,dirX:sX,transform:d}},n.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&r(e,Array)){var n=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[n]=e,n}return -1},n.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},n.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))},n.stopParticleEmission=function(){this.emissionStopped=!0},n.resumeParticleEmission=function(){this.emissionStopped=!1},n.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:t.HitTestType.sphere,area:e}},n.fromData=function(t){e.prototype.fromData.call(this,t),this.props=t,this.destroyed=!1;var i,n,s,a,o,u,l,h,c,f,d,p,m=t.options,v=t.positionOverLifetime,y=void 0===v?{}:v,g=t.shape,x=null==y?void 0:y.gravityOverLifetime,T=rh(null==y?void 0:y.gravity),E=t.textureSheetAnimation,b=E?{animationDelay:rW(E.animationDelay||0),animationDuration:rW(E.animationDuration||1),cycles:rW(E.cycles||1),animate:E.animate,col:E.col,row:E.row,total:E.total||E.col*E.row}:void 0,A=!!(g&&g.turbulenceX||(null==g?void 0:g.turbulenceY)||(null==g?void 0:g.turbulenceZ));A&&(s=[rW(null!=(a=g.turbulenceX)?a:0),rW(null!=(o=g.turbulenceY)?o:0),rW(null!=(u=g.turbulenceZ)?u:0)]),this.name="ParticleSystem",this.shape=su(g),this.emission={rateOverTime:rW(t.emission.rateOverTime),burstOffsets:(i=null!=(l=t.emission.burstOffsets)?l:[],n={},Array.isArray(i)&&i.forEach(function(t){var e=r(t,Array),i=e?t[0]:t.index,s=n[i];s||(s=n[i]=[]),e?s.push(t.slice(1,4)):s.push([+t.x,+t.y,+t.z])}),n),bursts:(t.emission.bursts||[]).map(function(t){return new sw(t)})},this.textureSheetAnimation=b;var S=t.renderer||{},C={},_=t.rotationOverLifetime;_&&(C.asRotation=!!_.asRotation,C.z=_.z?rW(_.z):rW(0),_.separateAxes&&(C.x=_.x&&rW(_.x),C.y=_.y&&rW(_.y))),(null==y?void 0:y.forceTarget)&&(h={target:y.target||[0,0,0],curve:rW(y.forceCurve||[tI.LINE,[[0,0],[1,1]]])});var R={x:y.linearX&&rW(y.linearX||0),y:y.linearY&&rW(y.linearY||0),z:y.linearZ&&rW(y.linearZ||0),asMovement:y.asMovement},O={x:y.orbitalX&&rW(y.orbitalX),y:y.orbitalY&&rW(y.orbitalY),z:y.orbitalZ&&rW(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},w=t.sizeOverLifetime||{},M=t.colorOverLifetime,I=(null==w?void 0:w.separateAxes)?{separateAxes:!0,x:rW(w.x),y:rW(w.y)}:{separateAxes:!1,x:rW(("size"in w?w.size:w.x)||1)};S.anchor=S.anchor||[0,0];var L=eQ.fromArray(S.anchor);this.options={particleFollowParent:!!m.particleFollowParent,startLifetime:rW(m.startLifetime),startDelay:rW(m.startDelay||0),startSpeed:rW(y.startSpeed||0),startColor:rW(m.startColor),looping:!1,maxCount:null!=(c=m.maxCount)?c:0,gravityModifier:rW(x||0),gravity:T,start3DSize:!!m.start3DSize,startTurbulence:A,turbulence:s,speedOverLifetime:y.speedOverLifetime&&rW(y.speedOverLifetime),linearVelOverLifetime:R,orbitalVelOverLifetime:O,forceTarget:h},m.startRotationZ&&(this.options.startRotation=rW(m.startRotationZ||0)),(m.startRotationX||m.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=rW(m.startRotationX||0),this.options.startRotationY=rW(m.startRotationY||0),this.options.startRotationZ=rW(m.startRotationZ||0)),m.start3DSize?(this.options.startSizeX=rW(m.startSizeX),this.options.startSizeY=rW(m.startSizeY)):(this.options.startSize=rW(m.startSize),this.options.sizeAspect=rW(m.sizeAspect||1));var P={meshSlots:m.meshSlots,name:this.name,matrix:e0.IDENTITY,shaderCachePrefix:"",renderMode:S.renderMode||tS.BILLBOARD,side:S.side||ty.DOUBLE,gravity:T,blending:S.blending||tv.ALPHA,rotationOverLifetime:C,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:b,occlusion:!!S.occlusion,transparentOcclusion:!!S.transparentOcclusion,maxCount:m.maxCount,mask:S.mask,maskMode:null!=(f=S.maskMode)?f:tg.NONE,forceTarget:h,diffuse:S.texture,sizeOverLifetime:I,anchor:L};if(M){var F=M.color,V=M.opacity;P.colorOverLifetime={},V&&(P.colorOverLifetime.opacity=rW(M.opacity)),F&&(F[0]===tI.GRADIENT_COLOR?P.colorOverLifetime.color=M.color[1]:F[0]===tI.RGBA_COLOR?P.colorOverLifetime.color=i2.createWithData(this.engine,{data:new Uint8Array(F[1]),width:1,height:1}):r(F,i2)&&(P.colorOverLifetime.color=F))}var N=[],D=[0,0,1,1];if(t.splits){var z=t.splits[0];D=(d=z[4])?[z[0],z[1],z[3],z[2]]:[z[0],z[1],z[2],z[3]]}if(b&&!b.animate)for(var U=d?b.row:b.col,k=d?b.col:b.row,B=b.total||U*k,G=0,X=0;X<U;X++)for(var H=0;H<k&&G<B;H++,G++)N.push([X*D[2]/U+D[0],H*D[3]/k+D[1],D[2]/U,D[3]/k]);else N.push(D);this.uvs=N,P.textureFlip=d;var Y=t.trails;Y&&(this.trails={lifetime:rW(Y.lifetime),dieWithParticles:!1!==Y.dieWithParticles,sizeAffectsWidth:!!Y.sizeAffectsWidth,sizeAffectsLifetime:!!Y.sizeAffectsLifetime,inheritParticleColor:!!Y.inheritParticleColor,parentAffectsPosition:!!Y.parentAffectsPosition},p={name:"Trail",matrix:e0.IDENTITY,minimumVertexDistance:Y.minimumVertexDistance||.02,maxTrailCount:m.maxCount,pointCountPerTrail:Math.round(Y.maxPointPerTrail)||32,blending:Y.blending,texture:Y.texture,opacityOverLifetime:rW(Y.opacityOverLifetime||1),widthOverTrail:rW(Y.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!Y.occlusion,transparentOcclusion:!!Y.transparentOcclusion,textureMap:Y.textureMap,mask:S.mask,maskMode:S.maskMode},Y.colorOverLifetime&&Y.colorOverLifetime[0]===tI.GRADIENT_COLOR&&(p.colorOverLifetime=Y.colorOverLifetime[1]),Y.colorOverTrail&&Y.colorOverTrail[0]===tI.GRADIENT_COLOR&&(p.colorOverTrail=Y.colorOverTrail[1])),this.renderer=new sU(this.engine,P,p),this.meshes=this.renderer.meshes;var W=t.interaction;W&&(this.interaction={multiple:W.multiple,radius:W.radius,behavior:W.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)},eB(i,[{key:"timePassed",get:function(){return this.lastUpdate-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}}]),i}(it),t.ParticleSystem=n([e6(tZ.ParticleSystem)],t.ParticleSystem);var sk=new eJ,sB=new eQ,sG=new e1,sX=new eJ,sH=new eJ,sY=new eJ,sW=new e1,sj=[0,0,0],sZ=new e0,sq=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.lastTime=0,t}eX(i,e);var n=i.prototype;return n.start=function(e){var i=e.output.getUserData();!this.particleSystem&&r(i,t.VFXItem)&&(this.particleSystem=i.getComponent(t.ParticleSystem),this.particleSystem&&(this.particleSystem.name=i.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform()))},n.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){e.setVisible(!0);var i=t.deltaTime;this.lastTime===this.time&&(i=0),e.onUpdate(i)}this.lastTime=this.time},i}(nY),sK=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createPlayable=function(t){return new sq(t)},e}(nj),sQ={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"},sJ=function(){function e(e,i){this.particleCount=0;var n,s,a,o,u,l,h,c,f,d=(null!=(h=e.renderer)?h:{}).env,p=i.speedOverLifetime,m=i.colorOverLifetime,v=i.linearVelOverLifetime,y=i.orbitalVelOverLifetime,g=i.sizeOverLifetime,x=i.rotationOverLifetime,T=i.sprite,E=i.gravityModifier,b=i.maxCount,A=i.textureFlip,S=i.useSprite,C=i.name,_=i.gravity,R=i.forceTarget,O=i.side,w=i.occlusion,M=i.anchor,I=i.blending,L=i.maskMode,P=i.mask,F=i.transparentOcclusion,V=i.meshSlots,N=i.renderMode,D=void 0===N?0:N,z=i.diffuse,U=void 0===z?i2.createWithData(e):z,k=e.gpuCapability.detail,B=k.halfFloatTexture,G=k.maxVertexUniforms,X=[["RENDER_MODE",+D],["ENV_EDITOR",d===ib]],H=e.gpuCapability.level,Y=rK(),W=rK(),j=G>0,Z={},q=0,K=0;this.useSprite=S,j&&X.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(X.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=p.toUniform(Y)),(null==T?void 0:T.animate)&&(X.push(["USE_SPRITE",!0]),K|=4,Z.uFSprite=Z.uSprite=new Float32Array([T.col,T.row,T.total,T.blend?1:0]),this.useSprite=!0),(null==m?void 0:m.color)&&(X.push(["COLOR_OVER_LIFETIME",!0]),K|=16,Z.uColorOverLifetime=r(m.color,i2)?m.color:i2.createWithData(e,eE(m.color))),(null==m?void 0:m.opacity)?Z.uOpacityOverLifetimeValue=m.opacity.toUniform(Y):Z.uOpacityOverLifetimeValue=rW(1).toUniform(Y),["x","y","z"].forEach(function(t,e){var i=0,r=0;(null==v?void 0:v[t])&&(Z["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=v[t].toUniform(Y),i=1,K|=1<<7+e,v.enabled=!0),X.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==y?void 0:y[t])&&(Z["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=y[t].toUniform(Y),r=1,K|=1<<10+e,c=!0,y.enabled=!0),X.push(["ORB_VEL_"+t.toUpperCase(),r])}),(null==v?void 0:v.asMovement)&&(X.push(["AS_LINEAR_MOVEMENT",!0]),K|=32),c&&((null==y?void 0:y.asRotation)&&(X.push(["AS_ORBITAL_MOVEMENT",!0]),K|=64),Z.uOrbCenter=new Float32Array((null==y?void 0:y.center)||[0,0,0])),Z.uSizeByLifetimeValue=null==g?void 0:g.x.toUniform(Y),(null==g?void 0:g.separateAxes)&&(X.push(["SIZE_Y_BY_LIFE",1]),K|=16384,Z.uSizeYByLifetimeValue=null==g?void 0:null==(f=g.y)?void 0:f.toUniform(Y)),(null==x?void 0:x.z)&&(Z.uRZByLifeTimeValue=x.z.toUniform(Y),K|=32768,X.push(["ROT_Z_LIFETIME",1])),(null==x?void 0:x.x)&&(Z.uRXByLifeTimeValue=x.x.toUniform(Y),K|=65536,X.push(["ROT_X_LIFETIME",1])),(null==x?void 0:x.y)&&(Z.uRYByLifeTimeValue=x.y.toUniform(Y),K|=131072,X.push(["ROT_Y_LIFETIME",1])),(null==x?void 0:x.asRotation)&&(X.push(["ROT_LIFETIME_AS_MOVEMENT",1]),K|=262144),Z.uGravityModifierValue=E.toUniform(Y),R&&(X.push(["FINAL_TARGET",!0]),K|=524288,Z.uFinalTarget=new Float32Array(R.target||[0,0,0]),Z.uForceCurve=R.curve.toUniform(Y)),B&&W.max?(K|=1048576,Z.uFCurveValueTexture=i3(e,rP.getAllData(W,!0),W.index,1)):Z.uFCurveValues=rP.getAllData(W);var Q=Y.max+Y.curves.length-32>G;if(2===H&&(Y.max=-1,Y.index=V?V[0]:s0(Y.index),W.index>0&&(W.max=-1,W.index=V?V[1]:s0(W.index))),Q&&B&&j){var J=i3(e,rP.getAllData(Y,!0),Y.index,1);Z.uVCurveValueTexture=J,q=1}else Z.uVCurveValues=rP.getAllData(Y);var $=["-p:",D,K,Y.index,Y.max,W.index,W.max].join("+");X.push(["VERT_CURVE_VALUE_COUNT",Y.index],["FRAG_CURVE_VALUE_COUNT",W.index],["VERT_MAX_KEY_FRAME_COUNT",Y.max],["FRAG_MAX_KEY_FRAME_COUNT",W.max]);var tt={fragment:nu,vertex:"#define LOOKUP_TEXTURE_CURVE "+q+"\n"+nl,glslVersion:1===H?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:$,macros:X,name:"particle#"+C},te=iL(I);Z.uTexOffset=new Float32Array(U?[1/U.getWidth(),1/U.getHeight()]:[0,0]),Z.uMaskTex=U,Z.uColorParams=new Float32Array([U?1:0,+te,0,+(!!w&&!F)]),Z.uParams=[0,0,0,0],Z.uAcceleration=[(null==_?void 0:_[0])||0,(null==_?void 0:_[1])||0,(null==_?void 0:_[2])||0,0];var ti=rn.create(e,{shader:tt,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}});ti.blending=!0,ti.depthTest=!0,ti.depthMask=!!w,ti.stencilRef=P?[P,P]:void 0,iD(ti,L),iV(ti,I),iN(ti,O),Object.keys(Z).map(function(t){var e=Z[t];if(r(e,i2)){ti.setTexture(t,e);return}var i=[];switch(sQ[t]){case"vec4":ti.setVector4(t,im.fromArray(e));break;case"vec3":ti.setVector3(t,eJ.fromArray(e));break;case"vec2":ti.setVector2(t,eQ.fromArray(e));break;case"vec4Array":for(var n=0;n<e.length;n+=4){var s=new im(e[n],e[n+1],e[n+2],e[n+3]);i.push(s)}ti.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}),ti.setVector3("emissionColor",new eJ(0,0,0)),ti.setFloat("emissionIntensity",0);var tr=r9.create(e,(n=4*b,s=this.useSprite,a="particle#"+C,l={aPos:{size:3,offset:0,stride:u=12*(o=Float32Array.BYTES_PER_ELEMENT),data:new Float32Array(0)},aVel:{size:3,offset:3*o,stride:u,dataSource:"aPos"},aDirX:{size:3,offset:6*o,stride:u,dataSource:"aPos"},aDirY:{size:3,offset:9*o,stride:u,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*o,data:new Float32Array(0)},aSeed:{size:1,offset:3*o,stride:8*o,dataSource:"aRot"},aColor:{size:4,offset:4*o,stride:8*o,dataSource:"aRot"},aOffset:{size:4,stride:4*o,data:new Float32Array(0)}},s&&(l.aSprite={size:3,stride:3*o,data:new Float32Array(0)}),{attributes:l,indices:{data:new Uint16Array(0)},name:a,maxVertex:n})),tn=ne.create(e,{name:"MParticle_"+C,material:ti,geometry:tr});this.anchor=M,this.mesh=tn,this.geometry=tn.firstGeometry(),this.forceTarget=R,this.sizeOverLifetime=g,this.speedOverLifetime=p,this.linearVelOverLifetime=v,this.orbitalVelOverLifetime=y,this.orbitalVelOverLifetime=y,this.gravityModifier=E,this.maxCount=b,this.textureOffsets=A?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var i=e.prototype;return i.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return[e[i],e[i+1],e[i+2],e[i+3]]},i.getPointPosition=function(t){var e=this.geometry,i=48*t,r=e.getAttributeData("aPos"),n=e.getAttributeData("aOffset"),s=this.time-n[16*t+2],a=n[16*t+3],o=this.mesh.material,u=o.getVector4("uAcceleration").toVector3(),l=eJ.fromArray(r,i),h=eJ.fromArray(r,i+3),c=rl(new eJ,this,u,s,a,l,h);if(this.forceTarget){var f=o.getVector3("uFinalTarget"),d=this.forceTarget.curve.getValue(s/a),p=1-d;c.x=c.x*p+f.x*d,c.y=c.y*p+f.y*d,c.z=c.z*p+f.z*d}return c},i.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},i.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],s=t.getAttributeData(n);s&&t.setAttributeData(n,new s.constructor(0))}t.setIndexData(new i.constructor(0))},i.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},i.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},i.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r,n=t+1,s=4*n,a=this.geometry,o=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)},h=this.useSprite;h&&(l.aSprite=new Float32Array(12));var c=new eJ,f=new e$,d=new eJ(1,1,1);e.transform.assignWorldTRS(c,f,d);var p=n3.getRotation(f,new e1),m=c.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],T=e.vel,E=e.color,b=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],A=Math.random();h&&(r=e.sprite);for(var S=0;S<4;S++){var C=2*S,_=3*S,R=4*S,O=12*S,w=8*S;l.aPos.set(m,O),T.fill(l.aPos,O+3),l.aRot.set(v,w),l.aRot[w+3]=A,l.aRot.set(E,w+4),h&&l.aSprite.set(r,_);var M=e.uv||x;if(M){var I=h?1-y[C+1]:y[C+1];g[0]=M[0]+y[C]*M[2],g[1]=M[1]+I*M[3]}l.aOffset.set(g,R);for(var L=S+S,P=(b[L]-this.anchor.x)*d.x,F=(b[L+1]-this.anchor.y)*d.y,V=0;V<3;V++)l.aPos[O+6+V]=e.dirX.getElement(V)*P,l.aPos[O+9+V]=e.dirY.getElement(V)*F}var N=new Uint16Array([0,1,2,2,1,3].map(function(e){return e+4*t}));if(o){var D=ec(a.getIndexData(),6*n,6*i,u);D.set(N,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,N);Object.keys(l).forEach(function(e){var r=l[e],n=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(o){var h=ec(a.getAttributeData(e),s*n,4*i*n,u);h.set(r,r.length*t),a.setAttributeData(e,h)}else a.setAttributeSubData(e,r.length*t,r)}),this.particleCount=Math.max(n,this.particleCount),a.setDrawCount(6*this.particleCount)}},e}(),s$=[10,32,64,160];function s0(t){for(var e=0;e<s$.length;e++){var i=s$[e];if(i>t)return i}return t||s$[0]}function s1(t,e,i){void 0===i&&(i="");var r,n,s,a=t.content,o=+((null==(r=a.renderer)?void 0:r.renderMode)||0),u=[["RENDER_MODE",o],["ENV_EDITOR",i===ib]],l=e.level,h=e.detail,c=rK(),f=rK(),d=h.maxVertexUniforms>0,p=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,m=0,v=0;d&&u.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(u.push(["SPEED_OVER_LIFETIME",!0]),v|=2,rq(c,p));var y=a.textureSheetAnimation;y&&y.animate&&(u.push(["USE_SPRITE",!0]),v|=4);var g=a.colorOverLifetime;g&&g.color&&(u.push(["COLOR_OVER_LIFETIME",!0]),v|=16);var x=g&&g.opacity;x&&rq(c,x);var T=a.positionOverLifetime;if(["x","y","z"].forEach(function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==T?void 0:T[r])&&(rq(c,T[r]),i=1,v|=1<<7+e),u.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==T?void 0:T[n])&&(rq(c,T[n]),a=1,v|=1<<10+e,s=!0),u.push(["ORB_VEL_"+t.toUpperCase(),a])}),(null==T?void 0:T.asMovement)&&(u.push(["AS_LINEAR_MOVEMENT",!0]),v|=32),s&&(null==T?void 0:T.asRotation)&&(u.push(["AS_ORBITAL_MOVEMENT",!0]),v|=64),a.sizeOverLifetime){var E=a.sizeOverLifetime;E.separateAxes?(rq(c,E.x),u.push(["SIZE_Y_BY_LIFE",1]),v|=16384,rq(c,E.y)):rq(c,E.size)}if(a.rotationOverLifetime){var b=a.rotationOverLifetime;b.z&&(rq(c,null==b?void 0:b.z),v|=32768,u.push(["ROT_Z_LIFETIME",1])),b.separateAxes&&(b.x&&(rq(c,b.x),v|=65536,u.push(["ROT_X_LIFETIME",1])),b.y&&(rq(c,b.y),v|=131072,u.push(["ROT_Y_LIFETIME",1]))),(null==b?void 0:b.asRotation)&&(u.push(["ROT_LIFETIME_AS_MOVEMENT",1]),v|=262144)}rq(c,null==T?void 0:T.gravityOverLifetime),(null==T?void 0:T.forceTarget)&&(u.push(["FINAL_TARGET",!0]),v|=524288,rq(c,T.forceCurve));var A=h.halfFloatTexture;A&&f.max&&(v|=1048576);var S=h.maxVertexUniforms,C=c.max+c.curves.length-32>S;n0[nJ]&&(C=!0),2===l&&(c.max=-1,f.index>0&&(f.max=-1)),C&&A&&d&&(m=1);var _={fragment:nu,vertex:"#define LOOKUP_TEXTURE_CURVE "+m+"\n"+nl,shared:!0,cacheId:["-p:",o,v,c.index,c.max,f.index,f.max].join("+"),macros:u,name:"particle#"+t.name};return u.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",f.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",f.max]),{shader:_,vertex:c.index,fragment:f.index}}function s2(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var s=0;s<t.macros.length;s++){var a=t.macros[s];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=i;break}}}var s3=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.precompile=function(e,i,r){var n=i.engine.gpuCapability,s=n.level,a=(null!=r?r:{}).env,o=i.getShaderLibrary(),u=[],l=[],h=0,c=0;return e.forEach(function(e){e.items.forEach(function(e){t.Item.isParticle(e)&&u.push(e)})}),u.forEach(function(e){var i=s1(e,n,a),r=i.shader,u=i.fragment,f=i.vertex;if(l.push(r),h=Math.max(h,u),c=Math.max(c,f),e.content.trails){var d,p,m,v,y,g,x,T,E,b,A=(d=e.content.trails,p=e.content.options.maxCount,m=e.name,void 0===(v=a)&&(v=""),y=0,g=n0[nJ]?1:0,x=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",g],["ENV_EDITOR",v===ib]],T=rK(),d.colorOverLifetime&&(x.push(["COLOR_OVER_LIFETIME",!0]),y|=1),d.colorOverTrail&&(x.push(["COLOR_OVER_TRAIL",!0]),y|=4),p>64&&(x.push(["ATTR_TRAIL_START",1]),y|=8),rq(T,d.opacityOverLifetime),rq(T,d.widthOverTrail),x.push(["VERT_CURVE_VALUE_COUNT",T.index],["VERT_MAX_KEY_FRAME_COUNT",T.max]),{vertex:nh,fragment:nu,macros:x,shared:!0,name:"trail#"+m,cacheId:"-t:+"+y+"+"+T.index+"+"+T.max});A.vertex=iF(null!=(E=A.macros)?E:[],A.vertex,t.ShaderType.vertex,s),A.fragment=iF(null!=(b=A.macros)?b:[],A.fragment,t.ShaderType.fragment,s),A.glslVersion=2===s?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,o.addShader(A)}}),l.forEach(function(e){var i,r;2===s?(s2(e,c,h),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,e.vertex=iF(null!=(i=e.macros)?i:[],e.vertex,t.ShaderType.vertex,s),e.fragment=iF(null!=(r=e.macros)?r:[],e.fragment,t.ShaderType.fragment,s),o.addShader(e)}),2===s&&u.forEach(function(t){t.content.options.meshSlots=[c,h]}),Promise.resolve()},i}(is),s4=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(is);function s5(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var s6=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,i){return this.findCurveValue(t,e)?this.curveValues[t+e].value=i:this.curveValues[t+e]={componentType:t,propertyName:e,value:i},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},e.getInputStream=function(t){var e=this.playable.getInput(t);if(r(e,s8))return e.animationStream},t}(),s8=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new s6(s5(i)),i}return eX(e,t),e}(nY),s9=new e1,s7=new eJ(1,1,1),at=new eJ,ae=function(e){function i(){return e.apply(this,arguments)}eX(i,e);var n=i.prototype;return n.start=function(){var t,e=this.binding,i=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new eJ(i.x,i.y,i.x)};var r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,s=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=rW(r.path));var a=r.linearX||r.linearY||r.linearZ;a&&(this.linearVelOverLifetime={x:r.linearX&&rW(r.linearX),y:r.linearY&&rW(r.linearY),z:r.linearZ&&rW(r.linearZ),asMovement:r.asMovement,enabled:!!a});var o=r.orbitalX||r.orbitalY||r.orbitalZ;o&&(this.orbitalVelOverLifetime={x:r.orbitalX&&rW(r.orbitalX),y:r.orbitalY&&rW(r.orbitalY),z:r.orbitalZ&&rW(r.orbitalZ),center:rh(r.orbCenter),asRotation:r.asRotation,enabled:!!o}),this.speedOverLifetime=r.speedOverLifetime&&rW(r.speedOverLifetime)}if(s&&(s.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=rW(s.x||1),this.sizeYOverLifetime=rW(s.y||1),this.sizeZOverLifetime=rW(s.z||1)):this.sizeXOverLifetime=rW(s.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:rW(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=rW(n.x||0),u.y=rW(n.y||0)}this.gravity=eJ.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=rW(null!=(t=null==r?void 0:r.gravityOverLifetime)?t:0),this.direction=(null==r?void 0:r.direction)?eJ.fromArray(r.direction).normalize():new eJ,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},n.processFrame=function(e){if(!this.binding){var i=e.output.getUserData();r(i,t.VFXItem)&&(this.binding=i,this.start())}this.binding&&this.binding.composition&&this.sampleAnimation()},n.sampleAnimation=function(){var t=this,e=this.binding,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){s7.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(s7.y=this.sizeYOverLifetime.getValue(r),s7.z=this.sizeZOverLifetime.getValue(r)):s7.z=s7.y=s7.x;var n=this.originalTransform.scale;e.transform.setScale(s7.x*n.x,s7.y*n.y,s7.z*n.z)}if(this.rotationOverLifetime){var s=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},a=s(this.rotationOverLifetime.z),o=this.rotationOverLifetime.separateAxes;s9.x=o?s(this.rotationOverLifetime.x):0,s9.y=o?s(this.rotationOverLifetime.y):0,s9.z=a;var u=s9.addEulers(this.originalTransform.rotation,s9);e.transform.setRotation(u.x,u.y,u.z)}this.positionOverLifetime&&(rl(at,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&at.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(at.x,at.y,at.z))},i}(s8);t.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new ae(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(nj),t.TransformPlayableAsset=n([e6("TransformPlayableAsset")],t.TransformPlayableAsset);var ai=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.processFrame=function(t){},e}(nY);t.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createPlayable=function(t){return new ai(t)},e}(nj),t.ActivationPlayableAsset=n([e6("ActivationPlayableAsset")],t.ActivationPlayableAsset),t.AnimationClip=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.duration=0,e.positionCurves=[],e.rotationCurves=[],e.scaleCurves=[],e.floatCurves=[],e}eX(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){var i=e/t.duration;i=i<0?0:i>1?1:i;for(var r,n=eY(this.positionCurves);!(r=n()).done;){var s=r.value,a=s.keyFrames.getValue(i),o=this.findTarget(t,s.path);null==o||o.transform.setPosition(a.x,a.y,a.z)}for(var u,l=eY(this.rotationCurves);!(u=l()).done;){var h=u.value,c=h.keyFrames.getValue(i),f=this.findTarget(t,h.path);null==f||f.transform.setQuaternion(c.x,c.y,c.z,c.w)}for(var d,p=eY(this.scaleCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(i),y=this.findTarget(t,m.path);null==y||y.transform.setScale(v.x,v.y,v.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,i=eY(t.positionCurves);!(e=i()).done;){var r=e.value,n={path:r.path,keyFrames:rW(r.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var s,a=eY(t.rotationCurves);!(s=a()).done;){var o=s.value,u={path:o.path,keyFrames:rW(o.keyFrames)};this.duration=Math.max(this.duration,u.keyFrames.getMaxTime()),this.rotationCurves.push(u)}for(var l,h=eY(t.scaleCurves);!(l=h()).done;){var c=l.value,f={path:c.path,keyFrames:rW(c.keyFrames)};this.duration=Math.max(this.duration,f.keyFrames.getMaxTime()),this.scaleCurves.push(f)}for(var d,p=eY(t.floatCurves);!(d=p()).done;){var m=d.value,v={path:m.path,keyFrames:rW(m.keyFrames),property:m.property,className:m.className};this.duration=Math.max(this.duration,v.keyFrames.getMaxTime()),this.floatCurves.push(v)}},i.findTarget=function(t,e){for(var i,r=t,n=eY(e);!(i=n()).done;){for(var s,a=i.value,o=!1,u=eY(r.children);!(s=u()).done;){var l=s.value;if(l.name===a){r=l,o=!0;break}}if(!o)return}return r},e}(e7),t.AnimationClip=n([e6(tZ.AnimationClip)],t.AnimationClip);var ar=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.prototype.processFrame=function(e){var i=e.output.getUserData();r(i,t.VFXItem)&&i.composition&&this.clip.sampleAnimation(i,this.time)},i}(nY),an=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>.001&&(this.endBehaviour===tP.loop?e%=i:this.endBehaviour===tP.freeze&&(e=Math.min(i,e))),e},t}();t.TrackAsset=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}eX(e,t);var i=e.prototype;return i.resolveBinding=function(t){return t},i.createTrackMixer=function(t){return new nY(t)},i.createOutput=function(){return new nW},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=eY(this.clips);!(i=n()).done;){var s=i.value;r.push(s)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),s=eY(e);!(r=s()).done;){var a=r.value,o=this.createClipPlayable(t,a),u=new as(a,o,n,this);i.push(u),n.addInput(o,0),n.setInputWeight(o,0)}return n},i.createPlayable=function(t){return new nY(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t)},i.createClip=function(t,e){var i=new an;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=eY(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},e}(nj),n([e9(an,void 0)],t.TrackAsset.prototype,"clips",void 0),n([e9(void 0,void 0)],t.TrackAsset.prototype,"children",void 0),t.TrackAsset=n([e6("TrackAsset")],t.TrackAsset),t.TrackType=void 0,(th=t.TrackType||(t.TrackType={}))[th.MasterTrack=0]="MasterTrack",th[th.ObjectTrack=1]="ObjectTrack";var as=function(){function e(e,i,n,s){this.clip=e,this.playable=i,this.parentMixer=n,this.track=s,r(this.track.binding,t.VFXItem)&&(this.particleSystem=this.track.binding.getComponent(t.ParticleSystem))}var i=e.prototype;return i.evaluateAt=function(e){var i=this.clip,r=1,n=!1,s=!1,a=this.track.binding;e>i.start+i.duration+.001&&i.endBehaviour===tP.destroy?t.VFXItem.isParticle(a)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,n=!0):e-this.clip.start>=0?(r=1,s=!0):e<i.start&&(r=0),s&&this.playable.getPlayState()!==t4.Playing&&this.playable.play(),this.parentMixer.setInputWeight(this.playable,r),n&&!a.ended&&(a.ended=!0,a.onEnd()),n&&this.playable.getPlayState()===t4.Playing&&(this.playable.pause(),this.onClipEnd());var o=i.toLocalTime(e);this.playable.setTime(o)},i.onClipEnd=function(){var t=this.track.binding;if(!t.compositionReusable&&!t.reusable){t.dispose(),this.playable.dispose();return}},eB(e,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setInputWeight(this.playable,0),this.playable.pause())}}]),e}();t.ObjectBindingTrack=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.prototype.create=function(e){var i=this.binding;if(i.getComponent(t.ParticleSystem)){var r=e.createTrack(t.TrackAsset,this,"ParticleTrack");r.binding=this.binding;var n=r.createClip(sK);n.start=i.start,n.duration=i.duration,n.endBehaviour=i.endBehavior}},i}(t.TrackAsset),t.ObjectBindingTrack=n([e6("ObjectBindingTrack")],t.ObjectBindingTrack),t.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(t.TrackAsset),t.TransformTrack=n([e6("TransformTrack")],t.TransformTrack);var aa=function(e){function i(){return e.apply(this,arguments)}eX(i,e);var n=i.prototype;return n.processFrame=function(e){var i=e.output.getUserData();if(r(i,t.VFXItem)){for(var n=!1,s=0;s<this.getInputCount();s++)if(this.getInputWeight(s)>0){n=!0;break}n?(i.transform.setValid(!0),this.showRendererComponents(i)):(i.transform.setValid(!1),this.hideRendererComponents(i))}},n.hideRendererComponents=function(t){for(var e,i=eY(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled&&(r.enabled=!1)}},n.showRendererComponents=function(t){for(var e,i=eY(t.rendererComponents);!(e=i()).done;){var r=e.value;r.enabled||(r.enabled=!0)}},i}(nY);t.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createTrackMixer=function(t){return new aa(t)},e}(t.TrackAsset),t.ActivationTrack=n([e6("ActivationTrack")],t.ActivationTrack),t.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(t.TrackAsset),t.SpriteColorTrack=n([e6("SpriteColorTrack")],t.SpriteColorTrack),t.TimelineAsset=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.tracks=[],t}eX(i,e);var n=i.prototype;return n.createPlayable=function(e){var i=new ao(e);i.setTraversalMode(t5.Passthrough);for(var n,s=eY(this.tracks);!(n=s()).done;){var a=n.value;r(a,t.ObjectBindingTrack)&&a.create(this)}return i.compileTracks(e,this.tracks),i},n.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),r},n.fromData=function(t){},i}(nj),n([e9(void 0,void 0)],t.TimelineAsset.prototype,"tracks",void 0),t.TimelineAsset=n([e6("TimelineAsset")],t.TimelineAsset);var ao=function(t){function e(){var e;return e=t.apply(this,arguments)||this,e.clips=[],e}eX(e,t);var i=e.prototype;return i.prepareFrame=function(t){this.evaluate()},i.evaluate=function(){for(var t,e=this.getTime(),i=eY(this.clips);!(t=i()).done;)t.value.evaluateAt(e)},i.compileTracks=function(t,e){this.sortTracks(e);for(var i,r=[],n=eY(e);!(i=n()).done;){var s=i.value;r.push(s),this.addSubTracksRecursive(s,r)}for(var a,o=eY(r);!(a=o()).done;){var u=a.value,l=u.createPlayableGraph(t,this.clips);this.addInput(l,0);var h=u.createOutput();h.setUserData(u.binding),t.addOutput(h),h.setSourcePlayeble(this,this.getInputCount()-1)}},i.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new au(t[i],i));e.sort(ah),t.length=0;for(var r,n=eY(e);!(r=n()).done;){var s=r.value;t.push(s.track)}},i.addSubTracksRecursive=function(t,e){for(var i,r=eY(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var s,a=eY(t.getChildTracks());!(s=a()).done;){var o=s.value;this.addSubTracksRecursive(o,e)}},e}(nY),au=function(t,e){this.track=t,this.originalIndex=e};function al(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1}function ah(e,i){var n=e.track.binding,s=i.track.binding;return r(n,t.VFXItem)&&r(s,t.VFXItem)?al(n,s)?-1:al(s,n)?1:e.originalIndex-i.originalIndex:e.originalIndex-i.originalIndex}var ac=function(e){function i(){var t;return t=e.apply(this,arguments)||this,t.time=0,t.startTime=0,t.items=[],t.reusable=!1,t.sceneBindings=[],t.graph=new nH,t}eX(i,e);var n=i.prototype;return n.start=function(){var t=this.item.props.startTime;this.startTime=void 0===t?0:t,this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==tP.destroy&&this.setReusable(!0)},n.setReusable=function(e){for(var n,s=eY(this.timelineAsset.tracks);!(n=s()).done;){var a=n.value,o=a.binding;if(r(o,t.VFXItem)){r(a,t.ObjectBindingTrack)&&(o.reusable=e);var u=o.getComponent(i);u&&u.setReusable(e)}}},n.getReusable=function(){return this.reusable},n.update=function(t){var e=this.time;this.item.isEnded(this.time)&&!this.item.parent&&(this.item.ended=!0),this.timelinePlayable.setTime(e),this.graph.evaluate(t)},n.createContent=function(){for(var e,r=[],n=eY(this.data.sceneBindings);!(e=n()).done;){var s=e.value;r.push({key:this.engine.assetLoader.loadGUID(s.key.id),value:this.engine.assetLoader.loadGUID(s.value.id)})}this.sceneBindings=r;var a=this.data.timelineAsset?this.engine.assetLoader.loadGUID(this.data.timelineAsset.id):new t.TimelineAsset(this.engine);this.timelineAsset=a;var o=this.items;if(this.items.length=0,this.item.composition)for(var u=this.item.engine.assetLoader,l=this.item.props.items?this.item.props.items:[],h=0;h<l.length;h++){var c=void 0,f=l[h];if(t.Item.isComposition(f)){var d=f.content.options.refId,p=this.item.composition.refCompositionProps.get(d);if(!p)throw Error("Referenced precomposition with Id: "+d+" does not exist.");p.content=f.content,(c=u.loadGUID(f.id)).composition=this.item.composition;var m=c.addComponent(i);m.data=p,m.refId=d,c.transform.parentTransform=this.transform,this.item.composition.refContent.push(c),c.endBehavior===tP.loop&&(this.item.composition.autoRefTex=!1),m.createContent();for(var v,y=eY(m.items);!(v=y()).done;){var g=v.value;g.setInstanceId(eD());for(var x,T=eY(g.components);!(x=T()).done;)x.value.setInstanceId(eD())}}else(c=u.loadGUID(f.id)).composition=this.item.composition;c.parent=this.item,c.transform.parentTransform=f.type===tA.camera?new n3:this.transform,t.VFXItem.isExtraCamera(c)&&(this.item.composition.extraCamera=c),o.push(c)}},n.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach(function(t){return t.dispose()}),this.items.length=0)},n.hitTest=function(e,i,r,n,s,a){for(var o,u=[],l=(null==a?void 0:a.stop)||ew,h=(null==a?void 0:a.skip)||ew,c=(null==a?void 0:a.maxCount)||this.items.length,f=0;f<this.items.length&&n.length<c;f++){var d=(o=this,function(a){var c=o.items[a];if(c.getVisible()&&!c.ended&&!t.VFXItem.isComposition(c)&&!h(c)){var f=c.getHitTestParams(s);if(f){var d=!1,p=new eJ;if(f.type===t.HitTestType.triangle)for(var m=f.triangles,v=f.backfaceCulling,y=0;y<m.length;y++){var g=m[y];if(e.intersectTriangle(g,p,v)){d=!0,u.push(p);break}}else if(f.type===t.HitTestType.box){var x=f.center,T=f.size,E=x.clone().addScaledVector(T,.5),b=x.clone().addScaledVector(T,-.5);e.intersectBox({min:E,max:b},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.sphere){var A=f.center,S=f.radius;e.intersectSphere({center:A,radius:S},p)&&(d=!0,u.push(p))}else if(f.type===t.HitTestType.custom){var C=f.collect(e,new eQ(i,r));C&&C.length>0&&(C.forEach(function(t){u.push(t)}),d=!0)}if(d){var _={compContent:o.item,id:c.id,name:c.name,position:u[u.length-1],parentId:c.parentId,hitPositions:u,behavior:f.behavior};if(n.push(_),l(_))return{v:n}}}}}(f));if("object"==(d&&"undefined"!=typeof Symbol&&d.constructor===Symbol?"symbol":typeof d))return d.v}return n},n.fromData=function(t){},n.resolveBindings=function(){for(var t,e=eY(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.binding=i.value}for(var r,n=eY(this.timelineAsset.tracks);!(r=n()).done;){var s=r.value;this.resolveTrackBindingsWithRoot(s)}},n.resolveTrackBindingsWithRoot=function(t){for(var e,i=eY(t.getChildTracks());!(e=i()).done;){var r=e.value;r.binding=r.resolveBinding(t.binding),this.resolveTrackBindingsWithRoot(r)}},i}(ii);t.SubCompositionTrack=function(e){function i(){return e.apply(this,arguments)}return eX(i,e),i.prototype.resolveBinding=function(e){if(!r(e,t.VFXItem))throw Error("SubCompositionTrack needs to be set under the VFXItem track.");return e.getComponent(ac)},i}(t.TrackAsset),t.SubCompositionTrack=n([e6("SubCompositionTrack")],t.SubCompositionTrack);var af=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();r(e,ac)&&(e.time=this.getTime())},e}(nY);t.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.createPlayable=function(t){return new af(t)},e}(nj),t.SubCompositionPlayableAsset=n([e6("SubCompositionPlayableAsset")],t.SubCompositionPlayableAsset);var ad=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=t.textWidth,r=t.textOverflow,n=void 0===r?tX.display:r,s=t.textBaseline,a=void 0===s?tH.top:s,o=t.textAlign,u=void 0===o?tY.left:o,l=t.text,h=t.letterSpace,c=void 0===h?0:h,f=t.autoWidth,d=t.fontSize,p=t.lineHeight;this.autoWidth=void 0!==f&&f,this.maxTextWidth=l.length*(d+c),this.width=void 0===i?100:i,this.height=void 0===e?100:e,this.letterSpace=c,this.overFlow=n,this.textBaseline=a,this.textAlign=u,this.lineHeight=void 0===p?d:p}var e=t.prototype;return e.getOffsetY=function(t){var e=0,i=(t.fontSize+t.outlineWidth)*t.fontScale;switch(this.textBaseline){case tH.top:e=i;break;case tH.middle:e=(this.height+i)/2;break;case tH.bottom:e=this.height-i/2}return e},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case tY.left:i=t.outlineWidth*t.fontScale;break;case tY.middle:i=(this.width*t.fontScale-e)/2;break;case tY.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),ap=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,s,a,o=t.textColor,u=t.fontSize,l=t.outline,h=t.shadow,c=t.fontWeight,f=t.fontStyle,d=t.fontFamily;this.textColor=void 0===o?[1,1,1,1]:o,this.textWeight=void 0===c?"normal":c,this.fontStyle=void 0===f?"normal":f,this.fontFamily=void 0===d?"sans-serif":d,this.fontSize=void 0===u?40:u,l&&(this.isOutlined=!0,this.outlineColor=null!=(e=l.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=l.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth),h&&(this.hasShadow=!0,this.shadowBlur=null!=(r=h.shadowBlur)?r:2,this.shadowColor=null!=(n=h.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(s=h.shadowOffsetX)?s:0,this.shadowOffsetY=null!=(a=h.shadowOffsetY)?a:0),this.fontStyle!==tj.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},am=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(n0[n$])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?el(this.elements,t):t.remove()},t}()),av=["serif","sans-serif","monospace","courier"];t.TextComponent=function(t){function e(e,i){if((r=t.call(this,e,i)||this).isDirty=!0,r.canvas=am.getCanvas(),am.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return s5(r);var r,n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}eX(e,t);var i=e.prototype;return i.update=function(e){t.prototype.update.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.options;this.updateWithOptions(i),this.updateTexture()},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(t.SpriteComponent),t.TextComponent=n([e6(tZ.TextComponent)],t.TextComponent);var ay=function(){function t(){}var e=t.prototype;return e.updateWithOptions=function(t){this.textStyle=new ap(t),this.textLayout=new ad(t),this.text=t.text},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t,this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){if(this.textStyle.fontFamily===t&&!e_(t)){console.warn("The font is either the current font or an risky font family.");return}this.textStyle.fontFamily=t,this.isDirty=!0},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,i=this.textStyle,r=this.textLayout,n=i.fontScale,s=(r.width+i.fontOffset)*n,a=r.height*n,o=i.fontSize*n,u=r.lineHeight*n;this.char=(this.text||"").split(""),this.canvas.width=s,this.canvas.height=a,e.clearRect(0,0,s,this.canvas.height),e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,a),e.scale(1,-1)),e.fillRect(0,0,s,this.canvas.height),i.fontDesc=this.getFontDesc(),e.font=i.fontDesc,i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var l=[],h=0,c=r.getOffsetY(i)+(u-o)/3,f=[],d=[],p=0;p<this.char.length;p++){var m=this.char[p],v=e.measureText(m);((h+=r.letterSpace*n)+v.width>s&&p>0||"\n"===m)&&(l.push({y:c,width:h,chars:f,charOffsetX:d}),h=0,c+=u,f=[],d=[]),"\n"!==m&&(f.push(m),d.push(h),h+=v.width)}l.push({y:c,width:h,chars:f,charOffsetX:d}),l.forEach(function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach(function(r,s){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[s],t.y),e.fillText(r,n+t.charOffsetX[s],t.y)})}),i.hasShadow&&(e.shadowColor="transparent");var y=e.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",i2.createWithData(this.engine,{data:new Uint8Array(y.data),width:y.width,height:y.height},{flipY:t,magFilter:iR.LINEAR,minFilter:iR.LINEAR,wrapS:iR.CLAMP_TO_EDGE,wrapT:iR.CLAMP_TO_EDGE})),this.isDirty=!1}},e.getFontDesc=function(){var t=this.textStyle,e=t.fontSize,i=t.fontScale,r=t.fontFamily,n=t.textWeight,s=t.fontStyle,a=""+(e*i).toString()+"px ";return av.includes(r)?a+=r:a+='"'+r+'"',n!==tW.normal&&(a=n+" "+a),s!==tj.normal&&(a=s+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],s=i[1],a=i[2],o=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*s+", "+255*a+", "+o+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,s=e.shadowOffsetY,a=i[0],o=i[1],u=i[2],l=i[3];t&&(t.shadowColor="rgba("+255*a+", "+255*o+", "+255*u+", "+l+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-s)},t}();eU(t.TextComponent,[ay]);var ag=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(is),ax=1;t.EffectComponent=function(e){function i(t){var i;return(i=e.call(this,t)||this).worldMatrix=e0.fromIdentity(),i.triangles=[],i.destroyed=!1,i.visible=!1,i.getHitTestParams=function(t){var e=i.getBoundingBox();if(e)return{type:e.type,triangles:e.area}},i.id="Mesh"+ax++,i.name="<unnamed>",i._priority=0,i}eX(i,e);var r=i.prototype;return r.setVisible=function(t){this.visible=t},r.start=function(){this.item.getHitTestParams=this.getHitTestParams},r.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),t.drawGeometry(this.geometry,this.material)},r.getVisible=function(){return this.visible},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(e,i){i!==t.DestroyOptions.keep&&this.material.dispose(i),this.material=e},r.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.hitTestGeometry!==this.geometry&&(this.triangles=function(t){for(var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[],n=0;n<e.length;n+=3){var s=3*e[n],a=3*e[n+1],o=3*e[n+2],u={x:i[s],y:i[s+1],z:i[s+2]},l={x:i[a],y:i[a+1],z:i[a+2]},h={x:i[o],y:i[o+1],z:i[o+2]};r.push({p0:u,p1:l,p2:h})}return r}(this.geometry),this.hitTestGeometry=this.geometry);for(var i,r=[],n=eY(this.triangles);!(i=n()).done;){var s=i.value;r.push({p0:s.p0,p1:s.p1,p2:s.p2})}return r.forEach(function(t){t.p0=e.transformPoint(t.p0,new eJ),t.p1=e.transformPoint(t.p1,new eJ),t.p2=e.transformPoint(t.p2,new eJ)}),{type:t.HitTestType.triangle,area:r}},r.fromData=function(t){e.prototype.fromData.call(this,t),this.material=this.materials[0]},r.toData=function(){this.taggedProperties.id=this.guid},r.dispose=function(t){this.destroyed||(this.destroyed=!0,e.prototype.dispose.call(this))},eB(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(ir),n([e9(void 0,void 0)],t.EffectComponent.prototype,"geometry",void 0),t.EffectComponent=n([e6(tZ.EffectComponent)],t.EffectComponent),t.VFXItem=function(e){function i(t,i){var r;return(r=e.call(this,t)||this).children=[],r.transform=new n3,r.duration=0,r.start=0,r.ended=!1,r.reusable=!1,r.type=tA.base,r.components=[],r.itemBehaviours=[],r.rendererComponents=[],r.visible=!0,r.speed=1,r.listIndex=0,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,i&&r.fromData(i),r}eX(i,e);var n=i.prototype;return n.setSpeed=function(t){this.speed=t},n.getSpeed=function(){return this.speed},n.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.item=this,e.onAttached(),e},n.getComponent=function(t){for(var e,i,n=eY(this.components);!(i=n()).done;){var s=i.value;if(r(s,t)){e=s;break}}return e},n.getComponents=function(t){for(var e,i=[],n=eY(this.components);!(e=n()).done;){var s=e.value;r(s,t)&&i.push(s)}return i},n.setParent=function(t){t!==this&&(this.parent&&eh(this.parent.children,this),this.parent=t,t&&(i.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition)))},n.onEnd=function(){},n.setColor=function(t,e,i,r){},n.setOpacity=function(t){},n.getVisible=function(){return this.visible},n.setVisible=function(t){this.visible!==t&&(this.visible=!!t)},n.getWorldTransform=function(t){var e=null!=t?t:new n3({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},n.getNodeTransform=function(t){for(var e=0;e<this.components.length;e++){var i=this.components[1];if(i.getNodeTransform)return i.getNodeTransform(t)}return this.transform},n.translate=function(t,e,i){this.transform.translate(t,e,i)},n.rotate=function(t,e,i){var r=new e1(t,e,i),n=e$.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},n.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},n.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,s=r.y,a=this.composition.renderer.getWidth()/2,o=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/a-1)*n,(1-2*e/o)*s,i)}},n.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},n.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},n.setScale=function(t,e,i){this.transform.setScale(t,e,i)},n.getBoundingBox=function(){},n.getHitTestParams=function(t){},n.getCurrentPosition=function(){var t=new eJ;return this.transform.assignWorldTRS(t),t},n.isEnded=function(t){return t-this.duration>.001},n.find=function(t){if(this.name===t)return this;for(var e,i=eY(this.children);!(e=i()).done;){var r=e.value;if(r.name===t)return r}for(var n,s=eY(this.children);!(n=s()).done;){var a=n.value.find(t);if(a)return a}},n.fromData=function(t){e.prototype.fromData.call(this,t);var i=t.id,r=t.name,n=t.delay,s=t.parentId,a=t.endBehavior,o=t.transform,u=t.listIndex,l=t.duration,h=void 0===l?0:l;if(this.props=t,this.type=t.type,this.id=i.toString(),this.name=r,this.start=n||this.start,o&&(o.position=new eJ().copyFrom(o.position),o.quat?o.quat=new e$(o.quat.x,o.quat.y,o.quat.z,o.quat.w):o.rotation=new e1().copyFrom(null!=(c=o.eulerHint)?c:o.rotation),o.scale=new eJ().copyFrom(o.scale),o.size&&(o.size=new eQ().copyFrom(o.size)),o.anchor&&(o.anchor=new eQ().copyFrom(o.anchor)),this.transform.setTransform(o)),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=s,this.duration=h,this.endBehavior=a,this.oldId=t.oldId,t.content||(t.content={options:{}}),h<=0)throw Error("Item duration can't be less than 0, see "+iA["Item duration can't be less than 0"]+".");for(var c,f,d=eY(this.components);!(f=d()).done;){var p=f.value;p.item=this,p.onAttached()}this.renderOrder=void 0===u?0:u},n.toData=function(){if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=tZ.VFXItemData,(null==(e=this.parent)?void 0:e.name)!=="rootItem"&&(this.taggedProperties.parentId=null==(i=this.parent)?void 0:i.guid),!this.taggedProperties.components){this.taggedProperties.components=[];for(var e,i,n,s=eY(this.components);!(n=s()).done;){var a=n.value;r(a,t.EffectComponent)&&this.taggedProperties.components.push(a)}}this.taggedProperties.content={}},n.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,s=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(s),o=a.x,u=a.y;this.transform.translate(2*t*o/r,-2*e*u/n,0)}},n.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=eY(this.components.slice());!(t=e()).done;)t.value.dispose();this.components=[],this._content=void 0,this.composition=null,this.transform.setValid(!1)}},n.resetChildrenParent=function(){for(var t,e,i=eY(this.children);!(e=i()).done;){var r=e.value;this.parent&&r.setParent(this.parent)}this.parent&&eh(null==(t=this.parent)?void 0:t.children,this)},i.isComposition=function(t){return t.type===tA.composition},i.isSprite=function(t){return t.type===tA.sprite},i.isParticle=function(t){return t.type===tA.particle},i.isNull=function(t){return t.type===tA.null},i.isTree=function(t){return t.type===tA.tree},i.isCamera=function(t){return t.type===tA.camera},i.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},eB(i,[{key:"content",get:function(){return this._content}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=eY(this.rendererComponents);!(e=i()).done;)e.value.priority=t}}}]),i}(e7),n([e9(void 0,void 0)],t.VFXItem.prototype,"components",void 0),t.VFXItem=n([e6(tZ.VFXItemData)],t.VFXItem),t.Item=void 0,(tc=t.Item||(t.Item={})).is=function(t,e){return t.type===e},tc.isComposition=function(t){return t.type===tA.composition},tc.isParticle=function(t){return t.type===tA.particle},tc.isNull=function(t){return t.type===tA.null};var aT={},aE=[],ab={};function aA(t,e,i,r){ab[t]=i,aT[t]=e,r&&el(aE,t)}var aS=function(){function e(t){var e={},i=[],r=function(t){var r=aT[t];i.includes(r)||(i.push(r),e[t]=r)};aE.forEach(r),t.forEach(r),this.plugins=Object.keys(e).map(function(t){var e,i=aT[t];if(!i)throw Error("The plugin '"+t+"' not found."+((e=aC[t])?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""));var r=new i;return r.name=t,r}).sort(function(t,e){return t.order-e.order})}var n=e.prototype;return n.initializeComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionConstructed(t,e)})},n.destroyComposition=function(t){this.plugins.forEach(function(e){return e.onCompositionDestroyed(t)})},n.resetComposition=function(t,e){this.plugins.forEach(function(i){return i.onCompositionReset(t,e)})},n.createPluginItem=function(e,i,n){var s=ab[e];if(!s)throw Error("The plugin '"+e+"' does not have a registered constructor.");var a=new s(n.getEngine(),i,n);if(a.composition=n,!r(a,t.VFXItem))throw Error("The plugin '"+e+"' invalid constructor type.");return a},n.processRawJSON=function(t,e){var r=this;return i(function(){return s(this,function(i){return[2,r.callStatic("processRawJSON",t,e)]})})()},n.callStatic=function(t){for(var e=arguments.length,r=Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var a=this;return i(function(){var e,i,n,o,u,l;return s(this,function(s){for(n=0,e=[],i=a.plugins;n<i.length;n++)t in(o=aT[i[n].name])&&e.push(Promise.resolve(null==(l=o[t])?void 0:(u=l).call.apply(u,[].concat([o],r))));return[2,Promise.all(e)]})})()},n.precompile=function(t,e,r){var n=this;return i(function(){return s(this,function(i){return[2,n.callStatic("precompile",t,e,r)]})})()},n.loadResources=function(t,e){var r=this;return i(function(){return s(this,function(i){return[2,r.callStatic("prepareResource",t,e)]})})()},e}(),aC={"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"},a_=function(){function t(){}return t.collectSerializableObject=function(e,i){if(!i[e.getInstanceId()]){e.toData(),i[e.getInstanceId()]=e;for(var r,n=e8(e),s=eY(Object.keys(n));!(r=s()).done;){var a=r.value,o=e.taggedProperties[a];if(void 0===o&&(o=e[a]),e7.is(o))t.collectSerializableObject(o,i);else if(eI(o))for(var u,l=eY(o);!(u=l()).done;){var h=u.value;e7.is(h)&&t.collectSerializableObject(h,i)}else if(eP(o))for(var c,f=eY(Object.keys(o));!(c=f()).done;){var d=o[c.value];e7.is(d)&&t.collectSerializableObject(d,i)}}}},t.serializeEffectObject=function(e){var i={},r=e.engine,n=iz({},r.jsonSceneData);t.collectSerializableObject(e,i);for(var s,a=eY(Object.keys(i));!(s=a()).done;){var o=i[s.value];n[o.getInstanceId()]||(n[o.getInstanceId()]={}),t.serializeTaggedProperties(o,n[o.getInstanceId()])}return n},t.serializeTaggedProperties=function(e,i){e.toData(),i||(i={});for(var r,n=e8(e),s=eY(Object.keys(n));!(r=s()).done;){var a=r.value,o=e[a];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(o)?i[a]=o:eI(o)?(i[a]||(i[a]=[]),t.serializeArrayProperty(o,i[a],0)):e7.is(o)?i[a]={id:o.getInstanceId()}:eP(o)&&(i[a]||(i[a]={}),t.serializeObjectProperty(o,i[a],0))}for(var u,l=eY(Object.keys(e.taggedProperties));!(u=l()).done;){var h=u.value,c=e.taggedProperties[h];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(c)?i[h]=c:eI(c)?(i[h]||(i[h]=[]),t.serializeArrayProperty(c,i[h],0)):e7.is(c)?i[h]={id:c.getInstanceId()}:eP(c)&&(i[h]||(i[h]={}),t.serializeObjectProperty(c,i[h],0))}return i},t.deserializeTaggedProperties=function(e,i){for(var r,n=i.taggedProperties,s=e8(i),a=i.engine,o=eY(Object.keys(e));!(r=o()).done;){var u=r.value;if(!s[u]){var l=e[u];n[u]=t.deserializeProperty(l,a,0)}}for(var h,c=eY(Object.keys(s));!(h=c()).done;){var f=h.value,d=e[f];if(void 0!==d){var p=s[f].type;i[f]=t.deserializeProperty(d,a,0,p)}}i.fromData(n)},t.deserializeTaggedPropertiesAsync=function(e,r){return i(function(){var i,n,a,o,u,l,h,c,f,d,p,m;return s(this,function(s){switch(s.label){case 0:i=r.taggedProperties,n=e8(r),a=r.engine,o=eY(Object.keys(e)),s.label=1;case 1:if((u=o()).done)return[3,4];if(n[l=u.value])return[3,3];return h=e[l],[4,t.deserializePropertyAsync(h,a,0)];case 2:i[l]=s.sent(),s.label=3;case 3:return[3,1];case 4:c=eY(Object.keys(n)),s.label=5;case 5:if((f=c()).done)return[3,8];if(void 0===(p=e[d=f.value]))return[3,7];return m=n[d].type,[4,t.deserializePropertyAsync(p,a,0,m)];case 6:r[d]=s.sent(),s.label=7;case 7:return[3,5];case 8:return r.fromData(i),[2]}})})()},t.checkTypedArray=function(t){return r(t,Int8Array)||r(t,Uint8Array)||r(t,Uint8ClampedArray)||r(t,Int16Array)||r(t,Uint16Array)||r(t,Int32Array)||r(t,Uint32Array)||r(t,Float32Array)||r(t,Float64Array)||r(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(eP(t)&&1===Object.keys(t).length&&"id"in t&&eM(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return eP(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return eF(t)||r(t,HTMLImageElement)},t.deserializeProperty=function(e,i,r,n){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(eI(e)){for(var s,a=[],o=eY(e);!(s=o()).done;){var u=s.value;a.push(t.deserializeProperty(u,i,r+1,n))}return a}if(t.checkDataPath(e))return i.assetLoader.loadGUID(e.id);if(!eP(e)||e.constructor!==Object)return e;l=n?new n:{};for(var l,h,c=eY(Object.keys(e));!(h=c()).done;){var f=h.value;l[f]=t.deserializeProperty(e[f],i,r+1)}return l},t.deserializePropertyAsync=function(e,r,n,a){return i(function(){var i,o,u,l,h,c,f,d,p;return s(this,function(s){switch(s.label){case 0:if(n>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!eI(e))return[3,5];i=[],o=eY(e),s.label=1;case 1:if((u=o()).done)return[3,4];return l=u.value,h=i.push,[4,t.deserializePropertyAsync(l,r,n+1,a)];case 2:h.apply(i,[s.sent()]),s.label=3;case 3:return[3,1];case 4:return[2,i];case 5:if(!t.checkDataPath(e))return[3,7];return[4,r.assetLoader.loadGUIDAsync(e.id)];case 6:return[2,s.sent()];case 7:if(!eP(e)||e.constructor!==Object)return[2,e];for(c=a?new a:{},f=eY(Object.keys(e));!(d=f()).done;)c[p=d.value]=t.deserializeProperty(e[p],r,n+1);return[2,c];case 8:return[2]}})})()},t.serializeObjectProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i={});for(var n,s=eY(Object.keys(e));!(n=s()).done;){var a=n.value,o=e[a];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[a]=o:eI(o)?(i[a]||(i[a]=[]),t.serializeArrayProperty(o,i[a],r+1)):e7.is(o)?i[a]={id:o.getInstanceId()}:eP(o)&&(i[a]||(i[a]={}),t.serializeObjectProperty(o,i[a],r+1))}},t.serializeArrayProperty=function(e,i,r){if(r>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}i||(i=[]);for(var n=0;n<e.length;n++){var s=e[n];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?i[n]=s:eI(s)?(i[n]||(i[n]=[]),t.serializeArrayProperty(s,i[n],r+1)):e7.is(s)?i[n]={id:s.getInstanceId()}:eP(s)&&(i[n]||(i[n]={}),t.serializeObjectProperty(s,i[n],r+1))}},t}(),aR=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){if(this.engine.objectInstance[e])return this.engine.objectInstance[e];var i,r=this.findData(e);if(!r){console.error("Object data with uuid: "+e+" not found.");return}switch(r.dataType){case tZ.Material:i=rn.create(this.engine);break;case tZ.Geometry:i=r9.create(this.engine);break;case tZ.Texture:i=i2.create(this.engine);break;default:var n=t.getClass(r.dataType);n&&(i=new n(this.engine))}if(!i){console.error("Constructor for DataType: "+r.dataType+" not found.");return}return i.setInstanceId(r.id),this.engine.addInstance(i),a_.deserializeTaggedProperties(r,i),i},e.loadGUIDAsync=function(e){var r=this;return i(function(){var i,n,a;return s(this,function(s){switch(s.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("Object data with uuid: "+e+" not found."),[2,void 0];return[4,r.engine.database.loadGUID(e)];case 1:if(!(i=s.sent()))return console.error("Disk data with uuid: "+e+" not found."),[2,void 0];return r.engine.addInstance(i),[2,i];case 2:switch(n.dataType){case tZ.Material:i=rn.create(r.engine);break;case tZ.Geometry:i=r9.create(r.engine);break;case tZ.Texture:i=i2.create(r.engine);break;default:(a=t.getClass(n.dataType))&&(i=new a(r.engine))}if(!i)return console.error("Constructor for DataType: "+n.dataType+" not found."),[2,void 0];return i.setInstanceId(n.id),r.engine.addInstance(i),[4,a_.deserializeTaggedPropertiesAsync(n,i)];case 3:return s.sent(),[2,i]}})})()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return e5[t]},t}(),aO=function(){function t(){}return t.prototype.loadGUID=function(t){return i(function(){return s(this,function(t){return[2,void 0]})})()},t}();function aw(t,e){if(!t.includes(e))return t.push(e),!0}function aM(t){if(Number.isFinite(t))return[tI.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===tI.CONSTANT)return[tI.CONSTANT,t[1]];if("lines"===e)return[tI.LINE,t[1]];if(e===tI.LINE){var r=i.map(function(t){return[tL.LINE,t]});return[tI.BEZIER_CURVE,r]}return"curve"===e||e===tI.CURVE?[tI.BEZIER_CURVE,aj(i)]:t}}function aI(t,e){return Array.isArray(t)&&"random"===t[0]?[tI.CONSTANT,t[1][e]]:aM(t)}function aL(t){return t&&"color"===t[0]?aV(t[1],!0):[1,1,1,1]}function aP(t){return t&&"random"===t[0]?[tI.RANDOM,t[1]]:aM(t)}function aF(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach(function(r){var n,s=(n=/^(-)?([\d+.]+)%$/.exec(r))?+n[2]/100*(n[1]?-1:1):+r,a=aV(t[r],e);i.push([s,a[0],a[1],a[2],a[3]])}),i=i.sort(function(t,e){return t[0]-e[0]}),[tI.GRADIENT_COLOR,i]}}function aV(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var n=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(n){var s=+n[4];i=[+n[1],+n[2],+n[3],isNaN(s)?255:Math.round(255*s)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16),255])}else r(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=aN(i)),i}function aN(t){if(Array.isArray(t))return t.map(function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0})}function aD(t,e){return Array.isArray(t)?t[0]===tI.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&aF(t[1],e):aF(t,e)}function az(t){if(t){if(3===t.length)return[tI.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===tI.BEZIER_PATH||e===tI.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],s=i[2],a=aj(r);if(!s){s=[];for(var o=0;o<n.length;o++){var u=n[o].slice();0===o||o<n.length-1&&s.push(u),s.push(u)}}return[tI.BEZIER_CURVE_PATH,[a,n,s]]}return t}}function aU(t){for(var e,i=eY(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function ak(t){for(var e,i=eY(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var aB=Math.cos,aG=Math.sin,aX=Math.PI/180,aH=180/Math.PI;function aY(t,e){return t?[t[0]-.5,.5-t[1]]:e?aW[e]:[0,0]}var aW=((t8={})[tC.PARTICLE_ORIGIN_CENTER]=[0,0],t8[tC.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],t8[tC.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],t8[tC.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],t8[tC.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],t8[tC.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],t8[tC.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],t8[tC.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],t8[tC.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],t8);function aj(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],s=0;s<t.length-1;s++){var a=t[s][3]*(e-i),o=t[s+1][2]*(e-i),u=[t[s][0],t[s][1]],l=[t[s+1][0],t[s+1][1]];if(u[0]!=l[0]){var h=function(t,e,i,r){var n=i[0],s=i[1],a=r[0],o=r[1],u=a-n;return[[n+(a-n)/3,s+(t*=u)/3],[a-(a-n)/3,o-(e*=u)/3]]}(a,o,u,l),c=h[0],f=h[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],l[0],l[1]])}else n[n.length-1].push(l[0]),n[n.length-1].push(l[1])}return n.map(function(t,e){return 0===e?[tL.EASE_OUT,t]:e===n.length-1?[tL.EASE_IN,t]:[tL.EASE,t]})}function aZ(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},s={path:az(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:aM(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:aM(n.linearX),linearY:aM(n.linearY),linearZ:aM(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:aM(n.orbitalX),orbitalY:aM(n.orbitalY),orbitalZ:aM(n.orbitalZ),speedOverLifetime:aM(n.speedOverLifetime)};ak(s);var a={options:{startColor:aL(r.startColor)},positionOverLifetime:s};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var o=t.rotationOverLifetime;if(o){var u=a.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=aM(o.x),u.y=aM(o.y),u.z=aM(o.z)):u.z=aM(o.angularVelocity)}var l=t.colorOverLifetime;if(l){var h=a.colorOverLifetime={opacity:aM(l.opacity)};l.color&&(h.color=aD(l.color))}var c=t.sizeOverLifetime;return c&&(a.sizeOverLifetime={separateAxes:c.separateAxes,size:aM(c.size),x:aM(c.x),y:aM(c.y),z:aM(c.z)}),a}function aq(t){return t.compositions.forEach(function(t){t.items.forEach(function(t){t.type===tA.null&&t.endBehavior===tP.destroy&&(t.endBehavior=tP.freeze)})}),t.version="2.1",t}function aK(t){for(var e,i=iz({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),r=eY(i.images);!(e=r()).done;)e.value.id=eD();if(null!=i.textures||(i.textures=[]),i.textures.forEach(function(t){t.id=eD(),t.dataType=tZ.Texture,t.source={id:i.images[t.source].id}}),i.textures.length<i.images.length)for(var n=i.textures.length;n<i.images.length;n++)i.textures.push({id:eD(),dataType:tZ.Texture,source:{id:i.images[n].id},flipY:!0});t.bins&&(s=t.bins,i.bins=s.map(function(t){return{url:t.url,dataType:"BinaryAsset",id:eD()}}));for(var s,a,o={},u={},l=eY(t.compositions);!(a=l()).done;)!function(){var t=a.value;(t.endBehavior===tw.pause_destroy||t.endBehavior===tw.pause)&&(t.endBehavior=4),t.items=t.items.filter(function(t){return"8"!==t.type}),t.items.forEach(function(t){t.type===tA.particle&&t.content.filter&&delete t.content.filter});for(var e,r=eY(t.items);!(e=r()).done;){var n=e.value;o[n.id]=eD(),n.oldId=n.id,n.id=o[n.id],u[n.id]=n}t.items.forEach(function(e,r){if(e.parentId){if(e.parentId.includes("^")){var n=e.parentId.split("^")[0],s=e.parentId.split("^")[1];e.parentId=o[n]+"^"+s}else e.parentId=o[e.parentId]}i.items.push(e),t.items[r]={id:e.id}});var s=iz({},t,{timelineAsset:{id:""},sceneBindings:[]});i.compositions.push(s),function(t,e,i){for(var r,n=[],s=[],a=[],o={tracks:[],id:eD(),dataType:"TimelineAsset"},u=eY(t.items);!(r=u()).done;){var l=e[r.value.id],h=[],c={id:eD(),dataType:"ActivationPlayableAsset"};a.push(c);var f={id:eD(),dataType:"ActivationTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehaviour:l.endBehavior,asset:{id:c.id}}]};if(h.push({id:f.id}),s.push(f),l.type!==tA.particle){var d={id:eD(),dataType:"TransformPlayableAsset",sizeOverLifetime:l.content.sizeOverLifetime,rotationOverLifetime:l.content.rotationOverLifetime,positionOverLifetime:l.content.positionOverLifetime};a.push(d);var p={id:eD(),dataType:"TransformTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehaviour:l.endBehavior,asset:{id:d.id}}]};h.push({id:p.id}),s.push(p)}if(l.type===tA.sprite){var m={id:eD(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:l.content.colorOverLifetime,startColor:l.content.options.startColor};a.push(m);var v={id:eD(),dataType:"SpriteColorTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehaviour:l.endBehavior,asset:{id:m.id}}]};h.push({id:v.id}),s.push(v)}if(l.type===tA.composition){var y={id:eD(),dataType:"SubCompositionPlayableAsset"};a.push(y);var g={id:eD(),dataType:"SubCompositionTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehaviour:l.endBehavior,asset:{id:y.id}}]};h.push({id:g.id}),s.push(g)}var x={id:eD(),dataType:"ObjectBindingTrack",children:h,clips:[]};s.push(x),o.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:l.id}})}for(var T,E=[],b=eY(s);!(T=b()).done;){var A=T.value;E.push({id:A.id})}t.timelineAsset={id:o.id},t.sceneBindings=n,i.miscs.push(o);for(var S,C=eY(s);!(S=C()).done;){var _=S.value;i.miscs.push(_)}for(var R,O=eY(a);!(R=O()).done;){var w=R.value;i.miscs.push(w)}}(s,u,i)}();for(var h,c=eY(i.items);!(h=c()).done;){var f=h.value;if(f.content){if(f.content.renderer&&void 0!==f.content.renderer.texture){var d=f.content.renderer.texture;f.content.renderer.texture={id:i.textures[d].id}}if(f.content.trails&&void 0!==f.content.trails.texture){var p=f.content.trails.texture;f.content.trails.texture={id:i.textures[p].id}}}if(f.transform){var m=[].concat(null!=(g=f.transform.position)?g:[0,0,0]),v=[].concat(null!=(x=f.transform.rotation)?x:[0,0,0]),y=[].concat(null!=(T=f.transform.scale)?T:[1,1,1]);if(Object.assign(f,{transform:{position:{x:m[0],y:m[1],z:m[2]},eulerHint:{x:v[0],y:v[1],z:v[2]},scale:{x:y[0],y:y[1],z:y[0]}}}),f.type===tA.sprite&&(f.transform.size={x:y[0],y:y[1]},f.transform.scale={x:1,y:1,z:1}),f.type===tA.sprite){var g,x,T,E,b,A,S,C=f.content;C.renderer||(C.renderer={});var _=C.renderer,R=aY(_.anchor,_.particleOrigin),O=f.transform.size;_.anchor||void 0===_.particleOrigin||(f.transform.position.x+=-R[0]*(null!=(E=null==O?void 0:O.x)?E:1),f.transform.position.y+=-R[1]*(null!=(b=null==O?void 0:O.y)?b:1)),f.transform.anchor={x:R[0]*(null!=(A=null==O?void 0:O.x)?A:1),y:R[1]*(null!=(S=null==O?void 0:O.y)?S:1)}}}if(f.type===tA.particle){var w=f.content;w.renderer||(w.renderer={});var M=w.renderer;w.renderer.anchor=aY(M.anchor,M.particleOrigin)}f.type===tA.camera&&f.content.positionOverLifetime&&0!==Object.keys(f.content.positionOverLifetime).length&&(f.content.positionOverLifetime.asMovement=!0),f.content.tracks=[];var I=f.content.tracks;if(f.type!==tA.particle&&I.push({clips:[{id:eD(),dataType:"TransformPlayableAsset",sizeOverLifetime:f.content.sizeOverLifetime,rotationOverLifetime:f.content.rotationOverLifetime,positionOverLifetime:f.content.positionOverLifetime}]}),f.type===tA.sprite&&I.push({clips:[{id:eD(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:f.content.colorOverLifetime,startColor:f.content.options.startColor}]}),f.content.options.target&&(f.content.options.target=o[f.content.options.target]),void 0!==f.pn){var L=f.pn,P=t.plugins,F=void 0===P?[]:P;void 0!==L&&Number.isInteger(L)&&(f.pluginName=F[L])}switch("editor-gizmo"===f.pluginName&&(f.type="editor-gizmo"),"orientation-transformer"===f.pluginName&&(f.type="orientation-transformer"),f.type===tA.spine&&t.spines&&0!==t.spines.length&&function(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map(function(t){return{id:i.textures[t].id}})}}(t.spines[f.content.options.spine],f.content,i),(f.type===tA.sprite||f.type===tA.particle||f.type===tA.mesh||f.type===tA.skybox||f.type===tA.light||"camera"===f.type||f.type===tA.tree||f.type===tA.interact||f.type===tA.camera||f.type===tA.text||f.type===tA.spine||"editor-gizmo"===f.type||"orientation-transformer"===f.type)&&(f.components=[],i.components.push(f.content),f.content.id=eD(),f.content.item={id:f.id},f.dataType=tZ.VFXItemData,f.components.push({id:f.content.id})),(f.type===tA.null||f.type===tA.composition)&&(f.components=[],f.dataType=tZ.VFXItemData),f.type){case tA.sprite:f.content.dataType=tZ.SpriteComponent;break;case tA.particle:f.content.dataType=tZ.ParticleSystem;break;case tA.mesh:f.content.dataType=tZ.MeshComponent;break;case tA.skybox:f.content.dataType=tZ.SkyboxComponent;break;case tA.light:f.content.dataType=tZ.LightComponent;break;case"camera":f.content.dataType=tZ.CameraComponent;break;case"editor-gizmo":f.content.dataType="GizmoComponent";break;case"orientation-transformer":f.content.dataType="OrientationComponent";break;case tA.tree:f.content.dataType=tZ.TreeComponent;break;case tA.interact:f.content.dataType=tZ.InteractComponent;break;case tA.camera:f.content.dataType=tZ.CameraController;break;case tA.text:f.content.dataType=tZ.TextComponent;break;case tA.spine:f.content.dataType="SpineComponent"}}return i.version="3.0",i}var aQ=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,aJ=/^(\d+)\.(\d+)$/,a$=!1;function a0(t){if(!t||"object"!=typeof t)throw Error("Invalid input: Expected a JSON object.");if(!(c=null==(h=(l=t).version)?void 0:h.split("."))||Number(c[0])>2||2===Number(c[0])&&Number(c[1])>=2||l.compositions.forEach(function(t){t.items.forEach(function(t){(t.type===tA.mesh||t.type===tA.light)&&(t.endBehavior=1===t.endBehavior?tP.destroy:t.endBehavior)})}),aQ.test(t.version)){var e,i,r,n,s,a,o,u;return a$=(null==(f=/^(\d+)/.exec(t.version))?void 0:f[0])==="0",aK(aq((a1="1.0",n=(e=t).plugins||[],(null==(i=e.bins)?void 0:i.length)&&(a1="1.3"),s=(e.requires||[]).slice(),a=e.images.map(function(t,i){return a2(t,i,e.imageTags||[])}),o=e.textures||a.map(function(t,e){return{source:e,flipY:!0}}),u={plugins:n,shapes:e.shapes||[],type:"ge",version:a1,playerVersion:null!=(r=e.playerVersion)?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map(function(t){return a3(t,{plugins:n,requires:s})}),images:a,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:o,bins:(e.bins||[]).slice()},e._textures&&(u._textures=e._textures),u)))}var l,h,c,f,d,p=aJ.exec(t.version)||[],m=Number(p[1]),v=Number(p[2]);if(m)return(m<2||2===m&&v<4)&&((d=t).compositions.map(function(t){for(var e,i=eY(t.items);!(e=i()).done;)(function t(e){if(e)for(var i,r=eY(Object.keys(e));!(i=r()).done;){var n=i.value,s=e[n],a=Array.isArray(s);a&&2===s.length&&Array.isArray(s[1])?"path"===n?e[n]=az(s):e[n]=aM(s):a||"object"!=typeof s||t(s)}})(e.value.content)}),t=d),m<3?aK(aq(t)):t;throw Error("Invalid JSON version: "+t.version+".")}var a1="1.0";function a2(t,e,i){var r=i[e],n=t.oriY;if("string"==typeof t)return{id:eD(),renderLevel:r,url:t,oriY:n};if(t.template)return{id:eD(),url:t.url,template:t.template,webp:t.webp,renderLevel:r,oriY:n};if(t.compressed)return{id:eD(),url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:eD(),url:t.url,webp:t.webp,renderLevel:r,oriY:n};if(t&&t.sourceType)return t;throw Error("Invalid image type.")}function a3(t,e){void 0===e&&(e={});var i,r={id:t.id+"",camera:iz({clipMode:0},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map(function(t){return a5(t,e)}),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var s=null==(i=t.meta)?void 0:i.previewSize;return s&&s[0]===s[1]&&0===s[0]&&(s=void 0),s&&(r.previewSize=s),r}var a4=[0,0,0,1];function a5(t,e){void 0===e&&(e={});var i=tA.base,r=t.endBehavior,n=NaN;if(t.content?(i=t.type||tA.plugin,m=t.pn,p=t.pluginName,f=t.content,c=t.content,isNaN(m)&&!p&&(p=f.options.type),t.duration&&(n=t.duration),h=t.transform||T(c.transform)):t.particle?(i=tA.particle,h=T((c=t.particle).transform,a$,!0),f=function(t){var e=t.options,i=t.transform,r={type:tx.NONE};if(t.shape){var n,s=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=iz({},t.shape,{type:tx[s]}),t.shape.upDirection){var a=t.shape.upDirection,o=a[0],u=a[1],l=a[2];0===o&&0===u&&0===l&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=aP(e.turbulenceX),r.turbulenceY=aP(e.turbulenceY),r.turbulenceZ=aP(e.turbulenceZ));var h=t.emission;h.bursts&&h.bursts.length>0&&(h.bursts=h.bursts.map(function(t){return aU(t)})),h.burstOffsets&&h.burstOffsets.length>0&&(h.burstOffsets=h.burstOffsets.map(function(t){return aU(t)})),h.rateOverTime&&(h.rateOverTime=aP(h.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:h,options:{startLifetime:aP(e.startLifetime),start3DSize:!!e.start3DSize,startSize:aP(e.startSize),startSizeX:aP(e.startSizeX),startSizeY:aP(e.startSizeY),sizeAspect:aP(e.sizeAspect),maxCount:e.maxCount,startDelay:aP(e.startDelay),startColor:function(t,e){if(t)return"colors"===t[0]?[tI.COLORS,t[1].map(function(t){return aV(t,e)})]:"gradient"===t[0]?aF(t[1],e):"color"===t[0]?[tI.RGBA_COLOR,aV(t[1],e)]:t}(e.startColor,!0),startRotationZ:aP(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=aP(e.startRotationX),c.options.startRotationY=aP(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:az(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:aP(f.x),y:aP(f.y)}:c.sizeOverLifetime={size:aP(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?aM(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:aM(e.gravityModifier),startSpeed:aP(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:aP(d.linearX),linearY:aP(d.linearY),linearZ:aP(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:aP(d.orbitalX),orbitalY:aP(d.orbitalY),orbitalZ:aP(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:aM(d.forceCurve)},ak(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:aP(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=aM(m.y),c.rotationOverLifetime.x=aM(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:aM(v.opacity)};v.color&&(y.color=aD(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:aM(g.cycles),animationDelay:aI(g.animationDelay,0),animationDuration:aI(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:aP(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:aM(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&aD(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&aD(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:aP(x.opacityOverLifetime)}),c.trails&&ak(c.trails);var T=t.interaction;return T&&(c.interaction={behavior:T.behavior,radius:T.radius,multiple:T.multiple}),c}(c)):t.sprite?(i=tA.sprite,h=T((c=t.sprite).transform,!1,!0),o=aZ(a=c,h),(u=a.textureSheetAnimation)&&(o.textureSheetAnimation={row:u.row,col:u.col,total:u.total||void 0,animate:u.animate}),o.renderer=a.renderer,a.splits&&(o.splits=a.splits),a.interaction&&(o.interaction=a.interaction),f=o):t.cal?(i=tA.null,h=T((c=t.cal).transform,!1,!0),f=aZ(c,h)):t.ui?(i=tA.interact,h=T((c=t.ui).transform),f=function(t){var e,i=t.options;switch(i.type){case"click":e={type:tE.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&aL(i.previewColor),behavior:i.behavior||tb.NOTIFY};break;case"drag":e={type:tE.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:tE.MESSAGE}}return{options:e}}(c),h.scale=[c.options.width||1,c.options.height||1,1]):t.model&&(c=t.model,1===t.model.options.type&&(i=tA.camera,h=T(c.transform),f=function(t){var e=t.options,i={options:{fov:e.fov,far:e.far,near:e.near,clipMode:e.clipMode}},r=t.velocityOverLifetime;if(r||(null==(n=t.transform)?void 0:n.path)){var n,s,a={path:az(null==(s=t.transform)?void 0:s.path),linearX:aM(null==r?void 0:r.translateX),linearY:aM(null==r?void 0:r.translateY),linearZ:aM(null==r?void 0:r.translateZ)};ak(a),i.positionOverLifetime=a}var o=t.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:aM(null==o?void 0:o.rotateX),y:aM(null==o?void 0:o.rotateY),z:o.separateAxes?aM(null==o?void 0:o.rotateZ):aM(o.rotation)};ak(u),i.rotationOverLifetime=u}return i}(c))),null==(l=f.renderer)?void 0:l.anchor){var s=new Float32Array(f.renderer.anchor);.5==s[0]&&.5==s[1]?delete f.renderer.anchor:e.requires&&aw(e.requires,"anchor")}if(c){var a,o,u,l,h,c,f,d,p,m,v,y,g=null==(v=c.options)?void 0:v.looping;r=g?Array.isArray(g)?g[1]?tP.loop:tP.destroy:tP.loop:r||(null==c?void 0:null==(y=c.options)?void 0:y.endBehavior)||tP.destroy,c.options.renderLevel&&(d=c.options.renderLevel),isNaN(n)&&(n=c.options.duration)}var x={type:i,name:t.name,delay:t.delay,duration:n,id:t.id+"",transform:h,endBehavior:r,renderLevel:d,content:f};return p?e.plugins?(aw(e.plugins,p),x.pn=e.plugins.indexOf(p)):x.pluginName=p:Number.isInteger(m)&&(x.pn=m),t.parentId&&(x.parentId=t.parentId+""),x;function T(t,e,i){if(t){var r={},n=t.rotation;if(n&&(e?r.rotation=[-n[0],-n[1],-n[2]]:r.rotation=[n[0],n[1],n[2]],i)){var s,a,o,u,l,h,c,f,d,p,m,v,y,g,x,T,E,b,A,S,C,_,R,O,w=(s=r.rotation[0],a=r.rotation[1],o=r.rotation[2],u=aB(s*aX/2),l=aB(a*aX/2),h=aB(o*aX/2),c=aG(s*aX/2),f=aG(a*aX/2),d=aG(o*aX/2),a4[0]=c*l*h+u*f*d,a4[1]=u*f*h-c*l*d,a4[2]=u*l*d+c*f*h,a4[3]=u*l*h-c*f*d,a4);r.rotation=(p=[],m=w[0],v=w[1],y=w[2],g=w[3],x=m+m,T=v+v,E=y+y,b=m*x,A=v*x,S=v*T,C=y*E,_=g*E,R=y*x-g*T,p[1]=Math.asin((O=-R)>1?1:O<-1?-1:O)*aH,.9999999>Math.abs(R)?(p[0]=Math.atan2(y*T+g*x,1-b-S)*aH,p[2]=Math.atan2(A+_,1-S-C)*aH):(p[0]=0,p[2]=Math.atan2(-(A-_),1-b-C)*aH),p)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}return{}}}var a6=((t9={})[tm.S]=[tm.S,tm.BPlus,tm.APlus],t9[tm.A]=[tm.A,tm.BPlus,tm.APlus],t9[tm.B]=[tm.B,tm.BPlus],t9);function a8(t,e){if(!t||!e)return!0;var i=a6[e];return!!i&&i.includes(t)}function a9(t){return eP(t)&&"jsonScene"in t}function a7(t){return eP(t)&&"url"in t}function ot(t){return eP(t)&&"options"in t}function oe(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},s=n.name,a=n.url;return s&&(e&&e[s]?i=e[s]:a&&(i=a)),i}function oi(t,e,i){return or.apply(this,arguments)}function or(){return(or=i(function(t,e,i){var r,n,a,o;return s(this,function(s){switch(s.label){case 0:if("string"!=typeof t)return[3,2];return[4,iX(t)];case 1:return r=s.sent(),[3,3];case 2:r=t,s.label=3;case 3:if(!r)throw Error("Image not provided.");if(!e)return[2,r];if(n=r,!((a=oe(e,i))&&eM(a)&&a!==r.src))return[3,7];if(!eM(a))return[3,5];return[4,iX(a)];case 4:return o=s.sent(),[3,6];case 5:o=a,s.label=6;case 6:n=o,s.label=7;case 7:return[2,n]}})})).apply(this,arguments)}var on=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e}(e7),os=1,oa=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new iU),this.options=t,this.downloader=e,this.assets={},this.id=os++,this.timers=[],this.updateOptions(t)}var n=e.prototype;return n.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},n.updateSceneData=function(t){var e=this.options.variables;e&&0!==Object.keys(e).length&&t.forEach(function(t){if(t.type===tA.text){var i=e[t.name];i&&(t.content.options.text=i)}})},n.loadScene=function(e,n,a){var o=this;return i(function(){var u,l,h,c,f,d,p,m,v,y,g,x,T,E;return s(this,function(b){return h=eM(e)?e:o.id,c=performance.now(),f=[],m=null!=(p=null==(d=null==n?void 0:n.engine.gpuCapability)?void 0:null==(u=d.detail)?void 0:u.asyncShaderCompile)&&p,y=null!=(v=null==d?void 0:d.detail.compressedTexture)?v:t.COMPRESSED_TEXTURE.NONE,x=!1,T=new Promise(function(t,e){g=window.setTimeout(function(){x=!0,o.removeTimer(g),e(Error("Load time out: totalTime: "+(performance.now()-c).toFixed(4)+"ms "+f.join(" ")+", url: "+h+"."))},1e3*o.timeout),o.timers.push(g)}),E=i(function(t,e){var i,r;return s(this,function(n){switch(n.label){case 0:if(x)return[3,4];i=performance.now(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e()];case 2:return r=n.sent(),f.push("["+t+": "+(performance.now()-i).toFixed(2)+"]"),[2,r];case 3:throw Error("Load error in "+t+", "+n.sent()+".");case 4:throw Error("Load canceled.")}})}),[2,Promise.race([T,i(function(){var t,i,u,d,p,v,x,T,b,A,S,C,_,R,O,w,M,I,L,P,F;return s(this,function(s){switch(s.label){case 0:if(!eP(e))return[3,1];return l=e,o.baseUrl=location.href,[3,3];case 1:return e=new URL(e,location.href).href,o.baseUrl=e,[4,E("loadJSON",function(){return o.loadJSON(e)})];case 2:l=s.sent(),s.label=3;case 3:if(!a9(l))return[3,6];if(t=iz({},l),!(o.options&&o.options.variables&&0!==Object.keys(o.options.variables).length))return[3,5];for(d=0,i=l.jsonScene.images,u=t.images;d<i.length;d++)r(u[d],HTMLCanvasElement)&&(u[d]=i[d]);return[4,E("processImages",function(){return o.processImages(u,y)})];case 4:for(p=0,t.images=s.sent();p<t.images.length;p++)t.textureOptions[p].image=t.images[p];o.updateSceneData(t.jsonScene.items),s.label=5;case 5:return[3,12];case 6:return[4,E("processJSON",function(){return o.processJSON(l)})];case 7:return x=(v=s.sent()).usedImages,T=v.jsonScene,b=v.pluginSystem,S=void 0===(A=T.bins)?[]:A,C=T.images,_=T.compositions,R=T.fonts,[4,Promise.all([E("processBins",function(){return o.processBins(S)}),E("processImages",function(){return o.processImages(C,y)}),E((m?"async":"sync")+" compile",function(){return o.precompile(_,b,n,a)})])];case 8:if(w=(O=s.sent())[0],M=O[1],n)for(I=0;I<C.length;I++)(L=new on(n.engine)).data=M[I],L.setInstanceId(C[I].id),n.engine.addInstance(L);return[4,E("processFontURL",function(){return o.processFontURL(R)})];case 9:return s.sent(),[4,E("processTextures",function(){return o.processTextures(M,w,T,n.engine)})];case 10:return P=s.sent(),o.updateSceneData(T.items),t={url:e,renderLevel:o.options.renderLevel,storage:{},pluginSystem:b,jsonScene:T,usedImages:x,images:M,textureOptions:P,bins:w},[4,E("processPlugins",function(){return b.loadResources(t,o.options)})];case 11:s.sent(),s.label=12;case 12:return F=performance.now()-c,eO.info("Load asset: totalTime: "+F.toFixed(4)+"ms "+f.join(" ")+", url: "+h+"."),window.clearTimeout(g),o.removeTimer(g),t.totalTime=F,t.startTime=c,[2,t]}})})()])]})})()},n.precompile=function(t,e,r,n){return i(function(){var i;return s(this,function(s){switch(s.label){case 0:if(!r||!r.getShaderLibrary())return[2];return i=null==r?void 0:r.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,r,n)];case 1:return s.sent(),[4,new Promise(function(t){null==i||i.compileAllShaders(function(){t(null)})})];case 2:return s.sent(),[2]}})})()},n.processJSON=function(t){var e=this;return i(function(){var i,r,n,a,o,u,l,h,c;return s(this,function(s){switch(s.label){case 0:return i=a0(t),t.compositions.forEach(function(t,e){t.globalVolume&&(i.compositions[e].globalVolume=t.globalVolume)}),n=void 0===(r=i.plugins)?[]:r,a=i.compositions,o=i.imgUsage,u=i.images,[4,(l=new aS(n)).processRawJSON(i,e.options)];case 1:return s.sent(),h=e.options.renderLevel,c={},o?function(t,e,i,r,n){for(var s=0;s<e.length;s++){var a=i[e[s].id];if(a)for(var o=0;o<a.length;o++){var u=a[o];a8(r[u].renderLevel,n)&&(t[u]=!0)}}}(c,a,o,u,h):null==u||u.forEach(function(t,e){c[e]=!0}),[2,{usedImages:c,jsonScene:i,pluginSystem:l}]}})})()},n.processBins=function(t){var e=this;return i(function(){var i,n;return s(this,function(s){return i=e.options.renderLevel,n=e.baseUrl,[2,Promise.all(t.map(function(s){if(r(s,ArrayBuffer))return s;if(a8(s.renderLevel,i))return e.loadBins(new URL(s.url,n).href);throw Error("Invalid bins source: "+JSON.stringify(t)+".")}))]})})()},n.processFontURL=function(t){var r=this;return i(function(){return s(this,function(n){return t?[2,Promise.all(t.map(i(function(t){var i,n,a;return s(this,function(s){switch(s.label){case 0:if(!(t.fontURL&&!e.fonts.has(t.fontFamily)))return[3,4];e_(t.fontFamily)||console.warn("Risky font family: "+t.fontFamily+"."),s.label=1;case 1:return s.trys.push([1,3,,4]),i=new URL(t.fontURL,r.baseUrl).href,[4,(a=new FontFace(null!=(n=t.fontFamily)?n:"","url("+i+")")).load()];case 2:return s.sent(),document.fonts.add(a),e.fonts.add(t.fontFamily),[3,4];case 3:return s.sent(),eO.warn("Invalid font family or font source: "+JSON.stringify(t.fontURL)+"."),[3,4];case 4:return[2]}})})))]:[2]})})()},n.processImages=function(e,n){void 0===n&&(n=0);var a=this;return i(function(){var o,u,l,h;return s(this,function(c){return u=(o=a.options).useCompressedTexture,l=o.variables,h=a.baseUrl,[2,Promise.all(e.map(i(function(e,i){var o,c,f,d,p,m,v,y,g,x,T,E,b,A,S,C,_;return s(this,function(s){switch(s.label){case 0:if(o=e.url,c=e.webp,f=new URL(o,h).href,d=c&&new URL(c,h).href,!("template"in e))return[3,8];if(!(m=(p=e.template).background))return[3,7];v=oe(p,l),y=m.type===tM.video,g=m&&y?iZ:iX,s.label=1;case 1:return s.trys.push([1,6,,7]),[4,iK(v,g)];case 2:if(!r(x=s.sent(),HTMLVideoElement))return[3,3];return[2,x];case 3:return m&&Array.isArray(v)&&l&&(l[m.name]=x.src),[4,oi(x,p,l)];case 4:return[2,s.sent()];case 5:return[3,7];case 6:throw T=s.sent(),Error("Failed to load. Check the template or if the URL is "+(y?"video":"image")+" type, URL: "+v+", Error: "+T.message+".");case 7:return[3,9];case 8:if("compressed"in e&&u&&n){if(E=e.compressed,n===t.COMPRESSED_TEXTURE.ASTC?b=E.astc:n===t.COMPRESSED_TEXTURE.PVRTC&&(b=E.pvrtc),b)return A=new URL(b,h).href,a.assets[i]={url:A,type:t.TextureSourceType.compressed},[2,a.loadBins(A)]}else if("sourceType"in e)return[2,e];else if(r(e,HTMLImageElement)||r(e,HTMLCanvasElement)||r(e,HTMLVideoElement)||r(e,i2))return[2,e];s.label=9;case 9:return[4,iB(f,d)];case 10:return C=(S=s.sent()).url,_=S.image,a.assets[i]={url:C,type:t.TextureSourceType.image},[2,_]}})})))]})})()},n.processTextures=function(e,n,a,o){var u=this;return i(function(){var l;return s(this,function(h){return[2,Promise.all((null!=(l=a.textures)?l:e.map(function(t,e){return{source:e}})).map(i(function(e,i){var l,h,c;return s(this,function(s){switch(s.label){case 0:if(r(e,i2))return[2,e];if(!("mipmaps"in e))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,iJ(e,n,o,a.bins)];case 2:return[2,s.sent()];case 3:throw Error("Load texture "+i+" fails, error message: "+s.sent()+".");case 4:if(!eP(l=e.source))return[3,5];return h=o.assetLoader.loadGUID(l.id).data,[3,7];case 5:if("string"!=typeof l)return[3,7];return[4,iX(ez(l))];case 6:h=s.sent(),s.label=7;case 7:if(h)return(c=function(e,i){if(r(e,i2))return e.source;if(r(e,HTMLImageElement)||eF(e))return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:iR.LINEAR,magFilter:iR.LINEAR};if(r(e,HTMLVideoElement))return{sourceType:t.TextureSourceType.video,video:e,minFilter:iR.LINEAR,magFilter:iR.LINEAR};if(r(e,ArrayBuffer))return iz({},i9(e),{sourceFrom:i});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:iR.CLAMP_TO_EDGE,wrapT:iR.CLAMP_TO_EDGE,minFilter:iR.NEAREST,magFilter:iR.NEAREST};throw Error("Invalid texture options.")}(h,u.assets[i])).id=e.id,c.dataType=tZ.Texture,[2,c.sourceType===t.TextureSourceType.compressed?c:iz({},c,e)];throw Error("Invalid texture source: "+l+".")}})})))]})})()},n.loadJSON=function(t){var e=this;return i(function(){return s(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadJSON(t,i,function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},n.loadBins=function(t){var e=this;return i(function(){return s(this,function(i){return[2,new Promise(function(i,r){e.downloader.downloadBinary(t,i,function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)})})]})})()},n.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},n.dispose=function(){for(var t in this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets){var e,i=this.assets[t];null==i||null==(e=i.dispose)||e.call(i)}this.assets={},this.timers=[]},e}();oa.fonts=new Set;var oo=new eJ(1,1,1),ou=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=e0.fromIdentity(),this.projectionMatrix=e0.fromIdentity(),this.viewProjectionMatrix=e0.fromIdentity(),this.inverseViewMatrix=e0.fromIdentity(),this.dirty=!0;var i=e.near,r=e.far,n=e.fov,s=e.aspect,a=e.clipMode,o=void 0===a?tO.portrait:a,u=e.position,l=e.rotation;this.options={near:void 0===i?.1:i,far:void 0===r?20:r,fov:void 0===n?60:n,aspect:void 0===s?1:s,clipMode:o,position:eJ.fromArray(void 0===u?[0,0,8]:u),rotation:e1.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 eJ(0,0,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix(),n=i.projectPoint(e).z;return r.projectPoint(new eJ(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 e$;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},e.getOptions=function(){return this.options},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,s=t.aspect,a=t.position,o=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=s,this.position=a,this.rotation=o,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,i=t.aspect,r=t.near,n=t.far,s=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*eW,i,r,n,s===tO.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),oo),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.setRotationByQuat=function(t){n3.getRotation(t,this.options.rotation)},eB(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)}},{key:"rotation",get:function(){return this.options.rotation.clone()},set:function(t){this.options.rotation.equals(t)||(this.options.rotation.copyFrom(t),this.dirty=!0,this.options.quat=void 0)}}]),t}(),ol=0,oh=function(){function t(t,e){this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var i=t.jsonScene,r=t.renderLevel,n=t.textureOptions,s=t.pluginSystem,a=t.totalTime,o=i.compositions,u=i.imgUsage,l=i.compositionId;if(!n)throw Error("scene.textures expected.");for(var h,c=eY(o);!(h=c()).done;){var f=h.value;f.id===l?this.composition=f:this.refCompositions.set(f.id,f)}if(!this.composition)throw Error("Invalid composition id: "+l+".");this.jsonScene=i,this.renderLevel=r,this.pluginSystem=s,this.totalTime=null!=a?a:0,this.imgUsage=null!=u?u:{},this.textures=n,ol=0,this.sourceContent=this.getContent(this.composition)}var e=t.prototype;return e.getContent=function(t){var e=t.id,i=t.duration,r=t.name,n=t.endBehavior,s=t.camera,a=t.globalVolume,o=t.startTime,u=this.assembleItems(t);return iz({},t,{id:e,duration:i,name:r,endBehavior:isNaN(n)?1:n,items:u,camera:s,startTime:void 0===o?0:o,globalVolume:a})},e.assembleItems=function(t){var e=[];this.mask++;for(var i,r={},n=eY(this.jsonScene.components);!(i=n()).done;){var s=i.value;r[s.id]=s}for(var a,o=eY(t.items);!(a=o()).done;){var u=a.value,l=this.engine.jsonSceneData[u.id];if(a8(l.renderLevel,this.renderLevel)){if(l.listIndex=ol++,l.type===tA.sprite||l.type===tA.particle)for(var h,c=eY(l.components);!(h=c()).done;){var f=r[h.value.id];this.preProcessItemContent(f)}if(l.type===tA.composition){var d=l.content.options.refId;if(!this.refCompositions.get(d))throw Error("Invalid ref composition id: "+d+".");var p=this.getContent(this.refCompositions.get(d));this.refCompositionProps.has(d)||this.refCompositionProps.set(d,p),l.items=p.items}e.push(l)}}return e},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var e,i=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=sR(null==(e=this.jsonScene)?void 0:e.shapes[t.renderer.shape],i):t.renderer.shape&&eP(t.renderer.shape)&&(t.renderer.shape=sR(t.renderer.shape,i))}t.trails&&(t.trails=this.changeTex(t.trails))},e.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},e.addTextureUsage=function(t){var e,i=null!=(e=this.imgUsage)?e:{};t&&i&&(i.hasOwnProperty(t)||(i[t]=0),i[t]++)},e.processMask=function(t){var e=t.maskMode;e!==tg.NONE&&(t.mask||(e===tg.MASK?t.mask=++this.mask:e!==tg.OBSCURED&&e!==tg.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}(),oc=function(){function e(e,i){var r,n=this;this.speed=1,this.loaderData={},this.refContent=[],this.refCompositionProps=new Map,this.editorScaleRatio=1,this.assigned=!1,this.destroyed=!1,this.postLoaders=[],this.paused=!1,this.lastVideoUpdateTime=0;var s=e.reusable,a=void 0!==s&&s,o=e.speed,u=e.baseRenderOrder,l=e.renderer,h=e.onPlayerPause,c=e.onMessageItem,f=e.onEnd,d=e.event,p=e.width,m=e.height;this.compositionSourceManager=new oh(i,l.engine),i.jsonScene.imgUsage=void 0,a&&(this.keepResource=!0,i.textures=void 0,i.consumed=!0);var v=this.compositionSourceManager,y=v.sourceContent,g=v.pluginSystem,x=v.imgUsage,T=v.totalTime,E=v.refCompositionProps;eC(y),this.renderer=l,this.refCompositionProps=E,this.rootItem=new t.VFXItem(this.getEngine(),y),this.rootItem.name="rootItem",this.rootItem.composition=this,this.rootComposition=this.rootItem.addComponent(ac),this.rootComposition.data=y;var b=!a&&x;this.globalVolume=y.globalVolume,this.width=p,this.height=m,this.renderOrder=void 0===u?0:u,this.id=y.id,this.renderer=l,this.texInfo=null!=b?b:{},this.event=d,this.statistic={loadTime:null!=T?T:0,loadStart:null!=(r=i.startTime)?r:0,firstFrameTime:0},this.reusable=a,this.speed=void 0===o?1:o,this.autoRefTex=!this.keepResource&&b&&this.rootItem.endBehavior!==tP.loop,this.name=y.name,this.pluginSystem=g,this.pluginSystem.initializeComposition(this,i),this.camera=new ou(this.name,iz({},null==y?void 0:y.camera,{aspect:p/m})),this.url=i.url,this.assigned=!0,this.globalTime=0,this.onPlayerPause=h,this.onMessageItem=c,this.onEnd=f,this.createRenderFrame(),this.rendererOptions=null,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout(function(){null==n.onEnd||n.onEnd.call(n,n)},0)},this.pluginSystem.resetComposition(this,this.renderFrame)}var r=e.prototype;return r.getDuration=function(){return this.rootItem.duration},r.restart=function(){this.reset(),this.forwardTime(this.startTime)},r.setIndex=function(t){this.renderOrder=t},r.getIndex=function(){return this.renderOrder},r.setSpeed=function(t){this.speed=t},r.setVisible=function(t){this.items.forEach(function(e){e.setVisible(t)})},r.getSpeed=function(){return this.speed},r.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootComposition.started?this.gotoAndPlay(0):this.gotoAndPlay(this.time-this.startTime)},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.rootComposition.started||(this.rootComposition.start(),this.rootComposition.started=!0),this.forwardTime(t+this.startTime)},r.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},r.createRenderFrame=function(){this.renderFrame=new nS({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},r.setTime=function(t){var e=this.paused;e&&this.resume(),this.rootComposition.started||(this.rootComposition.start(),this.rootComposition.started=!0),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 i=1e3*t-1e3*this.rootComposition.time,r=i<0,n=Math.abs(i),s=r?-15:15;n>15;n-=15)this.update(s,e);this.update(r?-n:n,e)},r.reset=function(){this.rendererOptions=null,this.globalTime=0,this.rootItem.ended=!1,this.pluginSystem.resetComposition(this,this.renderFrame)},r.prepareRender=function(){var t=this,e=this.renderFrame;e._renderPasses[0].meshes.length=0,this.postLoaders.length=0,this.pluginSystem.plugins.forEach(function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)}),this.gatherRendererComponent(this.rootItem,e),this.postLoaders.forEach(function(i){return i.postProcessFrame(t,e)})},r.gatherRendererComponent=function(t,e){for(var i,r=eY(t.rendererComponents);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&e.addMeshToDefaultRenderPass(n)}for(var s,a=eY(t.children);!(s=a()).done;){var o=s.value;this.gatherRendererComponent(o,e)}},r.shouldRestart=function(){var t=this.rootItem,e=t.ended,i=t.endBehavior;return e&&i===tP.loop},r.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,i=t.endBehavior;return e&&(!i||3===i)},r.update=function(t,e){if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var i=this.getUpdateTime(t*this.speed);if(this.globalTime+=i,this.rootComposition.isActiveAndEnabled){var r=this.toLocalTime(this.globalTime/1e3);this.rootComposition.time=r}this.updateVideo(),this.updatePluginLoaders(t),this.callStart(this.rootItem),this.callUpdate(this.rootItem,i),this.callLateUpdate(this.rootItem,i),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},r.toLocalTime=function(t){var e=t-this.rootItem.start,i=this.rootItem.duration;return e-i>.001&&(this.rootItem.endBehavior===tP.loop?e%=i:this.rootItem.endBehavior===tP.freeze&&(e=Math.min(i,e))),e},r.getUpdateTime=function(t){var e=1e3*this.startTime,i=1e3*this.rootComposition.time;return t<0&&i+t<e?e-i:t},r.callStart=function(t){for(var e,i=eY(t.itemBehaviours);!(e=i()).done;){var r=e.value;r.isActiveAndEnabled&&!r.started&&(r.start(),r.started=!0)}for(var n,s=eY(t.rendererComponents);!(n=s()).done;){var a=n.value;a.isActiveAndEnabled&&!a.started&&(a.start(),a.started=!0)}for(var o,u=eY(t.children);!(o=u()).done;){var l=o.value;this.callStart(l)}},r.callUpdate=function(e,i){for(var r,n=eY(e.itemBehaviours);!(r=n()).done;){var s=r.value;s.isActiveAndEnabled&&s.started&&s.update(i)}for(var a,o=eY(e.rendererComponents);!(a=o()).done;){var u=a.value;u.isActiveAndEnabled&&u.started&&u.update(i)}for(var l,h=eY(e.children);!(l=h()).done;){var c=l.value;t.VFXItem.isComposition(c)&&c.ended&&c.endBehavior===tP.loop?(c.ended=!1,this.callUpdate(c,0)):this.callUpdate(c,i)}},r.callLateUpdate=function(t,e){for(var i,r=eY(t.itemBehaviours);!(i=r()).done;){var n=i.value;n.isActiveAndEnabled&&n.started&&n.lateUpdate(e)}for(var s,a=eY(t.rendererComponents);!(s=a()).done;){var o=s.value;o.isActiveAndEnabled&&o.started&&o.lateUpdate(e)}for(var u,l=eY(t.children);!(u=l()).done;){var h=u.value;this.callLateUpdate(h,e)}},r.buildItemTree=function(e){if(e.composition){for(var i,r=new Map,n=e.getComponent(ac).items,s=eY(n);!(i=s()).done;){var a=i.value;r.set(a.id,a)}for(var o,u=eY(n);!(o=u()).done;){var l=o.value;if(void 0===l.parentId)l.setParent(e);else{var h=this.getParentIdWithoutSuffix(l.parentId),c=r.get(h);if(c)t.VFXItem.isTree(c)&&l.parentId.includes("^")?(l.parent=c,l.transform.parentTransform=c.getNodeTransform(l.parentId)):(l.parent=c,l.transform.parentTransform=c.transform),c.children.push(l);else throw Error("The element references a non-existent element, please check the data.")}}for(var f,d=eY(n);!(f=d()).done;){var p=f.value;t.VFXItem.isComposition(p)&&this.buildItemTree(p)}}},r.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},r.updateVideo=function(){var t,e=performance.now();e-this.lastVideoUpdateTime>33&&((null!=(t=this.textures)?t:[]).forEach(function(t){return null==t?void 0:t.uploadCurrentVideoFrame()}),this.lastVideoUpdateTime=e)},r.updateCamera=function(){this.camera.updateMatrix()},r.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach(function(i){return i.onCompositionUpdate(e,t)})},r.getItemByName=function(t){return this.rootItem.find(t)},r.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return rv((t-i.z)/r,(e-i.w)/n,this.camera)},r.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},r.hitTest=function(t,e,i,r){if(this.isDestroyed)return[];var n,s=[],a=this.getHitTestRay(t,e);return null==(n=this.rootItem.getComponent(ac))||n.hitTest(a,t,e,s,i,r),this.refContent.forEach(function(n){var o;null==(o=n.getComponent(ac))||o.hitTest(a,t,e,s,i,r)}),s},r.addInteractiveItem=function(t,e){if(e===tE.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===tE.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 i=0;i<e.length;i++){var r,n=e[i];if(n){if(n.sourceType===t.TextureSourceType.data&&!this.texInfo[n.getInstanceId()]){n!==(null==(r=this.rendererOptions)?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n!==this.getEngine().emptyTexture&&n.dispose();continue}!this.autoRefTex||--this.texInfo[n.getInstanceId()]||n.dispose()}}},r.destroyItem=function(t){var e=this;t.type==tA.composition?t.endBehavior!==tP.freeze&&t.getComponent(ac).items.forEach(function(t){return e.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)})}):(eh(this.items,t),this.pluginSystem.plugins.forEach(function(i){return i.onCompositionItemRemoved(e,t)}))},r.lost=function(t){this.videoState=this.textures.map(function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime}),this.textures.map(function(t){return t.dispose()}),this.dispose()},r.dispose=function(){var e,i,r=this;if(!this.destroyed){this.destroyed=!0;var n={},s=this.textures;s&&this.keepResource&&s.forEach(function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=ew)}),this.rootItem.dispose(),this.renderFrame.dispose(),null==(e=this.rendererOptions)||e.emptyTexture.dispose(),null==(i=this.pluginSystem)||i.destroyComposition(this),this.update=function(){eO.error("Update disposed composition: "+r.name+".")},this.onPlayerPause=ew,this.dispose=ew,s&&this.keepResource&&s.forEach(function(t){return t.dispose=n[t.id]}),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==ib&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},r.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},r.translateByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(t,e)},r.setPositionByPixel=function(t,e){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(t,e)},r.translate=function(t,e,i){this.rootItem.translate(t,e,i)},r.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},r.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},r.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},r.scale=function(t,e,i){this.rootItem.scale(t,e,i)},r.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},r.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(t){return t&&t.offloadData()}),this.textureOffloaded=!0)},r.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},r.reloadTexture=function(){var t=this;return i(function(){return s(this,function(e){switch(e.label){case 0:if(!t.textureOffloaded)return[3,2];return[4,Promise.all(t.textures.map(function(t){return null==t?void 0:t.reloadData()}))];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}})})()},eB(e,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this.compositionSourceManager.textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){var t;return null!=(t=this.rootComposition.startTime)?t:0}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(),of=function(){function t(){this.renderErrors=new Set,this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new aR(this),this.emptyTexture=i5(this),this.transparentTexture=i6(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.getInstance=function(t){return this.objectInstance[t]},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=i.items,s=i.materials,a=i.shaders,o=i.geometries,u=i.components,l=i.animations,h=i.bins,c=void 0===h?[]:h,f=i.miscs,d=eY(void 0===n?[]:n);!(e=d()).done;){var p=e.value;this.addEffectsObjectData(p)}for(var m,v=eY(void 0===s?[]:s);!(m=v()).done;){var y=m.value;this.addEffectsObjectData(y)}for(var g,x=eY(void 0===a?[]:a);!(g=x()).done;){var T=g.value;this.addEffectsObjectData(T)}for(var E,b=eY(void 0===o?[]:o);!(E=b()).done;){var A=E.value;this.addEffectsObjectData(A)}for(var S,C=eY(void 0===u?[]:u);!(S=C()).done;){var _=S.value;this.addEffectsObjectData(_)}for(var R,O=eY(void 0===l?[]:l);!(R=O()).done;){var w=R.value;this.addEffectsObjectData(w)}for(var M,I=eY(void 0===f?[]:f);!(M=I()).done;){var L=M.value;this.addEffectsObjectData(L)}for(var P=0;P<c.length;P++){var F=c[P],V=t.bins[P];F.buffer=V,F.id&&this.addEffectsObjectData(F)}for(var N,D=eY(void 0===r?[]:r);!(N=D()).done;){var z=N.value;this.addEffectsObjectData(z)}},e.createVFXItems=function(t){var e=this;return i(function(){var i,r,n,a;return s(this,function(s){switch(s.label){case 0:i=eY(t.jsonScene.items),s.label=1;case 1:if((r=i()).done)return[3,4];if(!("ECS"===(a=(n=r.value).type)||"camera"===a||a===tA.sprite||a===tA.particle||a===tA.mesh||a===tA.skybox||a===tA.light||a===tA.tree||a===tA.interact||a===tA.camera)||!e.database)return[3,3];return[4,e.assetLoader.loadGUIDAsync(n.id)];case 2:s.sent(),s.label=3;case 3:return[3,1];case 4:return[2]}})})()},e.addTexture=function(t){this.destroyed||el(this.textures,t)},e.removeTexture=function(t){this.destroyed||eh(this.textures,t)},e.addMaterial=function(t){this.destroyed||el(this.materials,t)},e.removeMaterial=function(t){this.destroyed||eh(this.materials,t)},e.addGeometry=function(t){this.destroyed||el(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||eh(this.geometries,t)},e.addMesh=function(t){this.destroyed||el(this.meshes,t)},e.removeMesh=function(t){this.destroyed||eh(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||el(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||eh(this.renderPasses,t)},e.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass "+this.renderPasses.length),this.meshes.length>0&&t.push("Mesh "+this.meshes.length),this.geometries.length>0&&t.push("Geom "+this.geometries.length),this.textures.length>0&&t.push("Tex "+this.textures.length),t.length>0&&eO.warn("Release GPU memory: "+t.join(", ")+"."),this.renderPasses.forEach(function(t){return t.dispose()}),this.meshes.forEach(function(t){return t.dispose()}),this.geometries.forEach(function(t){return t.dispose()}),this.materials.forEach(function(t){return t.dispose()}),this.textures.forEach(function(t){return t.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},eB(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),od=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=eK(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(t){return t}),this.resetTickers=!1);for(var e=0,i=this.tickers.length;e<i;e++)(0,this.tickers[e])(this.dt)}}},e.add=function(t){if("function"!=typeof t)throw Error("The tick object must implement the tick method.");this.tickers.push(t)},eB(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();t.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return eX(e,t),e.prototype.fromData=function(t){},e}(e7),n([e9(void 0,void 0)],t.BinaryAsset.prototype,"buffer",void 0),t.BinaryAsset=n([e6("BinaryAsset")],t.BinaryAsset),aA("camera",ia,t.VFXItem,!0),aA("text",ag,t.VFXItem,!0),aA("sprite",nX,t.VFXItem,!0),aA("particle",s3,t.VFXItem,!0),aA("cal",s4,t.VFXItem,!0),aA("interact",ip,t.VFXItem,!0),eO.info("Core version: 2.0.0-alpha.20.");var op=((t7={})[iR.RGBA]=34842,t7[iR.RGB]=34843,t7[iR.ALPHA]=33325,t7[iR.RED]=33325,t7[iR.LUMINANCE_ALPHA]=33327,t7[iR.LUMINANCE]=33325,t7),om=((et={})[iR.RGBA]=34836,et[iR.RGB]=34837,et[iR.ALPHA]=33326,et[iR.RED]=33326,et[iR.LUMINANCE_ALPHA]=33328,et[iR.LUMINANCE]=33326,et),ov=function(e){function r(t,i){var r;return(r=e.call(this,t)||this).initialized=!1,i&&r.fromData(i),r}eX(r,e);var n=r.prototype;return n.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},n.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,i=this.source,r=i.target,n=void 0===r?e.TEXTURE_2D:r,s=i.name;this.textureBuffer=e.createTexture(),oE(this.textureBuffer,s),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},n.clone=function(){var t=new r(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},n.release=function(){switch(this.source.sourceType){case t.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case t.TextureSourceType.data:delete this.source.data;break;case t.TextureSourceType.compressed:case t.TextureSourceType.mipmaps:delete this.source.mipmaps}},n.update=function(e){var i,r,n,s,a,o=this;if(!this.pipelineContext||!this.textureBuffer){this.width=0,this.height=0;return}var u=this.target,l=this.source,h=this.pipelineContext.gl,c=this.engine.gpuCapability.detail,f=l.sourceType,d=l.data,p=l.cube,m=l.image,v=l.video,y=l.mipmaps,g=l.mipmaps,x=e.data,T=e.cube,E=e.generateMipmap,b=e.mipmaps,A=l.format,S=l.type,C=l.internalFormat,_=0,R=0;(this.bind(f===t.TextureSourceType.video),S===iR.HALF_FLOAT?((S=c.halfFloatTexture)||eO.error("Half float texture is not support."),iw(h)&&C===A&&(A===iR.LUMINANCE&&(A=iR.RED),C=op[A]),c.halfFloatLinear||(l.minFilter=l.magFilter=h.NEAREST,eO.warn("Half float linear not support, change to NEAREST."))):S!==h.FLOAT||((S=c.floatTexture)||eO.error("Float texture is not support."),iw(h)&&C===A&&(A===iR.LUMINANCE&&(A=iR.RED),C=om[A]),c.floatLinear||(l.minFilter=h.NEAREST,l.magFilter=h.NEAREST,eO.warn("Float linear not support, change to NEAREST."))),void 0===l.premultiplyAlpha&&(l.premultiplyAlpha=!1),h.pixelStorei(h.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l.premultiplyAlpha),void 0===l.flipY&&(l.flipY=!1),h.pixelStorei(h.UNPACK_FLIP_Y_WEBGL,l.flipY),f===t.TextureSourceType.framebuffer)?x&&(_=null!=(i=x.width)?i:0,R=null!=(r=x.height)?r:0,_&&R&&(this.width!==_||this.height!==R)&&h.texImage2D(u,0,C,_,R,0,A,S,null)):f===t.TextureSourceType.data?u===h.TEXTURE_CUBE_MAP?T.forEach(function(t,e){var i=o.texImage2DData(h,h.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,C,A,S,t),r=i[0],n=i[1];_=Math.max(r,_),R=Math.max(n,R)}):(_=(n=this.texImage2DData(h,u,0,C,A,S,d))[0],R=n[1]):f===t.TextureSourceType.image||f===t.TextureSourceType.video?(u===h.TEXTURE_CUBE_MAP?p.forEach(function(t,e){var i=o.texImage2D(h,h.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,C,A,S,t),r=i[0],n=i[1];_=Math.max(r,_),R=Math.max(n,R)}):u===h.TEXTURE_2D&&(_=(s=this.texImage2D(h,u,0,C,A,S,null!=m?m:v))[0],R=s[1]),E&&(oy(_)&&oy(R)||iw(h))&&h.generateMipmap(u)):f===t.TextureSourceType.mipmaps?u===h.TEXTURE_2D?y.forEach(function(t,e){if(a="data"in t?o.texImage2DData(h,u,e,C,A,S,t):o.texImage2D(h,u,e,C,A,S,t),0===e){var i;_=(i=a)[0],R=i[1]}}):u===h.TEXTURE_CUBE_MAP&&g.forEach(function(t,e){t.forEach(function(t,i){if(a="data"in t?o.texImage2DData(h,h.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,C,A,S,t):o.texImage2D(h,h.TEXTURE_CUBE_MAP_POSITIVE_X+i,e,C,A,S,t),0===e){var r;_=(r=a)[0],R=r[1]}})}):f===t.TextureSourceType.compressed&&b&&0!==b.length&&(_=b[0].width,R=b[0].height,b.forEach(function(t,e){h.compressedTexImage2D(u,e,C,t.width,t.height,0,t.data)})),this.width=_,this.height=R,this.setTextureFilters(h,u,l)},n.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=i.wrapS,s=void 0===n?t.CLAMP_TO_EDGE:n,a=i.wrapT,o=void 0===a?t.CLAMP_TO_EDGE:a,u=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&u.setTextureAnisotropic(t,this.target,void 0===r?4:r);var l=iw(t)||oy(this.width)&&oy(this.height),h=i.magFilter?i.magFilter:t.NEAREST,c=i.minFilter?i.minFilter:t.NEAREST;l||c!==t.LINEAR_MIPMAP_LINEAR&&c!==t.LINEAR_MIPMAP_NEAREST&&c!==t.NEAREST_MIPMAP_LINEAR&&c!==t.NEAREST_MIPMAP_NEAREST||(c=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,c),t.texParameteri(e,t.TEXTURE_MAG_FILTER,h),t.texParameteri(e,t.TEXTURE_WRAP_S,l?s:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,l?o:t.CLAMP_TO_EDGE)},n.fromData=function(t){e.prototype.fromData.call(this,t);var i=this.assembleOptions(t),r=i.sourceType,n=i.sourceFrom,s=i.name;this.source=i,this.sourceType=r,this.sourceFrom=n,this.name=void 0===s?"":s,this.guid=t.id},n.texImage2D=function(e,i,r,n,s,a,o){var u,l=this,h=this.source,c=h.sourceType,f=h.minFilter,d=h.magFilter,p=h.wrapS,m=h.wrapT,v=null!=(u=this.engine.gpuCapability.detail.maxTextureSize)?u:2048,y=o;if(c!==t.TextureSourceType.video){var g=f!==e.NEAREST||d!==e.NEAREST||p!==e.CLAMP_TO_EDGE||m!==e.CLAMP_TO_EDGE;(g=g||o.width>v||o.height>v)&&setTimeout(function(){y=l.resizeImage(o)})}e.texImage2D(i,r,n,s,a,y);var x=[y.width,y.height];return c===t.TextureSourceType.video?[o.videoWidth,o.videoHeight]:x},n.texImage2DData=function(t,e,i,r,n,s,a){var o=a.data,u=a.width,l=a.height,h=n===t.UNSIGNED_BYTE?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/o.BYTES_PER_ELEMENT):o;return t.texImage2D(e,i,r,u,l,0,n,s,h),[u,l]},n.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;return iw(this.pipelineContext.gl)&&t.width<n&&t.height<n?t:function(t,e,i,r){var n=t.width,s=t.height,a=Math.min(e,i||rm(n)),o=Math.min(e,r||rm(s));if(o!==s||a!==n){var u=am.getCanvas(),l=u.getContext("2d");return u.width=a,u.height=o,null==l||l.drawImage(t,0,0,n,s,0,0,a,o),eO.warn("Image resize from "+n+"x"+s+" to "+a+"x"+o+"."),u}}(t,n,e,i)||t},n.reloadData=function(){var t=this;return i(function(){return s(this,function(e){switch(e.label){case 0:if(!t.offloaded)return[3,2];return[4,rt().reload(t)];case 1:e.sent(),e.label=2;case 2:return[2]}})})()},n.offloadData=function(){if(this.initialized&&rt().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},n.uploadCurrentVideoFrame=function(){var e=this;return i(function(){var i;return s(this,function(r){switch(r.label){case 0:if(!(e.source.sourceType===t.TextureSourceType.video&&e.source.video&&e.initialized))return[3,3];if(!(i=e.source.video).paused)return[3,2];return[4,i.play()];case 1:r.sent(),r.label=2;case 2:return e.update({video:e.source.video}),[2,!0];case 3:return[2,!1]}})})()},n.updateSource=function(t){this.source=this.assembleOptions(iz({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},n.restore=function(){},n.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.source.sourceType===t.TextureSourceType.video&&this.source.video&&this.initialized&&(this.source.video.pause(),this.source.video.src="",this.source.video.load()),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){eO.error("This texture has been destroyed.")},this.initialize=eN,void 0!==this.engine&&this.engine.removeTexture(this)},r}(i2);function oy(t){return(t&t-1)==0&&0!==t}var og=function(){function t(t,e){this.engine=t,this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return iw(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),oE(e,t),e},e.bindVertexArray=function(t){if(iw(this.gl))this.gl.bindVertexArray(t);else{var e;null==(e=this.vaoExt)||e.bindVertexArrayOES(t)}},e.dispose=function(){if(iw(this.gl))this.gl.deleteVertexArray(this.vao);else{var t;null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)}},t}(),ox=1,oT=function(){function e(e){this.engine=e,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var i={width:1,height:1,data:new Uint8Array([255])},r=e.getGLPipelineContext(),n=r.gl;this.gl=n,this.pipelineContext=r,this.emptyTexture2D=new ov(e,{data:i,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new ov(e,{target:n.TEXTURE_CUBE_MAP,cube:[i,i,i,i,i,i],sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+ox,ox++}var i=e.prototype;return i.copy2=function(t,e){var i=this.gl;if(i){this.sourceFbo||(this.sourceFbo=i.createFramebuffer()),this.targetFbo||(this.targetFbo=i.createFramebuffer());var r=this.pipelineContext;r.bindFramebuffer(i.FRAMEBUFFER,this.sourceFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t.textureBuffer,0),r.bindFramebuffer(i.FRAMEBUFFER,this.targetFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.textureBuffer,0),r.bindFramebuffer(i.READ_FRAMEBUFFER,this.sourceFbo),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?i.NEAREST:i.LINEAR;i.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),i.COLOR_BUFFER_BIT,n),r.bindFramebuffer(i.FRAMEBUFFER,null),r.bindFramebuffer(i.READ_FRAMEBUFFER,null),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,null)}},i.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},i.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&el(this.renderbuffers,t),e},i.resize=function(t,e){var i=this.gl;(i&&i.drawingBufferWidth!==t||i.drawingBufferHeight!==e)&&(i.canvas.width=t,i.canvas.height=e,i.viewport(0,0,t,e),this.framebuffers.forEach(function(i){var r=i.viewport;i.isCustomViewport||i.resize(r[0],r[1],t*i.viewportScale,e*i.viewportScale)}))},i.drawGeometry=function(t,e,i){if(!this.gl){console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.");return}var r=e.shaderVariant.program;if(r){var n=r.setupAttributes(t),s=this.gl,a=t.indicesBuffer,o=t.drawStart,u=t.drawCount,l=t.mode,h=t.subMeshes;if(h&&h.length){var c,f=h[i];o=f.offset,u=null!=(c=f.indexCount)?c:f.vertexCount,a?s.drawElements(l,u,a.type,null!=o?o:0):s.drawArrays(l,o,u)}else a?s.drawElements(l,u,a.type,null!=o?o:0):s.drawArrays(l,o,u);null==n||n.unbind()}},i.createGLFramebuffer=function(t,e){var i=this.gl.createFramebuffer();return i&&(el(this.framebuffers,t),oE(i,e,e)),i},i.createVAO=function(t){return new og(this.engine,t)},i.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),eh(this.textures,t),delete t.textureBuffer)},i.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},i.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),eh(this.framebuffers,t),delete t.fbo)},i.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),eh(this.renderbuffers,t),delete t.buffer)},i.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.framebuffers.forEach(function(e){return t.deleteGLFramebuffer(e)}),this.framebuffers.length=0,this.renderbuffers.forEach(function(e){return t.deleteGLRenderbuffer(e)}),this.renderbuffers.length=0,this.textures.forEach(function(e){return t.deleteGLTexture(e)}),this.textures.length=0)},i.lost=function(t){eO.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},i.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},eB(e,[{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}();function oE(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var ob=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var i,r,n=e.target,s=void 0===n?iR.ARRAY_BUFFER:n,a=e.type,o=void 0===a?iR.FLOAT:a,u=e.name,l=e.usage,h=void 0===l?iR.STATIC_DRAW:l,c=e.data,f=e.elementCount,d=null!=(r=null==(i=oA[o])?void 0:i.BYTES_PER_ELEMENT)?r:0;this.target=s,this.type=o,this.usage=h,this.glBuffer=this.createGLBuffer(u),this.bytesPerElement=d,c?this.bufferData(c):f&&this.bufferData(d*f)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return oE(e,t),e},e.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var i=this.pipelineContext.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var i=this.pipelineContext.gl,r=this.target,n=t*this.bytesPerElement,s=n+e.byteLength;i.bindBuffer(r,this.glBuffer),s>this.byteLength&&(this.byteLength=s,i.bufferData(r,s,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!iw(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},eB(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),oA=((ee={})[iR.INT]=Int32Array,ee[iR.FLOAT]=Float32Array,ee[iR.SHORT]=Int16Array,ee[iR.BYTE]=Int8Array,ee[iR.UNSIGNED_BYTE]=Uint8Array,ee[iR.UNSIGNED_INT]=Uint32Array,ee[iR.UNSIGNED_SHORT]=Uint16Array,ee),oS=((ei={})[Uint8Array.BYTES_PER_ELEMENT]=iR.UNSIGNED_BYTE,ei[Uint16Array.BYTES_PER_ELEMENT]=iR.UNSIGNED_SHORT,ei[Uint32Array.BYTES_PER_ELEMENT]=iR.UNSIGNED_INT,ei),oC=1,o_=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}eX(e,t);var i=e.prototype;return i.getOptions=function(){return iz({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;eC(e),e.addGeometry(this);var i=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach(function(e){t.buffers[e]=new ob(i,t.bufferProps[e])}),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(i,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(void 0!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,s=i.target;this.bufferProps[r]={data:e,usage:n,target:s,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(void 0!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(void 0!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&void 0!=r.data){var n=e+i.length;if(r.data.length<n){var s=new i.constructor(n);s.set(r.data),r.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];a.start=Math.min(a.start,e),a.end=Math.max(a.end,n-1)}r.data.set(i,e),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(r(t,Uint8Array)||r(t,Uint16Array)||r(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t+e.length;if(this.indices.length<r){var n=new e.constructor(r);n.set(this.indices),this.indices=n,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var s=this.dirtyFlags.index;s.start=Math.min(s.start,t),s.end=Math.max(s.end,r-1)}null==(i=this.indices)||i.set(e,t),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*r8[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t,e){var i=oS[e.BYTES_PER_ELEMENT];return new ob(t,{data:e,target:iR.ELEMENT_ARRAY_BUFFER,type:i,name:""+this.name+"##index"})},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach(function(n){var s,a,o=t.dirtyFlags[n];if("index"==n)s=t.indicesBuffer,a=r;else{var u=e[n].dataSource;s=t.buffers[u],a=i[u].data}if((o.dirty||o.discard)&&s&&a){if(o.discard)s.bufferData(a);else{var l=o.start*a.BYTES_PER_ELEMENT+a.byteOffset,h=o.end-o.start+1,c=new a.constructor(a.buffer,l,h);s.bufferSubData(o.start,c)}o.start=Number.POSITIVE_INFINITY,o.end=0,o.dirty=o.discard=!1}}),Object.keys(this.attributesReleasable).forEach(function(r){var n=t.attributesReleasable[r],s=e[r].dataSource;i[s]&&n&&(i[s].data=void 0)}),this.indicesReleasable}},i.processProps=function(t){var e=t.drawStart,i=t.drawCount,n=t.mode,s=t.indices,a=t.name,o=void 0===a?"effectsGeometry:"+oC++:a,u=t.bufferUsage,l=void 0===u?iR.STATIC_DRAW:u;this.name=o;var h={},c=[],f={},d={},p={};this.drawStart=void 0===e?0:e,void 0!==i&&(this.drawCount=i),this.mode=isNaN(n)?iR.TRIANGLES:n,Object.keys(t.attributes).forEach(function(e){var i=t.attributes[e],n=i.size,s=i.stride,a=i.offset,o=i.normalize,u=i.type,m=void 0===u?iR.FLOAT:u,v=i.releasable,y=i.data;if(!m||"dataSource"in i||y||(y=r7(m)),y){var g=r(y,Float32Array)?iR.FLOAT:iR.INT;h[e]={data:y,usage:l,target:iR.ARRAY_BUFFER,name:e},f[e]={size:n,stride:s,offset:a,type:null!=m?m:g,normalize:!!o,dataSource:e},p[e]=null!=v&&v,d[e]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=i.dataSource;x&&(f[e]={size:n,stride:s,offset:a,type:m,dataSource:x,normalize:!!o})}c.push(e)}),d.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==s?void 0:s.data,this.indicesReleasable=(null==s?void 0:s.releasable)===!0,this.bufferProps=h,this.attributes=f,this.attributesName=c,this.attributesReleasable=p,this.dirtyFlags=d,this.options=t,this.initialized=!1},i.fromData=function(e){var i=this;t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes;var r=function(t){for(var e=atob(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return i.buffer}(e.buffer),n=e.vertexData.vertexCount;if(this.hasSemantic(e)){var s={mode:iR.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach(function(t){var e,a=null!=(e=oR[t.semantic])?e:t.semantic,o=i.createVertexTypedArray(t,r,n);s.attributes[a]={type:iI(t.format),size:t.dimension,data:o,normalize:t.normalize}}),e.indexFormat!==tQ.None){var a=this.createIndexTypedArray(e.indexFormat,r,e.indexOffset);s.indices={data:a},s.drawCount=a.length}else s.drawCount=n;this.processProps(s)}else{var o=e.vertexData.channels[0],u=e.vertexData.channels[1],l=e.vertexData.channels[2],h=this.createVertexTypedArray(o,r,n),c=this.createVertexTypedArray(u,r,n),f=this.createVertexTypedArray(l,r,n),d=this.createIndexTypedArray(e.indexFormat,r,e.indexOffset),p={mode:iR.TRIANGLES,attributes:{aPos:{type:iI(o.format),size:3,data:h,normalize:o.normalize},aUV:{type:iI(u.format),size:2,data:c,normalize:u.normalize},aNormal:{type:iI(l.format),size:3,data:f,normalize:l.normalize}}};p.indices={data:d},p.drawCount=d.length,this.processProps(p)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}},i.dispose=function(){var t,e=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach(function(t){e.buffers[t].dispose()}),this.buffers={},null==(t=this.indicesBuffer)||t.dispose(),Object.keys(this.vaos).forEach(function(t){var i;null==(i=e.vaos[t])||i.dispose(),e.vaos[t]=void 0}),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},i.createVertexTypedArray=function(t,e,i){switch(t.format){case tK.Float32:return new Float32Array(e,t.offset,t.dimension*i);case tK.Int16:return new Int16Array(e,t.offset,t.dimension*i);case tK.Int8:return new Int8Array(e,t.offset,t.dimension*i);case tK.UInt16:return new Uint16Array(e,t.offset,t.dimension*i);case tK.UInt8:return new Uint8Array(e,t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(e,t.offset,t.dimension*i)}},i.createIndexTypedArray=function(t,e,i){switch(t){case tQ.UInt16:return new Uint16Array(e,i);case tQ.UInt32:return new Uint32Array(e,i);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(e,i)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach(function(t){t.semantic&&t.semantic.length>0&&(e=!0)}),e},eB(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(r9),oR={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",WEIGHTS:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"},oO=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendColor[0]!==e||this.blendColor[1]!==i||this.blendColor[2]!==r||this.blendColor[3]!==n)&&(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.blendFunctionParameters[0]!==e||this.blendFunctionParameters[1]!==i||this.blendFunctionParameters[2]!==r||this.blendFunctionParameters[3]!==n)&&(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];(this.blendEquationParameters[0]!==e||this.blendEquationParameters[1]!==i)&&(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){(this.depthRange[0]!==t[0]||this.depthRange[1]!==t[1])&&(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){(this.polygonOffset[0]!==t[0]||this.polygonOffset[1]!==t[1])&&(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];(this.colorMask[0]!==e||this.colorMask[1]!==i||this.colorMask[2]!==r||this.colorMask[3]!==n)&&(this.colorMask[0]=e,this.colorMask[1]=i,this.colorMask[2]=r,this.colorMask[3]=n)},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){(this.stencilMask[0]!==t[0]||this.stencilMask[1]!==t[1])&&(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){(this.stencilRef[0]!==t[0]||this.stencilRef[1]!==t[1])&&(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){(this.stencilFunc[0]!==t[0]||this.stencilFunc[1]!==t[1])&&(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){(this.stencilOpFail[0]!==t[0]||this.stencilOpFail[1]!==t[1])&&(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){(this.stencilOpZFail[0]!==t[0]||this.stencilOpZFail[1]!==t[1])&&(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){(this.stencilOpZPass[0]!==t[0]||this.stencilOpZPass[1]!==t[1])&&(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[iR.ONE,iR.ONE_MINUS_SRC_ALPHA,iR.ONE,iR.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[iR.FUNC_ADD,iR.FUNC_ADD],this.depthTest=!1,this.depthMask=!1,this.depthRange=[0,1],this.depthFunc=iR.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[iR.ALWAYS,iR.ALWAYS],this.stencilOpFail=[iR.KEEP,iR.KEEP],this.stencilOpZFail=[iR.KEEP,iR.KEEP],this.stencilOpZPass=[iR.KEEP,iR.KEEP],this.culling=!1,this.frontFace=iR.CW,this.cullFace=iR.FRONT},e.apply=function(t){if(t.toggle(iR.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(iR.BLEND,this.blending),t.toggle(iR.DEPTH_TEST,this.depthTest),t.toggle(iR.STENCIL_TEST,this.stencilTest),t.toggle(iR.CULL_FACE,this.culling),t.toggle(iR.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(iR.BACK,this.stencilMask[1]),t.stencilMaskSeparate(iR.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(iR.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(iR.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(iR.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(iR.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this.blendColor,i=this.blendEquationParameters,r=this.blendFunctionParameters;t.blendColor(e[0],e[1],e[2],e[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(r[0],r[1],r[2],r[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),ow=function(e){function i(i,r){var n;return(n=e.call(this,i,r)||this).floats={},n.ints={},n.vector2s={},n.vector3s={},n.vector4s={},n.colors={},n.quaternions={},n.matrices={},n.matrice3s={},n.textures={},n.floatArrays={},n.vector4Arrays={},n.matrixArrays={},n.samplers=[],n.uniforms=[],n.uniformDirtyFlag=!0,n.macrosDirtyFlag=!0,n.macros={},n.glMaterialState=new oO,r&&(n.shader=new t.Shader(i),n.shader.shaderData=iz({},r.shader,{id:eD(),dataType:tZ.Shader})),n}eX(i,e);var r=i.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.macros[t]===e||(this.macros[t]=null==e||e,this.macrosDirtyFlag=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.macros[t],this.macrosDirtyFlag=!0)},r.isMacroEnabled=function(t){return void 0!==this.macros[t]},r.createMaterialStates=function(t){this.sampleAlphaToCoverage=!!t.sampleAlphaToCoverage,this.depthTest=t.depthTest,this.depthMask=t.depthMask,this.depthRange=t.depthRange,this.depthFunc=t.depthFunc,this.colorMask=t.colorMask,this.polygonOffset=t.polygonOffset,this.polygonOffsetFill=t.polygonOffsetFill,this.blending=t.blending,this.blendFunction=t.blendFunction,this.stencilTest=t.stencilTest},r.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;e.addMaterial(this),(!this.shaderVariant||this.shaderVariant.shader!==this.shader||this.macrosDirtyFlag)&&(this.shaderVariant=this.shader.createVariant(this.macros),this.macrosDirtyFlag=!1),this.shaderVariant.initialize(e),Object.keys(this.textures).forEach(function(e){var i=t.textures[e];if(!eL(i.initialize)){eO.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.");return}i.initialize()}),this.initialized=!0}},r.setupStates=function(t){this.glMaterialState.apply(t)},r.use=function(t,e){var i=t.engine.getGLPipelineContext();if(!this.shaderVariant.program){null==(r=this.engine)||r.renderErrors.add(Error("Shader program is not initialized."));return}if(this.shaderVariant.program.bind(),this.setupStates(i),e){for(var r,n,s,a=eY(e.uniforms);!(s=a()).done;)n=s.value,this.checkUniform(n);for(var o,u=eY(e.samplers);!(o=u()).done;)n=o.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirtyFlag=!0)}if(this.uniformDirtyFlag&&(this.shaderVariant.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirtyFlag=!1),e){for(n in e.floats)this.shaderVariant.setFloat(n,e.floats[n]);for(n in e.ints)this.shaderVariant.setInt(n,e.ints[n]);for(n in e.matrices)this.shaderVariant.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)this.shaderVariant.setFloat(n,this.floats[n]);for(n in this.ints)this.shaderVariant.setInt(n,this.ints[n]);for(n in this.floatArrays)this.shaderVariant.setFloats(n,this.floatArrays[n]);for(n in this.textures)this.shaderVariant.setTexture(n,this.textures[n]);for(n in this.vector2s)this.shaderVariant.setVector2(n,this.vector2s[n]);for(n in this.vector3s)this.shaderVariant.setVector3(n,this.vector3s[n]);for(n in this.vector4s)this.shaderVariant.setVector4(n,this.vector4s[n]);for(n in this.colors)this.shaderVariant.setColor(n,this.colors[n]);for(n in this.quaternions)this.shaderVariant.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)this.shaderVariant.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)this.shaderVariant.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)this.shaderVariant.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)this.shaderVariant.setMatrixArray(n,this.matrixArrays[n])},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=eY(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=eY(e);!(i=r()).done;)for(var n=i.value,s=0;s<16;s++)this.matrixArrays[t].push(n.elements[s])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirtyFlag=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var e=t||this.props,r=this.engine;eC(r);var n=new i(r,e);return n.glMaterialState=Object.assign(new oO,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirtyFlag=!0,n},r.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i,r,n=iz({blending:!1,zTest:!1,zWrite:!1},t);for(i in this.blending=n.blending,this.depthTest=n.zTest,this.depthMask=n.zWrite,n.floats)this.setFloat(i,n.floats[i]);for(i in n.ints)this.setInt(i,n.ints[i]);for(i in n.vector4s){var s=n.vector4s[i];this.setVector4(i,new im(s.x,s.y,s.z,s.w))}for(i in n.colors){var a=n.colors[i];this.setColor(i,new ig(a.r,a.g,a.b,a.a))}for(i in n.textures){var o=n.textures[i];this.setTexture(i,o.texture);var u=o.offset,l=o.scale;u&&l&&this.setVector4(i+"_ST",new im(l.x,l.y,u.x,u.y))}t.shader&&(this.shader=t.shader,this.shaderSource=this.shader.shaderData),this.stringTags=null!=(r=t.stringTags)?r:{},this.initialized=!1},r.toData=function(){var t=this.taggedProperties;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.dataType=tZ.Material,this.blending&&(t.blending=this.blending),this.depthTest&&(t.zTest=this.depthTest),this.depthMask&&(t.zWrite=this.depthMask),this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];return t},r.cloneUniforms=function(t){var e;for(e in t.floats)this.setFloat(e,t.floats[e]);for(e in t.ints)this.setInt(e,t.ints[e]);for(e in t.floatArrays)this.setFloats(e,t.floatArrays[e]);for(e in t.textures)this.setTexture(e,t.textures[e]);for(e in t.vector2s)this.setVector2(e,t.vector2s[e]);for(e in t.vector3s)this.setVector3(e,t.vector3s[e]);for(e in t.vector4s)this.setVector4(e,t.vector4s[e]);for(e in t.colors)this.setColor(e,t.colors[e]);for(e in t.quaternions)this.setQuaternion(e,t.quaternions[e]);for(e in t.matrices)this.setMatrix(e,t.matrices[e]);for(e in t.vector4Arrays){for(var i=[],r=0;r<t.vector4Arrays[e].length;r+=4)i.push(new im(t.vector4Arrays[e][r],t.vector4Arrays[e][r+1],t.vector4Arrays[e][r+2],t.vector4Arrays[e][r+3]));this.setVector4Array(e,i)}for(e in t.matrixArrays){for(var n=[],s=0;s<t.matrixArrays[e].length;s+=16){for(var a=e0.fromIdentity(),o=0;o<16;o++)a.elements[o]=t.matrixArrays[e][s+o];n.push(a)}this.setMatrixArray(e,n)}},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirtyFlag=!0)},r.dispose=function(e){var i,r=this;this.destroyed||(null==(i=this.shaderVariant)||i.dispose(),(null==e?void 0:e.textures)!==t.DestroyOptions.keep&&Object.keys(this.textures).forEach(function(t){var e=r.textures[t];e!==r.engine.emptyTexture&&e.dispose()}),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=eN,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},eB(i,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask},set:function(t){t&&this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(rn),oM=function(){function e(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}var i=e.prototype;return i.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},i.copyTexture=function(e,i){this.renderer&&(e.initialize(),i.initialize(),i.updateSource({sourceType:t.TextureSourceType.framebuffer,data:{width:i.getWidth()||e.getWidth(),height:i.getHeight()||e.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(e,i):this.copy1(e,i))},i.copy2=function(t,e){var i=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(i)},i.copy1=function(t,e){var i=this.copyRenderPass;if(i){var r=this.renderer;if(r){var n=i.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),r.glRenderer.resetColorAttachments(n,[e]),i.meshes[0].material.setTexture("uTex",t),r.renderRenderPass(i)}}},i.createCopyRenderPass=function(){var e="mri-copy-mesh",i={texture:{format:iR.RGBA}},r=this.renderer.engine,n=new o_(r,{name:e,mode:iR.TRIANGLE_STRIP,attributes:{aPos:{type:iR.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=r.gpuCapability.level,a=new ow(r,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:"\n precision highp float;\n attribute vec2 aPos;\n varying vec2 vTex;\n void main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n }\n ",fragment:"\n precision highp float;\n varying vec2 vTex;\n uniform sampler2D uTex;\n void main(){gl_FragColor = texture2D(uTex,vTex);}\n ",glslVersion:2===s?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var o=new ne(r,{name:e,geometry:n,material:a,priority:0});return new oI(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[i],meshes:[o]})},i.dispose=function(){if(this.renderer){var t;null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0}},e}(),oI=function(t){function e(){return t.apply(this,arguments)}eX(e,t);var i=e.prototype;return i.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},i.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(nn),oL=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],eC(t),this.gl=iS(t,e,i),this.contextLostListener=function(t){for(var e,i,n=eY(r.lostHandlers);!(i=n()).done;)i.value.lost(t);null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,n=eY(r.restoreHandlers);!(i=n()).done;)i.value.restore();null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),oP=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new nM(e),i}eX(e,t);var i=e.prototype;return i.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},i.getGLRenderer=function(){return this.renderer},i.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},i.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(of),oF=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}eX(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},i.setSize=function(t,e){if(!this.initialized){eO.error("Can't set size for uninitialized render buffer.");return}if(t!==this.size[0]||e!==this.size[1]){var i=this.renderer,r=i.gl;i.pipelineContext.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):eO.error("Invalid render buffer size: "+t+"x"+e+".")}},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=eN},e}(nO),oV=1,oN=function(e){function i(i,r){(n=e.call(this)||this).attachmentTextures=[];var n,s,a=i.depthStencilAttachment,o=i.viewport,u=i.isCustomViewport,l=i.storeAction,h=i.viewportScale,c=i.name,f=void 0===c?"GLFramebuffer"+oV++:c;return n.renderer=r,n.engine=r.engine,n.depthStencilStorageType=null!=(s=null==a?void 0:a.storageType)?s:t.RenderPassAttachmentStorageType.none,n.viewport=o,n.isCustomViewport=!!u,n.viewportScale=void 0===h?1:h,n.name=f,n.storeAction=l,n.updateProps(i),n}eX(i,e);var n=i.prototype;return n.getDepthTexture=function(){return this.depthTexture},n.getStencilTexture=function(){return this.stencilTexture},n.getColorTextures=function(){return this.colorTextures},n.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach(function(e){e.initialize(),el(t.attachmentTextures,e.textureBuffer)}),this.stencilTexture&&el(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&el(this.attachmentTextures,this.depthTexture.textureBuffer)},n.updateProps=function(e){var i,n,s=this.renderer,a=this.engine.gpuCapability,o=null!=(n=e.depthStencilAttachment)?n:{storageType:t.RenderPassAttachmentStorageType.none},u=e.attachments.length>0,l=!0;if(this.externalStorage=!1,e.attachments.length>1&&!a.detail.drawBuffers)throw Error("Multiple color attachments not support.");var h=null==(i=e.depthStencilAttachment)?void 0:i.texture,c=a.detail.readableDepthStencilTextures,f=o.storageType,d=o.storage;if(this.colorTextures=e.attachments.slice(),!u&&f!==t.RenderPassAttachmentStorageType.none)throw Error("Use depth stencil attachment without color attachments.");switch(u&&(this.fbo=s.glRenderer.createGLFramebuffer(this,this.name)),f){case t.RenderPassAttachmentStorageType.depth_stencil_opaque:if(d){if(r(d,oF))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth stencil attachment storage.")}else this.depthStencilRenderbuffer=new oF({format:iR.DEPTH_STENCIL,attachment:iR.DEPTH_STENCIL_ATTACHMENT,storageType:f},s.glRenderer);l=!1;break;case t.RenderPassAttachmentStorageType.depth_16_opaque:if(d){if(r(d,oF))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid depth attachment storage.")}else this.depthStencilRenderbuffer=new oF({attachment:iR.DEPTH_ATTACHMENT,format:iR.DEPTH_COMPONENT16,storageType:f},s.glRenderer);break;case t.RenderPassAttachmentStorageType.stencil_8_opaque:if(d){if(r(d,oF))this.depthStencilRenderbuffer=d,this.externalStorage=!0;else throw Error("Invalid stencil attachment storage.")}else this.depthStencilRenderbuffer=new oF({attachment:iR.STENCIL_ATTACHMENT,format:iR.STENCIL_INDEX8,storageType:f},s.glRenderer);break;case t.RenderPassAttachmentStorageType.depth_16_texture:if(!c)throw Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new ov(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:iR.DEPTH_COMPONENT,internalFormat:a.internalFormatDepth16,type:iR.UNSIGNED_SHORT,name:""+this.name+"##depthTex"}),this.depthTexture.initialize();break;case t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!c)throw Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new ov(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:iR.DEPTH_STENCIL,internalFormat:a.internalFormatDepth24_stencil8,type:a.UNSIGNED_INT_24_8,name:""+this.name+"##dpthStclTex"}),this.depthTexture.initialize(),l=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,l),this.updateAttachmentTextures()},n.getStoreAttachments=function(e,i){var r=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(e&&iw(r)&&n>0){var s=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&el(s,i?r.DEPTH_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&el(s,i?r.STENCIL_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var a=0;a<n;a++)el(s,r["COLOR_ATTACHMENT"+a]);return s}},n.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;iw(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},n.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,i=this.renderer.pipelineContext,r=this.viewport,n=r[0],s=r[1],a=r[2],o=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,s,a,o);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(i.textureUnitDict).forEach(function(e){var r=i.textureUnitDict[e];r&&r!==u&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())});for(var l=0;l<4;l++)i.activeTexture(e.TEXTURE0+l),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var h=this.depthStencilRenderbuffer,c=this.depthTexture,f=this.stencilTexture;if(i.activeTexture(e.TEXTURE0),h)h.setSize(a,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,h.attachment,e.RENDERBUFFER,h.buffer);else if(c){c.source.data={width:a,height:o},c.update({data:{width:a,height:o,data:new Uint16Array(0)}});var d=c&&f?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,d,e.TEXTURE_2D,c.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var p=e.checkFramebufferStatus(e.FRAMEBUFFER);if(p!==e.FRAMEBUFFER_COMPLETE)throw Error("Framebuffer failed, status: "+p+", error: "+e.getError()+".");this.ready=!0}}},n.resetColorTextures=function(t){var e=this.renderer.glRenderer.gl,i=this.engine.gpuCapability,r=this.viewport,n=[];if(t){for(var s,a=eY(t);!(s=a()).done;)s.value.initialize();this.colorTextures=t.slice()}this.renderer.pipelineContext.activeTexture(e.TEXTURE0),this.colorTextures.forEach(function(t,s){var a={width:r[2],height:r[3],data:new Uint8Array(0)};t.update({data:a}),i.framebufferTexture2D(e,e.FRAMEBUFFER,s,e.TEXTURE_2D,t.textureBuffer),n.push(!0)}),i.drawBuffers(e,n),this.updateAttachmentTextures()},n.resize=function(t,e,i,r){var n=this.viewport,s=n[0],a=n[1],o=n[2],u=n[3];(s!==t||a!==e||o!==i||u!==r)&&(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},n.dispose=function(e){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force;n!==t.RenderPassDestroyAttachmentType.force&&(n!==t.RenderPassDestroyAttachmentType.keepExternal||this.externalStorage)||(null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose()),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},eB(i,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),i}(nL),oD=function(t){for(var e=5381,i=t.length;i;)e=33*e^t.charCodeAt(--i);return e>>>0},oz=((er={})[iR.FLOAT]=1,er[iR.INT]=1,er[iR.UNSIGNED_INT]=1,er[iR.SHORT]=1,er[iR.BOOL]=1,er[iR.UNSIGNED_SHORT]=1,er[iR.FLOAT_VEC2]=2,er[iR.FLOAT_VEC3]=3,er[iR.FLOAT_VEC4]=4,er[iR.FLOAT_MAT2]=4,er[iR.FLOAT_MAT3]=9,er[iR.FLOAT_MAT4]=16,er[iR.FLOAT_MAT2x3]=6,er[iR.FLOAT_MAT2x4]=8,er[iR.FLOAT_MAT4x3]=12,er[iR.FLOAT_MAT4x2]=8,er[iR.FLOAT_MAT3x4]=12,er[iR.FLOAT_MAT3x2]=6,er[iR.INT_VEC2]=2,er[iR.INT_VEC3]=3,er[iR.INT_VEC4]=4,er[iR.UNSIGNED_INT_VEC2]=2,er[iR.UNSIGNED_INT_VEC3]=3,er[iR.UNSIGNED_INT_VEC4]=4,er[iR.BOOL_VEC2]=2,er[iR.BOOL_VEC3]=3,er[iR.BOOL_VEC4]=4,er),oU=oX(Float32Array),ok=oX(Int32Array),oB=oX(Uint8Array);function oG(t){return function(e,i,r,n){var s={start:i[1],dirty:!0};if(i[2]>1){if(e.length){for(var a=n[1]||e.length,o=i[4]/t.BYTES_PER_ELEMENT,u=s.buffer=new t(a*o),l=n[0]||0,h=0;h<a;h++)u[h*o]=e[h+l];s.start+=l*o}}else s.buffer=new t([e]);return s}}function oX(t){return function(e,i,r,n){for(var s=i[8],a=i[2],o=i[5],u=1===a?s:i[4],l=o?u/o:1,h=u/t.BYTES_PER_ELEMENT/l,c=s/t.BYTES_PER_ELEMENT/h,f=oz[i[0]],d=f/l,p=(n[0]||0)*f,m=n[1]?l*n[1]:c,v=new t(h*m),y={start:i[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,T=p;g<m;g++){for(var E=0;E<d;E++)v[x+E]=e[T+E];x+=h,T+=d}return y}}(en={})[iR.FLOAT]=oG(Float32Array),en[iR.INT]=oG(Int32Array),en[iR.UNSIGNED_INT]=oG(Uint32Array),en[iR.SHORT]=oG(Int16Array),en[iR.BOOL]=oG(Uint8Array),en[iR.UNSIGNED_SHORT]=oG(Uint16Array),en[iR.FLOAT_VEC2]=oU,en[iR.FLOAT_VEC3]=oU,en[iR.FLOAT_VEC4]=oU,en[iR.FLOAT_MAT2]=oU,en[iR.FLOAT_MAT3]=oU,en[iR.FLOAT_MAT4]=oU,en[iR.FLOAT_MAT2x3]=oU,en[iR.FLOAT_MAT2x4]=oU,en[iR.FLOAT_MAT4x3]=oU,en[iR.FLOAT_MAT4x2]=oU,en[iR.FLOAT_MAT3x4]=oU,en[iR.FLOAT_MAT3x2]=oU,en[iR.INT_VEC2]=ok,en[iR.INT_VEC3]=ok,en[iR.INT_VEC4]=ok,en[iR.UNSIGNED_INT_VEC2]=ok,en[iR.UNSIGNED_INT_VEC3]=ok,en[iR.UNSIGNED_INT_VEC4]=ok,en[iR.BOOL_VEC2]=oB,en[iR.BOOL_VEC3]=oB,en[iR.BOOL_VEC4]=oB;var oH=function(){function t(t,e,i,r){var n=this;this.engine=t,this.program=e,this.shared=i,this.id=r,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var s=this.pipelineContext.gl;this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),iw(s)&&(function(t,e){for(var i=[],r=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),s=0;s<n;++s)!function(n){var s=t.getActiveUniformBlockName(e,n),a={index:t.getUniformBlockIndex(e,s),usedByVertexShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:s,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,i[n]=a;for(var o=a.uniformIndices,u=[],l=0;l<o.length;l++){var h=t.getActiveUniform(e,o[l]).name.replace("[0]","");a.uniforms[h]=[0,0,0,0,0,0,0,l,0],u[l]=h,r.push(h)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach(function(i,r){t.getActiveUniforms(e,o,i).forEach(function(t,e){var i=u[e];a.uniforms[i][r]=+t})});for(var c=0;c<u.length;c++){var f=a.uniforms[u[c]],d=a.uniforms[u[c+1]],p=d?d[1]:a.size;f[8]=p-f[1]}a.id=function(t){var e=t.name,i=t.size,r=t.uniforms,n=t.uniformIndices;return Object.keys(r).map(function(t){return t+"["+r[t].join(":")+"]"}).join("+"),oD(""+e+"+",""+i+"+",""+n.length+"+")}(a)+""}(s);return{blockSpecs:i,blockUniformNames:r}})(s,e).blockSpecs.forEach(function(t){return n.uniformBlockMap[t.name]=t}),this.pipelineContext.useProgram(null)}var e=t.prototype;return e.bind=function(){this.pipelineContext.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,s=this.pipelineContext.gl;return t.vaos[n]?i=t.vaos[n]:(i=new og(this.engine,t.name+"-"+n),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach(function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var a=t.buffers[n.dataSource];if(!a)throw Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");a.bind(),s.enableVertexAttribArray(i.loc),s.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}}),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var s=t.getActiveAttrib(e,n),a=s.name,o=s.type,u=s.size,l=t.getAttribLocation(e,a);i[a]={type:o,name:a,size:u,loc:l}}return i},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),oY=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}eX(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||t.getGLPipelineContext().shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i,r=e.slice();t=t.concat(r);for(var n=this.pipelineContext.getUniforms(this.program.program,t),s=0;s<t.length;s++)this.uniformLocations[t[s]]=n[s];for(i=0;i<r.length;i++)null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--);for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},i.toData=function(){var t=this.taggedProperties;t.dataType=tZ.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(rQ),oW=0,oj=function(){function e(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var i=e.prototype;return i.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=eY(Object.keys(this.cachedShaders));!(i=n()).done;){var s=i.value;this.cachedShaders[s].initialized||r.push(s)}t?r.length?Promise.all(r.map(function(t){return new Promise(function(i){return e.compileShader(e.cachedShaders[t],i)})})).then(t).catch(function(){return 0}):t([]):r.map(function(t){return e.compileShader(e.cachedShaders[t])}),this.shaderAllDone=!0}},i.addShader=function(e,i){var r=[];e.macros&&r.push.apply(r,[].concat(e.macros)),i&&r.push.apply(r,[].concat(i));var n=iz({},e,{vertex:iF(r,e.vertex,t.ShaderType.vertex,this.engine.gpuCapability.level),fragment:iF(r,e.fragment,t.ShaderType.fragment,this.engine.gpuCapability.level)}),s=this.computeShaderCacheId(n);if(this.cachedShaders[s])return s;this.shaderAllDone=!1;var a=n.glslVersion===t.GLSLVersion.GLSL3?"#version 300 es\n":"",o=n.vertex?a+n.vertex:"",u=n.fragment?a+n.fragment:"",l=!1;return(n.shared||n.cacheId)&&(l=!0),this.cachedShaders[s]=new oY(this.engine,iz({},n,{vertex:o,fragment:u,name:n.name||s,shared:l})),this.cachedShaders[s].id=s,s},i.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},i.compileShader=function(e,i){var r=this,n=e.source,s=n.shared,a=n.vertex,o=n.fragment,u=n.name,l=e.source.cacheId,h=!1;(s||l)&&(h=!0);var c=this.pipelineContext.gl,f={shared:h,status:t.ShaderCompileResultStatus.compiling},d=this.createProgram(c,a,o,f),p=this.glAsyncCompileExt,m=performance.now(),v=function(i){f.status=t.ShaderCompileResultStatus.success,f.compileTime=performance.now()-m,e.program=i,e.initialized=!0,e.pipelineContext=r.pipelineContext,void 0!==r.programMap[e.id]&&console.warn("Find duplicated shader id: "+e.id+"."),r.programMap[e.id]=i},y=function(){var n=(!i||!p||p&&!0==c.getProgramParameter(f.program,p.COMPLETION_STATUS_KHR))&&d();if(n){if(f.status!==t.ShaderCompileResultStatus.fail){oE(n,u);var s=new oH(r.engine,n,h,e.id);if(c.validateProgram(n),c.getProgramParameter(n,c.VALIDATE_STATUS))v(s);else{var l=c.getProgramInfoLog(n);(null==l?void 0:l.includes("the same texture"))?v(s):(f.status=t.ShaderCompileResultStatus.fail,f.error=l,console.error("compileProgramError: "+l,"\nvertex:\n",a,"\nfragment:\n",o),c.deleteProgram(n))}}i&&i(f)}else i&&requestAnimationFrame(y)};e.compileResult=f,y()},i.computeShaderCacheId=function(t){var e=t.vertex,i=t.fragment,r=t.shared,n=t.cacheId;return r||n?n||"shared_"+function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var s=e[n],a=0;a<s.length;a++)r=Math.imul(31,r)+s.charCodeAt(a)|0;return r}(void 0===e?"":e,void 0===i?"":i):"instanced_"+oW++},i.createProgram=function(e,i,r,n){var s=e.createProgram(),a=this.createGLShader(e,e.VERTEX_SHADER,i),o=this.createGLShader(e,e.FRAGMENT_SHADER,r);return s&&a&&o?(e.attachShader(s,a),e.attachShader(s,o),e.linkProgram(s),n.program=s,n.status=t.ShaderCompileResultStatus.compiling,function(){if(n.program=void 0,!e.getProgramParameter(s,e.LINK_STATUS)){console.error("Failed to link program: "+e.getProgramInfoLog(s)+".");var u=oZ(e,a,"vertex",i),l=oZ(e,o,"fragment",r);n.status=t.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),l&&(n.error=l.error,n.status=l.status)}return s}):(n.status=t.ShaderCompileResultStatus.fail,function(){return null})},i.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=oD(null!=i?i:""),s=r.get(n);if(s)return s;var a=t.createShader(e);return a&&(t.shaderSource(a,i),t.compileShader(a),r.set(n,a)),a},i.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},i.restore=function(){},i.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach(function(e){t.programMap[e].dispose()}),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap.forEach(function(t){e.deleteShader(t)}),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},e}();function oZ(e,i,r,n){if(!e.getShaderParameter(i,e.COMPILE_STATUS)){var s=e.getShaderInfoLog(i);return console.error("compile "+r+" error: "+s,(null!=n?n:"").split("\n").map(function(t,e){return e+1+" "+t}).join("\n")),{error:s,status:t.ShaderCompileResultStatus.fail}}}var oq=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new oj(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}var e=t.prototype;return e.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=iR.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},e.toggle=function(t,e){e?this.enable(t):this.disable(t)},e.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},e.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},e.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},e.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},e.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.useProgram=function(t){this.set1("useProgram",t)},e.clear=function(t){this.gl.clear(t)},e.clearDepth=function(t){this.set1("clearDepth",t)},e.depthFunc=function(t){this.set1("depthFunc",t)},e.depthMask=function(t){this.set1("depthMask",t)},e.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},e.depthRange=function(t,e){this.set2("depthRange",t,e)},e.clearStencil=function(t){this.set1("clearStencil",t)},e.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},e.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},e.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},e.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},e.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},e.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},e.blendEquation=function(t){this.set1("blendEquation",t)},e.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},e.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},e.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},e.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},e.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},e.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},e.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),(r.x!==e||r.y!==i)&&this.gl[t](r.x=e,r.y=i)},e.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),(n.x!==e||n.y!==i||n.z!==r)&&this.gl[t](n.x=e,n.y=i,n.z=r)},e.set4=function(t,e,i,r,n){var s=this.glCapabilityCache[t];s||(s=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),(s.x!==e||s.y!==i||s.z!==r||s.w!==n)&&this.gl[t](s.x=e,s.y=i,s.z=r,s.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},e.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},e.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},e.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},t}(),oK=function(e){function i(i,r,n){(s=e.call(this)||this).canvas=i,s.temporaryRTs={};var s,a=iz({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},n);s.context=new oL(i,r,a);var o=s.context.gl;return eC(o),s.engine=new oP(o),s.engine.renderer=s5(s),s.pipelineContext=new oq(s.engine,o),s.glRenderer=new oT(s.engine),s.extension=new oM(s5(s)),s.renderingData={currentFrame:{}},s.framebuffer=new oN({storeAction:{},viewport:[0,0,s.width,s.height],attachments:[new ov(s.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:s.width,height:s.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},s5(s)),s}eX(i,e);var r=i.prototype;return r.renderRenderFrame=function(t){t.resource&&t.resource.color_b.initialize(),t.emptyTexture.initialize(),t.transparentTexture.initialize();var e=t._renderPasses;if(this.isDestroyed){console.error("Renderer is destroyed, target: GLRenderer.");return}null==(i=t.renderer.getShaderLibrary())||i.compileAllShaders(),this.setFramebuffer(null),this.clear(t.clearAction),this.renderingData.currentFrame=t,this.renderingData.currentCamera=t.camera,eb(e);for(var i,r,n=eY(e);!(r=n()).done;){var s=r.value,a=s.delegate;null==a.willBeginRenderPass||a.willBeginRenderPass.call(a,s,this.renderingData),this.renderRenderPass(s),null==a.didEndRenderPass||a.didEndRenderPass.call(a,s,this.renderingData)}for(var o,u=eY(e);!(o=u()).done;)o.value.frameCleanup(this)},r.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},r.renderMeshes=function(t){for(var e,i=this.renderingData.currentPass.delegate,r=eY(t);!(e=r()).done;){var n=e.value;null==i.willRenderMesh||i.willRenderMesh.call(i,n,this.renderingData),n.render(this),null==i.didRenderMesh||i.didRenderMesh.call(i,n,this.renderingData)}},r.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},r.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},r.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},r.drawGeometry=function(t,e,i){if(void 0===i&&(i=0),t&&e){e.initialize(),t.initialize(),t.flush();var r=this.renderingData;r.currentFrame.globalUniforms&&r.currentCamera&&(this.setGlobalMatrix("effects_MatrixInvV",r.currentCamera.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",r.currentCamera.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",r.currentCamera.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",r.currentCamera.getProjectionMatrix()));var n=Date.now()%1e8*.001;this.setGlobalFloat("_GlobalTime",n),r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){console.error(t);return}this.glRenderer.drawGeometry(t,e,i)}},r.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.getFramebuffer=function(){return this.framebuffer},r.getTemporaryRT=function(e,i,r,n,s,a){if(this.temporaryRTs[e])return this.temporaryRTs[e];var o,u,l=t.RenderPassAttachmentStorageType.none;s===t.FilterMode.Linear?o=iR.LINEAR:s===t.FilterMode.Nearest&&(o=iR.NEAREST),a===t.RenderTextureFormat.RGBA32?u=iR.UNSIGNED_BYTE:a===t.RenderTextureFormat.RGBAHalf&&(u=iR.HALF_FLOAT),0===n?l=t.RenderPassAttachmentStorageType.none:16===n?l=t.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(l=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var h=new oN({name:e,storeAction:{},viewport:[0,0,i,r],viewportScale:1,isCustomViewport:!0,attachments:[new ov(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:o,magFilter:o,internalFormat:iR.RGBA,format:iR.RGBA,type:u})],depthStencilAttachment:{storageType:l}},this);return this.temporaryRTs[e]=h,h},r.setViewport=function(t,e,i,r){this.pipelineContext.viewport(t,e,i,r)},r.clear=function(e){var i=this.pipelineContext,r=0;if(e.colorAction===t.TextureLoadAction.clear){var n=e.clearColor;n&&i.clearColor(n[0],n[1],n[2],n[3]),i.colorMask(!0,!0,!0,!0),r=iR.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(i.stencilMask(255),i.clearStencil(e.clearStencil||0),r|=iR.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var s=e.clearDepth;i.depthMask(!0),i.clearDepth(Number.isFinite(s)?s:1),r|=iR.DEPTH_BUFFER_BIT}r&&i.clear(r)},r.addLostHandler=function(t){this.context.addLostHandler(t)},r.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},r.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.getWidth=function(){return this.width},r.getHeight=function(){return this.height},r.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},r.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},r.restore=function(){var t=this.context.gl;if(!t)throw Error("Can not restore automatically because losing gl context.");this.engine=new oP(t),this.engine.renderer=this,this.pipelineContext=new oq(this.engine,t),this.glRenderer=new oT(this.engine),this.extension=new oM(this)},r.resize=function(t,e){var i=this.glRenderer;i&&(this.width!==t||this.height!==e)&&i.resize(t,e)},r.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},eB(i,[{key:"isDestroyed",get:function(){var t=this.glRenderer;return!t||t.isDestroyed}},{key:"height",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.height)?e:0}},{key:"width",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.width)?e:0}}]),i}(nP),oQ={"Container size overflowed":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#MvjnY","DPI overflowed":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#ulfNT","Invalid container size":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#lLlSW","Container is not an HTMLElement":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Never use destroyed player again":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#YSWQr","Current running player count":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#IzodZ","Create player with different WebGL version":"https://galacean.antgroup.com/effects/user/gasrv4ka5sacrwpg#X0ulg"},oJ=new Map,o$=!1,o0=1,o1=function(){function e(t){var e,r=this;this.builtinObjects=[],this.compositions=[],this.displayScale=1,this.resumePending=!1,this.disposed=!1,this.assetManagers=[],this.speed=1,this.baseCompositionIndex=0,this.lost=function(t){var e;null==(e=r.ticker)||e.pause(),r.compositions.forEach(function(e){return e.lost(t)}),r.renderer.lost(t),null==r.handleWebGLContextLost||r.handleWebGLContextLost.call(r,t),o2(r,!1)};var n=this;this.restore=i(function(){var t;return s(this,function(e){switch(e.label){case 0:return n.renderer.restore(),[4,Promise.all(n.compositions.map(i(function(t){var e,i,r,a,o,u,l,h,c,f,d,p;return s(this,function(s){switch(s.label){case 0:return e=t.time,i=t.url,r=t.speed,a=t.keepResource,o=t.reusable,u=t.renderOrder,l=t.transform,h=t.videoState,[4,n.loadScene(i)];case 1:(c=s.sent()).speed=r,c.reusable=o,c.keepResource=a,c.renderOrder=u,c.transform.setPosition(l.position.x,l.position.y,l.position.z),c.transform.setRotation(l.rotation.x,l.rotation.y,l.rotation.z),c.transform.setScale(l.scale.x,l.scale.y,l.scale.z),f=0,s.label=2;case 2:if(!(f<h.length))return[3,5];if(!h[f])return[3,4];return(d=c.textures[f].source.video).currentTime=null!=(p=h[f])?p:0,[4,d.play()];case 3:s.sent(),s.label=4;case 4:return f++,[3,2];case 5:return c.rootItem.ended=!1,c.gotoAndPlay(e),[2,c]}})})))];case 1:return n.compositions=e.sent(),null==n.handleWebGLContextRestored||n.handleWebGLContextRestored.call(n),null==(t=n.ticker)||t.resume(),[2]}})}),this.handleResume=function(){null==r.handlePlayableUpdate||r.handlePlayableUpdate.call(r,{player:r,playing:!0})},this.handleClick=function(t){var e=t.x,i=t.y;r.compositions.forEach(function(t){var n=t.hitTest(e,i);if(n.length)for(var s=0;s<n.length;s++){var a=n[s].behavior||tb.NOTIFY;a===tb.NOTIFY?null==r.handleItemClicked||r.handleItemClicked.call(r,iz({},n[s],{composition:t.name,player:r})):a===tb.RESUME_PLAYER&&r.resume()}})};var a=t.container,o=t.canvas,u=t.fps,l=t.name,h=t.pixelRatio,c=t.manualRender,f=t.reportGPUTime,d=t.onMessageItem,p=t.onPausedByItem,m=t.onItemClicked,v=t.onPlayableUpdate,y=t.onRenderError,g=t.onWebGLContextLost,x=t.onWebGLContextRestored,T=t.renderFramework,E=t.notifyTouch,b=t.interactive,A=t.renderOptions,S=void 0===A?{}:A,C=t.env,_=void 0===C?"":C,R=S.willCaptureImage,O=S.premultipliedAlpha;if(i_.length)throw Error("Errors before player create: "+i_.map(function(t,e){return"\n "+(e+1)+": "+t})+".");if(!o$&&"debug-disable"!==T){var w=eg()||(e=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===e[1]||"16"===e[1]&&"5"===e[2])?"webgl":"webgl2";T&&(w="webgl"===T?"webgl":"webgl2"),this.handleWebGLContextLost=g,this.handleWebGLContextRestored=x,this.reportGPUTime=f,this.handleItemClicked=m,this.handleMessageItem=d,this.handlePlayableUpdate=v,this.handleRenderError=y,this.handlePlayerPause=function(t){r.pause(),null==p||p({name:t.name,player:r})},this.pixelRatio=Number.isFinite(h)?h:ey(),this.offscreenMode=!0,this.env=_,this.name=l||""+o0++,o?this.canvas=o:(o3(a),this.canvas=document.createElement("canvas"),a.appendChild(this.canvas)),this.container=this.canvas.parentElement,this.renderer=nP.create(this.canvas,w,{preserveDrawingBuffer:R,premultipliedAlpha:O}),this.renderer.env=_,this.renderer.addLostHandler({lost:this.lost}),this.renderer.addRestoreHandler({restore:this.restore}),this.gpuCapability=this.renderer.engine.gpuCapability,this.builtinObjects.push(i5(this.renderer.engine)),oJ.forEach(function(t){t.gpuCapability.type!==r.gpuCapability.type&&eO.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+r.gpuCapability.type+".\nsee "+oQ["Create player with different WebGL version"]+".")}),c||(this.ticker=new od(u),this.ticker.add(this.tick.bind(this))),this.event=new ic(this.canvas,!!E),this.event.bindListeners(),this.event.addEventListener(io,this.handleClick),this.interactive=void 0!==b&&b,this.resize(),nD(this.gpuCapability.detail),oJ.set(this.canvas,this),function(){for(var t,e=[],i=eY(oJ.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&eO.error("Current running player count: "+e.length+", see "+oQ["Current running player count"]+".",e)}(),o2(this,!0)}}var n=e.prototype;return n.setSpeed=function(t){isNaN(t)||(this.speed=t)},n.getSpeed=function(){return this.speed},n.getCompositionByName=function(t){return this.compositions.find(function(e){return e.name===t})},n.getCompositions=function(){return this.compositions},n.loadScene=function(t,e){var r=this;return i(function(){var n,a,o;return s(this,function(u){switch(u.label){case 0:if(o=r.baseCompositionIndex,!eI(t))return[3,2];return r.baseCompositionIndex+=t.length,[4,Promise.all(t.map(i(function(t,i){var n;return s(this,function(s){switch(s.label){case 0:return[4,r.createComposition(t,e)];case 1:return(n=s.sent()).setIndex(o+i),[2,n]}})})))];case 1:return a=u.sent(),[3,4];case 2:return r.baseCompositionIndex+=1,[4,r.createComposition(t,e)];case 3:(a=u.sent()).setIndex(o),u.label=4;case 4:return null==(n=r.ticker)||n.start(),[2,a]}})})()},n.createComposition=function(t,e){void 0===e&&(e={});var n=this;return i(function(){var i,a,o,u,l,h,c,f,d,p,m,v,y;return s(this,function(s){switch(s.label){case 0:return a=(i=n.renderer).engine,o=performance.now(),u=iz({autoplay:!0},e),a7(t)?(l=t.url,ot(t)&&(u=iz({},u,t.options))):l=t,h=new oa(u),a.clearResources(),n.assetManagers.push(h),[4,h.loadScene(l,n.renderer,{env:n.env})];case 1:for(c=s.sent(),a.addPackageDatas(c),f=eY(n.builtinObjects);!(d=f()).done;)p=d.value,a.addInstance(p);for(m=0;m<c.textureOptions.length;m++)c.textureOptions[m]=r(c.textureOptions[m],i2)?c.textureOptions[m]:a.assetLoader.loadGUID(c.textureOptions[m].id),c.textureOptions[m].initialize();if(!a.database)return[3,3];return[4,a.createVFXItems(c)];case 2:s.sent(),s.label=3;case 3:if(n.disposed)throw Error("Disposed player can not used to create Composition.");return v=new oc(iz({},u,{renderer:i,width:i.getWidth(),height:i.getHeight(),event:n.event,onPlayerPause:n.handlePlayerPause,onMessageItem:n.handleMessageItem}),c),n.ticker&&u.renderLevel===tm.B&&n.ticker.setFPS(Math.min(n.ticker.getFPS(),30)),[4,new Promise(function(t){var e;null==(e=n.renderer.getShaderLibrary())||e.compileAllShaders(function(){t(null)})})];case 4:return s.sent(),u.autoplay?(n.autoPlaying=!0,v.play()):v.pause(),y=performance.now()-o+v.statistic.loadTime,v.statistic.firstFrameTime=y,eO.info("First frame: ["+v.name+"]"+y.toFixed(4)+"ms."),n.compositions.push(v),[2,v]}})})()},n.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(t){t.play()}),null==(t=this.ticker)||t.start()},n.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(e){e.gotoAndPlay(t)}),this.ticker?this.ticker.start():this.doTick(0,!0)},n.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map(function(e){e.gotoAndStop(t)}),(!this.ticker||(null==(e=this.ticker)?void 0:e.getPaused()))&&this.doTick(0,!0),null==this.handlePlayableUpdate||this.handlePlayableUpdate.call(this,{player:this,playing:!1})},n.playSequence=function(t){for(var e,i=function(e){var i=t[e],r=i.onEnd;i.onEnd=function(){null==r||r.call(i,i),t[e+1].play()}},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},n.pause=function(t){var e;!this.paused&&(null==(e=this.ticker)||e.pause(),null==this.handlePlayableUpdate||this.handlePlayableUpdate.call(this,{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},n.resume=function(){var t=this;return i(function(){var e;return s(this,function(i){switch(i.label){case 0:if(t.resumePending)return[2];if(!t.paused)return[3,2];return t.resumePending=!0,[4,Promise.all(t.compositions.map(function(t){return t.reloadTexture()}))];case 1:i.sent(),t.resumePending=!1,t.handleResume(),i.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}})})()},n.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},n.doTick=function(e,i){var r,n,s=this,a=this.renderer.engine.renderErrors;a.size>0&&(null==this.handleRenderError||this.handleRenderError.call(this,a.values().next().value),null==(r=this.ticker)||r.pause()),e=Math.min(e,33)*this.speed;var o=this.compositions,u=!1;o.sort(function(t,e){return t.getIndex()-e.getIndex()});for(var l=[],h=0;h<o.length;h++){var c=o[h];if(c.textureOffloaded){u=!0,eO.error("Composition "+c.name+" texture offloaded, skip render."),l.push(c);continue}!c.isDestroyed&&c.renderer&&c.update(e,!1),c.isDestroyed||l.push(c)}if(this.compositions=l,this.baseCompositionIndex=this.compositions.length,u)return null==this.handleRenderError||this.handleRenderError.call(this,Error("Play when texture offloaded.")),null==(n=this.ticker)?void 0:n.pause();if(!this.paused||i){var f=this.gpuCapability.level,d=this.renderer.context.gl,p=2===f&&this.reportGPUTime?iC(d):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<o.length||i){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var m=0;m<o.length;m++)o[m].renderFrame.isDestroyed||this.renderer.renderRenderFrame(o[m].renderFrame)}null==p||p.end(),null==p||p.getTime().then(function(t){return null==s.reportGPUTime?void 0:s.reportGPUTime.call(s,null!=t?t:0)}).catch,this.autoPlaying&&(null==this.handlePlayableUpdate||this.handlePlayableUpdate.call(this,{player:this,playing:!0}))}},n.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},n.resize=function(){var t=this.canvas.parentElement;if(t){var e=this.getTargetSize(t);r=e[0],n=e[1],s=e[2],a=e[3]}else r=s=this.canvas.width,n=a=this.canvas.height;var i=r/n;if(r&&n){var r,n,s,a,o,u=document.documentElement.clientWidth;s>2*u&&eO.error("DPI overflowed, width "+s+" is more than 2x document width "+u+", see "+oQ["DPI overflowed"]+".");var l=this.env?this.gpuCapability.detail.maxTextureSize:2048;(s>l||a>l)&&(eO.error("Container size overflowed "+s+"x"+a+", see "+oQ["Container size overflowed"]+"."),i>1?(s=Math.round(l),a=Math.round(l/i)):(a=Math.round(l),s=Math.round(l*i))),this.renderer.resize(s,a),this.canvas.style.width=r+"px",this.canvas.style.height=n+"px",eO.info("Resize player "+this.name+" ["+s+","+a+","+r+","+n+"]."),null==(o=this.compositions)||o.forEach(function(t){t.camera.aspect=i})}},n.clearCanvas=function(e){e?this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},n.destroyCurrentCompositions=function(){this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.baseCompositionIndex=0},n.dispose=function(t){if(eO.info("Call player destroyed: "+this.name+"."),!this.disposed){oJ.delete(this.canvas),this.pause(),null==(e=this.ticker)||e.stop(),this.assetManagers.forEach(function(t){return t.dispose()}),this.compositions.forEach(function(t){return t.dispose()}),this.compositions.length=0,this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.event.dispose(),this.renderer.dispose(!t),this.destroyBuiltinObjects(),o2(this,!1),r(this.canvas,HTMLCanvasElement)&&!t&&this.renderer.context&&(am.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var e,i="Never use destroyed player: "+this.name+" again, see "+oQ["Never use destroyed player again"]+".",n=function(){return function(t){throw Error(t)}(i)},s=function(){return Promise.reject(i)};this.tick=n,this.resize=n,this.loadScene=s,this.play=s,this.gotoAndPlay=s,this.gotoAndStop=s,this.playSequence=n,this.destroyCurrentCompositions=n,this.resume=s,this.disposed=!0}},n.offloadTexture=function(){this.compositions.forEach(function(t){return t.offloadTexture()})},n.getTargetSize=function(t){o3(t);var e,i,r=this.displayAspect;r?t.clientWidth/t.clientHeight>r?e=(i=t.clientHeight*this.displayScale)*r:i=(e=t.clientWidth*this.displayScale)/r:(e=t.clientWidth,i=t.clientHeight);var n=this.pixelRatio,s=e,a=i;if(e=Math.round(e*n),(i=Math.round(i*n))<1||i<1){if(this.offscreenMode)e=i=s=a=1;else throw Error("Invalid container size "+e+"x"+i+", see "+oQ["Invalid container size"]+".")}return[s,a,e,i]},n.destroyBuiltinObjects=function(){for(var t,e=eY(this.builtinObjects);!(t=e()).done;)t.value.dispose();this.builtinObjects.length=0},eB(e,[{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),e}();function o2(t,e){Object.keys(aT).forEach(function(i){var r=aT[i],n=e?r.onPlayerCreated:r.onPlayerDestroy;null==n||n(t)})}function o3(t){if(null==t)throw Error("Container is not an HTMLElement, see "+oQ["Container is not an HTMLElement"]+".")}i2.create=function(t,e){return new ov(t,e)},i2.createWithData=function(e,i,r){void 0===i&&(i=eT("#fff")),void 0===r&&(r={});var n=r.type,s=void 0===n?iR.UNSIGNED_BYTE:n,a=r.format,o=void 0===a?iR.RGBA:a,u=r.internalFormat,l=r.wrapS,h=void 0===l?iR.MIRRORED_REPEAT:l,c=r.wrapT,f=void 0===c?iR.MIRRORED_REPEAT:c,d=r.minFilter,p=void 0===d?iR.NEAREST:d,m=r.magFilter,v=void 0===m?iR.NEAREST:m,y=r.flipY;return new ov(e,{data:i,type:s,sourceType:t.TextureSourceType.data,format:o,internalFormat:u||o,wrapS:h,wrapT:f,minFilter:p,magFilter:v,flipY:void 0!==y&&y})},rn.create=function(t,e){return new ow(t,e)},r9.create=function(t,e){return new o_(t,e)},ne.create=function(t,e){return new ne(t,e)},nO.create=function(t){return new oF(t)},nL.create=function(t,e){return new oN(t,e)},nP.create=function(t,e,i){return new oK(t,e,i)},of.create=function(t){return new oP(t)};var o4="2.0.0-alpha.20";eO.info("Player version: "+o4+"."),t.AbstractPlugin=is,t.ActivationPlayable=ai,t.AnimationClipPlayable=ar,t.AssetLoader=aR,t.AssetManager=oa,t.BYTES_TYPE_MAP=r8,t.Behaviour=ie,t.BezierCurve=rB,t.BezierCurvePath=rX,t.BezierCurveQuat=rH,t.COPY_FRAGMENT_SHADER=r1,t.COPY_MESH_SHADER_ID=r$,t.COPY_VERTEX_SHADER=r0,t.CalculateLoader=s4,t.Camera=ou,t.CameraVFXItemLoader=ia,t.Component=it,t.Composition=oc,t.CompositionComponent=ac,t.CompositionSourceManager=oh,t.DEFAULT_FONTS=av,t.Database=aO,t.Downloader=iU,t.EFFECTS_COPY_MESH_NAME=rJ,t.EVENT_TYPE_CLICK=io,t.EVENT_TYPE_TOUCH_END=ih,t.EVENT_TYPE_TOUCH_MOVE=il,t.EVENT_TYPE_TOUCH_START=iu,t.EffectsObject=e7,t.Engine=of,t.EventSystem=ic,t.Float16ArrayWrapper=ra,t.Framebuffer=nL,t.GLEngine=oP,t.GLGeometry=o_,t.GLRenderer=oK,t.GPUCapability=nM,t.Geometry=r9,t.GlobalUniforms=nR,t.GradientValue=rU,t.HELP_LINK=iA,t.InteractLoader=ip,t.InteractMesh=nV,t.ItemBehaviour=ii,t.KTXTexture=i8,t.LineSegments=rk,t.LinearValue=rz,t.Material=rn,t.MaterialDataBlock=re,t.Mesh=ne,t.PLAYER_OPTIONS_ENV_EDITOR=ib,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=sq,t.ParticleBehaviourPlayableAsset=sK,t.ParticleLoader=s3,t.ParticleMesh=sJ,t.ParticleSystemRenderer=sU,t.PassTextureCache=r5,t.PathSegments=rG,t.Player=o1,t.PluginSystem=aS,t.RENDER_PASS_NAME_PREFIX=nb,t.RENDER_PREFER_LOOKUP_TEXTURE=nJ,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=rV,t.RandomValue=rN,t.RandomVectorValue=rD,t.RenderFrame=nS,t.RenderPass=nn,t.RenderPassPriorityNormal=1e3,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=ni,t.Renderbuffer=nO,t.Renderer=nP,t.RendererComponent=ir,t.RuntimeClip=as,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=r6,t.SerializationHelper=a_,t.ShaderVariant=rQ,t.SpriteColorPlayable=nQ,t.SpriteLoader=nX,t.StaticValue=rF,t.TEMPLATE_USE_OFFSCREEN_CANVAS=n$,t.TextComponentBase=ay,t.TextLayout=ad,t.TextLoader=ag,t.TextStyle=ap,t.Texture=i2,t.TextureFactory=i7,t.Ticker=od,t.TimelineClip=an,t.TimelinePlayable=ao,t.TrackSortWrapper=au,t.Transform=n3,t.TransformAnimationPlayable=ae,t.ValueGetter=rP,t.addByOrder=eA,t.addItem=el,t.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var s=t[n];if(r)for(;t[n-1][i]<s[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>s[i]&&(t[n]=t[n-1],0!=--n););t[n]=s}}},t.applyMixins=eU,t.assertExist=eC,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw Error(e)},t.base64ToFile=ez,t.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",t.calculateTranslation=rl,t.canvasPool=am,t.colorGradingFrag=nf,t.colorStopsFromGradient=ep,t.colorToArr=ef,t.combineImageTemplate=oi,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=r2,t.createGLContext=iS,t.createKeyFrameMeta=rK,t.createShaderWithMacros=iF,t.createShape=su,t.createVFXItem=function(t,e){var i=t.type,r=t.pluginName;if(!r)switch(i){case tA.null:r="cal";break;case tA.sprite:r="sprite";break;case tA.particle:r="particle";break;case tA.interact:r="interact";break;case tA.camera:r="camera";break;case tA.text:r="text";break;case tA.tree:r="tree";break;default:throw Error("Invalid vfx item type.")}return e.pluginSystem.createPluginItem(r,t,e)},t.createValueGetter=rW,t.decimalEqual=rg,t.defaultGlobalVolume=nE,t.defaultPlugins=aE,t.deserializeMipmapTexture=iJ,t.disableAllPlayer=function(t){o$=!!t},t.earcut=sC,t.effectsClass=e6,t.effectsClassStore=e5,t.enlargeBuffer=ec,t.ensureFixedNumber=aM,t.ensureVec3=rh,t.findPreviousRenderPass=function(t,e){var i=t.indexOf(e);return t[i-1]},t.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",t.gaussianDownHFrag=nd,t.gaussianDownVFrag=np,t.gaussianUpFrag=nm,t.generateEmptyTypedArray=r7,t.generateGUID=eD,t.generateHalfFloatTexture=i3,t.generateTransparentTexture=i6,t.generateWhiteTexture=i5,t.getActivePlayers=function(){return Array.from(oJ.values())},t.getBackgroundImage=oe,t.getColorFromGradientStops=ed,t.getConfig=function(t){return n0[t]},t.getDefaultTemplateCanvasPool=function(){return am},t.getDefaultTextureFactory=rt,t.getGeometryByShape=sR,t.getGeometryTriangles=s_,t.getImageItemRenderInfo=nz,t.getKTXTextureOptions=i9,t.getKeyFrameMetaByRawValue=rq,t.getMergedStore=e8,t.getParticleMeshShader=s1,t.getPixelRatio=ey,t.getPlayerByCanvas=function(t){return oJ.get(t)},t.getPreMultiAlpha=iL,t.getStandardComposition=a3,t.getStandardImage=a2,t.getStandardItem=a5,t.getStandardJSON=a0,t.getTextureSize=nC,t.glContext=iR,t.glType2VertexFormatType=function(t){switch(t){case WebGLRenderingContext.FLOAT:return tK.Float32;case WebGLRenderingContext.SHORT:return tK.Int16;case WebGLRenderingContext.BYTE:return tK.Int8;case WebGLRenderingContext.UNSIGNED_SHORT:return tK.UInt16;case WebGLRenderingContext.UNSIGNED_BYTE:return tK.UInt8;default:return tK.Float32}},t.gpuTimer=iC,t.imageDataFromColor=eT,t.imageDataFromGradient=eE,t.initErrors=i_,t.initGLContext=iO,t.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",t.interpolateColor=em,t.isAlipayMiniApp=function(){var t;return"undefined"!=typeof my&&(null==(t=my)?void 0:t.renderTarget)==="web"},t.isAndroid=eg,t.isArray=eI,t.isCanvas=eF,t.isCanvasUsedByPlayer=function(t){return oJ.has(t)},t.isFunction=eL,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=eP,t.isSceneJSON=a9,t.isSceneURL=a7,t.isSceneWithOptions=ot,t.isSimulatorCellPhone=ex,t.isString=eM,t.isUniformStruct=ri,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&ri(t[0])},t.isValidFontFamily=e_,t.isWebGL2=iw,t.itemFrag=no,t.itemFrameFrag=ns,t.itemVert=na,t.loadBinary=iY,t.loadBlob=function(t){return ij.apply(this,arguments)},t.loadImage=iX,t.loadMedia=iK,t.loadVideo=iZ,t.loadWebPOptional=iB,t.logger=eO,t.math=iE,t.modifyMaxKeyframeShader=s2,t.nearestPowerOfTwo=rm,t.noop=ew,t.normalizeColor=aN,t.numberToFix=rx,t.parsePercent=ev,t.particleFrag=nu,t.particleOriginTranslateMap=rp,t.particleUniformTypeMap=sQ,t.particleVert=nl,t.pluginLoaderMap=aT,t.pointOnLine=function(t,e,i,r,n,s){var a=t*r+e*n+i*s-n*r-s*t-i*e;return a>-.001&&a<.001},t.randomInRange=eV,t.registerPlugin=aA,t.removeItem=eh,t.rotateVec2=sO,t.screenMeshVert=nc,t.serialize=function(t,e){return e9(t,e)},t.setBlendMode=iV,t.setConfig=function(t,e){return n0[t]=e},t.setDefaultTextureFactory=function(t){t0=t},t.setMaskMode=iD,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=rv,t.setSideMode=iN,t.setSpriteMeshMaxItemCountByGPU=nD,t.sortByOrder=eb,t.spec=e2,t.spriteMeshShaderFromFilter=nU,t.spriteMeshShaderFromRenderInfo=nB,t.spriteMeshShaderIdFromRenderInfo=nk,t.thresholdFrag=nv,t.throwDestroyedError=eN,t.trailVert=nh,t.translatePoint=function(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i},t.trianglesFromRect=ry,t.unregisterPlugin=function(t){delete ab[t],delete aT[t],eh(aE,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecAssign=rf,t.vecFill=rc,t.vecMulCombine=rd,t.vecNormalize=function(t,e){1==arguments.length&&(e=t,t=[]);var i,r=e,n=(i=Math).hypot.apply(i,[].concat(r));if(0===n)return rf(t,r,r.length);for(var s=0;s<r.length;s++)t[s]=r[s]/n;return t},t.version=o4,t.vertexFormatType2GLType=iI,Object.defineProperty(t,"__esModule",{value:!0})});
|
|
21
8
|
//# sourceMappingURL=index.min.js.map
|