@galacean/effects 2.7.2 → 2.7.3
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 +1 -1
- package/dist/alipay.mjs +1 -1
- package/dist/douyin.js +1 -1
- package/dist/douyin.mjs +1 -1
- package/dist/index.js +4 -4
- package/dist/index.min.js +2 -2
- package/dist/index.mjs +4 -4
- package/dist/weapp.js +1 -1
- package/dist/weapp.mjs +1 -1
- package/package.json +3 -3
package/dist/alipay.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/appx-adapter/alipay");function i(t,e,i,r,n,o,s){try{var a=t[o](s),u=a.value}catch(t){return void i(t)}a.done?e(u):Promise.resolve(u).then(r,n)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var s=t.apply(e,r);function a(t){i(s,n,o,a,u,"next",t)}function u(t){i(s,n,o,a,u,"throw",t)}a(void 0)}))}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function o(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 n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,e):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 new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):s(t,e)}function a(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function u(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s}function h(t,e){var i,r,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}"function"==typeof SuppressedError&&SuppressedError;var l=new Uint8Array(16);function c(){if(!t&&!(t=void 0!==e.crypto&&e.crypto.getRandomValues&&e.crypto.getRandomValues.bind(e.crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(l)}for(var f=[],d=0;d<256;++d)f.push((d+256).toString(16).slice(1));var p={randomUUID:void 0!==e.crypto&&e.crypto.randomUUID&&e.crypto.randomUUID.bind(e.crypto)};function m(t,e,i){if(p.randomUUID&&!e&&!t)return p.randomUUID();var r=(t=t||{}).random||(t.rng||c)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){i=i||0;for(var n=0;n<16;++n)e[i+n]=r[n];return e}return function(t,e){return void 0===e&&(e=0),f[t[e+0]]+f[t[e+1]]+f[t[e+2]]+f[t[e+3]]+"-"+f[t[e+4]]+f[t[e+5]]+"-"+f[t[e+6]]+f[t[e+7]]+"-"+f[t[e+8]]+f[t[e+9]]+"-"+f[t[e+10]]+f[t[e+11]]+f[t[e+12]]+f[t[e+13]]+f[t[e+14]]+f[t[e+15]]}(r)}function v(t,e){return t.includes(e)||t.push(e),t}function y(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function g(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var o=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),s=new t.constructor(o);return s.set(t),s}return t}var x=2*Math.PI,b=Math.PI/180,T=180/Math.PI,E=1e-6;function S(t,e){return Math.abs(t-e)<E||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var _=function(t,e,i){return(1-i)*t+i*e};function C(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,o=Math.min(r,n),s=Math.max(r,n);return Math.min(Math.max(t,o),s)}var A=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):s(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):s(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):s(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):s(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=E,e=this.x,i=this.y;return Math.abs(e)<=t&&Math.abs(i)<=t},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}();A.ONE=new A(1,1),A.ZERO=new A(0,0);var w=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):s(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):s(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):s(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):s(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,o=e.x,s=e.y,a=e.z;return this.x=r*a-n*s,this.y=n*o-i*a,this.z=i*s-r*o,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=E,e=this,i=e.x,r=e.y,n=e.z;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new A(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}();w.X=new w(1,0,0),w.Y=new w(0,1,0),w.Z=new w(0,0,1),w.ONE=new w(1,1,1),w.ZERO=new w(0,0,0);var M=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,o;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(o=t[e+3])?o:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):s(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):s(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):s(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):s(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=E,e=this,i=e.x,r=e.y,n=e.z,o=e.w;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t&&Math.abs(o)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new w(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}();M.ONE=new M(1,1,1,1),M.ZERO=new M(0,0,0,0);var R=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,o;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(o=t[e+3])?o:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,o=t/60,s=n*(1-Math.abs(o%2-1)),a=0,u=0,h=0;o>=0&&o<=1?(a=n,u=s):o>=1&&o<=2?(a=s,u=n):o>=2&&o<=3?(u=n,h=s):o>=3&&o<=4?(u=s,h=n):o>=4&&o<=5?(a=s,h=n):o>=5&&o<=6&&(a=n,h=s);var l=i-n;return this.set(a+l,u+l,h+l,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):s(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):s(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):s(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):s(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 M(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,i=e.r,r=e.g,n=e.b,o=e.a,s=Math.max(i,r,n),a=Math.min(i,r,n),u=s-a,h=0,l=0;return 0!==s&&(l=u/s),s!=a&&(s==i?(h=(r-n)/u,r<n&&(h+=6)):s==r?h=(n-i)/u+2:s==n&&(h=(i-r)/u+4),h*=60),new t(h,l,s,o)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),o=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+o:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),(new t).setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();function I(t,e){var i=[0,0,0,0];if(nt(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else s(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)i[o]/=255;return i}function P(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var o=t[n-1],s=t[n];if(o.time<=e&&e<=s.time){r=N(o.color.toArray(),s.color.toArray(),(e-o.time)/(s.time-o.time));break}}return r||(r=t[t.length-1].color.toArray()),i?r.map((function(t){return t/255})):r}return[0,0,0,0]}function O(t){var e=[];if(s(t,Array)?t.forEach((function(t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4];e.push({time:F(i),color:new R(r,n,o,s)})})):Object.keys(t).forEach((function(i){var r=t[i],n=(new R).setFromArray(I(r));e.push({time:F(i),color:n})})),(e=e.sort((function(t,e){return t.time-e.time}))).length){0!==e[0].time&&e.unshift({time:0,color:e[0].color.clone()});var i=e[e.length-1];1!==i.time&&e.push({time:1,color:i.color.clone()})}return e}function N(t,e,i,r){var n=[],o=1-i;if(r)for(var s=0;s<4;s++)n[s]=t[s]*o+e[s]*i;else{for(var a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*o+e[a]*e[a]*i));n[3]=Math.round(t[3]*o+e[3]*i)}return n}function F(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function L(){if("object"==typeof e.screen&&"object"==typeof e.document){var t=Math.max(e.document.documentElement.clientWidth,e.window.innerWidth||0),i=e.screen.width/t;return Math.min(2*i,2)}return 1}R.BLACK=new R(0,0,0,1),R.BLUE=new R(0,0,1,1),R.CLEAR=new R(0,0,0,0),R.CYAN=new R(0,1,1,1),R.GRAY=new R(.5,.5,.5,1),R.GREEN=new R(0,1,0,1),R.MAGENTA=new R(1,0,1,1),R.RED=new R(1,0,0,1),R.WHITE=new R(1,1,1,1),R.YELLOW=new R(1,.92,.016,1);var V,D=void 0!==e.window;function k(){return!!e.navigator.platform&&/iPad|iPhone|iPod/.test(e.navigator.platform)}function z(){return/\b[Aa]ndroid\b/.test(e.navigator.userAgent)}function U(){return/\bOpenHarmony\b/.test(e.navigator.userAgent)}function B(){return z()||U()||/\b(iPad|iPhone|iPod)\b/.test(e.navigator.userAgent)}function G(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function j(){return"miniprogram"===e.window.__wxjs_environment}function X(t){nt(t)&&(t=I(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 H(t){var e=128,i={width:e,height:1,data:new Uint8Array(512)},r=i.data,n=O(t);if(n.length){r.set(n[0].color.toArray(),0);for(var o=1;o<127;o++){for(var s=o/e,a=void 0,u=void 0,h=0;h<n.length&&(a=n[h],u=n[h+1],!(a.time<=s&&u.time>s));h++);var l=N(a.color.toArray(),u.color.toArray(),(s-a.time)/(u.time-a.time));r.set(l,4*o)}r.set(n[n.length-1].color.toArray(),508)}return i}function W(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(i<=30){for(var r=1;r<i;r++)Z(t,r,e);return t}return q(t,e)}function Y(t,e,i){return void 0===i&&(i=2),t.includes(e)?t:(t.push(e),1===t.length||1!==i&&Z(t,t.length-1,i),t)}function Z(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 q(t,e,i,r){if(void 0===i&&(i=0),void 0===r&&(r=t.length-1),i>=r)return t;for(var n,o=t[i],s=i,a=r;s<a;){if(2===e){for(;t[a].priority>o.priority&&a>=s;)a--;for(;t[s].priority<=o.priority&&s<a;)s++}else{for(;t[a].priority<o.priority&&a>=s;)a--;for(;t[s].priority>=o.priority&&s<a;)s++}var u;u=[t[a],t[s]],t[s]=u[0],t[a]=u[1]}return n=[t[s],t[i]],t[i]=n[0],t[s]=n[1],q(t,e,i,s-1),q(t,e,a+1,r),t}function K(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function Q(t){return/^[^\d.][\w-]*$/.test(t)}exports.OrderType=void 0,(V=exports.OrderType||(exports.OrderType={}))[V.none=1]="none",V[V.ascending=2]="ascending",V[V.descending=3]="descending";var J,$="[Galacean Effects]";function tt(t){return["%c"+$,"color: #AA0100",""+t]}var et,it={error:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).error.apply(n,[].concat(tt(t),[i])),null==J||J("error",t,i)},info:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).debug.apply(n,[].concat(tt(t))),null==J||J("info",t,i)},warn:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).warn.apply(n,[].concat(tt(t))),null==J||J("warn",t,i)},register:function(t){t&&st(t)&&(J=t)}};function rt(){}function nt(t){return"string"==typeof t}exports.DestroyOptions=void 0,(et=exports.DestroyOptions||(exports.DestroyOptions={}))[et.destroy=0]="destroy",et[et.keep=1]="keep",et[et.force=0]="force";var ot=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function st(t){return"[object Function]"===Object.prototype.toString.call(t)}function at(t){return"[object Object]"===Object.prototype.toString.call(t)}function ut(t){if(null===t||"object"!=typeof t)return!1;if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function ht(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function lt(t,e){return t+Math.random()*(e-t)}function ct(){throw new Error("Destroyed item cannot be used again.")}function ft(){return m().replace(/-/g,"")}function dt(t,i,r){void 0===i&&(i="base64File"),void 0===r&&(r="");for(var n=t.split(",")[1]||t,o=e.atob(n),s=[],a=0;a<o.length;a+=512){for(var u=o.slice(a,a+512),h=new Array(u.length),l=0;l<u.length;l++)h[l]=u.charCodeAt(l);var c=new Uint8Array(h);s.push(c)}var f=new e.Blob(s,{type:r});return new File([f],i,{type:r})}function pt(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)}))}))}var mt={},vt=[],yt={};function gt(t,e,i){yt[t]&&it.error("Duplicate registration for plugin "+t+"."),yt[t]=i,mt[t]=e,v(vt,t)}var xt=function(){function t(t){var e={},i=[];vt.forEach((function(t){var r=mt[t];i.includes(r)||(i.push(r),e[t]=r)}));for(var r,n=o(t);!(r=n()).done;){var s=r.value;if(!mt[s])throw new Error("The plugin '"+s+"' not found."+Tt(s))}this.plugins=Object.keys(e).map((function(t){var e=new(0,mt[t]);return e.name=t,e})).sort((function(t,e){return t.order-e.order}))}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach((function(i){return i.onCompositionConstructed(t,e)}))},e.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},e.resetComposition=function(t,e){this.plugins.forEach((function(i){return i.onCompositionReset(t,e)}))},e.processRawJSON=function(t,e){var i=this;return r((function(){return h(this,(function(r){return[2,i.callStatic("processRawJSON",t,e)]}))}))()},e.processAssets=function(t,e){var i=this;return r((function(){return h(this,(function(r){return[2,i.callStatic("processAssets",t,e)]}))}))()},e.precompile=function(t,e){for(var i,r=o(this.plugins);!(i=r()).done;){i.value.precompile(t,e)}},e.loadResources=function(t,e){var i=this;return r((function(){return h(this,(function(r){return[2,i.callStatic("prepareResource",t,e)]}))}))()},e.callStatic=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];var o=this;return r((function(){var e,r,n,s,a,u,l;return h(this,(function(h){for(e=[],r=o.plugins,n=0;n<r.length;n++)s=r[n],a=mt[s.name],t in a&&e.push(Promise.resolve(null==(l=a[t])?void 0:(u=l).call.apply(u,[].concat([a],i))));return[2,Promise.all(e)]}))}))()},t}(),bt={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer","rich-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"};function Tt(t){var e=bt[t];return e?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""}var Et,St,_t,Ct,At,wt,Mt,Rt,It,Pt,Ot,Nt,Ft,Lt,Vt=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.precompile=function(t,e){},e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t}();function Dt(t,e){return Dt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Dt(t,e)}function kt(t,e){if("function"!=typeof e&&null!==e)throw new 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&&Dt(t,e)}!function(t){t["1_0"]="1.0",t["1_1"]="1.1",t["1_2"]="1.2",t["1_3"]="1.3",t["1_5"]="1.5",t["1_8"]="1.8",t["2_0"]="2.0",t["2_1"]="2.1",t["2_2"]="2.2",t["2_3"]="2.3",t["2_4"]="2.4",t["3_0"]="3.0",t["3_1"]="3.1",t["3_2"]="3.2",t["3_3"]="3.3",t["3_4"]="3.4",t["3_5"]="3.5",t.LATEST="3.5"}(Et||(Et={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(St||(St={})),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"}(_t||(_t={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(Ct||(Ct={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(At||(At={})),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"}(wt||(wt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(Mt||(Mt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Rt||(Rt={})),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"}(It||(It={})),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.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox",t.effect="effect",t.shape="shape",t.postProcessVolume="postProcessVolume",t.node="node",t.video="video",t.audio="audio",t.richtext="richtext"}(Pt||(Pt={})),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"}(Ot||(Ot={})),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"}(Nt||(Nt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(Ft||(Ft={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(Lt||(Lt={}));var zt,Ut,Bt,Gt,jt,Xt,Ht,Wt,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee,ie,re=1,ne=3,oe=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(zt||(zt={})),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",t[t.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",t[t.COLOR_CURVE=24]="COLOR_CURVE",t[t.VECTOR4_CURVE=25]="VECTOR4_CURVE",t[t.VECTOR2_CURVE=26]="VECTOR2_CURVE",t[t.VECTOR3_CURVE=27]="VECTOR3_CURVE"}(Ut||(Ut={})),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"}(Bt||(Bt={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(Gt||(Gt={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(jt||(jt={})),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"}(Xt||(Xt={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(Ht||(Ht={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Wt||(Wt={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(Yt||(Yt={})),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"}(qt||(qt={})),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",t.diffuse="diffuse"}(Kt||(Kt={})),function(t){t[t.visible=0]="visible",t[t.display=1]="display",t[t.clip=2]="clip",t[t.ellipsis=3]="ellipsis"}(Qt||(Qt={})),function(t){t[t.autoWidth=0]="autoWidth",t[t.autoHeight=1]="autoHeight",t[t.fixed=2]="fixed"}(Jt||(Jt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}($t||($t={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(te||(te={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(ee||(ee={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(ie||(ie={}));var se,ae,ue,he,le,ce,fe,de,pe,me,ve,ye,ge,xe={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};!function(t){t[t.Solid=0]="Solid",t[t.GradientLinear=1]="GradientLinear",t[t.GradientRadial=2]="GradientRadial",t[t.GradientAngular=3]="GradientAngular",t[t.Texture=4]="Texture"}(se||(se={})),function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(ae||(ae={})),function(t){t[t.Custom=0]="Custom",t[t.Rectangle=1]="Rectangle",t[t.Ellipse=2]="Ellipse",t[t.Polygon=3]="Polygon",t[t.Star=4]="Star"}(ue||(ue={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(he||(he={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(le||(le={})),function(t){t.AnimationClipNodeData="AnimationClipNodeData",t.BlendNodeData="BlendNodeData",t.ApplyAdditiveNodeData="ApplyAdditiveNodeData",t.LayerBlendNodeData="LayerBlendNodeData",t.StateMachineNodeData="StateMachineNodeData",t.TransitionNodeData="TransitionNodeData",t.StateNodeData="StateNodeData",t.ConstFloatNodeData="ConstFloatNodeData",t.ConstBoolNodeData="ConstBoolNodeData",t.ControlParameterBoolNodeData="ControlParameterBoolNodeData",t.ControlParameterFloatNodeData="ControlParameterFloatNodeData",t.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",t.NotNodeData="NotNodeData",t.AndNodeData="AndNodeData",t.OrNodeData="OrNodeData",t.EqualNodeData="EqualNodeData",t.GreaterNodeData="GreaterNodeData",t.LessNodeData="LessNodeData"}(ce||(ce={})),function(t){t.video="video",t.image="image"}(fe||(fe={})),function(t){t.video="video",t.audio="audio"}(de||(de={})),function(t){t.VFXItemData="VFXItemData",t.Material="Material",t.Shader="Shader",t.Geometry="Geometry",t.Texture="Texture",t.Image="Image",t.AnimationClip="AnimationClip",t.BinaryAsset="BinaryAsset",t.TrackAsset="TrackAsset",t.TimelineAsset="TimelineAsset",t.ObjectBindingTrack="ObjectBindingTrack",t.TransformTrack="TransformTrack",t.SpriteColorTrack="SpriteColorTrack",t.ActivationTrack="ActivationTrack",t.SubCompositionTrack="SubCompositionTrack",t.FloatPropertyTrack="FloatPropertyTrack",t.ColorPropertyTrack="ColorPropertyTrack",t.Vector2PropertyTrack="Vector2PropertyTrack",t.Vector3PropertyTrack="Vector3PropertyTrack",t.Vector4PropertyTrack="Vector4PropertyTrack",t.TransformPlayableAsset="TransformPlayableAsset",t.SpriteColorPlayableAsset="SpriteColorPlayableAsset",t.ActivationPlayableAsset="ActivationPlayableAsset",t.SubCompositionPlayableAsset="SubCompositionPlayableAsset",t.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",t.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",t.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",t.Vector3PropertyPlayableAsset="Vector3PropertyPlayableAsset",t.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",t.MeshComponent="MeshComponent",t.SkyboxComponent="SkyboxComponent",t.LightComponent="LightComponent",t.CameraComponent="CameraComponent",t.ModelPluginComponent="ModelPluginComponent",t.TreeComponent="TreeComponent",t.AnimationComponent="AnimationComponent",t.SpineComponent="SpineComponent",t.VideoComponent="VideoComponent",t.AudioComponent="AudioComponent",t.RichTextComponent="RichTextComponent",t.OrientationComponent="OrientationComponent",t.ShapeComponent="ShapeComponent",t.SpriteComponent="SpriteComponent",t.ParticleSystem="ParticleSystem",t.InteractComponent="InteractComponent",t.CameraController="CameraController",t.PostProcessVolume="PostProcessVolume",t.EffectComponent="EffectComponent",t.TextComponent="TextComponent",t.AnimationGraphAsset="AnimationGraphAsset",t.CompositionComponent="CompositionComponent",t.FFDComponent="FFDComponent",t.Animator="Animator",t.TimelineClip="TimelineClip"}(pe||(pe={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(me||(me={})),function(t){t[t.Float16=0]="Float16",t[t.Float32=1]="Float32",t[t.Int8=2]="Int8",t[t.Int16=3]="Int16",t[t.Int32=4]="Int32",t[t.UInt8=5]="UInt8",t[t.UInt16=6]="UInt16",t[t.UInt32=7]="UInt32"}(ve||(ve={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(ye||(ye={})),function(t){t.Position="POSITION",t.Uv="TEXCOORD0",t.Uv2="TEXCOORD1",t.Normal="NORMAL",t.Tangent="TANGENT",t.Color="COLOR",t.Joints="JOINTS",t.Weights="WEIGHTS",t.PositionBS0="POSITION_BS0",t.PositionBS1="POSITION_BS1",t.PositionBS2="POSITION_BS2",t.PositionBS3="POSITION_BS3",t.PositionBS4="POSITION_BS4",t.PositionBS5="POSITION_BS5",t.PositionBS6="POSITION_BS6",t.PositionBS7="POSITION_BS7",t.NormalBS0="NORMAL_BS0",t.NormalBS1="NORMAL_BS1",t.NormalBS2="NORMAL_BS2",t.NormalBS3="NORMAL_BS3",t.TangentBS0="TANGENT_BS0",t.TangentBS1="TANGENT_BS1",t.TangentBS2="TANGENT_BS2",t.TangentBS3="TANGENT_BS3"}(ge||(ge={}));var be=Et.LATEST,Te=Object.freeze({__proto__:null,LATEST_VERSION:be,get RenderLevel(){return St},get BlendingMode(){return _t},get SideMode(){return Ct},get ObscuredMode(){return At},get ParticleEmitterShapeType(){return wt},get PluginType(){return Mt},get InteractType(){return Rt},get InteractBehavior(){return It},get ItemType(){return Pt},get RenderMode(){return Ot},get ParticleOrigin(){return Nt},get RenderType(){return Ft},get RenderFace(){return Lt},get CameraClipMode(){return zt},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:re,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:ne,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:oe,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return Ut},get BezierKeyframeType(){return Bt},get JSONSceneVersion(){return Et},get EndBehavior(){return Gt},get ParticleInteractionBehavior(){return jt},get ShapeArcMode(){return Xt},get LightType(){return Ht},get ModelBoundingType(){return Wt},get CameraType(){return Yt},get MaterialType(){return Zt},get MaterialBlending(){return qt},get RenderMode3D(){return Kt},get TextOverflow(){return Qt},get TextSizeMode(){return Jt},get TextBaseline(){return $t},get TextAlignment(){return te},get TextWeight(){return ee},get FontStyle(){return ie},BuiltinObjectGUID:xe,get FillType(){return se},get TexturePaintScaleMode(){return ae},get ShapePrimitiveType(){return ue},get LineCap(){return he},get LineJoin(){return le},get NodeDataType(){return ce},get BackgroundType(){return fe},get MultimediaType(){return de},get DataType(){return pe},get GeometryType(){return me},get VertexFormatType(){return ve},get IndexFormatType(){return ye},get VertexBufferSemantic(){return ge}}),Ee=new Map,Se=new Map,_e={};function Ce(t){return _e[t]}function Ae(t){return function(e,i){_e[t]&&console.warn("Class "+t+" is already registered."),_e[t]=e}}function we(t,e){return function(t,e){return function(i,r){var n=function(t){var e=t.constructor;Ee.get(e)||Ee.set(e,{});return Ee.get(e)}(i);n&&(n[r]||(n[r]={type:t,sourceName:e}))}}(t,e)}function Me(t){var e=t.constructor;if(Se.get(e))return Se.get(e);var i={};Se.set(e,i);for(var r=t,n=e;n;){var o=Ee.get(n);for(var s in o)i[s]=o[s];var a=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(a).constructor)===Object)break;r=a}return i}var Re=function(){function t(t){this.engine=t,this.guid=ft(),this.defination={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){void 0!==t.id&&this.setInstanceId(t.id)},e.dispose=function(){this.engine.removeInstance(this.guid)},t.is=function(e){return s(e,t)&&"guid"in e},t}(),Ie=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),Pe={};function Oe(t){return function(e,i){Pe[t]&&console.warn("NodeData Class "+t+" is already registered."),Pe[t]=e}}function Ne(t){return Pe[t]}var Fe,Le=-1,Ve=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw new Error("Node not initialized!");0==--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw new Error("Node still initialized!");this.lastUpdateID=-1},t}(),De=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i.asset=this,i},t}(),ke=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.previousTime=0,e.currentTime=0,e}kt(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(Ve),ze=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.setValue=function(t){},e}(Ve),Ue=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(ze),Be=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(ze);exports.AnimationGraphAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).nodeDatas=[],e.graphDataSet=new Ie,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=Le,e}return kt(e,t),e.prototype.fromData=function(t){var i=t,r=i.nodeDatas;this.rootNodeIndex=i.rootNodeIndex,this.controlParameterIDs=i.controlParameterIDs;for(var n=i.controlParameterIDs.length,s=0;s<n;s++)this.parameterLookupMap.set(i.controlParameterIDs[s],s);this.nodeDatas=[];for(var a=0;a<r.length;a++)this.nodeDatas[a]=e.createNodeData(r[a].type),this.nodeDatas[a].load(r[a]);this.graphDataSet=new Ie,this.graphDataSet.resources=[];for(var u,h=o(i.graphDataSet.resources);!(u=h()).done;){var l=u.value,c=this.engine.findObject(l);this.graphDataSet.resources.push(c)}},e.createNodeData=function(t){var e=Ne(t);if(e)return new e;throw new Error("Unknown node type: "+t+".")},e}(Re),exports.AnimationGraphAsset=u([Ae("AnimationGraphAsset")],exports.AnimationGraphAsset),function(t){t[t.Active=0]="Active",t[t.Inactive=1]="Inactive"}(Fe||(Fe={}));var Ge=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),je=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t]):null},t}();function Xe(){return Xe=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},Xe.apply(this,arguments)}exports.AnimationClipNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(We,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=Xe({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(De),exports.AnimationClipNodeData=u([Oe(ce.AnimationClipNodeData)],exports.AnimationClipNodeData);var He,We=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).animation=null,e.animatable=null,e}kt(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=C(this.currentTime,0,1);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new Ye(e.skeleton,this.animation))},e}(ke);!function(t){t[t.Position=0]="Position",t[t.Scale=1]="Scale",t[t.Rotation=2]="Rotation",t[t.Euler=3]="Euler"}(He||(He={}));var Ye=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=o(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var s,a=o(e.scaleCurves);!(s=a()).done;){var u=s.value;this.addTransformCurveInfo(u,1)}for(var h,l=o(e.rotationCurves);!(h=l()).done;){var c=h.value;this.addTransformCurveInfo(c,2)}for(var f,d=o(e.eulerCurves);!(f=d()).done;){var p=f.value;this.addTransformCurveInfo(p,3)}for(var m,v=o(e.floatCurves);!(m=v()).done;){var y=m.value;this.addFloatCurveInfo(y)}for(var g,x=o(e.colorCurves);!(g=x()).done;){var b=g.value;this.addColorCurveInfo(b)}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=C(t,0,this.animationClip.duration),n=o(this.transformCurveInfos);!(i=n()).done;){var s=i.value,a=s.curve.keyFrames.getValue(r),u=e.parentSpaceTransforms[s.boneIndex];switch(s.type){case 0:u.position.copyFrom(a);break;case 1:u.scale.copyFrom(a);break;case 2:u.rotation.copyFrom(a);break;case 3:u.euler.copyFrom(a)}}for(var h,l=o(this.floatCurveInfos);!(h=l()).done;){var c=h.value,f=c.curve.keyFrames.getValue(r);e.floatPropertyValues[c.animatedObjectIndex]=f}for(var d,p=o(this.colorCurveInfos);!(d=p()).done;){var m=d.value,v=m.curve.keyFrames.getValue(r);e.colorPropertyValues[m.animatedObjectIndex]=v}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),Ze=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),o=t.tempVec0;return o.copyFrom(e).normalize(),this.x=o.x*n,this.y=o.y*n,this.z=o.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],o=e[1],s=e[5],a=e[9],u=e[2],h=e[6],l=e[10],c=i+s+l;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(h-a)*f,this.y=(n-u)*f,this.z=(o-r)*f}else if(i>s&&i>l){var d=2*Math.sqrt(1+i-s-l);this.w=(h-a)/d,this.x=.25*d,this.y=(r+o)/d,this.z=(n+u)/d,this.negate()}else if(s>l){var p=2*Math.sqrt(1+s-i-l);this.w=(n-u)/p,this.x=(r+o)/p,this.y=.25*p,this.z=(a+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-s);this.w=(o-r)/m,this.x=(n+u)/m,this.y=(a+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=i):(this.x=0,this.y=-t.z,this.z=t.y,this.w=i)):(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(C(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);if(0===i)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,o=t.w,s=e.x,a=e.y,u=e.z,h=e.w;return this.x=i*h+o*s+r*u-n*a,this.y=r*h+o*a+n*s-i*u,this.z=n*h+o*u+i*a-r*s,this.w=o*h-i*s-r*a-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this,r=i.x,n=i.y,o=i.z,s=i.w,a=s*t.w+r*t.x+n*t.y+o*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=r,this.y=n,this.z=o,this;var u=1-a*a;if(u<=Number.EPSILON){var h=1-e;return this.w=h*s+e*this.w,this.x=h*r+e*this.x,this.y=h*n+e*this.y,this.z=h*o+e*this.z,this.normalize(),this}var l=Math.sqrt(u),c=Math.atan2(l,a),f=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this.w=s*f+this.w*d,this.x=r*f+this.x*d,this.y=n*f+this.y*d,this.z=o*f+this.z*d,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this,r=i.x,n=i.y,o=i.z,s=i.w,a=t.x,u=t.y,h=t.z,l=s*a+n*h-o*u,c=s*u+o*a-r*h,f=s*h+r*u-n*a,d=-r*a-n*u-o*h,p=null!=e?e:t;return p.x=l*s+d*-r+c*-o-f*-n,p.y=c*s+d*-n+f*-r-l*-o,p.z=f*s+d*-o+l*-n-c*-r,p},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(w.ZERO,this,w.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}();Ze.tempVec0=new w;var qe=new Ze,Ke=function(){},Qe=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(Ke),Je=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=qe.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(Ke),$e=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var o=0;o<t.parentSpaceTransforms.length;o++){var s=t.parentSpaceTransforms[o],a=e.parentSpaceTransforms[o],u=r.parentSpaceTransforms[o],h=s.position,l=a.position,c=u.position;n.blendVector3(h,l,i,c);var f=s.rotation,d=a.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=s.scale,v=a.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=s.euler,x=a.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var E=t.floatPropertyValues[T],S=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,S,i)}for(var _=0;_<t.colorPropertyValues.length;_++){var C=t.colorPropertyValues[_],A=e.colorPropertyValues[_],w=r.colorPropertyValues[_];n.blendColor(C,A,i,w)}},t}();$e.normalBlendFunction=new Qe,$e.additiveBlendFunction=new Je;var ti=function(){function t(t){this.position=new w,this.rotation=new Ze,this.scale=new w,this.euler=new w,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),ei=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=o(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push((new ti).copyFrom(r))}for(var n,s=o(t.defaultFloatPropertyValues);!(n=s()).done;){var a=n.value;this.floatPropertyValues.push(a)}for(var u,h=o(t.defaultColorPropertyValues);!(u=h()).done;){var l=u.value;this.colorPropertyValues.push((new R).copyFrom(l))}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),ii=function(t){this.pose=new ei(t)};exports.ApplyAdditiveNodeData=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ri,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(De),exports.ApplyAdditiveNodeData=u([Oe(ce.ApplyAdditiveNodeData)],exports.ApplyAdditiveNodeData);var ri=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new ii(e.skeleton),this.additiveNodeResult=new ii(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){$e.additiveBlend(t,e,i,r)},e}(ke);exports.BlendNodeData=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ni,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(De),exports.BlendNodeData=u([Oe(ce.BlendNodeData)],exports.BlendNodeData);var ni=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).source0=null,e.source1=null,e.inputParameterValueNode=null,e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new ii(e.skeleton),this.source1Result=new ii(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){$e.localBlend(t,e,i,r)},e}(ke);exports.AndNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(oi,t),r=o(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(De),exports.AndNodeData=u([Oe(ce.AndNodeData)],exports.AndNodeData);var oi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=o(this.conditionNodes);!(e=i()).done;){if(!e.value.getValue(t)){this.result=!1;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=o(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=o(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(Be);exports.OrNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(si,t),r=o(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(De),exports.OrNodeData=u([Oe(ce.OrNodeData)],exports.OrNodeData);var si=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=o(this.conditionNodes);!(e=i()).done;){if(e.value.getValue(t)){this.result=!0;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=o(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=o(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(Be);exports.NotNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Le,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ai,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(De),exports.NotNodeData=u([Oe(ce.NotNodeData)],exports.NotNodeData);var ai=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.result=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}(Be);exports.ConstFloatNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ui,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(De),exports.ConstFloatNodeData=u([Oe(ce.ConstFloatNodeData)],exports.ConstFloatNodeData);var ui=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}return kt(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(Ue);exports.ConstBoolNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(hi,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(De),exports.ConstBoolNodeData=u([Oe(ce.ConstBoolNodeData)],exports.ConstBoolNodeData);var hi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}return kt(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(Be);exports.ControlParameterFloatNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(li,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(De),exports.ControlParameterFloatNodeData=u([Oe(ce.ControlParameterFloatNodeData)],exports.ControlParameterFloatNodeData);var li=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(Ue);exports.ControlParameterBoolNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ci,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(De),exports.ControlParameterBoolNodeData=u([Oe(ce.ControlParameterBoolNodeData)],exports.ControlParameterBoolNodeData);var ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(Be);exports.ControlParameterTriggerNodeData=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(fi,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(De),exports.ControlParameterTriggerNodeData=u([Oe(ce.ControlParameterTriggerNodeData)],exports.ControlParameterTriggerNodeData);var fi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(Be);exports.LayerBlendNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNodeIndex=Le,e.layerDatas=[],e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(di,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=o(this.layerDatas);!(i=r()).done;){var n=i.value;e.layers.push({inputNode:t.getNode(n.inputNodeIndex),weightValueNode:t.getNode(n.weightValueNodeIndex),weight:0})}},i.load=function(e){var i;if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:Le,e.layerDatas)for(var r,n=o(e.layerDatas);!(r=n()).done;){var s=r.value;this.layerDatas.push(Xe({inputNodeIndex:Le,weightValueNodeIndex:Le},s))}},e}(De),exports.LayerBlendNodeData=u([Oe(ce.LayerBlendNodeData)],exports.LayerBlendNodeData);var di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseLayerNode=null,e.layers=[],e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new ii(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var r,n=o(this.layers);!(r=n()).done;){var s,a,u=r.value;null==(s=u.inputNode)||s.initialize(e),null==(a=u.weightValueNode)||a.initialize(e)}},i.shutdownInternal=function(e){var i;null==(i=this.baseLayerNode)||i.shutdown(e);for(var r,n=o(this.layers);!(r=n()).done;){var s,a,u=r.value;null==(s=u.inputNode)||s.shutdown(e),null==(a=u.weightValueNode)||a.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()?(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e),e):e},i.updateLayers=function(t,e){for(var i,r=o(this.layers);!(i=r()).done;){var n=i.value;if(n.inputNode&&n.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),n.inputNode.evaluate(t,this.layerNodeResult);var s=n.weightValueNode.getValue(t);$e.localBlend(e.pose,this.layerNodeResult.pose,s,e.pose)}}return e},e}(ke);exports.EqualNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Le,e.comparandValueNodeIndex=Le,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(mi,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(De),exports.EqualNodeData=u([Oe(ce.EqualNodeData)],exports.EqualNodeData);var pi,mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}(Be),vi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Le,e.comparandValueNodeIndex=Le,e}return kt(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(De);!function(t){t[t.GreaterThan=0]="GreaterThan",t[t.LessThan=1]="LessThan"}(pi||(pi={}));var yi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}(Be);exports.GreaterNodeData=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.instantiate=function(t){var e=this.createNode(yi,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(vi),exports.GreaterNodeData=u([Oe(ce.GreaterNodeData)],exports.GreaterNodeData),exports.LessNodeData=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.instantiate=function(t){var e=this.createNode(yi,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(vi),exports.LessNodeData=u([Oe(ce.LessNodeData)],exports.LessNodeData),exports.StateMachineNodeData=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(xi,t),r=o(this.stateDatas);!(e=r()).done;){var n=e.value,s={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};i.states.push(s);for(var a,u=o(n.transitionDatas);!(a=u()).done;){var h=a.value,l={transitionNode:t.getNode(h.transitionNodeIndex),conditionNode:t.getNode(h.conditionNodeIndex),targetStateIndex:h.targetStateIndex};s.transitions.push(l)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex,this.machineName=e.machineName},e}(De),exports.StateMachineNodeData=u([Oe(ce.StateMachineNodeData)],exports.StateMachineNodeData);var gi,xi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).states=[],e.activeTransition=null,e.activeStateIndex=Le,e}kt(e,t);var i=e.prototype;return i.getCurrentStateName=function(){return this.states[this.activeStateIndex].stateNode.getNodeData().stateName},i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===Fe.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=Le,n=i.transitions.length,o=0;o<n;o++){var s=i.transitions[o];if(s.targetStateIndex===Le)throw new Error("Invalid target state index.");if(!this.states[s.targetStateIndex].stateNode.isTransitioning()){var a=!1;if(s.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>s.transitionNode.exitTime&&(a=!0)}else null!==s.conditionNode&&s.conditionNode.getValue(t)&&(a=!0);if(a){r=o;break}}}if(r!==Le){var h=i.transitions[r];h.transitionNode.initialize(t),e=null!==this.activeTransition?h.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):h.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=h.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=h.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.getNodeData().defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=Le,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=o(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=o(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(ke);exports.TransitionState=void 0,(gi=exports.TransitionState||(exports.TransitionState={}))[gi.None=0]="None",gi[gi.TransitioningIn=1]="TransitioningIn",gi[gi.TransitioningOut=2]="TransitioningOut",exports.StateNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNodeIndex=Le,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Ti,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex,this.stateName=e.stateName},e}(De),exports.StateNodeData=u([Oe(ce.StateNodeData)],exports.StateNodeData);var bi,Ti=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}kt(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(ke);exports.SourceType=void 0,(bi=exports.SourceType||(exports.SourceType={}))[bi.State=0]="State",bi[bi.Transition=1]="Transition",bi[bi.CachedPose=2]="CachedPose",exports.TransitionNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=Le,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Si,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(De),exports.TransitionNodeData=u([Oe(ce.TransitionNodeData)],exports.TransitionNodeData);var Ei,Si=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).hasExitTime=!1,e.exitTime=.75,e.transitionLength=0,e.transitionProgress=0,e.blendWeight=0,e.sourceNode=null,e.sourceType=0,e.blendedDuration=0,e}kt(e,t);var i=e.prototype;return i.evaluate=function(t,e){K(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=C(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=Fe.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult),o=e;if(this.registerPoseTasksAndUpdateRootMotion(i,n,o),this.blendedDuration=_(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var s=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+s)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),o},i.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},i.getProgressPercentage=function(){return this.transitionProgress},i.getSourceType=function(){return this.sourceType},i.isSourceATransition=function(){return 1===this.sourceType},i.isSourceAState=function(){return 0===this.sourceType},i.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.getSourceStateNode=function(){return this.sourceNode},i.getSourceTransitionNode=function(){return this.sourceNode},i.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.sourceNodeResult=new ii(e.skeleton),this.targetNodeResult=new ii(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},i.shutdownInternal=function(e){this.targetNode.setTransitioningState(exports.TransitionState.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(e),this.sourceNode.shutdown(e),this.sourceNode=null),t.prototype.shutdownInternal.call(this,e)},i.endSourceTransition=function(t){var e,i=this.getSourceTransitionNode().targetNode;null==(e=this.sourceNode)||e.shutdown(t),this.sourceNode=i,this.sourceType=0,this.getSourceStateNode().setTransitioningState(exports.TransitionState.TransitioningOut)},i.initializeTargetStateAndUpdateTransition=function(t,e,i){var r=this;this.markNodeActive(t);var n=this.targetNodeResult;return 0===r.sourceType&&r.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),n=this.targetNode.evaluate(t,n),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,n,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=_(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},i.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=C(this.blendWeight,0,1))},i.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;$e.localBlend(t.pose,e.pose,r,i.pose)},e}(ke);!function(t){t[t.Float=0]="Float",t[t.Color=1]="Color"}(Ei||(Ei={}));var _i=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=o(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var s,a=o(e.rotation);!(s=a()).done;){var u=s.value;this.addReferenceTransform(u)}for(var h,l=o(e.scale);!(h=l()).done;){var c=h.value;this.addReferenceTransform(c)}for(var f,d=o(e.euler);!(f=d()).done;){var p=f.value;this.addReferenceTransform(p),this.useEuler=!0}for(var m=0;m<e.floats.length;m++){var v=e.floats[m];this.addRecordedProperty(v.path,v.className,v.property,0)}for(var y=0;y<e.colors.length;y++){var g=e.colors[y];this.addRecordedProperty(g.path,g.className,g.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new ti(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n=t+e+i;if(void 0===this.pathToObjectIndex.get(n)){var o=this.findTarget(t);if(o){var s;(s="VFXItem"===e?o:o.getComponent(Ce(e)))||console.error("The "+e+" Component was not found.");for(var a=i.split("."),u=a[a.length-1],h=s,l=0;l<a.length-1;l++){var c=h[a[l]];void 0===c&&console.error("The "+a[l]+" property of "+h+" was not found."),h=c}var f={target:s,propertyPath:i,directTarget:h,propertyName:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(n,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push((new R).copyFrom(h[u])),this.pathToObjectIndex.set(n,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=o(i);!(e=n()).done;){var s=e.value,a=r.find(s);if(!a)return null;r=a}return r},t}(),Ci=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.context=new Ge;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=o(t.graphDataSet.resources);!(i=n()).done;){var s=i.value;if(s){for(var a,u=o(s.positionCurves);!(a=u()).done;){var h=a.value;r.position.push(h.path)}for(var l,c=o(s.rotationCurves);!(l=c()).done;){var f=l.value;r.rotation.push(f.path)}for(var d,p=o(s.scaleCurves);!(d=p()).done;){var m=d.value;r.scale.push(m.path)}for(var v,y=o(s.eulerCurves);!(v=y()).done;){var g=v.value;r.euler.push(g.path)}for(var x,b=o(s.floatCurves);!(x=b()).done;){var T=x.value;r.floats.push(T)}for(var E,S=o(s.colorCurves);!(E=S()).done;){var _=E.value;r.colors.push(_)}}}this.skeleton=new _i(e,r),this.result=new ii(this.skeleton),this.context.skeleton=this.skeleton;var C=new je;C.nodes=this.nodes,C.nodeDatas=t.nodeDatas,C.dataSet=t.graphDataSet;for(var A=0;A<t.nodeDatas.length;A++)C.nodes[A]||t.nodeDatas[A].instantiate(C);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];s(i,fi)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.getStateMachineNode=function(t){for(var e,i=null,r=o(this.nodes);!(e=r()).done;){var n=e.value;s(n,xi)&&n.getNodeData().machineName===t&&(i=n)}return i},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),Le)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);i!==Le&&this.nodes[i].setValue(e)},t}();function Ai(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 wi(t,e,i){return e&&Ai(t.prototype,e),i&&Ai(t,i),t}var Mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}kt(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onDestroy=function(){},i.onApplyAnimationProperties=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&y(this.item.components,this),t.prototype.dispose.call(this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},wi(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(Re);u([we()],Mi.prototype,"item",void 0),u([we()],Mi.prototype,"_enabled",void 0);var Ri=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(Mi);exports.Animator=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).graphInstance=null,e.graphAsset=null,e}kt(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graphInstance&&this.graphInstance.setBool(t,e)},i.setFloat=function(t,e){this.graphInstance&&this.graphInstance.setFloat(t,e)},i.setTrigger=function(t){this.graphInstance&&this.graphInstance.setTrigger(t)},i.resetTrigger=function(t){this.graphInstance&&this.graphInstance.resetTrigger(t)},i.getStateMachineNode=function(t){var e=null;return this.graphInstance&&(e=this.graphInstance.getStateMachineNode(t)),e},i.onStart=function(){this.graphAsset&&(this.graphInstance=new Ci(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graphInstance){for(var e=this.graphInstance.evaluateGraph(t/1e3),i=this.graphInstance.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,o=e.pose.parentSpaceTransforms[r].rotation,a=e.pose.parentSpaceTransforms[r].scale,u=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(a.x,a.y,a.z),this.graphInstance.skeleton.useEuler?i[r].setRotation(u.x,u.y,u.z):i[r].setQuaternion(o.x,o.y,o.z,o.w)}for(var h=this.graphInstance.skeleton.floatAnimatedObjects,l=0;l<h.length;l++){var c=h[l],f=c.propertyName;c.directTarget[f]=e.pose.floatPropertyValues[l],s(c.target,Mi)&&c.target.onApplyAnimationProperties()}for(var d=this.graphInstance.skeleton.colorAnimatedObjects,p=0;p<d.length;p++){var m=d[p],v=m.propertyName;m.directTarget[v]=e.pose.colorPropertyValues[p],s(m.target,Mi)&&m.target.onApplyAnimationProperties()}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(Mi),exports.Animator=u([Ae("Animator")],exports.Animator);var Ii=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e._priority=0,e}kt(e,t);var i=e.prototype;return i.render=function(t){},i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},wi(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(Mi);u([we()],Ii.prototype,"materials",void 0),u([we()],Ii.prototype,"_priority",void 0);var Pi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).meshCollider=new bs,e.getHitTestParams=function(t){var i=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,i);var r=e.meshCollider.getBoundingBoxData();if(r)return{type:r.type,triangles:r.area}},e}kt(e,t);var i=e.prototype;return i.render=function(t){for(var e=0;e<this.materials.length;e++){var i=this.materials[e];t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),i,e)}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(Ii);u([we()],Pi.prototype,"geometry",void 0),exports.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}kt(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new M;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(Pi),exports.EffectComponent=u([Ae(pe.EffectComponent)],exports.EffectComponent),exports.PostProcessVolume=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return kt(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(Mi),u([we()],exports.PostProcessVolume.prototype,"bloom",void 0),u([we()],exports.PostProcessVolume.prototype,"vignette",void 0),u([we()],exports.PostProcessVolume.prototype,"tonemapping",void 0),u([we()],exports.PostProcessVolume.prototype,"colorAdjustments",void 0),exports.PostProcessVolume=u([Ae(pe.PostProcessVolume)],exports.PostProcessVolume);var Oi=function(){function t(t,e,i,r,n,o,s,a,u,h,l,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,o,s,a,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,s,a,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=o,v[6]=s,v[7]=a,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,o,s,a,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=o,v[9]=s,v[13]=a,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),o=Math.sin(i),s=1-n,a=r.x,u=r.y,h=r.z,l=s*a,c=s*u;return this.set(l*a+n,l*u+o*h,l*h-o*u,0,l*u-o*h,c*u+n,c*h+o*a,0,l*h+o*u,c*h-o*a,s*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(w.ZERO,t,w.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,o=t.tempVec1,s=t.tempVec2;s.subtractVectors(e,i),s.normalize(),n.crossVectors(r,s),n.normalize(),o.crossVectors(s,n);var a=this.elements;return a[0]=n.x,a[1]=o.x,a[2]=s.x,a[3]=0,a[4]=n.y,a[5]=o.y,a[6]=s.y,a[7]=0,a[8]=n.z,a[9]=o.z,a[10]=s.z,a[11]=0,a[12]=-n.dot(e),a[13]=-o.dot(e),a[14]=-s.dot(e),a[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){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,o=i[0],s=i[4],a=i[8],u=i[12],h=i[1],l=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],E=r[4],S=r[8],_=r[12],C=r[1],A=r[5],w=r[9],M=r[13],R=r[2],I=r[6],P=r[10],O=r[14],N=r[3],F=r[7],L=r[11],V=r[15];return n[0]=o*T+s*C+a*R+u*N,n[4]=o*E+s*A+a*I+u*F,n[8]=o*S+s*w+a*P+u*L,n[12]=o*_+s*M+a*O+u*V,n[1]=h*T+l*C+c*R+f*N,n[5]=h*E+l*A+c*I+f*F,n[9]=h*S+l*w+c*P+f*L,n[13]=h*_+l*M+c*O+f*V,n[2]=d*T+p*C+m*R+v*N,n[6]=d*E+p*A+m*I+v*F,n[10]=d*S+p*w+m*P+v*L,n[14]=d*_+p*M+m*O+v*V,n[3]=y*T+g*C+x*R+b*N,n[7]=y*E+g*A+x*I+b*F,n[11]=y*S+g*w+x*P+b*L,n[15]=y*_+g*M+x*O+b*V,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],o=t[1],s=t[5],a=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*a*l-r*u*l-n*s*c+i*u*c+r*s*f-i*a*f)+t[7]*(+e*a*f-e*u*c+n*o*c-r*o*f+r*u*h-n*a*h)+t[11]*(+e*u*l-e*s*f-n*o*l+i*o*f+n*s*h-i*u*h)+t[15]*(-r*s*h-e*a*l+e*s*c+r*o*l-i*o*c+i*a*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],o=t[4],s=t[5],a=t[6],u=t[7],h=t[8],l=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=l*m*u-p*c*u+p*a*f-s*m*f-l*a*v+s*c*v,g=d*c*u-h*m*u-d*a*f+o*m*f+h*a*v-o*c*v,x=h*p*u-d*l*u+d*s*f-o*p*f-h*s*v+o*l*v,b=d*l*a-h*p*a-d*s*c+o*p*c+h*s*m-o*l*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=y*E,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*E,t[2]=(s*m*n-p*a*n+p*r*u-i*m*u-s*r*v+i*a*v)*E,t[3]=(l*a*n-s*c*n-l*r*u+i*c*u+s*r*f-i*a*f)*E,t[4]=g*E,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*E,t[6]=(d*a*n-o*m*n-d*r*u+e*m*u+o*r*v-e*a*v)*E,t[7]=(o*c*n-h*a*n+h*r*u-e*c*u-o*r*f+e*a*f)*E,t[8]=x*E,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*E,t[10]=(o*p*n-d*s*n+d*i*u-e*p*u-o*i*v+e*s*v)*E,t[11]=(h*s*n-o*l*n-h*i*u+e*l*u+o*i*f-e*s*f)*E,t[12]=b*E,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*E,t[14]=(d*s*r-o*p*r-d*i*a+e*p*a+o*i*m-e*s*m)*E,t[15]=(o*l*r-h*s*r+h*i*a-e*l*a-o*i*c+e*s*c)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=w.ZERO);var n=this.elements,o=e.x,s=e.y,a=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=o+o,d=s+s,p=a+a,m=o*f,v=o*d,y=o*p,g=s*d,x=s*p,b=a*p,T=u*f,E=u*d,S=u*p,_=i.x,C=i.y,A=i.z;return n[0]=(1-(g+b))*_,n[1]=(v+S)*_,n[2]=(y-E)*_,n[3]=0,n[4]=(v-S)*C,n[5]=(1-(m+b))*C,n[6]=(x+T)*C,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=h*n[0]+l*n[4]+c*n[8]-h+t.x,n[13]=h*n[1]+l*n[5]+c*n[9]-l+t.y,n[14]=h*n[2]+l*n[6]+c*n[10]-c+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,o=this.elements,s=n.set(o[0],o[1],o[2]).length(),a=n.set(o[4],o[5],o[6]).length(),u=n.set(o[8],o[9],o[10]).length();this.determinant()<0&&(s=-s),e.x=o[12],e.y=o[13],e.z=o[14];var h=t.tempMat0;h.copyFrom(this);var l=1/s,c=1/a,f=1/u;return h.elements[0]*=l,h.elements[1]*=l,h.elements[2]*=l,h.elements[4]*=c,h.elements[5]*=c,h.elements[6]*=c,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),r.x=s,r.y=a,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 w,e=new Ze,i=new w;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,o){var s=1/(e-t),a=1/(i-r),u=1/(o-n),h=-(e+t)*s,l=-(i+r)*a,c=-(o+n)*u;s*=2,a*=2,u*=-2;var f=this.elements;return f[0]=s,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=a,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=l,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var o=1/Math.tan(.5*t),s=1/(i-r),a=this.elements;return a[0]=n?o:o/e,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=n?o*e:o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(r+i)*s,a[11]=-1,a[12]=0,a[13]=0,a[14]=2*r*i*s,a[15]=0,null!==r&&r!==1/0||(a[10]=-1,a[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,s=null!=e?e:t;s.x=o[0]*i+o[4]*r+o[8]*n+o[12],s.y=o[1]*i+o[5]*r+o[9]*n+o[13],s.z=o[2]*i+o[6]*r+o[10]*n+o[14];var a=o[3]*i+o[7]*r+o[11]*n+o[15];return s.multiply(1/a)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n+o[12],s.y=o[1]*i+o[5]*r+o[9]*n+o[13],s.z=o[2]*i+o[6]*r+o[10]*n+o[14],s},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n,s.y=o[1]*i+o[5]*r+o[9]*n,s.z=o[2]*i+o[6]*r+o[10]*n,s.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,o=t.w,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[4]*r+s[8]*n+s[12]*o,a.y=s[1]*i+s[5]*r+s[9]*n+s[13]*o,a.z=s[2]*i+s[6]*r+s[10]*n+s[14]*o,a.w=s[3]*i+s[7]*r+s[11]*n+s[15]*o,a},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!S(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return(new t).lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,o){return(new t).perspective(e,i,r,n,o)},t.fromColumnVectors=function(e,i,r,n){return(new t).setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromScale=function(e,i,r){return(new t).setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return(new t).setFromTranslation(e,i,r)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return(new t).setFromRotationAxis(e,i)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,i,r){return(new t).setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return(new t).setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,o,s,a,u,h,l,c,f,d,p,m,v){return new t(e,o,h,d,i,s,l,p,r,a,c,m,n,u,f,v)},t}();function Ni(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 new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}function Fi(t){var i=t.getExtension("EXT_disjoint_timer_query_webgl2");if(i){var n=t.createQuery(),o=r((function(){return h(this,(function(r){return[2,new Promise((function(r,s){if(n){var a=t.getQueryParameter(n,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(i.GPU_DISJOINT_EXT);if(a&&!u){var h=t.getQueryParameter(n,t.QUERY_RESULT);r(h/1e3/1e3)}(a||u)&&(t.deleteQuery(n),n=null),null!==a&&n&&e.window.setTimeout((function(){o().then(r).catch}),1)}}))]}))}));if(!n)return;return{begin:function(){n&&t.beginQuery(i.TIME_ELAPSED_EXT,n)},end:function(){t.endQuery(i.TIME_ELAPSED_EXT)},getTime:o}}}Oi.IDENTITY=new Oi(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),Oi.ZERO=new Oi(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Oi.tempVec0=new w,Oi.tempVec1=new w,Oi.tempVec2=new w,Oi.tempMat0=new Oi;var Li,Vi,Di,ki,zi=[],Ui={},Bi="WebGL Constants not in global, please check your environment";function Gi(){"function"==typeof e.WebGL2RenderingContext?Xi(e.WebGL2RenderingContext):void 0!==e.WebGLRenderingContext?(Xi(e.WebGLRenderingContext),Xi(e.WebGLRenderingContext.prototype)):D?zi.push(k()?"iOS16 lockdown mode, WebGL Constants not in global":Bi):zi.push(Bi),zi.length||"HALF_FLOAT"in Ui||(Ui.HALF_FLOAT=5131)}function ji(t){return void 0!==e.WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function Xi(t){for(var e in t)/^[A-Z_]/.test(e)&&(Ui[e]=t[e])}function Hi(t){switch(t){case ve.Float32:return e.WebGLRenderingContext.FLOAT;case ve.Int16:return e.WebGLRenderingContext.SHORT;case ve.Int8:return e.WebGLRenderingContext.BYTE;case ve.UInt16:return e.WebGLRenderingContext.UNSIGNED_SHORT;case ve.UInt8:return e.WebGLRenderingContext.UNSIGNED_BYTE;default:return e.WebGLRenderingContext.FLOAT}}function Wi(t){switch(t){case _t.ALPHA:case _t.ADD:case _t.SUBTRACTION:case _t.STRONG_LIGHT:case _t.WEAK_LIGHT:return 1;case _t.SUPERPOSITION:return 2;case _t.BRIGHTNESS:return 3;case _t.MULTIPLY:return 0;default:return 1}}function Yi(t,e){switch(e){case void 0:case _t.ALPHA:t.blendFunction=[Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA,Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA];break;case _t.ADD:t.blendFunction=[Ui.ONE,Ui.ONE,Ui.ONE,Ui.ONE];break;case _t.SUBTRACTION:t.blendFunction=[Ui.ONE,Ui.ONE,Ui.ZERO,Ui.ONE],t.blendEquation=[Ui.FUNC_REVERSE_SUBTRACT,Ui.FUNC_REVERSE_SUBTRACT];break;case _t.SUPERPOSITION:t.blendFunction=[Ui.ONE,Ui.ONE,Ui.ONE,Ui.ONE];break;case _t.MULTIPLY:t.blendFunction=[Ui.DST_COLOR,Ui.ONE_MINUS_SRC_ALPHA,Ui.DST_COLOR,Ui.ONE_MINUS_SRC_ALPHA];break;case _t.BRIGHTNESS:t.blendFunction=[Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA,Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA];break;case _t.STRONG_LIGHT:t.blendFunction=[Ui.DST_COLOR,Ui.DST_ALPHA,Ui.ZERO,Ui.ONE];break;case _t.WEAK_LIGHT:t.blendFunction=[Ui.DST_COLOR,Ui.ZERO,Ui.ZERO,Ui.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Zi(t,e){e===Ct.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=Ui.CW,t.cullFace=e===Ct.BACK?Ui.BACK:Ui.FRONT)}function qi(t,e){switch(e){case void 0:t.stencilTest=!1;break;case exports.MaskMode.MASK:t.stencilTest=!0,t.stencilFunc=[Ui.ALWAYS,Ui.ALWAYS],t.stencilOpZPass=[Ui.REPLACE,Ui.REPLACE];break;case exports.MaskMode.OBSCURED:t.stencilTest=!0,t.stencilFunc=[Ui.EQUAL,Ui.EQUAL];break;case exports.MaskMode.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[Ui.NOTEQUAL,Ui.NOTEQUAL];break;case exports.MaskMode.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}zi.length||Gi(),exports.ShaderType=void 0,(Li=exports.ShaderType||(exports.ShaderType={}))[Li.vertex=0]="vertex",Li[Li.fragment=1]="fragment",exports.MaskMode=void 0,(Vi=exports.MaskMode||(exports.MaskMode={}))[Vi.NONE=0]="NONE",Vi[Vi.MASK=1]="MASK",Vi[Vi.OBSCURED=2]="OBSCURED",Vi[Vi.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",exports.TextureLoadAction=void 0,(Di=exports.TextureLoadAction||(exports.TextureLoadAction={}))[Di.whatever=0]="whatever",Di[Di.clear=2]="clear",exports.TextureSourceType=void 0,(ki=exports.TextureSourceType||(exports.TextureSourceType={}))[ki.none=0]="none",ki[ki.data=1]="data",ki[ki.image=2]="image",ki[ki.compressed=3]="compressed",ki[ki.video=4]="video",ki[ki.canvas=5]="canvas",ki[ki.framebuffer=6]="framebuffer",ki[ki.mipmaps=7]="mipmaps";var Ki=function(){function t(){this.callbacks={}}var i=t.prototype;return i.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},i.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},i.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},i.download=function(i,r,n,o){var s=this;if(void 0===r&&(r="json"),!this.start(i,n,o)){var a=new e.XMLHttpRequest,u=function(){s.finish(i,a.status,a.response)};a.responseType=r,a.addEventListener("load",(function(){200==a.status||0==a.status&&t.trustXHRStatusZero?s.finish(i,200,a.response):u()})),a.addEventListener("error",u),a.open("GET",i,!0),a.send()}},i.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},i.finish=function(e,i,r){var n=this.callbacks[e];delete this.callbacks[e];for(var o=200==i||0==i&&t.trustXHRStatusZero?[r]:[i,r],s=o.length-1,a=n.length;s<a;s+=2)n[s].apply(null,o)},t}();Ki.trustXHRStatusZero=!1;var Qi=!1,Ji=!1;function $i(t,e){return tr.apply(this,arguments)}function tr(){return(tr=r((function(t,e){return h(this,(function(i){switch(i.label){case 0:return!Qi&&e?[3,2]:[4,rr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Qi=!0,[4,rr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function er(t,e){return ir.apply(this,arguments)}function ir(){return(ir=r((function(t,e){return h(this,(function(i){switch(i.label){case 0:return!Ji&&e?[3,2]:[4,rr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Ji=!0,[4,rr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function rr(t){return nr.apply(this,arguments)}function nr(){return(nr=r((function(t){var i,r;return h(this,(function(n){if(i="",s(t,e.HTMLImageElement)){if(t.complete)return[2,t];i=t.src}else s(t,e.Blob)?(i=e.URL.createObjectURL(t),r=!0):"string"==typeof t&&(i=t);if(!i)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,n){var o=new e.Image;/^data:/.test(i)||(o.crossOrigin="*"),o.onload=function(){return o.onload=null,r&&e.URL.revokeObjectURL(i),t(o)},o.onerror=function(t){return o.onerror=null,r&&e.URL.revokeObjectURL(i),n("Load image fail: "+i+", reason: "+JSON.stringify(t))},o.src=i}))]}))}))).apply(this,arguments)}function or(t){return sr.apply(this,arguments)}function sr(){return(sr=r((function(t){return h(this,(function(e){return[2,new Promise((function(e,i){(new Ki).downloadBinary(t,e,(function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function ar(){return(ar=r((function(t){return h(this,(function(e){return[2,new Promise((function(e,i){(new Ki).downloadBlob(t,e,(function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function ur(t){return hr.apply(this,arguments)}function hr(){return(hr=r((function(t){var i;return h(this,(function(r){return i=e.document.createElement("video"),"string"==typeof t?i.src=t:i.srcObject=t,i.crossOrigin="anonymous",i.muted=!0,z()&&i.setAttribute("renderer","standard"),i.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var r=i.play().catch((function(t){e(t)}));r?r.then((function(){return t(i)})):i.addEventListener("loadeddata",(function e(){t(i),i.removeEventListener("loadeddata",e)}),!0),i.addEventListener("error",(function(t){e("Load video fail.")}))}))]}))}))).apply(this,arguments)}function lr(t,e){return cr.apply(this,arguments)}function cr(){return(cr=r((function(t,e){return h(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:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 4:return[2,i.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function fr(t,e,i){return dr.apply(this,arguments)}function dr(){return(dr=r((function(t,e,i,r){var n,o,s,a,u,l,c,f,d;return h(this,(function(h){switch(h.label){case 0:return void 0===r&&(r=[]),34067!==t.target?[3,2]:(n=t.mipmaps,o=t.target,s=n.map((function(t){return Promise.all(t.map((function(t){return t.id?i[t.id]:pr(t,e)})))})),[4,Promise.all(s)]);case 1:return a=h.sent(),[2,Xe({keepImageSource:!1},t,{mipmaps:a,sourceFrom:{target:o,type:exports.TextureSourceType.mipmaps}})];case 2:return u=t.mipmaps,l=t.target,c=u.map((function(t){return pr(t,e)})),[4,Promise.all(c)];case 3:return f=h.sent(),d=r[u[0][1][0]].url,[2,Xe({keepImageSource:!1},t,{mipmaps:f,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{target:l,bin:d,type:exports.TextureSourceType.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function pr(t,e){return mr.apply(this,arguments)}function mr(){return mr=r((function(t,i){var r,n,o,s,a;return h(this,(function(u){if(r=t[1],n=r[0],o=r[1],s=r[2],!(a=i[n]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,rr(new e.Blob([new Uint8Array(a,o,s)]))]}))})),mr.apply(this,arguments)}var vr=1,yr=function(t){function e(e){var i;return(i=t.call(this,e)||this).destroyed=!1,i.id="Tex"+vr++,i}kt(e,t);var i=e.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(t){var e=t.target,i=void 0===e?Ui.TEXTURE_2D:e,r=t.format,n=void 0===r?Ui.RGBA:r;return t.sourceType||(t.sourceType="image"in t?exports.TextureSourceType.image:"data"in t?exports.TextureSourceType.data:"video"in t?exports.TextureSourceType.video:0),Xe({minFilter:Ui.NEAREST,magFilter:Ui.NEAREST,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE,target:i,format:Ui.RGBA,internalFormat:n,type:Ui.UNSIGNED_BYTE},t)},e.fromImage=function(t,i,n){return r((function(){var r,o;return h(this,(function(s){switch(s.label){case 0:return[4,rr(t)];case 1:return r=s.sent(),(o=e.create(i,Xe({sourceType:exports.TextureSourceType.image,image:r,target:Ui.TEXTURE_2D,id:ft(),flipY:!0},n))).initialize(),[2,o]}}))}))()},e.fromVideo=function(t,i,n){return r((function(){var r,o;return h(this,(function(s){switch(s.label){case 0:return[4,ur(t)];case 1:return r=s.sent(),(o=e.create(i,Xe({sourceType:exports.TextureSourceType.video,video:r,id:ft(),flipY:!0},n))).initialize(),[2,o]}}))}))()},wi(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Re);function gr(t,e,i,r){var n,o,s=e.length/i/r;return o=n=4===s||0===s?Ui.RGBA:3===s?Ui.RGB:2===s?Ui.LUMINANCE_ALPHA:Ui.LUMINANCE,yr.createWithData(t,{data:e,width:i,height:r},{type:Ui.HALF_FLOAT,format:n,internalFormat:o,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE})}var xr={type:Ui.UNSIGNED_BYTE,format:Ui.RGBA,internalFormat:Ui.RGBA,wrapS:Ui.MIRRORED_REPEAT,wrapT:Ui.MIRRORED_REPEAT,minFilter:Ui.NEAREST,magFilter:Ui.NEAREST};function br(t){return yr.create(t,Xe({id:xe.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:exports.TextureSourceType.data},xr))}function Tr(t){return yr.create(t,Xe({id:xe.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:exports.TextureSourceType.data},xr))}var Er=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 new Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),s=67305985===o.getUint32(0,!0);this.glType=o.getUint32(1*n,s),this.glTypeSize=o.getUint32(2*n,s),this.glFormat=o.getUint32(3*n,s),this.glInternalFormat=o.getUint32(4*n,s),this.glBaseInternalFormat=o.getUint32(5*n,s),this.pixelWidth=o.getUint32(6*n,s),this.pixelHeight=o.getUint32(7*n,s),this.pixelDepth=o.getUint32(8*n,s),this.numberOfArrayElements=o.getUint32(9*n,s),this.numberOfFaces=o.getUint32(10*n,s),this.numberOfMipmapLevels=o.getUint32(11*n,s),this.bytesOfKeyValueData=o.getUint32(12*n,s),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:it.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+"."):it.warn("Texture arrays not currently supported."):it.warn("Only 2D textures currently supported.")}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,s=0;s<o;s++){for(var a=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,a);e.push({data:h,width:r,height:n}),i+=a+4,i+=3-(a+3)%4}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function Sr(t){var e=new Er(t,1),i=e.numberOfMipmapLevels,r=e.pixelWidth,n=e.pixelHeight,o=e.glType,s=e.numberOfFaces,a=e.glInternalFormat,u=e.glFormat,h=i>=Math.floor(Math.log2(Math.max(r,n))+1);return{sourceType:exports.TextureSourceType.compressed,type:o,target:6===s?Ui.TEXTURE_CUBE_MAP:Ui.TEXTURE_2D,internalFormat:a,format:u,mipmaps:e.mipmaps(h)}}var _r,Cr=function(){function t(){this.reloadPending={}}var i=t.prototype;return i.reload=function(t){var e=this;return r((function(){var i,r;return h(this,(function(n){switch(n.label){case 0:return i=t.id,e.reloadPending[i]?[2]:t.sourceFrom?(e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},i.canOffloadTexture=function(t){if(t){var e=t.type;if(e===exports.TextureSourceType.compressed||e===exports.TextureSourceType.image){var i=t.target,r=t.map,n=t.url;return i===Ui.TEXTURE_CUBE_MAP?"object"==typeof r&&!!r:nt(n)&&n.length>0}if(e===exports.TextureSourceType.mipmaps){var o=t.bin,s=t.mipmaps,a=t.target,u=t.maps,h=t.urls;return o?s.length>0:a===Ui.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return nt(t)&&t.length>0}))}}return!1},i.loadSource=function(t,e){var i=this;return r((function(){var r,n,o,s,a,u,l,c,f,d,p,m,v,y,g,x,b;return h(this,(function(h){switch(h.label){case 0:return r=t.type,n=t.target,o=t.map,s=t.url,a=t.bin,u=t.mipmaps,l=t.urls,c=t.maps,n!==Ui.TEXTURE_CUBE_MAP||r===exports.TextureSourceType.mipmaps?[3,2]:[4,i.loadCubeMap(o)];case 1:return f=h.sent(),[2,Xe({},e,{cube:f,target:Ui.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.image,sourceFrom:{type:exports.TextureSourceType.image,map:Xe({},o),target:Ui.TEXTURE_CUBE_MAP}})];case 2:return r!==exports.TextureSourceType.image?[3,4]:[4,rr(s)];case 3:return d=h.sent(),[2,Xe({},e,{image:d,sourceType:exports.TextureSourceType.image,sourceFrom:{type:r,url:s,target:Ui.TEXTURE_2D}})];case 4:return r!==exports.TextureSourceType.video?[3,6]:[4,ur(s)];case 5:return p=h.sent(),[2,Xe({},e,{video:p,sourceType:exports.TextureSourceType.video})];case 6:return r!==exports.TextureSourceType.compressed?[3,8]:[4,or(s)];case 7:return[2,Xe({},Sr(h.sent()),e,{sourceFrom:{url:s,type:exports.TextureSourceType.compressed}})];case 8:return r!==exports.TextureSourceType.mipmaps?[3,17]:a?[4,or(a)]:[3,13];case 9:return m=h.sent(),v=null!=n?n:Ui.TEXTURE_2D,y=v===Ui.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==Ui.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(u.map((function(t){return i.loadMipmapImages(t,m)})))];case 10:return g=h.sent(),[3,12];case 11:g=i.loadMipmapImages(u,m),h.label=12;case 12:return[2,Xe({},e,{mipmaps:g,target:v,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{bin:a,mipmaps:y,target:v,type:exports.TextureSourceType.mipmaps}})];case 13:return n!==Ui.TEXTURE_2D&&n?[3,15]:[4,Promise.all(l.map((function(t){return rr(t)})))];case 14:return x=h.sent(),[2,Xe({},e,{mipmaps:x,target:Ui.TEXTURE_2D,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:r,urls:l.slice(),target:Ui.TEXTURE_2D}})];case 15:return n!==Ui.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(c.map((function(t){return i.loadCubeMap(t)})))];case 16:return b=h.sent(),[2,Xe({},e,{mipmaps:b,target:Ui.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:r,maps:c.map((function(t){return Xe({},t)})),target:Ui.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: "+r+".")}}))}))()},i.loadMipmapImages=function(t,i){return r((function(){return h(this,(function(r){return[2,Promise.all(t.map((function(t){return rr(new e.Blob([new Uint8Array(i,t[0],t[1])]))})))]}))}))()},i.loadCubeMap=function(t){return r((function(){return h(this,(function(e){return[2,Promise.all(t.map((function(t){return rr(t)})))]}))}))()},t}();function Ar(){return _r||(_r=new Cr),_r}var wr,Mr=function(){function t(t){this.destroyed=!1;var e=t.name,i=void 0===e?"defaultDataBlock":e;this.name=i}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(i){e.setUniformValue(i,t[i])}))},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function Rr(t){return"object"==typeof t&&t&&void 0===t.length&&s(t,yr)}exports.MaterialRenderType=void 0,(wr=exports.MaterialRenderType||(exports.MaterialRenderType={}))[wr.normal=0]="normal",wr[wr.transformFeedback=1]="transformFeedback";var Ir,Pr,Or=1,Nr=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,o=void 0===n?"Material"+Or++:n,s=i.renderType,a=void 0===s?0:s,u=i.shader;r.name=o,r.renderType=a,r.shaderSource=u,r.props=i}else r.name="Material"+Or++,r.renderType=0;return r}kt(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},wi(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(Re),Fr=function(){function t(t){this.engine=t,this.alphaMaskEnabled=!1,this.maskMode=exports.MaskMode.NONE,this.maskable=null,this.stencilClearAction={stencilAction:exports.TextureLoadAction.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.setMaskOptions=function(t){var e=t.isMask,i=void 0!==e&&e,r=t.inverted,n=void 0!==r&&r,o=t.reference,s=t.alphaMaskEnabled,a=void 0!==s&&s;this.alphaMaskEnabled=a,i?this.maskMode=exports.MaskMode.MASK:(this.maskMode=n?exports.MaskMode.REVERSE_OBSCURED:exports.MaskMode.OBSCURED,this.maskable=this.engine.findObject(o))},e.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},t}();exports.ShaderCompileResultStatus=void 0,(Ir=exports.ShaderCompileResultStatus||(exports.ShaderCompileResultStatus={}))[Ir.noShader=0]="noShader",Ir[Ir.success=1]="success",Ir[Ir.fail=2]="fail",Ir[Ir.compiling=3]="compiling",exports.GLSLVersion=void 0,(Pr=exports.GLSLVersion||(exports.GLSLVersion={})).GLSL1="100",Pr.GLSL3="300 es";var Lr=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return kt(e,t),e}(Re);exports.Shader=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=o(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}(Re),exports.Shader=u([Ae(pe.Shader)],exports.Shader);var Vr="effects-internal-copy",Dr="effects-internal-copy-mesh",kr="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",zr="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function Ur(t,e){return{name:Vr,vertex:kr,fragment:zr,glslVersion:2===t?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!e]],cacheId:Dr+ +e}}var Br,Gr,jr={format:Ui.RGBA,type:Ui.UNSIGNED_BYTE,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE},Xr=Symbol("dispose"),Hr=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,i=t.width,r=t.height,n=t.name,o={sourceType:exports.TextureSourceType.framebuffer,data:{width:i,height:r},name:n},s=[n];Object.getOwnPropertyNames(jr).forEach((function(e){var i,r=null!=(i=t[e])?i:jr[e];o[e]=r,s.push(e,r)}));var a=s.join(":"),u=this.textureCache[a];if(u)this.textureRef[a]++;else{var h=this.engine;K(h),u=yr.create(h,o),this.textureCache[a]=u,this.textureRef[a]=1,u[Xr]=u.dispose,u.dispose=function(){return e.removeTexture(a)}}return u},e.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[Xr](),i.dispose=i[Xr]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var i=t.textureCache[e];i[Xr](),i.dispose=i[Xr]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Wr=function(){function t(t){void 0===t&&(t={}),this.semantics=Xe({},t)}var e=t.prototype;return e.toObject=function(){return Xe({},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 st(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}(),Yr=((Br={})[Ui.FLOAT]=Float32Array.BYTES_PER_ELEMENT,Br[Ui.INT]=Int32Array.BYTES_PER_ELEMENT,Br[Ui.SHORT]=Int16Array.BYTES_PER_ELEMENT,Br[Ui.BYTE]=Int8Array.BYTES_PER_ELEMENT,Br),Zr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}kt(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(Re);function qr(t){return t===Ui.INT?new Int32Array(0):t===Ui.SHORT?new Int16Array(0):new Float32Array(0)}!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"}(Gr||(Gr={}));var Kr=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],o=i[8],s=i[1],a=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case Gr.XYZ:this.y=Math.asin(C(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,a),this.z=0);break;case Gr.YXZ:this.x=Math.asin(-C(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(o,c),this.z=Math.atan2(s,a)):(this.y=Math.atan2(-h,r),this.z=0);break;case Gr.ZXY:this.x=Math.asin(C(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,a)):(this.y=0,this.z=Math.atan2(s,r));break;case Gr.ZYX:this.y=Math.asin(-C(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(l,c),this.z=Math.atan2(s,r)):(this.x=0,this.z=Math.atan2(-n,a));break;case Gr.YZX:this.z=Math.asin(C(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,a),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(o,c));break;case Gr.XZY:this.z=Math.asin(-C(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(l,a),this.y=Math.atan2(o,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=T,this.y*=T,this.z*=T,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,o,s;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(o=t[e+2])?o:0,this.order=null!=(s=t[e+3])?s: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):(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):(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 Ze;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,i=e.x,r=e.y,n=e.z,o=e.order,s=Math.cos(i*b*.5),a=Math.cos(r*b*.5),u=Math.cos(n*b*.5),h=Math.sin(i*b*.5),l=Math.sin(r*b*.5),c=Math.sin(n*b*.5);switch(o){case Gr.XYZ:t.set(h*a*u+s*l*c,s*l*u-h*a*c,s*a*c+h*l*u,s*a*u-h*l*c);break;case Gr.YXZ:t.set(h*a*u+s*l*c,s*l*u-h*a*c,s*a*c-h*l*u,s*a*u+h*l*c);break;case Gr.ZXY:t.set(h*a*u-s*l*c,s*l*u+h*a*c,s*a*c+h*l*u,s*a*u-h*l*c);break;case Gr.ZYX:t.set(h*a*u-s*l*c,s*l*u+h*a*c,s*a*c-h*l*u,s*a*u+h*l*c);break;case Gr.YZX:t.set(h*a*u+s*l*c,s*l*u+h*a*c,s*a*c-h*l*u,s*a*u-h*l*c);break;case Gr.XZY:t.set(h*a*u-s*l*c,s*l*u-h*a*c,s*a*c+h*l*u,s*a*u+h*l*c);break;default:console.error("unknown euler order: "+o)}return t},e.toMatrix4=function(t){var e=t.elements,i=this,r=i.x,n=i.y,o=i.z,s=i.order,a=Math.cos(r*b),u=Math.sin(r*b),h=Math.cos(n*b),l=Math.sin(n*b),c=Math.cos(o*b),f=Math.sin(o*b);if(s===Gr.XYZ){var d=a*c,p=a*f,m=u*c,v=u*f;e[0]=h*c,e[4]=-h*f,e[8]=l,e[1]=p+m*l,e[5]=d-v*l,e[9]=-u*h,e[2]=v-d*l,e[6]=m+p*l,e[10]=a*h}else if(s===Gr.YXZ){var y=h*c,g=h*f,x=l*c,T=l*f;e[0]=y+T*u,e[4]=x*u-g,e[8]=a*l,e[1]=a*f,e[5]=a*c,e[9]=-u,e[2]=g*u-x,e[6]=T+y*u,e[10]=a*h}else if(s===Gr.ZXY){var E=h*c,S=h*f,_=l*c,C=l*f;e[0]=E-C*u,e[4]=-a*f,e[8]=_+S*u,e[1]=S+_*u,e[5]=a*c,e[9]=C-E*u,e[2]=-a*l,e[6]=u,e[10]=a*h}else if(s===Gr.ZYX){var A=a*c,w=a*f,M=u*c,R=u*f;e[0]=h*c,e[4]=M*l-w,e[8]=A*l+R,e[1]=h*f,e[5]=R*l+A,e[9]=w*l-M,e[2]=-l,e[6]=u*h,e[10]=a*h}else if(s===Gr.YZX){var I=a*h,P=a*l,O=u*h,N=u*l;e[0]=h*c,e[4]=N-I*f,e[8]=O*f+P,e[1]=f,e[5]=a*c,e[9]=-u*c,e[2]=-l*c,e[6]=P*f+O,e[10]=I-N*f}else if(s===Gr.XZY){var F=a*h,L=a*l,V=u*h,D=u*l;e[0]=h*c,e[4]=-f,e[8]=l*c,e[1]=F*f+D,e[5]=a*c,e[9]=L*f-V,e[2]=V*f-L,e[6]=u*c,e[10]=D*f+F}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}();Kr.DEFAULT_ORDER=Gr.ZYX,Kr.tempQuat0=new Ze,Kr.tempMat0=new Oi;var Qr=function(){function t(t,e,i,r,n,o,s,a,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,o,s,a,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,s,a,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=s,h[1]=e,h[4]=n,h[7]=a,h[2]=i,h[5]=o,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,o,s,a,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=o,h[2]=s,h[5]=a,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,o=e+e,s=i+i,a=r+r,u=e*o,h=e*s,l=e*a,c=i*s,f=i*a,d=r*a,p=n*o,m=n*s,v=n*a,y=this.elements;return y[0]=1-(c+d),y[1]=h+v,y[2]=l-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=l+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],o=r[3],s=r[6],a=r[1],u=r[4],h=r[7];return r[0]=e*n+i*a,r[3]=e*o+i*u,r[6]=e*s+i*h,r[1]=-i*n+e*a,r[4]=-i*o+e*u,r[7]=-i*s+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,o=i[0],s=i[3],a=i[6],u=i[1],h=i[4],l=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],E=r[8];return n[0]=o*p+s*y+a*b,n[3]=o*m+s*g+a*T,n[6]=o*v+s*x+a*E,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*E,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],o=t[4],s=t[7],a=t[2],u=t[5],h=t[8];return e*(o*h-u*s)+n*(u*r-i*h)+a*(i*s-o*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],o=t[4],s=t[7],a=t[2],u=t[5],h=t[8],l=h*o-u*s,c=u*r-h*i,f=s*i-o*r,d=e*l+n*c+a*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(a*s-h*n)*p,t[2]=(u*n-a*o)*p,t[3]=c*p,t[4]=(h*e-a*r)*p,t[5]=(a*i-u*e)*p,t[6]=f*p,t[7]=(n*r-s*e)*p,t[8]=(o*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[3]*r+o[6]*n,s.y=o[1]*i+o[4]*r+o[7]*n,s.z=o[2]*i+o[5]*r+o[8]*n,s},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(!S(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return(new t).setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,o,s,a,u,h){return new t(e,n,a,i,o,u,r,s,h)},t}(),Jr=function(){function t(t,e){void 0===t&&(t=w.ZERO),void 0===e&&(e=w.X),this.origin=new w,this.direction=new w,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 w;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,o,s,a,u=this.origin,h=u.x,l=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,E=b.y,S=b.z,_=1/d,C=1/p,A=1/m;if(_>=0?(i=(y-h)*_,r=(T-h)*_):(i=(T-h)*_,r=(y-h)*_),C>=0?(n=(g-l)*C,o=(E-l)*C):(n=(E-l)*C,o=(g-l)*C),!(i>o||n>r||((n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),(n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),A>=0?(s=(x-c)*A,a=(S-c)*A):(s=(S-c)*A,a=(x-c)*A),i>a||s>r||((s>i||i!=i)&&(i=s),(a<r||r!=r)&&(r=a),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 w).copyFrom(this.origin):void 0;var o=-(this.origin.dot(i)+r)/n;return o>=0?this.at(o,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),o=n.dot(this.direction),s=n.dot(n)-o*o,a=e.radius*e.radius;if(!(s>a)){var u=Math.sqrt(a-s),h=o-u,l=o+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}},e.intersectTriangle=function(e,i,r){var n,o=e.p0,s=e.p1,a=e.p2,u=t.tempVec0.subtractVectors(s,o),h=t.tempVec1.subtractVectors(a,o),l=t.tempVec2.subtractVectors(this.origin,o),c=t.tempVec3.crossVectors(u,h),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(l,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(l);var p=n*this.direction.dot(u);if(!(p<0||d+p>f)){var m=-n*l.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();Jr.tempVec0=new w,Jr.tempVec1=new w,Jr.tempVec2=new w,Jr.tempVec3=new w;var $r,tn,en=function(){function t(t,e){void 0===t&&(t=new w(1/0,1/0,1/0)),void 0===e&&(e=new w(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,o=-1/0,s=-1/0,a=0,u=t.length;a<u;a+=3){var h=t[a],l=t[a+1],c=t[a+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>o&&(o=l),c>s&&(s=c)}return this.min.set(e,i,r),this.max.set(n,o,s),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 w),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 w),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,o=0,s=n.length;o<s;o++)this.expandByObject(n[o]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new w),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 w;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 w),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 w),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 w),this.isEmpty())return[];var i=[];return i[0]=new w(this.min.x,this.min.y,this.min.z),i[1]=new w(this.min.x,this.min.y,this.max.z),i[2]=new w(this.min.x,this.max.y,this.min.z),i[3]=new w(this.min.x,this.max.y,this.max.z),i[4]=new w(this.max.x,this.min.y,this.min.z),i[5]=new w(this.max.x,this.min.y,this.max.z),i[6]=new w(this.max.x,this.max.y,this.min.z),i[7]=new w(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 w;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}(),rn=function(){function t(t,e){void 0===t&&(t=w.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var o=(new en).setFromPoints(t);o.getCenter(i),this.radius=o.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new w),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 en),this.isEmpty()?(t.makeEmpty(),t):(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],o=Math.sqrt(Math.max(i,r,n));return this.center.applyMatrix(t),this.radius=this.radius*o,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new w).subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=.5*(r-this.radius);this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new w,i=new w;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 w).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}(),nn=Object.freeze({__proto__:null,get EulerOrder(){return Gr},Euler:Kr,Quaternion:Ze,Vector2:A,Vector3:w,Vector4:M,Matrix3:Qr,Matrix4:Oi,Ray:Jr,PI2:x,DEG2RAD:b,RAD2DEG:T,NumberEpsilon:E,isZero:function(t){return isNaN(t)||Math.abs(t)<E},isEqual:S,damp:function(t,e,i,r){return _(t,e,1-Math.exp(-i*r))},lerp:_,degToRad:function(t){return t*b},radToDeg:function(t){return t*T},clamp:C,Color:R,Box3:en,Sphere:rn}),on=1,sn=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).destroyed=!1,r.visible=!0,i){var n=i.material,o=i.geometry,s=i.name,a=void 0===s?"<unnamed>":s,u=i.priority,h=void 0===u?0:u,l=i.worldMatrix,c=void 0===l?Oi.fromIdentity():l;r.id="Mesh"+on++,r.name=a,r.geometry=o,r.material=n,r.priority=h,r.worldMatrix=c}else r.id="Mesh"+on++,r.name="<unnamed>",r.worldMatrix=Oi.fromIdentity(),r._priority=0;return r}kt(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){this.isDestroyed||this.getVisible()&&t.drawGeometry(this.geometry,this.worldMatrix,this.material)},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(t,e){e!==exports.DestroyOptions.keep&&this.material.dispose(),this.material=t},i.restore=function(){},i.dispose=function(e){this.destroyed||((null==e?void 0:e.geometries)!==exports.DestroyOptions.keep&&this.geometry.dispose(),(null==e?void 0:e.material)!==exports.DestroyOptions.keep&&this.material.dispose(),this.destroyed=!0,void 0!==this.engine&&this.engine.removeMesh(this),t.prototype.dispose.call(this))},wi(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Ii),an=1e3;exports.RenderPassAttachmentStorageType=void 0,($r=exports.RenderPassAttachmentStorageType||(exports.RenderPassAttachmentStorageType={}))[$r.none=0]="none",$r[$r.color=1]="color",$r[$r.stencil_8_opaque=2]="stencil_8_opaque",$r[$r.depth_16_opaque=3]="depth_16_opaque",$r[$r.depth_stencil_opaque=4]="depth_stencil_opaque",$r[$r.depth_16_texture=5]="depth_16_texture",$r[$r.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",exports.TextureStoreAction=void 0,(tn=exports.TextureStoreAction||(exports.TextureStoreAction={}))[tn.store=0]="store",tn[tn.clear=2]="clear";var un,hn=function(){function t(t,e){if(this.destroyed=!1,e){var i=e.texture,r=e.size;if(s(i,yr))this.texture=i,this.externalTexture=!0;else if(i){var n=i.wrapT,o=i.wrapS,a=i.minFilter,u=i.magFilter,h=i.internalFormat,l=i.format,c=void 0===l?Ui.RGBA:l,f=i.type,d=void 0===f?Ui.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:r,format:c,type:d,internalFormat:h||c,wrapT:n,wrapS:o,minFilter:a,magFilter:u,name:e.name},this.texture=yr.create(t,Xe({},this.textureOptions,{sourceType:exports.TextureSourceType.framebuffer,data:{width:r[0],height:r[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},wi(t,[{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}}]),t}();exports.RenderPassDestroyAttachmentType=void 0,(un=exports.RenderPassDestroyAttachmentType||(exports.RenderPassDestroyAttachmentType={}))[un.force=0]="force",un[un.keep=1]="keep",un[un.keepExternal=2]="keepExternal",un[un.destroy=0]="destroy";var ln=1,cn=function(){function t(t,e){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=e.name,r=void 0===i?"RenderPass_"+ln++:i,n=e.clearAction,o=e.semantics,s=e.depthStencilAttachment,a=e.storeAction,u=e.priority,h=void 0===u?0:u,l=e.meshOrder,c=void 0===l?exports.OrderType.ascending:l,f=e.meshes,d=void 0===f?[]:f,p=e.delegate,m=void 0===p?{}:p;this.name=r,this.renderer=t,this.priority=h,this.meshOrder=c,this.meshes=W(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=Xe({},n),this.storeAction=Xe({colorAction:0,depthAction:0,stencilAction:0},a),this.semantics=new Wr(o),this.options=e,this.delegate=m,this.setViewportOptions(e)}var e=t.prototype;return e.addMesh=function(t){Y(this.meshes,t,this.meshOrder)},e.removeMesh=function(t){y(this.meshes,t)},e.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),W(this.meshes,this.meshOrder),this.meshes},e.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],o=e[3];t.setViewport(i,r,n,o)}},e.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.frameCleanup=function(t){},e.resetColorAttachments=function(t){var e=this;if(t.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=t.map((function(t){return t.updateSource({sourceType:exports.TextureSourceType.framebuffer}),new hn(e.renderer.engine,{texture:t})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=i,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(t.map((function(t){return t}))))}else this.resetAttachments({attachments:t.map((function(t){return{texture:t}}))})},e.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.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._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var o=this.viewportScale,s=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*o,r.getHeight()*o],a=[s[2],s[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map((function(t,e){var r;return new hn(i.renderer.engine,Xe({size:a,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))}));this.attachments=h;var l=Hn.create({storeAction:this.storeAction,name:u,viewport:s,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);l.bind(),l.unbind(),this.framebuffer=l}else this.attachments.length=0},e.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]},e.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:i}}},e.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:i}}},e.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},e.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},e.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.dispose=function(t){if(!this.destroyed){var e=(null==t?void 0:t.meshes)||void 0;e!==exports.DestroyOptions.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0;var i=(null==t?void 0:t.colorAttachment)?t.colorAttachment:0;this.attachments.forEach((function(t){t.externalTexture&&2===i||1===i||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var r,n,o=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:0,s=this.framebuffer;if(s)if(s.dispose({depthStencilAttachment:o}),!(s.externalStorage&&2===o||1===o))null==(r=this.stencilTexture)||r.dispose(),null==(n=this.depthTexture)||n.dispose();this.options=this.renderer=null,this.initialize=ct}},wi(t,[{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()}}]),t}(),fn="precision highp float;attribute vec2 aUV;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;void main(){vec4 texParams=_TexParams;vTexCoord=vec2(aUV.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(texParams.w,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}}",dn="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",pn="#version 100\nprecision mediump float;\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\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#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",mn="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;vec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;}}",vn="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;void 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;}",yn="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",gn="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",xn="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);}",bn="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);}",Tn="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);}",En="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}",Sn={},_n=function(){function t(){}return t.registerInclude=function(t,e){Sn[t]&&it.warn('The "'+t+'" shader include already exist.'),Sn[t]=e},t.unRegisterInclude=function(t){delete Sn[t]},t.unRegisterAllIncludes=function(){Object.keys(Sn).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var i=e.level,r=e.shaderType,n=e.shader,o=e.macros,s=e.removeVersion,a=t.genMacroString(i,o),u=t.genShaderVersion(i),h=t.parseIncludes(n),l=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==i||l||(h=t.convertTo300(h,r===exports.ShaderType.fragment)),s?a+h:u+a+h},t.convertTo300=function(e,i){if(e=(e=(e=e.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(e=(e=(e=e.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!t.has300Output(e))if(/\bgl_FragData\[.+?\]/g.test(e)){var r=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(e=t.replaceMRTShader(e,r))}else e=(e=e.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}else e=e.replace(/\battribute\b/g,"in");return e},t.parseIncludes=function(t,e){var i;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var r=i[1],n=Sn[r];if(void 0===n)throw new Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},t.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach((function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)})),r.length?r.join("\n")+"\n":""},t.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},t.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},t.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},t.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},t.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var o=e[n].match(/\bgl_FragData\[(.+?)\]/);o&&i.add(o[1])}return i.forEach((function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},t}(),Cn=function(t){function e(e,i){var r,n=(r=t.call(this,e,i)||this).renderer.engine,o=Zr.create(n,{mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=Nr.create(n,{shader:{vertex:yn,fragment:En,glslVersion:exports.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=sn.create(n,{geometry:o,material:s,priority:0}),r.priority=5e3,r}kt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},i.execute=function(t){var e,i,r;t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var n=null!=(r=null==(i=t.renderingData.currentFrame.globalVolume)||null==(e=i.bloom)?void 0:e.threshold)?r:1;this.screenMesh.material.setFloat("_Threshold",n),t.renderMeshes([this.screenMesh])},e}(cn),An=function(t){function e(e,i,r){var n;(n=t.call(this,e,r)||this).type=i;var o=n.renderer.engine,s="PostProcess",a=Zr.create(o,{name:s,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u={vertex:yn,fragment:"H"===i?xn:bn,glslVersion:exports.GLSLVersion.GLSL1},h=Nr.create(o,{name:s,shader:u});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=sn.create(o,{name:s,geometry:a,material:h,priority:0}),n.priority=5e3,n}kt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",On(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFramebuffer().getColorTextures()[0])},e}(cn),wn=function(t){function e(e,i){var r,n="PostProcess",o=(r=t.call(this,e,i)||this).renderer.engine,s=Zr.create(o,{name:n,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a={vertex:yn,fragment:Tn},u=Nr.create(o,{name:n,shader:a});return u.blending=!1,u.depthTest=!1,u.culling=!1,r.screenMesh=sn.create(o,{name:n,geometry:s,material:u,priority:0}),r.priority=5e3,r}kt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",On(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},e}(cn),Mn=function(t){function e(e,i){var r,n="PostProcess",o=(r=t.call(this,e,{})||this).renderer.engine;r.sceneTextureHandle=i||new hn(o);var s=Zr.create(o,{name:n,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=Nr.create(o,{name:n,shader:{vertex:yn,fragment:gn,glslVersion:exports.GLSLVersion.GLSL1}});return a.blending=!1,a.depthTest=!1,a.culling=!1,r.screenMesh=sn.create(o,{name:n,geometry:s,material:a,priority:0}),r.priority=5e3,r}kt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},i.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear});var e=t.renderingData.currentFrame.globalVolume,i=Xe({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),r=Xe({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=Xe({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),o=Xe({active:!1},null==e?void 0:e.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,n.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*n.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*n.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(i.active)),i.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i.intensity)),r.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",r.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",r.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",r.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new A(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new w(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(o.active)),t.renderMeshes([this.screenMesh])},e}(cn),Rn="_effects_default_",In=1,Pn=function(){function t(t){var e;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=t.camera,r=t.keepColorBuffer,n=t.renderer,o=t.editorTransform,s=void 0===o?[1,1,0,0]:o,a=t.globalVolume,u=t.postProcessingEnabled,h=void 0!==u&&u,l=t.clearAction,c=void 0===l?{colorAction:exports.TextureLoadAction.whatever,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.whatever}:l,f=n.engine;a&&(this.globalVolume=a),this.globalUniforms=new Dn;var d,p=[],m={};if(this.renderer=n,h){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");var v=Ui.HALF_FLOAT;p=[{texture:{format:Ui.RGBA,type:v,magFilter:Ui.LINEAR,minFilter:Ui.LINEAR}}],d={storageType:exports.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear}}this.drawObjectPass=new cn(n,{name:Rn,priority:an,meshOrder:exports.OrderType.ascending,depthStencilAttachment:d,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),h){var g=new hn(f),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=new Array(7),T=Ui.HALF_FLOAT,E=new Cn(n,{name:"BloomThresholdPass",attachments:[{texture:{format:Ui.RGBA,type:T,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var S=0;S<7;S++){b[S]=new hn(f);var _=new An(n,"H",{name:"GaussianDownPassH"+S,viewport:x,attachments:[{texture:{format:Ui.RGBA,type:T,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR}}]}),C=new An(n,"V",{name:"GaussianDownPassV"+S,viewport:x,attachments:[{texture:{format:Ui.RGBA,type:T,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR}}]});C.gaussianResult=b[S],this.addRenderPass(_),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var w=new wn(n,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:Ui.RGBA,type:T,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR}}]});w.gaussianDownSampleResult=b[5-A],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new Mn(n,g);this.addRenderPass(R)}this.semantics=new Wr(t.semantics),this.clearAction=c,this.name="RenderFrame"+In++;var I=y[0];this.camera=i,this.keepColorBuffer=r,this.renderPassInfoMap.set(I,{listStart:0,listEnd:0,renderPass:I,intermedia:!1}),this.editorTransform=M.fromArray(s),t.clearAction||this.resetClearActions(),this.passTextureCache=new Hr(f);var P=f.gpuCapability,O=P.detail,N=Ur(P.level,O.readableDepthStencilTextures&&O.writableFragDepth);null==(e=this.renderer.getShaderLibrary())||e.addShader(N)}var e=t.prototype;return e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose();var e,i,r=(null==t?void 0:t.passes)?t.passes:void 0;(r!==exports.DestroyOptions.keep&&this._renderPasses.forEach((function(t){t.dispose(r)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.resource)&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(i=this.resource.depthStencil)||null==(e=i.texture)||e.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null);this.destroyed=!0},e.resetRenderPassDefaultAttachment=function(t,e){for(var i,r=this.resource,n=r.color_a,o=r.color_b,s=e;s<t.length;s++){var a,u,h=t[s],l=null==(a=h.attachments[0])?void 0:a.texture;if(l&&i===l){var c=l===n?o:n;h.resetColorAttachments([c])}(l=null==(u=h.attachments[0])?void 0:u.texture)&&(i=l)}},e.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(i,r){return!i.name.startsWith(Rn)||!i.meshes.includes(t)||(e=r,!1)})),e},e.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;i&&(0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e))},e.getRPAttachments=function(t,e){if(1===(null==t?void 0:t.length)){var i,r=t[0],n=r.texture,o=r.persistent,s=n.format,a=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(s===Ui.RGBA&&!o){var u=this.resource.color_a;return 0===a.length?[{texture:u}]:[{texture:a[0].texture===u?this.resource.color_b:u}]}}return t},e.resetClearActions=function(){var t=this.renderPasses.length>1?exports.TextureLoadAction.clear:exports.TextureLoadAction.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=exports.TextureLoadAction.whatever)},e.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.createResource=function(){var t=this.renderer.engine;if(!this.resource){var e,i=t.gpuCapability,r=i.detail,n=i.level,o=this.renderer.getWidth(),s=this.renderer.getHeight(),a=2===n?Ui.LINEAR:Ui.NEAREST,u=yr.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:Ui.RGBA,name:"frame_a",minFilter:a,magFilter:a}),h=yr.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:Ui.RGBA,data:{width:o,height:s},minFilter:a,magFilter:a,name:"frame_b"}),l=r.readableDepthStencilTextures&&r.writableFragDepth?exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:exports.RenderPassAttachmentStorageType.depth_stencil_opaque,c=new cn(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:u}]}).initialize(this.renderer),f=new Vn(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,colorAction:exports.TextureLoadAction.clear},meshOrder:exports.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(e=c.getDepthAttachment())?void 0:e.texture})]});this.resource={color_a:c.attachments[0].texture,color_b:h,finalCopyRP:f,depthStencil:c.depthAttachment,resRP:c}}},e.createCopyMesh=function(t){var e,i=Vr,r=this.renderer.engine,n=Zr.create(r,{name:i,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=Ur(r.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(o);var s=Nr.create(r,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:i,shader:o});return s.blending=!1,s.depthTest=!1,s.culling=!1,(null==t?void 0:t.blend)&&(s.blending=!0,s.blendFunction=[Ui.SRC_ALPHA,Ui.ONE_MINUS_SRC_ALPHA,Ui.SRC_ALPHA,Ui.ONE_MINUS_SRC_ALPHA]),sn.create(r,{name:i,geometry:n,material:s,priority:0})},e.removeRenderPass=function(t){y(this._renderPasses,t)},wi(t,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function On(t){return t?new A(t.getWidth(),t.getHeight()):new A}var Nn,Fn,Ln,Vn=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",On(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(cn),Dn=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},kn=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 wi(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),zn="function"==typeof e.WebGL2RenderingContext,Un=function(){function t(t){this.setupCapability(t)}var i=t.prototype;return i.setupCapability=function(t){var i,r=zn&&s(t,e.WebGL2RenderingContext)?2:1,n=2===r,o=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),u=!!t.getExtension("OES_texture_half_float_linear"),h=!!t.getExtension("OES_texture_float_linear");this.level=r,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&&!u&&(u=Bn(t,t.HALF_FLOAT)),n&&!h&&(h=Bn(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,c=n?e.WebGL2RenderingContext.HALF_FLOAT:(null==(i=t.getExtension("OES_texture_half_float"))?void 0:i.HALF_FLOAT_OES)||0,f={floatTexture:l,halfFloatTexture:c,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"):c>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:Gn(t),halfFloatLinear:u,floatLinear:h,maxTextureAnisotropy:o?t.getParameter(o.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:!!this.glAsyncCompileExt,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=f,o&&(this.textureMaxAnisotropyExt=o.TEXTURE_MAX_ANISOTROPY_EXT)},i.framebufferTexture2D=function(t,e,i,r,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&i>0)throw new Error("Draw multiple color buffers not available.");var s=o?o["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];s?t.framebufferTexture2D(e,s,r,n,0):console.error("Invalid color attachment index: "+i+".")},i.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1!==this.level||i){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)}else if(e.length>1)throw new Error("Draw buffers not available.")},i.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function Bn(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}function Gn(t){return t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0}exports.COMPRESSED_TEXTURE=void 0,(Nn=exports.COMPRESSED_TEXTURE||(exports.COMPRESSED_TEXTURE={}))[Nn.NONE=0]="NONE",Nn[Nn.PVRTC=1]="PVRTC",Nn[Nn.ASTC=2]="ASTC",exports.FilterMode=void 0,(Fn=exports.FilterMode||(exports.FilterMode={}))[Fn.Nearest=0]="Nearest",Fn[Fn.Linear=1]="Linear",exports.RenderTextureFormat=void 0,(Ln=exports.RenderTextureFormat||(exports.RenderTextureFormat={}))[Ln.RGBA32=0]="RGBA32",Ln[Ln.RGBAHalf=1]="RGBAHalf";var jn,Xn,Hn=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){},wi(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),Wn=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i,r){},e.getTemporaryRT=function(t,e,i,r,n,o){return null},e.dispose=function(t){},t}(),Yn=function(t){function e(e){var i;(i=t.call(this,e)||this).visible=!0,i.meshCollider=new bs,i._color=new R(1,1,1,1),i.getHitTestParams=function(t){var e=Oi.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.meshCollider.setGeometry(i.geometry,e);var n,o=i.meshCollider.getBoundingBoxData();if(o)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:o.type,triangles:o.area,backfaceCulling:i.renderer.side===Ct.FRONT}}},i.renderer={renderMode:Ot.MESH,blending:_t.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:Ct.DOUBLE,mask:0},i.defaultGeometry=Zr.create(i.engine,{attributes:{aPos:{type:Ui.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Ui.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Ui.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var r=Nr.create(i.engine,{shader:{fragment:dn,vertex:fn,shared:!0}});return i.material=r,i.material.setColor("_Color",new R(1,1,1,1)),i.maskManager=new Fr(e),i}kt(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){s(t,R)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return r((function(){var i;return h(this,(function(r){switch(r.label){case 0:return"string"!=typeof t?[3,2]:[4,yr.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}}))}))()},i.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},i.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.mask,o=t.texture,s=this.maskManager.maskMode,a=this.material;a.blending=!0,a.depthTest=!0,a.depthMask=i,a.stencilRef=void 0!==n?[n,n]:void 0,Yi(a,r),qi(a,s),Zi(a,e),a.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',a.setVector4("_TexOffset",new M(0,0,1,1)),a.setTexture("_MainTex",o);var u=Wi(r),h=new M;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=u,h.z=t.renderMode,h.w=s,a.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?a.enableMacro("ALPHA_CLIP"):a.disableMacro("ALPHA_CLIP"),a},i.draw=function(t){for(var e=0;e<this.materials.length;e++){var i=this.materials[e];i.setVector2("_Size",this.transform.size),this.renderer.renderMode!==Ot.BILLBOARD&&this.renderer.renderMode!==Ot.VERTICAL_BILLBOARD&&this.renderer.renderMode!==Ot.HORIZONTAL_BILLBOARD||i.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),i,e)}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r,n,o,s=e,a=null!=(i=s.renderer)?i:{},u=s.mask;u&&this.maskManager.setMaskOptions(u),this.renderer={renderMode:null!=(r=a.renderMode)?r:Ot.MESH,blending:null!=(n=a.blending)?n:_t.ALPHA,texture:a.texture?this.engine.findObject(a.texture):this.engine.whiteTexture,occlusion:!!a.occlusion,transparentOcclusion:!!a.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(o=a.side)?o:Ct.DOUBLE,mask:this.maskManager.getRefValue()},this.configureMaterial(this.renderer)},wi(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(Ii),Zn=(jn=new Float32Array(1),Xn=new Int32Array(jn.buffer),function(t){jn[0]=t;var e=Xn[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?i|=((r|=2048)>>114-n)+(r>>113-n&1):(i|=n-112<<10|r>>1,i+=1&r)}),qn=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]=Zn(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=Zn(t[i])},t}();var Kn,Qn=new Kr,Jn=new Oi;function $n(t,e,i,r,n,o,s){var a=t,u=r/n,h=r,l=e.speedOverLifetime;l&&(h=l.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;a.copyFrom(o),a.addScaledVector(s,h),a.addScaledVector(i,c);var f=e.linearVelOverLifetime||{},d=e.orbitalVelOverLifetime||{};if(d.enabled){var p=new w;d.center&&p.setFromArray(d.center);var m=a.clone().subtract(p),v=d.asRotation,y=["x","y","z"].map((function(t){var e=d[t];return e?v?e.getValue(u):e.getIntegrateValue(0,r,n):0}));Qn.setFromArray(y).negate(),Jn.setFromEuler(Qn);var g=Jn.transformPoint(m);a.addVectors(p,g)}if(f.enabled){var x=f.asMovement,b=f.x,T=f.y,E=f.z;if(b){var S=x?b.getValue(u):b.getIntegrateValue(0,r,n);a.x=a.x+S}if(T){var _=x?T.getValue(u):T.getIntegrateValue(0,r,n);a.y=a.y+_}if(E){var C=x?E.getValue(u):E.getIntegrateValue(0,r,n);a.z=a.z+C}}return a}function to(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function eo(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function io(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var o=0;o<e.length;o++)t[o]=e[o]}else if(i&&t!==i)for(var s=0;s<i.length;s++)t[s]=i[s];return t}var ro=((Kn={})[Nt.PARTICLE_ORIGIN_CENTER]=[0,0],Kn[Nt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Kn[Nt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Kn[Nt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Kn[Nt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Kn[Nt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Kn[Nt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Kn[Nt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Kn[Nt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Kn);function no(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function oo(t,e,i){var r=i.position,n=new w(t,e,0),o=new w;return i.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(r),new Jr(r,o)}function so(t,e,i){var r=t.x,n=t.y,o=t.z,s=new w(r-e,n+i,o),a=new w(r-e,n-i,o),u=new w(r+e,n-i,o),h=new w(r+e,n+i,o);return[{p0:s,p1:a,p2:u},{p0:s.clone(),p1:u.clone(),p2:h}]}function ao(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function uo(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var ho={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex,o=e[r],s=e[n];return new A(o,s)},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===Bt.LINE||i===Bt.EASE_OUT?0:i===Bt.EASE_IN||i===Bt.EASE||i===Bt.HOLD&&r===Bt.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==Bt.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==Bt.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[Bt.EASE,Bt.EASE_IN,Bt.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[Bt.EASE,Bt.EASE_OUT,Bt.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===Bt.HOLD&&[Bt.HOLD,Bt.LINE_OUT,Bt.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===Bt.HOLD&&[Bt.HOLD,Bt.LINE,Bt.EASE_IN].includes(i)}},lo=function(t,e){this.points=t,this.totalLength=e},co={},fo={},po=.1;function mo(t,e){return 1-3*e+3*t}function vo(t,e){return 3*e-6*t}function yo(t){return 3*t}function go(t,e,i){return((mo(e,i)*t+vo(e,i))*t+yo(e))*t}function xo(t,e,i){return 3*mo(e,i)*t*t+2*vo(e,i)*t+yo(e)}var bo=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=uo(e.x-t.x,3)+"_"+uo(e.y-t.y,3)+"_"+uo(e.z-t.z,3)+"&"+uo(i.x-t.x,3)+"_"+uo(i.y-t.y,3)+"_"+uo(i.z-t.z,3)+"&"+uo(r.x-t.x,3)+"_"+uo(r.y-t.y,3)+"_"+uo(r.z-t.z,3);if(fo[n])return{data:fo[n],interval:t};for(var o=[],s=null,a=0,u=0,h=0;h<300;h+=1){var l=new w,c=h/299;u=0,l.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),l.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),l.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==s&&(u+=Math.pow(l.x-s.x,2),u+=Math.pow(l.y-s.y,2),u+=Math.pow(l.z-s.z,2)),s=l,a+=u=Math.sqrt(u),o[h]={partialLength:u,point:l}}var f=new lo(o,a);return fo[n]=f,{data:f,interval:new w(t.x,t.y,t.z)}}(t,e,i,r),o=n.data,s=n.interval;this.lengthData=o,this.interval=s,this.totalLength=o.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(ao(1-t,0))return e.points[299].point.clone().add(this.interval);if(ao(e.totalLength,0))return this.p1.clone();var i=new w,r=uo(e.totalLength*t,4),n=this.catching.lastAddedLength,o=this.catching.lastPoint;if(ao(n,r))return e.points[o].point.clone().add(this.interval);var s=!0,a=1;for(r<n&&(a=-1);s;){if(r>=n){if(299===o){i.x=e.points[o].point.x,i.y=e.points[o].point.y,i.z=e.points[o].point.z;break}if(r<n+e.points[o+1].partialLength){var u=(r-n)/e.points[o+1].partialLength;i.x=e.points[o].point.x+(e.points[o+1].point.x-e.points[o].point.x)*u,i.y=e.points[o].point.y+(e.points[o+1].point.y-e.points[o].point.y)*u,i.z=e.points[o].point.z+(e.points[o+1].point.z-e.points[o].point.z)*u;break}}a>0&&o<299?(o+=a,n+=uo(e.points[o].partialLength,5)):a<0&&o>0?(n-=uo(e.points[o].partialLength,5),o+=a):s=!1}return this.catching.lastPoint=o,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),To=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new Ze,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):ao(1-t,0)?this.temp.copyFrom(this.p2):(Co.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),Eo=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new A,this.control2=new A,this.weighted=!1,this.isConstant=!1,this.mSampleValues=new Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),go(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var o=1-n,s=o*o,a=n*n;return t*(s*o)+e*s*n*3+i*o*a*3+r*(a*n)},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=go(t*po,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=po;var n=i+(t-e[--r])/(e[r+1]-e[r])*po,o=xo(n,this.control1.x,this.control2.x);return o>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var o=xo(e,i,r);if(0===o)return e;e-=(go(e,i,r)-t)/o}return e}(t,n,this.control1.x,this.control2.x):0===o?n:function(t,e,i,r,n){var o,s,a=0;do{(o=go(s=e+(i-e)/2,r,n)-t)>0?i=s:e=s}while(Math.abs(o)>1e-7&&++a<10);return s}(t,i,i+po,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,this.control1.x===this.control1.y&&this.control2.x===this.control2.y||this.calcSampleValues()},t}();function So(t,e){var i=_o(t,e,!0),r=i.p0,n=i.p1,o=i.p2,s=i.p3;K(o),K(s);var a,u,h=s.x-r.x,l=s.y-r.y,c=uo((n.x-r.x)/h,5),f=uo((o.x-r.x)/h,5);ao(l,0)?a=u=NaN:(a=uo((n.y-r.y)/l,5),u=uo((o.y-r.y)/l,5)),c<0&&(console.error("Invalid bezier points, x1 < 0",r,n,o,s),c=0),f<0&&(console.error("Invalid bezier points, x2 < 0",r,n,o,s),f=0),c>1&&(console.error("Invalid bezier points, x1 >= 1",r,n,o,s),c=1),f>1&&(console.error("Invalid bezier points, x2 >= 1",r,n,o,s),f=1);var d,p=("bez_"+c+"_"+a+"_"+f+"_"+u).replace(/\./g,"p");return co[p]?d=co[p]:(d=ao(l,0)?new Eo:new Eo(c,a,f,u),co[p]=d),{points:[r,n,o,s],timeInterval:h,valueInterval:l,curve:d}}function _o(t,e,i){var r=t[1],n=ho.isHoldOutKeyframe(t),o=ho.isHoldInKeyframe(e),s=!o&&ho.isRightSideEase(t),a=!n&&ho.isLeftSideEase(e);if(s&&!a&&!o){var u=new A(r[r.length-4],r[r.length-3]),h=new A(r[r.length-2],r[r.length-1]),l=ho.getPointInCurve(e),c=new A(l.x,l.y);return{type:"ease",p0:u,p1:h,p2:new A(c.x-(c.x-u.x)/10,c.y),p3:c}}if(!s&&a&&!n){var f=e[1],d=ho.getPointInCurve(t),p=new A(d.x,d.y),m=new A(f[0],f[1]),v=new A(f[2],f[3]);return{type:"ease",p0:p,p1:new A(p.x+(v.x-p.x)/10,p.y),p2:m,p3:v}}if(s&&a){var y=e[1];return{type:"ease",p0:new A(r[r.length-4],r[r.length-3]),p1:new A(r[r.length-2],r[r.length-1]),p2:new A(y[0],y[1]),p3:new A(y[2],y[3])}}var g=ho.getPointInCurve(t),x=ho.getPointInCurve(e);return n?x.y=g.y:o&&(g.y=x.y),i?{type:"ease",p0:g,p1:new A((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new A((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||o,leftHoldLine:n,rightHoldLine:o}:{type:"line",p0:g,p1:x,isHold:n||o,leftHoldLine:n,rightHoldLine:o}}var Co=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,o=e.y,s=e.z,a=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r)return t.x=n,t.y=o,t.z=s,void(t.w=a);if(1===r)return t.x=u,t.y=h,t.z=l,void(t.w=c);if(a!==c||n!==u||o!==h||s!==l){var f=1-r,d=n*u+o*h+s*l+a*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,o=o*f+h*g,s=s*f+l*g,a=a*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+o*o+s*s+a*a);n*=x,o*=x,s*=x,a*=x}}t.x=n,t.y=o,t.z=s,t.w=a},t}(),Ao="not_implement",wo=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(Ao)},e.getIntegrateValue=function(t,e,i){throw new Error(Ao)},e.getIntegrateByTime=function(t,e){throw new Error(Ao)},e.getValue=function(t){throw new Error(Ao)},e.getMaxTime=function(){throw new Error(Ao)},e.toUniform=function(t){throw new Error(Ao)},e.map=function(t){throw new Error(Ao)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(Ao)},t.getAllData=function(t,e){for(var i=new(e?qn:Float32Array)(4*t.index),r=0,n=0,o=t.curves;r<o.length;r++){var s=o[r].toData();i.set(s,n),n+=s.length}return e?i.data:i},t}(),Mo=function(t){function e(){return t.apply(this,arguments)}kt(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}(wo),Ro=function(t){function e(){return t.apply(this,arguments)}kt(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}(wo),Io=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){var i=null!=e?e:Math.random();return this.min+i*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){var r=null!=i?i:1;return(this.min+r*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(wo),Po=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var o=Math.random();r[n]=e[n]*(1-o)+i[n]*o}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(wo),Oo=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,o=this.xCoord*i;return((r+e/o*(n-r)+r)*e-(r+t/o*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return zo(e,0,this.xCoord,this.min,this.max)-zo(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}(wo),No=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=O(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],o=e[r+1];if(n.time<=t&&o.time>t){var s=(t-n.time)/(o.time-n.time);return N(n.color.toArray(),o.color.toArray(),s,!0)}}return e[i].color.toArray()},e}(wo),Fo=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],o=e[r+1],s=n[0],a=o[0];if(t>=s&&t<=a){var u=(t-s)/(a-s),h=n[1];return h+u*(o[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,o=e?zo:ko,s=0;s<n;s++){var a=i[s],u=i[s+1],h=a[0],l=u[0];if(t>h&&t<=l)return r+o(t,h,l,a[1],u[1]);r+=o(l,h,l,a[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=this.keys,r=Math.ceil(i.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},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}(wo),Lo=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],o=e[r+1];if(n[0]<=t&&o[0]>=t){var s=o[1]-n[1],a=void 0;if(0===s)a=(t-n[0])/(o[0]-n[0]);else a=(Uo(t,n,o)-n[1])/s;return this.calculateVec(r,a)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],o=0;o<i.length;o++)n[o]=i[o]*(1-e)+r[o]*e;return n},e}(wo),Vo=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var o=e[n],s=e[n+1],a=new w(i[n][0],i[n][1],i[n][2]),u=new w(i[n+1][0],i[n+1][1],i[n+1][2]),h=new w(r[2*n][0],r[2*n][1],r[2*n][2]),l=new w(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=So(o,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new bo(a,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=uo(t,5),i=0,r=new w,n=this.keyTimeData;if(!n.length)return r;var o=this.curveSegments[n[0]].timeStart,s=this.curveSegments[n[n.length-1]].timeEnd;if(e<=o)return r=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=s)return r=this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<n.length;a++){var u=this.curveSegments[n[a]].timeStart,h=this.curveSegments[n[a]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[a]].pathCurve;i=this.getPercValue(n[a],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,o=uo((e-r.x)/n,4);return C(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(wo),Do=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var o=e[n],s=e[n+1],a=Ze.fromArray(i[n]),u=Ze.fromArray(i[n+1]),h=Ze.fromArray(r[2*n]),l=Ze.fromArray(r[2*n+1]),c=So(o,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new To(a,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=uo(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),o=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=o)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<r.length;s++){var a=r[s].split("&"),u=a[0],h=a[1];if(i>=Number(u)&&i<Number(h)){var l=this.curveSegments[r[s]].pathCurve;return e=this.getPercValue(r[s],i),l.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,o=uo((e-r.x)/n,4);return C(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(wo);function ko(t,e,i,r,n){var o=t-e;return(r+r+(n-r)*o/(i-e))*o/2}function zo(t,e,i,r,n){var o=t*t,s=e*e;return(2*(o*t)*(r-n)+3*o*(e*n-i*r)-s*e*(2*r+n)+3*s*i*r)/(6*(e-i))}function Uo(t,e,i){var r=i[0]-e[0],n=e[3]*r,o=i[2]*r,s=(t-e[0])/r,a=s*s,u=a*s,h=u-2*a+s,l=u-a,c=-2*u+3*a;return(2*u-3*a+1)*e[1]+h*n+l*o+c*i[1]}function Bo(t,e){if(e){var i=e[0],r=e[1];if(i===Ut.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===Ut.LINE){var o=r.length;if(2===o&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&o++,r[r.length-1][0]<1&&o++;var s=Math.ceil(o/2);t.lineSegCount+=s,t.curves.push(r),t.index+=s,t.max=Math.max(t.max,s)}else if(i===Ut.BEZIER_CURVE){var a=r.length-1;t.index+=2*a,t.curves.push(r),t.max=Math.max(t.max,2*a),t.curveCount+=2*a}}}function Go(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function jo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(jo=function(){return!!t})()}function Xo(t,e,i){return Xo=jo()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Dt(n,i.prototype),n},Xo.apply(null,arguments)}var Ho,Wo,Yo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new M,e}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=ns(t[0]),this.yCurve=ns(t[1]),this.zCurve=ns(t[2]),this.wCurve=ns(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(wo),Zo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new w,e}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=ns(t[0]),this.yCurve=ns(t[1]),this.zCurve=ns(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(wo),qo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new A,e}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=ns(t[0]),this.yCurve=ns(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(wo),Ko=6,Qo="editor",Jo={"Item duration can't be less than 0":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"};exports.TangentMode=void 0,(Ho=exports.TangentMode||(exports.TangentMode={}))[Ho.Cubic=0]="Cubic",Ho[Ho.Linear=1]="Linear",Ho[Ho.Constant=2]="Constant",exports.WeightedMode=void 0,(Wo=exports.WeightedMode||(exports.WeightedMode={}))[Wo.None=0]="None",Wo[Wo.In=1]="In",Wo[Wo.Out=2]="Out",Wo[Wo.Both=3]="Both";var $o=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=es(t);var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=ts(e[i],e[i+1]),n=r.points,o=r.curve,s=r.timeInterval,a=r.valueInterval,u=n[0],h=n[n.length-1];this.keys.push([].concat(u.toArray(),n[1].toArray())),this.keys.push([].concat(h.toArray(),n[2].toArray()));var l={points:n,timeInterval:s,valueInterval:a,curve:o,timeStart:Number(u.x),timeEnd:Number(h.x)};this.curveMap[u.x+"&"+h.x]=l,this.curveInfos.push(l)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,o=this.keyFrames[r+1].time;if(t>=n&&t<o){var s=this.curveInfos[r],a=s.points[0],u=s.timeInterval,h=s.valueInterval,l=(t-a.x)/u,c=s.curve.getValue(l);e=a.y+h*c;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,o=Object.keys(this.curveMap);if(r<=this.curveMap[o[0]].timeStart)return 0;for(var s=0;s<o.length;s++){var a=this.curveMap[o[s]].timeStart,u=this.curveMap[o[s]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(o[s],Number(u))),r>=Number(a)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(o[s],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,o=i.valueInterval,s=0,a=(e-r.x)/20,u=0;u<=20;u++){var h=u*a/n,l=r.y+o*i.curve.getValue(h);s+=0===u||20===u?l:u%2==1?4*l:2*l}return s*=a/3},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(wo);function ts(t,e){var i=new A(t.time,t.value),r=new A,n=new A,o=new A,s=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,a=2===t.tangentMode,u=(s?t.outWeight:1)*(e.time-t.time)/3;r.x=t.time+u,r.y=t.value+u*(a?0:t.outSlope);var h=(s?e.inWeight:1)*(e.time-t.time)/3;n.x=e.time-h,n.y=e.value-h*(a?0:e.inSlope),o.x=e.time,o.y=a?t.value:e.value,K(n),K(o);var l,c,f=o.x-i.x,d=o.y-i.y,p=uo((r.x-i.x)/f,5),m=uo((n.x-i.x)/f,5);ao(d,0)?l=c=NaN:(l=uo((r.y-i.y)/d,5),c=uo((n.y-i.y)/d,5)),p<0&&(console.error("Invalid bezier points, x1 < 0",i,r,n,o),p=0),m<0&&(console.error("Invalid bezier points, x2 < 0",i,r,n,o),m=0),p>1&&(console.error("Invalid bezier points, x1 >= 1",i,r,n,o),p=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",i,r,n,o),m=1);var v,y=("bez_"+p+"_"+l+"_"+m+"_"+c).replace(/\./g,"p");return co[y]?v=co[y]:(v=ao(d,0)?new Eo:s?new Eo(p,l,m,c):new Eo(l,c),co[y]=v),{points:[i,r,n,o],timeInterval:f,valueInterval:d,curve:v}}function es(t){for(var e=t,i=[],r=[],n={x:0,y:0},o=0;o<e.length;o++){var s=e[o],a=_o(s,o+1<e.length?e[o+1]:e[o],!0),u=a.p0,h=a.p1,l=a.p2,c=a.p3;K(l),K(c);var f={leftControl:n,value:u,rightControl:h,tangentMode:0};s[0]===Bt.HOLD&&(f.tangentMode=2),r.push(f),n=l}for(var d=function(t,e){return(e.y-t.y)/(e.x-t.x+E)},p=0;p<r.length;p++){var m=r[p].leftControl,v=r[p].value,y=r[p].rightControl,g=0,x=0;p>0&&(g=d(m,v)),p<r.length-1&&(x=d(v,y));var b={time:v.x,value:v.y,inSlope:g,outSlope:x,inWeight:0,outWeight:0,tangentMode:r[p].tangentMode,weightedMode:3};i.push(b),p>0&&(b.inWeight=(v.x-m.x)/((v.x-r[p-1].value.x)/3)),p+1<r.length&&(b.outWeight=(y.x-v.x)/((r[p+1].value.x-v.x)/3))}return i}var is,rs=((is={})[Ut.RANDOM]=function(t){return s(t[0],Array)?new Po(t):new Io(t)},is[Ut.CONSTANT]=function(t){return new Mo(t)},is[Ut.CONSTANT_VEC2]=function(t){return new Mo(t)},is[Ut.CONSTANT_VEC3]=function(t){return new Mo(t)},is[Ut.CONSTANT_VEC4]=function(t){return new Mo(t)},is[Ut.RGBA_COLOR]=function(t){return new Mo(t)},is[Ut.COLORS]=function(t){return new Ro(t.map((function(t){return I(t,!1)})))},is[Ut.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Oo([t[0][1],t[1][1]]):new Fo(t)},is[Ut.GRADIENT_COLOR]=function(t){return new No(t)},is[Ut.LINEAR_PATH]=function(t){return new Lo(t)},is[Ut.BEZIER_CURVE]=function(t){return 1===t.length?new Mo(t[0][1][1]):new $o(t)},is[Ut.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Mo(Xo(w,[].concat(t[1][0]))):new Vo(t)},is[Ut.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new Mo(Xo(Ze,[].concat(t[1][0]))):new Do(t)},is[Ut.COLOR_CURVE]=function(t){return new ss(t)},is[Ut.VECTOR4_CURVE]=function(t){return new Yo(t)},is[Ut.VECTOR2_CURVE]=function(t){return new qo(t)},is[27]=function(t){return new Zo(t)},is);function ns(t){if(!t||!isNaN(+t))return new Mo(t||0);if(s(t,wo))return t;if(st(rs[t[0]]))return rs[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Jo["ValueType: 21/22 is not supported"]+".")}var os,ss=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new R,e}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=ns(t[0]),this.gCurve=ns(t[1]),this.bCurve=ns(t[2]),this.aCurve=ns(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(wo);exports.TexturePaintScaleMode=void 0,function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(exports.TexturePaintScaleMode||(exports.TexturePaintScaleMode={})),exports.ShapeComponent=function(t){function e(e){var i;(i=t.call(this,e)||this).shapeDirty=!0,i.materialDirty=!0,i.graphicsPath=new mh,i.fills=[],i.strokeAttributes={width:1,alignment:.5,cap:he.Butt,join:le.Miter,miterLimit:10},i.strokeWidth=1,i.strokeCap=he.Butt,i.strokeJoin=le.Miter,i.strokes=[],i.meshCollider=new bs,i.fillMaterials=[],i.strokeMaterials=[],i.getHitTestParams=function(t){var e=Oi.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix());if(t){i.meshCollider.setGeometry(i.geometry,e);var r=i.meshCollider.getBoundingBoxData();if(r)return{behavior:0,type:r.type,triangles:r.area,backfaceCulling:i.rendererOptions.side===Ct.FRONT}}},i.rendererOptions={renderMode:Ot.MESH,blending:_t.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:Ct.DOUBLE,mask:0},i.maskManager=new Fr(i.engine);var r={type:se.Solid,color:new R(1,1,1,1)};i.strokes.push(r);var n={type:se.Solid,color:new R(1,1,1,1)};return i.fills.push(n),i.shapeAttributes={type:ue.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i.geometry=Zr.create(i.engine,{attributes:{aPos:{type:Ui.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Ui.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Ui.TRIANGLES,drawCount:6}),i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),i}kt(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){this.shapeDirty&&(this.buildPath(this.shapeAttributes),this.buildGeometryFromPath(this.graphicsPath.shapePath),this.shapeDirty=!1),this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},i.render=function(t){this.maskManager.drawStencilMask(t),this.draw(t)},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=!1,i=0;i<this.fillMaterials.length;i++)e=this.fillMaterials[i].colorMask,this.fillMaterials[i].colorMask=!1,t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[i],0),this.fillMaterials[i].colorMask=e;for(var r=0;r<this.strokeMaterials.length;r++)e=this.strokeMaterials[r].colorMask,this.strokeMaterials[r].colorMask=!1,t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[r],1),this.strokeMaterials[r].colorMask=e}},i.draw=function(t){for(var e=0;e<this.fillMaterials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],0);for(var i=0;i<this.strokeMaterials.length;i++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],1)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},i.buildGeometryFromPath=function(t){var e=t.shapePrimitives,i=[],r=[];if(this.fills.length>0)for(var n,s=o(e);!(n=s()).done;){var a=n.value.shape,u=[],h=r.length,l=i.length/2;a.build(u),a.triangulate(u,i,l,r,h)}var c=r.length;if(this.strokes.length>0)for(var f,d=o(e);!(f=d()).done;){var p=f.value.shape,m=[],v=i.length/2,y=this.strokeAttributes;y.cap=this.strokeCap,y.join=this.strokeJoin,y.width=this.strokeWidth;var g=!0;this.shapeAttributes.type===ue.Custom&&(g=p.closePath),p.build(m),$u(m,y,!1,g,i,2,v,r)}var x=r.length-c,b=i.length/2,T=this.geometry.getAttributeData("aPos"),E=this.geometry.getAttributeData("aUV"),S=this.geometry.getIndexData();(!T||T.length<3*b)&&(T=new Float32Array(3*b)),(!E||E.length<2*b)&&(E=new Float32Array(2*b)),(!S||S.length<r.length)&&(S=new Uint16Array(r.length));for(var _=Number.MAX_VALUE,C=Number.MAX_VALUE,A=Number.MIN_VALUE,w=Number.MIN_VALUE,M=0;M<b;M++){var R=3*M,I=2*M,P=i[I],O=i[I+1];T[R]=P,T[R+1]=O,T[R+2]=0,_=Math.min(_,P),C=Math.min(C,O),A=Math.max(A,P),w=Math.max(w,O)}for(var N=A-_,F=w-C,L=0;L<b;L++){var V=3*L,D=2*L;E[D]=(T[V]-_)/N,E[D+1]=(T[V+1]-C)/F}S.set(r),this.geometry.setAttributeData("aPos",T),this.geometry.setAttributeData("aUV",E),this.geometry.setIndexData(S),this.geometry.setDrawCount(r.length);var k=this.geometry.subMeshes[0],z=this.geometry.subMeshes[1];k.indexCount=c,z.offset=2*c,z.indexCount=x},i.buildPath=function(t){switch(this.graphicsPath.clear(),t.type){case ue.Custom:for(var e,i=this.shapeAttributes,r=i.points,n=i.easingIns,s=i.easingOuts,a=o(i.shapes);!(e=a()).done;){var u=e.value,h=u.indexes,l=r[h[0].point];this.graphicsPath.moveTo(l.x,l.y);for(var c=1;c<h.length;c++){var f=h[c],d=h[c-1],p=r[f.point],m=r[d.point],v=s[d.easingOut],y=n[f.easingIn];this.graphicsPath.bezierCurveTo(v.x+m.x,v.y+m.y,y.x+p.x,y.y+p.y,p.x,p.y,1)}if(u.close){var g=h[0],x=h[h.length-1],b=r[g.point],T=r[x.point],E=s[x.easingOut],S=n[g.easingIn];this.graphicsPath.bezierCurveTo(E.x+T.x,E.y+T.y,S.x+b.x,S.y+b.y,b.x,b.y,1),this.graphicsPath.closePath()}}break;case ue.Ellipse:var _=t;this.graphicsPath.ellipse(0,0,_.xRadius,_.yRadius);break;case ue.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case ue.Star:var A=t;this.graphicsPath.polyStar(A.pointCount,A.outerRadius,A.innerRadius,A.outerRoundness,A.innerRoundness,exports.StarType.Star);break;case ue.Polygon:var w=t;this.graphicsPath.polyStar(w.pointCount,w.radius,w.radius,w.roundness,w.roundness,exports.StarType.Polygon)}},i.updateMaterials=function(){for(var t=0;t<this.fills.length;t++)this.updatePaintMaterial(this.fillMaterials[t],this.fills[t]);for(var e=0;e<this.strokes.length;e++)this.updatePaintMaterial(this.strokeMaterials[e],this.strokes[e])},i.updatePaintMaterial=function(t,e){if(t.setFloat("_FillType",e.type),e.type===se.Solid)t.color=e.color;else if(e.type===se.GradientLinear||e.type===se.GradientAngular||e.type===se.GradientRadial)this.updateGradientMaterial(t,e.gradientStops,e.startPoint,e.endPoint);else if(e.type===se.Texture){t.setInt("_ImageScaleMode",e.scaleMode),t.setVector2("_ImageSize",new A(e.texture.getWidth(),e.texture.getHeight()));var i=this.getBoundingBox(),r=i.area[0].p1,n=i.area[1].p2;t.setVector2("_DestSize",new A(r.x-n.x,r.y-n.y)),t.setFloat("_ImageOpacity",e.opacity),t.setFloat("_ImageScalingFactor",e.scalingFactor),t.setTexture("_ImageTex",e.texture);var o=e.textureTransform;t.setMatrix3("_TextureTransform",(new Qr).scale(o.scale.x,o.scale.y).rotate(o.rotation).translate(o.offset.x,o.offset.y).invert())}},i.updateGradientMaterial=function(t,e,i,r){for(var n,s=[],a=[],u=o(e.stops);!(n=u()).done;){var h=n.value,l=h.color;s.push(new M(l.r,l.g,l.b,l.a)),a.push(h.time)}t.setVector4Array("_Colors",s),t.setFloats("_Stops",a),t.setInt("_StopsCount",a.length),t.setVector2("_StartPoint",i),t.setVector2("_EndPoint",r)},i.createMaterialFromRendererOptions=function(t){var e={shader:{vertex:"precision highp float;attribute vec3 aPos;attribute vec2 aUV;varying vec2 uv0;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;void main(){vec4 pos=vec4(aPos.xyz,1.0);uv0=aUV;gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}",fragment:"precision highp float;\n#define _MAX_STOPS 8\n#define PI 3.14159265359\nuniform vec4 _Color;uniform vec4 _Colors[_MAX_STOPS];uniform float _Stops[_MAX_STOPS];uniform int _StopsCount;uniform float _FillType;uniform vec2 _StartPoint;uniform vec2 _EndPoint;uniform sampler2D _ImageTex;uniform vec2 _ImageSize;uniform vec2 _DestSize;uniform int _ImageScaleMode;uniform mat3 _TextureTransform;uniform float _ImageScalingFactor;uniform float _ImageOpacity;varying vec2 uv0;vec4 smoothMix(vec4 a,vec4 b,float t){return mix(a,b,smoothstep(0.0,1.0,t));}float calculateAngleRatio(vec2 v1,vec2 v2){float angle=atan(v2.y,v2.x)-atan(v1.y,v1.x);if(angle<0.0)angle+=2.0*PI;return angle/(2.0*PI);}vec2 applyTransform(mat3 m,vec2 uv){uv=uv-vec2(0.5,0.5);vec3 p=m*vec3(uv,1.0);p.xy=p.xy+vec2(0.5,0.5);return p.xy;}void main(){vec4 finalColor=vec4(1.0);if(_FillType==0.0){finalColor=_Color;}else if(_FillType==1.0||_FillType==2.0||_FillType==3.0){float t=0.0;if(_FillType==1.0){vec2 gradientVector=_EndPoint-_StartPoint;vec2 pixelVector=uv0-_StartPoint;float denom=max(dot(gradientVector,gradientVector),1e-6);t=clamp(dot(pixelVector,gradientVector)/denom,0.0,1.0);}else if(_FillType==2.0){float maxRadius=max(distance(_EndPoint,_StartPoint),0.001);t=clamp(distance(uv0,_StartPoint)/maxRadius,0.0,1.0);}else{vec2 center=_StartPoint;vec2 referenceVector=_EndPoint-center;vec2 targetVector=uv0-center;if(length(targetVector)>0.001){t=calculateAngleRatio(referenceVector,targetVector);}}finalColor=_Colors[0];for(int i=1;i<_MAX_STOPS;i++){if(i>=_StopsCount)break;float prevStop=_Stops[i-1];float currStop=_Stops[i];if(t>=prevStop&&t<=currStop){float localT=(t-prevStop)/max(currStop-prevStop,1e-6);finalColor=smoothMix(_Colors[i-1],_Colors[i],localT);break;}}}else if(_FillType==4.0){vec2 uv=uv0;float rSrc=_ImageSize.x/max(_ImageSize.y,1.0);float rDst=_DestSize.x/max(_DestSize.y,1.0);bool maskOutside=false;if(_ImageScaleMode==0){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(1.0,rSrc/rDst);}else{scale=vec2(rDst/rSrc,1.0);}uv=(uv-0.5)*scale+0.5;uv=clamp(uv,0.0,1.0);}else if(_ImageScaleMode==1){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(rSrc/rDst,1.0);}else{scale=vec2(1.0,rSrc/rDst);}uv=(uv-0.5)*scale+0.5;maskOutside=true;}else if(_ImageScaleMode==2){uv=applyTransform(_TextureTransform,uv0);maskOutside=true;}else if(_ImageScaleMode==3){float aspectFix=rDst/max(rSrc,1e-6);vec2 uvTile=(uv0-0.5)*vec2(aspectFix,1.0)+0.5;float s=max(abs(_ImageScalingFactor),1e-6);uv=fract(uvTile*s);}vec4 img=texture2D(_ImageTex,uv);if(maskOutside){if(uv.x<0.0||uv.x>1.0||uv.y<0.0||uv.y>1.0){img.a=0.0;}}img.a*=_ImageOpacity;finalColor=img;}finalColor.rgb*=finalColor.a;gl_FragColor=finalColor;}",glslVersion:exports.GLSLVersion.GLSL1}},i=Nr.create(this.engine,e),r=t,n=r.side,o=r.occlusion,s=r.blending,a=r.mask,u=r.texture,h=this.maskManager.maskMode;i.blending=!0,i.depthTest=!0,i.depthMask=o,i.stencilRef=void 0!==a?[a,a]:void 0,Yi(i,s),qi(i,h),Zi(i,n),i.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',i.setVector4("_TexOffset",new M(0,0,1,1)),i.setTexture("_ImageTex",u);var l=Wi(s),c=new M;return c.x=r.occlusion?+r.transparentOcclusion:1,c.y=l,c.z=r.renderMode,c.w=h,i.setVector4("_TexParams",c),0===c.x||this.maskManager.alphaMaskEnabled?i.enableMacro("ALPHA_CLIP"):i.disableMacro("ALPHA_CLIP"),i},i.fromData=function(e){var i;t.prototype.fromData.call(this,e),this.shapeDirty=!0,e.mask&&this.maskManager.setMaskOptions(e.mask);var r,n,s,a,u,h=null!=(i=e.renderer)?i:{};this.rendererOptions={renderMode:Ot.MESH,blending:null!=(r=h.blending)?r:_t.ALPHA,texture:h.texture?this.engine.findObject(h.texture):this.engine.whiteTexture,occlusion:!!h.occlusion,transparentOcclusion:!!h.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(n=h.side)?n:Ct.DOUBLE,mask:this.maskManager.getRefValue()},this.strokeCap=null!=(s=e.strokeCap)?s:he.Butt,this.strokeWidth=null!=(a=e.strokeWidth)?a:1,this.strokeJoin=null!=(u=e.strokeJoin)?u:le.Miter,this.fills.length=0,this.fillMaterials.length=0;for(var l,c=o(e.fills);!(l=c()).done;){var f=l.value;this.fills.push(this.createPaint(f)),this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}this.strokes.length=0,this.strokeMaterials.length=0;for(var d,p=o(e.strokes);!(d=p()).done;){var m=d.value;this.strokes.push(this.createPaint(m)),this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}switch(this.materials=[].concat(this.fillMaterials,this.strokeMaterials),e.type){case ue.Custom:for(var v,y=e,g={type:ue.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},x=o(y.points);!(v=x()).done;){var b=v.value;g.points.push(new A(b.x,b.y))}for(var T,E=o(y.easingIns);!(T=E()).done;){var S=T.value;g.easingIns.push(new A(S.x,S.y))}for(var _,C=o(y.easingOuts);!(_=C()).done;){var w=_.value;g.easingOuts.push(new A(w.x,w.y))}g.shapes=y.shapes,this.shapeAttributes=g;break;case ue.Ellipse:var M=e,R={type:ue.Ellipse,xRadius:M.xRadius,yRadius:M.yRadius};this.shapeAttributes=R;break;case ue.Rectangle:var I=e,P={type:ue.Rectangle,width:I.width,height:I.height,roundness:I.roundness};this.shapeAttributes=P;break;case ue.Star:var O=e,N={type:ue.Star,pointCount:O.pointCount,innerRadius:O.innerRadius,outerRadius:O.outerRadius,innerRoundness:O.innerRoundness,outerRoundness:O.outerRoundness};this.shapeAttributes=N;break;case ue.Polygon:var F=e,L={type:ue.Polygon,pointCount:F.pointCount,radius:F.radius,roundness:F.roundness};this.shapeAttributes=L}},i.createPaint=function(t){var e;switch(t.type){case se.Solid:e={type:t.type,color:(new R).copyFrom(t.color)};break;case se.GradientLinear:case se.GradientAngular:case se.GradientRadial:e={type:t.type,gradientStops:ns(t.gradientStops),startPoint:(new A).copyFrom(t.startPoint),endPoint:(new A).copyFrom(t.endPoint)};break;case se.Texture:var i,r,n,o=Xe({offset:{x:0,y:0},rotation:0,scale:{x:1,y:1}},null!=(i=t.textureTransform)?i:{});e={type:t.type,texture:this.engine.findObject(t.texture),scaleMode:t.scaleMode,scalingFactor:null!=(r=t.scalingFactor)?r:1,opacity:null!=(n=t.opacity)?n:1,textureTransform:{offset:(new A).copyFrom(o.offset),rotation:o.rotation,scale:(new A).copyFrom(o.scale)}}}return e},i.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},wi(e,[{key:"shape",get:function(){return this.shapeAttributes}}]),e}(Ii),exports.ShapeComponent=u([Ae("ShapeComponent")],exports.ShapeComponent),exports.Fake3DComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).loop=!1,e.amountOfMotion=1,e.animationLength=2,e.mode=1,e.startPositionX=0,e.startPositionY=0,e.startPositionZ=0,e.endPositionX=0,e.endPositionY=0,e.endPositionZ=0,e.amplitudeX=0,e.amplitudeY=0,e.amplitudeZ=0,e.phaseX=0,e.phaseY=0,e.phaseZ=0,e}kt(e,t);var i=e.prototype;return i.onStart=function(){this.effectComponent=this.item.getComponent(exports.EffectComponent)},i.onUpdate=function(t){this.updateFake3D()},i.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var o=t;this.loop&&(o>.5&&(o=1-o),o*=2),e=this.startPositionX*(1-o)+o*this.endPositionX,i=this.startPositionY*(1-o)+o*this.endPositionY,r=this.startPositionZ*(1-o)+o*this.endPositionZ}var s=this.effectComponent.material;s.setFloat("_PosX",e*this.amountOfMotion),s.setFloat("_PosY",i*this.amountOfMotion),s.setFloat("_PosZ",r*this.amountOfMotion)}},e}(Mi),u([we()],exports.Fake3DComponent.prototype,"loop",void 0),u([we()],exports.Fake3DComponent.prototype,"amountOfMotion",void 0),u([we()],exports.Fake3DComponent.prototype,"animationLength",void 0),u([we()],exports.Fake3DComponent.prototype,"mode",void 0),u([we()],exports.Fake3DComponent.prototype,"startPositionX",void 0),u([we()],exports.Fake3DComponent.prototype,"startPositionY",void 0),u([we()],exports.Fake3DComponent.prototype,"startPositionZ",void 0),u([we()],exports.Fake3DComponent.prototype,"endPositionX",void 0),u([we()],exports.Fake3DComponent.prototype,"endPositionY",void 0),u([we()],exports.Fake3DComponent.prototype,"endPositionZ",void 0),u([we()],exports.Fake3DComponent.prototype,"amplitudeX",void 0),u([we()],exports.Fake3DComponent.prototype,"amplitudeY",void 0),u([we()],exports.Fake3DComponent.prototype,"amplitudeZ",void 0),u([we()],exports.Fake3DComponent.prototype,"phaseX",void 0),u([we()],exports.Fake3DComponent.prototype,"phaseY",void 0),u([we()],exports.Fake3DComponent.prototype,"phaseZ",void 0),exports.Fake3DComponent=u([Ae("Fake3DComponent")],exports.Fake3DComponent),exports.Fake3DAnimationMode=void 0,(os=exports.Fake3DAnimationMode||(exports.Fake3DAnimationMode={}))[os.Circular=0]="Circular",os[os.Linear=1]="Linear",exports.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(Mi),exports.CameraController=u([Ae(pe.CameraController)],exports.CameraController);var as,us=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt);exports.HitTestType=void 0,(as=exports.HitTestType||(exports.HitTestType={}))[as.triangle=1]="triangle",as[as.box=2]="box",as[as.sphere=3]="sphere",as[as.custom=4]="custom";var hs="click",ls="touchstart",cs="touchmove",fs="touchend",ds=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var i=t.prototype;return i.bindListeners=function(){var t,i,r,n,o,s=this;o=function(t){return t};var a,u="mousedown",h="mousemove",l="mouseup",c="mouseleave",f=function(t,i,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0);var u=0,h=0,l=e.performance.now();if(!s.target)return it.warn("Trigger TouchEvent after EventSystem is disposed."),{x:i,y:r,vx:0,vy:h,dx:o,dy:a,ts:l,width:0,height:0,origin:t};var c=s.target,f=c.width,d=c.height;if(n){var p=l-n.ts;u=(o-n.dx)/p||0,h=(a-n.dy)/p||0,n={dx:o,dy:a,ts:l}}return{x:i,y:r,vx:u,vy:h,dx:o,dy:a,ts:l,width:f,height:d,origin:t}};B()&&(o=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},u="touchstart",h="touchmove",l="touchend",c="touchcancel"),this.nativeHandlers=((a={})[u]=function(a){if(s.enabled){var u=o(a),h=ps(u);t=h.x,i=h.y,n=r={clientX:u.clientX,clientY:u.clientY,ts:e.performance.now(),x:t,y:i},s.dispatchEvent(ls,f(a,t,i))}},a[h]=function(e){if(r&&s.enabled){var n=ps(o(e));t=n.x,i=n.y,s.dispatchEvent(cs,f(e,t,i,t-r.x,i-r.y))}},a[l]=function(e){if(r&&s.enabled){!s.allowPropagation&&e.cancelable&&(e.preventDefault(),e.stopPropagation());var n=o(e),a=ps(n),u=Math.abs(r.clientX-n.clientX)+Math.abs(r.clientY-n.clientY);t=a.x,i=a.y,u<4&&s.dispatchEvent(hs,f(e,t,i)),s.dispatchEvent(fs,f(e,t,i,t-r.x,i-r.y))}r=0},a),this.nativeHandlers[c]=this.nativeHandlers[l],Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=s.target)||e.addEventListener(String(t),s.nativeHandlers[t])}))},i.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach((function(t){return t(e)}))},i.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),v(i,e),function(){y(i,e)}},i.removeEventListener=function(t,e){var i=this.handlers[t];i&&y(i,e)},i.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 ps(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),o=n.left,s=n.top;return{x:(i-o)/n.width*2-1,y:1-(r-s)/n.height*2}}var ms=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt),vs=1,ys=function(){function t(t,e,i){this.transform=e,this.engine=i,this.color=t.options.previewColor;var r=this.createMaterial(),n=this.createGeometry();this.mesh=this.createMesh(n,r),this.updateMesh()}var e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new w,n=new Ze,o=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,o),e.x=o.x,e.y=o.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},e.createMaterial=function(){var t,e=[["ENV_EDITOR",(null==(t=this.engine.renderer)?void 0:t.env)===Qo]],i=ns(this.color).getValue(0),r={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\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}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:exports.GLSLVersion.GLSL1,macros:e}},n=Nr.create(this.engine,r);return n.blending=!0,n.depthTest=!1,n.setVector4("uPos",new M(0,0,0,0)),n.setVector2("uSize",new A(1,1)),n.setVector4("uColor",new M(i[0]/255,i[1]/255,i[2]/255,i[3])),n.setQuaternion("uQuat",new Ze(0,0,0,0)),n},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return Zr.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:Ui.LINES,maxVertex:4})},e.createMesh=function(t,e){return sn.create(this.engine,{name:"Interact_preview"+vs++,priority:0,worldMatrix:Oi.fromIdentity(),geometry:t,material:e})},t}();function gs(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}exports.InteractComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.speed=25,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.invalidBorderRange=0,e.invalidByBorderRange=!1,e.duringPlay=!1,e._interactive=!0,e.lastTime=-1,e.getHitTestParams=function(t){if(e.clickable){var i=e.item.props.content.options.behavior,r=e.getBoundingBox();return r?{type:r.type,triangles:r.area,behavior:i}:void 0}},e}kt(e,t);var i=e.prototype;return i.getDragRangeX=function(){return this.dragRange.dxRange},i.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},i.getDragRangeY=function(){return this.dragRange.dyRange},i.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},i.onStart=function(){var t=this.item.engine.renderer.env,e=this.interactData.options,i=e.type,r=e.showPreview;i===Rt.CLICK&&(this.clickable=!0,r&&t===Qo&&(this.previewContent=new ys(this.item.props.content,this.transform,this.engine))),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},i.onDisable=function(){t.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},i.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,i=this.item.engine.renderer.env;if(e===Rt.CLICK)this.clickable=!0;else if(e===Rt.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==Qo||n){var o,s=(null!=(o=this.item.composition)?o:{}).event;s&&this.beginDragTarget(r,s)}}},i.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,o=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,o.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,gs(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},i.endDragTarget=function(){},i.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,o=n.position,s=n.fov,a=e.dy,u=e.dx*e.width/e.height,h=o[2],l=Math.tan(s*Math.PI/180/2)*Math.abs(h),c=a*l,f=u*l,d=this.dragRange,p=d.dxRange,m=d.dyRange,v=o[0]-this.dragRatio[0]*f,y=o[1]-this.dragRatio[1]*c,g=p[0],x=p[1],b=m[0],T=m[1];if(v=C(v,g,x),y=C(y,b,T),v!==g&&v!==x&&g!==x)null==(i=e.origin)||i.preventDefault();if(y!==b&&y!==T&&b!==T)null==(r=e.origin)||r.preventDefault();this.item.composition.camera.position=new w(v,y,h)}},i.beginDragTarget=function(t,i){var r=this;if("camera"===t.target){var n,o={touchstart:function(t){var e;if(r.canInteract()&&(r.invalidByBorderRange=r.checkInvalidBorderRange({x:t.x,y:t.y}),!r.invalidByBorderRange)){r.dragEvent=null,r.bouncingArg=null;var i=null==(e=r.item.composition)?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.invalidByBorderRange||(r.handleDragMove(n,t),r.bouncingArg=t)},touchend:function(t){if(r.canInteract()){var e=r.bouncingArg;!gs(e,3)&&e&&(e.vx*=r.speed,e.vy*=r.speed,r.dragEvent=Xe({},n)),n=null}}};Object.keys(o).forEach((function(t){i.addEventListener(t,o[t])})),o.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(o).forEach((function(t){i.removeEventListener(t,o[t])}))}}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=so(w.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:exports.HitTestType.triangle,area:e}},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===Rt.DRAG){var i=e.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},i.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},i.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i=0,r=0,n=0,o=0;if("number"==typeof e)i=e,r=e,n=e,o=e;else if(ot(e)){var s,a,u,h,l;i=void 0===(a=(s=e)[0])?0:a,r=void 0===(u=s[1])?0:u,n=void 0===(h=s[2])?0:h,o=void 0===(l=s[3])?0:l}if(t.x<o-1||t.x>1-r||t.y<i-1||t.y>1-n)return!0}return!1},wi(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(Ii),exports.InteractComponent=u([Ae(pe.InteractComponent)],exports.InteractComponent);var xs,bs=function(){function t(){this.triangles=[],this.worldMatrix=new Oi,this.assemblyTriangles=function(t,e,i,r,n){for(var o=i;o<r;o+=3){var s=3*e[o],a=3*e[o+1],u=3*e[o+2],h={x:t[s],y:t[s+1],z:t[s+2]},l={x:t[a],y:t[a+1],z:t[a+2]},c={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:l,p2:c})}}}var e=t.prototype;return e.getBoundingBoxData=function(){return this.applyWorldMatrix(this.boundingBoxData.area),this.boundingBoxData},e.getBoundingBox=function(){for(var t,e=-Number.MAX_VALUE,i=-Number.MAX_VALUE,r=Number.MAX_VALUE,n=Number.MAX_VALUE,s=o(this.boundingBoxData.area);!(t=s()).done;){var a=t.value;e=Math.max(a.p0.x,a.p1.x,a.p2.x,e),i=Math.max(a.p0.y,a.p1.y,a.p2.y,i),r=Math.min(a.p0.x,a.p1.x,a.p2.x,r),n=Math.min(a.p0.y,a.p1.y,a.p2.y,n)}var u=[],h=new w(r,i,0),l=new w(e,i,0),c=new w(e,n,0),f=new w(r,n,0);return u.push({p0:h,p1:l,p2:c}),u.push({p0:h,p1:c,p2:f}),this.applyWorldMatrix(u),{type:exports.HitTestType.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var i,r=[],n=o(this.triangles);!(i=n()).done;){var s=i.value;r.push({p0:s.p0,p1:s.p1,p2:s.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxData={type:exports.HitTestType.triangle,area:r}},e.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,s=o(t.subMeshes);!(n=s()).done;){var a=n.value;if(void 0!==a.indexCount){var u=e.BYTES_PER_ELEMENT,h=a.offset/u,l=h+a.indexCount;this.assemblyTriangles(i,e,h,l,r)}}return r},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new w),t.p1=e.worldMatrix.transformPoint(t.p1,new w),t.p2=e.worldMatrix.transformPoint(t.p2,new w)})),t},t}(),Ts=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return kt(e,t),e}(Vt),Es=function(){function t(){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0}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(){if(0===this.playState)this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},t}(),Ss=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),_s=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Re);function Cs(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}exports.PlayState=void 0,(xs=exports.PlayState||(exports.PlayState={}))[xs.Playing=0]="Playing",xs[xs.Paused=1]="Paused";var As=new Ze,ws=1,Ms=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new w(0,0,0),this.quat=new Ze(0,0,0,1),this.rotation=new Kr(0,0,0),this.scale=new w(1,1,1),this.anchor=new w(0,0,0),this.size=new A(1,1),this.children=[],this.worldMatrix=Oi.fromIdentity(),this.localMatrix=Oi.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new w(0,0,0),quat:new Ze(0,0,0,1),scale:new w(1,1,1)},this.name="transform_"+ws++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){this.position.x===t&&this.position.y===e&&this.position.z===i||(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){0===t&&0===e&&0===i||(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===i||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){this.quat.x===t&&this.quat.y===e&&this.quat.z===i&&this.quat.w===r||(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){this.scale.x===t&&this.scale.y===e&&this.scale.z===i||(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,o=t.size,a=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),i&&(s(i,w)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),a)s(a,Ze)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(r){var l=e?-1:1;s(r,Kr)?this.setRotation(r.x*l,r.y*l,r.z*l):this.setRotation(r[0]*l,r[1]*l,r[2]*l)}n&&(s(n,w)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),h&&(s(h,A)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){v(this.children,t)},e.removeChild=function(t){y(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Kr)},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;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return 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 Kr)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=(new w).copyFrom(t.position),t.quat?e.quat=new Ze(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new Kr(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=(new w).copyFrom(t.scale),t.size&&(e.size=(new A).copyFrom(t.size)),t.anchor&&(e.anchor=(new A).copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var i=As.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},wi(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}(),Rs=new w(1,1,1),Is=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new Ms,this.pixelWidth=0,this.pixelHeight=0,this.viewportMatrix=Oi.fromIdentity(),this.viewMatrix=Oi.fromIdentity(),this.projectionMatrix=Oi.fromIdentity(),this.viewProjectionMatrix=Oi.fromIdentity(),this.inverseViewMatrix=Oi.fromIdentity(),this.dirty=!0;var i=e.near,r=void 0===i?.1:i,n=e.far,o=void 0===n?20:n,s=e.fov,a=void 0===s?60:s,u=e.aspect,h=void 0===u?1:u,l=e.clipMode,c=void 0===l?zt.portrait:l,f=e.position,d=void 0===f?[0,0,8]:f,p=e.rotation,m=void 0===p?[0,0,0]:p,v=e.pixelWidth,y=void 0===v?0:v,g=e.pixelHeight,x=void 0===g?0:g,b=new Kr(m[0],m[1],m[2]),T=(new Ze).setFromEuler(b);this.options={near:r,far:o,fov:a,aspect:h,clipMode:c},this.pixelWidth=y,this.pixelHeight=x,this.transform.setPosition(d[0],d[1],d[2]),this.transform.setQuaternion(T.x,T.y,T.z,T.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new w(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var o=i.projectPoint(e).z,s=r.projectPoint(new w(1,1,o)),a=s.x,u=s.y,h=r.projectPoint(new w(-1,-1,o)),l=h.x,c=h.y;return new w((a-l)/2,(u-c)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return Xe({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,o=t.aspect,s=t.position,a=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=o,this.position=s,this.rotation=a,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,o=e.far,s=e.clipMode;this.projectionMatrix.perspective(i*b,r,n,o,s===zt.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),Rs),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:Oi.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.worldToScreenPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new w,r=this.getViewProjectionMatrix();return i.set(t.x,t.y,t.z),r.projectPoint(i,i),i.x=.5*(i.x+1)*this.pixelWidth,i.y=.5*(i.y+1)*this.pixelHeight,i.z=.5*(i.z+1),i},e.screenToWorldPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new w,r=this.getInverseViewProjectionMatrix(),n=t.x/this.pixelWidth*2-1,o=t.y/this.pixelHeight*2-1,s=2*t.z-1;return i.set(n,o,s),r.projectPoint(i,i),i},wi(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.transform.position.clone()},set:function(t){this.transform.position.equals(t)||(this.transform.setPosition(t.x,t.y,t.z),this.dirty=!0)}},{key:"worldPosition",get:function(){return this.transform.getWorldPosition()}},{key:"rotation",get:function(){return this.transform.rotation.clone()},set:function(t){this.transform.rotation.equals(t)||(this.transform.setRotation(t.x,t.y,t.z),this.dirty=!0)}}]),t}(),Ps=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=Os(this.arc,this.arcMode,t)*b,i=Math.cos(e)*this.radius,r=Math.sin(e)*this.radius,n=new w(i,r,0),o=Math.tan(this.angle*b),s=n.clone().multiply(o);return s.z+=1,{position:n.multiply(lt(0,1)),direction:s.normalize()}},t}();function Os(t,e,i){if(e===Xt.RANDOM)t=lt(0,t);else if(e===Xt.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===Xt.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),o=n-Math.floor(n);t*=Math.floor(n)%2?1-o:o}else e===Xt.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var Ns,Fs=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=Os(this.arc,this.arcMode,t)*b,i=new w(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),Ls=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=lt(-this._d,this._d),i=lt(-this._h,this._h);return{direction:new w(0,0,1),position:new w(e,i,0)}},t}(),Vs=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=Os(this.arc,this.arcMode,t)*b,i=new w(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,o=Math.atan2(n,r),s=Math.tan(e),a=new w;return e<o?a.set(r,r*s,0):e>=o&&e<Math.PI-o?a.set(n/s,n,0):e<Math.PI+o?a.set(-r,-r*s,0):e<2*Math.PI-o?a.set(-n/s,-n,0):a.set(r,r*s,0),{direction:i,position:a}},t}(),Ds=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Xt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):lt(0,1);return{direction:new w(0,1,0),position:new w(this._d*(e-.5),0,0)}},t}(),ks=new Oi,zs=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=lt(0,2*Math.PI),n=Os(this.arc,this.arcMode,t)*b,o=ks.setFromRotationZ(n),s=new w(Math.cos(r),Math.sin(r),0),a=new w(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:o.transformNormal(s),position:o.transformPoint(a)}},t}(),Us=new Oi,Bs=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 lt(-90,90)},e.generate=function(t){var e=Os(this.arc,this.arcMode,t)*b,i=this.getHorizontalAngle()*b,r=this.radius,n=new w(Math.cos(i),0,Math.sin(i)),o=Us.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(r),direction:o}},t}(),Gs=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.getHorizontalAngle=function(){return lt(0,90)},e}(Bs),js=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=C(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=e.length/2-1,r=Math.floor(Os(i,this.arcMode,t)),n=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,o=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,s=new w(n,o,0);return{position:new w(n*this.width,o*this.height,0),direction:s.normalize()}},t}(),Xs=function(){function t(){}return t.prototype.generate=function(){return{position:new w,direction:new w}},t}(),Hs=((Ns={})[wt.NONE]=Xs,Ns[wt.CONE]=Ps,Ns[wt.SPHERE]=Bs,Ns[wt.HEMISPHERE]=Gs,Ns[wt.CIRCLE]=Fs,Ns[wt.DONUT]=zs,Ns[wt.RECTANGLE]=Ls,Ns[wt.EDGE]=Ds,Ns[wt.RECTANGLE_EDGE]=Vs,Ns[wt.TEXTURE]=js,Ns);function Ws(t){if(!t)return new Xs;var e=Xe({radius:1,arc:360,angle:0,arcMode:Xt.RANDOM},t),i=t.type,r=Hs[i];if(!r)throw new Error("Invalid shape: "+i+".");var n=new r(e);if(i!==wt.NONE){var o=t.alignSpeedDirection,s=t.upDirection,a=void 0===s?[0,0,1]:s;n.alignSpeedDirection=o,n.upDirection=w.fromArray(a).normalize()}return n}function Ys(t,e,i,r,n){var o,s;if(n===function(t,e,i,r){for(var n=0,o=e,s=i-r;o<i;o+=r)n+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return n}(t,e,i,r)>0)for(o=e;o<i;o+=r)s=ca(o,t[o],t[o+1],s);else for(o=i-r;o>=e;o-=r)s=ca(o,t[o],t[o+1],s);return s&&oa(s,s.next)&&(fa(s),s=s.next),s}function Zs(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!oa(r,r.next)&&0!==na(r.prev,r,r.next))r=r.next;else{if(fa(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function qs(t){var e=t.prev,i=t,r=t.next;if(na(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(ia(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&na(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Ks(t,e,i,r){var n=t.prev,o=t,s=t.next;if(na(n,o,s)>=0)return!1;for(var a=n.x<o.x?n.x<s.x?n.x:s.x:o.x<s.x?o.x:s.x,u=n.y<o.y?n.y<s.y?n.y:s.y:o.y<s.y?o.y:s.y,h=n.x>o.x?n.x>s.x?n.x:s.x:o.x>s.x?o.x:s.x,l=n.y>o.y?n.y>s.y?n.y:s.y:o.y>s.y?o.y:s.y,c=ta(a,u,e,i,r),f=ta(h,l,e,i,r),d=t.prevZ,p=t.nextZ;d&&d.z>=c&&p&&p.z<=f;){if(d!==t.prev&&d!==t.next&&ia(n.x,n.y,o.x,o.y,s.x,s.y,d.x,d.y)&&na(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==t.prev&&p!==t.next&&ia(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&na(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&ia(n.x,n.y,o.x,o.y,s.x,s.y,d.x,d.y)&&na(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&ia(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&na(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Qs(t,e){return t.x-e.x}function Js(t,e){if(e=function(t,e){var i,r=e,n=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>s){if(s=a,a===n){if(o===r.y)return r;if(o===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===s)return i;var u,h=i,l=i.x,c=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=l&&n!==r.x&&ia(o<c?n:s,o,l,c,o<c?s:n,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(n-r.x),ha(r,t)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&$s(i,r)))&&(i=r,f=u)),r=r.next}while(r!==h);return i}(t,e),e){var i=la(e,t);Zs(e,e.next),Zs(i,i.next)}}function $s(t,e){return na(t.prev,t,e.prev)<0&&na(e.next,t,t.next)<0}function ta(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ea(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}function ia(t,e,i,r,n,o,s,a){return(n-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(r-a)-(i-s)*(e-a)>=0&&(i-s)*(o-a)-(n-s)*(r-a)>=0}function ra(t,e){return t.next.i!==e.i&&t.prev.i!==e.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&&sa(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(ha(t,e)&&ha(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(na(t.prev,t,e.prev)||na(t,e.prev,e))||oa(t,e)&&na(t.prev,t,t.next)>0&&na(e.prev,e,e.next)>0)}function na(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function oa(t,e){return t.x===e.x&&t.y===e.y}function sa(t,e,i,r){var n=ua(na(t,e,i)),o=ua(na(t,e,r)),s=ua(na(i,r,t)),a=ua(na(i,r,e));return n!==o&&s!==a||(!(0!==n||!aa(t,i,e))||(!(0!==o||!aa(t,r,e))||(!(0!==s||!aa(i,t,r))||!(0!==a||!aa(i,e,r)))))}function aa(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 ua(t){return t>0?1:t<0?-1:0}function ha(t,e){return na(t.prev,t,t.next)<0?na(t,e,t.next)>=0&&na(t,t.prev,e)>=0:na(t,e,t.prev)<0||na(t,t.next,e)<0}function la(t,e){var i=new da(t.i,t.x,t.y),r=new da(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function ca(t,e,i,r){var n=new da(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 fa(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 da(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 pa=0;function ma(t,e,i,r){i=i||2,pa=r||0;var n,o,s,a,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=Ys(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,o,s,a=[];for(n=0,o=e.length;n<o;n++)(s=Ys(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(ea(s));for(a.sort(Qs),n=0;n<a.length;n++)Js(a[n],i),i=Zs(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=s=t[0],o=a=t[1];for(var m=i;m<f;m+=i)(u=t[m])<n&&(n=u),(h=t[m+1])<o&&(o=h),u>s&&(s=u),h>a&&(a=h);l=0!==(l=Math.max(s-n,a-o))?1/l:0}return va(d,p,i,n,o,l),p}function va(t,e,i,r,n,o,s){if(t){!s&&o&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=ta(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,o,s,a,u,h=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,r=i,a=0,e=0;e<h&&(a++,r=r.nextZ);e++);for(u=h;a>0||u>0&&r;)0!==a&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,u--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,h*=2}while(s>1)}(n)}(t,r,n,o);for(var a,u,h=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?Ks(t,r,n,o):qs(t))e.push(a.i/i+pa),e.push(t.i/i+pa),e.push(u.i/i+pa),fa(t),t=u.next,h=u.next;else if((t=u)===h){s?1===s?va(t=ya(Zs(t),e,i),e,i,r,n,o,2):2===s&&ga(t,e,i,r,n,o):va(Zs(t),e,i,r,n,o,1);break}}}function ya(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!oa(n,o)&&sa(n,r,r.next,o)&&ha(n,o)&&ha(o,n)&&(e.push(n.i/i+pa),e.push(r.i/i+pa),e.push(o.i/i+pa),fa(r),fa(r.next),r=t=o),r=r.next}while(r!==t);return Zs(r)}function ga(t,e,i,r,n,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ra(s,a)){var u=la(s,a);return s=Zs(s,s.next),u=Zs(u,u.next),va(s,e,i,r,n,o),void va(u,e,i,r,n,o)}a=a.next}s=s.next}while(s!==t)}var xa=2;function ba(t,e){for(var i=t.s,r=t.p,n=i[1],o=r[1],s=0,a=0;a<n.length;a++){s+=n[a].length-1}var u,h=new Float32Array(s*Ko),l=e.indexBase,c=void 0===l?0:l,f=e.uvTransform,d=0,p=0,m=0,v=1,y=1;f&&(p=f[0],m=f[1],u=f[4],v=u?f[3]:f[2],y=u?f[2]:f[3]);for(var g=[0,0],x=0===u?0:-Math.PI/2,b=0;b<n.length;b++)for(var T=n[b],E=o[b],S=o[b+1]||o[0],_=T,C=[0,0],A=0;A<_.length-1;A++){Sa(C,_[A],E,S,E[4],E[5],S[2],S[3]),M(C[0],C[1])}var w=ma(Array.from(h),null,Ko,c);return{aPoint:h,index:new Uint16Array(w)};function M(t,e){h[d++]=t/2,h[d++]=e/2,f?(g[0]=t,g[1]=e,Ea(g,g,x),h[d++]=p+(g[0]+1)/2*v,h[d++]=m+(g[1]+1)/2*y):(h[d++]=(t+1)/2,h[d++]=(e+1)/2),d+=xa}}function Ta(t,e){for(var i=[],r=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[Ut.SHAPE_POINTS,t.p],s:[Ut.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[Ut.SHAPE_POINTS,t.g.p],s:[Ut.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,o=0,s=0,a=0;a<r.length;a++){var u=ba(r[a],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,i.push(u),o+=u.aPoint.length,s+=u.index.length}if(1===i.length)return i[0];for(var h=new Float32Array(o),l=new Uint16Array(s),c=0,f=0,d=0;c<i[c];c++){var p=i[c];h.set(p.aPoint,f),f+=p.aPoint.length,l.set(p.index,d),d+=p.index.length}return{aPoint:h,index:l}}function Ea(t,e,i){var r=Math.cos(i),n=Math.sin(i),o=e[0],s=e[1];return t[0]=r*o+n*s,t[1]=-n*o+r*s,t}function Sa(t,e,i,r,n,o,s,a){var u=1-e,h=u*u*u,l=3*e*u*u,c=3*e*e*u,f=e*e*e;return t[0]=h*i[0]+l*n+c*s+f*r[0],t[1]=h*i[1]+l*o+c*a+f*r[1],t}var _a=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+i||1,this.count=s(r,wo)?r:ns(r),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),Ca=function(t){this.content=t},Aa=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new Ca(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(this.sort(i.content,e.content)<=0))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 Ca(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(this.sort(e.content,i.content)<=0))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,o=t.next;n.next=o,o&&(o.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do{t.call(e||this,i.content,r++)}while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do{t.call(e||this,i.content,r--)}while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),wa="lookup_texture",Ma="offscreen_canvas",Ra={};function Ia(t){return Ra[t]}var Pa=new w,Oa=new w,Na=function(){function t(t,e){this.pointStart=[];var i,r=e.colorOverLifetime,n=e.colorOverTrail,o=e.maxTrailCount,a=e.opacityOverLifetime,u=void 0===a?ns(1):a,h=e.widthOverTrail,l=e.name,c=e.occlusion,f=e.blending,d=e.maskMode,p=e.mask,m=e.textureMap,v=void 0===m?[0,0,1,1]:m,y=e.texture,g=e.transparentOcclusion,x=e.minimumVertexDistance,b=e.lifetime,T=e.matrix,E=t.gpuCapability,S=E.detail,_=E.level,C=Math.max(e.pointCountPerTrail,2),w={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},R=S.maxVertexTextures>0,I=(null!=(i=t.renderer)?i:{}).env,P={},O=[["ENABLE_VERTEX_TEXTURE",R],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",I===Qo]],N=o>64,F=0;r&&(O.push(["COLOR_OVER_LIFETIME",!0]),F|=1,P.uColorOverLifetime=yr.createWithData(t,H(r))),n&&(O.push(["COLOR_OVER_TRAIL",!0]),F|=4,P.uColorOverTrail=yr.createWithData(t,H(n))),N?(O.push(["ATTR_TRAIL_START",1]),F|=8):P.uTrailStart=new Float32Array(o),P.uOpacityOverLifetimeValue=u.toUniform(w);var L=h.toUniform(w);O.push(["VERT_CURVE_VALUE_COUNT",w.index],["VERT_MAX_KEY_FRAME_COUNT",w.max]),P.uVCurveValues=wo.getAllData(w);var V={shader:{vertex:vn,fragment:pn,macros:O,glslVersion:1===_?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,name:"trail#"+l,cacheId:"-t:+"+F+"+"+w.index+"+"+w.max}},D=C*o*2,k=(C-1)*o,z=Float32Array.BYTES_PER_ELEMENT,U=12*z,B={attributes:{aColor:{size:4,stride:U,data:new Float32Array(12*D)},aSeed:{size:1,stride:U,offset:4*z,dataSource:"aColor"},aInfo:{size:3,stride:U,offset:5*z,dataSource:"aColor"},aPos:{size:4,stride:U,offset:8*z,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(D)},aDir:{size:3,data:new Float32Array(3*D)}},indices:{data:new Uint16Array(6*D)},drawCount:6*k,name:"trail#"+l,bufferUsage:Ui.DYNAMIC_DRAW};if(N)B.attributes.aTrailStart={size:1,data:new Float32Array(D)};else{var G=new Float32Array(D);B.attributes.aTrailStartIndex={size:1,data:G};for(var j=0;j<o;j++)for(var X=2*C,W=j*X,Y=0;Y<X;Y++)G[W+Y]=j}var Z=Wi(f),q=Nr.create(t,V);q.blending=!0,q.depthMask=c,q.depthTest=!0,q.stencilRef=p?[p,p]:void 0,qi(q,d),Yi(q,f);var K=this.mesh=sn.create(t,{name:"MTrail_"+l,material:q,geometry:Zr.create(t,B)}),Q=null!=y?y:yr.createWithData(t);Object.keys(P).map((function(t){var e=P[t];if(s(e,yr))q.setTexture(t,e);else if("uTrailStart"===t)q.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new M(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}q.setVector4Array(t,i)}else q.setVector4(t,M.fromArray(e))})),q.setFloat("uTime",0),q.setVector4("uWidthOverTrail",M.fromArray(L)),q.setVector2("uTexOffset",new A(0,0)),q.setVector4("uTextureMap",M.fromArray(v)),q.setVector4("uParams",new M(0,C-1,0,0)),q.setTexture("uMaskTex",Q),q.setVector4("uColorParams",new M(y?1:0,+Z,0,+(c&&!g))),this.maxTrailCount=o,this.pointCountPerTrail=C,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=N,this.lifetime=b,T&&(this.mesh.worldMatrix=T),this.geometry=K.firstGeometry(),this.trailCursors=new Uint16Array(o)}var e=t.prototype;return e.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,s=n-1,a=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,Pa);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+a,f=Da(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=6*c,y=new Float32Array(6);y.set(f,0),y.set(f,3),o.setAttributeSubData("aDir",v,y),o.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var g=i.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(p,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(p,16),x[19]=1,x.set(b,20),x[23]=-.5*m,o.setAttributeSubData("aColor",24*c,x),u>=0){var T=this.getTrailPosition(t,h,Oa),E=new Float32Array(Da(T,l,e)),S=6*(t*n+u);o.setAttributeSubData("aDir",S,E),o.setAttributeSubData("aDir",S+3,E);var _=t*n*2,C=new Uint16Array([2*u+_,2*u+1+_,2*a+_,2*a+_,2*u+1+_,2*a+1+_]),A=6*(t*s+(r-1)%s);o.setIndexSubData(A,C)}r=++this.trailCursors[t];var w=this.mesh.material,M=w.getVector4("uParams"),R=p[2];if(this.useAttributeTrailStart){for(var I=2*n,P=new Float32Array(I),O=0;O<I;O++)P[O]=R;o.setAttributeSubData("aTrailStart",t*P.length,P)}else{var N=w.getFloats("uTrailStart");null!=N&&(N[t]=R,w.setFloats("uTrailStart",N))}M&&(M.y=Math.max(M.y,r-1)-Math.max(0,r-n),w.setVector4("uParams",M))}},e.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=24*(t*r+e)+8,o=this.geometry.getAttributeData("aColor");return K(o),i.x=o[n],i.y=o[1+n],i.z=o[2+n],i}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();K(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},e.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");K(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),i=this.geometry.getIndexData();K(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},e.getPointStartPos=function(t){return this.pointStart[t]},e.setPointStartPos=function(t,e){this.pointStart[t]=e},e.onUpdate=function(t){},wi(t,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),t}(),Fa=new w,La=new w,Va=new w;function Da(t,e,i){var r=Fa;return t||i?(t?i?(La.subtractVectors(e,t).normalize(),La.subtractVectors(i,e),Va.copyFrom(La).normalize(),r.addVectors(La,Va)):r.subtractVectors(e,t):r.subtractVectors(i,e),r.normalize().toArray()):[0,0,0]}var ka=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).lastTime=0,e}kt(e,t);var i=e.prototype;return i.start=function(t){var e=t.output.getUserData();!this.particleSystem&&s(e,exports.VFXItem)&&(this.particleSystem=e.getComponent(exports.ParticleSystem),this.particleSystem&&(this.particleSystem.name=e.name))},i.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;e&&(this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),e.update(this.time-e.time)),this.lastTime=this.time},e}(Es),za=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){return new ka},e}(_s),Ua={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"},Ba=function(){function t(t,e){var i;this.particleCount=0,this.cachedRotationVector3=new w,this.cachedRotationMatrix=new Qr,this.cachedLinearMove=new w,this.tempMatrix3=new Qr,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,o=(null!=(i=t.renderer)?i:{}).env,a=e.speedOverLifetime,u=e.colorOverLifetime,h=e.linearVelOverLifetime,l=e.orbitalVelOverLifetime,c=e.sizeOverLifetime,f=e.rotationOverLifetime,d=e.sprite,p=e.gravityModifier,m=e.maxCount,v=e.textureFlip,y=e.useSprite,g=e.name,x=e.gravity,b=e.forceTarget,T=e.side,E=e.occlusion,S=e.anchor,_=e.blending,C=e.maskMode,R=e.mask,I=e.transparentOcclusion,P=e.meshSlots,O=e.renderMode,N=void 0===O?0:O,F=e.diffuse,L=void 0===F?yr.createWithData(t):F,V=t.gpuCapability.detail,D=V.halfFloatTexture,k=V.maxVertexUniforms,z=[["RENDER_MODE",+N],["ENV_EDITOR",o===Qo]],U=t.gpuCapability.level,B={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},G={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},j=k>0,X={},W=0,Y=0;(this.useSprite=y,j&&z.push(["ENABLE_VERTEX_TEXTURE",!0]),a&&(z.push(["SPEED_OVER_LIFETIME",!0]),Y|=2,X.uSpeedLifetimeValue=a.toUniform(B)),(null==d?void 0:d.animate)&&(z.push(["USE_SPRITE",!0]),Y|=4,X.uFSprite=X.uSprite=new Float32Array([d.col,d.row,d.total,d.blend?1:0]),this.useSprite=!0),(null==u?void 0:u.color)&&(z.push(["COLOR_OVER_LIFETIME",!0]),Y|=16,X.uColorOverLifetime=s(u.color,yr)?u.color:yr.createWithData(t,H(u.color))),(null==u?void 0:u.opacity)?X.uOpacityOverLifetimeValue=u.opacity.toUniform(B):X.uOpacityOverLifetimeValue=ns(1).toUniform(B),["x","y","z"].forEach((function(t,e){var i=0,n=0;(null==h?void 0:h[t])&&(X["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(B),i=1,Y|=1<<7+e,h.enabled=!0),z.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==l?void 0:l[t])&&(X["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=l[t].toUniform(B),n=1,Y|=1<<10+e,r=!0,l.enabled=!0),z.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==h?void 0:h.asMovement)&&(z.push(["AS_LINEAR_MOVEMENT",!0]),Y|=32),r&&((null==l?void 0:l.asRotation)&&(z.push(["AS_ORBITAL_MOVEMENT",!0]),Y|=64),X.uOrbCenter=new Float32Array((null==l?void 0:l.center)||[0,0,0])),X.uSizeByLifetimeValue=null==c?void 0:c.x.toUniform(B),null==c?void 0:c.separateAxes)&&(z.push(["SIZE_Y_BY_LIFE",1]),Y|=16384,X.uSizeYByLifetimeValue=null==c||null==(n=c.y)?void 0:n.toUniform(B));(null==f?void 0:f.z)&&(X.uRZByLifeTimeValue=f.z.toUniform(B),Y|=32768,z.push(["ROT_Z_LIFETIME",1])),(null==f?void 0:f.x)&&(X.uRXByLifeTimeValue=f.x.toUniform(B),Y|=65536,z.push(["ROT_X_LIFETIME",1])),(null==f?void 0:f.y)&&(X.uRYByLifeTimeValue=f.y.toUniform(B),Y|=1<<17,z.push(["ROT_Y_LIFETIME",1])),(null==f?void 0:f.asRotation)&&(z.push(["ROT_LIFETIME_AS_MOVEMENT",1]),Y|=1<<18),X.uGravityModifierValue=p.toUniform(B),b&&(z.push(["FINAL_TARGET",!0]),Y|=1<<19,X.uFinalTarget=new Float32Array(b.target||[0,0,0]),X.uForceCurve=b.curve.toUniform(B)),D&&G.max?(Y|=1<<20,X.uFCurveValueTexture=gr(t,wo.getAllData(G,!0),G.index,1)):X.uFCurveValues=wo.getAllData(G);var Z=B.max+B.curves.length-32>k;if(2===U&&(B.max=-1,B.index=P?P[0]:ja(B.index),G.index>0&&(G.max=-1,G.index=P?P[1]:ja(G.index))),Z&&D&&j){var q=gr(t,wo.getAllData(B,!0),B.index,1);X.uVCurveValueTexture=q,W=1}else X.uVCurveValues=wo.getAllData(B);var K=["-p:",N,Y,B.index,B.max,G.index,G.max].join("+");z.push(["VERT_CURVE_VALUE_COUNT",B.index],["FRAG_CURVE_VALUE_COUNT",G.index],["VERT_MAX_KEY_FRAME_COUNT",B.max],["FRAG_MAX_KEY_FRAME_COUNT",G.max]),this.VERT_MAX_KEY_FRAME_COUNT=B.max;var Q={shader:{fragment:pn,vertex:"#define LOOKUP_TEXTURE_CURVE "+W+"\n"+mn,glslVersion:1===U?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,cacheId:K,macros:z,name:"particle#"+g}},J=Wi(_);X.uTexOffset=new Float32Array(L?[1/L.getWidth(),1/L.getHeight()]:[0,0]),X.uMaskTex=L,X.uColorParams=new Float32Array([L?1:0,+J,0,+(!!E&&!I)]),X.uParams=[0,0,0,0],X.uAcceleration=[(null==x?void 0:x[0])||0,(null==x?void 0:x[1])||0,(null==x?void 0:x[2])||0,0];var $=Nr.create(t,Q);$.blending=!0,$.depthTest=!0,$.depthMask=!!E,$.stencilRef=R?[R,R]:void 0,qi($,C),Yi($,_),Zi($,T),Object.keys(X).map((function(t){var e=X[t];if(s(e,yr))$.setTexture(t,e);else{var i=[];switch(Ua[t]){case"vec4":$.setVector4(t,M.fromArray(e));break;case"vec3":$.setVector3(t,w.fromArray(e));break;case"vec2":$.setVector2(t,A.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new M(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}$.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),$.setVector3("emissionColor",new w(0,0,0)),$.setFloat("emissionIntensity",0);var tt=Zr.create(t,function(t,e,i){var r=Float32Array.BYTES_PER_ELEMENT,n=12*r,o={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*r,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*r,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*r,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*r,data:new Float32Array(0)},aSeed:{size:1,offset:3*r,stride:8*r,dataSource:"aRot"},aColor:{size:4,offset:4*r,stride:8*r,dataSource:"aRot"},aOffset:{size:4,stride:4*r,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*r,data:new Float32Array(0)},aRotation1:{size:3,offset:3*r,stride:9*r,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*r,stride:9*r,dataSource:"aRotation0"}};e&&(o.aSprite={size:3,stride:3*r,data:new Float32Array(0)});return{attributes:o,indices:{data:new Uint16Array(0)},name:i,maxVertex:t}}(4*m,this.useSprite,"particle#"+g)),et=sn.create(t,{name:"MParticle_"+g,material:$,geometry:tt});this.anchor=S,this.mesh=et,this.geometry=et.firstGeometry(),this.forceTarget=b,this.sizeOverLifetime=c,this.speedOverLifetime=a,this.linearVelOverLifetime=h,this.orbitalVelOverLifetime=l,this.orbitalVelOverLifetime=l,this.gravityModifier=p,this.rotationOverLifetime=f,this.maxCount=m,this.textureOffsets=v?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var e=t.prototype;return e.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return K(e),[e[i],e[i+1],e[i+2],e[i+3]]},e.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new i.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),i=Math.ceil(e.length/12);this.applyTranslation(i,t),this.applyRotation(i,t),this.applyLinearMove(i,t)},e.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},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r=t+1,n=4*r,o=this.geometry,s=r>this.maxParticleBufferCount,a=1;this.particleCount>300?a=(this.particleCount+100)/this.particleCount:this.particleCount>100?a=1.4:this.particleCount>0&&(a=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},h=this.useSprite;h&&(u.aSprite=new Float32Array(12));var l=new w,c=new Ze,f=new w(1,1,1);e.transform.assignWorldTRS(l,c,f);var d,p=Ms.getRotation(c,new Kr),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,x=[0,0,e.delay,e.lifetime],b=[0,0,1,1],T=e.vel,E=e.color,S=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();h&&(d=e.sprite);for(var C=0;C<4;C++){var A=2*C,M=3*C,R=4*C,I=12*C,P=8*C;u.aPos.set(m,I),T.fill(u.aPos,I+3),u.aRot.set(v,P),u.aRot[P+3]=_,u.aRot.set(E,P+4),h&&u.aSprite.set(d,M);var O=e.uv||b;if(O){var N=h?1-y[A+1]:y[A+1];x[0]=O[0]+y[A]*O[2],x[1]=O[1]+N*O[3]}u.aOffset.set(x,R);for(var F=C+C,L=(S[F]-this.anchor.x)*f.x,V=(S[F+1]-this.anchor.y)*f.y,D=0;D<3;D++)u.aPos[I+6+D]=e.dirX.getElement(D)*L,u.aPos[I+9+D]=e.dirY.getElement(D)*V}var k=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(s){var z=g(o.getIndexData(),6*r,6*i,a);z.set(k,6*t),o.setIndexData(z),this.maxParticleBufferCount=z.length/6}else o.setIndexSubData(6*t,k);Object.keys(u).forEach((function(e){var r=u[e],h=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=o.getAttributeData(e);K(l);var c=g(l,n*h,4*i*h,a);c.set(r,r.length*t),o.setAttributeData(e,c)}else o.setAttributeSubData(e,r.length*t,r)})),this.particleCount=Math.max(r,this.particleCount),o.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),o=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var s=0,a=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),l=this.mesh.material.getVector4("uGravityModifierValue"),c=0;c<t;c+=4){var f=12*c+3;s=n[f],a=n[f+1],u=n[f+2];var d=i-o[4*c+2],p=o[4*c+3];if(h&&l){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);s=s*x+v,a=a*x+y,u=u*x+g}else s+=v,a+=y,u+=g}var b=3*c;if(o[4*c+2]<i){var T=s*(e/1e3),E=a*(e/1e3),S=u*(e/1e3);r[b]+=T,r[b+1]+=E,r[b+2]+=S,r[b+3]+=T,r[b+4]+=E,r[b+5]+=S,r[b+6]+=T,r[b+7]+=E,r[b+8]+=S,r[b+9]+=T,r[b+10]+=E,r[b+11]+=S}}this.geometry.setAttributeData("aTranslation",r)},e.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),o=this.geometry.getAttributeData("aSeed"),a=this.time,u=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var h=0;h<t;h+=4){var l=C((a-r[4*h+2])/r[4*h+3],0,1),c=8*h,f=this.cachedRotationVector3.set(n[c],n[c+1],n[c+2]),d=o[8*h+3],p=f;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(s(this.rotationOverLifetime.x,Io)?p.x+=this.rotationOverLifetime.x.getValue(l,d):p.x+=this.rotationOverLifetime.x.getValue(l)),this.rotationOverLifetime.y&&(s(this.rotationOverLifetime.y,Io)?p.y+=this.rotationOverLifetime.y.getValue(l,d):p.y+=this.rotationOverLifetime.y.getValue(l)),this.rotationOverLifetime.z&&(s(this.rotationOverLifetime.z,Io)?p.z+=this.rotationOverLifetime.z.getValue(l,d):p.z+=this.rotationOverLifetime.z.getValue(l))):u.setZero(),0===p.dot(p)&&u.identity();var m=Math.PI/180,v=p.x*m,y=p.y*m,g=p.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),E=Math.cos(v),S=Math.cos(y),_=Math.cos(g);u.set(_,-T,0,T,_,0,0,0,1),u.multiply(this.tempMatrix3.set(S,0,b,0,1,0,-b,0,S)),u.multiply(this.tempMatrix3.set(1,0,0,0,E,-x,0,x,E));var A=9*h,w=u.elements;i.set(w,A),h+4<=t&&(i.set(w,A+9),i.set(w,A+18),i.set(w,A+27))}this.geometry.setAttributeData("aRotation0",i)},e.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),o=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var a=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=o-r[4*u+2],l=r[4*u+3],c=h/l,f=n[8*u+3];a.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(s(this.linearVelOverLifetime.x,Io)?a.x=this.linearVelOverLifetime.x.getValue(c,f):a.x=this.linearVelOverLifetime.x.getValue(c)),this.linearVelOverLifetime.y&&(s(this.linearVelOverLifetime.y,Io)?a.y=this.linearVelOverLifetime.y.getValue(c,f):a.y=this.linearVelOverLifetime.y.getValue(c)),this.linearVelOverLifetime.z&&(s(this.linearVelOverLifetime.z,Io)?a.z=this.linearVelOverLifetime.z.getValue(c,f):a.z=this.linearVelOverLifetime.z.getValue(c))):(this.linearVelOverLifetime.x&&(s(this.linearVelOverLifetime.x,Io)?a.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):a.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.y&&(s(this.linearVelOverLifetime.y,Io)?a.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):a.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.z&&(s(this.linearVelOverLifetime.z,Io)?a.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):a.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,l)));var d=3*u;i[d]=a.x,i[d+1]=a.y,i[d+2]=a.z,i[d+3]=a.x,i[d+4]=a.y,i[d+5]=a.z,i[d+6]=a.x,i[d+7]=a.y,i[d+8]=a.z,i[d+9]=a.x,i[d+10]=a.y,i[d+11]=a.z}this.geometry.setAttributeData("aLinearMove",i)},e.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},t}(),Ga=[10,32,64,160];function ja(t){for(var e=0;e<Ga.length;e++){var i=Ga[e];if(i>t)return i}return t||Ga[0]}var Xa=function(t){function e(e,i,r){var n;(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new Ba(e,i)),r&&(n.trailMesh=new Na(e,r));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}kt(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder;for(var t,e=o(this.meshes);!(t=e()).done;){t.value.onStart()}},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new M;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t);for(var e,i=o(this.meshes);!(e=i()).done;){e.value.render(t)}},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach((function(i){t.push(e[i])})),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach((function(e){t.push(i[e])}))}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(Ii);exports.ParticleSystem=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).destroyed=!1,r.getHitTestParams=function(t){var e=r.interaction;if(t||e)return{type:exports.HitTestType.custom,collect:function(t){return r.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===jt.removeParticle,ray:t})}}},r.maskManager=new Fr(e),i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.isFrozen=function(){return this.frozen},i.isEnded=function(){return this.ended},i.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]===Ut.CONSTANT_VEC3?e.add(r[1]):t=ns(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var o=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(o)}},i.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var o=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(o)}},i.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var o=r.first;r.removeNode(o),i=n[1]=o.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},i.setVisible=function(t){this.renderer.setVisible(t)},i.getTextures=function(){return this.renderer.getTextures()},i.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new Aa((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1,this.destroyed=!1},i.onStart=function(){this.startEmit(),this.initEmitterTransform()},i.onUpdate=function(t){this.update(t)},i.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,o=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var s=this.particleLink,a=(i-n)/this.item.duration,u=this.timePassed,h=!1,l=function(){e.trails&&!h&&(h=!0,s.forEach((function(t){var i=t[0],r=t[1],n=t[2],o=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,a,o,n)})))};if(this.ended){if(this.item.endBehavior!==Gt.restart&&Gt.destroy===this.item.endBehavior){var c=s.last;c&&c.content[0]<this.time&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/o.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=m,y=p/m,g=i,x=r.maxCount;this.updateEmitterTransform(u);for(var b=function(){var t=s.first;return e.emissionStopped||s.length===x&&t&&t.content[0]-n>u},T=0;T<v&&T<x&&!b();T++){var E=this.createPoint(d);E.delay+=g+T*y,this.addParticle(E,x),this.lastEmitTime=u}for(var S=o.bursts,_=(null==S?void 0:S.length)-1,C=0;_>=0&&C<x&&!b();_--){var A=S[_],w=!A.disabled&&A.getGeneratorOptions(u,d);if(w){var M=o.burstOffsets[_],R=M&&M[w.cycleIndex]||[0,0,0];A.once&&this.removeBurst(_);for(var I=0;I<w.count&&C<x;I++){var P;if(b())break;var O=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:I,burstCount:w.count}));O.delay+=g,C++,(P=O.transform).translate.apply(P,[].concat(R)),this.addParticle(O,x)}}}}else if(this.item.endBehavior===Gt.restart)l(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.time-=f,o.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=f,t[2]-=f,t[3].delay-=f})),this.renderer.minusTimeForLoop(f);else{this.ended=!0,this.item.endBehavior===Gt.freeze&&(this.frozen=!0)}}l()}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=[],i=0;i<this.renderer.meshes.length;i++){var r=this.renderer.meshes[i].material;e.push(r.colorMask),r.colorMask=!1}for(var n,s=o(this.renderer.meshes);!(n=s()).done;){n.value.render(t)}for(var a=0;a<this.renderer.meshes.length;a++){this.renderer.meshes[a].material.colorMask=e[a]}}},i.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach((function(t){return t.dispose()}))},i.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!t||!e)return i;for(var o=t.last,s=!1;!s;){var a=o.content[0],u=o.content[3];if(a>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),o.pre?o=o.pre:s=!0}++n>r&&(s=!0)}return i},i.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],o=new w,s=!1;if(r&&r.content)do{var a=r.content,u=a[0],h=a[1];a[2];var l=a[3];if(u>this.timePassed){var c=this.getPointPosition(l),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:c,radius:t.radius},o)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),r.content=[0]),n.push(c),t.multiple||(s=!0))}}while((r=r.pre)&&!s);return n}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var o=this.trails,s=this.getPointPosition(i),a=o.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=o.lifetime.getValue(e);if(o.sizeAffectsWidth&&(h*=u[0]),o.sizeAffectsLifetime&&(l*=u[0]),o.parentAffectsPosition&&this.transform.parentTransform){s.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&s.subtract(c)}n.addTrailPoint(t,s,{color:a,lifetime:l,size:h,time:r})}},i.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},i.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,o=t.gravity,s=void 0===o?[]:o,a=this.options.forceTarget,u=this.time-n,h=new w,l=w.fromArray(s);e.assignWorldTRS(h);var c=$n(new w,this.options,l,u,r,h,i);if(a){var f=a.target||[0,0,0],d=a.curve.getValue(u/r),p=1-d;c.x=c.x*p+f[0]*d,c.y=c.y*p+f[1]*d,c.z=c.z*p+f[2]*d}return c},i.initPoint=function(t){var e=this.options,i=this.lifetime,r=this.shape,n=e.startSpeed.getValue(i),o=e.particleFollowParent?Oi.IDENTITY:this.transform.getWorldMatrix(),s=t.position,a=o.transformPoint(s,new w),u=new Ms({position:a,valid:!0}),h=t.direction;if(h=o.transformNormal(h,Ha).normalize(),e.startTurbulence&&e.turbulence){for(var l=0;l<3;l++)Ka.setElement(l,e.turbulence[l].getValue(i));Qa.setFromVector3(Ka.negate()),$a.setFromEuler(Qa).transformNormal(h).normalize()}var c,f=Za,d=qa;r.alignSpeedDirection?(d.copyFrom(h),this.upDirectionWorld||(r.upDirection?this.upDirectionWorld=r.upDirection.clone():this.upDirectionWorld=w.Z.clone(),o.transformNormal(this.upDirectionWorld)),f.crossVectors(d,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),d.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((c=Ja)[0]=p.animationDelay.getValue(i),c[1]=p.animationDuration.getValue(i),c[2]=p.cycles.getValue(i));var m=Ya;e.start3DRotation?m.set(e.startRotationX.getValue(i),e.startRotationY.getValue(i),e.startRotationZ.getValue(i)):e.startRotation?m.set(0,0,e.startRotation.getValue(i)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(i);3===v.length&&(v[3]=1);var y=Wa;if(e.start3DSize)y.x=e.startSizeX.getValue(i),y.y=e.startSizeY.getValue(i);else{var g=e.startSize.getValue(i),x=e.sizeAspect.getValue(i);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new w;this.transform.assignWorldTRS(void 0,void 0,T),y.x*=T.x,y.y*=T.y}return u.setScale(y.x,y.y,1),{size:y,vel:b,color:v,delay:e.startDelay.getValue(i),lifetime:e.startLifetime.getValue(i),uv:eu(this.uvs,!0),gravity:e.gravity,sprite:c,dirY:d,dirX:f,transform:u}},i.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&s(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return-1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:exports.HitTestType.sphere,area:t}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e;this.props=i,this.destroyed=!1;var r,n,o,a,u,h=i.options,l=i.positionOverLifetime,c=void 0===l?{}:l,f=i.shape,d=null==c?void 0:c.gravityOverLifetime,p=to(null==c?void 0:c.gravity),m=i.textureSheetAnimation,v=m?{animationDelay:ns(m.animationDelay||0),animationDuration:ns(m.animationDuration||1),cycles:ns(m.cycles||1),animate:m.animate,col:m.col,row:m.row,total:m.total||m.col*m.row}:void 0,y=!!(f&&f.turbulenceX||(null==f?void 0:f.turbulenceY)||(null==f?void 0:f.turbulenceZ));y&&(r=[ns(null!=(n=f.turbulenceX)?n:0),ns(null!=(o=f.turbulenceY)?o:0),ns(null!=(a=f.turbulenceZ)?a:0)]);this.name="ParticleSystem",this.shape=Ws(f),this.emission={rateOverTime:ns(i.emission.rateOverTime),burstOffsets:tu(null!=(u=i.emission.burstOffsets)?u:[]),bursts:(i.emission.bursts||[]).map((function(t){return new _a(t)}))},this.textureSheetAnimation=v;var g,x,b=i.renderer||{},T=i.rotationOverLifetime;T&&((g={}).asRotation=!!T.asRotation,g.z=T.z?ns(T.z):ns(0),T.separateAxes&&(g.x=T.x&&ns(T.x),g.y=T.y&&ns(T.y))),(null==c?void 0:c.forceTarget)&&(x={target:c.target||[0,0,0],curve:ns(c.forceCurve||[Ut.LINE,[[0,0],[1,1]]])});var E={x:c.linearX&&ns(c.linearX||0),y:c.linearY&&ns(c.linearY||0),z:c.linearZ&&ns(c.linearZ||0),asMovement:c.asMovement},S={x:c.orbitalX&&ns(c.orbitalX),y:c.orbitalY&&ns(c.orbitalY),z:c.orbitalZ&&ns(c.orbitalZ),center:c.orbCenter,asRotation:c.asRotation},_=i.sizeOverLifetime||{},C=i.colorOverLifetime,w=(null==_?void 0:_.separateAxes)?{separateAxes:!0,x:ns(_.x),y:ns(_.y)}:{separateAxes:!1,x:ns(("size"in _?_.size:_.x)||1)};b.anchor=b.anchor||[0,0];var M,R=A.fromArray(b.anchor);this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:ns(h.startLifetime),startDelay:ns(h.startDelay||0),startSpeed:ns(c.startSpeed||0),startColor:ns(h.startColor),looping:!1,maxCount:null!=(M=h.maxCount)?M:0,gravityModifier:ns(d||0),gravity:p,start3DSize:!!h.start3DSize,startTurbulence:y,turbulence:r,speedOverLifetime:c.speedOverLifetime&&ns(c.speedOverLifetime),linearVelOverLifetime:E,orbitalVelOverLifetime:S,forceTarget:x},h.startRotationZ&&(this.options.startRotation=ns(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=ns(h.startRotationX||0),this.options.startRotationY=ns(h.startRotationY||0),this.options.startRotationZ=ns(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=ns(h.startSizeX),this.options.startSizeY=ns(h.startSizeY)):(this.options.startSize=ns(h.startSize),this.options.sizeAspect=ns(h.sizeAspect||1)),i.mask&&this.maskManager.setMaskOptions(i.mask);var I={meshSlots:h.meshSlots,name:this.name,matrix:Oi.IDENTITY,shaderCachePrefix:"",renderMode:b.renderMode||Ot.BILLBOARD,side:b.side||Ct.DOUBLE,gravity:p,blending:b.blending||_t.ALPHA,rotationOverLifetime:g,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:v,occlusion:!!b.occlusion,transparentOcclusion:!!b.transparentOcclusion,maxCount:h.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:x,diffuse:b.texture?this.engine.findObject(b.texture):void 0,sizeOverLifetime:w,anchor:R};if(C){var P=C.color,O=C.opacity;I.colorOverLifetime={},O&&(I.colorOverLifetime.opacity=ns(C.opacity)),P&&(P[0]===Ut.GRADIENT_COLOR?I.colorOverLifetime.color=C.color[1]:P[0]===Ut.RGBA_COLOR?I.colorOverLifetime.color=yr.createWithData(this.engine,{data:new Uint8Array(P[1]),width:1,height:1}):s(P,yr)&&(I.colorOverLifetime.color=P))}var N,F=[],L=[0,0,1,1];if(i.splits){var V=i.splits[0];L=(N=V[4])?[V[0],V[1],V[3],V[2]]:[V[0],V[1],V[2],V[3]]}if(v&&!v.animate)for(var D=N?v.row:v.col,k=N?v.col:v.row,z=v.total||D*k,U=0,B=0;B<D;B++)for(var G=0;G<k&&U<z;G++,U++)F.push([B*L[2]/D+L[0],G*L[3]/k+L[1],L[2]/D,L[3]/k]);else F.push(L);this.uvs=F,I.textureFlip=N;var j,X=i.trails;X&&(this.trails={lifetime:ns(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},X.mask&&this.maskManager.setMaskOptions(X.mask),j={name:"Trail",matrix:Oi.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture?this.engine.findObject(X.texture):void 0,opacityOverLifetime:ns(X.opacityOverLifetime||1),widthOverTrail:ns(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion,textureMap:X.textureMap,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},X.colorOverLifetime&&X.colorOverLifetime[0]===Ut.GRADIENT_COLOR&&(j.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===Ut.GRADIENT_COLOR&&(j.colorOverTrail=X.colorOverTrail[1])),this.renderer=new Xa(this.engine,I,j),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var H,W=i.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(H=W.radius)?H:.4,behavior:W.behavior});this.item.getHitTestParams=this.getHitTestParams},wi(e,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),e}(Mi),exports.ParticleSystem=u([Ae(pe.ParticleSystem)],exports.ParticleSystem);var Ha=new w,Wa=new A,Ya=new Kr,Za=new w,qa=new w,Ka=new w,Qa=new Kr,Ja=[0,0,0],$a=new Oi;function tu(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var i=s(t,Array),r=i?t[0]:t.index,n=e[r];n||(n=e[r]=[]),i?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function eu(t,e){var i=Math.floor(Math.random()*t.length),r=t[i];return e||t.splice(i,1),r}var iu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}kt(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=o(this.clipPlayables);!(e=i()).done;){e.value.processFrame(t)}this.evaluate(t)},i.setClipWeight=function(t,e){if(s(t,Es)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t)return void(this.clipWeights[i]=e)}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(Es),ru=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(s(e,exports.VFXItem)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},e}(iu),nu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();s(e,exports.VFXItem)&&(e.time=this.time)},e}(Es),ou=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(Es),su=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyPath="",e.propertyName="",e}kt(e,t);var i=e.prototype;return i.evaluate=function(t){var e=t.output.getUserData();if(e){this.directTarget||this.preparePath(e);var i=!1;if(this.propertyValue=this.directTarget[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var o=this.getClipPlayable(r);if(!s(o,ou)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var a=o.value;this.addWeightedValue(a,n),i=!0}}i&&(this.directTarget[this.propertyName]=this.propertyValue,s(e,Mi)&&e.onApplyAnimationProperties())}}},i.preparePath=function(t){for(var e=this.propertyPath.split("."),i=t,r=0;r<e.length-1;r++){var n=i[e[r]];void 0===n&&console.error("The "+e[r]+" property of "+t+" was not found"),i=n}e.length>0&&(this.propertyName=e[e.length-1]),this.directTarget=i},e}(iu),au=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(su),uu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(su),hu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){},e}(iu),lu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){},e}(iu),cu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();s(e,exports.CompositionComponent)&&(e.time=this.getTime())},e}(Es),fu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(s(e,exports.CompositionComponent)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},e}(iu),du=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){},e}(iu),pu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(su),mu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e},e}(su),vu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(su),yu=new Kr,gu=new w(1,1,1),xu=new w,bu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new w(e.x,e.y,e.x)};var i,r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,o=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=ns(r.path));var s=r.linearX||r.linearY||r.linearZ;s&&(this.linearVelOverLifetime={x:r.linearX&&ns(r.linearX),y:r.linearY&&ns(r.linearY),z:r.linearZ&&ns(r.linearZ),asMovement:r.asMovement,enabled:!!s});var a=r.orbitalX||r.orbitalY||r.orbitalZ;a&&(this.orbitalVelOverLifetime={x:r.orbitalX&&ns(r.orbitalX),y:r.orbitalY&&ns(r.orbitalY),z:r.orbitalZ&&ns(r.orbitalZ),center:to(r.orbCenter),asRotation:r.asRotation,enabled:!!a}),this.speedOverLifetime=r.speedOverLifetime&&ns(r.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=ns(o.x||1),this.sizeYOverLifetime=ns(o.y||1),this.sizeZOverLifetime=ns(o.z||1)):this.sizeXOverLifetime=ns(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:ns(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=ns(n.x||0),u.y=ns(n.y||0)}this.gravity=w.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=ns(null!=(i=null==r?void 0:r.gravityOverLifetime)?i:0),this.direction=(null==r?void 0:r.direction)?w.fromArray(r.direction).normalize():new w,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},i.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();s(e,exports.VFXItem)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},i.sampleAnimation=function(){var t=this,e=this.boundObject,i=this.getDuration(),r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){gu.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(gu.y=this.sizeYOverLifetime.getValue(r),gu.z=this.sizeZOverLifetime.getValue(r)):gu.z=gu.y=gu.x;var n=this.originalTransform.scale;e.transform.setScale(gu.x*n.x,gu.y*n.y,gu.z*n.z)}if(this.rotationOverLifetime){var o=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},s=o(this.rotationOverLifetime.z),a=this.rotationOverLifetime.separateAxes;yu.x=a?o(this.rotationOverLifetime.x):0,yu.y=a?o(this.rotationOverLifetime.y):0,yu.z=s;var u=yu.addEulers(this.originalTransform.rotation,yu);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=xu;$n(h,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(h.x,h.y,h.z)}},e}(Es);exports.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new bu;return t.data=this.transformAnimationData,t},i.fromData=function(t){this.transformAnimationData=t},e}(_s),exports.TransformPlayableAsset=u([Ae(pe.TransformPlayableAsset)],exports.TransformPlayableAsset);var Tu,Eu=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===Gt.restart?e%=i:this.endBehavior===Gt.freeze&&(e=Math.min(i,e))),e},t}();exports.TrackAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}kt(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){return t},i.createTrackMixer=function(){return new iu},i.createOutput=function(){return new Ss},i.createPlayableGraph=function(t){return this.createMixerPlayableGraph(t)},i.createMixerPlayableGraph=function(t){for(var e,i=[],r=o(this.clips);!(e=r()).done;){var n=e.value;i.push(n)}return this.compileClips(i,t)},i.compileClips=function(t,e){for(var i,r=this.createTrackMixer(),n=o(t);!(i=n()).done;){var s=i.value,a=this.createClipPlayable(s);a.setDuration(s.duration);var u=new Su(s,a,r);e.push(u),r.clipPlayables.push(a),r.setClipWeight(a,0)}return r},i.createPlayable=function(){return new Es},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new Eu;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=o(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){return t.asset.createPlayable()},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=o(this.children);!(i=r()).done;){i.value.parent=this}},e}(_s),u([we(Eu)],exports.TrackAsset.prototype,"clips",void 0),u([we()],exports.TrackAsset.prototype,"children",void 0),exports.TrackAsset=u([Ae(pe.TrackAsset)],exports.TrackAsset),exports.TrackType=void 0,(Tu=exports.TrackType||(exports.TrackType={}))[Tu.MasterTrack=0]="MasterTrack",Tu[Tu.ObjectTrack=1]="ObjectTrack";var Su=function(){function t(t,e,i){this.clip=t,this.playable=e,this.parentMixer=i}var e=t.prototype;return e.getParticleSystem=function(){return this.particleSystem||s(this.parentMixer.trackInstance.boundObject,exports.VFXItem)&&(this.particleSystem=this.parentMixer.trackInstance.boundObject.getComponent(exports.ParticleSystem)),this.particleSystem},e.evaluateAt=function(t){var e=this.clip,i=1,r=!1,n=!1,o=this.parentMixer.trackInstance.boundObject;t>=e.start+e.duration&&e.endBehavior===Gt.destroy?s(o,exports.VFXItem)&&exports.VFXItem.isParticle(o)&&this.getParticleSystem()&&!this.getParticleSystem().destroyed?i=1:(i=0,r=!0):t-this.clip.start>=0?(i=1,n=!0):t<e.start&&(i=0),n&&this.playable.getPlayState()!==exports.PlayState.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,i);var a=e.toLocalTime(t);this.playable.setTime(a),r&&this.playable.getPlayState()===exports.PlayState.Playing&&this.playable.pause()},wi(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}();exports.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new ru},e}(exports.TrackAsset),exports.ActivationTrack=u([Ae(pe.ActivationTrack)],exports.ActivationTrack);var _u=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}return kt(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(exports.TrackAsset);u([we()],_u.prototype,"path",void 0),exports.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new uu;return t.propertyPath=this.path,t},e}(_u),exports.FloatPropertyTrack=u([Ae(pe.FloatPropertyTrack)],exports.FloatPropertyTrack),exports.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new lu},e}(exports.TrackAsset),exports.SpriteColorTrack=u([Ae(pe.SpriteColorTrack)],exports.SpriteColorTrack),exports.SubCompositionTrack=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){if(!s(t,exports.VFXItem))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");return t.getComponent(exports.CompositionComponent)},i.createTrackMixer=function(){return new fu},e}(exports.TrackAsset),exports.SubCompositionTrack=u([Ae(pe.SubCompositionTrack)],exports.SubCompositionTrack),exports.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new du},e}(exports.TrackAsset),exports.TransformTrack=u([Ae(pe.TransformTrack)],exports.TransformTrack),exports.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.updateAnimatedObject=function(t){if(!s(t,Ii))throw new Error("MaterialTrack: expected a RendererComponent bound object.");var e=t.materials;if(this.index>=e.length)throw new Error("MaterialTrack: material index "+this.index+" out of bounds (length="+e.length+").");return e[this.index]},e}(exports.TrackAsset),u([we()],exports.MaterialTrack.prototype,"index",void 0),exports.MaterialTrack=u([Ae("MaterialTrack")],exports.MaterialTrack);var Cu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new hu},e}(exports.TrackAsset);exports.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new pu;return t.propertyPath=this.path,t},e}(_u),exports.Vector4PropertyTrack=u([Ae(pe.Vector4PropertyTrack)],exports.Vector4PropertyTrack),exports.Vector3PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new mu;return t.propertyPath=this.path,t},e}(_u),exports.Vector3PropertyTrack=u([Ae(pe.Vector3PropertyTrack)],exports.Vector3PropertyTrack),exports.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new vu;return t.propertyPath=this.path,t},e}(_u),exports.Vector2PropertyTrack=u([Ae(pe.Vector2PropertyTrack)],exports.Vector2PropertyTrack),exports.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new au;return t.propertyPath=this.path,t},e}(_u),exports.ColorPropertyTrack=u([Ae(pe.ColorPropertyTrack)],exports.ColorPropertyTrack),exports.ObjectBindingTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.create=function(t,e){var i=e[this.getInstanceId()];if(s(i,exports.VFXItem))for(var r,n=o(this.getChildTracks());!(r=n()).done;){var a=r.value;if(s(a,exports.ActivationTrack)){if(i.getComponent(exports.ParticleSystem))for(var u,h=t.createTrack(Cu,this,"ParticleTrack"),l=o(a.getClips());!(u=l()).done;){var c=u.value,f=h.createClip(za);f.start=c.start,f.duration=c.duration,f.endBehavior=c.endBehavior}if(i.getComponent(exports.SpriteComponent))for(var d,p=t.createTrack(Uu,this,"SpriteComponentTimeTrack"),m=o(a.getClips());!(d=m()).done;){var v=d.value,y=p.createClip(Gu);y.start=v.start,y.duration=v.duration,y.endBehavior=v.endBehavior}if(i.getComponent(exports.EffectComponent))for(var g,x=t.createTrack(Bu,this,"EffectComponentTimeTrack"),b=o(a.getClips());!(g=b()).done;){var T=g.value,E=x.createClip(Gu);E.start=T.start,E.duration=T.duration,E.endBehavior=T.endBehavior}break}}},e}(exports.TrackAsset),exports.ObjectBindingTrack=u([Ae(pe.ObjectBindingTrack)],exports.ObjectBindingTrack),exports.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){return new nu},e}(_s),exports.ActivationPlayableAsset=u([Ae(pe.ActivationPlayableAsset)],exports.ActivationPlayableAsset),exports.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.ColorPropertyPlayableAsset.prototype,"curveData",void 0),exports.ColorPropertyPlayableAsset=u([Ae(pe.ColorPropertyPlayableAsset)],exports.ColorPropertyPlayableAsset),exports.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.FloatPropertyPlayableAsset.prototype,"curveData",void 0),exports.FloatPropertyPlayableAsset=u([Ae(pe.FloatPropertyPlayableAsset)],exports.FloatPropertyPlayableAsset),exports.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){return new cu},e}(_s),exports.SubCompositionPlayableAsset=u([Ae(pe.SubCompositionPlayableAsset)],exports.SubCompositionPlayableAsset),exports.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector4PropertyPlayableAsset=u([Ae(pe.Vector4PropertyPlayableAsset)],exports.Vector4PropertyPlayableAsset),exports.Vector3ropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.Vector3ropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector3ropertyPlayableAsset=u([Ae(pe.Vector3PropertyPlayableAsset)],exports.Vector3ropertyPlayableAsset),exports.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector2PropertyPlayableAsset=u([Ae(pe.Vector2PropertyPlayableAsset)],exports.Vector2PropertyPlayableAsset);var Au=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i,this.mixer.trackInstance=this}return t.prototype.addChild=function(t){this.children.push(t)},t}();exports.TimelineAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}kt(e,t);var i=e.prototype;return i.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},i.invalidate=function(){this.cacheFlattenedTracks=null},i.addSubTracksRecursive=function(t,e){for(var i,r=o(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var s,a=o(t.getChildTracks());!(s=a()).done;){var u=s.value;this.addSubTracksRecursive(u,e)}},wi(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=o(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(Re),u([we()],exports.TimelineAsset.prototype,"tracks",void 0),exports.TimelineAsset=u([Ae(pe.TimelineAsset)],exports.TimelineAsset);var wu=function(){function t(t,e){this.time=0,this.clips=[],this.masterTrackInstances=[];for(var i,r={},n=o(e);!(i=n()).done;){var a=i.value;r[a.key.getInstanceId()]=a.value}for(var u,h=o(t.tracks);!(u=h()).done;){var l=u.value;s(l,exports.ObjectBindingTrack)&&l.create(t,r)}this.compileTracks(t.flattenedTracks,e)}var e=t.prototype;return e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.evaluate=function(t){for(var e,i=this.getTime(),r=o(this.clips);!(e=r()).done;){e.value.evaluateAt(i)}for(var n,s=o(this.masterTrackInstances);!(n=s()).done;){var a=n.value;this.tickTrack(a,t)}},e.compileTracks=function(t,e){for(var i,r=t,n={},s=o(r);!(i=s()).done;){var a=i.value,u=a.createPlayableGraph(this.clips),h=a.createOutput(),l=new Au(a,u,h);n[a.getInstanceId()]=l,a.parent||this.masterTrackInstances.push(l)}for(var c,f=o(r);!(c=f()).done;)for(var d,p=c.value,m=n[p.getInstanceId()],v=o(p.getChildTracks());!(d=v()).done;){var y=n[d.value.getInstanceId()];m.addChild(y)}for(var g,x=o(e);!(g=x()).done;){var b=g.value;n[b.key.getInstanceId()].boundObject=b.value}for(var T,E=o(this.masterTrackInstances);!(T=E()).done;){var S=T.value;this.updateTrackAnimatedObject(S)}},e.tickTrack=function(t,e){var i=t.output.context;i.deltaTime=e,t.output.setUserData(t.boundObject);for(var r,n=o(t.mixer.clipPlayables);!(r=n()).done;){var s=r.value;s.getPlayState()===exports.PlayState.Playing&&s.processFrame(i)}t.mixer.evaluate(i);for(var a,u=o(t.children);!(a=u()).done;){var h=a.value;this.tickTrack(h,e)}},e.updateTrackAnimatedObject=function(t){for(var e,i=o(t.children);!(e=i()).done;){var r=e.value;if(!r.boundObject){var n=r.trackAsset.updateAnimatedObject(t.boundObject);r.boundObject=n}this.updateTrackAnimatedObject(r)}},t}();exports.CompositionComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).time=0,e.items=[],e.state=exports.PlayState.Playing,e.reusable=!1,e.sceneBindings=[],e}kt(e,t);var i=e.prototype;return i.onStart=function(){var t;this.timelineAsset||(this.timelineAsset=new exports.TimelineAsset(this.engine)),this.timelineInstance=new wu(this.timelineAsset,this.sceneBindings),null==(t=this.item.composition)||t.refContent.push(this.item)},i.getReusable=function(){return this.reusable},i.pause=function(){this.state=exports.PlayState.Paused},i.resume=function(){this.state=exports.PlayState.Playing},i.onUpdate=function(t){if(this.state!==exports.PlayState.Paused){var e=this.time;this.timelineInstance.setTime(e),this.timelineInstance.evaluate(t/1e3)}},i.onEnable=function(){for(var t,e=o(this.items);!(t=e()).done;){t.value.setActive(!0)}},i.onDisable=function(){for(var t,e=o(this.items);!(t=e()).done;){t.value.setActive(!1)}},i.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},i.hitTest=function(t,e,i,r,n,o){for(var s,u=function(o){var a=s.items[o];if(a.isActive&&a.transform.getValid()&&!exports.VFXItem.isComposition(a)&&!c(a)){var u=a.getHitTestParams(n);if(u){var f=!1,d=new w;if(u.type===exports.HitTestType.triangle)for(var p=u.triangles,m=u.backfaceCulling,v=0;v<p.length;v++){var y=p[v];if(t.intersectTriangle(y,d,m)){f=!0,h.push(d);break}}else if(u.type===exports.HitTestType.box){var g=u.center,x=u.size,b=g.clone().addScaledVector(x,.5),T=g.clone().addScaledVector(x,-.5);t.intersectBox({min:b,max:T},d)&&(f=!0,h.push(d))}else if(u.type===exports.HitTestType.sphere){var E=u.center,S=u.radius;t.intersectSphere({center:E,radius:S},d)&&(f=!0,h.push(d))}else if(u.type===exports.HitTestType.custom){var _=u.collect(t,new A(e,i));_&&_.length>0&&(_.forEach((function(t){h.push(t)})),f=!0)}if(f){var C={compContent:s.item,id:a.id,name:a.name,position:h[h.length-1],parentId:a.parentId,hitPositions:h,behavior:u.behavior};if(a.emit("click",C),r.push(C),l(C))return{v:r}}}}},h=[],l=(null==o?void 0:o.stop)||rt,c=(null==o?void 0:o.skip)||rt,f=(null==o?void 0:o.maxCount)||this.items.length,d=0;d<this.items.length&&r.length<f;d++){var p=(s=this,u(d));if("object"===a(p))return p.v}return r},i.setChildrenRenderOrder=function(t){for(var i,r=o(this.items);!(i=r()).done;){var n=i.value;n.renderOrder=t++;var s=n.getComponent(e);s&&(t=s.setChildrenRenderOrder(t))}return t},i.fromData=function(e){t.prototype.fromData.call(this,e)},e}(Mi),u([we()],exports.CompositionComponent.prototype,"items",void 0),u([we()],exports.CompositionComponent.prototype,"sceneBindings",void 0),u([we()],exports.CompositionComponent.prototype,"timelineAsset",void 0),exports.CompositionComponent=u([Ae("CompositionComponent")],exports.CompositionComponent);var Mu,Ru=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter((function(t){return t.listener!==i})))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];var o;null==(o=e.listeners[t])||o.forEach((function(i){var n=i.listener,o=i.options;n.apply(void 0,[].concat(r)),(null==o?void 0:o.once)&&e.off(t,n)}))},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map((function(t){return t.listener})))||[]}},Iu=function(){function t(){this.update=new Ou,this.lateUpdate=new Nu}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==Mi.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==Mi.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==Mi.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==Mi.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),Pu=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),Ou=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=o(t);!(i=r()).done;){i.value.onUpdate(e)}},e}(Pu),Nu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=o(t);!(i=r()).done;){i.value.onLateUpdate(e)}},e}(Pu),Fu=function(t){function i(r,n){var a,u;(a=t.call(this)||this).sceneTicking=new Iu,a.speed=1,a.isEnded=!1,a.loaderData={},a.refContent=[],a.startTime=0,a.postProcessingEnabled=!1,a.destroyed=!1,a.postLoaders=[],a.paused=!1,a.isEndCalled=!1,a._textures=[],a.videos=[];var h,l=r.reusable,c=void 0!==l&&l,f=r.speed,d=void 0===f?1:f,p=r.baseRenderOrder,m=void 0===p?0:p,v=r.renderer,y=r.event,g=r.width,x=r.height,b=r.handleItemMessage;a.renderer=v,a._textures=n.textures;for(var T,E=o(Object.keys(n.assets));!(T=E()).done;){var S=T.value,_=n.assets[S];s(_,e.HTMLVideoElement)&&a.videos.push(_)}a.postProcessingEnabled=null!=(h=null==(u=n.jsonScene.renderSettings)?void 0:u.postProcessingEnabled)&&h,a.getEngine().renderLevel=n.renderLevel,c&&(n.consumed=!0);for(var C,A=n.jsonScene.compositions[0],w=o(n.jsonScene.compositions);!(C=w()).done;){var M=C.value;M.id===n.jsonScene.compositionId&&(A=M)}K(A),a.rootItem=new exports.VFXItem(a.getEngine()),a.rootItem.setInstanceId(A.id),a.rootItem.name="rootItem",a.rootItem.duration=A.duration,a.rootItem.endBehavior=A.endBehavior,a.rootItem.composition=Cs(a);for(var R,I,P,O,N=o(A.components);!(R=N()).done;){var F=R.value,L=a.getEngine().findObject(F);a.rootItem.components.push(L),L.item=a.rootItem}return a.rootComposition=a.rootItem.getComponent(exports.CompositionComponent),a.width=g,a.height=x,a.renderOrder=m,a.id=A.id,a.startTime=null!=(I=A.startTime)?I:0,a.renderer=v,a.event=y,a.statistic={loadStart:null!=(P=n.startTime)?P:0,loadTime:null!=(O=n.totalTime)?O:0,compileTime:0,firstFrameTime:0},a.reusable=c,a.speed=d,a.name=A.name,a.pluginSystem=n.pluginSystem,a.pluginSystem.initializeComposition(Cs(a),n),a.camera=new Is(a.name,Xe({},null==A?void 0:A.camera,{aspect:g/x,pixelWidth:g,pixelHeight:x})),a.url=n.url,a.interactive=!0,a.handleItemMessage=b,a.createRenderFrame(),i.buildItemTree(a.rootItem),a.rootComposition.setChildrenRenderOrder(0),a.pluginSystem.resetComposition(Cs(a),a.renderFrame),a}kt(i,t);var n=i.prototype;return n.getDuration=function(){return this.rootItem.duration},n.restart=function(){this.reset(),this.forwardTime(this.startTime)},n.setIndex=function(t){this.renderOrder=t},n.getIndex=function(){return this.renderOrder},n.setSpeed=function(t){this.speed=t},n.setVisible=function(t){this.rootItem.setVisible(t)},n.getSpeed=function(){return this.speed},n.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?(this.setTime(this.time-this.startTime),this.resume()):(this.setTime(0),this.resume())},n.pause=function(){this.paused=!0,this.emit("pause")},n.getPaused=function(){return this.paused},n.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var t=this.time;this.emit("play",{time:t})},n.gotoAndPlay=function(t){this.setTime(t),this.emit("goto",{time:t}),this.resume()},n.gotoAndStop=function(t){this.setTime(t),this.emit("goto",{time:t}),this.pause()},n.createRenderFrame=function(){this.renderFrame=new Pn({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},n.setTime=function(t){var e=this.speed,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0)},n.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},n.getComponent=function(t){return this.rootItem.getComponent(t)},n.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},n.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},n.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)})),this.postLoaders.forEach((function(i){return i.postProcessFrame(t,e)}))},n.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.rootItem.awake(),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=1e3*(this.time-e);this.updatePluginLoaders(i),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},n.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===Gt.destroy&&!this.reusable},n.updateCamera=function(){this.camera.updateMatrix()},n.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(i){return i.onCompositionUpdate(e,t)}))},n.updateCompositionTime=function(t){if(this.rootComposition.state!==exports.PlayState.Paused&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e>=i)switch(n=!0,r){case Gt.restart:e%=i,this.restart();break;case Gt.freeze:e=Math.min(i,e);case Gt.forward:case Gt.destroy:}this.rootComposition.time=e+this.startTime,this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},n.getItemByName=function(t){return this.rootItem.find(t)},n.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return oo((t-i.z)/r,(e-i.w)/n,this.camera)},n.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},n.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],o=this.getHitTestRay(t,e);return this.refContent.forEach((function(s){var a;null==(a=s.getComponent(exports.CompositionComponent))||a.hitTest(o,t,e,n,i,r)})),n},n.addInteractiveItem=function(t,e){if(e===Rt.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},n.removeInteractiveItem=function(t,e){e===Rt.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},n.destroyItem=function(t){var e=this;t.type==Pt.composition?t.endBehavior!==Gt.freeze&&t.getComponent(exports.CompositionComponent).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(i){return i.onCompositionItemRemoved(e,t)}))})):(y(this.items,t),this.pluginSystem.plugins.forEach((function(i){return i.onCompositionItemRemoved(e,t)})))},n.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()},n.dispose=function(){var t,e=this;if(!this.destroyed){this.destroyed=!0;for(var i,r=o(this.textures);!(i=r()).done;){i.value.dispose()}this._textures=[];for(var n,s=o(this.videos);!(n=s()).done;){var a=n.value;a.pause(),a.removeAttribute("src"),a.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),null==(t=this.pluginSystem)||t.destroyComposition(this),this.update=function(){it.error("Update disposed composition: "+e.name+".")},this.dispose=rt,this.renderer.env!==Qo&&this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},n.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},n.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},n.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},n.translate=function(t,e,i){this.rootItem.translate(t,e,i)},n.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},n.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},n.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},n.scale=function(t,e,i){this.rootItem.scale(t,e,i)},n.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},n.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},n.reloadTexture=function(){var t=this;return r((function(){return h(this,(function(e){switch(e.label){case 0:return t.textureOffloaded?[4,Promise.all(t.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))()},i.buildItemTree=function(t){for(var e,i=new Map,r=t.getComponent(exports.CompositionComponent).items,n=o(r);!(e=n()).done;){var s=e.value;i.set(s.id,s)}for(var a,u=o(r);!(a=u()).done;){var h=a.value;if(void 0===h.parentId)h.setParent(t);else{var l=i.get(h.parentId);if(!l)throw new Error("The element references a non-existent element, please check the data.");h.setParent(l)}}},wi(i,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),i}(Ru);exports.VFXItem=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).children=[],r.transform=new Ms,r.time=-1,r.duration=0,r.endBehavior=Gt.forward,r.type=Pt.base,r.components=[],r.isDuringPlay=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new Ru,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=e,i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.on=function(t,e,i){this.eventProcessor.on(t,e,i)},i.off=function(t,e){this.eventProcessor.off(t,e)},i.once=function(t,e){this.eventProcessor.once(t,e)},i.emit=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],i))},i.getListeners=function(t){return this.eventProcessor.getListeners(t)},i.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},i.getComponent=function(t){for(var e,i,r=o(this.components);!(i=r()).done;){var n=i.value;if(s(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,i=[],r=o(this.components);!(e=r()).done;){var n=e.value;s(n,t)&&i.push(n)}return i},i.setParent=function(t){(t!==this||t)&&(this.parent&&y(this.parent.children,this),this.parent=t,this.transform.parentTransform=t.transform,t.children.push(this),!this.composition&&t.composition&&(this.composition=t.composition),!this.isDuringPlay&&t.isDuringPlay&&(this.awake(),this.beginPlay()))},i.setColor=function(t,e,i,r){},i.setOpacity=function(t){},i.setActive=function(t){this.active!==!!t&&(this.active=!!t,this.onActiveChanged())},i.setVisible=function(t){for(var e,i=o(this.components);!(e=i()).done;){e.value.enabled=t}this.visible=t},i.getVisible=function(){return this.visible},i.getWorldTransform=function(t){var e=null!=t?t:new Ms({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.translate=function(t,e,i){this.transform.translate(t,e,i)},i.rotate=function(t,e,i){var r=new Kr(t,e,i),n=Ze.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},i.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,o=r.y,s=this.composition.renderer.getWidth()/2,a=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/s-1)*n,(1-2*e/a)*o,i)}},i.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},i.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},i.setScale=function(t,e,i){this.transform.setScale(t,e,i)},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.getCurrentPosition=function(){var t=new w;return this.transform.assignWorldTRS(t),t},i.find=function(t){var e;if(this.name===t)return this;var i=[];(e=i).push.apply(e,[].concat(this.children));for(var r=0;r<i.length;){var n,o=i[r];if(r++,o.name===t)return o;(n=i).push.apply(n,[].concat(o.children))}},i.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.resetGUID();var e=this.engine.findObject({id:this.defination.id});return e.resetGUID(),this.resetGUID(t),this.composition&&e.setParent(this.composition.rootItem),e},i.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=o(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},i.awake=function(){for(var t,e=o(this.components);!(t=e()).done;){var i=t.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var r,n=o(this.children);!(r=n()).done;){r.value.awake()}},i.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},i.onEnable=function(){this.isEnabled=!0;for(var t,e=o(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=o(this.components);!(r=n()).done;){var s=r.value;s.enabled&&!s.isEnableCalled&&s.enable()}},i.onDisable=function(){this.isEnabled=!1;for(var t,e=o(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},i.fromData=function(i){t.prototype.fromData.call(this,i);var r=i.id,n=i.name,a=i.parentId,u=i.endBehavior,h=i.transform,l=i.duration,c=void 0===l?0:l,f=i.visible,d=void 0===f||f;if(this.props=i,this.type=i.type,this.id=r.toString(),this.name=n,h&&this.transform.fromData(h),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=a,this.duration=c,this.endBehavior=u,i.content||(i.content={options:{}}),c<0)throw new Error("Item duration can't be less than 0, see "+Jo["Item duration can't be less than 0"]+".");if(i.components){this.components.length=0;for(var p,m=o(i.components);!(p=m()).done;){var v=p.value,y=this.engine.findObject(v);this.components.push(y),s(y,exports.ParticleSystem)&&(this.components.includes(y.renderer)||this.components.push(y.renderer))}}e.isComposition(this)&&this.instantiatePreComposition(),this.setVisible(d)},i.toData=function(){var t,e;(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=pe.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.defination.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.defination.components){this.defination.components=[];for(var i,r=o(this.components);!(i=r()).done;){var n=i.value;s(n,exports.EffectComponent)&&this.defination.components.push(n)}}this.defination.content={}},i.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,o=this.transform.getWorldPosition().z,s=this.composition.camera.getInverseVPRatio(o),a=s.x,u=s.y;this.transform.translate(2*t*a/r,-2*e*u/n,0)}},i.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var e,i=o(this.components.slice());!(e=i()).done;){e.value.dispose()}this.components=[],this._composition=null,this.transform.setValid(!1)}t.prototype.dispose.call(this)},i.resetChildrenParent=function(){for(var t,e=o(this.children);!(t=e()).done;){var i=t.value;this.parent&&i.setParent(this.parent)}var r;this.parent&&y(null==(r=this.parent)?void 0:r.children,this)},i.instantiatePreComposition=function(){var t=this.props.content.options.refId,e=this.engine.findEffectsObjectData(t);if(!e)throw new Error("Referenced precomposition with Id: "+t+" does not exist.");var i=e.components,r=this.getInstanceId();this.setInstanceId(e.id);for(var n,a=o(i);!(n=a()).done;){var u=n.value,h=this.engine.findObject(u);if(h.item=this,this.components.push(h),h.setInstanceId(ft()),s(h,exports.CompositionComponent))for(var l,c=o(h.items);!(l=c()).done;){var f=l.value;f.setInstanceId(ft());for(var d,p=o(f.components);!(d=p()).done;){d.value.setInstanceId(ft())}}}this.setInstanceId(r),Fu.buildItemTree(this)},i.resetGUID=function(t){var e,i=null!=(e=null==t?void 0:t.get(this))?e:ft();this.setInstanceId(i);for(var r,n=o(this.components);!(r=n()).done;){var s,a=r.value,u=null!=(s=null==t?void 0:t.get(a))?s:ft();a.setInstanceId(u)}for(var h,l=o(this.children);!(h=l()).done;){h.value.resetGUID(t)}},i.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=o(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,s=o(this.children);!(n=s()).done;){n.value.gatherPreviousObjectID(t)}},e.isComposition=function(t){return t.type===Pt.composition},e.isSprite=function(t){return t.type===Pt.sprite},e.isParticle=function(t){return t.type===Pt.particle},e.isNull=function(t){return t.type===Pt.null},e.isTree=function(t){return t.type===Pt.tree},e.isCamera=function(t){return t.type===Pt.camera},e.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},wi(e,[{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=o(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=o(this.components);!(e=i()).done;){var r=e.value;s(r,Ii)&&(r.priority=t)}}}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),e}(Re),exports.VFXItem=u([Ae(pe.VFXItemData)],exports.VFXItem),exports.Item=void 0,(Mu=exports.Item||(exports.Item={})).is=function(t,e){return t.type===e},Mu.isComposition=function(t){return t.type===Pt.composition},Mu.isParticle=function(t){return t.type===Pt.particle},Mu.isNull=function(t){return t.type===Pt.null};var Lu=[1,1,1,1],Vu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}kt(e,t);var i=e.prototype;return i.processFrame=function(t){var e=t.output.getUserData();if(s(e,exports.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(e)),!this.activeMaterial){var i,r;this.activeMaterial=null==(i=this.activeComponent)?void 0:i.material;var n=null==(r=this.activeMaterial)?void 0:r.getColor("_Color");n&&(this.startColor=n.toArray())}var o,a,u,h=eo(Lu,1),l=this.time/this.getDuration(),c=this.opacityOverLifetime,f=this.colorOverLifetime;if(f&&(h=P(f,l,!0),o=!0),c&&(h[3]*=c.getValue(l),o=!0),o)io(this.renderColor,h,this.startColor),null==(u=this.activeMaterial)||null==(a=u.getColor("_Color"))||a.setFromArray(this.renderColor)}},i.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;i&&(this.opacityOverLifetime=ns(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===Ut.GRADIENT_COLOR&&(this.colorOverLifetime=O(i.color[1])));return this},i.getActiveComponent=function(t){return t.getComponent(Yn)},e}(Es);exports.AnimationClip=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e}kt(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=C(e,0,this.duration),n=o(this.positionCurves);!(i=n()).done;){var s=i.value,a=s.keyFrames.getValue(r),u=this.findTarget(t,s.path);null==u||u.transform.setPosition(a.x,a.y,a.z)}for(var h,l=o(this.rotationCurves);!(h=l()).done;){var c=h.value,f=c.keyFrames.getValue(r),d=this.findTarget(t,c.path);null==d||d.transform.setQuaternion(f.x,f.y,f.z,f.w)}for(var p,m=o(this.eulerCurves);!(p=m()).done;){var v=p.value,y=v.keyFrames.getValue(r),g=this.findTarget(t,v.path);null==g||g.transform.setRotation(y.x,y.y,y.z)}for(var x,b=o(this.scaleCurves);!(x=b()).done;){var T=x.value,E=T.keyFrames.getValue(r),S=this.findTarget(t,T.path);null==S||S.transform.setScale(E.x,E.y,E.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=o(t.positionCurves);!(i=r()).done;){var n=i.value,s={path:n.path,keyFrames:ns(n.keyFrames)};e=Math.max(e,s.keyFrames.getMaxTime()),this.positionCurves.push(s)}if(t.rotationCurves)for(var a,u=o(t.rotationCurves);!(a=u()).done;){var h=a.value,l={path:h.path,keyFrames:ns(h.keyFrames)};e=Math.max(e,l.keyFrames.getMaxTime()),this.rotationCurves.push(l)}if(t.eulerCurves)for(var c,f=o(t.eulerCurves);!(c=f()).done;){var d=c.value,p={path:d.path,keyFrames:ns(d.keyFrames)};e=Math.max(e,p.keyFrames.getMaxTime()),this.eulerCurves.push(p)}if(t.scaleCurves)for(var m,v=o(t.scaleCurves);!(m=v()).done;){var y=m.value,g={path:y.path,keyFrames:ns(y.keyFrames)};e=Math.max(e,g.keyFrames.getMaxTime()),this.scaleCurves.push(g)}if(t.floatCurves)for(var x,b=o(t.floatCurves);!(x=b()).done;){var T=x.value,E={path:T.path,keyFrames:ns(T.keyFrames),property:T.property,className:T.className};e=Math.max(e,E.keyFrames.getMaxTime()),this.floatCurves.push(E)}if(t.colorCurves)for(var S,_=o(t.colorCurves);!(S=_()).done;){var C=S.value,A={path:C.path,keyFrames:ns(C.keyFrames),property:C.property,className:C.className};e=Math.max(e,A.keyFrames.getMaxTime()),this.colorCurves.push(A)}void 0!==t.duration?this.duration=t.duration:this.duration=e},i.findTarget=function(t,e){for(var i,r=t,n=o(e.split("."));!(i=n()).done;){for(var s,a=i.value,u=!1,h=o(r.children);!(s=h()).done;){var l=s.value;if(l.name===a){r=l,u=!0;break}}if(!u)return}return r},e}(Re),exports.AnimationClip=u([Ae(pe.AnimationClip)],exports.AnimationClip);var Du=[[0,0,1,1,0]],ku=0;exports.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new Vu;return t.create(this.data),t},i.fromData=function(t){this.data=t},e}(_s),exports.SpriteColorPlayableAsset=u([Ae(pe.SpriteColorPlayableAsset)],exports.SpriteColorPlayableAsset);var zu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new iu},e}(exports.TrackAsset),Uu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(exports.SpriteComponent)},e}(zu),Bu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(exports.EffectComponent)},e}(zu),Gu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){return new ju},e}(_s),ju=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(Es);function Xu(t){return t.maxVertexUniforms>=256?exports.maxSpriteMeshItemCount=32:t.maxVertexUniforms>=128?exports.maxSpriteMeshItemCount=16:void 0}exports.SpriteComponent=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).time=0,r.duration=0,r.loop=!0,r.splits=Du,r.name="MSprite"+ku++,i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.onUpdate=function(t){var e=this,i=this.time,r=this.duration;i>r&&this.loop&&(i%=r);var n=Math.min(Math.max(i/r,0),1),o=this.textureSheetAnimation,s=this.renderer.texture.source.video;if(s&&(0===i?s.pause():s.play().catch((function(t){e.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),o){var a,u,h,l,c,f=o.total||o.row*o.col,d=0,p=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],d=y[0],p=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/o.row*m,l=1/o.col*v):(h=1/o.col*m,l=1/o.row*v),o.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/o.col),b=g-x*o.col;c=u?[h*x,l*(o.col-b)]:[h*b,l*(1+x)]}else c=[0,l];null==(a=this.material.getVector4("_TexOffset"))||a.setFromArray([d+c[0],v+p-c[1],h,l])}this.time=i+t/1e3},i.onDisable=function(){t.prototype.onDisable.call(this),this.time=0},i.onDestroy=function(){var t=this.renderer.texture.source;t.sourceType===exports.TextureSourceType.video&&(null==t?void 0:t.video)&&(t.video.pause(),t.video.src="",t.video.load())},i.updateGeometry=function(t){var e=this.textureSheetAnimation?[0,0,1,1,this.splits[0][4]]:this.splits[0],i=e[0],r=e[1],n=Boolean(e[4]),s=n?e[3]:e[2],a=n?e[2]:e[3],u=n?-Math.PI/2:0,h=t.getAttributeData("aUV"),l=t.getAttributeData("aPos"),c=t.getIndexData(),f=[0,0];if(h&&l&&c){for(var d=h.length/2,p=0;p<d;p++){var m=3*p,v=2*p,y=l[m],g=l[m+1];f[0]=y,f[1]=g,Ea(f,f,u),h[v]=(f[0]+.5)*s+i,h[v+1]=(f[1]+.5)*a+r}this.geometry.setAttributeData("aPos",l.slice()),this.geometry.setAttributeData("aUV",h.slice()),this.geometry.setIndexData(c.slice()),this.geometry.setDrawCount(c.length)}this.geometry.subMeshes.length=0;for(var x,b=o(t.subMeshes);!(x=b()).done;){var T=x.value;this.geometry.subMeshes.push({offset:T.offset,indexCount:T.indexCount,vertexCount:T.vertexCount})}},i.updateGeometryFromMultiSplit=function(){for(var t=this.splits,e=this.textureSheetAnimation,i=this.defaultGeometry,r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],n=[],o=[],s=[],a=0;a<2;a++)for(var u=0;u<2;u++){var h=4*(2*u+a),l=e?[0,0,1,1,t[0][4]]:t[2*u+a],c=l[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],f=((a+a+1)/2-1)/2,d=((u+u+1)/2-1)/2,p=l[0],m=l[1],v=l[4]?l[3]:l[2],y=l[4]?l[2]:l[3],g=[r[0]/2+f,r[1]/2+d,r[2]/2+f,r[3]/2+d,r[4]/2+f,r[5]/2+d,r[6]/2+f,r[7]/2+d];n.push(c[0]*v+p,c[1]*y+m,c[2]*v+p,c[3]*y+m,c[4]*v+p,c[5]*y+m,c[6]*v+p,c[7]*y+m),s.push(1*g[0],1*g[1],0,1*g[2],1*g[3],0,1*g[4],1*g[5],0,1*g[6],1*g[7],0),o.push(h,1+h,2+h,2+h,1+h,3+h)}i.setAttributeData("aPos",new Float32Array(s)),i.setIndexData(new Uint16Array(o)),i.setAttributeData("aUV",new Float32Array(n)),i.setDrawCount(o.length)},i.fromData=function(e){var i;t.prototype.fromData.call(this,e);var r=null!=(i=e.splits)?i:Du,n=e.textureSheetAnimation;this.splits=r,this.textureSheetAnimation=n;var o=e.geometry?this.engine.findObject(e.geometry):this.defaultGeometry;1===r.length?this.updateGeometry(o):this.updateGeometryFromMultiSplit(),this.interaction=e.interaction;var s,a,u=e.options.startColor||[1,1,1,1];this.material.setColor("_Color",(new R).setFromArray(u)),this.duration=null!=(s=e.duration)?s:this.item.duration,this.loop=null==(a=e.loop)||a},e}(Yn),exports.SpriteComponent=u([Ae(pe.SpriteComponent)],exports.SpriteComponent),exports.maxSpriteMeshItemCount=8;var Hu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt),Wu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt),Yu=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){return this.set(t.x,t.y),this},e.copyTo=function(t){return t.set(this.x,this.y),t},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},wi(t,null,[{key:"shared",get:function(){return Zu.x=0,Zu.y=0,Zu}}]),t}(),Zu=new Yu,qu=1e-4,Ku=1e-4;function Qu(t,e,i,r,n,o,s,a){var u,h;s?(u=r,h=-i):(u=-r,h=i);var l=t-i*n+u,c=e-r*n+h,f=t+i*o+u,d=e+r*o+h;return a.push(l,c),a.push(f,d),2}function Ju(t,e,i,r,n,o,s,a){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,o-e);a&&l<c?l+=2*Math.PI:!a&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.abs(d),m=Math.sqrt(u*u+h*h),v=1+(15*p*Math.sqrt(m)/Math.PI>>0),y=d/v;if(f+=y,a){s.push(t,e),s.push(i,r);for(var g=1,x=f;g<v;g++,x+=y)s.push(t,e),s.push(t+Math.sin(x)*m,e+Math.cos(x)*m);s.push(t,e),s.push(n,o)}else{s.push(i,r),s.push(t,e);for(var b=1,T=f;b<v;b++,T+=y)s.push(t+Math.sin(T)*m,e+Math.cos(T)*m),s.push(t,e);s.push(n,o),s.push(t,e)}return 2*v}function $u(t,e,i,r,n,o,s,a,u){var h=qu;if(0!==t.length){var l=e,c=l.alignment;if(.5!==e.alignment){var f=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],o=t[e-1];r<e;r+=2){var s=t[r],a=t[r+1];i+=(s-n)*(a+o),n=s,o=a}return i<0?-1:1}(t);i&&(f*=-1),c=(c-.5)*f+.5}var d=new Yu(t[0],t[1]),p=new Yu(t[t.length-2],t[t.length-1]),m=r,v=Math.abs(d.x-p.x)<h&&Math.abs(d.y-p.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));var y=.5*(d.x+p.x),g=.5*(p.y+d.y);t.unshift(y,g),t.push(y,g)}var x=n,b=t.length/2,T=t.length,S=x.length/2,_=l.width/2,C=_*_,A=l.miterLimit*l.miterLimit,w=t[0],M=t[1],R=t[2],I=t[3],P=0,O=0,N=-(M-I),F=w-R,L=0,V=0,D=Math.sqrt(N*N+F*F)+E;N/=D,F/=D,N*=_,F*=_;var k=2*(1-c),z=2*c;m||(l.cap===he.Round?T+=Ju(w-N*(k-z)*.5,M-F*(k-z)*.5,w-N*k,M-F*k,w+N*z,M+F*z,x,!0)+2:l.cap===he.Square&&(T+=Qu(w,M,N,F,k,z,!0,x))),x.push(w-N*k,M-F*k),x.push(w+N*z,M+F*z);for(var U=1;U<b-1;++U){w=t[2*(U-1)],M=t[2*(U-1)+1],R=t[2*U],I=t[2*U+1],P=t[2*(U+1)],O=t[2*(U+1)+1],N=-(M-I),F=w-R,N/=D=Math.sqrt(N*N+F*F)+E,F/=D,N*=_,F*=_,L=-(I-O),V=R-P,L/=D=Math.sqrt(L*L+V*V)+E,V/=D,L*=_,V*=_;var B=R-w,G=M-I,j=R-P,X=O-I,H=B*j+G*X,W=G*j-X*B,Y=W<0;if(Math.abs(W)<.001*Math.abs(H))x.push(R-N*k,I-F*k),x.push(R+N*z,I+F*z),H>=0&&(l.join===le.Round?T+=Ju(R,I,R-N*k,I-F*k,R-L*k,I-V*k,x,!1)+4:T+=2,x.push(R-L*z,I-V*z),x.push(R+L*k,I+V*k));else{var Z=(-N+w)*(-F+I)-(-N+R)*(-F+M),q=(-L+P)*(-V+I)-(-L+R)*(-V+O),K=(B*q-j*Z)/W,Q=(X*Z-G*q)/W,J=(K-R)*(K-R)+(Q-I)*(Q-I),$=R+(K-R)*k,tt=I+(Q-I)*k,et=R-(K-R)*z,it=I-(Q-I)*z,rt=Y?k:z;J<=Math.min(B*B+G*G,j*j+X*X)+rt*rt*C?l.join===le.Bevel||J/C>A?(Y?(x.push($,tt),x.push(R+N*z,I+F*z),x.push($,tt),x.push(R+L*z,I+V*z)):(x.push(R-N*k,I-F*k),x.push(et,it),x.push(R-L*k,I-V*k),x.push(et,it)),T+=2):l.join===le.Round?Y?(x.push($,tt),x.push(R+N*z,I+F*z),T+=Ju(R,I,R+N*z,I+F*z,R+L*z,I+V*z,x,!0)+4,x.push($,tt),x.push(R+L*z,I+V*z)):(x.push(R-N*k,I-F*k),x.push(et,it),T+=Ju(R,I,R-N*k,I-F*k,R-L*k,I-V*k,x,!1)+4,x.push(R-L*k,I-V*k),x.push(et,it)):(x.push($,tt),x.push(et,it)):(x.push(R-N*k,I-F*k),x.push(R+N*z,I+F*z),l.join===le.Round?T+=Y?Ju(R,I,R+N*z,I+F*z,R+L*z,I+V*z,x,!0)+2:Ju(R,I,R-N*k,I-F*k,R-L*k,I-V*k,x,!1)+2:l.join===le.Miter&&J/C<=A&&(Y?(x.push(et,it),x.push(et,it)):(x.push($,tt),x.push($,tt)),T+=2),x.push(R-L*k,I-V*k),x.push(R+L*z,I+V*z),T+=2)}}w=t[2*(b-2)],M=t[2*(b-2)+1],R=t[2*(b-1)],N=-(M-(I=t[2*(b-1)+1])),F=w-R,N/=D=Math.sqrt(N*N+F*F)+E,F/=D,N*=_,F*=_,x.push(R-N*k,I-F*k),x.push(R+N*z,I+F*z),m||(l.cap===he.Round?T+=Ju(R-N*(k-z)*.5,I-F*(k-z)*.5,R-N*k,I-F*k,R+N*z,I+F*z,x,!1)+2:l.cap===he.Square&&(T+=Qu(R,I,N,F,k,z,!1,x)));for(var nt=Ku*Ku,ot=S;ot<T+S-2;++ot)w=x[2*ot],M=x[2*ot+1],R=x[2*(ot+1)],I=x[2*(ot+1)+1],P=x[2*(ot+2)],O=x[2*(ot+2)+1],Math.abs(w*(I-O)+R*(O-M)+P*(M-I))<nt||a.push(ot,ot+1,ot+2)}}var th=function(){},eh="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ih={exports:{}};!function(t){var e;function i(t,e){return t.b===e.b&&t.a===e.a}function r(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function o(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function s(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function a(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function u(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function h(t){return r(t.b.a,t.a)}function l(t){return r(t.a,t.b.a)}function c(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function d(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,E(e.a,t.a)),e.d!==t.d&&(i=!0,S(e.d,t.d)),g(e,t),r||(x(e,t.a),t.a.c=t),i||(b(e,t.d),t.d.a=t))}function p(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,S(t.d,t.b.d)),t.c===t?E(t.a,null):(t.b.d.a=$(t),t.a.c=t.c,g(t,$(t)),i||b(t,t.d)),e.c===e?(E(e.a,null),S(e.d,null)):(t.d.a=$(e),e.a.c=e.c,g(e,$(e))),T(t)}function m(t){var e=y(t),i=e.b;return g(e,t.e),e.a=t.b.a,x(i,e.a),e.d=i.d=t.d,e=e.b,g(t.b,$(t.b)),g(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function v(t,e){var i=!1,r=y(t),n=r.b;return e.d!==t.d&&(i=!0,S(e.d,t.d)),g(r,t.e),g(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||b(r,t.d),r}function y(t){var e=new J,i=new J,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function g(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function x(t,e){var i=e.f,r=new et(e,i);i.e=r,e.f=r,i=r.c=t;do{i.a=r,i=i.c}while(i!==t)}function b(t,e){var i=e.d,r=new Q(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do{i.d=r,i=i.e}while(i!==t)}function T(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function E(t,e){var i=t.c,r=i;do{r.a=e,r=r.c}while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function S(t,e){var i=t.a,r=i;do{r.d=e,r=r.e}while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function _(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var C=4e150;function A(t,e){t.f+=e.f,t.b.f+=e.b.f}function w(t,e,i){return t=t.a,e=e.a,i=i.a,e.b.a===t?i.b.a===t?r(e.a,i.a)?0>=o(i.b.a,e.a,i.a):0<=o(e.b.a,i.a,e.a):0>=o(i.b.a,t,i.a):i.b.a===t?0<=o(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(i.b.a,t,i.a))}function M(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function R(t,e){p(t.a),t.c=!1,t.a=e,e.i=t}function I(t){var e=t.a.a;do{t=dt(t)}while(t.a.a===e);return t.c&&(R(t,e=v(ft(t).a.b,t.a.e)),t=dt(t)),t}function P(t,e,i){var r=new ct;return r.a=i,r.e=H(t.f,e.e,r),i.i=r}function O(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function N(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,M(t)}function F(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=ft(t),n=r.a;if(n.a!==e.a){if(!r.c){N(t);break}R(r,n=v(e.c.b,n.b))}e.c!==n&&(d($(n),n),d(e,n)),N(t),e=r.a,t=r}return e}function L(t,e,i,r,n,o){var s=!0;do{P(t,e,i.b),i=i.c}while(i!==r);for(null===n&&(n=ft(e).a.b.c);(i=(r=ft(e)).a.b).a===n.a;)i.c!==n&&(d($(i),i),d($(n),i)),r.f=e.f-i.f,r.d=O(t,r.f),e.b=!0,!s&&z(t,e)&&(A(i,n),M(e),p(n)),s=!1,e=r,n=i;e.b=!0,o&&B(t,e)}function V(t,e,i,r,n){var o=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(o,i,r,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=i[0])}function D(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),d(e,i)}function k(t,e,i,r,n){var o=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),s=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),a=n+1;r[n]=.5*s/(o+s),r[a]=.5*o/(o+s),t.g[0]+=r[n]*e.g[0]+r[a]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[a]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[a]*i.g[2]}function z(t,e){var n=ft(e),s=e.a,a=n.a;if(r(s.a,a.a)){if(0<o(a.b.a,s.a,a.a))return!1;if(i(s.a,a.a)){if(s.a!==a.a){n=t.e;var u=s.a.h;if(0<=u){var h=(n=n.b).d,l=n.e,c=n.c,f=c[u];h[f]=h[n.a],c[h[f]]=f,f<=--n.a&&(1>=f||r(l[h[f>>1]],l[h[f]])?ht(n,f):lt(n,f)),l[u]=null,c[u]=n.b,n.b=u}else for(n.c[-(u+1)]=null;0<n.a&&null===n.c[n.d[n.a-1]];)--n.a;D(t,$(a),s)}}else m(a.b),d(s,$(a)),e.b=n.b=!0}else{if(0>o(s.b.a,a.a,s.a))return!1;dt(e).b=e.b=!0,m(s.b),d($(a),s)}return!0}function U(t,e){var h=ft(e),l=e.a,f=h.a,p=l.a,v=f.a,y=l.b.a,g=f.b.a,x=new et;if(o(y,t.a,p),o(g,t.a,v),p===v||Math.min(p.a,y.a)>Math.max(v.a,g.a))return!1;if(r(p,v)){if(0<o(g,p,v))return!1}else if(0>o(y,v,p))return!1;var b,T,E=y,S=p,_=g,C=v;if(r(E,S)||(b=E,E=S,S=b),r(_,C)||(b=_,_=C,C=b),r(E,_)||(b=E,E=_,_=b,b=S,S=C,C=b),r(_,S)?r(S,C)?(0>(b=n(E,_,S))+(T=n(_,S,C))&&(b=-b,T=-T),x.b=c(b,_.b,T,S.b)):(0>(b=o(E,_,S))+(T=-o(E,C,S))&&(b=-b,T=-T),x.b=c(b,_.b,T,C.b)):x.b=(_.b+S.b)/2,s(E,S)||(b=E,E=S,S=b),s(_,C)||(b=_,_=C,C=b),s(E,_)||(b=E,E=_,_=b,b=S,S=C,C=b),s(_,S)?s(S,C)?(0>(b=a(E,_,S))+(T=a(_,S,C))&&(b=-b,T=-T),x.a=c(b,_.a,T,S.a)):(0>(b=u(E,_,S))+(T=-u(E,C,S))&&(b=-b,T=-T),x.a=c(b,_.a,T,C.a)):x.a=(_.a+S.a)/2,r(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=r(p,v)?p:v,r(E,x)&&(x.b=E.b,x.a=E.a),i(x,p)||i(x,v))return z(t,e),!1;if(!i(y,t.a)&&0<=o(y,t.a,x)||!i(g,t.a)&&0>=o(g,t.a,x)){if(g===t.a)return m(l.b),d(f.b,l),l=ft(e=I(e)).a,F(t,ft(e),h),L(t,e,$(l),l,l,!0),!0;if(y===t.a){m(f.b),d(l.e,$(f)),v=(p=h=e).a.b.a;do{p=dt(p)}while(p.a.b.a===v);return p=ft(e=p).a.b.c,h.a=$(f),L(t,e,(f=F(t,h,null)).c,l.b.c,p,!0),!0}return 0<=o(y,t.a,x)&&(dt(e).b=e.b=!0,m(l.b),l.a.b=t.a.b,l.a.a=t.a.a),0>=o(g,t.a,x)&&(e.b=h.b=!0,m(f.b),f.a.b=t.a.b,f.a.a=t.a.a),!1}return m(l.b),m(f.b),d($(f),l),l.a.b=x.b,l.a.a=x.a,l.a.h=rt(t.e,l.a),l=l.a,f=[0,0,0,0],x=[p.d,y.d,v.d,g.d],l.g[0]=l.g[1]=l.g[2]=0,k(l,p,y,f,0),k(l,v,g,f,2),V(t,l,x,f,!0),dt(e).b=e.b=h.b=!0,!1}function B(t,e){for(var i=ft(e);;){for(;i.b;)e=i,i=ft(i);if(!e.b&&(i=e,null===(e=dt(e))||!e.b))break;e.b=!1;var n,s=e.a,a=i.a;if(n=s.b.a!==a.b.a)t:{var u=ft(n=e),h=n.a,l=u.a,c=void 0;if(r(h.b.a,l.b.a)){if(0>o(h.b.a,l.b.a,h.a)){n=!1;break t}dt(n).b=n.b=!0,c=m(h),d(l.b,c),c.d.c=n.d}else{if(0<o(l.b.a,h.b.a,l.a)){n=!1;break t}n.b=u.b=!0,c=m(l),d(h.e,l.b),c.b.d.c=n.d}n=!0}if(n&&(i.c?(M(i),p(a),a=(i=ft(e)).a):e.c&&(M(e),p(s),s=(e=dt(i)).a)),s.a!==a.a)if(s.b.a===a.b.a||e.c||i.c||s.b.a!==t.a&&a.b.a!==t.a)z(t,e);else if(U(t,e))break;s.a===a.a&&s.b.a===a.b.a&&(A(a,s),M(e),p(s),e=dt(i))}}function G(t,e){t.a=e;for(var n=e.c;null===n.i;)if((n=n.c)===e.c){n=t;var s=e;(h=new ct).a=s.c.b;var a=(c=n.f).a;do{a=a.a}while(null!==a.b&&!c.c(c.b,h,a.b));var u=ft(c=a.b),h=c.a;a=u.a;if(0===o(h.b.a,s,h.a))i((h=c.a).a,s)||i(h.b.a,s)||(m(h.b),c.c&&(p(h.c),c.c=!1),d(s.c,h),G(n,s));else{var l=r(a.b.a,h.b.a)?c:u;u=void 0;c.d||l.c?(u=l===c?v(s.c.b,h.e):v(a.b.c.b,s.c).b,l.c?R(l,u):(h=n,(c=P(n,c,u)).f=dt(c).f+c.a.f,c.d=O(h,c.f)),G(n,s)):L(n,c,s.c,s.c,null,!0)}return}if(c=(h=ft(n=I(n.i))).a,(h=F(t,h,null)).c===c){h=(c=h).c,a=ft(n),u=n.a,l=a.a;var c,f=!1;u.b.a!==l.b.a&&U(t,n),i(u.a,t.a)&&(d($(h),u),h=ft(n=I(n)).a,F(t,ft(n),a),f=!0),i(l.a,t.a)&&(d(c,$(l)),c=F(t,a,null),f=!0),f?L(t,n,c.c,h,h,!0):(s=r(l.a,u.a)?$(l):u,L(t,n,s=v(c.c.b,s),s.c,s.c,!1),s.b.i.c=!0,B(t,n))}else L(t,n,h.c,c,c,!0)}function j(t,e){var i=new ct,r=f(t.b);r.a.b=C,r.a.a=e,r.b.a.b=-C,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=H(r=t.f,r.a,i),i.e=r}function X(t){this.a=new W,this.b=t,this.c=w}function H(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i));return t=new W(i,e.a,e),e.a.c=t,e.a=t}function W(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function Y(){this.d=Z,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var Z=0;function q(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case Z:K(t,100151),t.u(null);break;case 1:K(t,100152),t.t()}else switch(t.d){case 2:K(t,100154),t.v();break;case 1:K(t,100153),t.w()}}function K(t,e){t.p&&t.p(e,t.c)}function Q(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function J(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function $(t){return t.b.e}function tt(){this.c=new et,this.a=new Q,this.b=new J,this.d=new J,this.b.b=this.d,this.d.b=this.b}function et(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function it(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ot}function rt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=st(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&<(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function nt(t){if(0===t.a)return ut(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&r(at(t.b),e))return ut(t.b);do{--t.a}while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function ot(){this.d=st([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function st(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function at(t){return t.e[t.d[1]]}function ut(t){var e=t.d,i=t.e,r=t.c,n=e[1],o=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),o}function ht(t,e){for(var i=t.d,n=t.e,o=t.c,s=e,a=i[s];;){var u=s<<1;u<t.a&&r(n[i[u+1]],n[i[u]])&&(u+=1);var h=i[u];if(u>t.a||r(n[a],n[h])){i[s]=a,o[a]=s;break}i[s]=h,o[h]=s,s=u}}function lt(t,e){for(var i=t.d,n=t.e,o=t.c,s=e,a=i[s];;){var u=s>>1,h=i[u];if(0===u||r(n[h],n[a])){i[s]=a,o[a]=s;break}i[s]=h,o[h]=s,s=u}}function ct(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function ft(t){return t.e.c.b}function dt(t){return t.e.a.b}(e=Y.prototype).x=function(){q(this,Z)},e.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=e)}break;case 100141:return void(this.m=!!e);default:return void K(this,100900)}K(this,100901)},e.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:K(this,100900)}return!1},e.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},e.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:K(this,100900)}},e.C=function(t,e){var i=!1,r=[0,0,0];q(this,2);for(var n=0;3>n;++n){var o=t[n];-1e150>o&&(o=-1e150,i=!0),1e150<o&&(o=1e150,i=!0),r[n]=o}i&&K(this,100155),null===(i=this.q)?d(i=f(this.b),i.b):(m(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},e.u=function(t){q(this,Z),this.d=1,this.b=new tt,this.c=t},e.t=function(){q(this,1),this.d=2,this.q=null},e.v=function(){q(this,2),this.d=1},e.w=function(){q(this,1),this.d=Z;var t=!1,e=[c=this.j[0],n=this.j[1],a=this.j[2]];if(0===c&&0===n&&0===a){for(var n=[-2e150,-2e150,-2e150],s=[2e150,2e150,2e150],a=[],u=[],c=(t=this.b.c).e;c!==t;c=c.e)for(var f=0;3>f;++f){var d=c.g[f];d<s[f]&&(s[f]=d,u[f]=c),d>n[f]&&(n[f]=d,a[f]=c)}if(c=0,n[1]-s[1]>n[0]-s[0]&&(c=1),n[2]-s[2]>n[c]-s[c]&&(c=2),s[c]>=n[c])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,s=u[c],a=a[c],u=[0,0,0],s=[s.g[0]-a.g[0],s.g[1]-a.g[1],s.g[2]-a.g[2]],f=[0,0,0],c=t.e;c!==t;c=c.e)f[0]=c.g[0]-a.g[0],f[1]=c.g[1]-a.g[1],f[2]=c.g[2]-a.g[2],u[0]=s[1]*f[2]-s[2]*f[1],u[1]=s[2]*f[0]-s[0]*f[2],u[2]=s[0]*f[1]-s[1]*f[0],(d=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=d,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[_(s)]=1)}t=!0}for(u=_(e),c=this.b.c,n=(u+1)%3,a=(u+2)%3,u=0<e[u]?1:-1,e=c.e;e!==c;e=e.e)e.b=e.g[n],e.a=u*e.g[a];if(t){for(e=0,c=(t=this.b.a).b;c!==t;c=c.b)if(!(0>=(n=c.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==c.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,c=(e=this.b.b).h;c!==e;c=t)t=c.h,n=c.e,i(c.a,c.b.a)&&c.e.e!==c&&(D(this,n,c),p(c),n=(c=n).e),n.e===c&&(n!==c&&(n!==t&&n!==t.b||(t=t.h),p(n)),c!==t&&c!==t.b||(t=t.h),p(c));for(this.e=e=new it,c=(t=this.b.c).e;c!==t;c=c.e)c.h=rt(e,c);for(function(t){t.d=[];for(var e=0;e<t.a;e++)t.d[e]=e;t.d.sort(function(t){return function(e,i){return r(t[e],t[i])?1:-1}}(t.c)),t.e=!0,function(t){for(var e=t.a;1<=e;--e)ht(t,e);t.h=!0}(t.b)}(e),this.f=new X(this),j(this,-C),j(this,C);null!==(e=nt(this.e));){for(;;){t:if(c=this.e,0===c.a)t=at(c.b);else if(t=c.c[c.d[c.a-1]],0!==c.b.a&&(c=at(c.b),r(c,t))){t=c;break t}if(null===t||!i(t,e))break;t=nt(this.e),D(this,e.c,t.c)}G(this,e)}for(this.a=this.f.a.a.b.a.a,e=0;null!==(t=this.f.a.a.b);)t.h||++e,M(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,c=(e=this.b).a.b;c!==e.a;c=t)t=c.b,(c=c.a).e.e===c&&(A(c.c,c),p(c));if(!this.n){if(e=this.b,this.m)for(c=e.b.h;c!==e.b;c=t)t=c.h,c.b.d.c!==c.d.c?c.f=c.d.c?1:-1:p(c);else for(c=e.a.b;c!==e.a;c=t)if(t=c.b,c.c){for(c=c.a;r(c.b.a,c.a);c=c.c.b);for(;r(c.a,c.b.a);c=c.e);for(n=c.c.b,a=void 0;c.e!==n;)if(r(c.b.a,n.a)){for(;n.e!==c&&(h(n.e)||0>=o(n.a,n.b.a,n.e.b.a));)n=(a=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==c&&(l(c.c.b)||0<=o(c.b.a,c.a,c.c.b.a));)c=(a=v(c,c.c.b)).b;c=c.e}for(;n.e.e!==c;)n=(a=v(n.e,n)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(t=(e=this.b).a.b;t!==e.a;t=t.b)if(t.c){this.h&&this.h(2,this.c),c=t.a;do{this.k&&this.k(c.a.d,this.c),c=c.e}while(c!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,c=!1,n=-1,a=e.a.d;a!==e.a;a=a.d)if(a.c){c||(this.h&&this.h(4,this.c),c=!0),u=a.a;do{t&&(n!==(s=u.b.d.c?0:1)&&(n=s,this.l&&this.l(!!n,this.c))),this.k&&this.k(u.a.d,this.c),u=u.e}while(u!==a.a)}c&&this.i&&this.i(this.c)}if(this.r){for(c=(e=this.b).a.b;c!==e.a;c=t)if(t=c.b,!c.c){a=(n=c.a).e,u=void 0;do{a=(u=a).e,u.d=null,null===u.b.d&&(u.c===u?E(u.a,null):(u.a.c=u.c,g(u,$(u))),(s=u.b).c===s?E(s.a,null):(s.a.c=s.c,g(s,$(s))),T(u))}while(u!==n);n=c.d,(c=c.b).d=n,n.b=c}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},eh.libtess={GluTesselator:Y,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},Y.prototype.gluDeleteTess=Y.prototype.x,Y.prototype.gluTessProperty=Y.prototype.B,Y.prototype.gluGetTessProperty=Y.prototype.y,Y.prototype.gluTessNormal=Y.prototype.A,Y.prototype.gluTessCallback=Y.prototype.z,Y.prototype.gluTessVertex=Y.prototype.C,Y.prototype.gluTessBeginPolygon=Y.prototype.u,Y.prototype.gluTessBeginContour=Y.prototype.t,Y.prototype.gluTessEndContour=Y.prototype.v,Y.prototype.gluTessEndPolygon=Y.prototype.w,t.exports=eh.libtess}(ih);var rh=function(){var t=new ih.exports.GluTesselator;return t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==ih.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,i){return[t[0],t[1],t[2]]})),t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function nh(t){rh.gluTessNormal(0,0,1);var e=[];rh.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){rh.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var o=[r[n],r[n+1],0];rh.gluTessVertex(o,o)}rh.gluTessEndContour()}return rh.gluTessEndPolygon(),e}var oh=function(t){function e(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var o=Array.isArray(i[0])?i[0]:i;if("number"!=typeof o[0]){for(var s=[],a=0,u=o.length;a<u;a++)s.push(o[a].x,o[a].y);o=s}return n.points=o,n.closePath=!0,n}kt(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,o=r-1;n<r;o=n++){var s=this.points[2*n],a=this.points[2*n+1],u=this.points[2*o],h=this.points[2*o+1];a>e!=h>e&&t<(e-a)/(h-a)*(u-s)+s&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){var o=nh([t]),s=e.length/2;0===o.length&&this.getLineEndPointsTriangle(t,o);for(var a=0;a<o.length;a++)e[2*i+a]=o[a];for(var u=o.length/2,h=0;h<u;h++)r[n+h]=s+h},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw new Error("Invalid points array");if(2!==t.length){var i=t[2]-t[0],r=t[3]-t[1],n=t[0],o=t[1],s=t[0],a=t[1];if(Math.abs(i)>=Math.abs(r))for(var u=0;u<t.length;u+=2){var h=t[u],l=t[u+1];h<n&&(n=h,o=l),h>s&&(s=h,a=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<o&&(n=f,o=d),d>a&&(s=f,a=d)}e.push(n,o,s,a,s,a)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},wi(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(th),sh=8,ah=1.1920929e-7;function uh(t,e,i,r,n,o,s,a,u,h){var l=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function(t,e,i,r,n,o,s,a,u,h){hh(t,e,i,r,n,o,s,a,u,h,0),u.push(s,a)}(e,i,r,n,o,s,a,u,t,l*=l),t}function hh(t,e,i,r,n,o,s,a,u,h,l){if(!(l>sh)){var c=(t+i)/2,f=(e+r)/2,d=(i+n)/2,p=(r+o)/2,m=(n+s)/2,v=(o+a)/2,y=(c+d)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(y+x)/2,E=(g+b)/2;if(l>0){var S=s-t,_=a-e,C=Math.abs((i-s)*_-(r-a)*S),A=Math.abs((n-s)*_-(o-a)*S);if(C>ah&&A>ah){if((C+A)*(C+A)<=h*(S*S+_*_))return void u.push(T,E)}else if(C>ah){if(C*C<=h*(S*S+_*_))return void u.push(T,E)}else if(A>ah){if(A*A<=h*(S*S+_*_))return void u.push(T,E)}else if((S=T-(t+s)/2)*S+(_=E-(e+a)/2)*_<=h)return void u.push(T,E)}hh(t,e,c,f,y,g,T,E,u,h,l+1),hh(T,E,x,b,m,v,s,a,u,h,l+1)}}var lh,ch=function(t){function e(e,i,r,n){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(o=t.call(this)||this).type="ellipse",o.x=e,o.y=i,o.halfWidth=r,o.halfHeight=n,o}kt(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return(i*=i)+(r*=r)<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var o=i/2,s=r-o,a=n-o,u=r+o,h=n+o,l=t-this.x,c=e-this.y;return l*l/(s*s)+c*c/(a*a)>1&&l*l/(u*u)+c*c/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var o=Math.ceil(5*Math.sqrt(r+n)),s=8*o+0+0;if(0===s)return t;if(0===o)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var a=0,u=4*o+0+2,h=u,l=s,c=0+r,f=0,d=e+c,p=e-c,m=i+f;t[a++]=d,t[a++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<o;v++){var y=Math.PI/2*(v/o),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,S=i-x;t[a++]=b,t[a++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=S,t[--l]=S,t[--l]=b}d=e+(c=0),p=e-c,m=i+(f=0+n);var _=i-f;return t[a++]=d,t[a++]=m,t[--l]=_,t[--l]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var o=0,s=0,a=0;a<t.length;a+=2)o+=t[a],s+=t[a+1];o/=t.length/2,s/=t.length/2;var u=i;e[2*u]=o,e[2*u+1]=s;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(th);exports.StarType=void 0,(lh=exports.StarType||(exports.StarType={}))[lh.Star=0]="Star",lh[lh.Polygon=1]="Polygon";var fh=function(t){function e(e,i,r,n,o,s){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),void 0===s&&(s=0),(a=t.call(this)||this).pointCount=e,a.outerRadius=i,a.innerRadius=r,a.outerRoundness=n,a.innerRoundness=o,a.starType=s,a.v=[],a.in=[],a.out=[],a}kt(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)uh(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var i=this.v.length-1;uh(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var o=nh([t]),s=e.length/2,a=0;a<o.length;a++)e[2*i+a]=o[a];for(var u=o.length/2,h=0;h<u;h++)r[n+h]=s+h},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),o=2*Math.PI/n,s=!0,a=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*a/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){i=s?h:l,r=s?c:f;var p=(e=s?a:u)*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,s=!s,d+=1*o}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,o=2*Math.PI*r/(4*e),s=.5*-Math.PI;for(t=0;t<e;t++){var a=r*Math.cos(s),u=r*Math.sin(s),h=0===a&&0===u?0:u/Math.sqrt(a*a+u*u),l=0===a&&0===u?0:-a/Math.sqrt(a*a+u*u),c=2*t;this.v[c]=a,this.v[c+1]=u,this.in[c]=a+h*o*n*1,this.in[c+1]=u+l*o*n*1,this.out[c]=a-h*o*n*1,this.out[c+1]=u-l*o*n*1,s+=1*i}},e}(th),dh=function(t){function e(e,i,r,n,o){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=20),(s=t.call(this)||this).x=e,s.y=i,s.width=r,s.height=n,s.roundness=o,s}kt(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t){var e,i=this.width/2,r=this.height/2,n=this.x+i,o=this.y+r,s=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(i,r)),a=i-s,u=r-e;if(s>=0&&e>=0&&a>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(s+e)),l=8*h+(a?4:0)+(u?4:0);if(0!==l){if(0===h)return t[0]=t[6]=n+a,t[1]=t[3]=o+u,t[2]=t[4]=n-a,void(t[5]=t[7]=o-u);var c=0,f=4*h+(a?2:0)+2,d=f,p=l,m=a+s,v=u,y=n+m,g=n-m,x=o+v;if(t[c++]=y,t[c++]=x,t[--f]=x,t[--f]=g,u){var b=o-v;t[d++]=g,t[d++]=b,t[--p]=b,t[--p]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),S=a+Math.cos(E)*s,_=u+Math.sin(E)*e,C=n+S,A=n-S,w=o+_,M=o-_;t[c++]=C,t[c++]=w,t[--f]=w,t[--f]=A,t[d++]=A,t[d++]=M,t[--p]=M,t[--p]=C}y=n+(m=a),g=n-m,x=o+(v=u+e);var R=o-v;t[c++]=y,t[c++]=x,t[--p]=R,t[--p]=y,a&&(t[c++]=g,t[c++]=x,t[--p]=R,t[--p]=g)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var o=0,s=0,a=0;a<t.length;a+=2)o+=t[a],s+=t[a+1];o/=t.length/2,s/=t.length/2;var u=i;e[2*u]=o,e[2*u+1]=s;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(th),ph=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=o(this.graphicsPath.instructions);!(t=e()).done;){var i=t.value,r=i.action,n=i.data;switch(r){case"bezierCurveTo":this.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);break;case"polyStar":this.polyStar(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"rect":this.rect(n[0],n[1],n[2],n[3],n[4]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,o,s){this.ensurePoly();var a=this.currentPoly;return uh(a.points,a.lastX,a.lastY,t,e,i,r,n,o,s),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new ch(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,o,s){return this.drawShape(new fh(t,e,i,r,n,o),s),this},e.rect=function(t,e,i,r,n,o){return this.drawShape(new dh(t,e,i,r,n),o),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new oh).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new oh,this.currentPoly.points.push(0,0))},t}(),mh=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,o,s){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,o,s]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,o){return this.instructions.push({action:"rect",data:[t,e,i,r,n,o]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,o,s){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,o,s]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},wi(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new ph(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function vh(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?Cs(t):e}var yh=new(function(){function t(){this.elements=[]}var i=t.prototype;return i.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},i.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return K(t),t}if(Ia(Ma))return e.window._createOffscreenCanvas(10,10);var i=e.document.createElement("canvas");return i.getContext("2d",{willReadFrequently:!0}),i},i.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?v(this.elements,t):t.remove()},t}()),gh=function(){function t(t){this.width=0,this.height=0;var e=t.fontSize,i=t.textHeight,r=void 0===i?100:i,n=t.textWidth,o=void 0===n?100:n,s=t.textOverflow,a=void 0===s?Qt.clip:s,u=t.textBaseline,h=void 0===u?$t.top:u,l=t.textAlign,c=void 0===l?te.left:l,f=t.text,d=void 0===f?" ":f,p=t.letterSpace,m=void 0===p?0:p,v=t.lineGap,y=void 0===v?.571:v,g=t.autoWidth,x=void 0!==g&&g,b=t.lineHeight,T=void 0===b?e:b,E=t.useLegacyRichText,S=void 0!==E&&E,_=e+m;this.autoWidth=x,this.maxTextWidth=d.length*_,this.width=o,this.height=r,this.letterSpace=m,this.lineGap=y,this.useLegacyRichText=S,this.overflow=a,this.textBaseline=h,this.textAlign=c,this.lineHeight=T}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,o=t.fontScale,s=(i-r)/3,a=r+n*o,u=i*(e-1),h=0;switch(this.textBaseline){case $t.top:h=a+s;break;case $t.middle:h=(this.height*o-u+a)/2;break;case $t.bottom:h=this.height*o-u-s}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case te.left:i=t.outlineWidth*t.fontScale;break;case te.middle:i=(this.width*t.fontScale-e)/2;break;case te.right:i=this.width*t.fontScale-e}return i},e.getOffsetYRich=function(t,e,i){var r=t.outlineWidth,n=t.fontScale,o=e.reduce((function(t,e){return t+e}),0),s=(e[0]-i)/3,a=i+r*n,u=o-e[0],h=0;switch(this.textBaseline){case $t.top:h=a+s;break;case $t.middle:h=(this.height*n-o+this.lineGap*n)/2+a;break;case $t.bottom:h=this.height*n-u-s}return h},e.setSize=function(t,e){this.width=t,this.height=e},t}(),xh=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,o,s,a=t.textColor,u=void 0===a?[1,1,1,1]:a,h=t.fontSize,l=void 0===h?40:h,c=t.outline,f=t.shadow,d=t.fontWeight,p=void 0===d?"normal":d,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,g=void 0===y?"sans-serif":y;(this.textColor=u,this.textWeight=p,this.fontStyle=v,this.fontFamily=g,this.fontSize=l,c)&&(this.isOutlined=!0,this.outlineColor=null!=(e=c.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=c.outlineWidth)?i:1);f&&(this.hasShadow=!0,this.shadowBlur=null!=(r=f.shadowBlur)?r:2,this.shadowColor=null!=(n=f.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(o=f.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(s=f.shadowOffsetY)?s:0);this.fontStyle!==ie.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},bh=["serif","sans-serif","monospace","courier"],Th=0;exports.TextComponent=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.maxLineWidth=0,r.SCALE_FACTOR=.1,r.ALPHA_FIX_VALUE=1/255,r.name="MText"+Th++,i&&r.fromData(i),r.canvas=yh.getCanvas(),yh.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return vh(r);var n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}kt(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.disposeTextTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new R(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(Yn),exports.TextComponent=u([Ae(pe.TextComponent)],exports.TextComponent);var Eh=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new xh(t),this.textLayout=new gh(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){var i=this.context,r=this.textLayout,n=r.letterSpace,o=r.overflow;this.maxLineWidth=0;var s=this.textLayout.width+this.textStyle.fontOffset,a=1,u=0;i&&(i.font=this.getFontDesc(this.textStyle.fontSize));for(var h=0;h<t.length;h++){var l,c,f=t[h],d=null!=(c=null==i||null==(l=i.measureText(f))?void 0:l.width)?c:0;u+=n,o===Qt.display?"\n"===f?(a++,u=0):(u+=d,this.maxLineWidth=Math.max(this.maxLineWidth,u)):((u+d>s&&h>0||"\n"===f)&&(a++,this.maxLineWidth=Math.max(this.maxLineWidth,u),u=0),"\n"!==f&&(u+=d))}return a},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){this.textStyle.fontFamily!==t||Q(t)?(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("The font is either the current font or an risky font family.")},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,i=this.textStyle,r=this.textLayout,n=i.fontScale,o=(r.width+i.fontOffset)*n,s=r.lineHeight*this.lineCount,a=i.fontSize*n,u=r.lineHeight*n;i.fontDesc=this.getFontDesc(a),this.char=(this.text||"").split(""),this.canvas.width=o,r.autoWidth?(this.canvas.height=s*n,this.item.transform.size.set(1,s/r.height)):this.canvas.height=r.height*n;var h=this.canvas.height;e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),this.maxLineWidth>o&&r.overflow===Qt.display?e.font=this.getFontDesc(a*o/this.maxLineWidth):e.font=i.fontDesc,e.clearRect(0,0,o,h),i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var l=[],c=0,f=r.getOffsetY(i,this.lineCount,u,a),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((c+=r.letterSpace*n)+y.width>o&&m>0||"\n"===v)&&(l.push({y:f,width:c,chars:d,charOffsetX:p}),c=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(c),c+=y.width)}l.push({y:f,width:c,chars:d,charOffsetX:p}),l.forEach((function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach((function(r,o){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[o],t.y),e.fillText(r,n+t.charOffsetX[o],t.y)}))})),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=yr.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:Ui.LINEAR,minFilter:Ui.LINEAR,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE});this.disposeTextTexture(),this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.disposeTextTexture=function(){var t=this.renderer.texture;t&&t!==this.engine.whiteTexture&&t.dispose()},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontScale,n=e.fontFamily,o=e.textWeight,s=e.fontStyle,a=(t||i*r).toString()+"px ";return bh.includes(n)?a+=n:a+='"'+n+'"',o!==ee.normal&&(a=o+" "+a),s!==ie.normal&&(a=s+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],o=i[1],s=i[2],a=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*o+", "+255*s+", "+a+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,o=e.shadowOffsetY,s=i[0],a=i[1],u=i[2],h=i[3];t&&(t.shadowColor="rgba("+255*s+", "+255*a+", "+255*u+", "+h+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-o)},t}();pt(exports.TextComponent,[Eh]);var Sh=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt),_h=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Re);exports.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Re),u([we()],exports.BinaryAsset.prototype,"buffer",void 0),exports.BinaryAsset=u([Ae(pe.BinaryAsset)],exports.BinaryAsset);var Ch=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=Me(e);if(r)for(var n,s=o(Object.keys(r));!(n=s()).done;){var a=n.value,u=e[a];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(u)?i[a]=u:ot(u)?(i[a]||(i[a]=[]),t.serializeArrayProperty(u,i[a],0)):Re.is(u)?i[a]={id:u.getInstanceId()}:at(u)&&(i[a]||(i[a]={}),t.serializeObjectProperty(u,i[a],0))}for(var h,l=o(Object.keys(e.defination));!(h=l()).done;){var c=h.value,f=e.defination[c];"number"==typeof f||"string"==typeof f||"boolean"==typeof f||t.checkTypedArray(f)?i[c]=f:ot(f)?(i[c]||(i[c]=[]),t.serializeArrayProperty(f,i[c],0)):Re.is(f)?i[c]={id:f.getInstanceId()}:at(f)&&(i[c]||(i[c]={}),t.serializeObjectProperty(f,i[c],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=Me(i),n=i.engine;if(r)for(var s,a=o(Object.keys(r));!(s=a()).done;){var u=s.value,h=e[u];if(void 0!==h){var l=r[u].type;i[u]=t.deserializeProperty(h,n,0,l)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return s(t,Int8Array)||s(t,Uint8Array)||s(t,Uint8ClampedArray)||s(t,Int16Array)||s(t,Uint16Array)||s(t,Int32Array)||s(t,Uint32Array)||s(t,Float32Array)||s(t,Float64Array)||s(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(at(t)&&1===Object.keys(t).length&&"id"in t&&nt(t.id))},t.checkGLTFNode=function(t){return at(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return ht(t)||s(t,e.HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,s){if(void 0===s&&(s=!0),!(r>14)){if(ot(e)){for(var a,u=[],h=o(e);!(a=h()).done;){var l=a.value;u.push(t.deserializeProperty(l,i,r+1,n,s))}return u}if(t.checkDataPath(e)){var c=i.findObject(e);return s?c:e}if(ut(e)){var f;f=n?new n:{};for(var d,p=o(Object.keys(e));!(d=p()).done;){var m=d.value;f[m]=t.deserializeProperty(e[m],i,r+1,void 0,s)}return f}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.serializeObjectProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i={});for(var n,s=o(Object.keys(e));!(n=s()).done;){var a=n.value,u=e[a];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(e)?i[a]=u:ot(u)?(i[a]||(i[a]=[]),t.serializeArrayProperty(u,i[a],r+1)):Re.is(u)?i[a]={id:u.getInstanceId()}:at(u)&&(i[a]||(i[a]={}),t.serializeObjectProperty(u,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.");else{i||(i=[]);for(var n=0;n<e.length;n++){var o=e[n];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[n]=o:ot(o)?(i[n]||(i[n]=[]),t.serializeArrayProperty(o,i[n],r+1)):Re.is(o)?i[n]={id:o.getInstanceId()}:at(o)&&(i[n]||(i[n]={}),t.serializeObjectProperty(o,i[n],r+1))}}},t}(),Ah=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(r){switch(r.dataType){case pe.Material:e=Nr.create(this.engine);break;case pe.Geometry:e=Zr.create(this.engine);break;case pe.Texture:e=yr.create(this.engine);break;default:var n=Ce(r.dataType);n&&(e=new n(this.engine))}if(e)return e.setInstanceId(r.id),this.engine.addInstance(e),Ch.deserialize(r,e),e;console.error("Constructor for DataType: "+r.dataType+" not found.")}else console.error("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),wh=function(){function t(){}return t.prototype.loadGUID=function(t){return r((function(){return h(this,(function(t){return[2,void 0]}))}))()},t}();function Mh(t,e){if(!t.includes(e))return t.push(e),!0}function Rh(t){if(Number.isFinite(t))return[Ut.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===Ut.CONSTANT)return[Ut.CONSTANT,t[1]];if("lines"===e)return[Ut.LINE,t[1]];if(e===Ut.LINE){var r=i.map((function(t){return[Bt.LINE,t]}));return[Ut.BEZIER_CURVE,r]}return"curve"===e||e===Ut.CURVE?[Ut.BEZIER_CURVE,Kh(i)]:t}}function Ih(t,e){return Array.isArray(t)&&"random"===t[0]?[Ut.CONSTANT,t[1][e]]:Rh(t)}function Ph(t){return t&&"color"===t[0]?Lh(t[1],!0):[1,1,1,1]}function Oh(t,e){if(t)return"colors"===t[0]?[Ut.COLORS,t[1].map((function(t){return Lh(t,e)}))]:"gradient"===t[0]?Fh(t[1],e):"color"===t[0]?[Ut.RGBA_COLOR,Lh(t[1],e)]:t}function Nh(t){return t&&"random"===t[0]?[Ut.RANDOM,t[1]]:Rh(t)}function Fh(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach((function(r){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(r),o=Lh(t[r],e);i.push([n,o[0],o[1],o[2],o[3]])})),i=i.sort((function(t,e){return t[0]-e[0]})),[Ut.GRADIENT_COLOR,i]}}function Lh(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else s(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=Vh(i)),i}function Vh(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Dh(t,e){return Array.isArray(t)?t[0]===Ut.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Fh(t[1],e):Fh(t,e)}function kh(t){if(t){if(3===t.length)return[Ut.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===Ut.BEZIER_PATH||e===Ut.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],o=i[2],s=Kh(r);if(!o){o=[];for(var a=0;a<n.length;a++){var u=n[a].slice();0===a?o.push(u):a<n.length-1?(o.push(u),o.push(u)):o.push(u)}}return[Ut.BEZIER_CURVE_PATH,[s,n,o]]}return t}}function zh(t){for(var e,i=o(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function Uh(t){for(var e,i=o(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var Bh,Gh=Math.cos,jh=Math.sin,Xh=Math.PI/180,Hh=180/Math.PI;function Wh(t,e){return t?[t[0]-.5,.5-t[1]]:e?Zh[e]:[0,0]}var Yh,Zh=((Bh={})[Nt.PARTICLE_ORIGIN_CENTER]=[0,0],Bh[Nt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Bh[Nt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Bh[Nt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Bh[Nt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Bh[Nt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Bh[Nt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Bh[Nt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Bh[Nt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Bh);function qh(t,e,i,r){var n=i[0],o=i[1],s=r[0],a=s-n;return[[n+(s-n)/3,o+(t*=a)/3],[s-(s-n)/3,r[1]-(e*=a)/3]]}function Kh(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],o=0;o<t.length-1;o++){var s=t[o][3]*(e-i),a=t[o+1][2]*(e-i),u=[t[o][0],t[o][1]],h=[t[o+1][0],t[o+1][1]];if(u[0]!=h[0]){var l=qh(s,a,u,h),c=l[0],f=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map((function(t,e){return 0===e?[Bt.EASE_OUT,t]:e===n.length-1?[Bt.EASE_IN,t]:[Bt.EASE,t]}))}function Qh(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===Pt.null&&t.endBehavior===Gt.destroy&&(t.endBehavior=Gt.freeze)}))})),t.version=Et["2_1"],t}var Jh=new Map,$h=new Map;function tl(t){for(var e,i=o(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===pe.ShapeComponent){var n=r;if(n.type===ue.Custom){var s,a=n;(null==(s=a.shapes)?void 0:s.length)>0&&a.shapes[0].fill&&(a.fill=a.shapes[0].fill);for(var u,h=new Array(a.easingIns.length),l=new Array(a.easingOuts.length).fill(!1),c=o(a.shapes);!(u=c()).done;)for(var f,d=o(u.value.indexes);!(f=d()).done;){var p=f.value,m=a.points[p.point],v=a.easingIns[p.easingIn],y=a.easingOuts[p.easingOut];h[p.easingIn]||(v.x-=m.x,v.y-=m.y,h[p.easingIn]=!0),l[p.easingOut]||(y.x-=m.x,y.y-=m.y,l[p.easingOut]=!0)}}}}return t.version=Et["3_2"],t}function el(t){Jh.clear(),$h.clear();for(var e,i=t.compositions,r=t.items,n=o(t.components);!(e=n()).done;){var s=e.value;Jh.set(s.id,s)}for(var a,u=o(r);!(a=u()).done;){var h=a.value;$h.set(h.id,h)}for(var l,c=o(i);!(l=c()).done;){sl(l.value)}return t.version=Et["3_3"],t}function il(t){var e;null==(e=t.plugins)||e.forEach((function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")}));for(var i,r=o(t.items);!(i=r()).done;){var n=i.value;if(n.type===Pt.sprite){var s=Jh.get(n.components[0].id);if(s){var a,u=s.renderer.shape,h=void 0;if(Number.isInteger(u))h=null==(a=t.shapes)?void 0:a[u];else h=u;s.renderer.shape=h}}}for(var l,c=t.compositionId,f={},d=o(t.compositions);!(l=d()).done;){var p=l.value,m=ft();f[p.id]=m,p.id===c&&(t.compositionId=m),p.id=m;var v={id:ft(),dataType:"CompositionComponent",items:p.items,timelineAsset:p.timelineAsset,sceneBindings:p.sceneBindings,item:{id:p.id}};p.timelineAsset=void 0,p.sceneBindings=void 0,p.components=[{id:v.id}],t.components.push(v)}for(var y,g=o(t.items);!(y=g()).done;){var x=y.value;if(x.content){var b=x.content.options;b&&void 0!==b.refId&&(b.refId=f[b.refId])}}return t.version=Et["3_4"],t}function rl(t){for(var e,i={},r=o(t.components);!(e=r()).done;){var n=e.value;i[n.id]=n}for(var s,a=o(t.compositions);!(s=a()).done;)for(var u,h=s.value,l=o(h.components);!(u=l()).done;){i[u.value.id].item.id=h.id}for(var c,f=o(t.components);!(c=f()).done;){var d=c.value;if(d.dataType===pe.SpriteComponent){var p=d,m=p.renderer.shape;if(!(null==m||"aPoint"in m&&"index"in m)){var v=ol(m);p.geometry={id:v.id},t.geometries.push(v)}}if(d.dataType===pe.ShapeComponent){var y=d;if(y.fills=[],y.fill){var g={type:se.Solid,color:y.fill.color};y.fills.push(g)}if(delete y.fill,y.strokes=[],y.stroke){var x={type:se.Solid,color:y.stroke.color};y.strokes.push(x),y.strokeWidth=y.stroke.width,y.strokeCap=y.stroke.cap,y.strokeJoin=y.stroke.join,delete y.stroke}}}return t.version="3.5",t}function nl(t){if(t.components)for(var e,i=o(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===pe.RichTextComponent){var n=r;n.options&&void 0===n.options.useLegacyRichText&&(void 0===n.options.lineGap?n.options.useLegacyRichText=!0:n.options.useLegacyRichText=!1)}}return t.version="3.6",t}function ol(t,e){void 0===e&&(e="形状");for(var i=Ta(t),r=i.index,n=void 0===r?[]:r,o=i.aPoint,s=void 0===o?[]:o,a=new Float32Array(s),u=[],h=[],l=0;l<a.length;l+=6)h.push(s[l+2],s[l+3]),u.push(a[l],a[l+1],0);var c=u.length/3,f=n.length,d=4*u.length,p=d+4*h.length,m=2*n.length,v={mode:me.TRIANGLES,vertexData:{vertexCount:c,channels:[]},name:e,indexFormat:ye.UInt16,indexOffset:p,buffer:"",id:ft(),dataType:pe.Geometry,subMeshes:[]};v.vertexData.channels.push({semantic:ge.Position,offset:0,format:ve.Float32,dimension:3}),v.vertexData.channels.push({semantic:ge.Uv,offset:d,format:ve.Float32,dimension:2}),v.subMeshes.push({offset:0,indexCount:f,vertexCount:c});var y=new ArrayBuffer(p+m+(m%4==0?0:2)),g=new Float32Array(y);g.set(u,0),g.set(h,u.length),new Uint16Array(y,p).set(n,0);var x=new Uint8Array(y).slice(0,p+m);return v.binaryData=x,v}function sl(t){for(var e,i=o(t.items);!(e=i()).done;){var r=e.value,n=$h.get(r.id);if(!n)return;if(n.type===Pt.sprite||n.type===Pt.particle||n.type===Pt.spine||n.type===Pt.text||n.type===Pt.richtext||n.type===Pt.video||n.type===Pt.shape){var s=Jh.get(n.components[0].id);s&&al(s)}}}function al(t){var e=t.renderer,i=null==e?void 0:e.maskMode;i&&i!==exports.MaskMode.NONE&&(i===exports.MaskMode.MASK?(t.mask={isMask:!0},Yh=t.id):i!==At.OBSCURED&&i!==At.REVERSE_OBSCURED||(t.mask={inverted:i===At.REVERSE_OBSCURED,reference:{id:Yh}}))}function ul(t){for(var e,i,r,n=function(){var t=h.value;t.endBehavior!==ne&&t.endBehavior!==re||(t.endBehavior=Gt.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===Pt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,i=o(t.items);!(e=i()).done;){var r=e.value;l[r.id]=ft(),r.oldId=r.id,r.id=l[r.id],c[r.id]=r}t.items.forEach((function(e,i){if(e.parentId)if(e.parentId.includes("^")){var r=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=l[r]+"^"+n}else e.parentId=l[e.parentId];s.items.push(e),t.items[i]={id:e.id}}));var n=Xe({},t,{timelineAsset:{id:""},sceneBindings:[]});s.compositions.push(n),function(t,e,i){for(var r,n=[],s=[],a=[],u={tracks:[],id:ft(),dataType:"TimelineAsset"},h=o(t.items);!(r=h()).done;){var l=e[r.value.id],c=[],f={id:ft(),dataType:"ActivationPlayableAsset"};a.push(f);var d={id:ft(),dataType:"ActivationTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:f.id}}]};if(c.push({id:d.id}),s.push(d),l.type!==Pt.particle){var p={id:ft(),dataType:"TransformPlayableAsset",sizeOverLifetime:l.content.sizeOverLifetime,rotationOverLifetime:l.content.rotationOverLifetime,positionOverLifetime:l.content.positionOverLifetime};a.push(p);var m={id:ft(),dataType:"TransformTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:p.id}}]};c.push({id:m.id}),s.push(m)}if(l.type===Pt.sprite||l.type===Pt.text){var v={id:ft(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:l.content.colorOverLifetime};a.push(v);var y={id:ft(),dataType:"SpriteColorTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:v.id}}]};c.push({id:y.id}),s.push(y)}if(l.type===Pt.composition){var g={id:ft(),dataType:"SubCompositionPlayableAsset"};a.push(g);var x={id:ft(),dataType:"SubCompositionTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:g.id}}]};c.push({id:x.id}),s.push(x)}var b={id:ft(),dataType:"ObjectBindingTrack",children:c,clips:[]};s.push(b),u.tracks.push({id:b.id}),n.push({key:{id:b.id},value:{id:l.id}})}for(var T,E=[],S=o(s);!(T=S()).done;){var _=T.value;E.push({id:_.id})}t.timelineAsset={id:u.id},t.sceneBindings=n,i.miscs.push(u);for(var C,A=o(s);!(C=A()).done;){var w=C.value;i.miscs.push(w)}for(var M,R=o(a);!(M=R()).done;){var I=M.value;i.miscs.push(I)}}(n,c,s)},s=Xe({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),a=o(s.images);!(i=a()).done;){i.value.id=ft()}if(null!=(e=s).textures||(e.textures=[]),s.textures.forEach((function(t){var e;t.id=ft(),t.dataType=pe.Texture,t.source={id:null==(e=s.images[t.source])?void 0:e.id}})),s.textures.length<s.images.length)for(var u=s.textures.length;u<s.images.length;u++)s.textures.push({id:ft(),dataType:pe.Texture,source:{id:s.images[u].id},flipY:!0});t.bins&&(r=t.bins,s.bins=r.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:ft()}})));for(var h,l={},c={},f=o(t.compositions);!(h=f()).done;)n();for(var d,p=o(s.items);!(d=p()).done;){var m=d.value;if(m.content){if(m.content.renderer&&void 0!==m.content.renderer.texture){var v=m.content.renderer.texture;m.content.renderer.texture={id:s.textures[v].id}}if(m.content.trails&&void 0!==m.content.trails.texture){var y=m.content.trails.texture;m.content.trails.texture={id:s.textures[y].id}}}if(m.transform){var g,x,b,T=[].concat(null!=(g=m.transform.position)?g:[0,0,0]),E=[].concat(null!=(x=m.transform.rotation)?x:[0,0,0]),S=[].concat(null!=(b=m.transform.scale)?b:[1,1,1]);if(Object.assign(m,{transform:{position:{x:T[0],y:T[1],z:T[2]},eulerHint:{x:E[0],y:E[1],z:E[2]},scale:{x:S[0],y:S[1],z:S[0]}}}),m.type===Pt.sprite&&(m.transform.size={x:S[0],y:S[1]},m.transform.scale={x:1,y:1,z:1}),m.type===Pt.sprite){var _=m.content;_.renderer||(_.renderer={});var C,A,w,M,R=_.renderer,I=Wh(R.anchor,R.particleOrigin),P=m.transform.size;if(!R.anchor&&void 0!==R.particleOrigin)m.transform.position.x+=-I[0]*(null!=(C=null==P?void 0:P.x)?C:1),m.transform.position.y+=-I[1]*(null!=(A=null==P?void 0:P.y)?A:1);m.transform.anchor={x:I[0]*(null!=(w=null==P?void 0:P.x)?w:1),y:I[1]*(null!=(M=null==P?void 0:P.y)?M:1)}}}if(m.type===Pt.particle){var O=m.content;O.renderer||(O.renderer={});var N=O.renderer;O.renderer.anchor=Wh(N.anchor,N.particleOrigin)}if(m.type===Pt.camera&&m.content.positionOverLifetime&&0!==Object.keys(m.content.positionOverLifetime).length&&(m.content.positionOverLifetime.asMovement=!0),void 0!==m.pn){var F=m.pn,L=t.plugins,V=void 0===L?[]:L;void 0!==F&&Number.isInteger(F)&&(m.pluginName=V[F])}switch("editor-gizmo"===m.pluginName&&(m.type="editor-gizmo"),"orientation-transformer"===m.pluginName&&(m.type="orientation-transformer"),m.content.options.target&&"editor-gizmo"===m.pluginName&&(m.content.options.target=l[m.content.options.target]),m.type===Pt.spine&&t.spines&&0!==t.spines.length&&ll(t.spines[m.content.options.spine],m.content,s),m.type!==Pt.sprite&&m.type!==Pt.particle&&m.type!==Pt.mesh&&m.type!==Pt.skybox&&m.type!==Pt.light&&"camera"!==m.type&&m.type!==Pt.tree&&m.type!==Pt.interact&&m.type!==Pt.camera&&m.type!==Pt.text&&m.type!==Pt.spine&&"editor-gizmo"!==m.type&&"orientation-transformer"!==m.type||(m.components=[],s.components.push(m.content),m.content.id=ft(),m.content.item={id:m.id},m.dataType=pe.VFXItemData,m.components.push({id:m.content.id})),m.type!==Pt.null&&m.type!==Pt.composition||(m.components=[],m.dataType=pe.VFXItemData),m.type){case Pt.sprite:m.content.dataType=pe.SpriteComponent;break;case Pt.particle:m.content.dataType=pe.ParticleSystem;break;case Pt.mesh:m.content.dataType=pe.MeshComponent;break;case Pt.skybox:m.content.dataType=pe.SkyboxComponent;break;case Pt.light:m.content.dataType=pe.LightComponent;break;case"camera":m.content.dataType=pe.CameraComponent;break;case"editor-gizmo":m.content.dataType="GizmoComponent";break;case"orientation-transformer":m.content.dataType="OrientationComponent";break;case Pt.tree:m.content.dataType=pe.TreeComponent;break;case Pt.interact:m.content.dataType=pe.InteractComponent;break;case Pt.camera:m.content.dataType=pe.CameraController;break;case Pt.text:m.content.dataType=pe.TextComponent;break;case Pt.spine:m.content.dataType=pe.SpineComponent}}return s.version=Et["3_0"],s}function hl(t){if(t)for(var e,i=o(Object.keys(t));!(e=i()).done;){var r=e.value,n=t[r],s=Array.isArray(n);s&&2===n.length&&Array.isArray(n[1])?t[r]="path"===r?kh(n):Rh(n):s||"object"!=typeof n||hl(n)}}function ll(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}}))}}function cl(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},o={path:kh(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:Rh(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:Rh(n.linearX),linearY:Rh(n.linearY),linearZ:Rh(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Rh(n.orbitalX),orbitalY:Rh(n.orbitalY),orbitalZ:Rh(n.orbitalZ),speedOverLifetime:Rh(n.speedOverLifetime)};Uh(o);var s={options:{startColor:Ph(r.startColor)},positionOverLifetime:o};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var a=t.rotationOverLifetime;if(a){var u=s.rotationOverLifetime={separateAxes:a.separateAxes,asRotation:a.asRotation};u.separateAxes?(u.x=Rh(a.x),u.y=Rh(a.y),u.z=Rh(a.z)):u.z=Rh(a.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=s.colorOverLifetime={opacity:Rh(h.opacity)};h.color&&(l.color=Dh(h.color))}var c=t.sizeOverLifetime;return c&&(s.sizeOverLifetime={separateAxes:c.separateAxes,size:Rh(c.size),x:Rh(c.x),y:Rh(c.y),z:Rh(c.z)}),s}var fl="2.7.2",dl=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,pl=/^(\d+)\.(\d+)$/,ml=!1;function vl(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e,i;(function(t){var e=t.playerVersion||{},i=e.web,r=void 0===i?"":i;if(r){var n,o,s=null!=(n=dl.exec(r))?n:[],a=null!=(o=dl.exec(fl))?o:[],u=s[1],h=s[2],l=a[1],c=a[2];return Number(l)<Number(u)||Number(l)===Number(u)&&Number(c)<Number(h)}return!1})(t)&&console.warn("The JSON need higher than "+(null==(e=t.playerVersion)?void 0:e.web)+" runtime version(current: "+fl+"). Some features may not work as expected.");if(function(t){var e,i=null==(e=t.version)?void 0:e.split(".");!i||Number(i[0])>2||2===Number(i[0])&&Number(i[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==Pt.mesh&&t.type!==Pt.light||(t.endBehavior=1===t.endBehavior?Gt.destroy:t.endBehavior)}))}))}(t),dl.test(t.version))return ml="0"===(null==(i=/^(\d+)/.exec(t.version))?void 0:i[0]),nl(rl(il(el(tl(ul(Qh(function(t){var e;yl=Et["1_0"];var i=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(yl=Et["1_3"]);var r,n=(t.requires||[]).slice(),o=t.images.map((function(e,i){return gl(e,i,t.imageTags||[])})),s=t.textures||o.map((function(t,e){return{source:e,flipY:!0}})),a={plugins:i,shapes:t.shapes||[],type:"ge",version:yl,playerVersion:null!=(r=t.playerVersion)?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return xl(t,{plugins:i,requires:n})})),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:s,bins:(t.bins||[]).slice()};t._textures&&(a._textures=t._textures);return a}(t))))))));ml=!1;var r=pl.exec(t.version)||[],n=Number(r[1]),s=Number(r[2]);if(n)return(n<2||2===n&&s<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,i=o(t.items);!(e=i()).done;)hl(e.value.content)})),t}(t)),n<3&&(t=ul(Qh(t))),r=pl.exec(t.version)||[],n=Number(r[1]),s=Number(r[2]),n<4&&(s<2&&(t=tl(t)),s<3&&(t=el(t)),s<4&&(t=il(t)),s<5&&(t=rl(t)),s<6&&(t=nl(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var yl=Et["1_0"];function gl(t,e,i){var r=i[e];if("string"==typeof t)return{id:ft(),renderLevel:r,url:t};if(t.template)return{id:ft(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:ft(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:ft(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function xl(t,e){var i;void 0===e&&(e={});var r={id:t.id+"",camera:Xe({clipMode:oe},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Sl(t,e)})),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var o=null==(i=t.meta)?void 0:i.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(r.previewSize=o),r}var bl,Tl=[0,0,0,1],El=.5;function Sl(t,e){var i;void 0===e&&(e={});var r,n,o,s,a,u,h=Pt.base,l=t.endBehavior,c=NaN;if(t.content?(h=t.type||Pt.plugin,u=t.pn,a=t.pluginName,o=t.content,n=t.content,isNaN(u)&&!a&&(a=o.options.type),t.duration&&(c=t.duration),r=t.transform||y(n.transform)):t.particle?(h=Pt.particle,r=y((n=t.particle).transform,ml,!0),o=function(t){var e=t.options,i=t.transform,r={type:wt.NONE};if(t.shape){var n,o=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=Xe({},t.shape,{type:wt[o]}),t.shape.upDirection){var s=t.shape.upDirection,a=s[0],u=s[1],h=s[2];0===a&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=Nh(e.turbulenceX),r.turbulenceY=Nh(e.turbulenceY),r.turbulenceZ=Nh(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return zh(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return zh(t)}))),l.rateOverTime&&(l.rateOverTime=Nh(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:Nh(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Nh(e.startSize),startSizeX:Nh(e.startSizeX),startSizeY:Nh(e.startSizeY),sizeAspect:Nh(e.sizeAspect),maxCount:e.maxCount,startDelay:Nh(e.startDelay),startColor:Oh(e.startColor,!0),startRotationZ:Nh(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=Nh(e.startRotationX),c.options.startRotationY=Nh(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:kh(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:Nh(f.x),y:Nh(f.y)}:c.sizeOverLifetime={size:Nh(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?Rh(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Rh(e.gravityModifier),startSpeed:Nh(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:Nh(d.linearX),linearY:Nh(d.linearY),linearZ:Nh(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Nh(d.orbitalX),orbitalY:Nh(d.orbitalY),orbitalZ:Nh(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Rh(d.forceCurve)},Uh(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Nh(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=Rh(m.y),c.rotationOverLifetime.x=Rh(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:Rh(v.opacity)};v.color&&(y.color=Dh(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Rh(g.cycles),animationDelay:Ih(g.animationDelay,0),animationDuration:Ih(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:Nh(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Rh(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Dh(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Dh(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:Nh(x.opacityOverLifetime)}),c.trails&&Uh(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(n)):t.sprite?(h=Pt.sprite,o=function(t,e){var i=cl(t,e),r=t.textureSheetAnimation;return r&&(i.textureSheetAnimation={row:r.row,col:r.col,total:r.total||void 0,animate:r.animate}),i.renderer=t.renderer,t.splits&&(i.splits=t.splits),t.interaction&&(i.interaction=t.interaction),i}(n=t.sprite,r=y(n.transform,!1,!0))):t.cal?(h=Pt.null,o=cl(n=t.cal,r=y(n.transform,!1,!0))):t.ui?(h=Pt.interact,r=y((n=t.ui).transform),o=function(t){var e,i=t.options;switch(i.type){case"click":e={type:Rt.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&Ph(i.previewColor),behavior:i.behavior||It.NOTIFY};break;case"drag":e={type:Rt.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:Rt.MESSAGE}}return{options:e}}(n),r.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=Pt.camera,r=y(n.transform),o=function(t){var e,i=t.options,r={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var o,s={path:kh(null==(o=t.transform)?void 0:o.path),linearX:Rh(null==n?void 0:n.translateX),linearY:Rh(null==n?void 0:n.translateY),linearZ:Rh(null==n?void 0:n.translateZ)};Uh(s),r.positionOverLifetime=s}var a=t.rotationOverLifetime;if(a){var u={separateAxes:a.separateAxes,x:Rh(null==a?void 0:a.rotateX),y:Rh(null==a?void 0:a.rotateY),z:a.separateAxes?Rh(null==a?void 0:a.rotateZ):Rh(a.rotation)};Uh(u),r.rotationOverLifetime=u}return r}(n))),null==(i=o.renderer)?void 0:i.anchor){var f=new Float32Array(o.renderer.anchor);f[0]==El&&f[1]==El?delete o.renderer.anchor:e.requires&&Mh(e.requires,"anchor")}if(n){var d,p,m=null==(d=n.options)?void 0:d.looping;if(m)l=Array.isArray(m)?m[1]?Gt.restart:Gt.destroy:Gt.restart;else l=l||(null==n||null==(p=n.options)?void 0:p.endBehavior)||Gt.destroy;n.options.renderLevel&&(s=n.options.renderLevel),isNaN(c)&&(c=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:c,id:t.id+"",transform:r,endBehavior:l,renderLevel:s,content:o};return a?e.plugins?(Mh(e.plugins,a),v.pn=e.plugins.indexOf(a)):v.pluginName=a:Number.isInteger(u)&&(v.pn=u),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,i){if(t){var r={},n=t.rotation;if(n&&(r.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],i)){var o=(s=Tl,a=r.rotation[0],u=r.rotation[1],h=r.rotation[2],l=Gh(a*Xh/2),c=Gh(u*Xh/2),f=Gh(h*Xh/2),d=jh(a*Xh/2),p=jh(u*Xh/2),m=jh(h*Xh/2),s[0]=d*c*f+l*p*m,s[1]=l*p*f-d*c*m,s[2]=l*c*m+d*p*f,s[3]=l*c*f-d*p*m,s);r.rotation=function(t,e){var i,r,n,o=e[0],s=e[1],a=e[2],u=e[3],h=o+o,l=s+s,c=a+a,f=o*h,d=s*h,p=s*l,m=a*c,v=u*c,y=1-p-m,g=d-v,x=d+v,b=1-f-m,T=a*h-u*l,E=a*l+u*h,S=1-f-p;return t[1]=Math.asin((r=-1,(i=-T)>(n=1)?n:i<r?r:i))*Hh,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,S)*Hh,t[2]=Math.atan2(x,y)*Hh):(t[0]=0,t[2]=Math.atan2(-g,b)*Hh),t}([],o)}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}var s,a,u,h,l,c,f,d,p,m;return{}}}var _l,Cl=((bl={})[St.S]=[St.S,St.BPlus,St.APlus],bl[St.A]=[St.A,St.BPlus,St.APlus],bl[St.B]=[St.B,St.BPlus],bl);function Al(t,e){if(!t||!e)return!0;var i=Cl[e];return!!i&&i.includes(t)}function wl(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},o=n.name,s=n.url;return o&&(e&&e[o]?i=e[o]:s&&(i=s)),i}function Ml(t,e,i){return Rl.apply(this,arguments)}function Rl(){return(Rl=r((function(t,i,r){var n,o;return h(this,(function(a){switch(a.label){case 0:return"string"!=typeof t?[3,2]:[4,rr(t)];case 1:return n=a.sent(),[3,3];case 2:n=t,a.label=3;case 3:if(!n)throw new Error("Image not provided.");if(!i)return[2,n];if(o=wl(i,r)){if(nt(o)&&o!==n.src)return[2,rr(o)];if(s(o,e.HTMLImageElement))return[2,o]}return[2,n]}}))}))).apply(this,arguments)}exports.Scene=void 0,(_l=exports.Scene||(exports.Scene={})).isJSONObject=function(t){return at(t)&&"jsonScene"in t},_l.isURL=function(t){return at(t)&&"url"in t},_l.isWithOptions=function(t){return at(t)&&"options"in t};var Il=1,Pl=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Ki),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=Il++,this.timers=[],this.updateOptions(t)}var i=t.prototype;return i.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,i=void 0===e?10:e;this.timeout=i},i.loadScene=function(t,i,n){var o=this;return r((function(){var s,a,u,l,c,f,d,p,m,v,y,g,x;return h(this,(function(b){return a=nt(t)?t:o.id,u=e.performance.now(),l=[],c=null==i?void 0:i.engine.gpuCapability,d=null!=(f=null==c?void 0:c.detail.compressedTexture)?f:exports.COMPRESSED_TEXTURE.NONE,p={},v=!1,y=new Promise((function(t,i){m=e.window.setTimeout((function(){v=!0,o.removeTimer(m);var t=e.performance.now()-u;i(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+l.join(" ")+", url: "+a+"."))}),1e3*o.timeout),o.timers.push(m)})),g=r((function(t,i){var r,n,o,s;return h(this,(function(a){switch(a.label){case 0:if(v)return[3,4];r=e.performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i()];case 2:return n=a.sent(),o=e.performance.now()-r,l.push("["+t+": "+o.toFixed(2)+"]"),p[t]=o,[2,n];case 3:throw s=a.sent(),new Error("Load error in "+t+", "+s+".");case 4:throw new Error("Load canceled.")}}))})),x=r((function(){var i,r,c,f,v,y,x,b,T,E,S,_,C,A;return h(this,(function(h){switch(h.label){case 0:return nt(t)?(r=new e.URL(t,e.location.href).href,o.baseUrl=r,[4,g("loadJSON",(function(){return o.loadJSON(r)}))]):[3,2];case 1:return nt(s=h.sent())&&(s=JSON.parse(s)),[3,3];case 2:s=t,o.baseUrl=e.location.href,h.label=3;case 3:return exports.Scene.isJSONObject(s)?(i=Xe({},s),[3,9]):[3,4];case 4:return[4,g("processJSON",(function(){return o.processJSON(s)}))];case 5:return c=h.sent(),f=c.jsonScene,v=c.pluginSystem,y=f.bins,x=void 0===y?[]:y,b=f.images,T=f.fonts,[4,Promise.all([g("processBins",(function(){return o.processBins(x)})),g("processImages",(function(){return o.processImages(b,d)})),g("plugin:processAssets",(function(){return o.processPluginAssets(f,v,n)})),g("processFontURL",(function(){return o.processFontURL(T)}))])];case 6:return E=h.sent(),S=E[0],_=E[1],[4,g("processTextures",(function(){return o.processTextures(_,S,f)}))];case 7:return C=h.sent(),i={timeInfos:p,url:t,renderLevel:o.options.renderLevel,storage:{},pluginSystem:v,jsonScene:f,bins:S,textureOptions:C,textures:[],images:_,assets:o.assets},[4,g("plugin:prepareResource",(function(){return v.loadResources(i,o.options)}))];case 8:h.sent(),h.label=9;case 9:return A=e.performance.now()-u,it.info("Load asset: totalTime: "+A.toFixed(4)+"ms "+l.join(" ")+", url: "+a+"."),e.window.clearTimeout(m),o.removeTimer(m),i.totalTime=A,i.startTime=u,i.timeInfos=p,[2,i]}}))})),[2,Promise.race([y,x()])]}))}))()},i.getAssets=function(){return this.assets},i.processJSON=function(t){var e=this;return r((function(){var i,r,n;return h(this,(function(o){switch(o.label){case 0:return i=vl(t),r=i.plugins,[4,(n=new xt(void 0===r?[]:r)).processRawJSON(i,e.options)];case 1:return o.sent(),[2,{jsonScene:i,pluginSystem:n}]}}))}))()},i.processBins=function(t){var i=this;return r((function(){var r,n,o;return h(this,(function(a){return r=i.options.renderLevel,n=i.baseUrl,o=t.map((function(o){if(s(o,ArrayBuffer))return o;if(Al(o.renderLevel,r))return i.loadBins(new e.URL(o.url,n).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(o)]}))}))()},i.processFontURL=function(e){var i=this;return r((function(){return h(this,(function(r){return[2,t.loadFontFamily(e,i.baseUrl)]}))}))()},i.processImages=function(t,i){void 0===i&&(i=0);var n=this;return r((function(){var o,a,u,l,c,f,d,p;return h(this,(function(m){switch(m.label){case 0:return o=n.options,a=o.useCompressedTexture,u=o.variables,l=o.disableWebP,c=o.disableAVIF,f=n.baseUrl,d=t.map(r((function(t,r){var o,d,p,m,v,y,g,x,b,T,E,S,_,C,A,w,M,R,I,P,O;return h(this,(function(r){switch(r.label){case 0:if(o=t.url,d=t.webp,p=t.avif,m=new e.URL(o,f).href,v=!l&&d?new e.URL(d,f).href:void 0,y=!c&&p?new e.URL(p,f).href:void 0,g=t.id,!("template"in t))return[3,8];if(x=t.template,!(b=x.background))return[3,7];T=wl(x,u),E=b.type===fe.video,S=b&&E?ur:rr,r.label=1;case 1:return r.trys.push([1,6,,7]),[4,lr(T,S)];case 2:return s(_=r.sent(),e.HTMLVideoElement)?(n.sourceFrom[g]={url:_.src,type:exports.TextureSourceType.video},[2,_]):[3,3];case 3:return b&&Array.isArray(T)&&u&&(u[b.name]=_.src),n.sourceFrom[g]={url:_.src,type:exports.TextureSourceType.image},[4,Ml(_,x,u)];case 4:return[2,r.sent()];case 5:return[3,7];case 6:throw C=r.sent(),new Error("Failed to load. Check the template or if the URL is "+(E?"video":"image")+" type, URL: "+T+", Error: "+(C.message||C)+".");case 7:return[3,9];case 8:if("compressed"in t&&a&&i){if(A=t.compressed,i===exports.COMPRESSED_TEXTURE.ASTC?w=A.astc:i===exports.COMPRESSED_TEXTURE.PVRTC&&(w=A.pvrtc),w)return M=new e.URL(w,f).href,n.sourceFrom[g]={url:M,type:exports.TextureSourceType.compressed},[2,n.loadBins(M)]}else if(s(t,e.HTMLImageElement)||s(t,e.HTMLCanvasElement)||s(t,e.HTMLVideoElement)||s(t,yr))return[2,t];r.label=9;case 9:return y?[4,er(m,y)]:[3,11];case 10:return O=r.sent(),[3,13];case 11:return[4,$i(m,v)];case 12:O=r.sent(),r.label=13;case 13:return I=(R=O).url,P=R.image,n.sourceFrom[g]={url:I,type:exports.TextureSourceType.image},[2,P]}}))}))),[4,Promise.all(d)];case 1:return p=m.sent(),n.assignImagesToAssets(t,p),[2,p]}}))}))()},i.processPluginAssets=function(t,e,i){var n=this;return r((function(){var r,o,s,a,u;return h(this,(function(h){switch(h.label){case 0:return[4,e.processAssets(t,i)];case 1:for(r=h.sent(),o=r.reduce((function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t}),{assets:[],loadedAssets:[]}),s=o.assets,a=o.loadedAssets,u=0;u<s.length;u++)n.assets[s[u].id]=a[u];return[2]}}))}))()},i.processTextures=function(t,i,n){var o=this;return r((function(){var a,u,l;return h(this,(function(c){return u=null!=(a=n.textures)?a:t.map((function(t,e){return{source:e}})),l=u.map(r((function(t,r){var a,u,l,c,f,d;return h(this,(function(h){switch(h.label){case 0:if(s(t,yr))return[2,t];if(!("mipmaps"in t))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,fr(t,i,o.assets,n.bins)];case 2:return[2,h.sent()];case 3:throw a=h.sent(),new Error("Load texture "+r+" fails, error message: "+a+".");case 4:return u=t.source,l=t.id,f="",at(u)?(c=o.assets[u.id],f=u.id,[3,7]):[3,5];case 5:return"string"!=typeof u?[3,7]:[4,rr(dt(u))];case 6:c=h.sent(),h.label=7;case 7:if(c)return d=function(t,i,r){var n={id:r,dataType:pe.Texture};if(s(t,yr))return Xe({},t.source,n);if(s(t,e.HTMLImageElement)||ht(t))return Xe({image:t,sourceType:exports.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR},n);if(s(t,e.HTMLVideoElement))return Xe({sourceType:exports.TextureSourceType.video,video:t,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR},n);if(s(t,ArrayBuffer))return Xe({},Sr(t),{sourceFrom:i},n);if("width"in t&&"height"in t&&"data"in t)return Xe({sourceType:exports.TextureSourceType.data,data:t,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE,minFilter:Ui.NEAREST,magFilter:Ui.NEAREST},n);throw new Error("Invalid texture options.")}(c,o.sourceFrom[f],l),[2,d.sourceType===exports.TextureSourceType.compressed?d:Xe({},d,t)];throw new Error("Invalid texture source: "+u+".")}}))}))),[2,Promise.all(l)]}))}))()},i.loadJSON=function(t){var e=this;return r((function(){return h(this,(function(i){return[2,new Promise((function(i,r){e.downloader.downloadJSON(t,i,(function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)}))}))]}))}))()},i.loadBins=function(t){var e=this;return r((function(){return h(this,(function(i){return[2,new Promise((function(i,r){e.downloader.downloadBinary(t,i,(function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)}))}))]}))}))()},i.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},i.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){this.timers.length&&this.timers.map((function(t){return e.window.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t.loadFontFamily=function(i,n){return void 0===n&&(n=e.location.href),r((function(){var o;return h(this,(function(s){return i?(o=i.map(r((function(i){var r,o,s;return h(this,(function(a){switch(a.label){case 0:if(!i.fontURL||t.fontCache.has(i.fontFamily))return[3,4];Q(i.fontFamily)||console.warn("Risky font family: "+i.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),r=new e.URL(i.fontURL,n).href,[4,(s=new FontFace(null!=(o=i.fontFamily)?o:"","url("+r+")")).load()];case 2:return a.sent(),e.document.fonts.add(s),t.fontCache.add(i.fontFamily),[3,4];case 3:return a.sent(),it.warn("Invalid font family or font source: "+JSON.stringify(i.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(o)]):[2]}))}))()},t}();Pl.fontCache=new Set;var Ol,Nl=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(t.whiteTexture)}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var i=t;return exports.Scene.isURL(t)&&(exports.Scene.isJSONObject(t)||(i=t.url),exports.Scene.isWithOptions(t)&&(e=Xe({},e,t.options))),{source:i,options:e}},e.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===Pt.text||t.type===Pt.richtext){var r=e[t.name];if(!r)return;t.components.forEach((function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==pe.TextComponent&&(null==n?void 0:n.dataType)!==pe.RichTextComponent||(n.options.text=r)}))}}))},e.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++)t.textures[e]=this.engine.findObject({id:t.textureOptions[e].id}),t.textures[e].initialize()},e.prepareAssets=function(t,e){this.engine.clearResources();for(var i,r=o(Object.keys(e));!(i=r()).done;){var n=i.value,s=e[n],a=new _h(this.engine);a.data=s,a.setInstanceId(n)}this.engine.addPackageDatas(t);for(var u,h=o(this.builtinObjects);!(u=h()).done;){var l=u.value;this.engine.addInstance(l)}},e.createShaderVariant=function(){for(var t,e=o(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];s(r,Nr)&&r.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=o(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),Fl=new Int32Array(2),Ll=new Float32Array(Fl.buffer),Vl=new Float64Array(Fl.buffer),Dl=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];!function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(Ol||(Ol={}));var kl=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new e.TextDecoder}var i=t.prototype;return i.clear=function(){this.position_=0},i.bytes=function(){return this.bytes_},i.position=function(){return this.position_},i.setPosition=function(t){this.position_=t},i.capacity=function(){return this.bytes_.length},i.readInt8=function(t){return this.readUint8(t)<<24>>24},i.readUint8=function(t){return this.bytes_[t]},i.readInt16=function(t){return this.readUint16(t)<<16>>16},i.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},i.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},i.readUint32=function(t){return this.readInt32(t)>>>0},i.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},i.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},i.readFloat32=function(t){return Fl[0]=this.readInt32(t),Ll[0]},i.readFloat64=function(t){return Fl[Dl?0:1]=this.readInt32(t),Fl[Dl?1:0]=this.readInt32(t+4),Vl[0]},i.writeInt8=function(t,e){this.bytes_[t]=e},i.writeUint8=function(t,e){this.bytes_[t]=e},i.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},i.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},i.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},i.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},i.writeFloat32=function(t,e){Ll[0]=e,this.writeInt32(t,Fl[0])},i.writeFloat64=function(t,e){Vl[0]=e,this.writeInt32(t,Fl[Dl?0:1]),this.writeInt32(t+4,Fl[Dl?1:0])},i.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},i.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},i.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},i.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===Ol.UTF8_BYTES?r:this.text_decoder_.decode(r)},i.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},i.__indirect=function(t){return t+this.readInt32(t)},i.__vector=function(t){return t+this.readInt32(t)+4},i.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},i.__has_identifier=function(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},i.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},i.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),zl=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=kl.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=1+~(this.bb.capacity()-this.space+i)&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=2*(i+2);this.addInt16(r);var n=0,o=this.space;t:for(e=0;e<this.vtables.length;e++){var s=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(s)){for(var a=2;a<r;a+=2)if(this.bb.readInt16(o+a)!=this.bb.readInt16(s+a))continue t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){var n=e;if(this.prep(this.minalign,8+r),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var o=3;o>=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw new TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){return null==t?0:(e=s(t,Uint8Array)?t:this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector());var e},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null===r)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=kl.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),Ul=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new Bl(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),Bl=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=Ul.createDataVector(t,this.data);return Ul.createFBEffectsObjectData(t,e,i)},t}(),Gl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new Ul).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new jl(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),jl=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=Gl.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Gl.createFBEffectsPackageData(t,e)},t}(),Xl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new Hl(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),Hl=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return Xl.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),Wl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new Yl(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,o,s){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,o),t.addNormalize(e,s),t.endFBVertexChannel(e)},t}(),Yl=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return Wl.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),Zl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new Wl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new ql(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),ql=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=Zl.createChannelsVector(t,t.createObjectOffsetList(this.channels));return Zl.createFBVertexData(t,this.vertexCount,e)},t}(),Kl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new Zl).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new Xl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new Ql(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),Ql=function(){function t(t,e,i,r,n,o,s,a,u,h,l,c){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=[]),void 0===s&&(s=0),void 0===a&&(a=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===l&&(l=null),void 0===c&&(c=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=o,this.mode=s,this.buffer=a,this.binaryData=u,this.boneNames=h,this.rootBoneName=l,this.inverseBindMatrices=c}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=Kl.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),o=null!==this.buffer?t.createString(this.buffer):0,s=Kl.createBinaryDataVector(t,this.binaryData),a=Kl.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=Kl.createInverseBindMatricesVector(t,this.inverseBindMatrices);return Kl.startFBGeometryData(t),Kl.addId(t,e),Kl.addName(t,i),Kl.addVertexData(t,r),Kl.addIndexFormat(t,this.indexFormat),Kl.addIndexOffset(t,this.indexOffset),Kl.addSubMeshes(t,n),Kl.addMode(t,this.mode),Kl.addBuffer(t,o),Kl.addBinaryData(t,s),Kl.addBoneNames(t,a),Kl.addRootBoneName(t,u),Kl.addInverseBindMatrices(t,h),Kl.endFBGeometryData(t)},t}(),Jl=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new zl(1),i=new jl,r=[],n=o(this.exportObjectDatas);!(t=n()).done;){var s=t.value,a=void 0;s.dataType===pe.Geometry&&(a=new Bl("Geometry",this.geometryDataToBinary(s))),a&&r.push(a)}return i.exportObjects=r,Gl.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new kl(t),i=Gl.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var o=n.dataArray(),s=n.dataType();if(o){var a=void 0;s===pe.Geometry&&(a=this.binaryToGeometryData(o)),a&&this.exportObjectDatas.push(a)}}}},e.geometryDataToBinary=function(t){var e=new zl(1),i=new Ql,r=t.indexFormat,n=t.indexOffset,s=t.mode,a=t.id,u=t.vertexData,h=t.boneNames,l=void 0===h?[]:h,c=t.rootBoneName,f=void 0===c?"":c,d=t.inverseBindMatrices,p=void 0===d?[]:d,m=t.binaryData,v=void 0===m?[]:m;i.indexFormat=r,i.indexOffset=n,i.mode=s,i.id=a,i.boneNames=l,i.rootBoneName=f,i.inverseBindMatrices=p,i.binaryData=v;var y=new ql;y.vertexCount=u.vertexCount,y.channels=[];for(var g,x=o(u.channels);!(g=x()).done;){var b=g.value,T=b.semantic,E=b.offset,S=b.format,_=b.dimension,C=b.normalize,A=new Yl(T,E,S,_,C);y.channels.push(A)}i.vertexData=y;for(var w,M=[],R=o(t.subMeshes);!(w=R()).done;){var I=w.value,P=I.offset,O=I.indexCount,N=I.vertexCount,F=new Hl(P,O,N);M.push(F)}return i.subMeshes=M,Gl.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new kl(t),i=Kl.getRootAsFBGeometryData(e),r={vertexCount:0,channels:[]},n=i.vertexData();if(n){r.vertexCount=n.vertexCount();for(var o=0;o<n.channelsLength();o++){var s=n.channels(o);if(s){var a,u={semantic:null!=(a=s.semantic())?a:"",offset:s.offset(),format:s.format(),dimension:s.dimension(),normalize:s.normalize()};r.channels.push(u)}}}for(var h=[],l=0;l<i.subMeshesLength();l++){var c=i.subMeshes(l);if(c){var f={offset:c.offset(),vertexCount:c.vertexCount(),indexCount:c.indexCount()};h.push(f)}}for(var d=[],p=0;p<i.boneNamesLength();p++){var m=i.boneNames(p);d.push(m)}var v,y,g,x,b=i.inverseBindMatricesArray();return{vertexData:r,indexFormat:i.indexFormat(),indexOffset:i.indexOffset(),subMeshes:h,mode:i.mode(),buffer:null!=(v=i.buffer())?v:"",boneNames:d,rootBoneName:null!=(y=i.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=i.binaryDataArray())?g:void 0,id:null!=(x=i.id())?x:"",dataType:pe.Geometry}},t}(),$l=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 Ah(this),this.whiteTexture=br(this),this.transparentTexture=Tr(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.findObject=function(t){return ut(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=void 0===r?[]:r,s=i.items,a=void 0===s?[]:s,u=i.materials,h=void 0===u?[]:u,l=i.shaders,c=void 0===l?[]:l,f=i.geometries,d=void 0===f?[]:f,p=i.components,m=void 0===p?[]:p,v=i.animations,y=void 0===v?[]:v,g=i.bins,x=void 0===g?[]:g,b=i.miscs,T=void 0===b?[]:b,E=o(i.compositions);!(e=E()).done;){var S=e.value;this.addEffectsObjectData(S)}for(var _,C=o(a);!(_=C()).done;){var A=_.value;Al(A.renderLevel,t.renderLevel)||(A.components=[],A.type=Pt.null),this.addEffectsObjectData(A)}for(var w,M=o(h);!(w=M()).done;){var R=w.value;this.addEffectsObjectData(R)}for(var I,P=o(c);!(I=P()).done;){var O=I.value;this.addEffectsObjectData(O)}for(var N,F=o(d);!(N=F()).done;){var L=N.value;this.addEffectsObjectData(L)}for(var V,D=o(m);!(V=D()).done;){var k=V.value;this.addEffectsObjectData(k)}for(var z,U=o(y);!(z=U()).done;){var B=z.value;this.addEffectsObjectData(B)}for(var G,j=o(T);!(G=j()).done;){var X=G.value;this.addEffectsObjectData(X)}for(var H=0;H<x.length;H++){var W=x[H],Y=t.bins[H];if(W.dataType===pe.BinaryAsset)W.buffer=Y,W.id&&this.addEffectsObjectData(W);else{var Z=new Jl;Z.deserializeFromBinary(new Uint8Array(Y));for(var q,K=o(Z.exportObjectDatas);!(q=K()).done;){var Q=q.value;this.addEffectsObjectData(Q)}}}for(var J,$=o(n);!(J=$()).done;){var tt=J.value;this.addEffectsObjectData(tt)}},e.createVFXItems=function(t){var e=this;return r((function(){var i,r,n,s,a;return h(this,(function(u){for(i=t.jsonScene,r=o(i.items);!(n=r()).done;)s=n.value,"ECS"!==(a=s.type)&&"camera"!==a&&a!==Pt.sprite&&a!==Pt.particle&&a!==Pt.mesh&&a!==Pt.skybox&&a!==Pt.light&&a!==Pt.tree&&a!==Pt.interact&&a!==Pt.camera||e.database&&e.assetLoader.loadGUID(s);return[2]}))}))()},e.addTexture=function(t){this.destroyed||v(this.textures,t)},e.removeTexture=function(t){this.destroyed||y(this.textures,t)},e.addMaterial=function(t){this.destroyed||v(this.materials,t)},e.removeMaterial=function(t){this.destroyed||y(this.materials,t)},e.addGeometry=function(t){this.destroyed||v(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||y(this.geometries,t)},e.addMesh=function(t){this.destroyed||v(this.meshes,t)},e.removeMesh=function(t){this.destroyed||y(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||v(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||y(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&&it.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}},wi(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),tc=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var i=t.prototype;return i.getFPS=function(){return this.targetFPS},i.setFPS=function(t){this.targetFPS=C(t,1,120),this.interval=Math.floor(1e3/t)-2},i.getPaused=function(){return this.paused},i.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=e.performance.now();var i=e.requestAnimationFrame||function(t){return e.window.setTimeout(t,16.7)},r=function(){t.intervalId=i(r),t.paused||t.tick()};r()}},i.stop=function(){(e.cancelAnimationFrame||e.window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},i.pause=function(){this.paused=!0,this.dt=0},i.resume=function(){this.paused=!1,this.dt=0},i.tick=function(){if(!this.paused){var t=e.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 i=0,r=this.tickers.length;i<r;i++){var n=this.tickers[i];n(this.dt)}}}},i.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},wi(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();gt("camera",us,exports.VFXItem),gt("text",Sh,exports.VFXItem),gt("sprite",Ts,exports.VFXItem),gt("particle",Hu,exports.VFXItem),gt("cal",Wu,exports.VFXItem),gt("interact",ms,exports.VFXItem);var ec;it.info("Core version: 2.7.2.");var ic,rc=((ec={})[Ui.RGBA]=34842,ec[Ui.RGB]=34843,ec[Ui.ALPHA]=33325,ec[Ui.RED]=33325,ec[Ui.LUMINANCE_ALPHA]=33327,ec[Ui.LUMINANCE]=33325,ec),nc=((ic={})[Ui.RGBA]=34836,ic[Ui.RGB]=34837,ic[Ui.ALPHA]=33326,ic[Ui.RED]=33326,ic[Ui.LUMINANCE_ALPHA]=33328,ic[Ui.LUMINANCE]=33326,ic),oc=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.bind=function(t){this.engine.bindTexture(this.target,this.textureBuffer,t)},i.initialize=function(){if(!this.initialized){this.engine.addTexture(this);var t=this.engine.gl,e=this.source,i=e.target,r=void 0===i?t.TEXTURE_2D:i,n=e.name;this.textureBuffer=t.createTexture(),lc(this.textureBuffer,n),this.target=r,this.update(this.source),this.release(),this.initialized=!0}},i.clone=function(){var t=new e(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},i.release=function(){switch(this.source.sourceType){case exports.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case exports.TextureSourceType.data:delete this.source.data;break;case exports.TextureSourceType.compressed:case exports.TextureSourceType.mipmaps:delete this.source.mipmaps}},i.update=function(t){var e=this;if(!this.engine||!this.textureBuffer)return this.width=0,void(this.height=0);var i,r,n=this.target,o=this.source,s=this.engine.gl,a=this.engine.gpuCapability.detail,u=o.sourceType,h=o.data,l=o.cube,c=o.image,f=o.video,d=o.mipmaps,p=o.mipmaps,m=t.data,v=t.cube,y=t.generateMipmap,g=t.mipmaps,x=o.format,b=o.type,T=o.internalFormat,E=0,S=0;if(this.bind(u===exports.TextureSourceType.video),b===Ui.HALF_FLOAT?((b=a.halfFloatTexture)||it.error("Half float texture is not support."),ji(s)&&T===x&&(x===Ui.LUMINANCE&&(x=Ui.RED),T=rc[x]),a.halfFloatLinear||(o.minFilter=o.magFilter=s.NEAREST,it.warn("Half float linear not support, change to NEAREST."))):b===s.FLOAT&&((b=a.floatTexture)||it.error("Float texture is not support."),ji(s)&&T===x&&(x===Ui.LUMINANCE&&(x=Ui.RED),T=nc[x]),a.floatLinear||(o.minFilter=s.NEAREST,o.magFilter=s.NEAREST,it.warn("Float linear not support, change to NEAREST."))),void 0===o.premultiplyAlpha&&(o.premultiplyAlpha=!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),void 0===o.flipY&&(o.flipY=!1),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,o.flipY),u===exports.TextureSourceType.framebuffer)m&&(E=null!=(i=m.width)?i:0,S=null!=(r=m.height)?r:0,E&&S&&(this.width!==E||this.height!==S)&&s.texImage2D(n,0,T,E,S,0,x,b,null));else if(u===exports.TextureSourceType.data){var _;if(n===s.TEXTURE_CUBE_MAP)v.forEach((function(t,i){var r=e.texImage2DData(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,x,b,t),n=r[0],o=r[1];E=Math.max(n,E),S=Math.max(o,S)}));else _=this.texImage2DData(s,n,0,T,x,b,h),E=_[0],S=_[1]}else if(u===exports.TextureSourceType.image||u===exports.TextureSourceType.video){if(n===s.TEXTURE_CUBE_MAP)l.forEach((function(t,i){var r=e.texImage2D(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,x,b,t),n=r[0],o=r[1];E=Math.max(n,E),S=Math.max(o,S)}));else if(n===s.TEXTURE_2D){var C,A=null!=c?c:f;C=this.texImage2D(s,n,0,T,x,b,A),E=C[0],S=C[1]}y&&(sc(E)&&sc(S)||ji(s))&&s.generateMipmap(n)}else if(u===exports.TextureSourceType.mipmaps){var w;n===s.TEXTURE_2D?d.forEach((function(t,i){var r;(w="data"in t?e.texImage2DData(s,n,i,T,x,b,t):e.texImage2D(s,n,i,T,x,b,t),0===i)&&(E=(r=w)[0],S=r[1])})):n===s.TEXTURE_CUBE_MAP&&p.forEach((function(t,i){t.forEach((function(t,r){var n;(w="data"in t?e.texImage2DData(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,T,x,b,t):e.texImage2D(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,T,x,b,t),0===i)&&(E=(n=w)[0],S=n[1])}))}))}else u===exports.TextureSourceType.compressed&&g&&0!==g.length&&(E=g[0].width,S=g[0].height,g.forEach((function(t,e){s.compressedTexImage2D(n,e,T,t.width,t.height,0,t.data)})));this.width=E,this.height=S,this.setTextureFilters(s,n,o)},i.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=void 0===r?4:r,o=i.wrapS,s=void 0===o?t.CLAMP_TO_EDGE:o,a=i.wrapT,u=void 0===a?t.CLAMP_TO_EDGE:a,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var l=ji(t)||sc(this.width)&&sc(this.height),c=i.magFilter?i.magFilter:t.NEAREST,f=i.minFilter?i.minFilter:t.NEAREST;l||f!==t.LINEAR_MIPMAP_LINEAR&&f!==t.LINEAR_MIPMAP_NEAREST&&f!==t.NEAREST_MIPMAP_LINEAR&&f!==t.NEAREST_MIPMAP_NEAREST||(f=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,f),t.texParameteri(e,t.TEXTURE_MAG_FILTER,c),t.texParameteri(e,t.TEXTURE_WRAP_S,l?s:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,l?u:t.CLAMP_TO_EDGE)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e,r=this.assembleOptions(i),n=r.sourceType,o=r.sourceFrom,s=r.name,a=void 0===s?"":s;this.source=r,this.sourceType=n,this.sourceFrom=o,this.name=a},i.texImage2D=function(t,e,i,r,n,o,s){var a,u=this,h=this.source,l=h.sourceType,c=h.minFilter,f=h.magFilter,d=h.wrapS,p=h.wrapT,m=null!=(a=this.engine.gpuCapability.detail.maxTextureSize)?a:2048,v=s;if(l!==exports.TextureSourceType.video){var y=c!==t.NEAREST||f!==t.NEAREST||d!==t.CLAMP_TO_EDGE||p!==t.CLAMP_TO_EDGE;(y=y||s.width>m||s.height>m)&&setTimeout((function(){v=u.resizeImage(s)}))}t.texImage2D(e,i,r,n,o,v);var g=[v.width,v.height];return l===exports.TextureSourceType.video?[s.videoWidth,s.videoHeight]:g},i.texImage2DData=function(t,e,i,r,n,o,s){var a=s.data,u=s.width,h=s.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(a.buffer,a.byteOffset,a.byteLength/a.BYTES_PER_ELEMENT):a;return t.texImage2D(e,i,r,u,h,0,n,o,l),[u,h]},i.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;if(ji(this.engine.gl)&&t.width<n&&t.height<n)return t;var o=function(t,e,i,r){var n=t.width,o=t.height,s=Math.min(e,i||no(n)),a=Math.min(e,r||no(o));if(a!==o||s!==n){var u=yh.getCanvas(),h=u.getContext("2d");return u.width=s,u.height=a,null==h||h.drawImage(t,0,0,n,o,0,0,s,a),it.warn("Image resize from "+n+"x"+o+" to "+s+"x"+a+"."),u}}(t,n,e,i);return o||t},i.reloadData=function(){var t=this;return r((function(){return h(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,Ar().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},i.offloadData=function(){if(this.initialized&&Ar().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.engine.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}},i.uploadCurrentVideoFrame=function(){var t=this;return r((function(){return h(this,(function(e){return t.source.sourceType===exports.TextureSourceType.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},i.updateSource=function(t){this.source=this.assembleOptions(Xe({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},i.restore=function(){},i.dispose=function(){this.engine&&this.textureBuffer&&this.engine.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){it.error("This texture has been destroyed.")},this.initialize=ct,void 0!==this.engine&&this.engine.removeTexture(this),t.prototype.dispose.call(this)},e}(yr);function sc(t){return 0==(t&t-1)&&0!==t}var ac=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.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 ji(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),lc(e,t),e},e.bindVertexArray=function(t){var e;ji(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;ji(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),uc=1,hc=function(){function t(t){this.engine=t,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var e={width:1,height:1,data:new Uint8Array([255])},i=this.engine.gl;this.gl=i,this.emptyTexture2D=new oc(t,{data:e,sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new oc(t,{target:i.TEXTURE_CUBE_MAP,cube:[e,e,e,e,e,e],sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+uc,uc++}var e=t.prototype;return e.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.engine;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)}},e.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&v(this.renderbuffers,t),e},e.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)})))},e.drawGeometry=function(t,e,i){if(this.gl){var r=t,n=e.shaderVariant.program;if(n){var o=n.setupAttributes(r),s=this.gl,a=r.indicesBuffer,u=r.drawStart,h=r.drawCount,l=r.mode,c=r.subMeshes;if(c&&c.length){var f,d=c[i];if(h<0)return;if(u=d.offset,a)h=null!=(f=d.indexCount)?f:0;else h=d.vertexCount}a?s.drawElements(l,h,a.type,null!=u?u:0):s.drawArrays(l,u,h),null==o||o.unbind()}}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")},e.createGLFramebuffer=function(t,e){var i=this.gl.createFramebuffer();if(!i)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return v(this.framebuffers,t),lc(i,e,e),i},e.createVAO=function(t){return new ac(this.engine,t)},e.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),y(this.textures,t),delete t.textureBuffer)},e.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},e.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),y(this.framebuffers,t),delete t.fbo)},e.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),y(this.renderbuffers,t),delete t.buffer)},e.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.lost=function(t){it.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},e.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.gpu=this.gl=null,this.destroyed=!0},wi(t,[{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}}]),t}();function lc(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 cc,fc,dc=function(){function t(t,e){this.engine=t,this.byteLength=0,this.destroyed=!1;var i=e.name,r=e.data,n=e.elementCount,o=e.target,s=void 0===o?Ui.ARRAY_BUFFER:o,a=e.type,u=void 0===a?Ui.FLOAT:a,h=e.usage,l=void 0===h?Ui.STATIC_DRAW:h,c=function(t){var e,i;return null!=(i=null==(e=pc[t])?void 0:e.BYTES_PER_ELEMENT)?i:0}(u);this.target=s,this.type=u,this.usage=l,this.glBuffer=this.createGLBuffer(i),this.bytesPerElement=c,r?this.bufferData(r):n&&this.bufferData(c*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.engine.gl.createBuffer();return lc(e,t),e},e.bind=function(){this.engine.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.engine){this.byteLength=e;var i=this.engine.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.engine){var i=this.engine.gl,r=this.target,n=t*this.bytesPerElement,o=n+e.byteLength;i.bindBuffer(r,this.glBuffer),o>this.byteLength&&(this.byteLength=o,i.bufferData(r,o,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.engine.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!ji(this.engine.gl)&&(this.engine.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},wi(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),pc=((cc={})[Ui.INT]=Int32Array,cc[Ui.FLOAT]=Float32Array,cc[Ui.SHORT]=Int16Array,cc[Ui.BYTE]=Int8Array,cc[Ui.UNSIGNED_BYTE]=Uint8Array,cc[Ui.UNSIGNED_INT]=Uint32Array,cc[Ui.UNSIGNED_SHORT]=Uint16Array,cc);var mc=((fc={})[Uint8Array.BYTES_PER_ELEMENT]=Ui.UNSIGNED_BYTE,fc[Uint16Array.BYTES_PER_ELEMENT]=Ui.UNSIGNED_SHORT,fc[Uint32Array.BYTES_PER_ELEMENT]=Ui.UNSIGNED_INT,fc),vc=1,yc=function(t){function i(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}kt(i,t);var r=i.prototype;return r.getOptions=function(){return Xe({},this.options)},r.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;K(e),e.addGeometry(this),Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new dc(t.engine,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},r.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},r.setAttributeData=function(t,e){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,o=i.target;this.bufferProps[r]={data:e,usage:n,target:o,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},r.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},r.setAttributeSubData=function(t,e,i){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&null!=r.data){var n=e,o=e+i.length;if(r.data.length<o){var s=new i.constructor(o);s.set(r.data),r.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];void 0!==a.start&&(a.start=Math.min(a.start,n)),void 0!==a.end&&(a.end=Math.max(a.end,o-1))}r.data.set(i,n),this.dirtyFlags[t].dirty=!0}}},r.getIndexData=function(){return this.indices},r.setIndexData=function(t){(s(t,Uint8Array)||s(t,Uint16Array)||s(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},r.setIndexSubData=function(t,e){if(this.indices){var i,r=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 s=this.dirtyFlags.index;void 0!==s.start&&(s.start=Math.min(s.start,r)),void 0!==s.end&&(s.end=Math.max(s.end,n-1))}null==(i=this.indices)||i.set(e,r),this.dirtyFlags.index.dirty=!0}},r.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*Yr[n]},r.getAttributeNames=function(){return this.attributesName},r.setDrawStart=function(t){this.drawStart=t},r.getDrawStart=function(){return this.drawStart},r.setDrawCount=function(t){this.drawCount=t},r.getDrawCount=function(){return this.drawCount},r.getSkinProps=function(){return this.skin},r.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},r.createIndicesBuffer=function(t){var e=mc[t.BYTES_PER_ELEMENT],i={data:t,target:Ui.ELEMENT_ARRAY_BUFFER,type:e,name:this.name+"##index"};return new dc(this.engine,i)},r.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 o,s,a=t.dirtyFlags[n];if("index"==n)o=t.indicesBuffer,s=r;else{var u=e[n].dataSource;o=t.buffers[u],s=i[u].data}if((a.dirty||a.discard)&&o&&s){if(a.discard)o.bufferData(s);else if(void 0!==a.start&&void 0!==a.end){var h=a.start*s.BYTES_PER_ELEMENT+s.byteOffset,l=a.end-a.start+1,c=new s.constructor(s.buffer,h,l);o.bufferSubData(a.start,c)}a.start=Number.POSITIVE_INFINITY,a.end=0,a.dirty=a.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(r){var n=t.attributesReleasable[r],o=e[r].dataSource;i[o]&&n&&(i[o].data=void 0)})),this.indicesReleasable}},r.processProps=function(t){var e=t,i=e.drawStart,r=void 0===i?0:i,n=e.drawCount,o=e.mode,a=e.indices,u=e.name,h=void 0===u?"effectsGeometry:"+vc++:u,l=e.bufferUsage,c=void 0===l?Ui.STATIC_DRAW:l;this.name=h;var f={},d=[],p={},m={},v={},y=c;this.drawStart=r,void 0!==n&&(this.drawCount=n),this.mode=isNaN(o)?Ui.TRIANGLES:o,Object.keys(e.attributes).forEach((function(t){var i=e.attributes[t],r=i.size,n=i.stride,o=i.offset,a=i.normalize,u=i.type,h=void 0===u?Ui.FLOAT:u,l=i.releasable,c=i.data;if(!h||"dataSource"in i||c||(c=qr(h)),c){var g=s(c,Float32Array)?Ui.FLOAT:Ui.INT;f[t]={data:c,usage:y,target:Ui.ARRAY_BUFFER,name:t},p[t]={size:r,stride:n,offset:o,type:null!=h?h:g,normalize:!!a,dataSource:t},v[t]=null!=l&&l,m[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=i.dataSource;x&&(p[t]={size:r,stride:n,offset:o,type:h,dataSource:x,normalize:!!a})}d.push(t)})),m.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=f,this.attributes=p,this.attributesName=d,this.attributesReleasable=v,this.dirtyFlags=m,this.options=e,this.initialized=!1},r.fromData=function(i){var r,n=this;if(t.prototype.fromData.call(this,i),this.subMeshes=i.subMeshes,i.buffer?r=new Uint8Array(function(t){for(var i=e.atob(t),r=new Uint8Array(i.length),n=0;n<i.length;n++)r[n]=i.charCodeAt(n);var o=r.buffer;return o}(i.buffer)):i.binaryData&&(r=i.binaryData),r){var o=i.vertexData.vertexCount;if(this.hasSemantic(i)){var s={mode:Ui.TRIANGLES,attributes:{}};if(i.vertexData.channels.forEach((function(t){var e,i=null!=(e=gc[t.semantic])?e:t.semantic,a=n.createVertexTypedArray(t,r,o);s.attributes[i]={type:Hi(t.format),size:t.dimension,data:a,normalize:t.normalize}})),i.indexFormat!==ye.None){var a=this.createIndexTypedArray(i.indexFormat,r,i.indexOffset);s.indices={data:a},s.drawCount=a.length}else s.drawCount=o;this.processProps(s)}else{var u=i.vertexData.channels[0],h=i.vertexData.channels[1],l=i.vertexData.channels[2],c=this.createVertexTypedArray(u,r,o),f=this.createVertexTypedArray(h,r,o),d=this.createVertexTypedArray(l,r,o),p=this.createIndexTypedArray(i.indexFormat,r,i.indexOffset),m={mode:Ui.TRIANGLES,attributes:{aPos:{type:Hi(u.format),size:3,data:c,normalize:u.normalize},aUV:{type:Hi(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:Hi(l.format),size:3,data:d,normalize:l.normalize}}};m.indices={data:p},m.drawCount=p.length,this.processProps(m)}this.skin={boneNames:i.boneNames,rootBoneName:i.rootBoneName,inverseBindMatrices:i.inverseBindMatrices}}},r.dispose=function(){var e,i=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){i.buffers[t].dispose()})),this.buffers={},null==(e=this.indicesBuffer)||e.dispose(),Object.keys(this.vaos).forEach((function(t){var e;null==(e=i.vaos[t])||e.dispose(),i.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&this.engine.removeGeometry(this));this.destroyed=!0,t.prototype.dispose.call(this)},r.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case ve.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},r.createIndexTypedArray=function(t,e,i){var r=e.buffer;switch(t){case ye.UInt16:return new Uint16Array(r,e.byteOffset+i);case ye.UInt32:return new Uint32Array(r,e.byteOffset+i);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,e.byteOffset+i)}},r.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},wi(i,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),i}(Zr),gc={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"};var xc=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendColor[0]===e&&this.blendColor[1]===i&&this.blendColor[2]===r&&this.blendColor[3]===n||(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===r&&this.blendFunctionParameters[3]===n||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA,Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[Ui.FUNC_ADD,Ui.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=Ui.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=[Ui.ALWAYS,Ui.ALWAYS],this.stencilOpFail=[Ui.KEEP,Ui.KEEP],this.stencilOpZFail=[Ui.KEEP,Ui.KEEP],this.stencilOpZPass=[Ui.KEEP,Ui.KEEP],this.culling=!1,this.frontFace=Ui.CCW,this.cullFace=Ui.FRONT},e.apply=function(t){if(t.toggle(Ui.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(Ui.BLEND,this.blending),t.toggle(Ui.DEPTH_TEST,this.depthTest),t.toggle(Ui.STENCIL_TEST,this.stencilTest),t.toggle(Ui.CULL_FACE,this.culling),t.toggle(Ui.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(Ui.BACK,this.stencilMask[1]),t.stencilMaskSeparate(Ui.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(Ui.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(Ui.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(Ui.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(Ui.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,i=e.blendColor,r=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(i[0],i[1],i[2],i[3]),t.blendEquationSeparate(r[0],r[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}(),bc=M,Tc=Oi,Ec=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).floats={},r.ints={},r.vector2s={},r.vector3s={},r.vector4s={},r.colors={},r.quaternions={},r.matrices={},r.matrice3s={},r.textures={},r.floatArrays={},r.vector4Arrays={},r.matrixArrays={},r.samplers=[],r.uniforms=[],r.uniformDirty=!0,r.macrosDirty=!0,r.glMaterialState=new xc,i&&(r.shader=new exports.Shader(e),r.shader.shaderData=Xe({},i.shader,{id:ft(),dataType:pe.Shader})),r}kt(e,t);var i=e.prototype;return i.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},i.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},i.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},i.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach((function(e){var i=t.textures[e];st(i.initialize)?i.initialize():it.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},i.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},i.setupStates=function(t){this.glMaterialState.apply(t)},i.use=function(t,e){var i=t.engine,r=this.shaderVariant;if(r.program){var n;if(r.program.bind(),this.setupStates(i),e){for(var s,a=o(e.uniforms);!(s=a()).done;)n=s.value,this.checkUniform(n);for(var u,h=o(e.samplers);!(u=h()).done;)n=u.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)r.setFloat(n,e.floats[n]);for(n in e.ints)r.setInt(n,e.ints[n]);for(n in e.vector4s)r.setVector4(n,e.vector4s[n]);for(n in e.vector3s)r.setVector3(n,e.vector3s[n]);for(n in e.matrices)r.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)r.setFloat(n,this.floats[n]);for(n in this.ints)r.setInt(n,this.ints[n]);for(n in this.floatArrays)r.setFloats(n,this.floatArrays[n]);for(n in this.textures)r.setTexture(n,this.textures[n]);for(n in this.vector2s)r.setVector2(n,this.vector2s[n]);for(n in this.vector3s)r.setVector3(n,this.vector3s[n]);for(n in this.vector4s)r.setVector4(n,this.vector4s[n]);for(n in this.colors)r.setColor(n,this.colors[n]);for(n in this.quaternions)r.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)r.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)r.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)r.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)r.setMatrixArray(n,this.matrixArrays[n])}else{var l;null==(l=this.engine)||l.renderErrors.add(new Error("Shader program is not initialized."))}},i.getFloat=function(t){return this.floats[t]},i.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},i.getInt=function(t){return this.ints[t]},i.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},i.getFloats=function(t){return this.floatArrays[t]},i.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},i.getVector2=function(t){return this.vector2s[t]},i.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},i.getVector3=function(t){return this.vector3s[t]},i.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},i.getVector4=function(t){return this.vector4s[t]},i.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},i.getColor=function(t){return this.colors[t]},i.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},i.getQuaternion=function(t){return this.quaternions[t]},i.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},i.getMatrix=function(t){return this.matrices[t]},i.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},i.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},i.getVector4Array=function(t){return this.vector4Arrays[t]},i.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=o(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},i.getMatrixArray=function(t){return this.matrixArrays[t]},i.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=o(e);!(i=r()).done;)for(var n=i.value,s=0;s<16;s++)this.matrixArrays[t].push(n.elements[s])},i.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},i.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},i.clone=function(t){var i=t||this.props,r=this.engine;K(r);var n=new e(r,i);return n.glMaterialState=Object.assign(new xc,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},i.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i=Xe({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===Ft.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var r,n,o=e.stringTags.RenderFace;for(r in o===Lt.Front?(this.culling=!0,this.cullFace=Ui.BACK):o===Lt.Back?(this.culling=!0,this.cullFace=Ui.FRONT):this.culling=!1,i.floats)this.setFloat(r,i.floats[r]);for(r in i.ints)this.setInt(r,i.ints[r]);for(r in i.vector4s){var s=i.vector4s[r];this.setVector4(r,new M(s.x,s.y,s.z,s.w))}for(r in i.colors){var a=i.colors[r];this.setColor(r,new R(a.r,a.g,a.b,a.a))}for(r in i.textures){var u=i.textures[r],h=this.engine.findObject(u.texture);this.setTexture(r,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(r+"_ST",new bc(c.x,c.y,l.x,l.y))}if(e.shader){var f=this.engine.findObject(e.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(n=e.stringTags)?n:{},this.initialized=!1},i.toData=function(){var t=this.defination;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=pe.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var o in this.textures){t.textures[o]||(t.textures[o]={texture:this.textures[o]});var s=t.textures[o],a=this.getVector4(o+"_ST");a&&(s.scale={x:a.x,y:a.y},s.offset={x:a.z,y:a.w},delete t.vector4s[o+"_ST"])}return t},i.cloneUniforms=function(t){var e,i=t;for(e in i.floats)this.setFloat(e,i.floats[e]);for(e in i.ints)this.setInt(e,i.ints[e]);for(e in i.floatArrays)this.setFloats(e,i.floatArrays[e]);for(e in i.textures)this.setTexture(e,i.textures[e]);for(e in i.vector2s)this.setVector2(e,i.vector2s[e]);for(e in i.vector3s)this.setVector3(e,i.vector3s[e]);for(e in i.vector4s)this.setVector4(e,i.vector4s[e]);for(e in i.colors)this.setColor(e,i.colors[e]);for(e in i.quaternions)this.setQuaternion(e,i.quaternions[e]);for(e in i.matrices)this.setMatrix(e,i.matrices[e]);for(e in i.vector4Arrays){for(var r=[],n=0;n<i.vector4Arrays[e].length;n+=4)r.push(new bc(i.vector4Arrays[e][n],i.vector4Arrays[e][n+1],i.vector4Arrays[e][n+2],i.vector4Arrays[e][n+3]));this.setVector4Array(e,r)}for(e in i.matrixArrays){for(var o=[],s=0;s<i.matrixArrays[e].length;s+=16){for(var a=Tc.fromIdentity(),u=0;u<16;u++)a.elements[u]=i.matrixArrays[e][s+u];o.push(a)}this.setMatrixArray(e,o)}},i.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},i.dispose=function(){var e;this.destroyed||(null==(e=this.shaderVariant)||e.dispose(),this.textures={},this.shaderSource=null,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=ct,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this),t.prototype.dispose.call(this))},wi(e,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask[0]},set:function(t){this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Nr),Sc=function(){function t(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.engine.shaderLibrary.addShader(e)}}var e=t.prototype;return e.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},e.copyTexture=function(t,e){this.renderer&&(t.initialize(),e.initialize(),e.updateSource({sourceType:exports.TextureSourceType.framebuffer,data:{width:e.getWidth()||t.getWidth(),height:e.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,e):this.copy1(t,e))},e.copy2=function(t,e){var i=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(i)},e.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)}}},e.createCopyRenderPass=function(){var t="mri-copy-mesh",e={texture:{format:Ui.RGBA}},i=this.renderer.engine,r=new yc(i,{name:t,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=i.gpuCapability.level,o=new Ec(i,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===n?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1}});o.blending=!1,o.depthTest=!1,o.culling=!1;var s=new sn(i,{name:t,geometry:r,material:o,priority:0});return new _c(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:exports.TextureLoadAction.whatever},attachments:[e],meshes:[s]})},e.dispose=function(){var t;this.renderer&&(null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0)},t}(),_c=function(t){function e(){return t.apply(this,arguments)}kt(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}(cn),Cc=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=[],K(t),this.gl=Ni(t,e,i),this.contextLostListener=function(t){for(var e,i,n=o(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=o(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}(),Ac=function(){function t(t,e,i){this.engine=t,this.program=e,this.id=i,this.engine.useProgram(e),this.attribInfoMap=this.createAttribMap(),this.engine.useProgram(null)}var e=t.prototype;return e.bind=function(){this.engine.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,o=this.engine.gl;return t.vaos[n]?i=t.vaos[n]:((i=new ac(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),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 s=t.buffers[n.dataSource];if(!s)throw new Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");s.bind(),o.enableVertexAttribArray(i.loc),o.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.engine.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var o=t.getActiveAttrib(e,n);if(o){var s=o.name,a=o.type,u=o.size,h=t.getAttribLocation(e,s);i[s]={type:a,name:s,size:u,loc:h}}}return i},e.dispose=function(){this.engine&&this.engine.gl.deleteProgram(this.program)},t}(),wc=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}kt(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.engine.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.engine.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.engine.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.engine.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.engine.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.engine.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.engine.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.engine.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.engine.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.engine.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.engine.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.engine.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.engine.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i=e.slice();t=t.concat(i);for(var r,n=this.engine.getUniforms(this.program.program,t),o=0;o<t.length;o++)this.uniformLocations[t[o]]=n[o];for(r=0;r<i.length;r++){null==this.uniformLocations[i[r]]&&(i.splice(r,1),r--)}for(r=0;r<i.length;r++){var s=i[r];this.samplerChannels[s]=r}},i.toData=function(){var t=this.defination;t.dataType=pe.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var e;this.compileResult&&this.compileResult.shared||(null==(e=this.program)||e.dispose(),t.prototype.dispose.call(this))},e}(Lr),Mc=0,Rc=function(){function t(t){this.engine=t,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var i=t.prototype;return i.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=o(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(t,e){var i,r,n=[];t.macros&&(i=n).push.apply(i,[].concat(t.macros));e&&(r=n).push.apply(r,[].concat(e));var o=Xe({},t,{vertex:_n.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.vertex,shader:t.vertex,macros:n}),fragment:_n.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.fragment,shader:t.fragment,macros:n})}),s=this.computeShaderCacheId(o);if(this.cachedShaders[s])return s;this.shaderAllDone=!1;var a=!1;return(o.shared||o.cacheId)&&(a=!0),this.cachedShaders[s]=new wc(this.engine,Xe({},o,{vertex:o.vertex,fragment:o.fragment,name:o.name||s,shared:a})),this.cachedShaders[s].id=s,s},i.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},i.compileShader=function(t,i){var r=this,n=t.source,o=n.shared,s=n.vertex,a=n.fragment,u=n.name,h=t.source.cacheId,l=!1;(o||h)&&(l=!0);var c=this.engine.gl,f={shared:l,status:exports.ShaderCompileResultStatus.compiling},d=this.createProgram(c,s,a,f),p=this.glAsyncCompileExt,m=e.performance.now(),v=function(i){f.status=exports.ShaderCompileResultStatus.success,f.compileTime=e.performance.now()-m,t.program=i,t.initialized=!0,void 0!==r.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),r.programMap[t.id]=i},y=function(){if(r.engine.isDestroyed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==i?void 0:i(f);if(t.initialized)return null==i?void 0:i(f);var n=(!i||!p||p&&1==c.getProgramParameter(f.program,p.COMPLETION_STATUS_KHR))&&d();if(n){if(f.status!==exports.ShaderCompileResultStatus.fail){lc(n,u);var o=new Ac(r.engine,n,t.id);if(c.validateProgram(n),c.getProgramParameter(n,c.VALIDATE_STATUS))v(o);else{var h=c.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))||(null==h?void 0:h.includes("Two textures of different types use the same sampler"))?v(o):(f.status=exports.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",s,"\nfragment:\n",a),c.deleteProgram(n))}}null==i||i(f)}else i&&e.requestAnimationFrame(y)};t.compileResult=f,y()},i.computeShaderCacheId=function(t){var e=t.vertex,i=void 0===e?"":e,r=t.fragment,n=void 0===r?"":r,o=t.shared,s=t.cacheId;return o||s?s||"shared_"+Pc(i,n):"instanced_"+Mc++},i.createProgram=function(t,e,i,r){var n=t.createProgram(),o=this.createGLShader(t,t.VERTEX_SHADER,e),s=this.createGLShader(t,t.FRAGMENT_SHADER,i);return n&&o&&s?(t.attachShader(n,o),t.attachShader(n,s),t.linkProgram(n),r.program=n,r.status=exports.ShaderCompileResultStatus.compiling,function(){if(r.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var a=t.getProgramInfoLog(n);console.error("Failed to link program: "+a+".");var u=Ic(t,o,"vertex",e),h=Ic(t,s,"fragment",i);return r.status=exports.ShaderCompileResultStatus.fail,u&&(r.error=u.error,r.status=u.status),h&&(r.error=h.error,r.status=h.status),n}return n}):(r.status=exports.ShaderCompileResultStatus.fail,function(){return null})},i.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Pc(null!=i?i:""),o=r.get(n);if(o)return o;var s=t.createShader(e);return s&&(t.shaderSource(s,i),t.compileShader(s),r.set(n,s)),s},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.engine){var e=this.engine.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}},t}();function Ic(t,e,i,r){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+i+" error: "+n,(null!=r?r:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:exports.ShaderCompileResultStatus.fail}}}function Pc(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var o=e[n],s=0;s<o.length;s++)r=Math.imul(31,r)+o.charCodeAt(s)|0;return r}var Oc=function(t){function e(e){var i;return(i=t.call(this)||this).gl=e,i.gpuCapability=new Un(e),i.gl=e,i.shaderLibrary=new Rc(Cs(i)),i.maxTextureCount=i.gl.TEXTURE0+i.gl.getParameter(i.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,i.reset(),i}kt(e,t);var i=e.prototype;return i.dispose=function(){this.destroyed||(t.prototype.dispose.call(this),this.shaderLibrary.dispose(),this.reset())},i.getGLRenderer=function(){return this.renderer},i.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},i.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=Ui.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},i.toggle=function(t,e){e?this.enable(t):this.disable(t)},i.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},i.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},i.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},i.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},i.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},i.useProgram=function(t){this.set1("useProgram",t)},i.clear=function(t){this.gl.clear(t)},i.clearDepth=function(t){this.set1("clearDepth",t)},i.depthFunc=function(t){this.set1("depthFunc",t)},i.depthMask=function(t){this.set1("depthMask",t)},i.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},i.depthRange=function(t,e){this.set2("depthRange",t,e)},i.clearStencil=function(t){this.set1("clearStencil",t)},i.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},i.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},i.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},i.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},i.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},i.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},i.cullFace=function(t){this.set1("cullFace",t)},i.frontFace=function(t){this.set1("frontFace",t)},i.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},i.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},i.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},i.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},i.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},i.blendEquation=function(t){this.set1("blendEquation",t)},i.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},i.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},i.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},i.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},i.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},i.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},i.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)},i.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)},i.set4=function(t,e,i,r,n){var o=this.glCapabilityCache[t];o||(o=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),o.x===e&&o.y===i&&o.z===r&&o.w===n||this.gl[t](o.x=e,o.y=i,o.z=r,o.w=n)},i.get=function(t){return this.glCapabilityCache[t]},i.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},i.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},i.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},i.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},i.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},i.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},i.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},i.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},i.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},i.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},i.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},i.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},i.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)}},i.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},i.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},i.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},i.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},e}($l),Nc=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}kt(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){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer,r=i.gl;i.engine.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):it.error("Invalid render buffer size: "+t+"x"+e+".")}}else it.error("Can't set size for uninitialized render buffer.")},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=ct},e}(kn),Fc=1,Lc=function(t){function e(e,i){var r;(r=t.call(this)||this).attachmentTextures=[];var n,o=e.depthStencilAttachment,s=e.viewport,a=e.isCustomViewport,u=e.storeAction,h=e.viewportScale,l=void 0===h?1:h,c=e.name,f=void 0===c?"GLFramebuffer"+Fc++:c;return r.renderer=i,r.engine=i.engine,r.depthStencilStorageType=null!=(n=null==o?void 0:o.storageType)?n:exports.RenderPassAttachmentStorageType.none,r.viewport=s,r.isCustomViewport=!!a,r.viewportScale=l,r.name=f,r.storeAction=u,r.updateProps(e),r}kt(e,t);var i=e.prototype;return i.getDepthTexture=function(){return this.depthTexture},i.getStencilTexture=function(){return this.stencilTexture},i.getColorTextures=function(){return this.colorTextures},i.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.updateProps=function(t){var e,i,r=this.renderer,n=this.engine.gpuCapability,o=null!=(i=t.depthStencilAttachment)?i:{storageType:exports.RenderPassAttachmentStorageType.none},a=t.attachments.length>0,u=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var h=null==(e=t.depthStencilAttachment)?void 0:e.texture,l=n.detail.readableDepthStencilTextures,c=o.storageType,f=o.storage;if(this.colorTextures=t.attachments.slice(),!a&&c!==exports.RenderPassAttachmentStorageType.none)throw new Error("Use depth stencil attachment without color attachments.");switch(a&&(this.fbo=r.glRenderer.createGLFramebuffer(this,this.name)),c){case exports.RenderPassAttachmentStorageType.depth_stencil_opaque:if(f){if(!s(f,Nc))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Nc({format:Ui.DEPTH_STENCIL,attachment:Ui.DEPTH_STENCIL_ATTACHMENT,storageType:c},r.glRenderer);u=!1;break;case exports.RenderPassAttachmentStorageType.depth_16_opaque:if(f){if(!s(f,Nc))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Nc({attachment:Ui.DEPTH_ATTACHMENT,format:Ui.DEPTH_COMPONENT16,storageType:c},r.glRenderer);break;case exports.RenderPassAttachmentStorageType.stencil_8_opaque:if(f){if(!s(f,Nc))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Nc({attachment:Ui.STENCIL_ATTACHMENT,format:Ui.STENCIL_INDEX8,storageType:c},r.glRenderer);break;case exports.RenderPassAttachmentStorageType.depth_16_texture:if(!l)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new oc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:Ui.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:Ui.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!l)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new oc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:Ui.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},i.getStoreAttachments=function(t,e){var i=this.renderer.glRenderer.gl,r=this.colorTextures.length;if(t&&ji(i)&&r>0){var n=[];if(t.depthAction===exports.TextureStoreAction.clear&&this.depthStorage&&v(n,e?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===exports.TextureStoreAction.clear&&this.stencilStorage&&v(n,e?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===exports.TextureStoreAction.clear)for(var o=0;o<r;o++)v(n,i["COLOR_ATTACHMENT"+o]);return n}},i.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;ji(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.engine.bindSystemFramebuffer()},i.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,i=this.renderer.engine,r=this.viewport,n=r[0],o=r[1],s=r[2],a=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,o,s,a);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(i.textureUnitDict).forEach((function(e){var r=i.textureUnitDict[e];r&&r!==u&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)i.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var l=this,c=l.depthStencilRenderbuffer,f=l.depthTexture,d=l.stencilTexture;if(i.activeTexture(e.TEXTURE0),c)c.setSize(s,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,c.attachment,e.RENDERBUFFER,c.buffer);else if(f){f.source.data={width:s,height:a},f.update({data:{width:s,height:a,data:new Uint16Array(0)}});var p=f&&d?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,p,e.TEXTURE_2D,f.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var m=e.checkFramebufferStatus(e.FRAMEBUFFER);if(m!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+m+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+".");this.ready=!0}}},i.resetColorTextures=function(t){var e=t,i=this.renderer.glRenderer.gl,r=this.engine.gpuCapability,n=this.viewport,s=[];if(e){for(var a,u=o(e);!(a=u()).done;){a.value.initialize()}this.colorTextures=e.slice()}this.renderer.engine.activeTexture(i.TEXTURE0),this.colorTextures.forEach((function(t,e){var o={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:o}),r.framebufferTexture2D(i,i.FRAMEBUFFER,e,i.TEXTURE_2D,t.textureBuffer),s.push(!0)})),r.drawBuffers(i,s),this.updateAttachmentTextures()},i.resize=function(t,e,i,r){var n=this.viewport,o=n[0],s=n[1],a=n[2],u=n[3];o===t&&s===e&&a===i&&u===r||(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},i.dispose=function(t){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var e,i,r=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:exports.RenderPassDestroyAttachmentType.force;if(r===exports.RenderPassDestroyAttachmentType.force||r===exports.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)null==(e=this.depthStencilRenderbuffer)||e.dispose(),null==(i=this.depthTexture)||i.dispose();this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},wi(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(Hn),Vc=function(t){function e(e,i,r){var n;(n=t.call(this)||this).canvas=e,n.temporaryRTs={};var o=Xe({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},r);n.context=new Cc(e,i,o);var s=n.context.gl;return K(s),n.engine=new Oc(s),n.engine.renderer=Cs(n),n.glRenderer=new hc(n.engine),n.extension=new Sc(Cs(n)),n.renderingData={currentFrame:{}},n.framebuffer=new Lc({storeAction:{},viewport:[0,0,n.width,n.height],attachments:[new oc(n.engine,{sourceType:exports.TextureSourceType.framebuffer,data:{width:n.width,height:n.height}})],depthStencilAttachment:{storageType:exports.RenderPassAttachmentStorageType.none}},Cs(n)),n}kt(e,t);var i=e.prototype;return i.renderRenderFrame=function(t){var e,i=t;i.resource&&i.resource.color_b.initialize();var r=i._renderPasses;if(this.isDestroyed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=i.renderer.getShaderLibrary())||e.compileAllShaders(),this.setFramebuffer(null),this.clear(i.clearAction);var n=i.camera;this.renderingData.currentFrame=i,this.renderingData.currentCamera=n,this.setGlobalMatrix("effects_MatrixInvV",n.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",n.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",n.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",n.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",n.position),W(r);for(var s,a=o(r);!(s=a()).done;){var u=s.value,h=u.delegate;null==h.willBeginRenderPass||h.willBeginRenderPass.call(h,u,this.renderingData),this.renderRenderPass(u),null==h.didEndRenderPass||h.didEndRenderPass.call(h,u,this.renderingData)}for(var l,c=o(r);!(l=c()).done;){l.value.frameCleanup(this)}}},i.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},i.renderMeshes=function(t){for(var e,i=this.renderingData.currentPass.delegate,r=o(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)}},i.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},i.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},i.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},i.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},i.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},i.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},i.drawGeometry=function(t,e,i,r){if(void 0===r&&(r=0),t&&i){i.initialize(),t.initialize(),t.flush();var n=this.renderingData;i.setMatrix("effects_ObjectToWorld",e);try{i.use(this,n.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,i,r)}},i.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.engine.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},i.getFramebuffer=function(){return this.framebuffer},i.getTemporaryRT=function(t,e,i,r,n,o){if(this.temporaryRTs[t])return this.temporaryRTs[t];var s,a,u=exports.RenderPassAttachmentStorageType.none;n===exports.FilterMode.Linear?s=Ui.LINEAR:n===exports.FilterMode.Nearest&&(s=Ui.NEAREST),o===exports.RenderTextureFormat.RGBA32?a=Ui.UNSIGNED_BYTE:o===exports.RenderTextureFormat.RGBAHalf&&(a=Ui.HALF_FLOAT),0===r?u=exports.RenderPassAttachmentStorageType.none:16===r?u=exports.RenderPassAttachmentStorageType.depth_16_opaque:24===r&&(u=exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var h=new oc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:Ui.RGBA,format:Ui.RGBA,type:a}),l=new Lc({name:t,storeAction:{},viewport:[0,0,e,i],viewportScale:1,isCustomViewport:!0,attachments:[h],depthStencilAttachment:{storageType:u}},this);return this.temporaryRTs[t]=l,l},i.setViewport=function(t,e,i,r){this.engine.viewport(t,e,i,r)},i.clear=function(t){var e=this.engine,i=0;if(t.colorAction===exports.TextureLoadAction.clear){var r=t.clearColor;r&&e.clearColor(r[0],r[1],r[2],r[3]),e.colorMask(!0,!0,!0,!0),i=Ui.COLOR_BUFFER_BIT}if(t.stencilAction===exports.TextureLoadAction.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),i|=Ui.STENCIL_BUFFER_BIT),t.depthAction===exports.TextureLoadAction.clear){var n=t.clearDepth;e.depthMask(!0),e.clearDepth(Number.isFinite(n)?n:1),i|=Ui.DEPTH_BUFFER_BIT}i&&e.clear(i)},i.addLostHandler=function(t){this.context.addLostHandler(t)},i.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},i.getShaderLibrary=function(){return this.engine.shaderLibrary},i.getWidth=function(){return this.width},i.getHeight=function(){return this.height},i.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},i.lost=function(t){t.preventDefault(),this.extension.dispose(),this.glRenderer.lost(t)},i.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context.");var e=this.engine;e.reset(),e.shaderLibrary=new Rc(e),e.gpuCapability=new Un(t),this.glRenderer=new hc(this.engine),this.extension=new Sc(this)},i.resize=function(t,e){var i=this.glRenderer;i&&(this.width===t&&this.height===e||i.resize(t,e))},i.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},wi(e,[{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}}]),e}(Wn),Dc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY",kc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT",zc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW",Uc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Bc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Gc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",jc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var Xc=new Map;var Hc=!1,Wc=1,Yc=function(t){function i(i){var n;(n=t.call(this)||this).compositions=[],n.displayScale=1,n.resumePending=!1,n.disposed=!1,n.assetManagers=[],n.speed=1,n.baseCompositionIndex=0,n.useExternalCanvas=!1,n.lost=function(t){var e;null==(e=n.ticker)||e.pause(),n.compositions.forEach((function(e){return e.lost(t)})),n.renderer.lost(t),n.handleEmitEvent("webglcontextlost",t)};var s=Cs(n);n.restore=r((function(){var t;return h(this,(function(i){switch(i.label){case 0:return s.renderer.restore(),[4,Promise.all(s.compositions.map(r((function(t){var e,i,r,n,o,a,u,l,c,f,d;return h(this,(function(h){switch(h.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.reusable,o=t.renderOrder,a=t.transform,u=t.videoState,[4,s.loadScene(i)];case 1:(l=h.sent()).speed=r,l.reusable=n,l.renderOrder=o,l.transform.setPosition(a.position.x,a.position.y,a.position.z),l.transform.setRotation(a.rotation.x,a.rotation.y,a.rotation.z),l.transform.setScale(a.scale.x,a.scale.y,a.scale.z),c=0,h.label=2;case 2:return c<u.length?u[c]?((f=l.textures[c].source.video).currentTime=null!=(d=u[c])?d:0,[4,f.play()]):[3,4]:[3,5];case 3:h.sent(),h.label=4;case 4:return c++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return s.compositions=i.sent(),s.emit("webglcontextrestored"),null==(t=s.ticker)||t.resume(),k()&&s.canvas&&(s.canvas.style.display="none",e.window.setTimeout((function(){s.canvas.style.display=""}),0)),[2]}}))})),n.handleClick=function(t){var e=t.x,i=t.y,r=[];n.compositions.forEach((function(t){for(var s,a=o(t.hitTest(e,i));!(s=a()).done;){var u=s.value;r.push(Xe({},u,{player:Cs(n),composition:t}))}}));for(var s=0;s<r.length;s++){var a=r[s],u=a.behavior||It.NOTIFY;u===It.NOTIFY?(n.emit("click",Xe({},a,{compositionId:a.composition.id,compositionName:a.composition.name})),a.composition.emit("click",Xe({},a,{compositionId:a.composition.id,compositionName:a.composition.name}))):u===It.RESUME_PLAYER&&n.resume()}};var a=i.container,u=i.canvas,l=i.fps,c=i.name,f=i.pixelRatio,d=i.manualRender,p=i.reportGPUTime,m=i.renderFramework,v=i.notifyTouch,y=i.onError,g=i.interactive,x=void 0!==g&&g,b=i.renderOptions,T=void 0===b?{}:b,E=i.env,S=void 0===E?"":E,_=T.willCaptureImage,C=T.premultipliedAlpha;if(n.onError=y,Hc||"debug-disable"===m)return vh(n);var A,w=(A=/iPhone OS (\d+)_(\d+)/.exec(e.navigator.userAgent))&&("13"===A[1]||"16"===A[1]&&"5"===A[2])?"webgl":"webgl2";m&&(w="webgl"===m?"webgl":"webgl2"),n.reportGPUTime=p,n.pixelRatio=Number.isFinite(f)?f:L(),n.offscreenMode=!0,n.env=S,n.name=c||""+Wc++;try{if(zi.length)throw new Error("Errors before player create: "+zi.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?(n.canvas=u,n.useExternalCanvas=!0):(Zc(a),n.canvas=e.document.createElement("canvas"),a.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.renderer=Wn.create(n.canvas,w,{preserveDrawingBuffer:_,premultipliedAlpha:C}),n.renderer.env=S,n.renderer.addLostHandler({lost:n.lost}),n.renderer.addRestoreHandler({restore:n.restore}),n.gpuCapability=n.renderer.engine.gpuCapability,n.assetService=new Nl(n.renderer.engine),d||(n.ticker=new tc(l),n.ticker.add(n.tick.bind(Cs(n)))),n.event=new ds(n.canvas,!!v),n.event.bindListeners(),n.event.addEventListener(hs,n.handleClick),n.interactive=x,n.resize(),Xu(n.gpuCapability.detail),Xc.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&&it.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+jc+".")})),Xc.set(n.canvas,Cs(n)),function(){for(var t,e=[],i=o(Xc.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&it.error("Current running player count: "+e.length+", see "+Gc+".",e)}()}catch(t){n.canvas&&!n.useExternalCanvas&&n.canvas.remove(),n.handleThrowError(t)}return n}kt(i,t);var n=i.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.sort((function(t,e){return t.getIndex()-e.getIndex()}))},n.getAssetManager=function(){return this.assetManagers},n.loadScene=function(t,i){var n=this;return r((function(){var s,a,u,l,c,f,d,p,m,v,y,g,x,b,T,E,S,_,C,A,w,M;return h(this,(function(R){switch(R.label){case 0:for(K(n.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),l=e.performance.now(),c=[],f=[],p=null==(d=null==i?void 0:i.autoplay)||d,m=null==(a=n.renderer.engine.gpuCapability)||null==(s=a.detail)?void 0:s.asyncShaderCompile,v=n.baseCompositionIndex,ot(t)?(y=c).push.apply(y,[].concat(t)):c.push(t),n.baseCompositionIndex+=c.length,p&&(n.autoPlaying=!0),g=o(n.assetManagers);!(x=g()).done;)x.value.dispose();return n.assetManagers=[],b=[],[4,Promise.all(c.map(r((function(t,e){var r,o,s,a,u,l,c,d;return h(this,(function(h){switch(h.label){case 0:return r=n.assetService.assembleSceneLoadOptions(t,Xe({autoplay:p},i)),o=r.source,s=r.options,u=null!=(a=null==s?void 0:s.autoplay)?a:p,l=new Pl(s),n.assetManagers.push(l),[4,l.loadScene(o,n.renderer,{env:n.env})];case 1:return c=h.sent(),n.disposed?(f.length=0,[2]):(n.assetService.prepareAssets(c,c.assets),n.assetService.updateTextVariables(c,l.options.variables),n.assetService.initializeTexture(c),c.pluginSystem.precompile(c.jsonScene.compositions,n.renderer),(d=n.createComposition(c,s)).setIndex(v+e),f[e]=d,b[e]=u,[2])}}))}))))];case 1:return R.sent(),T=e.performance.now(),[4,new Promise((function(t){var e;null==(e=n.renderer.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:for(R.sent(),E=e.performance.now()-T,S=0;S<f.length;S++)b[S]?f[S].play():f[S].pause(),n.compositions.push(f[S]);for(null==(u=n.ticker)||u.start(),f.some((function(t){return!t.getPaused()}))&&n.emit("play",{time:0}),_=f.map((function(t){return t.name})),C=e.performance.now()-l,A=o(f);!(w=A()).done;)(M=w.value).statistic.compileTime=E,M.statistic.firstFrameTime=C;return it.info("First frame ["+_+"]: "+C.toFixed(4)+"ms."),it.info("Shader "+(m?"async":"sync")+" compile ["+_+"]: "+E.toFixed(4)+"ms."),[2,ot(t)?f:f[0]]}}))}))()},n.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=this.renderer,n=new Fu(Xe({},e,{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,handleItemMessage:function(t){i.emit("message",t)}}),t);return this.ticker&&e.renderLevel===St.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==Qo&&this.assetService.createShaderVariant(),n},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(),this.emit("play",{time:0})},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),this.emit("play",{time:t})},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),this.emit("pause")},n.playSequence=function(t){for(var e,i=function(e){t[e].on("end",(function(){t[e+1].play()}))},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},n.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),this.compositions.map((function(t){t.pause()})),t&&t.offloadTexture&&this.offloadTexture())},n.resume=function(){var t=this;return r((function(){var e;return h(this,(function(i){switch(i.label){case 0:return t.resumePending?[2]:t.paused?(t.resumePending=!0,[4,Promise.all(t.compositions.map((function(t){return t.reloadTexture()})))]):[3,2];case 1:i.sent(),t.resumePending=!1,t.emit("resume"),i.label=2;case 2:return t.compositions.map((function(t){t.resume()})),null==(e=t.ticker)||e.resume(),[2]}}))}))()},n.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},n.doTick=function(t,e){var i,r=this,n=this.renderer.engine.renderErrors;n.size>0&&(this.handleEmitEvent("rendererror",n.values().next().value),null==(i=this.ticker)||i.pause());t=Math.min(t,33)*this.speed;var o=this.compositions,s=!1;o.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var a,u=[],h=0;h<o.length;h++){var l=o[h];l.textureOffloaded?(s=!0,it.error("Composition "+l.name+" texture offloaded, skip render."),u.push(l)):(!l.isDestroyed&&l.renderer&&l.update(t),l.isDestroyed||u.push(l))}if(this.compositions=u,this.baseCompositionIndex=this.compositions.length,s)return this.handleEmitEvent("rendererror",new Error("Play when texture offloaded.")),null==(a=this.ticker)?void 0:a.pause();if(!this.paused||e){var c=this.gpuCapability.level,f=this.renderer.context.gl,d=2===c&&this.reportGPUTime?Fi(f):void 0;if(null==d||d.begin(),this.compositions.length||this.compositions.length<o.length||e){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var p=0;p<o.length;p++)!o[p].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(o[p].renderFrame)}null==d||d.end(),null==d||d.getTime().then((function(t){return null==r.reportGPUTime?void 0:r.reportGPUTime.call(r,null!=t?t:0)})).catch,this.autoPlaying&&this.emit("update",{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,i,r,n,o=this,s=this.canvas.parentElement;if(s){var a=this.getTargetSize(s);t=a[0],i=a[1],r=a[2],n=a[3]}else t=r=this.canvas.width,i=n=this.canvas.height;var u=t/i;if(t&&i){var h,l=e.document.documentElement.clientWidth;r>2*l&&it.error("DPI overflowed, width "+r+" is more than 2x document width "+l+", see "+kc+".");var c=this.env?this.gpuCapability.detail.maxTextureSize:2048;(r>c||n>c)&&(it.error("Container size overflowed "+r+"x"+n+", see "+Dc+"."),u>1?(r=Math.round(c),n=Math.round(c/u)):(n=Math.round(c),r=Math.round(c*u))),this.renderer.resize(r,n),this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",it.info("Resize player "+this.name+" ["+r+","+n+","+t+","+i+"]."),null==(h=this.compositions)||h.forEach((function(t){t.camera.aspect=u,t.camera.pixelHeight=o.renderer.getHeight(),t.camera.pixelWidth=o.renderer.getWidth()}))}},n.clearCanvas=function(t){t?this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.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){var i,r,n;if(it.info("Call player destroyed: "+this.name+"."),!this.disposed){Xc.delete(this.canvas),this.pause(),null==(i=this.ticker)||i.stop(),this.assetManagers.forEach((function(t){return t.dispose()})),this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.renderer&&(this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.renderer.dispose(!t)),null==(r=this.event)||r.dispose(),null==(n=this.assetService)||n.dispose(),s(this.canvas,e.HTMLCanvasElement)&&!t&&this.renderer.context&&(yh.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var o="Never use destroyed player: "+this.name+" again, see "+Bc+".",a=function(){return function(t){throw new Error(t)}(o)},u=function(){return t=o,Promise.reject(t);var t};this.tick=a,this.resize=a,this.loadScene=u,this.play=u,this.gotoAndPlay=u,this.gotoAndStop=u,this.playSequence=a,this.destroyCurrentCompositions=a,this.resume=u,this.disposed=!0}},n.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},n.getTargetSize=function(t){Zc(t);var i,r,n=this.displayAspect,o=null==e.window.getComputedStyle?void 0:e.window.getComputedStyle.call(e.window,t),s=0,a=0;(o?(s=parseInt(o.width,10),a=parseInt(o.height,10)):(s=t.clientWidth,a=t.clientHeight),n)?s/a>n?i=(r=a*this.displayScale)*n:r=(i=s*this.displayScale)/n:(i=s,r=a);var u=this.pixelRatio,h=i,l=r;if(i=Math.round(i*u),(r=Math.round(r*u))<1||r<1){if(!this.offscreenMode)throw new Error("Invalid container size "+i+"x"+r+", see "+zc+".");i=r=h=l=1}return[h,l,i,r]},n.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},n.handleEmitEvent=function(t,i){this.onError?s(i,e.Event)?this.onError(new Error(i.type,{cause:t}),i):s(i,Error)?this.onError(new Error(i.message,{cause:t}),i):this.onError(new Error("Unknown error.",{cause:t}),i):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,i))},wi(i,[{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),i}(Ru);function Zc(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Uc+".")}u([function(t,e,i){var n=i.value;return i.value=r((function(){var e,i,r,o,s=arguments;return h(this,(function(a){switch(a.label){case 0:for(e=s.length,i=new Array(e),r=0;r<e;r++)i[r]=s[r];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.apply(this,i)];case 2:return[2,a.sent()];case 3:return o=a.sent(),t.handleThrowError.call(this,o),[3,4];case 4:return[2]}}))})),i}],Yc.prototype,"loadScene",null),yr.create=function(t,e){return new oc(t,e)},yr.createWithData=function(t,e,i){void 0===e&&(e=X("#fff")),void 0===i&&(i={});var r=i.type,n=void 0===r?Ui.UNSIGNED_BYTE:r,o=i.format,s=void 0===o?Ui.RGBA:o,a=i.internalFormat,u=i.wrapS,h=void 0===u?Ui.MIRRORED_REPEAT:u,l=i.wrapT,c=void 0===l?Ui.MIRRORED_REPEAT:l,f=i.minFilter,d=void 0===f?Ui.NEAREST:f,p=i.magFilter,m=void 0===p?Ui.NEAREST:p,v=i.flipY,y=void 0!==v&&v;return new oc(t,{data:e,type:n,sourceType:exports.TextureSourceType.data,format:s,internalFormat:a||s,wrapS:h,wrapT:c,minFilter:d,magFilter:m,flipY:y})},Nr.create=function(t,e){return new Ec(t,e)},Zr.create=function(t,e){return new yc(t,e)},sn.create=function(t,e){return new sn(t,e)},kn.create=function(t){return new Nc(t)},Hn.create=function(t,e){return new Lc(t,e)},Wn.create=function(t,e,i){return new Vc(t,e,i)},$l.create=function(t){return new Oc(t)};var qc="2.7.2";it.info("Player version: 2.7.2."),exports.AbstractPlugin=Vt,exports.ActivationMixerPlayable=ru,exports.ActivationPlayable=nu,exports.AndNode=oi,exports.Animatable=Ye,exports.AnimationClipNode=We,exports.ApplyAdditiveNode=ri,exports.Asset=_h,exports.AssetLoader=Ah,exports.AssetManager=Pl,exports.AssetService=Nl,exports.BYTES_TYPE_MAP=Yr,exports.Behaviour=Ri,exports.BezierCurve=$o,exports.BezierCurvePath=Vo,exports.BezierCurveQuat=Do,exports.BlendNode=ni,exports.BoolValueNode=Be,exports.COPY_FRAGMENT_SHADER=zr,exports.COPY_MESH_SHADER_ID=Dr,exports.COPY_VERTEX_SHADER=kr,exports.CalculateLoader=Wu,exports.Camera=Is,exports.CameraVFXItemLoader=us,exports.ColorCurve=ss,exports.ColorPlayable=Vu,exports.ColorPropertyMixerPlayable=au,exports.Component=Mi,exports.ComponentTimePlayable=ju,exports.ComponentTimePlayableAsset=Gu,exports.ComponentTimeTrack=zu,exports.Composition=Fu,exports.ConstBoolNode=hi,exports.ConstFloatNode=ui,exports.ControlParameterBoolNode=ci,exports.ControlParameterFloatNode=li,exports.ControlParameterTriggerNode=fi,exports.DEFAULT_FONTS=bh,exports.DEFAULT_FPS=60,exports.Database=wh,exports.Deferred=function(){var t=this;this.promise=new Promise((function(e,i){t.resolve=e,t.reject=i}))},exports.Downloader=Ki,exports.EFFECTS_COPY_MESH_NAME=Vr,exports.EVENT_TYPE_CLICK=hs,exports.EVENT_TYPE_TOUCH_END=fs,exports.EVENT_TYPE_TOUCH_MOVE=cs,exports.EVENT_TYPE_TOUCH_START=ls,exports.EffectComponentTimeTrack=Bu,exports.EffectsObject=Re,exports.EffectsPackage=Jl,exports.Ellipse=ch,exports.Engine=$l,exports.EventEmitter=Ru,exports.EventSystem=ds,exports.Float16ArrayWrapper=qn,exports.FloatComparisonNode=yi,exports.FloatComparisonNodeData=vi,exports.FloatPropertyMixerPlayable=uu,exports.FloatValueNode=Ue,exports.Framebuffer=Hn,exports.GLEngine=Oc,exports.GLGeometry=yc,exports.GLRenderer=Vc,exports.GPUCapability=Un,exports.Geometry=Zr,exports.GlobalUniforms=Dn,exports.GradientValue=No,exports.GraphInstance=Ci,exports.GraphNode=Ve,exports.GraphNodeData=De,exports.GraphicsPath=mh,exports.HELP_LINK=Jo,exports.InteractLoader=ms,exports.InteractMesh=ys,exports.InvalidIndex=Le,exports.KTXTexture=Er,exports.LayerBlendNode=di,exports.LineSegments=Fo,exports.LinearValue=Oo,exports.MaskProcessor=Fr,exports.MaskableGraphic=Yn,exports.Material=Nr,exports.MaterialDataBlock=Mr,exports.Mesh=sn,exports.MeshCollider=bs,exports.NodeTransform=ti,exports.NotNode=ai,exports.OrNode=si,exports.PLAYER_OPTIONS_ENV_EDITOR=Qo,exports.POST_PROCESS_SETTINGS="post_process_settings",exports.ParticleBehaviourPlayable=ka,exports.ParticleBehaviourPlayableAsset=za,exports.ParticleLoader=Hu,exports.ParticleMesh=Ba,exports.ParticleMixerPlayable=hu,exports.ParticleSystemRenderer=Xa,exports.ParticleTrack=Cu,exports.PassTextureCache=Hr,exports.PathSegments=Lo,exports.Playable=Es,exports.PlayableAsset=_s,exports.PlayableOutput=Ss,exports.Player=Yc,exports.PluginSystem=xt,exports.PolyStar=fh,exports.Polygon=oh,exports.Pose=ei,exports.PoseNode=ke,exports.PropertyClipPlayable=ou,exports.PropertyTrack=_u,exports.RENDER_PASS_NAME_PREFIX=Rn,exports.RENDER_PREFER_LOOKUP_TEXTURE=wa,exports.RUNTIME_ENV="runtime_env",exports.RandomSetValue=Ro,exports.RandomValue=Io,exports.RandomVectorValue=Po,exports.RenderFrame=Pn,exports.RenderPass=cn,exports.RenderPassPriorityNormal=an,exports.RenderPassPriorityPostprocess=3e3,exports.RenderPassPriorityPrepare=0,exports.RenderTargetHandle=hn,exports.Renderbuffer=kn,exports.Renderer=Wn,exports.RendererComponent=Ii,exports.RuntimeClip=Su,exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",exports.SPRITE_VERTEX_STRIDE=Ko,exports.SemanticMap=Wr,exports.SerializationHelper=Ch,exports.ShaderFactory=_n,exports.ShaderVariant=Lr,exports.ShapePath=ph,exports.SpriteColorMixerPlayable=lu,exports.SpriteComponentTimeTrack=Uu,exports.SpriteLoader=Ts,exports.StateMachineNode=xi,exports.StateNode=Ti,exports.StaticValue=Mo,exports.SubCompositionClipPlayable=cu,exports.SubCompositionMixerPlayable=fu,exports.TEMPLATE_USE_OFFSCREEN_CANVAS=Ma,exports.TextComponentBase=Eh,exports.TextLayout=gh,exports.TextLoader=Sh,exports.TextStyle=xh,exports.Texture=yr,exports.TextureFactory=Cr,exports.Ticker=tc,exports.TimelineClip=Eu,exports.TimelineInstance=wu,exports.TrackMixerPlayable=iu,exports.Transform=Ms,exports.TransformMixerPlayable=du,exports.TransformPlayable=bu,exports.TransitionNode=Si,exports.ValueGetter=wo,exports.ValueNode=ze,exports.Vector2Curve=qo,exports.Vector2PropertyMixerPlayable=vu,exports.Vector3Curve=Zo,exports.Vector3PropertyMixerPlayable=mu,exports.Vector4Curve=Yo,exports.Vector4PropertyMixerPlayable=pu,exports.addByOrder=Y,exports.addItem=v,exports.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var o=t[n];if(r)for(;t[n-1][i]<o[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>o[i]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},exports.applyMixins=pt,exports.assertExist=K,exports.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},exports.base64ToFile=dt,exports.buildLine=$u,exports.calculateTranslation=$n,exports.canUseBOM=D,exports.canvasPool=yh,exports.closePointEps=qu,exports.colorGradingFrag=gn,exports.colorStopsFromGradient=O,exports.colorToArr=I,exports.combineImageTemplate=Ml,exports.createCopyShader=Ur,exports.createGLContext=Ni,exports.createKeyFrameMeta=Go,exports.createShape=Ws,exports.createValueGetter=ns,exports.curveEps=Ku,exports.decimalEqual=ao,exports.defaultPlugins=vt,exports.deserializeMipmapTexture=fr,exports.disableAllPlayer=function(t){Hc=!!t},exports.earcut=ma,exports.effectsClass=Ae,exports.effectsClassStore=_e,exports.enlargeBuffer=g,exports.ensureFixedNumber=Rh,exports.ensureVec3=to,exports.findPreviousRenderPass=function(t,e){var i=t.indexOf(e);return t[i-1]},exports.gaussianDownHFrag=xn,exports.gaussianDownVFrag=bn,exports.gaussianUpFrag=Tn,exports.generateEmptyTypedArray=qr,exports.generateGUID=ft,exports.generateHalfFloatTexture=gr,exports.generateTransparentTexture=Tr,exports.generateWhiteTexture=br,exports.getActivePlayers=function(){return Array.from(Xc.values())},exports.getBackgroundImage=wl,exports.getClass=Ce,exports.getColorFromGradientStops=P,exports.getConfig=Ia,exports.getDefaultTextureFactory=Ar,exports.getGeometryByShape=Ta,exports.getGeometryTriangles=ba,exports.getKTXTextureOptions=Sr,exports.getKeyFrameMetaByRawValue=Bo,exports.getMergedStore=Me,exports.getNodeDataClass=Ne,exports.getParticleMeshShader=function(t,e,i){var r;void 0===i&&(i="");var n,o=t.content,s=+((null==(r=o.renderer)?void 0:r.renderMode)||0),a=[["RENDER_MODE",s],["ENV_EDITOR",i===Qo]],u=e.level,h=e.detail,l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=h.maxVertexUniforms>0,d=(null!=(n=o.positionOverLifetime)?n:{}).speedOverLifetime,p=0,m=0;f&&a.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(a.push(["SPEED_OVER_LIFETIME",!0]),m|=2,Bo(l,d));var v=o.textureSheetAnimation;v&&v.animate&&(a.push(["USE_SPRITE",!0]),m|=4);var y=o.colorOverLifetime;y&&y.color&&(a.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&Bo(l,g);var x,b=o.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[r])&&(Bo(l,b[r]),i=1,m|=1<<7+e),a.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==b?void 0:b[n])&&(Bo(l,b[n]),o=1,m|=1<<10+e,x=!0),a.push(["ORB_VEL_"+t.toUpperCase(),o])})),(null==b?void 0:b.asMovement)&&(a.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),x&&(null==b?void 0:b.asRotation)&&(a.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64),o.sizeOverLifetime){var T=o.sizeOverLifetime;T.separateAxes?(Bo(l,T.x),a.push(["SIZE_Y_BY_LIFE",1]),m|=16384,Bo(l,T.y)):Bo(l,T.size)}if(o.rotationOverLifetime){var E=o.rotationOverLifetime;E.z&&(Bo(l,null==E?void 0:E.z),m|=32768,a.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(Bo(l,E.x),m|=65536,a.push(["ROT_X_LIFETIME",1])),E.y&&(Bo(l,E.y),m|=1<<17,a.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(a.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=1<<18)}Bo(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(a.push(["FINAL_TARGET",!0]),m|=1<<19,Bo(l,b.forceCurve));var S=h.halfFloatTexture;S&&c.max&&(m|=1<<20);var _=h.maxVertexUniforms,C=l.max+l.curves.length-32>_;Ia(wa)&&(C=!0),2===u&&(l.max=-1,c.index>0&&(c.max=-1)),C&&S&&f&&(p=1);var A=["-p:",s,m,l.index,l.max,c.index,c.max].join("+"),w={fragment:pn,vertex:"#define LOOKUP_TEXTURE_CURVE "+p+"\n"+mn,shared:!0,cacheId:A,macros:a,name:"particle#"+t.name};return a.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",c.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",c.max]),{shader:w,vertex:l.index,fragment:c.index}},exports.getPixelRatio=L,exports.getPlayerByCanvas=function(t){return Xc.get(t)},exports.getPreMultiAlpha=Wi,exports.getStandardComposition=xl,exports.getStandardImage=gl,exports.getStandardItem=Sl,exports.getStandardJSON=vl,exports.getTextureSize=On,exports.glContext=Ui,exports.glType2VertexFormatType=function(t){switch(t){case e.WebGLRenderingContext.FLOAT:return ve.Float32;case e.WebGLRenderingContext.SHORT:return ve.Int16;case e.WebGLRenderingContext.BYTE:return ve.Int8;case e.WebGLRenderingContext.UNSIGNED_SHORT:return ve.UInt16;case e.WebGLRenderingContext.UNSIGNED_BYTE:return ve.UInt8;default:return ve.Float32}},exports.gpuTimer=Fi,exports.imageDataFromColor=X,exports.imageDataFromGradient=H,exports.initErrors=zi,exports.initGLContext=Gi,exports.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.;}",exports.interpolateColor=N,exports.isAlipayMiniApp=G,exports.isAndroid=z,exports.isArray=ot,exports.isCanvas=ht,exports.isCanvasUsedByPlayer=function(t){return Xc.has(t)},exports.isFunction=st,exports.isIOS=k,exports.isIOSByUA=function(){var t=e.navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},exports.isMiniProgram=function(){return G()||j()},exports.isObject=at,exports.isOpenHarmony=U,exports.isPlainObject=ut,exports.isSimulatorCellPhone=B,exports.isString=nt,exports.isUniformStruct=Rr,exports.isUniformStructArray=function(t){return t&&void 0!==t.length&&Rr(t[0])},exports.isValidFontFamily=Q,exports.isWebGL2=ji,exports.isWechatMiniApp=j,exports.itemFrag=dn,exports.itemVert=fn,exports.loadAVIFOptional=er,exports.loadBinary=or,exports.loadBlob=function(t){return ar.apply(this,arguments)},exports.loadImage=rr,exports.loadMedia=lr,exports.loadVideo=ur,exports.loadWebPOptional=$i,exports.logger=it,exports.math=nn,exports.modifyMaxKeyframeShader=function(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var o=0;o<t.macros.length;o++){var s=t.macros[o];if("VERT_CURVE_VALUE_COUNT"===s[0])s[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===s[0]){s[1]=i;break}}},exports.nearestPowerOfTwo=no,exports.nodeDataClass=Oe,exports.noop=rt,exports.normalizeColor=Vh,exports.numberToFix=uo,exports.oldBezierKeyFramesToNew=es,exports.parsePercent=F,exports.particleFrag=pn,exports.particleOriginTranslateMap=ro,exports.particleUniformTypeMap=Ua,exports.particleVert=mn,exports.passRenderLevel=Al,exports.pluginLoaderMap=mt,exports.randomInRange=lt,exports.registerPlugin=gt,exports.removeItem=y,exports.rotateVec2=Ea,exports.screenMeshVert=yn,exports.serialize=we,exports.setBlendMode=Yi,exports.setConfig=function(t,e){return Ra[t]=e},exports.setDefaultTextureFactory=function(t){_r=t},exports.setMaskMode=qi,exports.setMaxSpriteMeshItemCount=function(t){exports.maxSpriteMeshItemCount=t},exports.setRayFromCamera=oo,exports.setSideMode=Zi,exports.setSpriteMeshMaxItemCountByGPU=Xu,exports.sortByOrder=W,exports.spec=Te,exports.thresholdFrag=En,exports.throwDestroyedError=ct,exports.trailVert=vn,exports.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},exports.trianglesFromRect=so,exports.unregisterPlugin=function(t){delete yt[t],delete mt[t],y(vt,t)},exports.valIfUndefined=function(t,e){return null==t?e:t},exports.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",exports.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",exports.vecFill=eo,exports.vecMulCombine=io,exports.version=qc,exports.vertexFormatType2GLType=Hi;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/appx-adapter/alipay");function i(t,e,i,r,n,o,s){try{var a=t[o](s),u=a.value}catch(t){return void i(t)}a.done?e(u):Promise.resolve(u).then(r,n)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var s=t.apply(e,r);function a(t){i(s,n,o,a,u,"next",t)}function u(t){i(s,n,o,a,u,"throw",t)}a(void 0)}))}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function o(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 n(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,e):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 new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function s(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):s(t,e)}function a(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function u(t,e,i,r){var n,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,i,s):n(e,i))||s);return o>3&&s&&Object.defineProperty(e,i,s),s}function h(t,e){var i,r,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(u){return function(a){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(i=1,r&&(n=2&a[0]?r.return:a[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,a[1])).done)return n;switch(r=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){o.label=a[1];break}if(6===a[0]&&o.label<n[1]){o.label=n[1],n=a;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(a);break}n[2]&&o.ops.pop(),o.trys.pop();continue}a=e.call(t,o)}catch(t){a=[6,t],r=0}finally{i=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}"function"==typeof SuppressedError&&SuppressedError;var l=new Uint8Array(16);function c(){if(!t&&!(t=void 0!==e.crypto&&e.crypto.getRandomValues&&e.crypto.getRandomValues.bind(e.crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(l)}for(var f=[],d=0;d<256;++d)f.push((d+256).toString(16).slice(1));var p={randomUUID:void 0!==e.crypto&&e.crypto.randomUUID&&e.crypto.randomUUID.bind(e.crypto)};function m(t,e,i){if(p.randomUUID&&!e&&!t)return p.randomUUID();var r=(t=t||{}).random||(t.rng||c)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){i=i||0;for(var n=0;n<16;++n)e[i+n]=r[n];return e}return function(t,e){return void 0===e&&(e=0),f[t[e+0]]+f[t[e+1]]+f[t[e+2]]+f[t[e+3]]+"-"+f[t[e+4]]+f[t[e+5]]+"-"+f[t[e+6]]+f[t[e+7]]+"-"+f[t[e+8]]+f[t[e+9]]+"-"+f[t[e+10]]+f[t[e+11]]+f[t[e+12]]+f[t[e+13]]+f[t[e+14]]+f[t[e+15]]}(r)}function v(t,e){return t.includes(e)||t.push(e),t}function y(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function g(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var o=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),s=new t.constructor(o);return s.set(t),s}return t}var x=2*Math.PI,b=Math.PI/180,T=180/Math.PI,E=1e-6;function S(t,e){return Math.abs(t-e)<E||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var _=function(t,e,i){return(1-i)*t+i*e};function C(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,o=Math.min(r,n),s=Math.max(r,n);return Math.min(Math.max(t,o),s)}var A=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):s(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):s(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):s(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):s(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=E,e=this.x,i=this.y;return Math.abs(e)<=t&&Math.abs(i)<=t},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}();A.ONE=new A(1,1),A.ZERO=new A(0,0);var w=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):s(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):s(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):s(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):s(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,o=e.x,s=e.y,a=e.z;return this.x=r*a-n*s,this.y=n*o-i*a,this.z=i*s-r*o,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=E,e=this,i=e.x,r=e.y,n=e.z;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new A(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}();w.X=new w(1,0,0),w.Y=new w(0,1,0),w.Z=new w(0,0,1),w.ONE=new w(1,1,1),w.ZERO=new w(0,0,0);var M=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,o;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(o=t[e+3])?o:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):s(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):s(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):s(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):s(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=E,e=this,i=e.x,r=e.y,n=e.z,o=e.w;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t&&Math.abs(o)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new w(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}();M.ONE=new M(1,1,1,1),M.ZERO=new M(0,0,0,0);var R=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,o;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(o=t[e+3])?o:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,o=t/60,s=n*(1-Math.abs(o%2-1)),a=0,u=0,h=0;o>=0&&o<=1?(a=n,u=s):o>=1&&o<=2?(a=s,u=n):o>=2&&o<=3?(u=n,h=s):o>=3&&o<=4?(u=s,h=n):o>=4&&o<=5?(a=s,h=n):o>=5&&o<=6&&(a=n,h=s);var l=i-n;return this.set(a+l,u+l,h+l,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):s(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):s(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):s(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):s(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 M(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,i=e.r,r=e.g,n=e.b,o=e.a,s=Math.max(i,r,n),a=Math.min(i,r,n),u=s-a,h=0,l=0;return 0!==s&&(l=u/s),s!=a&&(s==i?(h=(r-n)/u,r<n&&(h+=6)):s==r?h=(n-i)/u+2:s==n&&(h=(i-r)/u+4),h*=60),new t(h,l,s,o)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),o=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+o:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),(new t).setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();function I(t,e){var i=[0,0,0,0];if(nt(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else s(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)i[o]/=255;return i}function P(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var o=t[n-1],s=t[n];if(o.time<=e&&e<=s.time){r=N(o.color.toArray(),s.color.toArray(),(e-o.time)/(s.time-o.time));break}}return r||(r=t[t.length-1].color.toArray()),i?r.map((function(t){return t/255})):r}return[0,0,0,0]}function O(t){var e=[];if(s(t,Array)?t.forEach((function(t){var i=t[0],r=t[1],n=t[2],o=t[3],s=t[4];e.push({time:F(i),color:new R(r,n,o,s)})})):Object.keys(t).forEach((function(i){var r=t[i],n=(new R).setFromArray(I(r));e.push({time:F(i),color:n})})),(e=e.sort((function(t,e){return t.time-e.time}))).length){0!==e[0].time&&e.unshift({time:0,color:e[0].color.clone()});var i=e[e.length-1];1!==i.time&&e.push({time:1,color:i.color.clone()})}return e}function N(t,e,i,r){var n=[],o=1-i;if(r)for(var s=0;s<4;s++)n[s]=t[s]*o+e[s]*i;else{for(var a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*o+e[a]*e[a]*i));n[3]=Math.round(t[3]*o+e[3]*i)}return n}function F(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function L(){if("object"==typeof e.screen&&"object"==typeof e.document){var t=Math.max(e.document.documentElement.clientWidth,e.window.innerWidth||0),i=e.screen.width/t;return Math.min(2*i,2)}return 1}R.BLACK=new R(0,0,0,1),R.BLUE=new R(0,0,1,1),R.CLEAR=new R(0,0,0,0),R.CYAN=new R(0,1,1,1),R.GRAY=new R(.5,.5,.5,1),R.GREEN=new R(0,1,0,1),R.MAGENTA=new R(1,0,1,1),R.RED=new R(1,0,0,1),R.WHITE=new R(1,1,1,1),R.YELLOW=new R(1,.92,.016,1);var V,D=void 0!==e.window;function k(){return!!e.navigator.platform&&/iPad|iPhone|iPod/.test(e.navigator.platform)}function z(){return/\b[Aa]ndroid\b/.test(e.navigator.userAgent)}function U(){return/\bOpenHarmony\b/.test(e.navigator.userAgent)}function B(){return z()||U()||/\b(iPad|iPhone|iPod)\b/.test(e.navigator.userAgent)}function G(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function j(){return"miniprogram"===e.window.__wxjs_environment}function X(t){nt(t)&&(t=I(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 H(t){var e=128,i={width:e,height:1,data:new Uint8Array(512)},r=i.data,n=O(t);if(n.length){r.set(n[0].color.toArray(),0);for(var o=1;o<127;o++){for(var s=o/e,a=void 0,u=void 0,h=0;h<n.length&&(a=n[h],u=n[h+1],!(a.time<=s&&u.time>s));h++);var l=N(a.color.toArray(),u.color.toArray(),(s-a.time)/(u.time-a.time));r.set(l,4*o)}r.set(n[n.length-1].color.toArray(),508)}return i}function W(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(i<=30){for(var r=1;r<i;r++)Z(t,r,e);return t}return q(t,e)}function Y(t,e,i){return void 0===i&&(i=2),t.includes(e)?t:(t.push(e),1===t.length||1!==i&&Z(t,t.length-1,i),t)}function Z(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 q(t,e,i,r){if(void 0===i&&(i=0),void 0===r&&(r=t.length-1),i>=r)return t;for(var n,o=t[i],s=i,a=r;s<a;){if(2===e){for(;t[a].priority>o.priority&&a>=s;)a--;for(;t[s].priority<=o.priority&&s<a;)s++}else{for(;t[a].priority<o.priority&&a>=s;)a--;for(;t[s].priority>=o.priority&&s<a;)s++}var u;u=[t[a],t[s]],t[s]=u[0],t[a]=u[1]}return n=[t[s],t[i]],t[i]=n[0],t[s]=n[1],q(t,e,i,s-1),q(t,e,a+1,r),t}function K(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function Q(t){return/^[^\d.][\w-]*$/.test(t)}exports.OrderType=void 0,(V=exports.OrderType||(exports.OrderType={}))[V.none=1]="none",V[V.ascending=2]="ascending",V[V.descending=3]="descending";var J,$="[Galacean Effects]";function tt(t){return["%c"+$,"color: #AA0100",""+t]}var et,it={error:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).error.apply(n,[].concat(tt(t),[i])),null==J||J("error",t,i)},info:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).debug.apply(n,[].concat(tt(t))),null==J||J("info",t,i)},warn:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).warn.apply(n,[].concat(tt(t))),null==J||J("warn",t,i)},register:function(t){t&&st(t)&&(J=t)}};function rt(){}function nt(t){return"string"==typeof t}exports.DestroyOptions=void 0,(et=exports.DestroyOptions||(exports.DestroyOptions={}))[et.destroy=0]="destroy",et[et.keep=1]="keep",et[et.force=0]="force";var ot=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function st(t){return"[object Function]"===Object.prototype.toString.call(t)}function at(t){return"[object Object]"===Object.prototype.toString.call(t)}function ut(t){if(null===t||"object"!=typeof t)return!1;if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function ht(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function lt(t,e){return t+Math.random()*(e-t)}function ct(){throw new Error("Destroyed item cannot be used again.")}function ft(){return m().replace(/-/g,"")}function dt(t,i,r){void 0===i&&(i="base64File"),void 0===r&&(r="");for(var n=t.split(",")[1]||t,o=e.atob(n),s=[],a=0;a<o.length;a+=512){for(var u=o.slice(a,a+512),h=new Array(u.length),l=0;l<u.length;l++)h[l]=u.charCodeAt(l);var c=new Uint8Array(h);s.push(c)}var f=new e.Blob(s,{type:r});return new File([f],i,{type:r})}function pt(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)}))}))}var mt={},vt=[],yt={};function gt(t,e,i){yt[t]&&it.error("Duplicate registration for plugin "+t+"."),yt[t]=i,mt[t]=e,v(vt,t)}var xt=function(){function t(t){var e={},i=[];vt.forEach((function(t){var r=mt[t];i.includes(r)||(i.push(r),e[t]=r)}));for(var r,n=o(t);!(r=n()).done;){var s=r.value;if(!mt[s])throw new Error("The plugin '"+s+"' not found."+Tt(s))}this.plugins=Object.keys(e).map((function(t){var e=new(0,mt[t]);return e.name=t,e})).sort((function(t,e){return t.order-e.order}))}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach((function(i){return i.onCompositionConstructed(t,e)}))},e.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},e.resetComposition=function(t,e){this.plugins.forEach((function(i){return i.onCompositionReset(t,e)}))},e.processRawJSON=function(t,e){var i=this;return r((function(){return h(this,(function(r){return[2,i.callStatic("processRawJSON",t,e)]}))}))()},e.processAssets=function(t,e){var i=this;return r((function(){return h(this,(function(r){return[2,i.callStatic("processAssets",t,e)]}))}))()},e.precompile=function(t,e){for(var i,r=o(this.plugins);!(i=r()).done;){i.value.precompile(t,e)}},e.loadResources=function(t,e){var i=this;return r((function(){return h(this,(function(r){return[2,i.callStatic("prepareResource",t,e)]}))}))()},e.callStatic=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];var o=this;return r((function(){var e,r,n,s,a,u,l;return h(this,(function(h){for(e=[],r=o.plugins,n=0;n<r.length;n++)s=r[n],a=mt[s.name],t in a&&e.push(Promise.resolve(null==(l=a[t])?void 0:(u=l).call.apply(u,[].concat([a],i))));return[2,Promise.all(e)]}))}))()},t}(),bt={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer","rich-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"};function Tt(t){var e=bt[t];return e?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""}var Et,St,_t,Ct,At,wt,Mt,Rt,It,Pt,Ot,Nt,Ft,Lt,Vt=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.precompile=function(t,e){},e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t}();function Dt(t,e){return Dt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Dt(t,e)}function kt(t,e){if("function"!=typeof e&&null!==e)throw new 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&&Dt(t,e)}!function(t){t["1_0"]="1.0",t["1_1"]="1.1",t["1_2"]="1.2",t["1_3"]="1.3",t["1_5"]="1.5",t["1_8"]="1.8",t["2_0"]="2.0",t["2_1"]="2.1",t["2_2"]="2.2",t["2_3"]="2.3",t["2_4"]="2.4",t["3_0"]="3.0",t["3_1"]="3.1",t["3_2"]="3.2",t["3_3"]="3.3",t["3_4"]="3.4",t["3_5"]="3.5",t.LATEST="3.5"}(Et||(Et={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(St||(St={})),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"}(_t||(_t={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(Ct||(Ct={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(At||(At={})),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"}(wt||(wt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(Mt||(Mt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Rt||(Rt={})),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"}(It||(It={})),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.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox",t.effect="effect",t.shape="shape",t.postProcessVolume="postProcessVolume",t.node="node",t.video="video",t.audio="audio",t.richtext="richtext"}(Pt||(Pt={})),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"}(Ot||(Ot={})),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"}(Nt||(Nt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(Ft||(Ft={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(Lt||(Lt={}));var zt,Ut,Bt,Gt,jt,Xt,Ht,Wt,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee,ie,re=1,ne=3,oe=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(zt||(zt={})),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",t[t.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",t[t.COLOR_CURVE=24]="COLOR_CURVE",t[t.VECTOR4_CURVE=25]="VECTOR4_CURVE",t[t.VECTOR2_CURVE=26]="VECTOR2_CURVE",t[t.VECTOR3_CURVE=27]="VECTOR3_CURVE"}(Ut||(Ut={})),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"}(Bt||(Bt={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(Gt||(Gt={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(jt||(jt={})),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"}(Xt||(Xt={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(Ht||(Ht={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Wt||(Wt={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(Yt||(Yt={})),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"}(qt||(qt={})),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",t.diffuse="diffuse"}(Kt||(Kt={})),function(t){t[t.visible=0]="visible",t[t.display=1]="display",t[t.clip=2]="clip",t[t.ellipsis=3]="ellipsis"}(Qt||(Qt={})),function(t){t[t.autoWidth=0]="autoWidth",t[t.autoHeight=1]="autoHeight",t[t.fixed=2]="fixed"}(Jt||(Jt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}($t||($t={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(te||(te={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(ee||(ee={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(ie||(ie={}));var se,ae,ue,he,le,ce,fe,de,pe,me,ve,ye,ge,xe={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};!function(t){t[t.Solid=0]="Solid",t[t.GradientLinear=1]="GradientLinear",t[t.GradientRadial=2]="GradientRadial",t[t.GradientAngular=3]="GradientAngular",t[t.Texture=4]="Texture"}(se||(se={})),function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(ae||(ae={})),function(t){t[t.Custom=0]="Custom",t[t.Rectangle=1]="Rectangle",t[t.Ellipse=2]="Ellipse",t[t.Polygon=3]="Polygon",t[t.Star=4]="Star"}(ue||(ue={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(he||(he={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(le||(le={})),function(t){t.AnimationClipNodeData="AnimationClipNodeData",t.BlendNodeData="BlendNodeData",t.ApplyAdditiveNodeData="ApplyAdditiveNodeData",t.LayerBlendNodeData="LayerBlendNodeData",t.StateMachineNodeData="StateMachineNodeData",t.TransitionNodeData="TransitionNodeData",t.StateNodeData="StateNodeData",t.ConstFloatNodeData="ConstFloatNodeData",t.ConstBoolNodeData="ConstBoolNodeData",t.ControlParameterBoolNodeData="ControlParameterBoolNodeData",t.ControlParameterFloatNodeData="ControlParameterFloatNodeData",t.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",t.NotNodeData="NotNodeData",t.AndNodeData="AndNodeData",t.OrNodeData="OrNodeData",t.EqualNodeData="EqualNodeData",t.GreaterNodeData="GreaterNodeData",t.LessNodeData="LessNodeData"}(ce||(ce={})),function(t){t.video="video",t.image="image"}(fe||(fe={})),function(t){t.video="video",t.audio="audio"}(de||(de={})),function(t){t.VFXItemData="VFXItemData",t.Material="Material",t.Shader="Shader",t.Geometry="Geometry",t.Texture="Texture",t.Image="Image",t.AnimationClip="AnimationClip",t.BinaryAsset="BinaryAsset",t.TrackAsset="TrackAsset",t.TimelineAsset="TimelineAsset",t.ObjectBindingTrack="ObjectBindingTrack",t.TransformTrack="TransformTrack",t.SpriteColorTrack="SpriteColorTrack",t.ActivationTrack="ActivationTrack",t.SubCompositionTrack="SubCompositionTrack",t.FloatPropertyTrack="FloatPropertyTrack",t.ColorPropertyTrack="ColorPropertyTrack",t.Vector2PropertyTrack="Vector2PropertyTrack",t.Vector3PropertyTrack="Vector3PropertyTrack",t.Vector4PropertyTrack="Vector4PropertyTrack",t.TransformPlayableAsset="TransformPlayableAsset",t.SpriteColorPlayableAsset="SpriteColorPlayableAsset",t.ActivationPlayableAsset="ActivationPlayableAsset",t.SubCompositionPlayableAsset="SubCompositionPlayableAsset",t.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",t.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",t.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",t.Vector3PropertyPlayableAsset="Vector3PropertyPlayableAsset",t.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",t.MeshComponent="MeshComponent",t.SkyboxComponent="SkyboxComponent",t.LightComponent="LightComponent",t.CameraComponent="CameraComponent",t.ModelPluginComponent="ModelPluginComponent",t.TreeComponent="TreeComponent",t.AnimationComponent="AnimationComponent",t.SpineComponent="SpineComponent",t.VideoComponent="VideoComponent",t.AudioComponent="AudioComponent",t.RichTextComponent="RichTextComponent",t.OrientationComponent="OrientationComponent",t.ShapeComponent="ShapeComponent",t.SpriteComponent="SpriteComponent",t.ParticleSystem="ParticleSystem",t.InteractComponent="InteractComponent",t.CameraController="CameraController",t.PostProcessVolume="PostProcessVolume",t.EffectComponent="EffectComponent",t.TextComponent="TextComponent",t.AnimationGraphAsset="AnimationGraphAsset",t.CompositionComponent="CompositionComponent",t.FFDComponent="FFDComponent",t.Animator="Animator",t.TimelineClip="TimelineClip"}(pe||(pe={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(me||(me={})),function(t){t[t.Float16=0]="Float16",t[t.Float32=1]="Float32",t[t.Int8=2]="Int8",t[t.Int16=3]="Int16",t[t.Int32=4]="Int32",t[t.UInt8=5]="UInt8",t[t.UInt16=6]="UInt16",t[t.UInt32=7]="UInt32"}(ve||(ve={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(ye||(ye={})),function(t){t.Position="POSITION",t.Uv="TEXCOORD0",t.Uv2="TEXCOORD1",t.Normal="NORMAL",t.Tangent="TANGENT",t.Color="COLOR",t.Joints="JOINTS",t.Weights="WEIGHTS",t.PositionBS0="POSITION_BS0",t.PositionBS1="POSITION_BS1",t.PositionBS2="POSITION_BS2",t.PositionBS3="POSITION_BS3",t.PositionBS4="POSITION_BS4",t.PositionBS5="POSITION_BS5",t.PositionBS6="POSITION_BS6",t.PositionBS7="POSITION_BS7",t.NormalBS0="NORMAL_BS0",t.NormalBS1="NORMAL_BS1",t.NormalBS2="NORMAL_BS2",t.NormalBS3="NORMAL_BS3",t.TangentBS0="TANGENT_BS0",t.TangentBS1="TANGENT_BS1",t.TangentBS2="TANGENT_BS2",t.TangentBS3="TANGENT_BS3"}(ge||(ge={}));var be=Et.LATEST,Te=Object.freeze({__proto__:null,LATEST_VERSION:be,get RenderLevel(){return St},get BlendingMode(){return _t},get SideMode(){return Ct},get ObscuredMode(){return At},get ParticleEmitterShapeType(){return wt},get PluginType(){return Mt},get InteractType(){return Rt},get InteractBehavior(){return It},get ItemType(){return Pt},get RenderMode(){return Ot},get ParticleOrigin(){return Nt},get RenderType(){return Ft},get RenderFace(){return Lt},get CameraClipMode(){return zt},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:re,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:ne,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:oe,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return Ut},get BezierKeyframeType(){return Bt},get JSONSceneVersion(){return Et},get EndBehavior(){return Gt},get ParticleInteractionBehavior(){return jt},get ShapeArcMode(){return Xt},get LightType(){return Ht},get ModelBoundingType(){return Wt},get CameraType(){return Yt},get MaterialType(){return Zt},get MaterialBlending(){return qt},get RenderMode3D(){return Kt},get TextOverflow(){return Qt},get TextSizeMode(){return Jt},get TextBaseline(){return $t},get TextAlignment(){return te},get TextWeight(){return ee},get FontStyle(){return ie},BuiltinObjectGUID:xe,get FillType(){return se},get TexturePaintScaleMode(){return ae},get ShapePrimitiveType(){return ue},get LineCap(){return he},get LineJoin(){return le},get NodeDataType(){return ce},get BackgroundType(){return fe},get MultimediaType(){return de},get DataType(){return pe},get GeometryType(){return me},get VertexFormatType(){return ve},get IndexFormatType(){return ye},get VertexBufferSemantic(){return ge}}),Ee=new Map,Se=new Map,_e={};function Ce(t){return _e[t]}function Ae(t){return function(e,i){_e[t]&&console.warn("Class "+t+" is already registered."),_e[t]=e}}function we(t,e){return function(t,e){return function(i,r){var n=function(t){var e=t.constructor;Ee.get(e)||Ee.set(e,{});return Ee.get(e)}(i);n&&(n[r]||(n[r]={type:t,sourceName:e}))}}(t,e)}function Me(t){var e=t.constructor;if(Se.get(e))return Se.get(e);var i={};Se.set(e,i);for(var r=t,n=e;n;){var o=Ee.get(n);for(var s in o)i[s]=o[s];var a=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(a).constructor)===Object)break;r=a}return i}var Re=function(){function t(t){this.engine=t,this.guid=ft(),this.defination={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){void 0!==t.id&&this.setInstanceId(t.id)},e.dispose=function(){this.engine.removeInstance(this.guid)},t.is=function(e){return s(e,t)&&"guid"in e},t}(),Ie=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),Pe={};function Oe(t){return function(e,i){Pe[t]&&console.warn("NodeData Class "+t+" is already registered."),Pe[t]=e}}function Ne(t){return Pe[t]}var Fe,Le=-1,Ve=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw new Error("Node not initialized!");0==--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw new Error("Node still initialized!");this.lastUpdateID=-1},t}(),De=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i.asset=this,i},t}(),ke=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.previousTime=0,e.currentTime=0,e}kt(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(Ve),ze=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.setValue=function(t){},e}(Ve),Ue=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(ze),Be=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(ze);exports.AnimationGraphAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).nodeDatas=[],e.graphDataSet=new Ie,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=Le,e}return kt(e,t),e.prototype.fromData=function(t){var i=t,r=i.nodeDatas;this.rootNodeIndex=i.rootNodeIndex,this.controlParameterIDs=i.controlParameterIDs;for(var n=i.controlParameterIDs.length,s=0;s<n;s++)this.parameterLookupMap.set(i.controlParameterIDs[s],s);this.nodeDatas=[];for(var a=0;a<r.length;a++)this.nodeDatas[a]=e.createNodeData(r[a].type),this.nodeDatas[a].load(r[a]);this.graphDataSet=new Ie,this.graphDataSet.resources=[];for(var u,h=o(i.graphDataSet.resources);!(u=h()).done;){var l=u.value,c=this.engine.findObject(l);this.graphDataSet.resources.push(c)}},e.createNodeData=function(t){var e=Ne(t);if(e)return new e;throw new Error("Unknown node type: "+t+".")},e}(Re),exports.AnimationGraphAsset=u([Ae("AnimationGraphAsset")],exports.AnimationGraphAsset),function(t){t[t.Active=0]="Active",t[t.Inactive=1]="Inactive"}(Fe||(Fe={}));var Ge=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),je=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t]):null},t}();function Xe(){return Xe=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},Xe.apply(this,arguments)}exports.AnimationClipNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(We,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=Xe({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(De),exports.AnimationClipNodeData=u([Oe(ce.AnimationClipNodeData)],exports.AnimationClipNodeData);var He,We=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).animation=null,e.animatable=null,e}kt(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=C(this.currentTime,0,1);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new Ye(e.skeleton,this.animation))},e}(ke);!function(t){t[t.Position=0]="Position",t[t.Scale=1]="Scale",t[t.Rotation=2]="Rotation",t[t.Euler=3]="Euler"}(He||(He={}));var Ye=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=o(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var s,a=o(e.scaleCurves);!(s=a()).done;){var u=s.value;this.addTransformCurveInfo(u,1)}for(var h,l=o(e.rotationCurves);!(h=l()).done;){var c=h.value;this.addTransformCurveInfo(c,2)}for(var f,d=o(e.eulerCurves);!(f=d()).done;){var p=f.value;this.addTransformCurveInfo(p,3)}for(var m,v=o(e.floatCurves);!(m=v()).done;){var y=m.value;this.addFloatCurveInfo(y)}for(var g,x=o(e.colorCurves);!(g=x()).done;){var b=g.value;this.addColorCurveInfo(b)}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=C(t,0,this.animationClip.duration),n=o(this.transformCurveInfos);!(i=n()).done;){var s=i.value,a=s.curve.keyFrames.getValue(r),u=e.parentSpaceTransforms[s.boneIndex];switch(s.type){case 0:u.position.copyFrom(a);break;case 1:u.scale.copyFrom(a);break;case 2:u.rotation.copyFrom(a);break;case 3:u.euler.copyFrom(a)}}for(var h,l=o(this.floatCurveInfos);!(h=l()).done;){var c=h.value,f=c.curve.keyFrames.getValue(r);e.floatPropertyValues[c.animatedObjectIndex]=f}for(var d,p=o(this.colorCurveInfos);!(d=p()).done;){var m=d.value,v=m.curve.keyFrames.getValue(r);e.colorPropertyValues[m.animatedObjectIndex]=v}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),Ze=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),o=t.tempVec0;return o.copyFrom(e).normalize(),this.x=o.x*n,this.y=o.y*n,this.z=o.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],o=e[1],s=e[5],a=e[9],u=e[2],h=e[6],l=e[10],c=i+s+l;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(h-a)*f,this.y=(n-u)*f,this.z=(o-r)*f}else if(i>s&&i>l){var d=2*Math.sqrt(1+i-s-l);this.w=(h-a)/d,this.x=.25*d,this.y=(r+o)/d,this.z=(n+u)/d,this.negate()}else if(s>l){var p=2*Math.sqrt(1+s-i-l);this.w=(n-u)/p,this.x=(r+o)/p,this.y=.25*p,this.z=(a+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-s);this.w=(o-r)/m,this.x=(n+u)/m,this.y=(a+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=i):(this.x=0,this.y=-t.z,this.z=t.y,this.w=i)):(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(C(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);if(0===i)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,o=t.w,s=e.x,a=e.y,u=e.z,h=e.w;return this.x=i*h+o*s+r*u-n*a,this.y=r*h+o*a+n*s-i*u,this.z=n*h+o*u+i*a-r*s,this.w=o*h-i*s-r*a-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this,r=i.x,n=i.y,o=i.z,s=i.w,a=s*t.w+r*t.x+n*t.y+o*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=r,this.y=n,this.z=o,this;var u=1-a*a;if(u<=Number.EPSILON){var h=1-e;return this.w=h*s+e*this.w,this.x=h*r+e*this.x,this.y=h*n+e*this.y,this.z=h*o+e*this.z,this.normalize(),this}var l=Math.sqrt(u),c=Math.atan2(l,a),f=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this.w=s*f+this.w*d,this.x=r*f+this.x*d,this.y=n*f+this.y*d,this.z=o*f+this.z*d,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this,r=i.x,n=i.y,o=i.z,s=i.w,a=t.x,u=t.y,h=t.z,l=s*a+n*h-o*u,c=s*u+o*a-r*h,f=s*h+r*u-n*a,d=-r*a-n*u-o*h,p=null!=e?e:t;return p.x=l*s+d*-r+c*-o-f*-n,p.y=c*s+d*-n+f*-r-l*-o,p.z=f*s+d*-o+l*-n-c*-r,p},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(w.ZERO,this,w.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}();Ze.tempVec0=new w;var qe=new Ze,Ke=function(){},Qe=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(Ke),Je=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=qe.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(Ke),$e=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var o=0;o<t.parentSpaceTransforms.length;o++){var s=t.parentSpaceTransforms[o],a=e.parentSpaceTransforms[o],u=r.parentSpaceTransforms[o],h=s.position,l=a.position,c=u.position;n.blendVector3(h,l,i,c);var f=s.rotation,d=a.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=s.scale,v=a.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=s.euler,x=a.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var E=t.floatPropertyValues[T],S=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,S,i)}for(var _=0;_<t.colorPropertyValues.length;_++){var C=t.colorPropertyValues[_],A=e.colorPropertyValues[_],w=r.colorPropertyValues[_];n.blendColor(C,A,i,w)}},t}();$e.normalBlendFunction=new Qe,$e.additiveBlendFunction=new Je;var ti=function(){function t(t){this.position=new w,this.rotation=new Ze,this.scale=new w,this.euler=new w,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),ei=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=o(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push((new ti).copyFrom(r))}for(var n,s=o(t.defaultFloatPropertyValues);!(n=s()).done;){var a=n.value;this.floatPropertyValues.push(a)}for(var u,h=o(t.defaultColorPropertyValues);!(u=h()).done;){var l=u.value;this.colorPropertyValues.push((new R).copyFrom(l))}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),ii=function(t){this.pose=new ei(t)};exports.ApplyAdditiveNodeData=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ri,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(De),exports.ApplyAdditiveNodeData=u([Oe(ce.ApplyAdditiveNodeData)],exports.ApplyAdditiveNodeData);var ri=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new ii(e.skeleton),this.additiveNodeResult=new ii(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){$e.additiveBlend(t,e,i,r)},e}(ke);exports.BlendNodeData=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ni,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(De),exports.BlendNodeData=u([Oe(ce.BlendNodeData)],exports.BlendNodeData);var ni=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).source0=null,e.source1=null,e.inputParameterValueNode=null,e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new ii(e.skeleton),this.source1Result=new ii(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){$e.localBlend(t,e,i,r)},e}(ke);exports.AndNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(oi,t),r=o(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(De),exports.AndNodeData=u([Oe(ce.AndNodeData)],exports.AndNodeData);var oi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=o(this.conditionNodes);!(e=i()).done;){if(!e.value.getValue(t)){this.result=!1;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=o(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=o(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(Be);exports.OrNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(si,t),r=o(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(De),exports.OrNodeData=u([Oe(ce.OrNodeData)],exports.OrNodeData);var si=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=o(this.conditionNodes);!(e=i()).done;){if(e.value.getValue(t)){this.result=!0;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=o(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=o(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(Be);exports.NotNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Le,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ai,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(De),exports.NotNodeData=u([Oe(ce.NotNodeData)],exports.NotNodeData);var ai=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.result=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}(Be);exports.ConstFloatNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ui,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(De),exports.ConstFloatNodeData=u([Oe(ce.ConstFloatNodeData)],exports.ConstFloatNodeData);var ui=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}return kt(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(Ue);exports.ConstBoolNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(hi,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(De),exports.ConstBoolNodeData=u([Oe(ce.ConstBoolNodeData)],exports.ConstBoolNodeData);var hi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}return kt(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(Be);exports.ControlParameterFloatNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(li,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(De),exports.ControlParameterFloatNodeData=u([Oe(ce.ControlParameterFloatNodeData)],exports.ControlParameterFloatNodeData);var li=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(Ue);exports.ControlParameterBoolNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ci,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(De),exports.ControlParameterBoolNodeData=u([Oe(ce.ControlParameterBoolNodeData)],exports.ControlParameterBoolNodeData);var ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(Be);exports.ControlParameterTriggerNodeData=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(fi,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(De),exports.ControlParameterTriggerNodeData=u([Oe(ce.ControlParameterTriggerNodeData)],exports.ControlParameterTriggerNodeData);var fi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}kt(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(Be);exports.LayerBlendNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNodeIndex=Le,e.layerDatas=[],e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(di,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=o(this.layerDatas);!(i=r()).done;){var n=i.value;e.layers.push({inputNode:t.getNode(n.inputNodeIndex),weightValueNode:t.getNode(n.weightValueNodeIndex),weight:0})}},i.load=function(e){var i;if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:Le,e.layerDatas)for(var r,n=o(e.layerDatas);!(r=n()).done;){var s=r.value;this.layerDatas.push(Xe({inputNodeIndex:Le,weightValueNodeIndex:Le},s))}},e}(De),exports.LayerBlendNodeData=u([Oe(ce.LayerBlendNodeData)],exports.LayerBlendNodeData);var di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseLayerNode=null,e.layers=[],e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new ii(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var r,n=o(this.layers);!(r=n()).done;){var s,a,u=r.value;null==(s=u.inputNode)||s.initialize(e),null==(a=u.weightValueNode)||a.initialize(e)}},i.shutdownInternal=function(e){var i;null==(i=this.baseLayerNode)||i.shutdown(e);for(var r,n=o(this.layers);!(r=n()).done;){var s,a,u=r.value;null==(s=u.inputNode)||s.shutdown(e),null==(a=u.weightValueNode)||a.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()?(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e),e):e},i.updateLayers=function(t,e){for(var i,r=o(this.layers);!(i=r()).done;){var n=i.value;if(n.inputNode&&n.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),n.inputNode.evaluate(t,this.layerNodeResult);var s=n.weightValueNode.getValue(t);$e.localBlend(e.pose,this.layerNodeResult.pose,s,e.pose)}}return e},e}(ke);exports.EqualNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Le,e.comparandValueNodeIndex=Le,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(mi,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(De),exports.EqualNodeData=u([Oe(ce.EqualNodeData)],exports.EqualNodeData);var pi,mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}(Be),vi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Le,e.comparandValueNodeIndex=Le,e}return kt(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(De);!function(t){t[t.GreaterThan=0]="GreaterThan",t[t.LessThan=1]="LessThan"}(pi||(pi={}));var yi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}kt(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}(Be);exports.GreaterNodeData=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.instantiate=function(t){var e=this.createNode(yi,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(vi),exports.GreaterNodeData=u([Oe(ce.GreaterNodeData)],exports.GreaterNodeData),exports.LessNodeData=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.instantiate=function(t){var e=this.createNode(yi,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(vi),exports.LessNodeData=u([Oe(ce.LessNodeData)],exports.LessNodeData),exports.StateMachineNodeData=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(xi,t),r=o(this.stateDatas);!(e=r()).done;){var n=e.value,s={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};i.states.push(s);for(var a,u=o(n.transitionDatas);!(a=u()).done;){var h=a.value,l={transitionNode:t.getNode(h.transitionNodeIndex),conditionNode:t.getNode(h.conditionNodeIndex),targetStateIndex:h.targetStateIndex};s.transitions.push(l)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex,this.machineName=e.machineName},e}(De),exports.StateMachineNodeData=u([Oe(ce.StateMachineNodeData)],exports.StateMachineNodeData);var gi,xi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).states=[],e.activeTransition=null,e.activeStateIndex=Le,e}kt(e,t);var i=e.prototype;return i.getCurrentStateName=function(){return this.states[this.activeStateIndex].stateNode.getNodeData().stateName},i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===Fe.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=Le,n=i.transitions.length,o=0;o<n;o++){var s=i.transitions[o];if(s.targetStateIndex===Le)throw new Error("Invalid target state index.");if(!this.states[s.targetStateIndex].stateNode.isTransitioning()){var a=!1;if(s.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>s.transitionNode.exitTime&&(a=!0)}else null!==s.conditionNode&&s.conditionNode.getValue(t)&&(a=!0);if(a){r=o;break}}}if(r!==Le){var h=i.transitions[r];h.transitionNode.initialize(t),e=null!==this.activeTransition?h.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):h.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=h.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=h.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.getNodeData().defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=Le,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=o(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=o(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(ke);exports.TransitionState=void 0,(gi=exports.TransitionState||(exports.TransitionState={}))[gi.None=0]="None",gi[gi.TransitioningIn=1]="TransitioningIn",gi[gi.TransitioningOut=2]="TransitioningOut",exports.StateNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNodeIndex=Le,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Ti,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex,this.stateName=e.stateName},e}(De),exports.StateNodeData=u([Oe(ce.StateNodeData)],exports.StateNodeData);var bi,Ti=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}kt(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(ke);exports.SourceType=void 0,(bi=exports.SourceType||(exports.SourceType={}))[bi.State=0]="State",bi[bi.Transition=1]="Transition",bi[bi.CachedPose=2]="CachedPose",exports.TransitionNodeData=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=Le,e}kt(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Si,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(De),exports.TransitionNodeData=u([Oe(ce.TransitionNodeData)],exports.TransitionNodeData);var Ei,Si=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).hasExitTime=!1,e.exitTime=.75,e.transitionLength=0,e.transitionProgress=0,e.blendWeight=0,e.sourceNode=null,e.sourceType=0,e.blendedDuration=0,e}kt(e,t);var i=e.prototype;return i.evaluate=function(t,e){K(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=C(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=Fe.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult),o=e;if(this.registerPoseTasksAndUpdateRootMotion(i,n,o),this.blendedDuration=_(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var s=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+s)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),o},i.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},i.getProgressPercentage=function(){return this.transitionProgress},i.getSourceType=function(){return this.sourceType},i.isSourceATransition=function(){return 1===this.sourceType},i.isSourceAState=function(){return 0===this.sourceType},i.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.getSourceStateNode=function(){return this.sourceNode},i.getSourceTransitionNode=function(){return this.sourceNode},i.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.sourceNodeResult=new ii(e.skeleton),this.targetNodeResult=new ii(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},i.shutdownInternal=function(e){this.targetNode.setTransitioningState(exports.TransitionState.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(e),this.sourceNode.shutdown(e),this.sourceNode=null),t.prototype.shutdownInternal.call(this,e)},i.endSourceTransition=function(t){var e,i=this.getSourceTransitionNode().targetNode;null==(e=this.sourceNode)||e.shutdown(t),this.sourceNode=i,this.sourceType=0,this.getSourceStateNode().setTransitioningState(exports.TransitionState.TransitioningOut)},i.initializeTargetStateAndUpdateTransition=function(t,e,i){var r=this;this.markNodeActive(t);var n=this.targetNodeResult;return 0===r.sourceType&&r.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),n=this.targetNode.evaluate(t,n),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,n,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=_(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},i.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=C(this.blendWeight,0,1))},i.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;$e.localBlend(t.pose,e.pose,r,i.pose)},e}(ke);!function(t){t[t.Float=0]="Float",t[t.Color=1]="Color"}(Ei||(Ei={}));var _i=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=o(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var s,a=o(e.rotation);!(s=a()).done;){var u=s.value;this.addReferenceTransform(u)}for(var h,l=o(e.scale);!(h=l()).done;){var c=h.value;this.addReferenceTransform(c)}for(var f,d=o(e.euler);!(f=d()).done;){var p=f.value;this.addReferenceTransform(p),this.useEuler=!0}for(var m=0;m<e.floats.length;m++){var v=e.floats[m];this.addRecordedProperty(v.path,v.className,v.property,0)}for(var y=0;y<e.colors.length;y++){var g=e.colors[y];this.addRecordedProperty(g.path,g.className,g.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new ti(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n=t+e+i;if(void 0===this.pathToObjectIndex.get(n)){var o=this.findTarget(t);if(o){var s;(s="VFXItem"===e?o:o.getComponent(Ce(e)))||console.error("The "+e+" Component was not found.");for(var a=i.split("."),u=a[a.length-1],h=s,l=0;l<a.length-1;l++){var c=h[a[l]];void 0===c&&console.error("The "+a[l]+" property of "+h+" was not found."),h=c}var f={target:s,propertyPath:i,directTarget:h,propertyName:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(n,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push((new R).copyFrom(h[u])),this.pathToObjectIndex.set(n,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=o(i);!(e=n()).done;){var s=e.value,a=r.find(s);if(!a)return null;r=a}return r},t}(),Ci=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.context=new Ge;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=o(t.graphDataSet.resources);!(i=n()).done;){var s=i.value;if(s){for(var a,u=o(s.positionCurves);!(a=u()).done;){var h=a.value;r.position.push(h.path)}for(var l,c=o(s.rotationCurves);!(l=c()).done;){var f=l.value;r.rotation.push(f.path)}for(var d,p=o(s.scaleCurves);!(d=p()).done;){var m=d.value;r.scale.push(m.path)}for(var v,y=o(s.eulerCurves);!(v=y()).done;){var g=v.value;r.euler.push(g.path)}for(var x,b=o(s.floatCurves);!(x=b()).done;){var T=x.value;r.floats.push(T)}for(var E,S=o(s.colorCurves);!(E=S()).done;){var _=E.value;r.colors.push(_)}}}this.skeleton=new _i(e,r),this.result=new ii(this.skeleton),this.context.skeleton=this.skeleton;var C=new je;C.nodes=this.nodes,C.nodeDatas=t.nodeDatas,C.dataSet=t.graphDataSet;for(var A=0;A<t.nodeDatas.length;A++)C.nodes[A]||t.nodeDatas[A].instantiate(C);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];s(i,fi)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.getStateMachineNode=function(t){for(var e,i=null,r=o(this.nodes);!(e=r()).done;){var n=e.value;s(n,xi)&&n.getNodeData().machineName===t&&(i=n)}return i},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),Le)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);i!==Le&&this.nodes[i].setValue(e)},t}();function Ai(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 wi(t,e,i){return e&&Ai(t.prototype,e),i&&Ai(t,i),t}var Mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}kt(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onDestroy=function(){},i.onApplyAnimationProperties=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&y(this.item.components,this),t.prototype.dispose.call(this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},wi(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(Re);u([we()],Mi.prototype,"item",void 0),u([we()],Mi.prototype,"_enabled",void 0);var Ri=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(Mi);exports.Animator=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).graphInstance=null,e.graphAsset=null,e}kt(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graphInstance&&this.graphInstance.setBool(t,e)},i.setFloat=function(t,e){this.graphInstance&&this.graphInstance.setFloat(t,e)},i.setTrigger=function(t){this.graphInstance&&this.graphInstance.setTrigger(t)},i.resetTrigger=function(t){this.graphInstance&&this.graphInstance.resetTrigger(t)},i.getStateMachineNode=function(t){var e=null;return this.graphInstance&&(e=this.graphInstance.getStateMachineNode(t)),e},i.onStart=function(){this.graphAsset&&(this.graphInstance=new Ci(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graphInstance){for(var e=this.graphInstance.evaluateGraph(t/1e3),i=this.graphInstance.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,o=e.pose.parentSpaceTransforms[r].rotation,a=e.pose.parentSpaceTransforms[r].scale,u=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(a.x,a.y,a.z),this.graphInstance.skeleton.useEuler?i[r].setRotation(u.x,u.y,u.z):i[r].setQuaternion(o.x,o.y,o.z,o.w)}for(var h=this.graphInstance.skeleton.floatAnimatedObjects,l=0;l<h.length;l++){var c=h[l],f=c.propertyName;c.directTarget[f]=e.pose.floatPropertyValues[l],s(c.target,Mi)&&c.target.onApplyAnimationProperties()}for(var d=this.graphInstance.skeleton.colorAnimatedObjects,p=0;p<d.length;p++){var m=d[p],v=m.propertyName;m.directTarget[v]=e.pose.colorPropertyValues[p],s(m.target,Mi)&&m.target.onApplyAnimationProperties()}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(Mi),exports.Animator=u([Ae("Animator")],exports.Animator);var Ii=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e._priority=0,e}kt(e,t);var i=e.prototype;return i.render=function(t){},i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},wi(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(Mi);u([we()],Ii.prototype,"materials",void 0),u([we()],Ii.prototype,"_priority",void 0);var Pi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).meshCollider=new bs,e.getHitTestParams=function(t){var i=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,i);var r=e.meshCollider.getBoundingBoxData();if(r)return{type:r.type,triangles:r.area}},e}kt(e,t);var i=e.prototype;return i.render=function(t){for(var e=0;e<this.materials.length;e++){var i=this.materials[e];t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),i,e)}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(Ii);u([we()],Pi.prototype,"geometry",void 0),exports.EffectComponent=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}kt(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new M;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(Pi),exports.EffectComponent=u([Ae(pe.EffectComponent)],exports.EffectComponent),exports.PostProcessVolume=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return kt(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(Mi),u([we()],exports.PostProcessVolume.prototype,"bloom",void 0),u([we()],exports.PostProcessVolume.prototype,"vignette",void 0),u([we()],exports.PostProcessVolume.prototype,"tonemapping",void 0),u([we()],exports.PostProcessVolume.prototype,"colorAdjustments",void 0),exports.PostProcessVolume=u([Ae(pe.PostProcessVolume)],exports.PostProcessVolume);var Oi=function(){function t(t,e,i,r,n,o,s,a,u,h,l,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,o,s,a,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,s,a,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=o,v[6]=s,v[7]=a,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,o,s,a,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=o,v[9]=s,v[13]=a,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),o=Math.sin(i),s=1-n,a=r.x,u=r.y,h=r.z,l=s*a,c=s*u;return this.set(l*a+n,l*u+o*h,l*h-o*u,0,l*u-o*h,c*u+n,c*h+o*a,0,l*h+o*u,c*h-o*a,s*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(w.ZERO,t,w.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,o=t.tempVec1,s=t.tempVec2;s.subtractVectors(e,i),s.normalize(),n.crossVectors(r,s),n.normalize(),o.crossVectors(s,n);var a=this.elements;return a[0]=n.x,a[1]=o.x,a[2]=s.x,a[3]=0,a[4]=n.y,a[5]=o.y,a[6]=s.y,a[7]=0,a[8]=n.z,a[9]=o.z,a[10]=s.z,a[11]=0,a[12]=-n.dot(e),a[13]=-o.dot(e),a[14]=-s.dot(e),a[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){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,o=i[0],s=i[4],a=i[8],u=i[12],h=i[1],l=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],E=r[4],S=r[8],_=r[12],C=r[1],A=r[5],w=r[9],M=r[13],R=r[2],I=r[6],P=r[10],O=r[14],N=r[3],F=r[7],L=r[11],V=r[15];return n[0]=o*T+s*C+a*R+u*N,n[4]=o*E+s*A+a*I+u*F,n[8]=o*S+s*w+a*P+u*L,n[12]=o*_+s*M+a*O+u*V,n[1]=h*T+l*C+c*R+f*N,n[5]=h*E+l*A+c*I+f*F,n[9]=h*S+l*w+c*P+f*L,n[13]=h*_+l*M+c*O+f*V,n[2]=d*T+p*C+m*R+v*N,n[6]=d*E+p*A+m*I+v*F,n[10]=d*S+p*w+m*P+v*L,n[14]=d*_+p*M+m*O+v*V,n[3]=y*T+g*C+x*R+b*N,n[7]=y*E+g*A+x*I+b*F,n[11]=y*S+g*w+x*P+b*L,n[15]=y*_+g*M+x*O+b*V,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],o=t[1],s=t[5],a=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*a*l-r*u*l-n*s*c+i*u*c+r*s*f-i*a*f)+t[7]*(+e*a*f-e*u*c+n*o*c-r*o*f+r*u*h-n*a*h)+t[11]*(+e*u*l-e*s*f-n*o*l+i*o*f+n*s*h-i*u*h)+t[15]*(-r*s*h-e*a*l+e*s*c+r*o*l-i*o*c+i*a*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],o=t[4],s=t[5],a=t[6],u=t[7],h=t[8],l=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=l*m*u-p*c*u+p*a*f-s*m*f-l*a*v+s*c*v,g=d*c*u-h*m*u-d*a*f+o*m*f+h*a*v-o*c*v,x=h*p*u-d*l*u+d*s*f-o*p*f-h*s*v+o*l*v,b=d*l*a-h*p*a-d*s*c+o*p*c+h*s*m-o*l*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=y*E,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*E,t[2]=(s*m*n-p*a*n+p*r*u-i*m*u-s*r*v+i*a*v)*E,t[3]=(l*a*n-s*c*n-l*r*u+i*c*u+s*r*f-i*a*f)*E,t[4]=g*E,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*E,t[6]=(d*a*n-o*m*n-d*r*u+e*m*u+o*r*v-e*a*v)*E,t[7]=(o*c*n-h*a*n+h*r*u-e*c*u-o*r*f+e*a*f)*E,t[8]=x*E,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*E,t[10]=(o*p*n-d*s*n+d*i*u-e*p*u-o*i*v+e*s*v)*E,t[11]=(h*s*n-o*l*n-h*i*u+e*l*u+o*i*f-e*s*f)*E,t[12]=b*E,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*E,t[14]=(d*s*r-o*p*r-d*i*a+e*p*a+o*i*m-e*s*m)*E,t[15]=(o*l*r-h*s*r+h*i*a-e*l*a-o*i*c+e*s*c)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=w.ZERO);var n=this.elements,o=e.x,s=e.y,a=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=o+o,d=s+s,p=a+a,m=o*f,v=o*d,y=o*p,g=s*d,x=s*p,b=a*p,T=u*f,E=u*d,S=u*p,_=i.x,C=i.y,A=i.z;return n[0]=(1-(g+b))*_,n[1]=(v+S)*_,n[2]=(y-E)*_,n[3]=0,n[4]=(v-S)*C,n[5]=(1-(m+b))*C,n[6]=(x+T)*C,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=h*n[0]+l*n[4]+c*n[8]-h+t.x,n[13]=h*n[1]+l*n[5]+c*n[9]-l+t.y,n[14]=h*n[2]+l*n[6]+c*n[10]-c+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,o=this.elements,s=n.set(o[0],o[1],o[2]).length(),a=n.set(o[4],o[5],o[6]).length(),u=n.set(o[8],o[9],o[10]).length();this.determinant()<0&&(s=-s),e.x=o[12],e.y=o[13],e.z=o[14];var h=t.tempMat0;h.copyFrom(this);var l=1/s,c=1/a,f=1/u;return h.elements[0]*=l,h.elements[1]*=l,h.elements[2]*=l,h.elements[4]*=c,h.elements[5]*=c,h.elements[6]*=c,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),r.x=s,r.y=a,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 w,e=new Ze,i=new w;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,o){var s=1/(e-t),a=1/(i-r),u=1/(o-n),h=-(e+t)*s,l=-(i+r)*a,c=-(o+n)*u;s*=2,a*=2,u*=-2;var f=this.elements;return f[0]=s,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=a,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=l,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var o=1/Math.tan(.5*t),s=1/(i-r),a=this.elements;return a[0]=n?o:o/e,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=n?o*e:o,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(r+i)*s,a[11]=-1,a[12]=0,a[13]=0,a[14]=2*r*i*s,a[15]=0,null!==r&&r!==1/0||(a[10]=-1,a[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,s=null!=e?e:t;s.x=o[0]*i+o[4]*r+o[8]*n+o[12],s.y=o[1]*i+o[5]*r+o[9]*n+o[13],s.z=o[2]*i+o[6]*r+o[10]*n+o[14];var a=o[3]*i+o[7]*r+o[11]*n+o[15];return s.multiply(1/a)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n+o[12],s.y=o[1]*i+o[5]*r+o[9]*n+o[13],s.z=o[2]*i+o[6]*r+o[10]*n+o[14],s},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[4]*r+o[8]*n,s.y=o[1]*i+o[5]*r+o[9]*n,s.z=o[2]*i+o[6]*r+o[10]*n,s.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,o=t.w,s=this.elements,a=null!=e?e:t;return a.x=s[0]*i+s[4]*r+s[8]*n+s[12]*o,a.y=s[1]*i+s[5]*r+s[9]*n+s[13]*o,a.z=s[2]*i+s[6]*r+s[10]*n+s[14]*o,a.w=s[3]*i+s[7]*r+s[11]*n+s[15]*o,a},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!S(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return(new t).lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,o){return(new t).perspective(e,i,r,n,o)},t.fromColumnVectors=function(e,i,r,n){return(new t).setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromScale=function(e,i,r){return(new t).setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return(new t).setFromTranslation(e,i,r)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return(new t).setFromRotationAxis(e,i)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,i,r){return(new t).setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return(new t).setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,o,s,a,u,h,l,c,f,d,p,m,v){return new t(e,o,h,d,i,s,l,p,r,a,c,m,n,u,f,v)},t}();function Ni(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 new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}function Fi(t){var i=t.getExtension("EXT_disjoint_timer_query_webgl2");if(i){var n=t.createQuery(),o=r((function(){return h(this,(function(r){return[2,new Promise((function(r,s){if(n){var a=t.getQueryParameter(n,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(i.GPU_DISJOINT_EXT);if(a&&!u){var h=t.getQueryParameter(n,t.QUERY_RESULT);r(h/1e3/1e3)}(a||u)&&(t.deleteQuery(n),n=null),null!==a&&n&&e.window.setTimeout((function(){o().then(r).catch}),1)}}))]}))}));if(!n)return;return{begin:function(){n&&t.beginQuery(i.TIME_ELAPSED_EXT,n)},end:function(){t.endQuery(i.TIME_ELAPSED_EXT)},getTime:o}}}Oi.IDENTITY=new Oi(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),Oi.ZERO=new Oi(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Oi.tempVec0=new w,Oi.tempVec1=new w,Oi.tempVec2=new w,Oi.tempMat0=new Oi;var Li,Vi,Di,ki,zi=[],Ui={},Bi="WebGL Constants not in global, please check your environment";function Gi(){"function"==typeof e.WebGL2RenderingContext?Xi(e.WebGL2RenderingContext):void 0!==e.WebGLRenderingContext?(Xi(e.WebGLRenderingContext),Xi(e.WebGLRenderingContext.prototype)):D?zi.push(k()?"iOS16 lockdown mode, WebGL Constants not in global":Bi):zi.push(Bi),zi.length||"HALF_FLOAT"in Ui||(Ui.HALF_FLOAT=5131)}function ji(t){return void 0!==e.WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function Xi(t){for(var e in t)/^[A-Z_]/.test(e)&&(Ui[e]=t[e])}function Hi(t){switch(t){case ve.Float32:return e.WebGLRenderingContext.FLOAT;case ve.Int16:return e.WebGLRenderingContext.SHORT;case ve.Int8:return e.WebGLRenderingContext.BYTE;case ve.UInt16:return e.WebGLRenderingContext.UNSIGNED_SHORT;case ve.UInt8:return e.WebGLRenderingContext.UNSIGNED_BYTE;default:return e.WebGLRenderingContext.FLOAT}}function Wi(t){switch(t){case _t.ALPHA:case _t.ADD:case _t.SUBTRACTION:case _t.STRONG_LIGHT:case _t.WEAK_LIGHT:return 1;case _t.SUPERPOSITION:return 2;case _t.BRIGHTNESS:return 3;case _t.MULTIPLY:return 0;default:return 1}}function Yi(t,e){switch(e){case void 0:case _t.ALPHA:t.blendFunction=[Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA,Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA];break;case _t.ADD:t.blendFunction=[Ui.ONE,Ui.ONE,Ui.ONE,Ui.ONE];break;case _t.SUBTRACTION:t.blendFunction=[Ui.ONE,Ui.ONE,Ui.ZERO,Ui.ONE],t.blendEquation=[Ui.FUNC_REVERSE_SUBTRACT,Ui.FUNC_REVERSE_SUBTRACT];break;case _t.SUPERPOSITION:t.blendFunction=[Ui.ONE,Ui.ONE,Ui.ONE,Ui.ONE];break;case _t.MULTIPLY:t.blendFunction=[Ui.DST_COLOR,Ui.ONE_MINUS_SRC_ALPHA,Ui.DST_COLOR,Ui.ONE_MINUS_SRC_ALPHA];break;case _t.BRIGHTNESS:t.blendFunction=[Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA,Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA];break;case _t.STRONG_LIGHT:t.blendFunction=[Ui.DST_COLOR,Ui.DST_ALPHA,Ui.ZERO,Ui.ONE];break;case _t.WEAK_LIGHT:t.blendFunction=[Ui.DST_COLOR,Ui.ZERO,Ui.ZERO,Ui.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Zi(t,e){e===Ct.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=Ui.CW,t.cullFace=e===Ct.BACK?Ui.BACK:Ui.FRONT)}function qi(t,e){switch(e){case void 0:t.stencilTest=!1;break;case exports.MaskMode.MASK:t.stencilTest=!0,t.stencilFunc=[Ui.ALWAYS,Ui.ALWAYS],t.stencilOpZPass=[Ui.REPLACE,Ui.REPLACE];break;case exports.MaskMode.OBSCURED:t.stencilTest=!0,t.stencilFunc=[Ui.EQUAL,Ui.EQUAL];break;case exports.MaskMode.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[Ui.NOTEQUAL,Ui.NOTEQUAL];break;case exports.MaskMode.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}zi.length||Gi(),exports.ShaderType=void 0,(Li=exports.ShaderType||(exports.ShaderType={}))[Li.vertex=0]="vertex",Li[Li.fragment=1]="fragment",exports.MaskMode=void 0,(Vi=exports.MaskMode||(exports.MaskMode={}))[Vi.NONE=0]="NONE",Vi[Vi.MASK=1]="MASK",Vi[Vi.OBSCURED=2]="OBSCURED",Vi[Vi.REVERSE_OBSCURED=3]="REVERSE_OBSCURED",exports.TextureLoadAction=void 0,(Di=exports.TextureLoadAction||(exports.TextureLoadAction={}))[Di.whatever=0]="whatever",Di[Di.clear=2]="clear",exports.TextureSourceType=void 0,(ki=exports.TextureSourceType||(exports.TextureSourceType={}))[ki.none=0]="none",ki[ki.data=1]="data",ki[ki.image=2]="image",ki[ki.compressed=3]="compressed",ki[ki.video=4]="video",ki[ki.canvas=5]="canvas",ki[ki.framebuffer=6]="framebuffer",ki[ki.mipmaps=7]="mipmaps";var Ki=function(){function t(){this.callbacks={}}var i=t.prototype;return i.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},i.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},i.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},i.download=function(i,r,n,o){var s=this;if(void 0===r&&(r="json"),!this.start(i,n,o)){var a=new e.XMLHttpRequest,u=function(){s.finish(i,a.status,a.response)};a.responseType=r,a.addEventListener("load",(function(){200==a.status||0==a.status&&t.trustXHRStatusZero?s.finish(i,200,a.response):u()})),a.addEventListener("error",u),a.open("GET",i,!0),a.send()}},i.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},i.finish=function(e,i,r){var n=this.callbacks[e];delete this.callbacks[e];for(var o=200==i||0==i&&t.trustXHRStatusZero?[r]:[i,r],s=o.length-1,a=n.length;s<a;s+=2)n[s].apply(null,o)},t}();Ki.trustXHRStatusZero=!1;var Qi=!1,Ji=!1;function $i(t,e){return tr.apply(this,arguments)}function tr(){return(tr=r((function(t,e){return h(this,(function(i){switch(i.label){case 0:return!Qi&&e?[3,2]:[4,rr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Qi=!0,[4,rr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function er(t,e){return ir.apply(this,arguments)}function ir(){return(ir=r((function(t,e){return h(this,(function(i){switch(i.label){case 0:return!Ji&&e?[3,2]:[4,rr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,rr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Ji=!0,[4,rr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function rr(t){return nr.apply(this,arguments)}function nr(){return(nr=r((function(t){var i,r;return h(this,(function(n){if(i="",s(t,e.HTMLImageElement)){if(t.complete)return[2,t];i=t.src}else s(t,e.Blob)?(i=e.URL.createObjectURL(t),r=!0):"string"==typeof t&&(i=t);if(!i)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,n){var o=new e.Image;/^data:/.test(i)||(o.crossOrigin="*"),o.onload=function(){return o.onload=null,r&&e.URL.revokeObjectURL(i),t(o)},o.onerror=function(t){return o.onerror=null,r&&e.URL.revokeObjectURL(i),n("Load image fail: "+i+", reason: "+JSON.stringify(t))},o.src=i}))]}))}))).apply(this,arguments)}function or(t){return sr.apply(this,arguments)}function sr(){return(sr=r((function(t){return h(this,(function(e){return[2,new Promise((function(e,i){(new Ki).downloadBinary(t,e,(function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function ar(){return(ar=r((function(t){return h(this,(function(e){return[2,new Promise((function(e,i){(new Ki).downloadBlob(t,e,(function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function ur(t){return hr.apply(this,arguments)}function hr(){return(hr=r((function(t){var i;return h(this,(function(r){return i=e.document.createElement("video"),"string"==typeof t?i.src=t:i.srcObject=t,i.crossOrigin="anonymous",i.muted=!0,z()&&i.setAttribute("renderer","standard"),i.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var r=i.play().catch((function(t){e(t)}));r?r.then((function(){return t(i)})):i.addEventListener("loadeddata",(function e(){t(i),i.removeEventListener("loadeddata",e)}),!0),i.addEventListener("error",(function(t){e("Load video fail.")}))}))]}))}))).apply(this,arguments)}function lr(t,e){return cr.apply(this,arguments)}function cr(){return(cr=r((function(t,e){return h(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:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 4:return[2,i.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function fr(t,e,i){return dr.apply(this,arguments)}function dr(){return(dr=r((function(t,e,i,r){var n,o,s,a,u,l,c,f,d;return h(this,(function(h){switch(h.label){case 0:return void 0===r&&(r=[]),34067!==t.target?[3,2]:(n=t.mipmaps,o=t.target,s=n.map((function(t){return Promise.all(t.map((function(t){return t.id?i[t.id]:pr(t,e)})))})),[4,Promise.all(s)]);case 1:return a=h.sent(),[2,Xe({keepImageSource:!1},t,{mipmaps:a,sourceFrom:{target:o,type:exports.TextureSourceType.mipmaps}})];case 2:return u=t.mipmaps,l=t.target,c=u.map((function(t){return pr(t,e)})),[4,Promise.all(c)];case 3:return f=h.sent(),d=r[u[0][1][0]].url,[2,Xe({keepImageSource:!1},t,{mipmaps:f,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{target:l,bin:d,type:exports.TextureSourceType.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function pr(t,e){return mr.apply(this,arguments)}function mr(){return mr=r((function(t,i){var r,n,o,s,a;return h(this,(function(u){if(r=t[1],n=r[0],o=r[1],s=r[2],!(a=i[n]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,rr(new e.Blob([new Uint8Array(a,o,s)]))]}))})),mr.apply(this,arguments)}var vr=1,yr=function(t){function e(e){var i;return(i=t.call(this,e)||this).destroyed=!1,i.id="Tex"+vr++,i}kt(e,t);var i=e.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(t){var e=t.target,i=void 0===e?Ui.TEXTURE_2D:e,r=t.format,n=void 0===r?Ui.RGBA:r;return t.sourceType||(t.sourceType="image"in t?exports.TextureSourceType.image:"data"in t?exports.TextureSourceType.data:"video"in t?exports.TextureSourceType.video:0),Xe({minFilter:Ui.NEAREST,magFilter:Ui.NEAREST,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE,target:i,format:Ui.RGBA,internalFormat:n,type:Ui.UNSIGNED_BYTE},t)},e.fromImage=function(t,i,n){return r((function(){var r,o;return h(this,(function(s){switch(s.label){case 0:return[4,rr(t)];case 1:return r=s.sent(),(o=e.create(i,Xe({sourceType:exports.TextureSourceType.image,image:r,target:Ui.TEXTURE_2D,id:ft(),flipY:!0},n))).initialize(),[2,o]}}))}))()},e.fromVideo=function(t,i,n){return r((function(){var r,o;return h(this,(function(s){switch(s.label){case 0:return[4,ur(t)];case 1:return r=s.sent(),(o=e.create(i,Xe({sourceType:exports.TextureSourceType.video,video:r,id:ft(),flipY:!0},n))).initialize(),[2,o]}}))}))()},wi(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Re);function gr(t,e,i,r){var n,o,s=e.length/i/r;return o=n=4===s||0===s?Ui.RGBA:3===s?Ui.RGB:2===s?Ui.LUMINANCE_ALPHA:Ui.LUMINANCE,yr.createWithData(t,{data:e,width:i,height:r},{type:Ui.HALF_FLOAT,format:n,internalFormat:o,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE})}var xr={type:Ui.UNSIGNED_BYTE,format:Ui.RGBA,internalFormat:Ui.RGBA,wrapS:Ui.MIRRORED_REPEAT,wrapT:Ui.MIRRORED_REPEAT,minFilter:Ui.NEAREST,magFilter:Ui.NEAREST};function br(t){return yr.create(t,Xe({id:xe.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:exports.TextureSourceType.data},xr))}function Tr(t){return yr.create(t,Xe({id:xe.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:exports.TextureSourceType.data},xr))}var Er=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 new Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),s=67305985===o.getUint32(0,!0);this.glType=o.getUint32(1*n,s),this.glTypeSize=o.getUint32(2*n,s),this.glFormat=o.getUint32(3*n,s),this.glInternalFormat=o.getUint32(4*n,s),this.glBaseInternalFormat=o.getUint32(5*n,s),this.pixelWidth=o.getUint32(6*n,s),this.pixelHeight=o.getUint32(7*n,s),this.pixelDepth=o.getUint32(8*n,s),this.numberOfArrayElements=o.getUint32(9*n,s),this.numberOfFaces=o.getUint32(10*n,s),this.numberOfMipmapLevels=o.getUint32(11*n,s),this.bytesOfKeyValueData=o.getUint32(12*n,s),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:it.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+"."):it.warn("Texture arrays not currently supported."):it.warn("Only 2D textures currently supported.")}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,s=0;s<o;s++){for(var a=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,a);e.push({data:h,width:r,height:n}),i+=a+4,i+=3-(a+3)%4}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function Sr(t){var e=new Er(t,1),i=e.numberOfMipmapLevels,r=e.pixelWidth,n=e.pixelHeight,o=e.glType,s=e.numberOfFaces,a=e.glInternalFormat,u=e.glFormat,h=i>=Math.floor(Math.log2(Math.max(r,n))+1);return{sourceType:exports.TextureSourceType.compressed,type:o,target:6===s?Ui.TEXTURE_CUBE_MAP:Ui.TEXTURE_2D,internalFormat:a,format:u,mipmaps:e.mipmaps(h)}}var _r,Cr=function(){function t(){this.reloadPending={}}var i=t.prototype;return i.reload=function(t){var e=this;return r((function(){var i,r;return h(this,(function(n){switch(n.label){case 0:return i=t.id,e.reloadPending[i]?[2]:t.sourceFrom?(e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},i.canOffloadTexture=function(t){if(t){var e=t.type;if(e===exports.TextureSourceType.compressed||e===exports.TextureSourceType.image){var i=t.target,r=t.map,n=t.url;return i===Ui.TEXTURE_CUBE_MAP?"object"==typeof r&&!!r:nt(n)&&n.length>0}if(e===exports.TextureSourceType.mipmaps){var o=t.bin,s=t.mipmaps,a=t.target,u=t.maps,h=t.urls;return o?s.length>0:a===Ui.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return nt(t)&&t.length>0}))}}return!1},i.loadSource=function(t,e){var i=this;return r((function(){var r,n,o,s,a,u,l,c,f,d,p,m,v,y,g,x,b;return h(this,(function(h){switch(h.label){case 0:return r=t.type,n=t.target,o=t.map,s=t.url,a=t.bin,u=t.mipmaps,l=t.urls,c=t.maps,n!==Ui.TEXTURE_CUBE_MAP||r===exports.TextureSourceType.mipmaps?[3,2]:[4,i.loadCubeMap(o)];case 1:return f=h.sent(),[2,Xe({},e,{cube:f,target:Ui.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.image,sourceFrom:{type:exports.TextureSourceType.image,map:Xe({},o),target:Ui.TEXTURE_CUBE_MAP}})];case 2:return r!==exports.TextureSourceType.image?[3,4]:[4,rr(s)];case 3:return d=h.sent(),[2,Xe({},e,{image:d,sourceType:exports.TextureSourceType.image,sourceFrom:{type:r,url:s,target:Ui.TEXTURE_2D}})];case 4:return r!==exports.TextureSourceType.video?[3,6]:[4,ur(s)];case 5:return p=h.sent(),[2,Xe({},e,{video:p,sourceType:exports.TextureSourceType.video})];case 6:return r!==exports.TextureSourceType.compressed?[3,8]:[4,or(s)];case 7:return[2,Xe({},Sr(h.sent()),e,{sourceFrom:{url:s,type:exports.TextureSourceType.compressed}})];case 8:return r!==exports.TextureSourceType.mipmaps?[3,17]:a?[4,or(a)]:[3,13];case 9:return m=h.sent(),v=null!=n?n:Ui.TEXTURE_2D,y=v===Ui.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==Ui.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(u.map((function(t){return i.loadMipmapImages(t,m)})))];case 10:return g=h.sent(),[3,12];case 11:g=i.loadMipmapImages(u,m),h.label=12;case 12:return[2,Xe({},e,{mipmaps:g,target:v,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{bin:a,mipmaps:y,target:v,type:exports.TextureSourceType.mipmaps}})];case 13:return n!==Ui.TEXTURE_2D&&n?[3,15]:[4,Promise.all(l.map((function(t){return rr(t)})))];case 14:return x=h.sent(),[2,Xe({},e,{mipmaps:x,target:Ui.TEXTURE_2D,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:r,urls:l.slice(),target:Ui.TEXTURE_2D}})];case 15:return n!==Ui.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(c.map((function(t){return i.loadCubeMap(t)})))];case 16:return b=h.sent(),[2,Xe({},e,{mipmaps:b,target:Ui.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:r,maps:c.map((function(t){return Xe({},t)})),target:Ui.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: "+r+".")}}))}))()},i.loadMipmapImages=function(t,i){return r((function(){return h(this,(function(r){return[2,Promise.all(t.map((function(t){return rr(new e.Blob([new Uint8Array(i,t[0],t[1])]))})))]}))}))()},i.loadCubeMap=function(t){return r((function(){return h(this,(function(e){return[2,Promise.all(t.map((function(t){return rr(t)})))]}))}))()},t}();function Ar(){return _r||(_r=new Cr),_r}var wr,Mr=function(){function t(t){this.destroyed=!1;var e=t.name,i=void 0===e?"defaultDataBlock":e;this.name=i}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(i){e.setUniformValue(i,t[i])}))},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function Rr(t){return"object"==typeof t&&t&&void 0===t.length&&s(t,yr)}exports.MaterialRenderType=void 0,(wr=exports.MaterialRenderType||(exports.MaterialRenderType={}))[wr.normal=0]="normal",wr[wr.transformFeedback=1]="transformFeedback";var Ir,Pr,Or=1,Nr=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,o=void 0===n?"Material"+Or++:n,s=i.renderType,a=void 0===s?0:s,u=i.shader;r.name=o,r.renderType=a,r.shaderSource=u,r.props=i}else r.name="Material"+Or++,r.renderType=0;return r}kt(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},wi(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(Re),Fr=function(){function t(t){this.engine=t,this.alphaMaskEnabled=!1,this.maskMode=exports.MaskMode.NONE,this.maskable=null,this.stencilClearAction={stencilAction:exports.TextureLoadAction.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.setMaskOptions=function(t){var e=t.isMask,i=void 0!==e&&e,r=t.inverted,n=void 0!==r&&r,o=t.reference,s=t.alphaMaskEnabled,a=void 0!==s&&s;this.alphaMaskEnabled=a,i?this.maskMode=exports.MaskMode.MASK:(this.maskMode=n?exports.MaskMode.REVERSE_OBSCURED:exports.MaskMode.OBSCURED,this.maskable=this.engine.findObject(o))},e.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},t}();exports.ShaderCompileResultStatus=void 0,(Ir=exports.ShaderCompileResultStatus||(exports.ShaderCompileResultStatus={}))[Ir.noShader=0]="noShader",Ir[Ir.success=1]="success",Ir[Ir.fail=2]="fail",Ir[Ir.compiling=3]="compiling",exports.GLSLVersion=void 0,(Pr=exports.GLSLVersion||(exports.GLSLVersion={})).GLSL1="100",Pr.GLSL3="300 es";var Lr=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return kt(e,t),e}(Re);exports.Shader=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=o(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}(Re),exports.Shader=u([Ae(pe.Shader)],exports.Shader);var Vr="effects-internal-copy",Dr="effects-internal-copy-mesh",kr="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",zr="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function Ur(t,e){return{name:Vr,vertex:kr,fragment:zr,glslVersion:2===t?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!e]],cacheId:Dr+ +e}}var Br,Gr,jr={format:Ui.RGBA,type:Ui.UNSIGNED_BYTE,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE},Xr=Symbol("dispose"),Hr=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,i=t.width,r=t.height,n=t.name,o={sourceType:exports.TextureSourceType.framebuffer,data:{width:i,height:r},name:n},s=[n];Object.getOwnPropertyNames(jr).forEach((function(e){var i,r=null!=(i=t[e])?i:jr[e];o[e]=r,s.push(e,r)}));var a=s.join(":"),u=this.textureCache[a];if(u)this.textureRef[a]++;else{var h=this.engine;K(h),u=yr.create(h,o),this.textureCache[a]=u,this.textureRef[a]=1,u[Xr]=u.dispose,u.dispose=function(){return e.removeTexture(a)}}return u},e.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[Xr](),i.dispose=i[Xr]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var i=t.textureCache[e];i[Xr](),i.dispose=i[Xr]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Wr=function(){function t(t){void 0===t&&(t={}),this.semantics=Xe({},t)}var e=t.prototype;return e.toObject=function(){return Xe({},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 st(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}(),Yr=((Br={})[Ui.FLOAT]=Float32Array.BYTES_PER_ELEMENT,Br[Ui.INT]=Int32Array.BYTES_PER_ELEMENT,Br[Ui.SHORT]=Int16Array.BYTES_PER_ELEMENT,Br[Ui.BYTE]=Int8Array.BYTES_PER_ELEMENT,Br),Zr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}kt(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(Re);function qr(t){return t===Ui.INT?new Int32Array(0):t===Ui.SHORT?new Int16Array(0):new Float32Array(0)}!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"}(Gr||(Gr={}));var Kr=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],o=i[8],s=i[1],a=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case Gr.XYZ:this.y=Math.asin(C(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,a),this.z=0);break;case Gr.YXZ:this.x=Math.asin(-C(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(o,c),this.z=Math.atan2(s,a)):(this.y=Math.atan2(-h,r),this.z=0);break;case Gr.ZXY:this.x=Math.asin(C(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,a)):(this.y=0,this.z=Math.atan2(s,r));break;case Gr.ZYX:this.y=Math.asin(-C(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(l,c),this.z=Math.atan2(s,r)):(this.x=0,this.z=Math.atan2(-n,a));break;case Gr.YZX:this.z=Math.asin(C(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,a),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(o,c));break;case Gr.XZY:this.z=Math.asin(-C(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(l,a),this.y=Math.atan2(o,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=T,this.y*=T,this.z*=T,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,o,s;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(o=t[e+2])?o:0,this.order=null!=(s=t[e+3])?s: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):(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):(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 Ze;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,i=e.x,r=e.y,n=e.z,o=e.order,s=Math.cos(i*b*.5),a=Math.cos(r*b*.5),u=Math.cos(n*b*.5),h=Math.sin(i*b*.5),l=Math.sin(r*b*.5),c=Math.sin(n*b*.5);switch(o){case Gr.XYZ:t.set(h*a*u+s*l*c,s*l*u-h*a*c,s*a*c+h*l*u,s*a*u-h*l*c);break;case Gr.YXZ:t.set(h*a*u+s*l*c,s*l*u-h*a*c,s*a*c-h*l*u,s*a*u+h*l*c);break;case Gr.ZXY:t.set(h*a*u-s*l*c,s*l*u+h*a*c,s*a*c+h*l*u,s*a*u-h*l*c);break;case Gr.ZYX:t.set(h*a*u-s*l*c,s*l*u+h*a*c,s*a*c-h*l*u,s*a*u+h*l*c);break;case Gr.YZX:t.set(h*a*u+s*l*c,s*l*u+h*a*c,s*a*c-h*l*u,s*a*u-h*l*c);break;case Gr.XZY:t.set(h*a*u-s*l*c,s*l*u-h*a*c,s*a*c+h*l*u,s*a*u+h*l*c);break;default:console.error("unknown euler order: "+o)}return t},e.toMatrix4=function(t){var e=t.elements,i=this,r=i.x,n=i.y,o=i.z,s=i.order,a=Math.cos(r*b),u=Math.sin(r*b),h=Math.cos(n*b),l=Math.sin(n*b),c=Math.cos(o*b),f=Math.sin(o*b);if(s===Gr.XYZ){var d=a*c,p=a*f,m=u*c,v=u*f;e[0]=h*c,e[4]=-h*f,e[8]=l,e[1]=p+m*l,e[5]=d-v*l,e[9]=-u*h,e[2]=v-d*l,e[6]=m+p*l,e[10]=a*h}else if(s===Gr.YXZ){var y=h*c,g=h*f,x=l*c,T=l*f;e[0]=y+T*u,e[4]=x*u-g,e[8]=a*l,e[1]=a*f,e[5]=a*c,e[9]=-u,e[2]=g*u-x,e[6]=T+y*u,e[10]=a*h}else if(s===Gr.ZXY){var E=h*c,S=h*f,_=l*c,C=l*f;e[0]=E-C*u,e[4]=-a*f,e[8]=_+S*u,e[1]=S+_*u,e[5]=a*c,e[9]=C-E*u,e[2]=-a*l,e[6]=u,e[10]=a*h}else if(s===Gr.ZYX){var A=a*c,w=a*f,M=u*c,R=u*f;e[0]=h*c,e[4]=M*l-w,e[8]=A*l+R,e[1]=h*f,e[5]=R*l+A,e[9]=w*l-M,e[2]=-l,e[6]=u*h,e[10]=a*h}else if(s===Gr.YZX){var I=a*h,P=a*l,O=u*h,N=u*l;e[0]=h*c,e[4]=N-I*f,e[8]=O*f+P,e[1]=f,e[5]=a*c,e[9]=-u*c,e[2]=-l*c,e[6]=P*f+O,e[10]=I-N*f}else if(s===Gr.XZY){var F=a*h,L=a*l,V=u*h,D=u*l;e[0]=h*c,e[4]=-f,e[8]=l*c,e[1]=F*f+D,e[5]=a*c,e[9]=L*f-V,e[2]=V*f-L,e[6]=u*c,e[10]=D*f+F}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}();Kr.DEFAULT_ORDER=Gr.ZYX,Kr.tempQuat0=new Ze,Kr.tempMat0=new Oi;var Qr=function(){function t(t,e,i,r,n,o,s,a,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,o,s,a,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,o,s,a,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=s,h[1]=e,h[4]=n,h[7]=a,h[2]=i,h[5]=o,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,o,s,a,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=o,h[2]=s,h[5]=a,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,o=e+e,s=i+i,a=r+r,u=e*o,h=e*s,l=e*a,c=i*s,f=i*a,d=r*a,p=n*o,m=n*s,v=n*a,y=this.elements;return y[0]=1-(c+d),y[1]=h+v,y[2]=l-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=l+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],o=r[3],s=r[6],a=r[1],u=r[4],h=r[7];return r[0]=e*n+i*a,r[3]=e*o+i*u,r[6]=e*s+i*h,r[1]=-i*n+e*a,r[4]=-i*o+e*u,r[7]=-i*s+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,o=i[0],s=i[3],a=i[6],u=i[1],h=i[4],l=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],E=r[8];return n[0]=o*p+s*y+a*b,n[3]=o*m+s*g+a*T,n[6]=o*v+s*x+a*E,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*E,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],o=t[4],s=t[7],a=t[2],u=t[5],h=t[8];return e*(o*h-u*s)+n*(u*r-i*h)+a*(i*s-o*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],o=t[4],s=t[7],a=t[2],u=t[5],h=t[8],l=h*o-u*s,c=u*r-h*i,f=s*i-o*r,d=e*l+n*c+a*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(a*s-h*n)*p,t[2]=(u*n-a*o)*p,t[3]=c*p,t[4]=(h*e-a*r)*p,t[5]=(a*i-u*e)*p,t[6]=f*p,t[7]=(n*r-s*e)*p,t[8]=(o*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,o=this.elements,s=null!=e?e:t;return s.x=o[0]*i+o[3]*r+o[6]*n,s.y=o[1]*i+o[4]*r+o[7]*n,s.z=o[2]*i+o[5]*r+o[8]*n,s},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(!S(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return(new t).setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,o,s,a,u,h){return new t(e,n,a,i,o,u,r,s,h)},t}(),Jr=function(){function t(t,e){void 0===t&&(t=w.ZERO),void 0===e&&(e=w.X),this.origin=new w,this.direction=new w,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 w;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,o,s,a,u=this.origin,h=u.x,l=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,E=b.y,S=b.z,_=1/d,C=1/p,A=1/m;if(_>=0?(i=(y-h)*_,r=(T-h)*_):(i=(T-h)*_,r=(y-h)*_),C>=0?(n=(g-l)*C,o=(E-l)*C):(n=(E-l)*C,o=(g-l)*C),!(i>o||n>r||((n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),(n>i||i!=i)&&(i=n),(o<r||r!=r)&&(r=o),A>=0?(s=(x-c)*A,a=(S-c)*A):(s=(S-c)*A,a=(x-c)*A),i>a||s>r||((s>i||i!=i)&&(i=s),(a<r||r!=r)&&(r=a),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 w).copyFrom(this.origin):void 0;var o=-(this.origin.dot(i)+r)/n;return o>=0?this.at(o,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),o=n.dot(this.direction),s=n.dot(n)-o*o,a=e.radius*e.radius;if(!(s>a)){var u=Math.sqrt(a-s),h=o-u,l=o+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}},e.intersectTriangle=function(e,i,r){var n,o=e.p0,s=e.p1,a=e.p2,u=t.tempVec0.subtractVectors(s,o),h=t.tempVec1.subtractVectors(a,o),l=t.tempVec2.subtractVectors(this.origin,o),c=t.tempVec3.crossVectors(u,h),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(l,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(l);var p=n*this.direction.dot(u);if(!(p<0||d+p>f)){var m=-n*l.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();Jr.tempVec0=new w,Jr.tempVec1=new w,Jr.tempVec2=new w,Jr.tempVec3=new w;var $r,tn,en=function(){function t(t,e){void 0===t&&(t=new w(1/0,1/0,1/0)),void 0===e&&(e=new w(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,o=-1/0,s=-1/0,a=0,u=t.length;a<u;a+=3){var h=t[a],l=t[a+1],c=t[a+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>o&&(o=l),c>s&&(s=c)}return this.min.set(e,i,r),this.max.set(n,o,s),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 w),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 w),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,o=0,s=n.length;o<s;o++)this.expandByObject(n[o]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new w),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 w;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 w),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 w),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 w),this.isEmpty())return[];var i=[];return i[0]=new w(this.min.x,this.min.y,this.min.z),i[1]=new w(this.min.x,this.min.y,this.max.z),i[2]=new w(this.min.x,this.max.y,this.min.z),i[3]=new w(this.min.x,this.max.y,this.max.z),i[4]=new w(this.max.x,this.min.y,this.min.z),i[5]=new w(this.max.x,this.min.y,this.max.z),i[6]=new w(this.max.x,this.max.y,this.min.z),i[7]=new w(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 w;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}(),rn=function(){function t(t,e){void 0===t&&(t=w.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var o=(new en).setFromPoints(t);o.getCenter(i),this.radius=o.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new w),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 en),this.isEmpty()?(t.makeEmpty(),t):(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],o=Math.sqrt(Math.max(i,r,n));return this.center.applyMatrix(t),this.radius=this.radius*o,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new w).subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=.5*(r-this.radius);this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new w,i=new w;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 w).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}(),nn=Object.freeze({__proto__:null,get EulerOrder(){return Gr},Euler:Kr,Quaternion:Ze,Vector2:A,Vector3:w,Vector4:M,Matrix3:Qr,Matrix4:Oi,Ray:Jr,PI2:x,DEG2RAD:b,RAD2DEG:T,NumberEpsilon:E,isZero:function(t){return isNaN(t)||Math.abs(t)<E},isEqual:S,damp:function(t,e,i,r){return _(t,e,1-Math.exp(-i*r))},lerp:_,degToRad:function(t){return t*b},radToDeg:function(t){return t*T},clamp:C,Color:R,Box3:en,Sphere:rn}),on=1,sn=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).destroyed=!1,r.visible=!0,i){var n=i.material,o=i.geometry,s=i.name,a=void 0===s?"<unnamed>":s,u=i.priority,h=void 0===u?0:u,l=i.worldMatrix,c=void 0===l?Oi.fromIdentity():l;r.id="Mesh"+on++,r.name=a,r.geometry=o,r.material=n,r.priority=h,r.worldMatrix=c}else r.id="Mesh"+on++,r.name="<unnamed>",r.worldMatrix=Oi.fromIdentity(),r._priority=0;return r}kt(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){this.isDestroyed||this.getVisible()&&t.drawGeometry(this.geometry,this.worldMatrix,this.material)},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(t,e){e!==exports.DestroyOptions.keep&&this.material.dispose(),this.material=t},i.restore=function(){},i.dispose=function(e){this.destroyed||((null==e?void 0:e.geometries)!==exports.DestroyOptions.keep&&this.geometry.dispose(),(null==e?void 0:e.material)!==exports.DestroyOptions.keep&&this.material.dispose(),this.destroyed=!0,void 0!==this.engine&&this.engine.removeMesh(this),t.prototype.dispose.call(this))},wi(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Ii),an=1e3;exports.RenderPassAttachmentStorageType=void 0,($r=exports.RenderPassAttachmentStorageType||(exports.RenderPassAttachmentStorageType={}))[$r.none=0]="none",$r[$r.color=1]="color",$r[$r.stencil_8_opaque=2]="stencil_8_opaque",$r[$r.depth_16_opaque=3]="depth_16_opaque",$r[$r.depth_stencil_opaque=4]="depth_stencil_opaque",$r[$r.depth_16_texture=5]="depth_16_texture",$r[$r.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",exports.TextureStoreAction=void 0,(tn=exports.TextureStoreAction||(exports.TextureStoreAction={}))[tn.store=0]="store",tn[tn.clear=2]="clear";var un,hn=function(){function t(t,e){if(this.destroyed=!1,e){var i=e.texture,r=e.size;if(s(i,yr))this.texture=i,this.externalTexture=!0;else if(i){var n=i.wrapT,o=i.wrapS,a=i.minFilter,u=i.magFilter,h=i.internalFormat,l=i.format,c=void 0===l?Ui.RGBA:l,f=i.type,d=void 0===f?Ui.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:r,format:c,type:d,internalFormat:h||c,wrapT:n,wrapS:o,minFilter:a,magFilter:u,name:e.name},this.texture=yr.create(t,Xe({},this.textureOptions,{sourceType:exports.TextureSourceType.framebuffer,data:{width:r[0],height:r[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},wi(t,[{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}}]),t}();exports.RenderPassDestroyAttachmentType=void 0,(un=exports.RenderPassDestroyAttachmentType||(exports.RenderPassDestroyAttachmentType={}))[un.force=0]="force",un[un.keep=1]="keep",un[un.keepExternal=2]="keepExternal",un[un.destroy=0]="destroy";var ln=1,cn=function(){function t(t,e){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=e.name,r=void 0===i?"RenderPass_"+ln++:i,n=e.clearAction,o=e.semantics,s=e.depthStencilAttachment,a=e.storeAction,u=e.priority,h=void 0===u?0:u,l=e.meshOrder,c=void 0===l?exports.OrderType.ascending:l,f=e.meshes,d=void 0===f?[]:f,p=e.delegate,m=void 0===p?{}:p;this.name=r,this.renderer=t,this.priority=h,this.meshOrder=c,this.meshes=W(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=Xe({},n),this.storeAction=Xe({colorAction:0,depthAction:0,stencilAction:0},a),this.semantics=new Wr(o),this.options=e,this.delegate=m,this.setViewportOptions(e)}var e=t.prototype;return e.addMesh=function(t){Y(this.meshes,t,this.meshOrder)},e.removeMesh=function(t){y(this.meshes,t)},e.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),W(this.meshes,this.meshOrder),this.meshes},e.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],o=e[3];t.setViewport(i,r,n,o)}},e.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.frameCleanup=function(t){},e.resetColorAttachments=function(t){var e=this;if(t.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=t.map((function(t){return t.updateSource({sourceType:exports.TextureSourceType.framebuffer}),new hn(e.renderer.engine,{texture:t})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=i,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(t.map((function(t){return t}))))}else this.resetAttachments({attachments:t.map((function(t){return{texture:t}}))})},e.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.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._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var o=this.viewportScale,s=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*o,r.getHeight()*o],a=[s[2],s[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map((function(t,e){var r;return new hn(i.renderer.engine,Xe({size:a,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))}));this.attachments=h;var l=Hn.create({storeAction:this.storeAction,name:u,viewport:s,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);l.bind(),l.unbind(),this.framebuffer=l}else this.attachments.length=0},e.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]},e.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:i}}},e.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:i}}},e.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},e.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},e.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.dispose=function(t){if(!this.destroyed){var e=(null==t?void 0:t.meshes)||void 0;e!==exports.DestroyOptions.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0;var i=(null==t?void 0:t.colorAttachment)?t.colorAttachment:0;this.attachments.forEach((function(t){t.externalTexture&&2===i||1===i||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var r,n,o=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:0,s=this.framebuffer;if(s)if(s.dispose({depthStencilAttachment:o}),!(s.externalStorage&&2===o||1===o))null==(r=this.stencilTexture)||r.dispose(),null==(n=this.depthTexture)||n.dispose();this.options=this.renderer=null,this.initialize=ct}},wi(t,[{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()}}]),t}(),fn="precision highp float;attribute vec2 aUV;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec2 _Size;uniform vec3 _Scale;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;void main(){vec4 texParams=_TexParams;vTexCoord=vec2(aUV.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(texParams.w,texParams.y,texParams.x);if(texParams.z==1.0){vec4 pos=vec4(aPos.xy*_Size,aPos.z,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}else{mat4 view=effects_MatrixV;vec3 camRight=vec3(view[0][0],view[1][0],view[2][0]);vec3 camUp=vec3(view[0][1],view[1][1],view[2][1]);vec3 worldPosition=vec3(effects_ObjectToWorld*vec4(0.0,0.0,0.0,1.0));vec3 vertexPosition=worldPosition+camRight*aPos.x*_Size.x*_Scale.x+camUp*aPos.y*_Size.y*_Scale.y;gl_Position=effects_MatrixVP*vec4(vertexPosition,1.0);}}",dn="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",pn="#version 100\nprecision mediump float;\n#define PATICLE_SHADER 1\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nvarying vec4 vTexCoordBlend;\n#endif\nvarying float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\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#ifdef PREVIEW_BORDER\nvoid main(){gl_FragColor=uPreviewColor;}\n#else\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}if(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);gl_FragColor=color;}\n#endif\n",mn="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}const float d2r=3.141592653589793/180.;attribute vec3 aPos;attribute vec4 aOffset;attribute vec4 aColor;attribute vec3 aDirX;attribute vec3 aDirY;attribute vec3 aTranslation;attribute vec3 aRotation0;attribute vec3 aRotation1;attribute vec3 aRotation2;attribute vec3 aLinearMove;\n#ifdef USE_SPRITE\nattribute vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);varying vec4 vTexCoordBlend;\n#endif\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nuniform vec4 uOrbXByLifetimeValue;uniform vec4 uOrbYByLifetimeValue;uniform vec4 uOrbZByLifetimeValue;uniform vec3 uOrbCenter;uniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nvarying float vLife;varying vec4 vColor;varying vec2 vTexCoord;vec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;}}",vn="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;void 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;}",yn="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",gn="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",xn="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);}",bn="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);}",Tn="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);}",En="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainTex=texture2D(_MainTex,uv);mainTex.rgb=pow(mainTex.rgb,vec3(2.2));float brightness=max(mainTex.r,max(mainTex.g,mainTex.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainTex.rgb*=w;mainTex.rgb*=mainTex.a;gl_FragColor=vec4(mainTex.rgb,1.0);}",Sn={},_n=function(){function t(){}return t.registerInclude=function(t,e){Sn[t]&&it.warn('The "'+t+'" shader include already exist.'),Sn[t]=e},t.unRegisterInclude=function(t){delete Sn[t]},t.unRegisterAllIncludes=function(){Object.keys(Sn).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var i=e.level,r=e.shaderType,n=e.shader,o=e.macros,s=e.removeVersion,a=t.genMacroString(i,o),u=t.genShaderVersion(i),h=t.parseIncludes(n),l=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==i||l||(h=t.convertTo300(h,r===exports.ShaderType.fragment)),s?a+h:u+a+h},t.convertTo300=function(e,i){if(e=(e=(e=e.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(e=(e=(e=e.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!t.has300Output(e))if(/\bgl_FragData\[.+?\]/g.test(e)){var r=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(e=t.replaceMRTShader(e,r))}else e=(e=e.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}else e=e.replace(/\battribute\b/g,"in");return e},t.parseIncludes=function(t,e){var i;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var r=i[1],n=Sn[r];if(void 0===n)throw new Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},t.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach((function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)})),r.length?r.join("\n")+"\n":""},t.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},t.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},t.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},t.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},t.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var o=e[n].match(/\bgl_FragData\[(.+?)\]/);o&&i.add(o[1])}return i.forEach((function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},t}(),Cn=function(t){function e(e,i){var r,n=(r=t.call(this,e,i)||this).renderer.engine,o=Zr.create(n,{mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=Nr.create(n,{shader:{vertex:yn,fragment:En,glslVersion:exports.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=sn.create(n,{geometry:o,material:s,priority:0}),r.priority=5e3,r}kt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},i.execute=function(t){var e,i,r;t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var n=null!=(r=null==(i=t.renderingData.currentFrame.globalVolume)||null==(e=i.bloom)?void 0:e.threshold)?r:1;this.screenMesh.material.setFloat("_Threshold",n),t.renderMeshes([this.screenMesh])},e}(cn),An=function(t){function e(e,i,r){var n;(n=t.call(this,e,r)||this).type=i;var o=n.renderer.engine,s="PostProcess",a=Zr.create(o,{name:s,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u={vertex:yn,fragment:"H"===i?xn:bn,glslVersion:exports.GLSLVersion.GLSL1},h=Nr.create(o,{name:s,shader:u});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=sn.create(o,{name:s,geometry:a,material:h,priority:0}),n.priority=5e3,n}kt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",On(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFramebuffer().getColorTextures()[0])},e}(cn),wn=function(t){function e(e,i){var r,n="PostProcess",o=(r=t.call(this,e,i)||this).renderer.engine,s=Zr.create(o,{name:n,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a={vertex:yn,fragment:Tn},u=Nr.create(o,{name:n,shader:a});return u.blending=!1,u.depthTest=!1,u.culling=!1,r.screenMesh=sn.create(o,{name:n,geometry:s,material:u,priority:0}),r.priority=5e3,r}kt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",On(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},e}(cn),Mn=function(t){function e(e,i){var r,n="PostProcess",o=(r=t.call(this,e,{})||this).renderer.engine;r.sceneTextureHandle=i||new hn(o);var s=Zr.create(o,{name:n,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=Nr.create(o,{name:n,shader:{vertex:yn,fragment:gn,glslVersion:exports.GLSLVersion.GLSL1}});return a.blending=!1,a.depthTest=!1,a.culling=!1,r.screenMesh=sn.create(o,{name:n,geometry:s,material:a,priority:0}),r.priority=5e3,r}kt(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},i.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear});var e=t.renderingData.currentFrame.globalVolume,i=Xe({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),r=Xe({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=Xe({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),o=Xe({active:!1},null==e?void 0:e.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,n.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*n.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*n.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(i.active)),i.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i.intensity)),r.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",r.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",r.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",r.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new A(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new w(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(o.active)),t.renderMeshes([this.screenMesh])},e}(cn),Rn="_effects_default_",In=1,Pn=function(){function t(t){var e;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=t.camera,r=t.keepColorBuffer,n=t.renderer,o=t.editorTransform,s=void 0===o?[1,1,0,0]:o,a=t.globalVolume,u=t.postProcessingEnabled,h=void 0!==u&&u,l=t.clearAction,c=void 0===l?{colorAction:exports.TextureLoadAction.whatever,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.whatever}:l,f=n.engine;a&&(this.globalVolume=a),this.globalUniforms=new Dn;var d,p=[],m={};if(this.renderer=n,h){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");var v=Ui.HALF_FLOAT;p=[{texture:{format:Ui.RGBA,type:v,magFilter:Ui.LINEAR,minFilter:Ui.LINEAR}}],d={storageType:exports.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear}}this.drawObjectPass=new cn(n,{name:Rn,priority:an,meshOrder:exports.OrderType.ascending,depthStencilAttachment:d,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),h){var g=new hn(f),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=new Array(7),T=Ui.HALF_FLOAT,E=new Cn(n,{name:"BloomThresholdPass",attachments:[{texture:{format:Ui.RGBA,type:T,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var S=0;S<7;S++){b[S]=new hn(f);var _=new An(n,"H",{name:"GaussianDownPassH"+S,viewport:x,attachments:[{texture:{format:Ui.RGBA,type:T,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR}}]}),C=new An(n,"V",{name:"GaussianDownPassV"+S,viewport:x,attachments:[{texture:{format:Ui.RGBA,type:T,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR}}]});C.gaussianResult=b[S],this.addRenderPass(_),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var w=new wn(n,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:Ui.RGBA,type:T,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR}}]});w.gaussianDownSampleResult=b[5-A],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new Mn(n,g);this.addRenderPass(R)}this.semantics=new Wr(t.semantics),this.clearAction=c,this.name="RenderFrame"+In++;var I=y[0];this.camera=i,this.keepColorBuffer=r,this.renderPassInfoMap.set(I,{listStart:0,listEnd:0,renderPass:I,intermedia:!1}),this.editorTransform=M.fromArray(s),t.clearAction||this.resetClearActions(),this.passTextureCache=new Hr(f);var P=f.gpuCapability,O=P.detail,N=Ur(P.level,O.readableDepthStencilTextures&&O.writableFragDepth);null==(e=this.renderer.getShaderLibrary())||e.addShader(N)}var e=t.prototype;return e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose();var e,i,r=(null==t?void 0:t.passes)?t.passes:void 0;(r!==exports.DestroyOptions.keep&&this._renderPasses.forEach((function(t){t.dispose(r)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.resource)&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(i=this.resource.depthStencil)||null==(e=i.texture)||e.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null);this.destroyed=!0},e.resetRenderPassDefaultAttachment=function(t,e){for(var i,r=this.resource,n=r.color_a,o=r.color_b,s=e;s<t.length;s++){var a,u,h=t[s],l=null==(a=h.attachments[0])?void 0:a.texture;if(l&&i===l){var c=l===n?o:n;h.resetColorAttachments([c])}(l=null==(u=h.attachments[0])?void 0:u.texture)&&(i=l)}},e.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(i,r){return!i.name.startsWith(Rn)||!i.meshes.includes(t)||(e=r,!1)})),e},e.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;i&&(0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e))},e.getRPAttachments=function(t,e){if(1===(null==t?void 0:t.length)){var i,r=t[0],n=r.texture,o=r.persistent,s=n.format,a=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(s===Ui.RGBA&&!o){var u=this.resource.color_a;return 0===a.length?[{texture:u}]:[{texture:a[0].texture===u?this.resource.color_b:u}]}}return t},e.resetClearActions=function(){var t=this.renderPasses.length>1?exports.TextureLoadAction.clear:exports.TextureLoadAction.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=exports.TextureLoadAction.whatever)},e.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.createResource=function(){var t=this.renderer.engine;if(!this.resource){var e,i=t.gpuCapability,r=i.detail,n=i.level,o=this.renderer.getWidth(),s=this.renderer.getHeight(),a=2===n?Ui.LINEAR:Ui.NEAREST,u=yr.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:Ui.RGBA,name:"frame_a",minFilter:a,magFilter:a}),h=yr.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:Ui.RGBA,data:{width:o,height:s},minFilter:a,magFilter:a,name:"frame_b"}),l=r.readableDepthStencilTextures&&r.writableFragDepth?exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:exports.RenderPassAttachmentStorageType.depth_stencil_opaque,c=new cn(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:u}]}).initialize(this.renderer),f=new Vn(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,colorAction:exports.TextureLoadAction.clear},meshOrder:exports.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(e=c.getDepthAttachment())?void 0:e.texture})]});this.resource={color_a:c.attachments[0].texture,color_b:h,finalCopyRP:f,depthStencil:c.depthAttachment,resRP:c}}},e.createCopyMesh=function(t){var e,i=Vr,r=this.renderer.engine,n=Zr.create(r,{name:i,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=Ur(r.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(o);var s=Nr.create(r,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:i,shader:o});return s.blending=!1,s.depthTest=!1,s.culling=!1,(null==t?void 0:t.blend)&&(s.blending=!0,s.blendFunction=[Ui.SRC_ALPHA,Ui.ONE_MINUS_SRC_ALPHA,Ui.SRC_ALPHA,Ui.ONE_MINUS_SRC_ALPHA]),sn.create(r,{name:i,geometry:n,material:s,priority:0})},e.removeRenderPass=function(t){y(this._renderPasses,t)},wi(t,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function On(t){return t?new A(t.getWidth(),t.getHeight()):new A}var Nn,Fn,Ln,Vn=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",On(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(cn),Dn=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},kn=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 wi(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),zn="function"==typeof e.WebGL2RenderingContext,Un=function(){function t(t){this.setupCapability(t)}var i=t.prototype;return i.setupCapability=function(t){var i,r=zn&&s(t,e.WebGL2RenderingContext)?2:1,n=2===r,o=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),u=!!t.getExtension("OES_texture_half_float_linear"),h=!!t.getExtension("OES_texture_float_linear");this.level=r,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&&!u&&(u=Bn(t,t.HALF_FLOAT)),n&&!h&&(h=Bn(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,c=n?e.WebGL2RenderingContext.HALF_FLOAT:(null==(i=t.getExtension("OES_texture_half_float"))?void 0:i.HALF_FLOAT_OES)||0,f={floatTexture:l,halfFloatTexture:c,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"):c>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:Gn(t),halfFloatLinear:u,floatLinear:h,maxTextureAnisotropy:o?t.getParameter(o.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:!!this.glAsyncCompileExt,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=f,o&&(this.textureMaxAnisotropyExt=o.TEXTURE_MAX_ANISOTROPY_EXT)},i.framebufferTexture2D=function(t,e,i,r,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&i>0)throw new Error("Draw multiple color buffers not available.");var s=o?o["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];s?t.framebufferTexture2D(e,s,r,n,0):console.error("Invalid color attachment index: "+i+".")},i.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1!==this.level||i){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)}else if(e.length>1)throw new Error("Draw buffers not available.")},i.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function Bn(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}function Gn(t){return t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0}exports.COMPRESSED_TEXTURE=void 0,(Nn=exports.COMPRESSED_TEXTURE||(exports.COMPRESSED_TEXTURE={}))[Nn.NONE=0]="NONE",Nn[Nn.PVRTC=1]="PVRTC",Nn[Nn.ASTC=2]="ASTC",exports.FilterMode=void 0,(Fn=exports.FilterMode||(exports.FilterMode={}))[Fn.Nearest=0]="Nearest",Fn[Fn.Linear=1]="Linear",exports.RenderTextureFormat=void 0,(Ln=exports.RenderTextureFormat||(exports.RenderTextureFormat={}))[Ln.RGBA32=0]="RGBA32",Ln[Ln.RGBAHalf=1]="RGBAHalf";var jn,Xn,Hn=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){},wi(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),Wn=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i,r){},e.getTemporaryRT=function(t,e,i,r,n,o){return null},e.dispose=function(t){},t}(),Yn=function(t){function e(e){var i;(i=t.call(this,e)||this).visible=!0,i.meshCollider=new bs,i._color=new R(1,1,1,1),i.getHitTestParams=function(t){var e=Oi.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.meshCollider.setGeometry(i.geometry,e);var n,o=i.meshCollider.getBoundingBoxData();if(o)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:o.type,triangles:o.area,backfaceCulling:i.renderer.side===Ct.FRONT}}},i.renderer={renderMode:Ot.MESH,blending:_t.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:Ct.DOUBLE,mask:0},i.defaultGeometry=Zr.create(i.engine,{attributes:{aPos:{type:Ui.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Ui.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Ui.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var r=Nr.create(i.engine,{shader:{fragment:dn,vertex:fn,shared:!0}});return i.material=r,i.material.setColor("_Color",new R(1,1,1,1)),i.maskManager=new Fr(e),i}kt(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){s(t,R)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return r((function(){var i;return h(this,(function(r){switch(r.label){case 0:return"string"!=typeof t?[3,2]:[4,yr.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}}))}))()},i.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},i.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.mask,o=t.texture,s=this.maskManager.maskMode,a=this.material;a.blending=!0,a.depthTest=!0,a.depthMask=i,a.stencilRef=void 0!==n?[n,n]:void 0,Yi(a,r),qi(a,s),Zi(a,e),a.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',a.setVector4("_TexOffset",new M(0,0,1,1)),a.setTexture("_MainTex",o);var u=Wi(r),h=new M;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=u,h.z=t.renderMode,h.w=s,a.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?a.enableMacro("ALPHA_CLIP"):a.disableMacro("ALPHA_CLIP"),a},i.draw=function(t){for(var e=0;e<this.materials.length;e++){var i=this.materials[e];i.setVector2("_Size",this.transform.size),this.renderer.renderMode!==Ot.BILLBOARD&&this.renderer.renderMode!==Ot.VERTICAL_BILLBOARD&&this.renderer.renderMode!==Ot.HORIZONTAL_BILLBOARD||i.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),i,e)}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r,n,o,s=e,a=null!=(i=s.renderer)?i:{},u=s.mask;u&&this.maskManager.setMaskOptions(u),this.renderer={renderMode:null!=(r=a.renderMode)?r:Ot.MESH,blending:null!=(n=a.blending)?n:_t.ALPHA,texture:a.texture?this.engine.findObject(a.texture):this.engine.whiteTexture,occlusion:!!a.occlusion,transparentOcclusion:!!a.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(o=a.side)?o:Ct.DOUBLE,mask:this.maskManager.getRefValue()},this.configureMaterial(this.renderer)},wi(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(Ii),Zn=(jn=new Float32Array(1),Xn=new Int32Array(jn.buffer),function(t){jn[0]=t;var e=Xn[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?i|=((r|=2048)>>114-n)+(r>>113-n&1):(i|=n-112<<10|r>>1,i+=1&r)}),qn=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]=Zn(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=Zn(t[i])},t}();var Kn,Qn=new Kr,Jn=new Oi;function $n(t,e,i,r,n,o,s){var a=t,u=r/n,h=r,l=e.speedOverLifetime;l&&(h=l.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;a.copyFrom(o),a.addScaledVector(s,h),a.addScaledVector(i,c);var f=e.linearVelOverLifetime||{},d=e.orbitalVelOverLifetime||{};if(d.enabled){var p=new w;d.center&&p.setFromArray(d.center);var m=a.clone().subtract(p),v=d.asRotation,y=["x","y","z"].map((function(t){var e=d[t];return e?v?e.getValue(u):e.getIntegrateValue(0,r,n):0}));Qn.setFromArray(y).negate(),Jn.setFromEuler(Qn);var g=Jn.transformPoint(m);a.addVectors(p,g)}if(f.enabled){var x=f.asMovement,b=f.x,T=f.y,E=f.z;if(b){var S=x?b.getValue(u):b.getIntegrateValue(0,r,n);a.x=a.x+S}if(T){var _=x?T.getValue(u):T.getIntegrateValue(0,r,n);a.y=a.y+_}if(E){var C=x?E.getValue(u):E.getIntegrateValue(0,r,n);a.z=a.z+C}}return a}function to(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function eo(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function io(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var o=0;o<e.length;o++)t[o]=e[o]}else if(i&&t!==i)for(var s=0;s<i.length;s++)t[s]=i[s];return t}var ro=((Kn={})[Nt.PARTICLE_ORIGIN_CENTER]=[0,0],Kn[Nt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Kn[Nt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Kn[Nt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Kn[Nt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Kn[Nt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Kn[Nt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Kn[Nt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Kn[Nt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Kn);function no(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function oo(t,e,i){var r=i.position,n=new w(t,e,0),o=new w;return i.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(r),new Jr(r,o)}function so(t,e,i){var r=t.x,n=t.y,o=t.z,s=new w(r-e,n+i,o),a=new w(r-e,n-i,o),u=new w(r+e,n-i,o),h=new w(r+e,n+i,o);return[{p0:s,p1:a,p2:u},{p0:s.clone(),p1:u.clone(),p2:h}]}function ao(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function uo(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var ho={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex,o=e[r],s=e[n];return new A(o,s)},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===Bt.LINE||i===Bt.EASE_OUT?0:i===Bt.EASE_IN||i===Bt.EASE||i===Bt.HOLD&&r===Bt.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==Bt.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==Bt.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[Bt.EASE,Bt.EASE_IN,Bt.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[Bt.EASE,Bt.EASE_OUT,Bt.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===Bt.HOLD&&[Bt.HOLD,Bt.LINE_OUT,Bt.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===Bt.HOLD&&[Bt.HOLD,Bt.LINE,Bt.EASE_IN].includes(i)}},lo=function(t,e){this.points=t,this.totalLength=e},co={},fo={},po=.1;function mo(t,e){return 1-3*e+3*t}function vo(t,e){return 3*e-6*t}function yo(t){return 3*t}function go(t,e,i){return((mo(e,i)*t+vo(e,i))*t+yo(e))*t}function xo(t,e,i){return 3*mo(e,i)*t*t+2*vo(e,i)*t+yo(e)}var bo=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=uo(e.x-t.x,3)+"_"+uo(e.y-t.y,3)+"_"+uo(e.z-t.z,3)+"&"+uo(i.x-t.x,3)+"_"+uo(i.y-t.y,3)+"_"+uo(i.z-t.z,3)+"&"+uo(r.x-t.x,3)+"_"+uo(r.y-t.y,3)+"_"+uo(r.z-t.z,3);if(fo[n])return{data:fo[n],interval:t};for(var o=[],s=null,a=0,u=0,h=0;h<300;h+=1){var l=new w,c=h/299;u=0,l.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),l.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),l.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==s&&(u+=Math.pow(l.x-s.x,2),u+=Math.pow(l.y-s.y,2),u+=Math.pow(l.z-s.z,2)),s=l,a+=u=Math.sqrt(u),o[h]={partialLength:u,point:l}}var f=new lo(o,a);return fo[n]=f,{data:f,interval:new w(t.x,t.y,t.z)}}(t,e,i,r),o=n.data,s=n.interval;this.lengthData=o,this.interval=s,this.totalLength=o.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(ao(1-t,0))return e.points[299].point.clone().add(this.interval);if(ao(e.totalLength,0))return this.p1.clone();var i=new w,r=uo(e.totalLength*t,4),n=this.catching.lastAddedLength,o=this.catching.lastPoint;if(ao(n,r))return e.points[o].point.clone().add(this.interval);var s=!0,a=1;for(r<n&&(a=-1);s;){if(r>=n){if(299===o){i.x=e.points[o].point.x,i.y=e.points[o].point.y,i.z=e.points[o].point.z;break}if(r<n+e.points[o+1].partialLength){var u=(r-n)/e.points[o+1].partialLength;i.x=e.points[o].point.x+(e.points[o+1].point.x-e.points[o].point.x)*u,i.y=e.points[o].point.y+(e.points[o+1].point.y-e.points[o].point.y)*u,i.z=e.points[o].point.z+(e.points[o+1].point.z-e.points[o].point.z)*u;break}}a>0&&o<299?(o+=a,n+=uo(e.points[o].partialLength,5)):a<0&&o>0?(n-=uo(e.points[o].partialLength,5),o+=a):s=!1}return this.catching.lastPoint=o,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),To=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new Ze,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):ao(1-t,0)?this.temp.copyFrom(this.p2):(Co.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),Eo=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new A,this.control2=new A,this.weighted=!1,this.isConstant=!1,this.mSampleValues=new Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),go(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var o=1-n,s=o*o,a=n*n;return t*(s*o)+e*s*n*3+i*o*a*3+r*(a*n)},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=go(t*po,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=po;var n=i+(t-e[--r])/(e[r+1]-e[r])*po,o=xo(n,this.control1.x,this.control2.x);return o>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var o=xo(e,i,r);if(0===o)return e;e-=(go(e,i,r)-t)/o}return e}(t,n,this.control1.x,this.control2.x):0===o?n:function(t,e,i,r,n){var o,s,a=0;do{(o=go(s=e+(i-e)/2,r,n)-t)>0?i=s:e=s}while(Math.abs(o)>1e-7&&++a<10);return s}(t,i,i+po,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,this.control1.x===this.control1.y&&this.control2.x===this.control2.y||this.calcSampleValues()},t}();function So(t,e){var i=_o(t,e,!0),r=i.p0,n=i.p1,o=i.p2,s=i.p3;K(o),K(s);var a,u,h=s.x-r.x,l=s.y-r.y,c=uo((n.x-r.x)/h,5),f=uo((o.x-r.x)/h,5);ao(l,0)?a=u=NaN:(a=uo((n.y-r.y)/l,5),u=uo((o.y-r.y)/l,5)),c<0&&(console.error("Invalid bezier points, x1 < 0",r,n,o,s),c=0),f<0&&(console.error("Invalid bezier points, x2 < 0",r,n,o,s),f=0),c>1&&(console.error("Invalid bezier points, x1 >= 1",r,n,o,s),c=1),f>1&&(console.error("Invalid bezier points, x2 >= 1",r,n,o,s),f=1);var d,p=("bez_"+c+"_"+a+"_"+f+"_"+u).replace(/\./g,"p");return co[p]?d=co[p]:(d=ao(l,0)?new Eo:new Eo(c,a,f,u),co[p]=d),{points:[r,n,o,s],timeInterval:h,valueInterval:l,curve:d}}function _o(t,e,i){var r=t[1],n=ho.isHoldOutKeyframe(t),o=ho.isHoldInKeyframe(e),s=!o&&ho.isRightSideEase(t),a=!n&&ho.isLeftSideEase(e);if(s&&!a&&!o){var u=new A(r[r.length-4],r[r.length-3]),h=new A(r[r.length-2],r[r.length-1]),l=ho.getPointInCurve(e),c=new A(l.x,l.y);return{type:"ease",p0:u,p1:h,p2:new A(c.x-(c.x-u.x)/10,c.y),p3:c}}if(!s&&a&&!n){var f=e[1],d=ho.getPointInCurve(t),p=new A(d.x,d.y),m=new A(f[0],f[1]),v=new A(f[2],f[3]);return{type:"ease",p0:p,p1:new A(p.x+(v.x-p.x)/10,p.y),p2:m,p3:v}}if(s&&a){var y=e[1];return{type:"ease",p0:new A(r[r.length-4],r[r.length-3]),p1:new A(r[r.length-2],r[r.length-1]),p2:new A(y[0],y[1]),p3:new A(y[2],y[3])}}var g=ho.getPointInCurve(t),x=ho.getPointInCurve(e);return n?x.y=g.y:o&&(g.y=x.y),i?{type:"ease",p0:g,p1:new A((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new A((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||o,leftHoldLine:n,rightHoldLine:o}:{type:"line",p0:g,p1:x,isHold:n||o,leftHoldLine:n,rightHoldLine:o}}var Co=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,o=e.y,s=e.z,a=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r)return t.x=n,t.y=o,t.z=s,void(t.w=a);if(1===r)return t.x=u,t.y=h,t.z=l,void(t.w=c);if(a!==c||n!==u||o!==h||s!==l){var f=1-r,d=n*u+o*h+s*l+a*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,o=o*f+h*g,s=s*f+l*g,a=a*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+o*o+s*s+a*a);n*=x,o*=x,s*=x,a*=x}}t.x=n,t.y=o,t.z=s,t.w=a},t}(),Ao="not_implement",wo=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(Ao)},e.getIntegrateValue=function(t,e,i){throw new Error(Ao)},e.getIntegrateByTime=function(t,e){throw new Error(Ao)},e.getValue=function(t){throw new Error(Ao)},e.getMaxTime=function(){throw new Error(Ao)},e.toUniform=function(t){throw new Error(Ao)},e.map=function(t){throw new Error(Ao)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(Ao)},t.getAllData=function(t,e){for(var i=new(e?qn:Float32Array)(4*t.index),r=0,n=0,o=t.curves;r<o.length;r++){var s=o[r].toData();i.set(s,n),n+=s.length}return e?i.data:i},t}(),Mo=function(t){function e(){return t.apply(this,arguments)}kt(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}(wo),Ro=function(t){function e(){return t.apply(this,arguments)}kt(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}(wo),Io=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){var i=null!=e?e:Math.random();return this.min+i*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){var r=null!=i?i:1;return(this.min+r*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(wo),Po=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var o=Math.random();r[n]=e[n]*(1-o)+i[n]*o}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(wo),Oo=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,o=this.xCoord*i;return((r+e/o*(n-r)+r)*e-(r+t/o*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return zo(e,0,this.xCoord,this.min,this.max)-zo(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}(wo),No=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=O(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],o=e[r+1];if(n.time<=t&&o.time>t){var s=(t-n.time)/(o.time-n.time);return N(n.color.toArray(),o.color.toArray(),s,!0)}}return e[i].color.toArray()},e}(wo),Fo=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],o=e[r+1],s=n[0],a=o[0];if(t>=s&&t<=a){var u=(t-s)/(a-s),h=n[1];return h+u*(o[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,o=e?zo:ko,s=0;s<n;s++){var a=i[s],u=i[s+1],h=a[0],l=u[0];if(t>h&&t<=l)return r+o(t,h,l,a[1],u[1]);r+=o(l,h,l,a[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=this.keys,r=Math.ceil(i.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},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}(wo),Lo=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],o=e[r+1];if(n[0]<=t&&o[0]>=t){var s=o[1]-n[1],a=void 0;if(0===s)a=(t-n[0])/(o[0]-n[0]);else a=(Uo(t,n,o)-n[1])/s;return this.calculateVec(r,a)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],o=0;o<i.length;o++)n[o]=i[o]*(1-e)+r[o]*e;return n},e}(wo),Vo=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var o=e[n],s=e[n+1],a=new w(i[n][0],i[n][1],i[n][2]),u=new w(i[n+1][0],i[n+1][1],i[n+1][2]),h=new w(r[2*n][0],r[2*n][1],r[2*n][2]),l=new w(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=So(o,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new bo(a,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=uo(t,5),i=0,r=new w,n=this.keyTimeData;if(!n.length)return r;var o=this.curveSegments[n[0]].timeStart,s=this.curveSegments[n[n.length-1]].timeEnd;if(e<=o)return r=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=s)return r=this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<n.length;a++){var u=this.curveSegments[n[a]].timeStart,h=this.curveSegments[n[a]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[a]].pathCurve;i=this.getPercValue(n[a],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,o=uo((e-r.x)/n,4);return C(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(wo),Do=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var o=e[n],s=e[n+1],a=Ze.fromArray(i[n]),u=Ze.fromArray(i[n+1]),h=Ze.fromArray(r[2*n]),l=Ze.fromArray(r[2*n+1]),c=So(o,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new To(a,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=uo(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),o=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=o)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<r.length;s++){var a=r[s].split("&"),u=a[0],h=a[1];if(i>=Number(u)&&i<Number(h)){var l=this.curveSegments[r[s]].pathCurve;return e=this.getPercValue(r[s],i),l.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,o=uo((e-r.x)/n,4);return C(i.easingCurve.getValue(o),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(wo);function ko(t,e,i,r,n){var o=t-e;return(r+r+(n-r)*o/(i-e))*o/2}function zo(t,e,i,r,n){var o=t*t,s=e*e;return(2*(o*t)*(r-n)+3*o*(e*n-i*r)-s*e*(2*r+n)+3*s*i*r)/(6*(e-i))}function Uo(t,e,i){var r=i[0]-e[0],n=e[3]*r,o=i[2]*r,s=(t-e[0])/r,a=s*s,u=a*s,h=u-2*a+s,l=u-a,c=-2*u+3*a;return(2*u-3*a+1)*e[1]+h*n+l*o+c*i[1]}function Bo(t,e){if(e){var i=e[0],r=e[1];if(i===Ut.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===Ut.LINE){var o=r.length;if(2===o&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&o++,r[r.length-1][0]<1&&o++;var s=Math.ceil(o/2);t.lineSegCount+=s,t.curves.push(r),t.index+=s,t.max=Math.max(t.max,s)}else if(i===Ut.BEZIER_CURVE){var a=r.length-1;t.index+=2*a,t.curves.push(r),t.max=Math.max(t.max,2*a),t.curveCount+=2*a}}}function Go(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function jo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(jo=function(){return!!t})()}function Xo(t,e,i){return Xo=jo()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Dt(n,i.prototype),n},Xo.apply(null,arguments)}var Ho,Wo,Yo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new M,e}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=ns(t[0]),this.yCurve=ns(t[1]),this.zCurve=ns(t[2]),this.wCurve=ns(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(wo),Zo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new w,e}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=ns(t[0]),this.yCurve=ns(t[1]),this.zCurve=ns(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(wo),qo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new A,e}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=ns(t[0]),this.yCurve=ns(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(wo),Ko=6,Qo="editor",Jo={"Item duration can't be less than 0":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#AOnQS","ValueType: 21/22 is not supported":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#smO1b"};exports.TangentMode=void 0,(Ho=exports.TangentMode||(exports.TangentMode={}))[Ho.Cubic=0]="Cubic",Ho[Ho.Linear=1]="Linear",Ho[Ho.Constant=2]="Constant",exports.WeightedMode=void 0,(Wo=exports.WeightedMode||(exports.WeightedMode={}))[Wo.None=0]="None",Wo[Wo.In=1]="In",Wo[Wo.Out=2]="Out",Wo[Wo.Both=3]="Both";var $o=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=es(t);var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=ts(e[i],e[i+1]),n=r.points,o=r.curve,s=r.timeInterval,a=r.valueInterval,u=n[0],h=n[n.length-1];this.keys.push([].concat(u.toArray(),n[1].toArray())),this.keys.push([].concat(h.toArray(),n[2].toArray()));var l={points:n,timeInterval:s,valueInterval:a,curve:o,timeStart:Number(u.x),timeEnd:Number(h.x)};this.curveMap[u.x+"&"+h.x]=l,this.curveInfos.push(l)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,o=this.keyFrames[r+1].time;if(t>=n&&t<o){var s=this.curveInfos[r],a=s.points[0],u=s.timeInterval,h=s.valueInterval,l=(t-a.x)/u,c=s.curve.getValue(l);e=a.y+h*c;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,o=Object.keys(this.curveMap);if(r<=this.curveMap[o[0]].timeStart)return 0;for(var s=0;s<o.length;s++){var a=this.curveMap[o[s]].timeStart,u=this.curveMap[o[s]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(o[s],Number(u))),r>=Number(a)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(o[s],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,o=i.valueInterval,s=0,a=(e-r.x)/20,u=0;u<=20;u++){var h=u*a/n,l=r.y+o*i.curve.getValue(h);s+=0===u||20===u?l:u%2==1?4*l:2*l}return s*=a/3},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(wo);function ts(t,e){var i=new A(t.time,t.value),r=new A,n=new A,o=new A,s=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,a=2===t.tangentMode,u=(s?t.outWeight:1)*(e.time-t.time)/3;r.x=t.time+u,r.y=t.value+u*(a?0:t.outSlope);var h=(s?e.inWeight:1)*(e.time-t.time)/3;n.x=e.time-h,n.y=e.value-h*(a?0:e.inSlope),o.x=e.time,o.y=a?t.value:e.value,K(n),K(o);var l,c,f=o.x-i.x,d=o.y-i.y,p=uo((r.x-i.x)/f,5),m=uo((n.x-i.x)/f,5);ao(d,0)?l=c=NaN:(l=uo((r.y-i.y)/d,5),c=uo((n.y-i.y)/d,5)),p<0&&(console.error("Invalid bezier points, x1 < 0",i,r,n,o),p=0),m<0&&(console.error("Invalid bezier points, x2 < 0",i,r,n,o),m=0),p>1&&(console.error("Invalid bezier points, x1 >= 1",i,r,n,o),p=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",i,r,n,o),m=1);var v,y=("bez_"+p+"_"+l+"_"+m+"_"+c).replace(/\./g,"p");return co[y]?v=co[y]:(v=ao(d,0)?new Eo:s?new Eo(p,l,m,c):new Eo(l,c),co[y]=v),{points:[i,r,n,o],timeInterval:f,valueInterval:d,curve:v}}function es(t){for(var e=t,i=[],r=[],n={x:0,y:0},o=0;o<e.length;o++){var s=e[o],a=_o(s,o+1<e.length?e[o+1]:e[o],!0),u=a.p0,h=a.p1,l=a.p2,c=a.p3;K(l),K(c);var f={leftControl:n,value:u,rightControl:h,tangentMode:0};s[0]===Bt.HOLD&&(f.tangentMode=2),r.push(f),n=l}for(var d=function(t,e){return(e.y-t.y)/(e.x-t.x+E)},p=0;p<r.length;p++){var m=r[p].leftControl,v=r[p].value,y=r[p].rightControl,g=0,x=0;p>0&&(g=d(m,v)),p<r.length-1&&(x=d(v,y));var b={time:v.x,value:v.y,inSlope:g,outSlope:x,inWeight:0,outWeight:0,tangentMode:r[p].tangentMode,weightedMode:3};i.push(b),p>0&&(b.inWeight=(v.x-m.x)/((v.x-r[p-1].value.x)/3)),p+1<r.length&&(b.outWeight=(y.x-v.x)/((r[p+1].value.x-v.x)/3))}return i}var is,rs=((is={})[Ut.RANDOM]=function(t){return s(t[0],Array)?new Po(t):new Io(t)},is[Ut.CONSTANT]=function(t){return new Mo(t)},is[Ut.CONSTANT_VEC2]=function(t){return new Mo(t)},is[Ut.CONSTANT_VEC3]=function(t){return new Mo(t)},is[Ut.CONSTANT_VEC4]=function(t){return new Mo(t)},is[Ut.RGBA_COLOR]=function(t){return new Mo(t)},is[Ut.COLORS]=function(t){return new Ro(t.map((function(t){return I(t,!1)})))},is[Ut.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Oo([t[0][1],t[1][1]]):new Fo(t)},is[Ut.GRADIENT_COLOR]=function(t){return new No(t)},is[Ut.LINEAR_PATH]=function(t){return new Lo(t)},is[Ut.BEZIER_CURVE]=function(t){return 1===t.length?new Mo(t[0][1][1]):new $o(t)},is[Ut.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Mo(Xo(w,[].concat(t[1][0]))):new Vo(t)},is[Ut.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new Mo(Xo(Ze,[].concat(t[1][0]))):new Do(t)},is[Ut.COLOR_CURVE]=function(t){return new ss(t)},is[Ut.VECTOR4_CURVE]=function(t){return new Yo(t)},is[Ut.VECTOR2_CURVE]=function(t){return new qo(t)},is[27]=function(t){return new Zo(t)},is);function ns(t){if(!t||!isNaN(+t))return new Mo(t||0);if(s(t,wo))return t;if(st(rs[t[0]]))return rs[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Jo["ValueType: 21/22 is not supported"]+".")}var os,ss=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new R,e}kt(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=ns(t[0]),this.gCurve=ns(t[1]),this.bCurve=ns(t[2]),this.aCurve=ns(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(wo);exports.TexturePaintScaleMode=void 0,function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(exports.TexturePaintScaleMode||(exports.TexturePaintScaleMode={})),exports.ShapeComponent=function(t){function e(e){var i;(i=t.call(this,e)||this).shapeDirty=!0,i.materialDirty=!0,i.graphicsPath=new mh,i.fills=[],i.strokeAttributes={width:1,alignment:.5,cap:he.Butt,join:le.Miter,miterLimit:10},i.strokeWidth=1,i.strokeCap=he.Butt,i.strokeJoin=le.Miter,i.strokes=[],i.meshCollider=new bs,i.fillMaterials=[],i.strokeMaterials=[],i.getHitTestParams=function(t){var e=Oi.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix());if(t){i.meshCollider.setGeometry(i.geometry,e);var r=i.meshCollider.getBoundingBoxData();if(r)return{behavior:0,type:r.type,triangles:r.area,backfaceCulling:i.rendererOptions.side===Ct.FRONT}}},i.rendererOptions={renderMode:Ot.MESH,blending:_t.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:Ct.DOUBLE,mask:0},i.maskManager=new Fr(i.engine);var r={type:se.Solid,color:new R(1,1,1,1)};i.strokes.push(r);var n={type:se.Solid,color:new R(1,1,1,1)};return i.fills.push(n),i.shapeAttributes={type:ue.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i.geometry=Zr.create(i.engine,{attributes:{aPos:{type:Ui.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{size:2,offset:0,releasable:!0,type:Ui.FLOAT,data:new Float32Array([0,1,0,0,1,1,1,0])}},indices:{data:new Uint16Array([0,1,2,2,1,3]),releasable:!0},mode:Ui.TRIANGLES,drawCount:6}),i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),i}kt(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){this.shapeDirty&&(this.buildPath(this.shapeAttributes),this.buildGeometryFromPath(this.graphicsPath.shapePath),this.shapeDirty=!1),this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},i.render=function(t){this.maskManager.drawStencilMask(t),this.draw(t)},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=!1,i=0;i<this.fillMaterials.length;i++)e=this.fillMaterials[i].colorMask,this.fillMaterials[i].colorMask=!1,t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[i],0),this.fillMaterials[i].colorMask=e;for(var r=0;r<this.strokeMaterials.length;r++)e=this.strokeMaterials[r].colorMask,this.strokeMaterials[r].colorMask=!1,t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[r],1),this.strokeMaterials[r].colorMask=e}},i.draw=function(t){for(var e=0;e<this.fillMaterials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],0);for(var i=0;i<this.strokeMaterials.length;i++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],1)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},i.buildGeometryFromPath=function(t){var e=t.shapePrimitives,i=[],r=[];if(this.fills.length>0)for(var n,s=o(e);!(n=s()).done;){var a=n.value.shape,u=[],h=r.length,l=i.length/2;a.build(u),a.triangulate(u,i,l,r,h)}var c=r.length;if(this.strokes.length>0)for(var f,d=o(e);!(f=d()).done;){var p=f.value.shape,m=[],v=i.length/2,y=this.strokeAttributes;y.cap=this.strokeCap,y.join=this.strokeJoin,y.width=this.strokeWidth;var g=!0;this.shapeAttributes.type===ue.Custom&&(g=p.closePath),p.build(m),$u(m,y,!1,g,i,2,v,r)}var x=r.length-c,b=i.length/2,T=this.geometry.getAttributeData("aPos"),E=this.geometry.getAttributeData("aUV"),S=this.geometry.getIndexData();(!T||T.length<3*b)&&(T=new Float32Array(3*b)),(!E||E.length<2*b)&&(E=new Float32Array(2*b)),(!S||S.length<r.length)&&(S=new Uint16Array(r.length));for(var _=Number.MAX_VALUE,C=Number.MAX_VALUE,A=Number.MIN_VALUE,w=Number.MIN_VALUE,M=0;M<b;M++){var R=3*M,I=2*M,P=i[I],O=i[I+1];T[R]=P,T[R+1]=O,T[R+2]=0,_=Math.min(_,P),C=Math.min(C,O),A=Math.max(A,P),w=Math.max(w,O)}for(var N=A-_,F=w-C,L=0;L<b;L++){var V=3*L,D=2*L;E[D]=(T[V]-_)/N,E[D+1]=(T[V+1]-C)/F}S.set(r),this.geometry.setAttributeData("aPos",T),this.geometry.setAttributeData("aUV",E),this.geometry.setIndexData(S),this.geometry.setDrawCount(r.length);var k=this.geometry.subMeshes[0],z=this.geometry.subMeshes[1];k.indexCount=c,z.offset=2*c,z.indexCount=x},i.buildPath=function(t){switch(this.graphicsPath.clear(),t.type){case ue.Custom:for(var e,i=this.shapeAttributes,r=i.points,n=i.easingIns,s=i.easingOuts,a=o(i.shapes);!(e=a()).done;){var u=e.value,h=u.indexes,l=r[h[0].point];this.graphicsPath.moveTo(l.x,l.y);for(var c=1;c<h.length;c++){var f=h[c],d=h[c-1],p=r[f.point],m=r[d.point],v=s[d.easingOut],y=n[f.easingIn];this.graphicsPath.bezierCurveTo(v.x+m.x,v.y+m.y,y.x+p.x,y.y+p.y,p.x,p.y,1)}if(u.close){var g=h[0],x=h[h.length-1],b=r[g.point],T=r[x.point],E=s[x.easingOut],S=n[g.easingIn];this.graphicsPath.bezierCurveTo(E.x+T.x,E.y+T.y,S.x+b.x,S.y+b.y,b.x,b.y,1),this.graphicsPath.closePath()}}break;case ue.Ellipse:var _=t;this.graphicsPath.ellipse(0,0,_.xRadius,_.yRadius);break;case ue.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case ue.Star:var A=t;this.graphicsPath.polyStar(A.pointCount,A.outerRadius,A.innerRadius,A.outerRoundness,A.innerRoundness,exports.StarType.Star);break;case ue.Polygon:var w=t;this.graphicsPath.polyStar(w.pointCount,w.radius,w.radius,w.roundness,w.roundness,exports.StarType.Polygon)}},i.updateMaterials=function(){for(var t=0;t<this.fills.length;t++)this.updatePaintMaterial(this.fillMaterials[t],this.fills[t]);for(var e=0;e<this.strokes.length;e++)this.updatePaintMaterial(this.strokeMaterials[e],this.strokes[e])},i.updatePaintMaterial=function(t,e){if(t.setFloat("_FillType",e.type),e.type===se.Solid)t.color=e.color;else if(e.type===se.GradientLinear||e.type===se.GradientAngular||e.type===se.GradientRadial)this.updateGradientMaterial(t,e.gradientStops,e.startPoint,e.endPoint);else if(e.type===se.Texture){t.setInt("_ImageScaleMode",e.scaleMode),t.setVector2("_ImageSize",new A(e.texture.getWidth(),e.texture.getHeight()));var i=this.getBoundingBox(),r=i.area[0].p1,n=i.area[1].p2;t.setVector2("_DestSize",new A(r.x-n.x,r.y-n.y)),t.setFloat("_ImageOpacity",e.opacity),t.setFloat("_ImageScalingFactor",e.scalingFactor),t.setTexture("_ImageTex",e.texture);var o=e.textureTransform;t.setMatrix3("_TextureTransform",(new Qr).scale(o.scale.x,o.scale.y).rotate(o.rotation).translate(o.offset.x,o.offset.y).invert())}},i.updateGradientMaterial=function(t,e,i,r){for(var n,s=[],a=[],u=o(e.stops);!(n=u()).done;){var h=n.value,l=h.color;s.push(new M(l.r,l.g,l.b,l.a)),a.push(h.time)}t.setVector4Array("_Colors",s),t.setFloats("_Stops",a),t.setInt("_StopsCount",a.length),t.setVector2("_StartPoint",i),t.setVector2("_EndPoint",r)},i.createMaterialFromRendererOptions=function(t){var e={shader:{vertex:"precision highp float;attribute vec3 aPos;attribute vec2 aUV;varying vec2 uv0;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;void main(){vec4 pos=vec4(aPos.xyz,1.0);uv0=aUV;gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;}",fragment:"precision highp float;\n#define _MAX_STOPS 8\n#define PI 3.14159265359\nuniform vec4 _Color;uniform vec4 _Colors[_MAX_STOPS];uniform float _Stops[_MAX_STOPS];uniform int _StopsCount;uniform float _FillType;uniform vec2 _StartPoint;uniform vec2 _EndPoint;uniform sampler2D _ImageTex;uniform vec2 _ImageSize;uniform vec2 _DestSize;uniform int _ImageScaleMode;uniform mat3 _TextureTransform;uniform float _ImageScalingFactor;uniform float _ImageOpacity;varying vec2 uv0;vec4 smoothMix(vec4 a,vec4 b,float t){return mix(a,b,smoothstep(0.0,1.0,t));}float calculateAngleRatio(vec2 v1,vec2 v2){float angle=atan(v2.y,v2.x)-atan(v1.y,v1.x);if(angle<0.0)angle+=2.0*PI;return angle/(2.0*PI);}vec2 applyTransform(mat3 m,vec2 uv){uv=uv-vec2(0.5,0.5);vec3 p=m*vec3(uv,1.0);p.xy=p.xy+vec2(0.5,0.5);return p.xy;}void main(){vec4 finalColor=vec4(1.0);if(_FillType==0.0){finalColor=_Color;}else if(_FillType==1.0||_FillType==2.0||_FillType==3.0){float t=0.0;if(_FillType==1.0){vec2 gradientVector=_EndPoint-_StartPoint;vec2 pixelVector=uv0-_StartPoint;float denom=max(dot(gradientVector,gradientVector),1e-6);t=clamp(dot(pixelVector,gradientVector)/denom,0.0,1.0);}else if(_FillType==2.0){float maxRadius=max(distance(_EndPoint,_StartPoint),0.001);t=clamp(distance(uv0,_StartPoint)/maxRadius,0.0,1.0);}else{vec2 center=_StartPoint;vec2 referenceVector=_EndPoint-center;vec2 targetVector=uv0-center;if(length(targetVector)>0.001){t=calculateAngleRatio(referenceVector,targetVector);}}finalColor=_Colors[0];for(int i=1;i<_MAX_STOPS;i++){if(i>=_StopsCount)break;float prevStop=_Stops[i-1];float currStop=_Stops[i];if(t>=prevStop&&t<=currStop){float localT=(t-prevStop)/max(currStop-prevStop,1e-6);finalColor=smoothMix(_Colors[i-1],_Colors[i],localT);break;}}}else if(_FillType==4.0){vec2 uv=uv0;float rSrc=_ImageSize.x/max(_ImageSize.y,1.0);float rDst=_DestSize.x/max(_DestSize.y,1.0);bool maskOutside=false;if(_ImageScaleMode==0){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(1.0,rSrc/rDst);}else{scale=vec2(rDst/rSrc,1.0);}uv=(uv-0.5)*scale+0.5;uv=clamp(uv,0.0,1.0);}else if(_ImageScaleMode==1){vec2 scale=vec2(1.0);if(rDst>rSrc){scale=vec2(rSrc/rDst,1.0);}else{scale=vec2(1.0,rSrc/rDst);}uv=(uv-0.5)*scale+0.5;maskOutside=true;}else if(_ImageScaleMode==2){uv=applyTransform(_TextureTransform,uv0);maskOutside=true;}else if(_ImageScaleMode==3){float aspectFix=rDst/max(rSrc,1e-6);vec2 uvTile=(uv0-0.5)*vec2(aspectFix,1.0)+0.5;float s=max(abs(_ImageScalingFactor),1e-6);uv=fract(uvTile*s);}vec4 img=texture2D(_ImageTex,uv);if(maskOutside){if(uv.x<0.0||uv.x>1.0||uv.y<0.0||uv.y>1.0){img.a=0.0;}}img.a*=_ImageOpacity;finalColor=img;}finalColor.rgb*=finalColor.a;gl_FragColor=finalColor;}",glslVersion:exports.GLSLVersion.GLSL1}},i=Nr.create(this.engine,e),r=t,n=r.side,o=r.occlusion,s=r.blending,a=r.mask,u=r.texture,h=this.maskManager.maskMode;i.blending=!0,i.depthTest=!0,i.depthMask=o,i.stencilRef=void 0!==a?[a,a]:void 0,Yi(i,s),qi(i,h),Zi(i,n),i.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',i.setVector4("_TexOffset",new M(0,0,1,1)),i.setTexture("_ImageTex",u);var l=Wi(s),c=new M;return c.x=r.occlusion?+r.transparentOcclusion:1,c.y=l,c.z=r.renderMode,c.w=h,i.setVector4("_TexParams",c),0===c.x||this.maskManager.alphaMaskEnabled?i.enableMacro("ALPHA_CLIP"):i.disableMacro("ALPHA_CLIP"),i},i.fromData=function(e){var i;t.prototype.fromData.call(this,e),this.shapeDirty=!0,e.mask&&this.maskManager.setMaskOptions(e.mask);var r,n,s,a,u,h=null!=(i=e.renderer)?i:{};this.rendererOptions={renderMode:Ot.MESH,blending:null!=(r=h.blending)?r:_t.ALPHA,texture:h.texture?this.engine.findObject(h.texture):this.engine.whiteTexture,occlusion:!!h.occlusion,transparentOcclusion:!!h.transparentOcclusion||this.maskManager.maskMode===exports.MaskMode.MASK,side:null!=(n=h.side)?n:Ct.DOUBLE,mask:this.maskManager.getRefValue()},this.strokeCap=null!=(s=e.strokeCap)?s:he.Butt,this.strokeWidth=null!=(a=e.strokeWidth)?a:1,this.strokeJoin=null!=(u=e.strokeJoin)?u:le.Miter,this.fills.length=0,this.fillMaterials.length=0;for(var l,c=o(e.fills);!(l=c()).done;){var f=l.value;this.fills.push(this.createPaint(f)),this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}this.strokes.length=0,this.strokeMaterials.length=0;for(var d,p=o(e.strokes);!(d=p()).done;){var m=d.value;this.strokes.push(this.createPaint(m)),this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}switch(this.materials=[].concat(this.fillMaterials,this.strokeMaterials),e.type){case ue.Custom:for(var v,y=e,g={type:ue.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},x=o(y.points);!(v=x()).done;){var b=v.value;g.points.push(new A(b.x,b.y))}for(var T,E=o(y.easingIns);!(T=E()).done;){var S=T.value;g.easingIns.push(new A(S.x,S.y))}for(var _,C=o(y.easingOuts);!(_=C()).done;){var w=_.value;g.easingOuts.push(new A(w.x,w.y))}g.shapes=y.shapes,this.shapeAttributes=g;break;case ue.Ellipse:var M=e,R={type:ue.Ellipse,xRadius:M.xRadius,yRadius:M.yRadius};this.shapeAttributes=R;break;case ue.Rectangle:var I=e,P={type:ue.Rectangle,width:I.width,height:I.height,roundness:I.roundness};this.shapeAttributes=P;break;case ue.Star:var O=e,N={type:ue.Star,pointCount:O.pointCount,innerRadius:O.innerRadius,outerRadius:O.outerRadius,innerRoundness:O.innerRoundness,outerRoundness:O.outerRoundness};this.shapeAttributes=N;break;case ue.Polygon:var F=e,L={type:ue.Polygon,pointCount:F.pointCount,radius:F.radius,roundness:F.roundness};this.shapeAttributes=L}},i.createPaint=function(t){var e;switch(t.type){case se.Solid:e={type:t.type,color:(new R).copyFrom(t.color)};break;case se.GradientLinear:case se.GradientAngular:case se.GradientRadial:e={type:t.type,gradientStops:ns(t.gradientStops),startPoint:(new A).copyFrom(t.startPoint),endPoint:(new A).copyFrom(t.endPoint)};break;case se.Texture:var i,r,n,o=Xe({offset:{x:0,y:0},rotation:0,scale:{x:1,y:1}},null!=(i=t.textureTransform)?i:{});e={type:t.type,texture:this.engine.findObject(t.texture),scaleMode:t.scaleMode,scalingFactor:null!=(r=t.scalingFactor)?r:1,opacity:null!=(n=t.opacity)?n:1,textureTransform:{offset:(new A).copyFrom(o.offset),rotation:o.rotation,scale:(new A).copyFrom(o.scale)}}}return e},i.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},wi(e,[{key:"shape",get:function(){return this.shapeAttributes}}]),e}(Ii),exports.ShapeComponent=u([Ae("ShapeComponent")],exports.ShapeComponent),exports.Fake3DComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).loop=!1,e.amountOfMotion=1,e.animationLength=2,e.mode=1,e.startPositionX=0,e.startPositionY=0,e.startPositionZ=0,e.endPositionX=0,e.endPositionY=0,e.endPositionZ=0,e.amplitudeX=0,e.amplitudeY=0,e.amplitudeZ=0,e.phaseX=0,e.phaseY=0,e.phaseZ=0,e}kt(e,t);var i=e.prototype;return i.onStart=function(){this.effectComponent=this.item.getComponent(exports.EffectComponent)},i.onUpdate=function(t){this.updateFake3D()},i.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var o=t;this.loop&&(o>.5&&(o=1-o),o*=2),e=this.startPositionX*(1-o)+o*this.endPositionX,i=this.startPositionY*(1-o)+o*this.endPositionY,r=this.startPositionZ*(1-o)+o*this.endPositionZ}var s=this.effectComponent.material;s.setFloat("_PosX",e*this.amountOfMotion),s.setFloat("_PosY",i*this.amountOfMotion),s.setFloat("_PosZ",r*this.amountOfMotion)}},e}(Mi),u([we()],exports.Fake3DComponent.prototype,"loop",void 0),u([we()],exports.Fake3DComponent.prototype,"amountOfMotion",void 0),u([we()],exports.Fake3DComponent.prototype,"animationLength",void 0),u([we()],exports.Fake3DComponent.prototype,"mode",void 0),u([we()],exports.Fake3DComponent.prototype,"startPositionX",void 0),u([we()],exports.Fake3DComponent.prototype,"startPositionY",void 0),u([we()],exports.Fake3DComponent.prototype,"startPositionZ",void 0),u([we()],exports.Fake3DComponent.prototype,"endPositionX",void 0),u([we()],exports.Fake3DComponent.prototype,"endPositionY",void 0),u([we()],exports.Fake3DComponent.prototype,"endPositionZ",void 0),u([we()],exports.Fake3DComponent.prototype,"amplitudeX",void 0),u([we()],exports.Fake3DComponent.prototype,"amplitudeY",void 0),u([we()],exports.Fake3DComponent.prototype,"amplitudeZ",void 0),u([we()],exports.Fake3DComponent.prototype,"phaseX",void 0),u([we()],exports.Fake3DComponent.prototype,"phaseY",void 0),u([we()],exports.Fake3DComponent.prototype,"phaseZ",void 0),exports.Fake3DComponent=u([Ae("Fake3DComponent")],exports.Fake3DComponent),exports.Fake3DAnimationMode=void 0,(os=exports.Fake3DAnimationMode||(exports.Fake3DAnimationMode={}))[os.Circular=0]="Circular",os[os.Linear=1]="Linear",exports.CameraController=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(Mi),exports.CameraController=u([Ae(pe.CameraController)],exports.CameraController);var as,us=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt);exports.HitTestType=void 0,(as=exports.HitTestType||(exports.HitTestType={}))[as.triangle=1]="triangle",as[as.box=2]="box",as[as.sphere=3]="sphere",as[as.custom=4]="custom";var hs="click",ls="touchstart",cs="touchmove",fs="touchend",ds=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var i=t.prototype;return i.bindListeners=function(){var t,i,r,n,o,s=this;o=function(t){return t};var a,u="mousedown",h="mousemove",l="mouseup",c="mouseleave",f=function(t,i,r,o,a){void 0===o&&(o=0),void 0===a&&(a=0);var u=0,h=0,l=e.performance.now();if(!s.target)return it.warn("Trigger TouchEvent after EventSystem is disposed."),{x:i,y:r,vx:0,vy:h,dx:o,dy:a,ts:l,width:0,height:0,origin:t};var c=s.target,f=c.width,d=c.height;if(n){var p=l-n.ts;u=(o-n.dx)/p||0,h=(a-n.dy)/p||0,n={dx:o,dy:a,ts:l}}return{x:i,y:r,vx:u,vy:h,dx:o,dy:a,ts:l,width:f,height:d,origin:t}};B()&&(o=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},u="touchstart",h="touchmove",l="touchend",c="touchcancel"),this.nativeHandlers=((a={})[u]=function(a){if(s.enabled){var u=o(a),h=ps(u);t=h.x,i=h.y,n=r={clientX:u.clientX,clientY:u.clientY,ts:e.performance.now(),x:t,y:i},s.dispatchEvent(ls,f(a,t,i))}},a[h]=function(e){if(r&&s.enabled){var n=ps(o(e));t=n.x,i=n.y,s.dispatchEvent(cs,f(e,t,i,t-r.x,i-r.y))}},a[l]=function(e){if(r&&s.enabled){!s.allowPropagation&&e.cancelable&&(e.preventDefault(),e.stopPropagation());var n=o(e),a=ps(n),u=Math.abs(r.clientX-n.clientX)+Math.abs(r.clientY-n.clientY);t=a.x,i=a.y,u<4&&s.dispatchEvent(hs,f(e,t,i)),s.dispatchEvent(fs,f(e,t,i,t-r.x,i-r.y))}r=0},a),this.nativeHandlers[c]=this.nativeHandlers[l],Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=s.target)||e.addEventListener(String(t),s.nativeHandlers[t])}))},i.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach((function(t){return t(e)}))},i.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),v(i,e),function(){y(i,e)}},i.removeEventListener=function(t,e){var i=this.handlers[t];i&&y(i,e)},i.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 ps(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),o=n.left,s=n.top;return{x:(i-o)/n.width*2-1,y:1-(r-s)/n.height*2}}var ms=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt),vs=1,ys=function(){function t(t,e,i){this.transform=e,this.engine=i,this.color=t.options.previewColor;var r=this.createMaterial(),n=this.createGeometry();this.mesh=this.createMesh(n,r),this.updateMesh()}var e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new w,n=new Ze,o=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,o),e.x=o.x,e.y=o.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},e.createMaterial=function(){var t,e=[["ENV_EDITOR",(null==(t=this.engine.renderer)?void 0:t.env)===Qo]],i=ns(this.color).getValue(0),r={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\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}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:exports.GLSLVersion.GLSL1,macros:e}},n=Nr.create(this.engine,r);return n.blending=!0,n.depthTest=!1,n.setVector4("uPos",new M(0,0,0,0)),n.setVector2("uSize",new A(1,1)),n.setVector4("uColor",new M(i[0]/255,i[1]/255,i[2]/255,i[3])),n.setQuaternion("uQuat",new Ze(0,0,0,0)),n},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return Zr.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:Ui.LINES,maxVertex:4})},e.createMesh=function(t,e){return sn.create(this.engine,{name:"Interact_preview"+vs++,priority:0,worldMatrix:Oi.fromIdentity(),geometry:t,material:e})},t}();function gs(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}exports.InteractComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.speed=25,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.invalidBorderRange=0,e.invalidByBorderRange=!1,e.duringPlay=!1,e._interactive=!0,e.lastTime=-1,e.getHitTestParams=function(t){if(e.clickable){var i=e.item.props.content.options.behavior,r=e.getBoundingBox();return r?{type:r.type,triangles:r.area,behavior:i}:void 0}},e}kt(e,t);var i=e.prototype;return i.getDragRangeX=function(){return this.dragRange.dxRange},i.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},i.getDragRangeY=function(){return this.dragRange.dyRange},i.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},i.onStart=function(){var t=this.item.engine.renderer.env,e=this.interactData.options,i=e.type,r=e.showPreview;i===Rt.CLICK&&(this.clickable=!0,r&&t===Qo&&(this.previewContent=new ys(this.item.props.content,this.transform,this.engine))),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},i.onDisable=function(){t.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},i.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,i=this.item.engine.renderer.env;if(e===Rt.CLICK)this.clickable=!0;else if(e===Rt.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==Qo||n){var o,s=(null!=(o=this.item.composition)?o:{}).event;s&&this.beginDragTarget(r,s)}}},i.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,o=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,o.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,gs(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},i.endDragTarget=function(){},i.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,o=n.position,s=n.fov,a=e.dy,u=e.dx*e.width/e.height,h=o[2],l=Math.tan(s*Math.PI/180/2)*Math.abs(h),c=a*l,f=u*l,d=this.dragRange,p=d.dxRange,m=d.dyRange,v=o[0]-this.dragRatio[0]*f,y=o[1]-this.dragRatio[1]*c,g=p[0],x=p[1],b=m[0],T=m[1];if(v=C(v,g,x),y=C(y,b,T),v!==g&&v!==x&&g!==x)null==(i=e.origin)||i.preventDefault();if(y!==b&&y!==T&&b!==T)null==(r=e.origin)||r.preventDefault();this.item.composition.camera.position=new w(v,y,h)}},i.beginDragTarget=function(t,i){var r=this;if("camera"===t.target){var n,o={touchstart:function(t){var e;if(r.canInteract()&&(r.invalidByBorderRange=r.checkInvalidBorderRange({x:t.x,y:t.y}),!r.invalidByBorderRange)){r.dragEvent=null,r.bouncingArg=null;var i=null==(e=r.item.composition)?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.invalidByBorderRange||(r.handleDragMove(n,t),r.bouncingArg=t)},touchend:function(t){if(r.canInteract()){var e=r.bouncingArg;!gs(e,3)&&e&&(e.vx*=r.speed,e.vy*=r.speed,r.dragEvent=Xe({},n)),n=null}}};Object.keys(o).forEach((function(t){i.addEventListener(t,o[t])})),o.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(o).forEach((function(t){i.removeEventListener(t,o[t])}))}}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=so(w.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:exports.HitTestType.triangle,area:e}},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===Rt.DRAG){var i=e.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},i.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},i.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i=0,r=0,n=0,o=0;if("number"==typeof e)i=e,r=e,n=e,o=e;else if(ot(e)){var s,a,u,h,l;i=void 0===(a=(s=e)[0])?0:a,r=void 0===(u=s[1])?0:u,n=void 0===(h=s[2])?0:h,o=void 0===(l=s[3])?0:l}if(t.x<o-1||t.x>1-r||t.y<i-1||t.y>1-n)return!0}return!1},wi(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(Ii),exports.InteractComponent=u([Ae(pe.InteractComponent)],exports.InteractComponent);var xs,bs=function(){function t(){this.triangles=[],this.worldMatrix=new Oi,this.assemblyTriangles=function(t,e,i,r,n){for(var o=i;o<r;o+=3){var s=3*e[o],a=3*e[o+1],u=3*e[o+2],h={x:t[s],y:t[s+1],z:t[s+2]},l={x:t[a],y:t[a+1],z:t[a+2]},c={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:l,p2:c})}}}var e=t.prototype;return e.getBoundingBoxData=function(){return this.applyWorldMatrix(this.boundingBoxData.area),this.boundingBoxData},e.getBoundingBox=function(){for(var t,e=-Number.MAX_VALUE,i=-Number.MAX_VALUE,r=Number.MAX_VALUE,n=Number.MAX_VALUE,s=o(this.boundingBoxData.area);!(t=s()).done;){var a=t.value;e=Math.max(a.p0.x,a.p1.x,a.p2.x,e),i=Math.max(a.p0.y,a.p1.y,a.p2.y,i),r=Math.min(a.p0.x,a.p1.x,a.p2.x,r),n=Math.min(a.p0.y,a.p1.y,a.p2.y,n)}var u=[],h=new w(r,i,0),l=new w(e,i,0),c=new w(e,n,0),f=new w(r,n,0);return u.push({p0:h,p1:l,p2:c}),u.push({p0:h,p1:c,p2:f}),this.applyWorldMatrix(u),{type:exports.HitTestType.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var i,r=[],n=o(this.triangles);!(i=n()).done;){var s=i.value;r.push({p0:s.p0,p1:s.p1,p2:s.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxData={type:exports.HitTestType.triangle,area:r}},e.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,s=o(t.subMeshes);!(n=s()).done;){var a=n.value;if(void 0!==a.indexCount){var u=e.BYTES_PER_ELEMENT,h=a.offset/u,l=h+a.indexCount;this.assemblyTriangles(i,e,h,l,r)}}return r},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new w),t.p1=e.worldMatrix.transformPoint(t.p1,new w),t.p2=e.worldMatrix.transformPoint(t.p2,new w)})),t},t}(),Ts=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return kt(e,t),e}(Vt),Es=function(){function t(){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0}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(){if(0===this.playState)this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},t}(),Ss=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),_s=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Re);function Cs(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}exports.PlayState=void 0,(xs=exports.PlayState||(exports.PlayState={}))[xs.Playing=0]="Playing",xs[xs.Paused=1]="Paused";var As=new Ze,ws=1,Ms=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new w(0,0,0),this.quat=new Ze(0,0,0,1),this.rotation=new Kr(0,0,0),this.scale=new w(1,1,1),this.anchor=new w(0,0,0),this.size=new A(1,1),this.children=[],this.worldMatrix=Oi.fromIdentity(),this.localMatrix=Oi.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new w(0,0,0),quat:new Ze(0,0,0,1),scale:new w(1,1,1)},this.name="transform_"+ws++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){this.position.x===t&&this.position.y===e&&this.position.z===i||(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){0===t&&0===e&&0===i||(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===i||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){this.quat.x===t&&this.quat.y===e&&this.quat.z===i&&this.quat.w===r||(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){this.scale.x===t&&this.scale.y===e&&this.scale.z===i||(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,o=t.size,a=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),i&&(s(i,w)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),a)s(a,Ze)?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(r){var l=e?-1:1;s(r,Kr)?this.setRotation(r.x*l,r.y*l,r.z*l):this.setRotation(r[0]*l,r[1]*l,r[2]*l)}n&&(s(n,w)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),o&&this.setSize(o.x,o.y),h&&(s(h,A)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){v(this.children,t)},e.removeChild=function(t){y(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Kr)},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;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return 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 Kr)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=(new w).copyFrom(t.position),t.quat?e.quat=new Ze(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new Kr(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=(new w).copyFrom(t.scale),t.size&&(e.size=(new A).copyFrom(t.size)),t.anchor&&(e.anchor=(new A).copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var i=As.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},wi(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}(),Rs=new w(1,1,1),Is=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new Ms,this.pixelWidth=0,this.pixelHeight=0,this.viewportMatrix=Oi.fromIdentity(),this.viewMatrix=Oi.fromIdentity(),this.projectionMatrix=Oi.fromIdentity(),this.viewProjectionMatrix=Oi.fromIdentity(),this.inverseViewMatrix=Oi.fromIdentity(),this.dirty=!0;var i=e.near,r=void 0===i?.1:i,n=e.far,o=void 0===n?20:n,s=e.fov,a=void 0===s?60:s,u=e.aspect,h=void 0===u?1:u,l=e.clipMode,c=void 0===l?zt.portrait:l,f=e.position,d=void 0===f?[0,0,8]:f,p=e.rotation,m=void 0===p?[0,0,0]:p,v=e.pixelWidth,y=void 0===v?0:v,g=e.pixelHeight,x=void 0===g?0:g,b=new Kr(m[0],m[1],m[2]),T=(new Ze).setFromEuler(b);this.options={near:r,far:o,fov:a,aspect:h,clipMode:c},this.pixelWidth=y,this.pixelHeight=x,this.transform.setPosition(d[0],d[1],d[2]),this.transform.setQuaternion(T.x,T.y,T.z,T.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new w(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var o=i.projectPoint(e).z,s=r.projectPoint(new w(1,1,o)),a=s.x,u=s.y,h=r.projectPoint(new w(-1,-1,o)),l=h.x,c=h.y;return new w((a-l)/2,(u-c)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return Xe({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,o=t.aspect,s=t.position,a=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=o,this.position=s,this.rotation=a,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,o=e.far,s=e.clipMode;this.projectionMatrix.perspective(i*b,r,n,o,s===zt.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),Rs),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:Oi.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.worldToScreenPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new w,r=this.getViewProjectionMatrix();return i.set(t.x,t.y,t.z),r.projectPoint(i,i),i.x=.5*(i.x+1)*this.pixelWidth,i.y=.5*(i.y+1)*this.pixelHeight,i.z=.5*(i.z+1),i},e.screenToWorldPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new w,r=this.getInverseViewProjectionMatrix(),n=t.x/this.pixelWidth*2-1,o=t.y/this.pixelHeight*2-1,s=2*t.z-1;return i.set(n,o,s),r.projectPoint(i,i),i},wi(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.transform.position.clone()},set:function(t){this.transform.position.equals(t)||(this.transform.setPosition(t.x,t.y,t.z),this.dirty=!0)}},{key:"worldPosition",get:function(){return this.transform.getWorldPosition()}},{key:"rotation",get:function(){return this.transform.rotation.clone()},set:function(t){this.transform.rotation.equals(t)||(this.transform.setRotation(t.x,t.y,t.z),this.dirty=!0)}}]),t}(),Ps=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=Os(this.arc,this.arcMode,t)*b,i=Math.cos(e)*this.radius,r=Math.sin(e)*this.radius,n=new w(i,r,0),o=Math.tan(this.angle*b),s=n.clone().multiply(o);return s.z+=1,{position:n.multiply(lt(0,1)),direction:s.normalize()}},t}();function Os(t,e,i){if(e===Xt.RANDOM)t=lt(0,t);else if(e===Xt.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===Xt.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),o=n-Math.floor(n);t*=Math.floor(n)%2?1-o:o}else e===Xt.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var Ns,Fs=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=Os(this.arc,this.arcMode,t)*b,i=new w(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),Ls=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=lt(-this._d,this._d),i=lt(-this._h,this._h);return{direction:new w(0,0,1),position:new w(e,i,0)}},t}(),Vs=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=Os(this.arc,this.arcMode,t)*b,i=new w(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,o=Math.atan2(n,r),s=Math.tan(e),a=new w;return e<o?a.set(r,r*s,0):e>=o&&e<Math.PI-o?a.set(n/s,n,0):e<Math.PI+o?a.set(-r,-r*s,0):e<2*Math.PI-o?a.set(-n/s,-n,0):a.set(r,r*s,0),{direction:i,position:a}},t}(),Ds=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Xt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):lt(0,1);return{direction:new w(0,1,0),position:new w(this._d*(e-.5),0,0)}},t}(),ks=new Oi,zs=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=lt(0,2*Math.PI),n=Os(this.arc,this.arcMode,t)*b,o=ks.setFromRotationZ(n),s=new w(Math.cos(r),Math.sin(r),0),a=new w(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:o.transformNormal(s),position:o.transformPoint(a)}},t}(),Us=new Oi,Bs=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 lt(-90,90)},e.generate=function(t){var e=Os(this.arc,this.arcMode,t)*b,i=this.getHorizontalAngle()*b,r=this.radius,n=new w(Math.cos(i),0,Math.sin(i)),o=Us.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(r),direction:o}},t}(),Gs=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.getHorizontalAngle=function(){return lt(0,90)},e}(Bs),js=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=C(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=e.length/2-1,r=Math.floor(Os(i,this.arcMode,t)),n=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,o=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,s=new w(n,o,0);return{position:new w(n*this.width,o*this.height,0),direction:s.normalize()}},t}(),Xs=function(){function t(){}return t.prototype.generate=function(){return{position:new w,direction:new w}},t}(),Hs=((Ns={})[wt.NONE]=Xs,Ns[wt.CONE]=Ps,Ns[wt.SPHERE]=Bs,Ns[wt.HEMISPHERE]=Gs,Ns[wt.CIRCLE]=Fs,Ns[wt.DONUT]=zs,Ns[wt.RECTANGLE]=Ls,Ns[wt.EDGE]=Ds,Ns[wt.RECTANGLE_EDGE]=Vs,Ns[wt.TEXTURE]=js,Ns);function Ws(t){if(!t)return new Xs;var e=Xe({radius:1,arc:360,angle:0,arcMode:Xt.RANDOM},t),i=t.type,r=Hs[i];if(!r)throw new Error("Invalid shape: "+i+".");var n=new r(e);if(i!==wt.NONE){var o=t.alignSpeedDirection,s=t.upDirection,a=void 0===s?[0,0,1]:s;n.alignSpeedDirection=o,n.upDirection=w.fromArray(a).normalize()}return n}function Ys(t,e,i,r,n){var o,s;if(n===function(t,e,i,r){for(var n=0,o=e,s=i-r;o<i;o+=r)n+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return n}(t,e,i,r)>0)for(o=e;o<i;o+=r)s=ca(o,t[o],t[o+1],s);else for(o=i-r;o>=e;o-=r)s=ca(o,t[o],t[o+1],s);return s&&oa(s,s.next)&&(fa(s),s=s.next),s}function Zs(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!oa(r,r.next)&&0!==na(r.prev,r,r.next))r=r.next;else{if(fa(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function qs(t){var e=t.prev,i=t,r=t.next;if(na(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(ia(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&na(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Ks(t,e,i,r){var n=t.prev,o=t,s=t.next;if(na(n,o,s)>=0)return!1;for(var a=n.x<o.x?n.x<s.x?n.x:s.x:o.x<s.x?o.x:s.x,u=n.y<o.y?n.y<s.y?n.y:s.y:o.y<s.y?o.y:s.y,h=n.x>o.x?n.x>s.x?n.x:s.x:o.x>s.x?o.x:s.x,l=n.y>o.y?n.y>s.y?n.y:s.y:o.y>s.y?o.y:s.y,c=ta(a,u,e,i,r),f=ta(h,l,e,i,r),d=t.prevZ,p=t.nextZ;d&&d.z>=c&&p&&p.z<=f;){if(d!==t.prev&&d!==t.next&&ia(n.x,n.y,o.x,o.y,s.x,s.y,d.x,d.y)&&na(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==t.prev&&p!==t.next&&ia(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&na(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&ia(n.x,n.y,o.x,o.y,s.x,s.y,d.x,d.y)&&na(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&ia(n.x,n.y,o.x,o.y,s.x,s.y,p.x,p.y)&&na(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Qs(t,e){return t.x-e.x}function Js(t,e){if(e=function(t,e){var i,r=e,n=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=n&&a>s){if(s=a,a===n){if(o===r.y)return r;if(o===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===s)return i;var u,h=i,l=i.x,c=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=l&&n!==r.x&&ia(o<c?n:s,o,l,c,o<c?s:n,o,r.x,r.y)&&(u=Math.abs(o-r.y)/(n-r.x),ha(r,t)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&$s(i,r)))&&(i=r,f=u)),r=r.next}while(r!==h);return i}(t,e),e){var i=la(e,t);Zs(e,e.next),Zs(i,i.next)}}function $s(t,e){return na(t.prev,t,e.prev)<0&&na(e.next,t,t.next)<0}function ta(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ea(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}function ia(t,e,i,r,n,o,s,a){return(n-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(r-a)-(i-s)*(e-a)>=0&&(i-s)*(o-a)-(n-s)*(r-a)>=0}function ra(t,e){return t.next.i!==e.i&&t.prev.i!==e.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&&sa(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(ha(t,e)&&ha(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{i.y>o!=i.next.y>o&&i.next.y!==i.y&&n<(i.next.x-i.x)*(o-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(na(t.prev,t,e.prev)||na(t,e.prev,e))||oa(t,e)&&na(t.prev,t,t.next)>0&&na(e.prev,e,e.next)>0)}function na(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function oa(t,e){return t.x===e.x&&t.y===e.y}function sa(t,e,i,r){var n=ua(na(t,e,i)),o=ua(na(t,e,r)),s=ua(na(i,r,t)),a=ua(na(i,r,e));return n!==o&&s!==a||(!(0!==n||!aa(t,i,e))||(!(0!==o||!aa(t,r,e))||(!(0!==s||!aa(i,t,r))||!(0!==a||!aa(i,e,r)))))}function aa(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 ua(t){return t>0?1:t<0?-1:0}function ha(t,e){return na(t.prev,t,t.next)<0?na(t,e,t.next)>=0&&na(t,t.prev,e)>=0:na(t,e,t.prev)<0||na(t,t.next,e)<0}function la(t,e){var i=new da(t.i,t.x,t.y),r=new da(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function ca(t,e,i,r){var n=new da(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 fa(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 da(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 pa=0;function ma(t,e,i,r){i=i||2,pa=r||0;var n,o,s,a,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=Ys(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,o,s,a=[];for(n=0,o=e.length;n<o;n++)(s=Ys(t,e[n]*r,n<o-1?e[n+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(ea(s));for(a.sort(Qs),n=0;n<a.length;n++)Js(a[n],i),i=Zs(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=s=t[0],o=a=t[1];for(var m=i;m<f;m+=i)(u=t[m])<n&&(n=u),(h=t[m+1])<o&&(o=h),u>s&&(s=u),h>a&&(a=h);l=0!==(l=Math.max(s-n,a-o))?1/l:0}return va(d,p,i,n,o,l),p}function va(t,e,i,r,n,o,s){if(t){!s&&o&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=ta(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,o,s,a,u,h=1;do{for(i=t,t=null,o=null,s=0;i;){for(s++,r=i,a=0,e=0;e<h&&(a++,r=r.nextZ);e++);for(u=h;a>0||u>0&&r;)0!==a&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,a--):(n=r,r=r.nextZ,u--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;i=r}o.nextZ=null,h*=2}while(s>1)}(n)}(t,r,n,o);for(var a,u,h=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?Ks(t,r,n,o):qs(t))e.push(a.i/i+pa),e.push(t.i/i+pa),e.push(u.i/i+pa),fa(t),t=u.next,h=u.next;else if((t=u)===h){s?1===s?va(t=ya(Zs(t),e,i),e,i,r,n,o,2):2===s&&ga(t,e,i,r,n,o):va(Zs(t),e,i,r,n,o,1);break}}}function ya(t,e,i){var r=t;do{var n=r.prev,o=r.next.next;!oa(n,o)&&sa(n,r,r.next,o)&&ha(n,o)&&ha(o,n)&&(e.push(n.i/i+pa),e.push(r.i/i+pa),e.push(o.i/i+pa),fa(r),fa(r.next),r=t=o),r=r.next}while(r!==t);return Zs(r)}function ga(t,e,i,r,n,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ra(s,a)){var u=la(s,a);return s=Zs(s,s.next),u=Zs(u,u.next),va(s,e,i,r,n,o),void va(u,e,i,r,n,o)}a=a.next}s=s.next}while(s!==t)}var xa=2;function ba(t,e){for(var i=t.s,r=t.p,n=i[1],o=r[1],s=0,a=0;a<n.length;a++){s+=n[a].length-1}var u,h=new Float32Array(s*Ko),l=e.indexBase,c=void 0===l?0:l,f=e.uvTransform,d=0,p=0,m=0,v=1,y=1;f&&(p=f[0],m=f[1],u=f[4],v=u?f[3]:f[2],y=u?f[2]:f[3]);for(var g=[0,0],x=0===u?0:-Math.PI/2,b=0;b<n.length;b++)for(var T=n[b],E=o[b],S=o[b+1]||o[0],_=T,C=[0,0],A=0;A<_.length-1;A++){Sa(C,_[A],E,S,E[4],E[5],S[2],S[3]),M(C[0],C[1])}var w=ma(Array.from(h),null,Ko,c);return{aPoint:h,index:new Uint16Array(w)};function M(t,e){h[d++]=t/2,h[d++]=e/2,f?(g[0]=t,g[1]=e,Ea(g,g,x),h[d++]=p+(g[0]+1)/2*v,h[d++]=m+(g[1]+1)/2*y):(h[d++]=(t+1)/2,h[d++]=(e+1)/2),d+=xa}}function Ta(t,e){for(var i=[],r=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[Ut.SHAPE_POINTS,t.p],s:[Ut.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[Ut.SHAPE_POINTS,t.g.p],s:[Ut.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,o=0,s=0,a=0;a<r.length;a++){var u=ba(r[a],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,i.push(u),o+=u.aPoint.length,s+=u.index.length}if(1===i.length)return i[0];for(var h=new Float32Array(o),l=new Uint16Array(s),c=0,f=0,d=0;c<i[c];c++){var p=i[c];h.set(p.aPoint,f),f+=p.aPoint.length,l.set(p.index,d),d+=p.index.length}return{aPoint:h,index:l}}function Ea(t,e,i){var r=Math.cos(i),n=Math.sin(i),o=e[0],s=e[1];return t[0]=r*o+n*s,t[1]=-n*o+r*s,t}function Sa(t,e,i,r,n,o,s,a){var u=1-e,h=u*u*u,l=3*e*u*u,c=3*e*e*u,f=e*e*e;return t[0]=h*i[0]+l*n+c*s+f*r[0],t[1]=h*i[1]+l*o+c*a+f*r[1],t}var _a=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+i||1,this.count=s(r,wo)?r:ns(r),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),Ca=function(t){this.content=t},Aa=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new Ca(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(this.sort(i.content,e.content)<=0))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 Ca(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(this.sort(e.content,i.content)<=0))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,o=t.next;n.next=o,o&&(o.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do{t.call(e||this,i.content,r++)}while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do{t.call(e||this,i.content,r--)}while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),wa="lookup_texture",Ma="offscreen_canvas",Ra={};function Ia(t){return Ra[t]}var Pa=new w,Oa=new w,Na=function(){function t(t,e){this.pointStart=[];var i,r=e.colorOverLifetime,n=e.colorOverTrail,o=e.maxTrailCount,a=e.opacityOverLifetime,u=void 0===a?ns(1):a,h=e.widthOverTrail,l=e.name,c=e.occlusion,f=e.blending,d=e.maskMode,p=e.mask,m=e.textureMap,v=void 0===m?[0,0,1,1]:m,y=e.texture,g=e.transparentOcclusion,x=e.minimumVertexDistance,b=e.lifetime,T=e.matrix,E=t.gpuCapability,S=E.detail,_=E.level,C=Math.max(e.pointCountPerTrail,2),w={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},R=S.maxVertexTextures>0,I=(null!=(i=t.renderer)?i:{}).env,P={},O=[["ENABLE_VERTEX_TEXTURE",R],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",I===Qo]],N=o>64,F=0;r&&(O.push(["COLOR_OVER_LIFETIME",!0]),F|=1,P.uColorOverLifetime=yr.createWithData(t,H(r))),n&&(O.push(["COLOR_OVER_TRAIL",!0]),F|=4,P.uColorOverTrail=yr.createWithData(t,H(n))),N?(O.push(["ATTR_TRAIL_START",1]),F|=8):P.uTrailStart=new Float32Array(o),P.uOpacityOverLifetimeValue=u.toUniform(w);var L=h.toUniform(w);O.push(["VERT_CURVE_VALUE_COUNT",w.index],["VERT_MAX_KEY_FRAME_COUNT",w.max]),P.uVCurveValues=wo.getAllData(w);var V={shader:{vertex:vn,fragment:pn,macros:O,glslVersion:1===_?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,name:"trail#"+l,cacheId:"-t:+"+F+"+"+w.index+"+"+w.max}},D=C*o*2,k=(C-1)*o,z=Float32Array.BYTES_PER_ELEMENT,U=12*z,B={attributes:{aColor:{size:4,stride:U,data:new Float32Array(12*D)},aSeed:{size:1,stride:U,offset:4*z,dataSource:"aColor"},aInfo:{size:3,stride:U,offset:5*z,dataSource:"aColor"},aPos:{size:4,stride:U,offset:8*z,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(D)},aDir:{size:3,data:new Float32Array(3*D)}},indices:{data:new Uint16Array(6*D)},drawCount:6*k,name:"trail#"+l,bufferUsage:Ui.DYNAMIC_DRAW};if(N)B.attributes.aTrailStart={size:1,data:new Float32Array(D)};else{var G=new Float32Array(D);B.attributes.aTrailStartIndex={size:1,data:G};for(var j=0;j<o;j++)for(var X=2*C,W=j*X,Y=0;Y<X;Y++)G[W+Y]=j}var Z=Wi(f),q=Nr.create(t,V);q.blending=!0,q.depthMask=c,q.depthTest=!0,q.stencilRef=p?[p,p]:void 0,qi(q,d),Yi(q,f);var K=this.mesh=sn.create(t,{name:"MTrail_"+l,material:q,geometry:Zr.create(t,B)}),Q=null!=y?y:yr.createWithData(t);Object.keys(P).map((function(t){var e=P[t];if(s(e,yr))q.setTexture(t,e);else if("uTrailStart"===t)q.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new M(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}q.setVector4Array(t,i)}else q.setVector4(t,M.fromArray(e))})),q.setFloat("uTime",0),q.setVector4("uWidthOverTrail",M.fromArray(L)),q.setVector2("uTexOffset",new A(0,0)),q.setVector4("uTextureMap",M.fromArray(v)),q.setVector4("uParams",new M(0,C-1,0,0)),q.setTexture("uMaskTex",Q),q.setVector4("uColorParams",new M(y?1:0,+Z,0,+(c&&!g))),this.maxTrailCount=o,this.pointCountPerTrail=C,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=N,this.lifetime=b,T&&(this.mesh.worldMatrix=T),this.geometry=K.firstGeometry(),this.trailCursors=new Uint16Array(o)}var e=t.prototype;return e.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,s=n-1,a=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,Pa);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+a,f=Da(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=6*c,y=new Float32Array(6);y.set(f,0),y.set(f,3),o.setAttributeSubData("aDir",v,y),o.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var g=i.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(p,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(p,16),x[19]=1,x.set(b,20),x[23]=-.5*m,o.setAttributeSubData("aColor",24*c,x),u>=0){var T=this.getTrailPosition(t,h,Oa),E=new Float32Array(Da(T,l,e)),S=6*(t*n+u);o.setAttributeSubData("aDir",S,E),o.setAttributeSubData("aDir",S+3,E);var _=t*n*2,C=new Uint16Array([2*u+_,2*u+1+_,2*a+_,2*a+_,2*u+1+_,2*a+1+_]),A=6*(t*s+(r-1)%s);o.setIndexSubData(A,C)}r=++this.trailCursors[t];var w=this.mesh.material,M=w.getVector4("uParams"),R=p[2];if(this.useAttributeTrailStart){for(var I=2*n,P=new Float32Array(I),O=0;O<I;O++)P[O]=R;o.setAttributeSubData("aTrailStart",t*P.length,P)}else{var N=w.getFloats("uTrailStart");null!=N&&(N[t]=R,w.setFloats("uTrailStart",N))}M&&(M.y=Math.max(M.y,r-1)-Math.max(0,r-n),w.setVector4("uParams",M))}},e.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=24*(t*r+e)+8,o=this.geometry.getAttributeData("aColor");return K(o),i.x=o[n],i.y=o[1+n],i.z=o[2+n],i}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();K(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},e.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");K(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),i=this.geometry.getIndexData();K(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},e.getPointStartPos=function(t){return this.pointStart[t]},e.setPointStartPos=function(t,e){this.pointStart[t]=e},e.onUpdate=function(t){},wi(t,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),t}(),Fa=new w,La=new w,Va=new w;function Da(t,e,i){var r=Fa;return t||i?(t?i?(La.subtractVectors(e,t).normalize(),La.subtractVectors(i,e),Va.copyFrom(La).normalize(),r.addVectors(La,Va)):r.subtractVectors(e,t):r.subtractVectors(i,e),r.normalize().toArray()):[0,0,0]}var ka=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).lastTime=0,e}kt(e,t);var i=e.prototype;return i.start=function(t){var e=t.output.getUserData();!this.particleSystem&&s(e,exports.VFXItem)&&(this.particleSystem=e.getComponent(exports.ParticleSystem),this.particleSystem&&(this.particleSystem.name=e.name))},i.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;e&&(this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),e.update(this.time-e.time)),this.lastTime=this.time},e}(Es),za=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){return new ka},e}(_s),Ua={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"},Ba=function(){function t(t,e){var i;this.particleCount=0,this.cachedRotationVector3=new w,this.cachedRotationMatrix=new Qr,this.cachedLinearMove=new w,this.tempMatrix3=new Qr,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,o=(null!=(i=t.renderer)?i:{}).env,a=e.speedOverLifetime,u=e.colorOverLifetime,h=e.linearVelOverLifetime,l=e.orbitalVelOverLifetime,c=e.sizeOverLifetime,f=e.rotationOverLifetime,d=e.sprite,p=e.gravityModifier,m=e.maxCount,v=e.textureFlip,y=e.useSprite,g=e.name,x=e.gravity,b=e.forceTarget,T=e.side,E=e.occlusion,S=e.anchor,_=e.blending,C=e.maskMode,R=e.mask,I=e.transparentOcclusion,P=e.meshSlots,O=e.renderMode,N=void 0===O?0:O,F=e.diffuse,L=void 0===F?yr.createWithData(t):F,V=t.gpuCapability.detail,D=V.halfFloatTexture,k=V.maxVertexUniforms,z=[["RENDER_MODE",+N],["ENV_EDITOR",o===Qo]],U=t.gpuCapability.level,B={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},G={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},j=k>0,X={},W=0,Y=0;(this.useSprite=y,j&&z.push(["ENABLE_VERTEX_TEXTURE",!0]),a&&(z.push(["SPEED_OVER_LIFETIME",!0]),Y|=2,X.uSpeedLifetimeValue=a.toUniform(B)),(null==d?void 0:d.animate)&&(z.push(["USE_SPRITE",!0]),Y|=4,X.uFSprite=X.uSprite=new Float32Array([d.col,d.row,d.total,d.blend?1:0]),this.useSprite=!0),(null==u?void 0:u.color)&&(z.push(["COLOR_OVER_LIFETIME",!0]),Y|=16,X.uColorOverLifetime=s(u.color,yr)?u.color:yr.createWithData(t,H(u.color))),(null==u?void 0:u.opacity)?X.uOpacityOverLifetimeValue=u.opacity.toUniform(B):X.uOpacityOverLifetimeValue=ns(1).toUniform(B),["x","y","z"].forEach((function(t,e){var i=0,n=0;(null==h?void 0:h[t])&&(X["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(B),i=1,Y|=1<<7+e,h.enabled=!0),z.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==l?void 0:l[t])&&(X["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=l[t].toUniform(B),n=1,Y|=1<<10+e,r=!0,l.enabled=!0),z.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==h?void 0:h.asMovement)&&(z.push(["AS_LINEAR_MOVEMENT",!0]),Y|=32),r&&((null==l?void 0:l.asRotation)&&(z.push(["AS_ORBITAL_MOVEMENT",!0]),Y|=64),X.uOrbCenter=new Float32Array((null==l?void 0:l.center)||[0,0,0])),X.uSizeByLifetimeValue=null==c?void 0:c.x.toUniform(B),null==c?void 0:c.separateAxes)&&(z.push(["SIZE_Y_BY_LIFE",1]),Y|=16384,X.uSizeYByLifetimeValue=null==c||null==(n=c.y)?void 0:n.toUniform(B));(null==f?void 0:f.z)&&(X.uRZByLifeTimeValue=f.z.toUniform(B),Y|=32768,z.push(["ROT_Z_LIFETIME",1])),(null==f?void 0:f.x)&&(X.uRXByLifeTimeValue=f.x.toUniform(B),Y|=65536,z.push(["ROT_X_LIFETIME",1])),(null==f?void 0:f.y)&&(X.uRYByLifeTimeValue=f.y.toUniform(B),Y|=1<<17,z.push(["ROT_Y_LIFETIME",1])),(null==f?void 0:f.asRotation)&&(z.push(["ROT_LIFETIME_AS_MOVEMENT",1]),Y|=1<<18),X.uGravityModifierValue=p.toUniform(B),b&&(z.push(["FINAL_TARGET",!0]),Y|=1<<19,X.uFinalTarget=new Float32Array(b.target||[0,0,0]),X.uForceCurve=b.curve.toUniform(B)),D&&G.max?(Y|=1<<20,X.uFCurveValueTexture=gr(t,wo.getAllData(G,!0),G.index,1)):X.uFCurveValues=wo.getAllData(G);var Z=B.max+B.curves.length-32>k;if(2===U&&(B.max=-1,B.index=P?P[0]:ja(B.index),G.index>0&&(G.max=-1,G.index=P?P[1]:ja(G.index))),Z&&D&&j){var q=gr(t,wo.getAllData(B,!0),B.index,1);X.uVCurveValueTexture=q,W=1}else X.uVCurveValues=wo.getAllData(B);var K=["-p:",N,Y,B.index,B.max,G.index,G.max].join("+");z.push(["VERT_CURVE_VALUE_COUNT",B.index],["FRAG_CURVE_VALUE_COUNT",G.index],["VERT_MAX_KEY_FRAME_COUNT",B.max],["FRAG_MAX_KEY_FRAME_COUNT",G.max]),this.VERT_MAX_KEY_FRAME_COUNT=B.max;var Q={shader:{fragment:pn,vertex:"#define LOOKUP_TEXTURE_CURVE "+W+"\n"+mn,glslVersion:1===U?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,cacheId:K,macros:z,name:"particle#"+g}},J=Wi(_);X.uTexOffset=new Float32Array(L?[1/L.getWidth(),1/L.getHeight()]:[0,0]),X.uMaskTex=L,X.uColorParams=new Float32Array([L?1:0,+J,0,+(!!E&&!I)]),X.uParams=[0,0,0,0],X.uAcceleration=[(null==x?void 0:x[0])||0,(null==x?void 0:x[1])||0,(null==x?void 0:x[2])||0,0];var $=Nr.create(t,Q);$.blending=!0,$.depthTest=!0,$.depthMask=!!E,$.stencilRef=R?[R,R]:void 0,qi($,C),Yi($,_),Zi($,T),Object.keys(X).map((function(t){var e=X[t];if(s(e,yr))$.setTexture(t,e);else{var i=[];switch(Ua[t]){case"vec4":$.setVector4(t,M.fromArray(e));break;case"vec3":$.setVector3(t,w.fromArray(e));break;case"vec2":$.setVector2(t,A.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new M(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}$.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),$.setVector3("emissionColor",new w(0,0,0)),$.setFloat("emissionIntensity",0);var tt=Zr.create(t,function(t,e,i){var r=Float32Array.BYTES_PER_ELEMENT,n=12*r,o={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*r,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*r,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*r,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*r,data:new Float32Array(0)},aSeed:{size:1,offset:3*r,stride:8*r,dataSource:"aRot"},aColor:{size:4,offset:4*r,stride:8*r,dataSource:"aRot"},aOffset:{size:4,stride:4*r,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*r,data:new Float32Array(0)},aRotation1:{size:3,offset:3*r,stride:9*r,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*r,stride:9*r,dataSource:"aRotation0"}};e&&(o.aSprite={size:3,stride:3*r,data:new Float32Array(0)});return{attributes:o,indices:{data:new Uint16Array(0)},name:i,maxVertex:t}}(4*m,this.useSprite,"particle#"+g)),et=sn.create(t,{name:"MParticle_"+g,material:$,geometry:tt});this.anchor=S,this.mesh=et,this.geometry=et.firstGeometry(),this.forceTarget=b,this.sizeOverLifetime=c,this.speedOverLifetime=a,this.linearVelOverLifetime=h,this.orbitalVelOverLifetime=l,this.orbitalVelOverLifetime=l,this.gravityModifier=p,this.rotationOverLifetime=f,this.maxCount=m,this.textureOffsets=v?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var e=t.prototype;return e.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return K(e),[e[i],e[i+1],e[i+2],e[i+3]]},e.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new i.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),i=Math.ceil(e.length/12);this.applyTranslation(i,t),this.applyRotation(i,t),this.applyLinearMove(i,t)},e.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},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r=t+1,n=4*r,o=this.geometry,s=r>this.maxParticleBufferCount,a=1;this.particleCount>300?a=(this.particleCount+100)/this.particleCount:this.particleCount>100?a=1.4:this.particleCount>0&&(a=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},h=this.useSprite;h&&(u.aSprite=new Float32Array(12));var l=new w,c=new Ze,f=new w(1,1,1);e.transform.assignWorldTRS(l,c,f);var d,p=Ms.getRotation(c,new Kr),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,x=[0,0,e.delay,e.lifetime],b=[0,0,1,1],T=e.vel,E=e.color,S=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();h&&(d=e.sprite);for(var C=0;C<4;C++){var A=2*C,M=3*C,R=4*C,I=12*C,P=8*C;u.aPos.set(m,I),T.fill(u.aPos,I+3),u.aRot.set(v,P),u.aRot[P+3]=_,u.aRot.set(E,P+4),h&&u.aSprite.set(d,M);var O=e.uv||b;if(O){var N=h?1-y[A+1]:y[A+1];x[0]=O[0]+y[A]*O[2],x[1]=O[1]+N*O[3]}u.aOffset.set(x,R);for(var F=C+C,L=(S[F]-this.anchor.x)*f.x,V=(S[F+1]-this.anchor.y)*f.y,D=0;D<3;D++)u.aPos[I+6+D]=e.dirX.getElement(D)*L,u.aPos[I+9+D]=e.dirY.getElement(D)*V}var k=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(s){var z=g(o.getIndexData(),6*r,6*i,a);z.set(k,6*t),o.setIndexData(z),this.maxParticleBufferCount=z.length/6}else o.setIndexSubData(6*t,k);Object.keys(u).forEach((function(e){var r=u[e],h=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=o.getAttributeData(e);K(l);var c=g(l,n*h,4*i*h,a);c.set(r,r.length*t),o.setAttributeData(e,c)}else o.setAttributeSubData(e,r.length*t,r)})),this.particleCount=Math.max(r,this.particleCount),o.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),o=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var s=0,a=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),l=this.mesh.material.getVector4("uGravityModifierValue"),c=0;c<t;c+=4){var f=12*c+3;s=n[f],a=n[f+1],u=n[f+2];var d=i-o[4*c+2],p=o[4*c+3];if(h&&l){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);s=s*x+v,a=a*x+y,u=u*x+g}else s+=v,a+=y,u+=g}var b=3*c;if(o[4*c+2]<i){var T=s*(e/1e3),E=a*(e/1e3),S=u*(e/1e3);r[b]+=T,r[b+1]+=E,r[b+2]+=S,r[b+3]+=T,r[b+4]+=E,r[b+5]+=S,r[b+6]+=T,r[b+7]+=E,r[b+8]+=S,r[b+9]+=T,r[b+10]+=E,r[b+11]+=S}}this.geometry.setAttributeData("aTranslation",r)},e.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),o=this.geometry.getAttributeData("aSeed"),a=this.time,u=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var h=0;h<t;h+=4){var l=C((a-r[4*h+2])/r[4*h+3],0,1),c=8*h,f=this.cachedRotationVector3.set(n[c],n[c+1],n[c+2]),d=o[8*h+3],p=f;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(s(this.rotationOverLifetime.x,Io)?p.x+=this.rotationOverLifetime.x.getValue(l,d):p.x+=this.rotationOverLifetime.x.getValue(l)),this.rotationOverLifetime.y&&(s(this.rotationOverLifetime.y,Io)?p.y+=this.rotationOverLifetime.y.getValue(l,d):p.y+=this.rotationOverLifetime.y.getValue(l)),this.rotationOverLifetime.z&&(s(this.rotationOverLifetime.z,Io)?p.z+=this.rotationOverLifetime.z.getValue(l,d):p.z+=this.rotationOverLifetime.z.getValue(l))):u.setZero(),0===p.dot(p)&&u.identity();var m=Math.PI/180,v=p.x*m,y=p.y*m,g=p.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),E=Math.cos(v),S=Math.cos(y),_=Math.cos(g);u.set(_,-T,0,T,_,0,0,0,1),u.multiply(this.tempMatrix3.set(S,0,b,0,1,0,-b,0,S)),u.multiply(this.tempMatrix3.set(1,0,0,0,E,-x,0,x,E));var A=9*h,w=u.elements;i.set(w,A),h+4<=t&&(i.set(w,A+9),i.set(w,A+18),i.set(w,A+27))}this.geometry.setAttributeData("aRotation0",i)},e.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),o=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var a=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=o-r[4*u+2],l=r[4*u+3],c=h/l,f=n[8*u+3];a.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(s(this.linearVelOverLifetime.x,Io)?a.x=this.linearVelOverLifetime.x.getValue(c,f):a.x=this.linearVelOverLifetime.x.getValue(c)),this.linearVelOverLifetime.y&&(s(this.linearVelOverLifetime.y,Io)?a.y=this.linearVelOverLifetime.y.getValue(c,f):a.y=this.linearVelOverLifetime.y.getValue(c)),this.linearVelOverLifetime.z&&(s(this.linearVelOverLifetime.z,Io)?a.z=this.linearVelOverLifetime.z.getValue(c,f):a.z=this.linearVelOverLifetime.z.getValue(c))):(this.linearVelOverLifetime.x&&(s(this.linearVelOverLifetime.x,Io)?a.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):a.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.y&&(s(this.linearVelOverLifetime.y,Io)?a.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):a.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,l)),this.linearVelOverLifetime.z&&(s(this.linearVelOverLifetime.z,Io)?a.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):a.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,l)));var d=3*u;i[d]=a.x,i[d+1]=a.y,i[d+2]=a.z,i[d+3]=a.x,i[d+4]=a.y,i[d+5]=a.z,i[d+6]=a.x,i[d+7]=a.y,i[d+8]=a.z,i[d+9]=a.x,i[d+10]=a.y,i[d+11]=a.z}this.geometry.setAttributeData("aLinearMove",i)},e.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},t}(),Ga=[10,32,64,160];function ja(t){for(var e=0;e<Ga.length;e++){var i=Ga[e];if(i>t)return i}return t||Ga[0]}var Xa=function(t){function e(e,i,r){var n;(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new Ba(e,i)),r&&(n.trailMesh=new Na(e,r));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}kt(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder;for(var t,e=o(this.meshes);!(t=e()).done;){t.value.onStart()}},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new M;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t);for(var e,i=o(this.meshes);!(e=i()).done;){e.value.render(t)}},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach((function(i){t.push(e[i])})),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach((function(e){t.push(i[e])}))}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(Ii);exports.ParticleSystem=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).destroyed=!1,r.getHitTestParams=function(t){var e=r.interaction;if(t||e)return{type:exports.HitTestType.custom,collect:function(t){return r.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===jt.removeParticle,ray:t})}}},r.maskManager=new Fr(e),i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.isFrozen=function(){return this.frozen},i.isEnded=function(){return this.ended},i.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]===Ut.CONSTANT_VEC3?e.add(r[1]):t=ns(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var o=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(o)}},i.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var o=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(o)}},i.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var o=r.first;r.removeNode(o),i=n[1]=o.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},i.setVisible=function(t){this.renderer.setVisible(t)},i.getTextures=function(){return this.renderer.getTextures()},i.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new Aa((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1,this.destroyed=!1},i.onStart=function(){this.startEmit(),this.initEmitterTransform()},i.onUpdate=function(t){this.update(t)},i.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,o=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var s=this.particleLink,a=(i-n)/this.item.duration,u=this.timePassed,h=!1,l=function(){e.trails&&!h&&(h=!0,s.forEach((function(t){var i=t[0],r=t[1],n=t[2],o=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,a,o,n)})))};if(this.ended){if(this.item.endBehavior!==Gt.restart&&Gt.destroy===this.item.endBehavior){var c=s.last;c&&c.content[0]<this.time&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/o.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=m,y=p/m,g=i,x=r.maxCount;this.updateEmitterTransform(u);for(var b=function(){var t=s.first;return e.emissionStopped||s.length===x&&t&&t.content[0]-n>u},T=0;T<v&&T<x&&!b();T++){var E=this.createPoint(d);E.delay+=g+T*y,this.addParticle(E,x),this.lastEmitTime=u}for(var S=o.bursts,_=(null==S?void 0:S.length)-1,C=0;_>=0&&C<x&&!b();_--){var A=S[_],w=!A.disabled&&A.getGeneratorOptions(u,d);if(w){var M=o.burstOffsets[_],R=M&&M[w.cycleIndex]||[0,0,0];A.once&&this.removeBurst(_);for(var I=0;I<w.count&&C<x;I++){var P;if(b())break;var O=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:I,burstCount:w.count}));O.delay+=g,C++,(P=O.transform).translate.apply(P,[].concat(R)),this.addParticle(O,x)}}}}else if(this.item.endBehavior===Gt.restart)l(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.time-=f,o.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=f,t[2]-=f,t[3].delay-=f})),this.renderer.minusTimeForLoop(f);else{this.ended=!0,this.item.endBehavior===Gt.freeze&&(this.frozen=!0)}}l()}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=[],i=0;i<this.renderer.meshes.length;i++){var r=this.renderer.meshes[i].material;e.push(r.colorMask),r.colorMask=!1}for(var n,s=o(this.renderer.meshes);!(n=s()).done;){n.value.render(t)}for(var a=0;a<this.renderer.meshes.length;a++){this.renderer.meshes[a].material.colorMask=e[a]}}},i.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach((function(t){return t.dispose()}))},i.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!t||!e)return i;for(var o=t.last,s=!1;!s;){var a=o.content[0],u=o.content[3];if(a>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),o.pre?o=o.pre:s=!0}++n>r&&(s=!0)}return i},i.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],o=new w,s=!1;if(r&&r.content)do{var a=r.content,u=a[0],h=a[1];a[2];var l=a[3];if(u>this.timePassed){var c=this.getPointPosition(l),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:c,radius:t.radius},o)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),r.content=[0]),n.push(c),t.multiple||(s=!0))}}while((r=r.pre)&&!s);return n}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var o=this.trails,s=this.getPointPosition(i),a=o.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=o.lifetime.getValue(e);if(o.sizeAffectsWidth&&(h*=u[0]),o.sizeAffectsLifetime&&(l*=u[0]),o.parentAffectsPosition&&this.transform.parentTransform){s.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&s.subtract(c)}n.addTrailPoint(t,s,{color:a,lifetime:l,size:h,time:r})}},i.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},i.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,o=t.gravity,s=void 0===o?[]:o,a=this.options.forceTarget,u=this.time-n,h=new w,l=w.fromArray(s);e.assignWorldTRS(h);var c=$n(new w,this.options,l,u,r,h,i);if(a){var f=a.target||[0,0,0],d=a.curve.getValue(u/r),p=1-d;c.x=c.x*p+f[0]*d,c.y=c.y*p+f[1]*d,c.z=c.z*p+f[2]*d}return c},i.initPoint=function(t){var e=this.options,i=this.lifetime,r=this.shape,n=e.startSpeed.getValue(i),o=e.particleFollowParent?Oi.IDENTITY:this.transform.getWorldMatrix(),s=t.position,a=o.transformPoint(s,new w),u=new Ms({position:a,valid:!0}),h=t.direction;if(h=o.transformNormal(h,Ha).normalize(),e.startTurbulence&&e.turbulence){for(var l=0;l<3;l++)Ka.setElement(l,e.turbulence[l].getValue(i));Qa.setFromVector3(Ka.negate()),$a.setFromEuler(Qa).transformNormal(h).normalize()}var c,f=Za,d=qa;r.alignSpeedDirection?(d.copyFrom(h),this.upDirectionWorld||(r.upDirection?this.upDirectionWorld=r.upDirection.clone():this.upDirectionWorld=w.Z.clone(),o.transformNormal(this.upDirectionWorld)),f.crossVectors(d,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),d.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((c=Ja)[0]=p.animationDelay.getValue(i),c[1]=p.animationDuration.getValue(i),c[2]=p.cycles.getValue(i));var m=Ya;e.start3DRotation?m.set(e.startRotationX.getValue(i),e.startRotationY.getValue(i),e.startRotationZ.getValue(i)):e.startRotation?m.set(0,0,e.startRotation.getValue(i)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(i);3===v.length&&(v[3]=1);var y=Wa;if(e.start3DSize)y.x=e.startSizeX.getValue(i),y.y=e.startSizeY.getValue(i);else{var g=e.startSize.getValue(i),x=e.sizeAspect.getValue(i);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new w;this.transform.assignWorldTRS(void 0,void 0,T),y.x*=T.x,y.y*=T.y}return u.setScale(y.x,y.y,1),{size:y,vel:b,color:v,delay:e.startDelay.getValue(i),lifetime:e.startLifetime.getValue(i),uv:eu(this.uvs,!0),gravity:e.gravity,sprite:c,dirY:d,dirX:f,transform:u}},i.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&s(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return-1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:exports.HitTestType.sphere,area:t}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e;this.props=i,this.destroyed=!1;var r,n,o,a,u,h=i.options,l=i.positionOverLifetime,c=void 0===l?{}:l,f=i.shape,d=null==c?void 0:c.gravityOverLifetime,p=to(null==c?void 0:c.gravity),m=i.textureSheetAnimation,v=m?{animationDelay:ns(m.animationDelay||0),animationDuration:ns(m.animationDuration||1),cycles:ns(m.cycles||1),animate:m.animate,col:m.col,row:m.row,total:m.total||m.col*m.row}:void 0,y=!!(f&&f.turbulenceX||(null==f?void 0:f.turbulenceY)||(null==f?void 0:f.turbulenceZ));y&&(r=[ns(null!=(n=f.turbulenceX)?n:0),ns(null!=(o=f.turbulenceY)?o:0),ns(null!=(a=f.turbulenceZ)?a:0)]);this.name="ParticleSystem",this.shape=Ws(f),this.emission={rateOverTime:ns(i.emission.rateOverTime),burstOffsets:tu(null!=(u=i.emission.burstOffsets)?u:[]),bursts:(i.emission.bursts||[]).map((function(t){return new _a(t)}))},this.textureSheetAnimation=v;var g,x,b=i.renderer||{},T=i.rotationOverLifetime;T&&((g={}).asRotation=!!T.asRotation,g.z=T.z?ns(T.z):ns(0),T.separateAxes&&(g.x=T.x&&ns(T.x),g.y=T.y&&ns(T.y))),(null==c?void 0:c.forceTarget)&&(x={target:c.target||[0,0,0],curve:ns(c.forceCurve||[Ut.LINE,[[0,0],[1,1]]])});var E={x:c.linearX&&ns(c.linearX||0),y:c.linearY&&ns(c.linearY||0),z:c.linearZ&&ns(c.linearZ||0),asMovement:c.asMovement},S={x:c.orbitalX&&ns(c.orbitalX),y:c.orbitalY&&ns(c.orbitalY),z:c.orbitalZ&&ns(c.orbitalZ),center:c.orbCenter,asRotation:c.asRotation},_=i.sizeOverLifetime||{},C=i.colorOverLifetime,w=(null==_?void 0:_.separateAxes)?{separateAxes:!0,x:ns(_.x),y:ns(_.y)}:{separateAxes:!1,x:ns(("size"in _?_.size:_.x)||1)};b.anchor=b.anchor||[0,0];var M,R=A.fromArray(b.anchor);this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:ns(h.startLifetime),startDelay:ns(h.startDelay||0),startSpeed:ns(c.startSpeed||0),startColor:ns(h.startColor),looping:!1,maxCount:null!=(M=h.maxCount)?M:0,gravityModifier:ns(d||0),gravity:p,start3DSize:!!h.start3DSize,startTurbulence:y,turbulence:r,speedOverLifetime:c.speedOverLifetime&&ns(c.speedOverLifetime),linearVelOverLifetime:E,orbitalVelOverLifetime:S,forceTarget:x},h.startRotationZ&&(this.options.startRotation=ns(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=ns(h.startRotationX||0),this.options.startRotationY=ns(h.startRotationY||0),this.options.startRotationZ=ns(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=ns(h.startSizeX),this.options.startSizeY=ns(h.startSizeY)):(this.options.startSize=ns(h.startSize),this.options.sizeAspect=ns(h.sizeAspect||1)),i.mask&&this.maskManager.setMaskOptions(i.mask);var I={meshSlots:h.meshSlots,name:this.name,matrix:Oi.IDENTITY,shaderCachePrefix:"",renderMode:b.renderMode||Ot.BILLBOARD,side:b.side||Ct.DOUBLE,gravity:p,blending:b.blending||_t.ALPHA,rotationOverLifetime:g,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:v,occlusion:!!b.occlusion,transparentOcclusion:!!b.transparentOcclusion,maxCount:h.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:x,diffuse:b.texture?this.engine.findObject(b.texture):void 0,sizeOverLifetime:w,anchor:R};if(C){var P=C.color,O=C.opacity;I.colorOverLifetime={},O&&(I.colorOverLifetime.opacity=ns(C.opacity)),P&&(P[0]===Ut.GRADIENT_COLOR?I.colorOverLifetime.color=C.color[1]:P[0]===Ut.RGBA_COLOR?I.colorOverLifetime.color=yr.createWithData(this.engine,{data:new Uint8Array(P[1]),width:1,height:1}):s(P,yr)&&(I.colorOverLifetime.color=P))}var N,F=[],L=[0,0,1,1];if(i.splits){var V=i.splits[0];L=(N=V[4])?[V[0],V[1],V[3],V[2]]:[V[0],V[1],V[2],V[3]]}if(v&&!v.animate)for(var D=N?v.row:v.col,k=N?v.col:v.row,z=v.total||D*k,U=0,B=0;B<D;B++)for(var G=0;G<k&&U<z;G++,U++)F.push([B*L[2]/D+L[0],G*L[3]/k+L[1],L[2]/D,L[3]/k]);else F.push(L);this.uvs=F,I.textureFlip=N;var j,X=i.trails;X&&(this.trails={lifetime:ns(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},X.mask&&this.maskManager.setMaskOptions(X.mask),j={name:"Trail",matrix:Oi.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture?this.engine.findObject(X.texture):void 0,opacityOverLifetime:ns(X.opacityOverLifetime||1),widthOverTrail:ns(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion,textureMap:X.textureMap,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},X.colorOverLifetime&&X.colorOverLifetime[0]===Ut.GRADIENT_COLOR&&(j.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===Ut.GRADIENT_COLOR&&(j.colorOverTrail=X.colorOverTrail[1])),this.renderer=new Xa(this.engine,I,j),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var H,W=i.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(H=W.radius)?H:.4,behavior:W.behavior});this.item.getHitTestParams=this.getHitTestParams},wi(e,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),e}(Mi),exports.ParticleSystem=u([Ae(pe.ParticleSystem)],exports.ParticleSystem);var Ha=new w,Wa=new A,Ya=new Kr,Za=new w,qa=new w,Ka=new w,Qa=new Kr,Ja=[0,0,0],$a=new Oi;function tu(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var i=s(t,Array),r=i?t[0]:t.index,n=e[r];n||(n=e[r]=[]),i?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function eu(t,e){var i=Math.floor(Math.random()*t.length),r=t[i];return e||t.splice(i,1),r}var iu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}kt(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=o(this.clipPlayables);!(e=i()).done;){e.value.processFrame(t)}this.evaluate(t)},i.setClipWeight=function(t,e){if(s(t,Es)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t)return void(this.clipWeights[i]=e)}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(Es),ru=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(s(e,exports.VFXItem)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},e}(iu),nu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();s(e,exports.VFXItem)&&(e.time=this.time)},e}(Es),ou=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(Es),su=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyPath="",e.propertyName="",e}kt(e,t);var i=e.prototype;return i.evaluate=function(t){var e=t.output.getUserData();if(e){this.directTarget||this.preparePath(e);var i=!1;if(this.propertyValue=this.directTarget[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var o=this.getClipPlayable(r);if(!s(o,ou)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var a=o.value;this.addWeightedValue(a,n),i=!0}}i&&(this.directTarget[this.propertyName]=this.propertyValue,s(e,Mi)&&e.onApplyAnimationProperties())}}},i.preparePath=function(t){for(var e=this.propertyPath.split("."),i=t,r=0;r<e.length-1;r++){var n=i[e[r]];void 0===n&&console.error("The "+e[r]+" property of "+t+" was not found"),i=n}e.length>0&&(this.propertyName=e[e.length-1]),this.directTarget=i},e}(iu),au=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(su),uu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(su),hu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){},e}(iu),lu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){},e}(iu),cu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();s(e,exports.CompositionComponent)&&(e.time=this.getTime())},e}(Es),fu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(s(e,exports.CompositionComponent)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},e}(iu),du=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.evaluate=function(t){},e}(iu),pu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(su),mu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e},e}(su),vu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(su),yu=new Kr,gu=new w(1,1,1),xu=new w,bu=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new w(e.x,e.y,e.x)};var i,r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,o=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=ns(r.path));var s=r.linearX||r.linearY||r.linearZ;s&&(this.linearVelOverLifetime={x:r.linearX&&ns(r.linearX),y:r.linearY&&ns(r.linearY),z:r.linearZ&&ns(r.linearZ),asMovement:r.asMovement,enabled:!!s});var a=r.orbitalX||r.orbitalY||r.orbitalZ;a&&(this.orbitalVelOverLifetime={x:r.orbitalX&&ns(r.orbitalX),y:r.orbitalY&&ns(r.orbitalY),z:r.orbitalZ&&ns(r.orbitalZ),center:to(r.orbCenter),asRotation:r.asRotation,enabled:!!a}),this.speedOverLifetime=r.speedOverLifetime&&ns(r.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=ns(o.x||1),this.sizeYOverLifetime=ns(o.y||1),this.sizeZOverLifetime=ns(o.z||1)):this.sizeXOverLifetime=ns(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:ns(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=ns(n.x||0),u.y=ns(n.y||0)}this.gravity=w.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=ns(null!=(i=null==r?void 0:r.gravityOverLifetime)?i:0),this.direction=(null==r?void 0:r.direction)?w.fromArray(r.direction).normalize():new w,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},i.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();s(e,exports.VFXItem)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},i.sampleAnimation=function(){var t=this,e=this.boundObject,i=this.getDuration(),r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){gu.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(gu.y=this.sizeYOverLifetime.getValue(r),gu.z=this.sizeZOverLifetime.getValue(r)):gu.z=gu.y=gu.x;var n=this.originalTransform.scale;e.transform.setScale(gu.x*n.x,gu.y*n.y,gu.z*n.z)}if(this.rotationOverLifetime){var o=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},s=o(this.rotationOverLifetime.z),a=this.rotationOverLifetime.separateAxes;yu.x=a?o(this.rotationOverLifetime.x):0,yu.y=a?o(this.rotationOverLifetime.y):0,yu.z=s;var u=yu.addEulers(this.originalTransform.rotation,yu);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=xu;$n(h,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(h.x,h.y,h.z)}},e}(Es);exports.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new bu;return t.data=this.transformAnimationData,t},i.fromData=function(t){this.transformAnimationData=t},e}(_s),exports.TransformPlayableAsset=u([Ae(pe.TransformPlayableAsset)],exports.TransformPlayableAsset);var Tu,Eu=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===Gt.restart?e%=i:this.endBehavior===Gt.freeze&&(e=Math.min(i,e))),e},t}();exports.TrackAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}kt(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){return t},i.createTrackMixer=function(){return new iu},i.createOutput=function(){return new Ss},i.createPlayableGraph=function(t){return this.createMixerPlayableGraph(t)},i.createMixerPlayableGraph=function(t){for(var e,i=[],r=o(this.clips);!(e=r()).done;){var n=e.value;i.push(n)}return this.compileClips(i,t)},i.compileClips=function(t,e){for(var i,r=this.createTrackMixer(),n=o(t);!(i=n()).done;){var s=i.value,a=this.createClipPlayable(s);a.setDuration(s.duration);var u=new Su(s,a,r);e.push(u),r.clipPlayables.push(a),r.setClipWeight(a,0)}return r},i.createPlayable=function(){return new Es},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new Eu;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=o(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){return t.asset.createPlayable()},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=o(this.children);!(i=r()).done;){i.value.parent=this}},e}(_s),u([we(Eu)],exports.TrackAsset.prototype,"clips",void 0),u([we()],exports.TrackAsset.prototype,"children",void 0),exports.TrackAsset=u([Ae(pe.TrackAsset)],exports.TrackAsset),exports.TrackType=void 0,(Tu=exports.TrackType||(exports.TrackType={}))[Tu.MasterTrack=0]="MasterTrack",Tu[Tu.ObjectTrack=1]="ObjectTrack";var Su=function(){function t(t,e,i){this.clip=t,this.playable=e,this.parentMixer=i}var e=t.prototype;return e.getParticleSystem=function(){return this.particleSystem||s(this.parentMixer.trackInstance.boundObject,exports.VFXItem)&&(this.particleSystem=this.parentMixer.trackInstance.boundObject.getComponent(exports.ParticleSystem)),this.particleSystem},e.evaluateAt=function(t){var e=this.clip,i=1,r=!1,n=!1,o=this.parentMixer.trackInstance.boundObject;t>=e.start+e.duration&&e.endBehavior===Gt.destroy?s(o,exports.VFXItem)&&exports.VFXItem.isParticle(o)&&this.getParticleSystem()&&!this.getParticleSystem().destroyed?i=1:(i=0,r=!0):t-this.clip.start>=0?(i=1,n=!0):t<e.start&&(i=0),n&&this.playable.getPlayState()!==exports.PlayState.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,i);var a=e.toLocalTime(t);this.playable.setTime(a),r&&this.playable.getPlayState()===exports.PlayState.Playing&&this.playable.pause()},wi(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}();exports.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new ru},e}(exports.TrackAsset),exports.ActivationTrack=u([Ae(pe.ActivationTrack)],exports.ActivationTrack);var _u=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}return kt(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(exports.TrackAsset);u([we()],_u.prototype,"path",void 0),exports.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new uu;return t.propertyPath=this.path,t},e}(_u),exports.FloatPropertyTrack=u([Ae(pe.FloatPropertyTrack)],exports.FloatPropertyTrack),exports.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new lu},e}(exports.TrackAsset),exports.SpriteColorTrack=u([Ae(pe.SpriteColorTrack)],exports.SpriteColorTrack),exports.SubCompositionTrack=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){if(!s(t,exports.VFXItem))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");return t.getComponent(exports.CompositionComponent)},i.createTrackMixer=function(){return new fu},e}(exports.TrackAsset),exports.SubCompositionTrack=u([Ae(pe.SubCompositionTrack)],exports.SubCompositionTrack),exports.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new du},e}(exports.TrackAsset),exports.TransformTrack=u([Ae(pe.TransformTrack)],exports.TransformTrack),exports.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.updateAnimatedObject=function(t){if(!s(t,Ii))throw new Error("MaterialTrack: expected a RendererComponent bound object.");var e=t.materials;if(this.index>=e.length)throw new Error("MaterialTrack: material index "+this.index+" out of bounds (length="+e.length+").");return e[this.index]},e}(exports.TrackAsset),u([we()],exports.MaterialTrack.prototype,"index",void 0),exports.MaterialTrack=u([Ae("MaterialTrack")],exports.MaterialTrack);var Cu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new hu},e}(exports.TrackAsset);exports.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new pu;return t.propertyPath=this.path,t},e}(_u),exports.Vector4PropertyTrack=u([Ae(pe.Vector4PropertyTrack)],exports.Vector4PropertyTrack),exports.Vector3PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new mu;return t.propertyPath=this.path,t},e}(_u),exports.Vector3PropertyTrack=u([Ae(pe.Vector3PropertyTrack)],exports.Vector3PropertyTrack),exports.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new vu;return t.propertyPath=this.path,t},e}(_u),exports.Vector2PropertyTrack=u([Ae(pe.Vector2PropertyTrack)],exports.Vector2PropertyTrack),exports.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){var t=new au;return t.propertyPath=this.path,t},e}(_u),exports.ColorPropertyTrack=u([Ae(pe.ColorPropertyTrack)],exports.ColorPropertyTrack),exports.ObjectBindingTrack=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.create=function(t,e){var i=e[this.getInstanceId()];if(s(i,exports.VFXItem))for(var r,n=o(this.getChildTracks());!(r=n()).done;){var a=r.value;if(s(a,exports.ActivationTrack)){if(i.getComponent(exports.ParticleSystem))for(var u,h=t.createTrack(Cu,this,"ParticleTrack"),l=o(a.getClips());!(u=l()).done;){var c=u.value,f=h.createClip(za);f.start=c.start,f.duration=c.duration,f.endBehavior=c.endBehavior}if(i.getComponent(exports.SpriteComponent))for(var d,p=t.createTrack(Uu,this,"SpriteComponentTimeTrack"),m=o(a.getClips());!(d=m()).done;){var v=d.value,y=p.createClip(Gu);y.start=v.start,y.duration=v.duration,y.endBehavior=v.endBehavior}if(i.getComponent(exports.EffectComponent))for(var g,x=t.createTrack(Bu,this,"EffectComponentTimeTrack"),b=o(a.getClips());!(g=b()).done;){var T=g.value,E=x.createClip(Gu);E.start=T.start,E.duration=T.duration,E.endBehavior=T.endBehavior}break}}},e}(exports.TrackAsset),exports.ObjectBindingTrack=u([Ae(pe.ObjectBindingTrack)],exports.ObjectBindingTrack),exports.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){return new nu},e}(_s),exports.ActivationPlayableAsset=u([Ae(pe.ActivationPlayableAsset)],exports.ActivationPlayableAsset),exports.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.ColorPropertyPlayableAsset.prototype,"curveData",void 0),exports.ColorPropertyPlayableAsset=u([Ae(pe.ColorPropertyPlayableAsset)],exports.ColorPropertyPlayableAsset),exports.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.FloatPropertyPlayableAsset.prototype,"curveData",void 0),exports.FloatPropertyPlayableAsset=u([Ae(pe.FloatPropertyPlayableAsset)],exports.FloatPropertyPlayableAsset),exports.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){return new cu},e}(_s),exports.SubCompositionPlayableAsset=u([Ae(pe.SubCompositionPlayableAsset)],exports.SubCompositionPlayableAsset),exports.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector4PropertyPlayableAsset=u([Ae(pe.Vector4PropertyPlayableAsset)],exports.Vector4PropertyPlayableAsset),exports.Vector3ropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.Vector3ropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector3ropertyPlayableAsset=u([Ae(pe.Vector3PropertyPlayableAsset)],exports.Vector3ropertyPlayableAsset),exports.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){var t=new ou;return t.curve=ns(this.curveData),t.value=t.curve.getValue(0),t},e}(_s),u([we()],exports.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector2PropertyPlayableAsset=u([Ae(pe.Vector2PropertyPlayableAsset)],exports.Vector2PropertyPlayableAsset);var Au=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i,this.mixer.trackInstance=this}return t.prototype.addChild=function(t){this.children.push(t)},t}();exports.TimelineAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}kt(e,t);var i=e.prototype;return i.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},i.invalidate=function(){this.cacheFlattenedTracks=null},i.addSubTracksRecursive=function(t,e){for(var i,r=o(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var s,a=o(t.getChildTracks());!(s=a()).done;){var u=s.value;this.addSubTracksRecursive(u,e)}},wi(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=o(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(Re),u([we()],exports.TimelineAsset.prototype,"tracks",void 0),exports.TimelineAsset=u([Ae(pe.TimelineAsset)],exports.TimelineAsset);var wu=function(){function t(t,e){this.time=0,this.clips=[],this.masterTrackInstances=[];for(var i,r={},n=o(e);!(i=n()).done;){var a=i.value;r[a.key.getInstanceId()]=a.value}for(var u,h=o(t.tracks);!(u=h()).done;){var l=u.value;s(l,exports.ObjectBindingTrack)&&l.create(t,r)}this.compileTracks(t.flattenedTracks,e)}var e=t.prototype;return e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.evaluate=function(t){for(var e,i=this.getTime(),r=o(this.clips);!(e=r()).done;){e.value.evaluateAt(i)}for(var n,s=o(this.masterTrackInstances);!(n=s()).done;){var a=n.value;this.tickTrack(a,t)}},e.compileTracks=function(t,e){for(var i,r=t,n={},s=o(r);!(i=s()).done;){var a=i.value,u=a.createPlayableGraph(this.clips),h=a.createOutput(),l=new Au(a,u,h);n[a.getInstanceId()]=l,a.parent||this.masterTrackInstances.push(l)}for(var c,f=o(r);!(c=f()).done;)for(var d,p=c.value,m=n[p.getInstanceId()],v=o(p.getChildTracks());!(d=v()).done;){var y=n[d.value.getInstanceId()];m.addChild(y)}for(var g,x=o(e);!(g=x()).done;){var b=g.value;n[b.key.getInstanceId()].boundObject=b.value}for(var T,E=o(this.masterTrackInstances);!(T=E()).done;){var S=T.value;this.updateTrackAnimatedObject(S)}},e.tickTrack=function(t,e){var i=t.output.context;i.deltaTime=e,t.output.setUserData(t.boundObject);for(var r,n=o(t.mixer.clipPlayables);!(r=n()).done;){var s=r.value;s.getPlayState()===exports.PlayState.Playing&&s.processFrame(i)}t.mixer.evaluate(i);for(var a,u=o(t.children);!(a=u()).done;){var h=a.value;this.tickTrack(h,e)}},e.updateTrackAnimatedObject=function(t){for(var e,i=o(t.children);!(e=i()).done;){var r=e.value;if(!r.boundObject){var n=r.trackAsset.updateAnimatedObject(t.boundObject);r.boundObject=n}this.updateTrackAnimatedObject(r)}},t}();exports.CompositionComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).time=0,e.items=[],e.state=exports.PlayState.Playing,e.reusable=!1,e.sceneBindings=[],e}kt(e,t);var i=e.prototype;return i.onStart=function(){var t;this.timelineAsset||(this.timelineAsset=new exports.TimelineAsset(this.engine)),this.timelineInstance=new wu(this.timelineAsset,this.sceneBindings),null==(t=this.item.composition)||t.refContent.push(this.item)},i.getReusable=function(){return this.reusable},i.pause=function(){this.state=exports.PlayState.Paused},i.resume=function(){this.state=exports.PlayState.Playing},i.onUpdate=function(t){if(this.state!==exports.PlayState.Paused){var e=this.time;this.timelineInstance.setTime(e),this.timelineInstance.evaluate(t/1e3)}},i.onEnable=function(){for(var t,e=o(this.items);!(t=e()).done;){t.value.setActive(!0)}},i.onDisable=function(){for(var t,e=o(this.items);!(t=e()).done;){t.value.setActive(!1)}},i.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},i.hitTest=function(t,e,i,r,n,o){for(var s,u=function(o){var a=s.items[o];if(a.isActive&&a.transform.getValid()&&!exports.VFXItem.isComposition(a)&&!c(a)){var u=a.getHitTestParams(n);if(u){var f=!1,d=new w;if(u.type===exports.HitTestType.triangle)for(var p=u.triangles,m=u.backfaceCulling,v=0;v<p.length;v++){var y=p[v];if(t.intersectTriangle(y,d,m)){f=!0,h.push(d);break}}else if(u.type===exports.HitTestType.box){var g=u.center,x=u.size,b=g.clone().addScaledVector(x,.5),T=g.clone().addScaledVector(x,-.5);t.intersectBox({min:b,max:T},d)&&(f=!0,h.push(d))}else if(u.type===exports.HitTestType.sphere){var E=u.center,S=u.radius;t.intersectSphere({center:E,radius:S},d)&&(f=!0,h.push(d))}else if(u.type===exports.HitTestType.custom){var _=u.collect(t,new A(e,i));_&&_.length>0&&(_.forEach((function(t){h.push(t)})),f=!0)}if(f){var C={compContent:s.item,id:a.id,name:a.name,position:h[h.length-1],parentId:a.parentId,hitPositions:h,behavior:u.behavior};if(a.emit("click",C),r.push(C),l(C))return{v:r}}}}},h=[],l=(null==o?void 0:o.stop)||rt,c=(null==o?void 0:o.skip)||rt,f=(null==o?void 0:o.maxCount)||this.items.length,d=0;d<this.items.length&&r.length<f;d++){var p=(s=this,u(d));if("object"===a(p))return p.v}return r},i.setChildrenRenderOrder=function(t){for(var i,r=o(this.items);!(i=r()).done;){var n=i.value;n.renderOrder=t++;var s=n.getComponent(e);s&&(t=s.setChildrenRenderOrder(t))}return t},i.fromData=function(e){t.prototype.fromData.call(this,e)},e}(Mi),u([we()],exports.CompositionComponent.prototype,"items",void 0),u([we()],exports.CompositionComponent.prototype,"sceneBindings",void 0),u([we()],exports.CompositionComponent.prototype,"timelineAsset",void 0),exports.CompositionComponent=u([Ae("CompositionComponent")],exports.CompositionComponent);var Mu,Ru=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter((function(t){return t.listener!==i})))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];var o;null==(o=e.listeners[t])||o.forEach((function(i){var n=i.listener,o=i.options;n.apply(void 0,[].concat(r)),(null==o?void 0:o.once)&&e.off(t,n)}))},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map((function(t){return t.listener})))||[]}},Iu=function(){function t(){this.update=new Ou,this.lateUpdate=new Nu}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==Mi.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==Mi.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==Mi.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==Mi.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),Pu=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),Ou=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=o(t);!(i=r()).done;){i.value.onUpdate(e)}},e}(Pu),Nu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=o(t);!(i=r()).done;){i.value.onLateUpdate(e)}},e}(Pu),Fu=function(t){function i(r,n){var a,u;(a=t.call(this)||this).sceneTicking=new Iu,a.speed=1,a.isEnded=!1,a.loaderData={},a.refContent=[],a.startTime=0,a.postProcessingEnabled=!1,a.destroyed=!1,a.postLoaders=[],a.paused=!1,a.isEndCalled=!1,a._textures=[],a.videos=[];var h,l=r.reusable,c=void 0!==l&&l,f=r.speed,d=void 0===f?1:f,p=r.baseRenderOrder,m=void 0===p?0:p,v=r.renderer,y=r.event,g=r.width,x=r.height,b=r.handleItemMessage;a.renderer=v,a._textures=n.textures;for(var T,E=o(Object.keys(n.assets));!(T=E()).done;){var S=T.value,_=n.assets[S];s(_,e.HTMLVideoElement)&&a.videos.push(_)}a.postProcessingEnabled=null!=(h=null==(u=n.jsonScene.renderSettings)?void 0:u.postProcessingEnabled)&&h,a.getEngine().renderLevel=n.renderLevel,c&&(n.consumed=!0);for(var C,A=n.jsonScene.compositions[0],w=o(n.jsonScene.compositions);!(C=w()).done;){var M=C.value;M.id===n.jsonScene.compositionId&&(A=M)}K(A),a.rootItem=new exports.VFXItem(a.getEngine()),a.rootItem.setInstanceId(A.id),a.rootItem.name="rootItem",a.rootItem.duration=A.duration,a.rootItem.endBehavior=A.endBehavior,a.rootItem.composition=Cs(a);for(var R,I,P,O,N=o(A.components);!(R=N()).done;){var F=R.value,L=a.getEngine().findObject(F);a.rootItem.components.push(L),L.item=a.rootItem}return a.rootComposition=a.rootItem.getComponent(exports.CompositionComponent),a.width=g,a.height=x,a.renderOrder=m,a.id=A.id,a.startTime=null!=(I=A.startTime)?I:0,a.renderer=v,a.event=y,a.statistic={loadStart:null!=(P=n.startTime)?P:0,loadTime:null!=(O=n.totalTime)?O:0,compileTime:0,firstFrameTime:0},a.reusable=c,a.speed=d,a.name=A.name,a.pluginSystem=n.pluginSystem,a.pluginSystem.initializeComposition(Cs(a),n),a.camera=new Is(a.name,Xe({},null==A?void 0:A.camera,{aspect:g/x,pixelWidth:g,pixelHeight:x})),a.url=n.url,a.interactive=!0,a.handleItemMessage=b,a.createRenderFrame(),i.buildItemTree(a.rootItem),a.rootComposition.setChildrenRenderOrder(0),a.pluginSystem.resetComposition(Cs(a),a.renderFrame),a}kt(i,t);var n=i.prototype;return n.getDuration=function(){return this.rootItem.duration},n.restart=function(){this.reset(),this.forwardTime(this.startTime)},n.setIndex=function(t){this.renderOrder=t},n.getIndex=function(){return this.renderOrder},n.setSpeed=function(t){this.speed=t},n.setVisible=function(t){this.rootItem.setVisible(t)},n.getSpeed=function(){return this.speed},n.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?(this.setTime(this.time-this.startTime),this.resume()):(this.setTime(0),this.resume())},n.pause=function(){this.paused=!0,this.emit("pause")},n.getPaused=function(){return this.paused},n.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var t=this.time;this.emit("play",{time:t})},n.gotoAndPlay=function(t){this.setTime(t),this.emit("goto",{time:t}),this.resume()},n.gotoAndStop=function(t){this.setTime(t),this.emit("goto",{time:t}),this.pause()},n.createRenderFrame=function(){this.renderFrame=new Pn({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},n.setTime=function(t){var e=this.speed,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0)},n.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},n.getComponent=function(t){return this.rootItem.getComponent(t)},n.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},n.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},n.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)})),this.postLoaders.forEach((function(i){return i.postProcessFrame(t,e)}))},n.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.rootItem.awake(),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=1e3*(this.time-e);this.updatePluginLoaders(i),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},n.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===Gt.destroy&&!this.reusable},n.updateCamera=function(){this.camera.updateMatrix()},n.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(i){return i.onCompositionUpdate(e,t)}))},n.updateCompositionTime=function(t){if(this.rootComposition.state!==exports.PlayState.Paused&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e>=i)switch(n=!0,r){case Gt.restart:e%=i,this.restart();break;case Gt.freeze:e=Math.min(i,e);case Gt.forward:case Gt.destroy:}this.rootComposition.time=e+this.startTime,this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},n.getItemByName=function(t){return this.rootItem.find(t)},n.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return oo((t-i.z)/r,(e-i.w)/n,this.camera)},n.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},n.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],o=this.getHitTestRay(t,e);return this.refContent.forEach((function(s){var a;null==(a=s.getComponent(exports.CompositionComponent))||a.hitTest(o,t,e,n,i,r)})),n},n.addInteractiveItem=function(t,e){if(e===Rt.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},n.removeInteractiveItem=function(t,e){e===Rt.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},n.destroyItem=function(t){var e=this;t.type==Pt.composition?t.endBehavior!==Gt.freeze&&t.getComponent(exports.CompositionComponent).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(i){return i.onCompositionItemRemoved(e,t)}))})):(y(this.items,t),this.pluginSystem.plugins.forEach((function(i){return i.onCompositionItemRemoved(e,t)})))},n.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()},n.dispose=function(){var t,e=this;if(!this.destroyed){this.destroyed=!0;for(var i,r=o(this.textures);!(i=r()).done;){i.value.dispose()}this._textures=[];for(var n,s=o(this.videos);!(n=s()).done;){var a=n.value;a.pause(),a.removeAttribute("src"),a.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),null==(t=this.pluginSystem)||t.destroyComposition(this),this.update=function(){it.error("Update disposed composition: "+e.name+".")},this.dispose=rt,this.renderer.env!==Qo&&this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},n.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},n.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},n.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},n.translate=function(t,e,i){this.rootItem.translate(t,e,i)},n.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},n.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},n.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},n.scale=function(t,e,i){this.rootItem.scale(t,e,i)},n.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},n.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},n.reloadTexture=function(){var t=this;return r((function(){return h(this,(function(e){switch(e.label){case 0:return t.textureOffloaded?[4,Promise.all(t.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))()},i.buildItemTree=function(t){for(var e,i=new Map,r=t.getComponent(exports.CompositionComponent).items,n=o(r);!(e=n()).done;){var s=e.value;i.set(s.id,s)}for(var a,u=o(r);!(a=u()).done;){var h=a.value;if(void 0===h.parentId)h.setParent(t);else{var l=i.get(h.parentId);if(!l)throw new Error("The element references a non-existent element, please check the data.");h.setParent(l)}}},wi(i,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),i}(Ru);exports.VFXItem=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).children=[],r.transform=new Ms,r.time=-1,r.duration=0,r.endBehavior=Gt.forward,r.type=Pt.base,r.components=[],r.isDuringPlay=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new Ru,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=e,i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.on=function(t,e,i){this.eventProcessor.on(t,e,i)},i.off=function(t,e){this.eventProcessor.off(t,e)},i.once=function(t,e){this.eventProcessor.once(t,e)},i.emit=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],i))},i.getListeners=function(t){return this.eventProcessor.getListeners(t)},i.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},i.getComponent=function(t){for(var e,i,r=o(this.components);!(i=r()).done;){var n=i.value;if(s(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,i=[],r=o(this.components);!(e=r()).done;){var n=e.value;s(n,t)&&i.push(n)}return i},i.setParent=function(t){(t!==this||t)&&(this.parent&&y(this.parent.children,this),this.parent=t,this.transform.parentTransform=t.transform,t.children.push(this),!this.composition&&t.composition&&(this.composition=t.composition),!this.isDuringPlay&&t.isDuringPlay&&(this.awake(),this.beginPlay()))},i.setColor=function(t,e,i,r){},i.setOpacity=function(t){},i.setActive=function(t){this.active!==!!t&&(this.active=!!t,this.onActiveChanged())},i.setVisible=function(t){for(var e,i=o(this.components);!(e=i()).done;){e.value.enabled=t}this.visible=t},i.getVisible=function(){return this.visible},i.getWorldTransform=function(t){var e=null!=t?t:new Ms({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.translate=function(t,e,i){this.transform.translate(t,e,i)},i.rotate=function(t,e,i){var r=new Kr(t,e,i),n=Ze.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},i.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,o=r.y,s=this.composition.renderer.getWidth()/2,a=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/s-1)*n,(1-2*e/a)*o,i)}},i.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},i.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},i.setScale=function(t,e,i){this.transform.setScale(t,e,i)},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.getCurrentPosition=function(){var t=new w;return this.transform.assignWorldTRS(t),t},i.find=function(t){var e;if(this.name===t)return this;var i=[];(e=i).push.apply(e,[].concat(this.children));for(var r=0;r<i.length;){var n,o=i[r];if(r++,o.name===t)return o;(n=i).push.apply(n,[].concat(o.children))}},i.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.resetGUID();var e=this.engine.findObject({id:this.defination.id});return e.resetGUID(),this.resetGUID(t),this.composition&&e.setParent(this.composition.rootItem),e},i.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=o(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},i.awake=function(){for(var t,e=o(this.components);!(t=e()).done;){var i=t.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var r,n=o(this.children);!(r=n()).done;){r.value.awake()}},i.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},i.onEnable=function(){this.isEnabled=!0;for(var t,e=o(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=o(this.components);!(r=n()).done;){var s=r.value;s.enabled&&!s.isEnableCalled&&s.enable()}},i.onDisable=function(){this.isEnabled=!1;for(var t,e=o(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},i.fromData=function(i){t.prototype.fromData.call(this,i);var r=i.id,n=i.name,a=i.parentId,u=i.endBehavior,h=i.transform,l=i.duration,c=void 0===l?0:l,f=i.visible,d=void 0===f||f;if(this.props=i,this.type=i.type,this.id=r.toString(),this.name=n,h&&this.transform.fromData(h),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=a,this.duration=c,this.endBehavior=u,i.content||(i.content={options:{}}),c<0)throw new Error("Item duration can't be less than 0, see "+Jo["Item duration can't be less than 0"]+".");if(i.components){this.components.length=0;for(var p,m=o(i.components);!(p=m()).done;){var v=p.value,y=this.engine.findObject(v);this.components.push(y),s(y,exports.ParticleSystem)&&(this.components.includes(y.renderer)||this.components.push(y.renderer))}}e.isComposition(this)&&this.instantiatePreComposition(),this.setVisible(d)},i.toData=function(){var t,e;(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=pe.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.defination.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.defination.components){this.defination.components=[];for(var i,r=o(this.components);!(i=r()).done;){var n=i.value;s(n,exports.EffectComponent)&&this.defination.components.push(n)}}this.defination.content={}},i.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,o=this.transform.getWorldPosition().z,s=this.composition.camera.getInverseVPRatio(o),a=s.x,u=s.y;this.transform.translate(2*t*a/r,-2*e*u/n,0)}},i.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var e,i=o(this.components.slice());!(e=i()).done;){e.value.dispose()}this.components=[],this._composition=null,this.transform.setValid(!1)}t.prototype.dispose.call(this)},i.resetChildrenParent=function(){for(var t,e=o(this.children);!(t=e()).done;){var i=t.value;this.parent&&i.setParent(this.parent)}var r;this.parent&&y(null==(r=this.parent)?void 0:r.children,this)},i.instantiatePreComposition=function(){var t=this.props.content.options.refId,e=this.engine.findEffectsObjectData(t);if(!e)throw new Error("Referenced precomposition with Id: "+t+" does not exist.");var i=e.components,r=this.getInstanceId();this.setInstanceId(e.id);for(var n,a=o(i);!(n=a()).done;){var u=n.value,h=this.engine.findObject(u);if(h.item=this,this.components.push(h),h.setInstanceId(ft()),s(h,exports.CompositionComponent))for(var l,c=o(h.items);!(l=c()).done;){var f=l.value;f.setInstanceId(ft());for(var d,p=o(f.components);!(d=p()).done;){d.value.setInstanceId(ft())}}}this.setInstanceId(r),Fu.buildItemTree(this)},i.resetGUID=function(t){var e,i=null!=(e=null==t?void 0:t.get(this))?e:ft();this.setInstanceId(i);for(var r,n=o(this.components);!(r=n()).done;){var s,a=r.value,u=null!=(s=null==t?void 0:t.get(a))?s:ft();a.setInstanceId(u)}for(var h,l=o(this.children);!(h=l()).done;){h.value.resetGUID(t)}},i.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=o(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,s=o(this.children);!(n=s()).done;){n.value.gatherPreviousObjectID(t)}},e.isComposition=function(t){return t.type===Pt.composition},e.isSprite=function(t){return t.type===Pt.sprite},e.isParticle=function(t){return t.type===Pt.particle},e.isNull=function(t){return t.type===Pt.null},e.isTree=function(t){return t.type===Pt.tree},e.isCamera=function(t){return t.type===Pt.camera},e.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},wi(e,[{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=o(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=o(this.components);!(e=i()).done;){var r=e.value;s(r,Ii)&&(r.priority=t)}}}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),e}(Re),exports.VFXItem=u([Ae(pe.VFXItemData)],exports.VFXItem),exports.Item=void 0,(Mu=exports.Item||(exports.Item={})).is=function(t,e){return t.type===e},Mu.isComposition=function(t){return t.type===Pt.composition},Mu.isParticle=function(t){return t.type===Pt.particle},Mu.isNull=function(t){return t.type===Pt.null};var Lu=[1,1,1,1],Vu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}kt(e,t);var i=e.prototype;return i.processFrame=function(t){var e=t.output.getUserData();if(s(e,exports.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(e)),!this.activeMaterial){var i,r;this.activeMaterial=null==(i=this.activeComponent)?void 0:i.material;var n=null==(r=this.activeMaterial)?void 0:r.getColor("_Color");n&&(this.startColor=n.toArray())}var o,a,u,h=eo(Lu,1),l=this.time/this.getDuration(),c=this.opacityOverLifetime,f=this.colorOverLifetime;if(f&&(h=P(f,l,!0),o=!0),c&&(h[3]*=c.getValue(l),o=!0),o)io(this.renderColor,h,this.startColor),null==(u=this.activeMaterial)||null==(a=u.getColor("_Color"))||a.setFromArray(this.renderColor)}},i.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;i&&(this.opacityOverLifetime=ns(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===Ut.GRADIENT_COLOR&&(this.colorOverLifetime=O(i.color[1])));return this},i.getActiveComponent=function(t){return t.getComponent(Yn)},e}(Es);exports.AnimationClip=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e}kt(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=C(e,0,this.duration),n=o(this.positionCurves);!(i=n()).done;){var s=i.value,a=s.keyFrames.getValue(r),u=this.findTarget(t,s.path);null==u||u.transform.setPosition(a.x,a.y,a.z)}for(var h,l=o(this.rotationCurves);!(h=l()).done;){var c=h.value,f=c.keyFrames.getValue(r),d=this.findTarget(t,c.path);null==d||d.transform.setQuaternion(f.x,f.y,f.z,f.w)}for(var p,m=o(this.eulerCurves);!(p=m()).done;){var v=p.value,y=v.keyFrames.getValue(r),g=this.findTarget(t,v.path);null==g||g.transform.setRotation(y.x,y.y,y.z)}for(var x,b=o(this.scaleCurves);!(x=b()).done;){var T=x.value,E=T.keyFrames.getValue(r),S=this.findTarget(t,T.path);null==S||S.transform.setScale(E.x,E.y,E.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=o(t.positionCurves);!(i=r()).done;){var n=i.value,s={path:n.path,keyFrames:ns(n.keyFrames)};e=Math.max(e,s.keyFrames.getMaxTime()),this.positionCurves.push(s)}if(t.rotationCurves)for(var a,u=o(t.rotationCurves);!(a=u()).done;){var h=a.value,l={path:h.path,keyFrames:ns(h.keyFrames)};e=Math.max(e,l.keyFrames.getMaxTime()),this.rotationCurves.push(l)}if(t.eulerCurves)for(var c,f=o(t.eulerCurves);!(c=f()).done;){var d=c.value,p={path:d.path,keyFrames:ns(d.keyFrames)};e=Math.max(e,p.keyFrames.getMaxTime()),this.eulerCurves.push(p)}if(t.scaleCurves)for(var m,v=o(t.scaleCurves);!(m=v()).done;){var y=m.value,g={path:y.path,keyFrames:ns(y.keyFrames)};e=Math.max(e,g.keyFrames.getMaxTime()),this.scaleCurves.push(g)}if(t.floatCurves)for(var x,b=o(t.floatCurves);!(x=b()).done;){var T=x.value,E={path:T.path,keyFrames:ns(T.keyFrames),property:T.property,className:T.className};e=Math.max(e,E.keyFrames.getMaxTime()),this.floatCurves.push(E)}if(t.colorCurves)for(var S,_=o(t.colorCurves);!(S=_()).done;){var C=S.value,A={path:C.path,keyFrames:ns(C.keyFrames),property:C.property,className:C.className};e=Math.max(e,A.keyFrames.getMaxTime()),this.colorCurves.push(A)}void 0!==t.duration?this.duration=t.duration:this.duration=e},i.findTarget=function(t,e){for(var i,r=t,n=o(e.split("."));!(i=n()).done;){for(var s,a=i.value,u=!1,h=o(r.children);!(s=h()).done;){var l=s.value;if(l.name===a){r=l,u=!0;break}}if(!u)return}return r},e}(Re),exports.AnimationClip=u([Ae(pe.AnimationClip)],exports.AnimationClip);var Du=[[0,0,1,1,0]],ku=0;exports.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}kt(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new Vu;return t.create(this.data),t},i.fromData=function(t){this.data=t},e}(_s),exports.SpriteColorPlayableAsset=u([Ae(pe.SpriteColorPlayableAsset)],exports.SpriteColorPlayableAsset);var zu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createTrackMixer=function(){return new iu},e}(exports.TrackAsset),Uu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(exports.SpriteComponent)},e}(zu),Bu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(exports.EffectComponent)},e}(zu),Gu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.createPlayable=function(){return new ju},e}(_s),ju=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(Es);function Xu(t){return t.maxVertexUniforms>=256?exports.maxSpriteMeshItemCount=32:t.maxVertexUniforms>=128?exports.maxSpriteMeshItemCount=16:void 0}exports.SpriteComponent=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).time=0,r.duration=0,r.loop=!0,r.splits=Du,r.name="MSprite"+ku++,i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.onUpdate=function(t){var e=this,i=this.time,r=this.duration;i>r&&this.loop&&(i%=r);var n=Math.min(Math.max(i/r,0),1),o=this.textureSheetAnimation,s=this.renderer.texture.source.video;if(s&&(0===i?s.pause():s.play().catch((function(t){e.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),o){var a,u,h,l,c,f=o.total||o.row*o.col,d=0,p=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],d=y[0],p=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/o.row*m,l=1/o.col*v):(h=1/o.col*m,l=1/o.row*v),o.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/o.col),b=g-x*o.col;c=u?[h*x,l*(o.col-b)]:[h*b,l*(1+x)]}else c=[0,l];null==(a=this.material.getVector4("_TexOffset"))||a.setFromArray([d+c[0],v+p-c[1],h,l])}this.time=i+t/1e3},i.onDisable=function(){t.prototype.onDisable.call(this),this.time=0},i.onDestroy=function(){var t=this.renderer.texture.source;t.sourceType===exports.TextureSourceType.video&&(null==t?void 0:t.video)&&(t.video.pause(),t.video.src="",t.video.load())},i.updateGeometry=function(t){var e=this.textureSheetAnimation?[0,0,1,1,this.splits[0][4]]:this.splits[0],i=e[0],r=e[1],n=Boolean(e[4]),s=n?e[3]:e[2],a=n?e[2]:e[3],u=n?-Math.PI/2:0,h=t.getAttributeData("aUV"),l=t.getAttributeData("aPos"),c=t.getIndexData(),f=[0,0];if(h&&l&&c){for(var d=h.length/2,p=0;p<d;p++){var m=3*p,v=2*p,y=l[m],g=l[m+1];f[0]=y,f[1]=g,Ea(f,f,u),h[v]=(f[0]+.5)*s+i,h[v+1]=(f[1]+.5)*a+r}this.geometry.setAttributeData("aPos",l.slice()),this.geometry.setAttributeData("aUV",h.slice()),this.geometry.setIndexData(c.slice()),this.geometry.setDrawCount(c.length)}this.geometry.subMeshes.length=0;for(var x,b=o(t.subMeshes);!(x=b()).done;){var T=x.value;this.geometry.subMeshes.push({offset:T.offset,indexCount:T.indexCount,vertexCount:T.vertexCount})}},i.updateGeometryFromMultiSplit=function(){for(var t=this.splits,e=this.textureSheetAnimation,i=this.defaultGeometry,r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],n=[],o=[],s=[],a=0;a<2;a++)for(var u=0;u<2;u++){var h=4*(2*u+a),l=e?[0,0,1,1,t[0][4]]:t[2*u+a],c=l[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],f=((a+a+1)/2-1)/2,d=((u+u+1)/2-1)/2,p=l[0],m=l[1],v=l[4]?l[3]:l[2],y=l[4]?l[2]:l[3],g=[r[0]/2+f,r[1]/2+d,r[2]/2+f,r[3]/2+d,r[4]/2+f,r[5]/2+d,r[6]/2+f,r[7]/2+d];n.push(c[0]*v+p,c[1]*y+m,c[2]*v+p,c[3]*y+m,c[4]*v+p,c[5]*y+m,c[6]*v+p,c[7]*y+m),s.push(1*g[0],1*g[1],0,1*g[2],1*g[3],0,1*g[4],1*g[5],0,1*g[6],1*g[7],0),o.push(h,1+h,2+h,2+h,1+h,3+h)}i.setAttributeData("aPos",new Float32Array(s)),i.setIndexData(new Uint16Array(o)),i.setAttributeData("aUV",new Float32Array(n)),i.setDrawCount(o.length)},i.fromData=function(e){var i;t.prototype.fromData.call(this,e);var r=null!=(i=e.splits)?i:Du,n=e.textureSheetAnimation;this.splits=r,this.textureSheetAnimation=n;var o=e.geometry?this.engine.findObject(e.geometry):this.defaultGeometry;1===r.length?this.updateGeometry(o):this.updateGeometryFromMultiSplit(),this.interaction=e.interaction;var s,a,u=e.options.startColor||[1,1,1,1];this.material.setColor("_Color",(new R).setFromArray(u)),this.duration=null!=(s=e.duration)?s:this.item.duration,this.loop=null==(a=e.loop)||a},e}(Yn),exports.SpriteComponent=u([Ae(pe.SpriteComponent)],exports.SpriteComponent),exports.maxSpriteMeshItemCount=8;var Hu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt),Wu=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt),Yu=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){return this.set(t.x,t.y),this},e.copyTo=function(t){return t.set(this.x,this.y),t},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},wi(t,null,[{key:"shared",get:function(){return Zu.x=0,Zu.y=0,Zu}}]),t}(),Zu=new Yu,qu=1e-4,Ku=1e-4;function Qu(t,e,i,r,n,o,s,a){var u,h;s?(u=r,h=-i):(u=-r,h=i);var l=t-i*n+u,c=e-r*n+h,f=t+i*o+u,d=e+r*o+h;return a.push(l,c),a.push(f,d),2}function Ju(t,e,i,r,n,o,s,a){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,o-e);a&&l<c?l+=2*Math.PI:!a&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.abs(d),m=Math.sqrt(u*u+h*h),v=1+(15*p*Math.sqrt(m)/Math.PI>>0),y=d/v;if(f+=y,a){s.push(t,e),s.push(i,r);for(var g=1,x=f;g<v;g++,x+=y)s.push(t,e),s.push(t+Math.sin(x)*m,e+Math.cos(x)*m);s.push(t,e),s.push(n,o)}else{s.push(i,r),s.push(t,e);for(var b=1,T=f;b<v;b++,T+=y)s.push(t+Math.sin(T)*m,e+Math.cos(T)*m),s.push(t,e);s.push(n,o),s.push(t,e)}return 2*v}function $u(t,e,i,r,n,o,s,a,u){var h=qu;if(0!==t.length){var l=e,c=l.alignment;if(.5!==e.alignment){var f=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],o=t[e-1];r<e;r+=2){var s=t[r],a=t[r+1];i+=(s-n)*(a+o),n=s,o=a}return i<0?-1:1}(t);i&&(f*=-1),c=(c-.5)*f+.5}var d=new Yu(t[0],t[1]),p=new Yu(t[t.length-2],t[t.length-1]),m=r,v=Math.abs(d.x-p.x)<h&&Math.abs(d.y-p.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));var y=.5*(d.x+p.x),g=.5*(p.y+d.y);t.unshift(y,g),t.push(y,g)}var x=n,b=t.length/2,T=t.length,S=x.length/2,_=l.width/2,C=_*_,A=l.miterLimit*l.miterLimit,w=t[0],M=t[1],R=t[2],I=t[3],P=0,O=0,N=-(M-I),F=w-R,L=0,V=0,D=Math.sqrt(N*N+F*F)+E;N/=D,F/=D,N*=_,F*=_;var k=2*(1-c),z=2*c;m||(l.cap===he.Round?T+=Ju(w-N*(k-z)*.5,M-F*(k-z)*.5,w-N*k,M-F*k,w+N*z,M+F*z,x,!0)+2:l.cap===he.Square&&(T+=Qu(w,M,N,F,k,z,!0,x))),x.push(w-N*k,M-F*k),x.push(w+N*z,M+F*z);for(var U=1;U<b-1;++U){w=t[2*(U-1)],M=t[2*(U-1)+1],R=t[2*U],I=t[2*U+1],P=t[2*(U+1)],O=t[2*(U+1)+1],N=-(M-I),F=w-R,N/=D=Math.sqrt(N*N+F*F)+E,F/=D,N*=_,F*=_,L=-(I-O),V=R-P,L/=D=Math.sqrt(L*L+V*V)+E,V/=D,L*=_,V*=_;var B=R-w,G=M-I,j=R-P,X=O-I,H=B*j+G*X,W=G*j-X*B,Y=W<0;if(Math.abs(W)<.001*Math.abs(H))x.push(R-N*k,I-F*k),x.push(R+N*z,I+F*z),H>=0&&(l.join===le.Round?T+=Ju(R,I,R-N*k,I-F*k,R-L*k,I-V*k,x,!1)+4:T+=2,x.push(R-L*z,I-V*z),x.push(R+L*k,I+V*k));else{var Z=(-N+w)*(-F+I)-(-N+R)*(-F+M),q=(-L+P)*(-V+I)-(-L+R)*(-V+O),K=(B*q-j*Z)/W,Q=(X*Z-G*q)/W,J=(K-R)*(K-R)+(Q-I)*(Q-I),$=R+(K-R)*k,tt=I+(Q-I)*k,et=R-(K-R)*z,it=I-(Q-I)*z,rt=Y?k:z;J<=Math.min(B*B+G*G,j*j+X*X)+rt*rt*C?l.join===le.Bevel||J/C>A?(Y?(x.push($,tt),x.push(R+N*z,I+F*z),x.push($,tt),x.push(R+L*z,I+V*z)):(x.push(R-N*k,I-F*k),x.push(et,it),x.push(R-L*k,I-V*k),x.push(et,it)),T+=2):l.join===le.Round?Y?(x.push($,tt),x.push(R+N*z,I+F*z),T+=Ju(R,I,R+N*z,I+F*z,R+L*z,I+V*z,x,!0)+4,x.push($,tt),x.push(R+L*z,I+V*z)):(x.push(R-N*k,I-F*k),x.push(et,it),T+=Ju(R,I,R-N*k,I-F*k,R-L*k,I-V*k,x,!1)+4,x.push(R-L*k,I-V*k),x.push(et,it)):(x.push($,tt),x.push(et,it)):(x.push(R-N*k,I-F*k),x.push(R+N*z,I+F*z),l.join===le.Round?T+=Y?Ju(R,I,R+N*z,I+F*z,R+L*z,I+V*z,x,!0)+2:Ju(R,I,R-N*k,I-F*k,R-L*k,I-V*k,x,!1)+2:l.join===le.Miter&&J/C<=A&&(Y?(x.push(et,it),x.push(et,it)):(x.push($,tt),x.push($,tt)),T+=2),x.push(R-L*k,I-V*k),x.push(R+L*z,I+V*z),T+=2)}}w=t[2*(b-2)],M=t[2*(b-2)+1],R=t[2*(b-1)],N=-(M-(I=t[2*(b-1)+1])),F=w-R,N/=D=Math.sqrt(N*N+F*F)+E,F/=D,N*=_,F*=_,x.push(R-N*k,I-F*k),x.push(R+N*z,I+F*z),m||(l.cap===he.Round?T+=Ju(R-N*(k-z)*.5,I-F*(k-z)*.5,R-N*k,I-F*k,R+N*z,I+F*z,x,!1)+2:l.cap===he.Square&&(T+=Qu(R,I,N,F,k,z,!1,x)));for(var nt=Ku*Ku,ot=S;ot<T+S-2;++ot)w=x[2*ot],M=x[2*ot+1],R=x[2*(ot+1)],I=x[2*(ot+1)+1],P=x[2*(ot+2)],O=x[2*(ot+2)+1],Math.abs(w*(I-O)+R*(O-M)+P*(M-I))<nt||a.push(ot,ot+1,ot+2)}}var th=function(){},eh="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ih={exports:{}};!function(t){var e;function i(t,e){return t.b===e.b&&t.a===e.a}function r(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function o(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function s(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function a(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function u(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function h(t){return r(t.b.a,t.a)}function l(t){return r(t.a,t.b.a)}function c(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function d(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,E(e.a,t.a)),e.d!==t.d&&(i=!0,S(e.d,t.d)),g(e,t),r||(x(e,t.a),t.a.c=t),i||(b(e,t.d),t.d.a=t))}function p(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,S(t.d,t.b.d)),t.c===t?E(t.a,null):(t.b.d.a=$(t),t.a.c=t.c,g(t,$(t)),i||b(t,t.d)),e.c===e?(E(e.a,null),S(e.d,null)):(t.d.a=$(e),e.a.c=e.c,g(e,$(e))),T(t)}function m(t){var e=y(t),i=e.b;return g(e,t.e),e.a=t.b.a,x(i,e.a),e.d=i.d=t.d,e=e.b,g(t.b,$(t.b)),g(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function v(t,e){var i=!1,r=y(t),n=r.b;return e.d!==t.d&&(i=!0,S(e.d,t.d)),g(r,t.e),g(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||b(r,t.d),r}function y(t){var e=new J,i=new J,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function g(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function x(t,e){var i=e.f,r=new et(e,i);i.e=r,e.f=r,i=r.c=t;do{i.a=r,i=i.c}while(i!==t)}function b(t,e){var i=e.d,r=new Q(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do{i.d=r,i=i.e}while(i!==t)}function T(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function E(t,e){var i=t.c,r=i;do{r.a=e,r=r.c}while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function S(t,e){var i=t.a,r=i;do{r.d=e,r=r.e}while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function _(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var C=4e150;function A(t,e){t.f+=e.f,t.b.f+=e.b.f}function w(t,e,i){return t=t.a,e=e.a,i=i.a,e.b.a===t?i.b.a===t?r(e.a,i.a)?0>=o(i.b.a,e.a,i.a):0<=o(e.b.a,i.a,e.a):0>=o(i.b.a,t,i.a):i.b.a===t?0<=o(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(i.b.a,t,i.a))}function M(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function R(t,e){p(t.a),t.c=!1,t.a=e,e.i=t}function I(t){var e=t.a.a;do{t=dt(t)}while(t.a.a===e);return t.c&&(R(t,e=v(ft(t).a.b,t.a.e)),t=dt(t)),t}function P(t,e,i){var r=new ct;return r.a=i,r.e=H(t.f,e.e,r),i.i=r}function O(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function N(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,M(t)}function F(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=ft(t),n=r.a;if(n.a!==e.a){if(!r.c){N(t);break}R(r,n=v(e.c.b,n.b))}e.c!==n&&(d($(n),n),d(e,n)),N(t),e=r.a,t=r}return e}function L(t,e,i,r,n,o){var s=!0;do{P(t,e,i.b),i=i.c}while(i!==r);for(null===n&&(n=ft(e).a.b.c);(i=(r=ft(e)).a.b).a===n.a;)i.c!==n&&(d($(i),i),d($(n),i)),r.f=e.f-i.f,r.d=O(t,r.f),e.b=!0,!s&&z(t,e)&&(A(i,n),M(e),p(n)),s=!1,e=r,n=i;e.b=!0,o&&B(t,e)}function V(t,e,i,r,n){var o=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(o,i,r,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=i[0])}function D(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),d(e,i)}function k(t,e,i,r,n){var o=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),s=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),a=n+1;r[n]=.5*s/(o+s),r[a]=.5*o/(o+s),t.g[0]+=r[n]*e.g[0]+r[a]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[a]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[a]*i.g[2]}function z(t,e){var n=ft(e),s=e.a,a=n.a;if(r(s.a,a.a)){if(0<o(a.b.a,s.a,a.a))return!1;if(i(s.a,a.a)){if(s.a!==a.a){n=t.e;var u=s.a.h;if(0<=u){var h=(n=n.b).d,l=n.e,c=n.c,f=c[u];h[f]=h[n.a],c[h[f]]=f,f<=--n.a&&(1>=f||r(l[h[f>>1]],l[h[f]])?ht(n,f):lt(n,f)),l[u]=null,c[u]=n.b,n.b=u}else for(n.c[-(u+1)]=null;0<n.a&&null===n.c[n.d[n.a-1]];)--n.a;D(t,$(a),s)}}else m(a.b),d(s,$(a)),e.b=n.b=!0}else{if(0>o(s.b.a,a.a,s.a))return!1;dt(e).b=e.b=!0,m(s.b),d($(a),s)}return!0}function U(t,e){var h=ft(e),l=e.a,f=h.a,p=l.a,v=f.a,y=l.b.a,g=f.b.a,x=new et;if(o(y,t.a,p),o(g,t.a,v),p===v||Math.min(p.a,y.a)>Math.max(v.a,g.a))return!1;if(r(p,v)){if(0<o(g,p,v))return!1}else if(0>o(y,v,p))return!1;var b,T,E=y,S=p,_=g,C=v;if(r(E,S)||(b=E,E=S,S=b),r(_,C)||(b=_,_=C,C=b),r(E,_)||(b=E,E=_,_=b,b=S,S=C,C=b),r(_,S)?r(S,C)?(0>(b=n(E,_,S))+(T=n(_,S,C))&&(b=-b,T=-T),x.b=c(b,_.b,T,S.b)):(0>(b=o(E,_,S))+(T=-o(E,C,S))&&(b=-b,T=-T),x.b=c(b,_.b,T,C.b)):x.b=(_.b+S.b)/2,s(E,S)||(b=E,E=S,S=b),s(_,C)||(b=_,_=C,C=b),s(E,_)||(b=E,E=_,_=b,b=S,S=C,C=b),s(_,S)?s(S,C)?(0>(b=a(E,_,S))+(T=a(_,S,C))&&(b=-b,T=-T),x.a=c(b,_.a,T,S.a)):(0>(b=u(E,_,S))+(T=-u(E,C,S))&&(b=-b,T=-T),x.a=c(b,_.a,T,C.a)):x.a=(_.a+S.a)/2,r(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=r(p,v)?p:v,r(E,x)&&(x.b=E.b,x.a=E.a),i(x,p)||i(x,v))return z(t,e),!1;if(!i(y,t.a)&&0<=o(y,t.a,x)||!i(g,t.a)&&0>=o(g,t.a,x)){if(g===t.a)return m(l.b),d(f.b,l),l=ft(e=I(e)).a,F(t,ft(e),h),L(t,e,$(l),l,l,!0),!0;if(y===t.a){m(f.b),d(l.e,$(f)),v=(p=h=e).a.b.a;do{p=dt(p)}while(p.a.b.a===v);return p=ft(e=p).a.b.c,h.a=$(f),L(t,e,(f=F(t,h,null)).c,l.b.c,p,!0),!0}return 0<=o(y,t.a,x)&&(dt(e).b=e.b=!0,m(l.b),l.a.b=t.a.b,l.a.a=t.a.a),0>=o(g,t.a,x)&&(e.b=h.b=!0,m(f.b),f.a.b=t.a.b,f.a.a=t.a.a),!1}return m(l.b),m(f.b),d($(f),l),l.a.b=x.b,l.a.a=x.a,l.a.h=rt(t.e,l.a),l=l.a,f=[0,0,0,0],x=[p.d,y.d,v.d,g.d],l.g[0]=l.g[1]=l.g[2]=0,k(l,p,y,f,0),k(l,v,g,f,2),V(t,l,x,f,!0),dt(e).b=e.b=h.b=!0,!1}function B(t,e){for(var i=ft(e);;){for(;i.b;)e=i,i=ft(i);if(!e.b&&(i=e,null===(e=dt(e))||!e.b))break;e.b=!1;var n,s=e.a,a=i.a;if(n=s.b.a!==a.b.a)t:{var u=ft(n=e),h=n.a,l=u.a,c=void 0;if(r(h.b.a,l.b.a)){if(0>o(h.b.a,l.b.a,h.a)){n=!1;break t}dt(n).b=n.b=!0,c=m(h),d(l.b,c),c.d.c=n.d}else{if(0<o(l.b.a,h.b.a,l.a)){n=!1;break t}n.b=u.b=!0,c=m(l),d(h.e,l.b),c.b.d.c=n.d}n=!0}if(n&&(i.c?(M(i),p(a),a=(i=ft(e)).a):e.c&&(M(e),p(s),s=(e=dt(i)).a)),s.a!==a.a)if(s.b.a===a.b.a||e.c||i.c||s.b.a!==t.a&&a.b.a!==t.a)z(t,e);else if(U(t,e))break;s.a===a.a&&s.b.a===a.b.a&&(A(a,s),M(e),p(s),e=dt(i))}}function G(t,e){t.a=e;for(var n=e.c;null===n.i;)if((n=n.c)===e.c){n=t;var s=e;(h=new ct).a=s.c.b;var a=(c=n.f).a;do{a=a.a}while(null!==a.b&&!c.c(c.b,h,a.b));var u=ft(c=a.b),h=c.a;a=u.a;if(0===o(h.b.a,s,h.a))i((h=c.a).a,s)||i(h.b.a,s)||(m(h.b),c.c&&(p(h.c),c.c=!1),d(s.c,h),G(n,s));else{var l=r(a.b.a,h.b.a)?c:u;u=void 0;c.d||l.c?(u=l===c?v(s.c.b,h.e):v(a.b.c.b,s.c).b,l.c?R(l,u):(h=n,(c=P(n,c,u)).f=dt(c).f+c.a.f,c.d=O(h,c.f)),G(n,s)):L(n,c,s.c,s.c,null,!0)}return}if(c=(h=ft(n=I(n.i))).a,(h=F(t,h,null)).c===c){h=(c=h).c,a=ft(n),u=n.a,l=a.a;var c,f=!1;u.b.a!==l.b.a&&U(t,n),i(u.a,t.a)&&(d($(h),u),h=ft(n=I(n)).a,F(t,ft(n),a),f=!0),i(l.a,t.a)&&(d(c,$(l)),c=F(t,a,null),f=!0),f?L(t,n,c.c,h,h,!0):(s=r(l.a,u.a)?$(l):u,L(t,n,s=v(c.c.b,s),s.c,s.c,!1),s.b.i.c=!0,B(t,n))}else L(t,n,h.c,c,c,!0)}function j(t,e){var i=new ct,r=f(t.b);r.a.b=C,r.a.a=e,r.b.a.b=-C,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=H(r=t.f,r.a,i),i.e=r}function X(t){this.a=new W,this.b=t,this.c=w}function H(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i));return t=new W(i,e.a,e),e.a.c=t,e.a=t}function W(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function Y(){this.d=Z,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var Z=0;function q(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case Z:K(t,100151),t.u(null);break;case 1:K(t,100152),t.t()}else switch(t.d){case 2:K(t,100154),t.v();break;case 1:K(t,100153),t.w()}}function K(t,e){t.p&&t.p(e,t.c)}function Q(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function J(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function $(t){return t.b.e}function tt(){this.c=new et,this.a=new Q,this.b=new J,this.d=new J,this.b.b=this.d,this.d.b=this.b}function et(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function it(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new ot}function rt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=st(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&<(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function nt(t){if(0===t.a)return ut(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&r(at(t.b),e))return ut(t.b);do{--t.a}while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function ot(){this.d=st([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function st(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function at(t){return t.e[t.d[1]]}function ut(t){var e=t.d,i=t.e,r=t.c,n=e[1],o=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),o}function ht(t,e){for(var i=t.d,n=t.e,o=t.c,s=e,a=i[s];;){var u=s<<1;u<t.a&&r(n[i[u+1]],n[i[u]])&&(u+=1);var h=i[u];if(u>t.a||r(n[a],n[h])){i[s]=a,o[a]=s;break}i[s]=h,o[h]=s,s=u}}function lt(t,e){for(var i=t.d,n=t.e,o=t.c,s=e,a=i[s];;){var u=s>>1,h=i[u];if(0===u||r(n[h],n[a])){i[s]=a,o[a]=s;break}i[s]=h,o[h]=s,s=u}}function ct(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function ft(t){return t.e.c.b}function dt(t){return t.e.a.b}(e=Y.prototype).x=function(){q(this,Z)},e.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=e)}break;case 100141:return void(this.m=!!e);default:return void K(this,100900)}K(this,100901)},e.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:K(this,100900)}return!1},e.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},e.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:K(this,100900)}},e.C=function(t,e){var i=!1,r=[0,0,0];q(this,2);for(var n=0;3>n;++n){var o=t[n];-1e150>o&&(o=-1e150,i=!0),1e150<o&&(o=1e150,i=!0),r[n]=o}i&&K(this,100155),null===(i=this.q)?d(i=f(this.b),i.b):(m(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},e.u=function(t){q(this,Z),this.d=1,this.b=new tt,this.c=t},e.t=function(){q(this,1),this.d=2,this.q=null},e.v=function(){q(this,2),this.d=1},e.w=function(){q(this,1),this.d=Z;var t=!1,e=[c=this.j[0],n=this.j[1],a=this.j[2]];if(0===c&&0===n&&0===a){for(var n=[-2e150,-2e150,-2e150],s=[2e150,2e150,2e150],a=[],u=[],c=(t=this.b.c).e;c!==t;c=c.e)for(var f=0;3>f;++f){var d=c.g[f];d<s[f]&&(s[f]=d,u[f]=c),d>n[f]&&(n[f]=d,a[f]=c)}if(c=0,n[1]-s[1]>n[0]-s[0]&&(c=1),n[2]-s[2]>n[c]-s[c]&&(c=2),s[c]>=n[c])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,s=u[c],a=a[c],u=[0,0,0],s=[s.g[0]-a.g[0],s.g[1]-a.g[1],s.g[2]-a.g[2]],f=[0,0,0],c=t.e;c!==t;c=c.e)f[0]=c.g[0]-a.g[0],f[1]=c.g[1]-a.g[1],f[2]=c.g[2]-a.g[2],u[0]=s[1]*f[2]-s[2]*f[1],u[1]=s[2]*f[0]-s[0]*f[2],u[2]=s[0]*f[1]-s[1]*f[0],(d=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=d,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[_(s)]=1)}t=!0}for(u=_(e),c=this.b.c,n=(u+1)%3,a=(u+2)%3,u=0<e[u]?1:-1,e=c.e;e!==c;e=e.e)e.b=e.g[n],e.a=u*e.g[a];if(t){for(e=0,c=(t=this.b.a).b;c!==t;c=c.b)if(!(0>=(n=c.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==c.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,c=(e=this.b.b).h;c!==e;c=t)t=c.h,n=c.e,i(c.a,c.b.a)&&c.e.e!==c&&(D(this,n,c),p(c),n=(c=n).e),n.e===c&&(n!==c&&(n!==t&&n!==t.b||(t=t.h),p(n)),c!==t&&c!==t.b||(t=t.h),p(c));for(this.e=e=new it,c=(t=this.b.c).e;c!==t;c=c.e)c.h=rt(e,c);for(function(t){t.d=[];for(var e=0;e<t.a;e++)t.d[e]=e;t.d.sort(function(t){return function(e,i){return r(t[e],t[i])?1:-1}}(t.c)),t.e=!0,function(t){for(var e=t.a;1<=e;--e)ht(t,e);t.h=!0}(t.b)}(e),this.f=new X(this),j(this,-C),j(this,C);null!==(e=nt(this.e));){for(;;){t:if(c=this.e,0===c.a)t=at(c.b);else if(t=c.c[c.d[c.a-1]],0!==c.b.a&&(c=at(c.b),r(c,t))){t=c;break t}if(null===t||!i(t,e))break;t=nt(this.e),D(this,e.c,t.c)}G(this,e)}for(this.a=this.f.a.a.b.a.a,e=0;null!==(t=this.f.a.a.b);)t.h||++e,M(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,c=(e=this.b).a.b;c!==e.a;c=t)t=c.b,(c=c.a).e.e===c&&(A(c.c,c),p(c));if(!this.n){if(e=this.b,this.m)for(c=e.b.h;c!==e.b;c=t)t=c.h,c.b.d.c!==c.d.c?c.f=c.d.c?1:-1:p(c);else for(c=e.a.b;c!==e.a;c=t)if(t=c.b,c.c){for(c=c.a;r(c.b.a,c.a);c=c.c.b);for(;r(c.a,c.b.a);c=c.e);for(n=c.c.b,a=void 0;c.e!==n;)if(r(c.b.a,n.a)){for(;n.e!==c&&(h(n.e)||0>=o(n.a,n.b.a,n.e.b.a));)n=(a=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==c&&(l(c.c.b)||0<=o(c.b.a,c.a,c.c.b.a));)c=(a=v(c,c.c.b)).b;c=c.e}for(;n.e.e!==c;)n=(a=v(n.e,n)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(t=(e=this.b).a.b;t!==e.a;t=t.b)if(t.c){this.h&&this.h(2,this.c),c=t.a;do{this.k&&this.k(c.a.d,this.c),c=c.e}while(c!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,c=!1,n=-1,a=e.a.d;a!==e.a;a=a.d)if(a.c){c||(this.h&&this.h(4,this.c),c=!0),u=a.a;do{t&&(n!==(s=u.b.d.c?0:1)&&(n=s,this.l&&this.l(!!n,this.c))),this.k&&this.k(u.a.d,this.c),u=u.e}while(u!==a.a)}c&&this.i&&this.i(this.c)}if(this.r){for(c=(e=this.b).a.b;c!==e.a;c=t)if(t=c.b,!c.c){a=(n=c.a).e,u=void 0;do{a=(u=a).e,u.d=null,null===u.b.d&&(u.c===u?E(u.a,null):(u.a.c=u.c,g(u,$(u))),(s=u.b).c===s?E(s.a,null):(s.a.c=s.c,g(s,$(s))),T(u))}while(u!==n);n=c.d,(c=c.b).d=n,n.b=c}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},eh.libtess={GluTesselator:Y,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},Y.prototype.gluDeleteTess=Y.prototype.x,Y.prototype.gluTessProperty=Y.prototype.B,Y.prototype.gluGetTessProperty=Y.prototype.y,Y.prototype.gluTessNormal=Y.prototype.A,Y.prototype.gluTessCallback=Y.prototype.z,Y.prototype.gluTessVertex=Y.prototype.C,Y.prototype.gluTessBeginPolygon=Y.prototype.u,Y.prototype.gluTessBeginContour=Y.prototype.t,Y.prototype.gluTessEndContour=Y.prototype.v,Y.prototype.gluTessEndPolygon=Y.prototype.w,t.exports=eh.libtess}(ih);var rh=function(){var t=new ih.exports.GluTesselator;return t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==ih.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,i){return[t[0],t[1],t[2]]})),t.gluTessCallback(ih.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function nh(t){rh.gluTessNormal(0,0,1);var e=[];rh.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){rh.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var o=[r[n],r[n+1],0];rh.gluTessVertex(o,o)}rh.gluTessEndContour()}return rh.gluTessEndPolygon(),e}var oh=function(t){function e(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var o=Array.isArray(i[0])?i[0]:i;if("number"!=typeof o[0]){for(var s=[],a=0,u=o.length;a<u;a++)s.push(o[a].x,o[a].y);o=s}return n.points=o,n.closePath=!0,n}kt(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,o=r-1;n<r;o=n++){var s=this.points[2*n],a=this.points[2*n+1],u=this.points[2*o],h=this.points[2*o+1];a>e!=h>e&&t<(e-a)/(h-a)*(u-s)+s&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){var o=nh([t]),s=e.length/2;0===o.length&&this.getLineEndPointsTriangle(t,o);for(var a=0;a<o.length;a++)e[2*i+a]=o[a];for(var u=o.length/2,h=0;h<u;h++)r[n+h]=s+h},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw new Error("Invalid points array");if(2!==t.length){var i=t[2]-t[0],r=t[3]-t[1],n=t[0],o=t[1],s=t[0],a=t[1];if(Math.abs(i)>=Math.abs(r))for(var u=0;u<t.length;u+=2){var h=t[u],l=t[u+1];h<n&&(n=h,o=l),h>s&&(s=h,a=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<o&&(n=f,o=d),d>a&&(s=f,a=d)}e.push(n,o,s,a,s,a)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},wi(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(th),sh=8,ah=1.1920929e-7;function uh(t,e,i,r,n,o,s,a,u,h){var l=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function(t,e,i,r,n,o,s,a,u,h){hh(t,e,i,r,n,o,s,a,u,h,0),u.push(s,a)}(e,i,r,n,o,s,a,u,t,l*=l),t}function hh(t,e,i,r,n,o,s,a,u,h,l){if(!(l>sh)){var c=(t+i)/2,f=(e+r)/2,d=(i+n)/2,p=(r+o)/2,m=(n+s)/2,v=(o+a)/2,y=(c+d)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(y+x)/2,E=(g+b)/2;if(l>0){var S=s-t,_=a-e,C=Math.abs((i-s)*_-(r-a)*S),A=Math.abs((n-s)*_-(o-a)*S);if(C>ah&&A>ah){if((C+A)*(C+A)<=h*(S*S+_*_))return void u.push(T,E)}else if(C>ah){if(C*C<=h*(S*S+_*_))return void u.push(T,E)}else if(A>ah){if(A*A<=h*(S*S+_*_))return void u.push(T,E)}else if((S=T-(t+s)/2)*S+(_=E-(e+a)/2)*_<=h)return void u.push(T,E)}hh(t,e,c,f,y,g,T,E,u,h,l+1),hh(T,E,x,b,m,v,s,a,u,h,l+1)}}var lh,ch=function(t){function e(e,i,r,n){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(o=t.call(this)||this).type="ellipse",o.x=e,o.y=i,o.halfWidth=r,o.halfHeight=n,o}kt(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return(i*=i)+(r*=r)<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var o=i/2,s=r-o,a=n-o,u=r+o,h=n+o,l=t-this.x,c=e-this.y;return l*l/(s*s)+c*c/(a*a)>1&&l*l/(u*u)+c*c/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var o=Math.ceil(5*Math.sqrt(r+n)),s=8*o+0+0;if(0===s)return t;if(0===o)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var a=0,u=4*o+0+2,h=u,l=s,c=0+r,f=0,d=e+c,p=e-c,m=i+f;t[a++]=d,t[a++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<o;v++){var y=Math.PI/2*(v/o),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,S=i-x;t[a++]=b,t[a++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=S,t[--l]=S,t[--l]=b}d=e+(c=0),p=e-c,m=i+(f=0+n);var _=i-f;return t[a++]=d,t[a++]=m,t[--l]=_,t[--l]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var o=0,s=0,a=0;a<t.length;a+=2)o+=t[a],s+=t[a+1];o/=t.length/2,s/=t.length/2;var u=i;e[2*u]=o,e[2*u+1]=s;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(th);exports.StarType=void 0,(lh=exports.StarType||(exports.StarType={}))[lh.Star=0]="Star",lh[lh.Polygon=1]="Polygon";var fh=function(t){function e(e,i,r,n,o,s){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0),void 0===s&&(s=0),(a=t.call(this)||this).pointCount=e,a.outerRadius=i,a.innerRadius=r,a.outerRoundness=n,a.innerRoundness=o,a.starType=s,a.v=[],a.in=[],a.out=[],a}kt(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)uh(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var i=this.v.length-1;uh(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var o=nh([t]),s=e.length/2,a=0;a<o.length;a++)e[2*i+a]=o[a];for(var u=o.length/2,h=0;h<u;h++)r[n+h]=s+h},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),o=2*Math.PI/n,s=!0,a=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*a/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){i=s?h:l,r=s?c:f;var p=(e=s?a:u)*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,s=!s,d+=1*o}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,o=2*Math.PI*r/(4*e),s=.5*-Math.PI;for(t=0;t<e;t++){var a=r*Math.cos(s),u=r*Math.sin(s),h=0===a&&0===u?0:u/Math.sqrt(a*a+u*u),l=0===a&&0===u?0:-a/Math.sqrt(a*a+u*u),c=2*t;this.v[c]=a,this.v[c+1]=u,this.in[c]=a+h*o*n*1,this.in[c+1]=u+l*o*n*1,this.out[c]=a-h*o*n*1,this.out[c+1]=u-l*o*n*1,s+=1*i}},e}(th),dh=function(t){function e(e,i,r,n,o){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=20),(s=t.call(this)||this).x=e,s.y=i,s.width=r,s.height=n,s.roundness=o,s}kt(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t){var e,i=this.width/2,r=this.height/2,n=this.x+i,o=this.y+r,s=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(i,r)),a=i-s,u=r-e;if(s>=0&&e>=0&&a>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(s+e)),l=8*h+(a?4:0)+(u?4:0);if(0!==l){if(0===h)return t[0]=t[6]=n+a,t[1]=t[3]=o+u,t[2]=t[4]=n-a,void(t[5]=t[7]=o-u);var c=0,f=4*h+(a?2:0)+2,d=f,p=l,m=a+s,v=u,y=n+m,g=n-m,x=o+v;if(t[c++]=y,t[c++]=x,t[--f]=x,t[--f]=g,u){var b=o-v;t[d++]=g,t[d++]=b,t[--p]=b,t[--p]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),S=a+Math.cos(E)*s,_=u+Math.sin(E)*e,C=n+S,A=n-S,w=o+_,M=o-_;t[c++]=C,t[c++]=w,t[--f]=w,t[--f]=A,t[d++]=A,t[d++]=M,t[--p]=M,t[--p]=C}y=n+(m=a),g=n-m,x=o+(v=u+e);var R=o-v;t[c++]=y,t[c++]=x,t[--p]=R,t[--p]=y,a&&(t[c++]=g,t[c++]=x,t[--p]=R,t[--p]=g)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var o=0,s=0,a=0;a<t.length;a+=2)o+=t[a],s+=t[a+1];o/=t.length/2,s/=t.length/2;var u=i;e[2*u]=o,e[2*u+1]=s;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(th),ph=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=o(this.graphicsPath.instructions);!(t=e()).done;){var i=t.value,r=i.action,n=i.data;switch(r){case"bezierCurveTo":this.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);break;case"polyStar":this.polyStar(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"rect":this.rect(n[0],n[1],n[2],n[3],n[4]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,o,s){this.ensurePoly();var a=this.currentPoly;return uh(a.points,a.lastX,a.lastY,t,e,i,r,n,o,s),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new ch(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,o,s){return this.drawShape(new fh(t,e,i,r,n,o),s),this},e.rect=function(t,e,i,r,n,o){return this.drawShape(new dh(t,e,i,r,n),o),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new oh).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new oh,this.currentPoly.points.push(0,0))},t}(),mh=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,o,s){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,o,s]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,o){return this.instructions.push({action:"rect",data:[t,e,i,r,n,o]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,o,s){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,o,s]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},wi(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new ph(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function vh(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?Cs(t):e}var yh=new(function(){function t(){this.elements=[]}var i=t.prototype;return i.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},i.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return K(t),t}if(Ia(Ma))return e.window._createOffscreenCanvas(10,10);var i=e.document.createElement("canvas");return i.getContext("2d",{willReadFrequently:!0}),i},i.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?v(this.elements,t):t.remove()},t}()),gh=function(){function t(t){this.width=0,this.height=0;var e=t.fontSize,i=t.textHeight,r=void 0===i?100:i,n=t.textWidth,o=void 0===n?100:n,s=t.textOverflow,a=void 0===s?Qt.clip:s,u=t.textBaseline,h=void 0===u?$t.top:u,l=t.textAlign,c=void 0===l?te.left:l,f=t.text,d=void 0===f?" ":f,p=t.letterSpace,m=void 0===p?0:p,v=t.lineGap,y=void 0===v?.571:v,g=t.autoWidth,x=void 0!==g&&g,b=t.lineHeight,T=void 0===b?e:b,E=t.useLegacyRichText,S=void 0!==E&&E,_=e+m;this.autoWidth=x,this.maxTextWidth=d.length*_,this.width=o,this.height=r,this.letterSpace=m,this.lineGap=y,this.useLegacyRichText=S,this.overflow=a,this.textBaseline=h,this.textAlign=c,this.lineHeight=T}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,o=t.fontScale,s=(i-r)/3,a=r+n*o,u=i*(e-1),h=0;switch(this.textBaseline){case $t.top:h=a+s;break;case $t.middle:h=(this.height*o-u+a)/2;break;case $t.bottom:h=this.height*o-u-s}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case te.left:i=t.outlineWidth*t.fontScale;break;case te.middle:i=(this.width*t.fontScale-e)/2;break;case te.right:i=this.width*t.fontScale-e}return i},e.getOffsetYRich=function(t,e,i){var r=t.outlineWidth,n=t.fontScale,o=e.reduce((function(t,e){return t+e}),0),s=(e[0]-i)/3,a=i+r*n,u=o-e[0],h=0;switch(this.textBaseline){case $t.top:h=a+s;break;case $t.middle:h=(this.height*n-o+this.lineGap*n)/2+a;break;case $t.bottom:h=this.height*n-u-s}return h},e.setSize=function(t,e){this.width=t,this.height=e},t}(),xh=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,o,s,a=t.textColor,u=void 0===a?[1,1,1,1]:a,h=t.fontSize,l=void 0===h?40:h,c=t.outline,f=t.shadow,d=t.fontWeight,p=void 0===d?"normal":d,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,g=void 0===y?"sans-serif":y;(this.textColor=u,this.textWeight=p,this.fontStyle=v,this.fontFamily=g,this.fontSize=l,c)&&(this.isOutlined=!0,this.outlineColor=null!=(e=c.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=c.outlineWidth)?i:1);f&&(this.hasShadow=!0,this.shadowBlur=null!=(r=f.shadowBlur)?r:2,this.shadowColor=null!=(n=f.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(o=f.shadowOffsetX)?o:0,this.shadowOffsetY=null!=(s=f.shadowOffsetY)?s:0);this.fontStyle!==ie.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},bh=["serif","sans-serif","monospace","courier"],Th=0;exports.TextComponent=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.maxLineWidth=0,r.SCALE_FACTOR=.1,r.ALPHA_FIX_VALUE=1/255,r.name="MText"+Th++,i&&r.fromData(i),r.canvas=yh.getCanvas(),yh.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return vh(r);var n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}kt(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.onDestroy=function(){t.prototype.onDestroy.call(this),this.disposeTextTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new R(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(Yn),exports.TextComponent=u([Ae(pe.TextComponent)],exports.TextComponent);var Eh=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new xh(t),this.textLayout=new gh(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){var i=this.context,r=this.textLayout,n=r.letterSpace,o=r.overflow;this.maxLineWidth=0;var s=this.textLayout.width+this.textStyle.fontOffset,a=1,u=0;i&&(i.font=this.getFontDesc(this.textStyle.fontSize));for(var h=0;h<t.length;h++){var l,c,f=t[h],d=null!=(c=null==i||null==(l=i.measureText(f))?void 0:l.width)?c:0;u+=n,o===Qt.display?"\n"===f?(a++,u=0):(u+=d,this.maxLineWidth=Math.max(this.maxLineWidth,u)):((u+d>s&&h>0||"\n"===f)&&(a++,this.maxLineWidth=Math.max(this.maxLineWidth,u),u=0),"\n"!==f&&(u+=d))}return a},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){this.textStyle.fontFamily!==t||Q(t)?(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("The font is either the current font or an risky font family.")},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,i=this.textStyle,r=this.textLayout,n=i.fontScale,o=(r.width+i.fontOffset)*n,s=r.lineHeight*this.lineCount,a=i.fontSize*n,u=r.lineHeight*n;i.fontDesc=this.getFontDesc(a),this.char=(this.text||"").split(""),this.canvas.width=o,r.autoWidth?(this.canvas.height=s*n,this.item.transform.size.set(1,s/r.height)):this.canvas.height=r.height*n;var h=this.canvas.height;e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),this.maxLineWidth>o&&r.overflow===Qt.display?e.font=this.getFontDesc(a*o/this.maxLineWidth):e.font=i.fontDesc,e.clearRect(0,0,o,h),i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var l=[],c=0,f=r.getOffsetY(i,this.lineCount,u,a),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((c+=r.letterSpace*n)+y.width>o&&m>0||"\n"===v)&&(l.push({y:f,width:c,chars:d,charOffsetX:p}),c=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(c),c+=y.width)}l.push({y:f,width:c,chars:d,charOffsetX:p}),l.forEach((function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach((function(r,o){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[o],t.y),e.fillText(r,n+t.charOffsetX[o],t.y)}))})),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=yr.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:Ui.LINEAR,minFilter:Ui.LINEAR,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE});this.disposeTextTexture(),this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.disposeTextTexture=function(){var t=this.renderer.texture;t&&t!==this.engine.whiteTexture&&t.dispose()},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontScale,n=e.fontFamily,o=e.textWeight,s=e.fontStyle,a=(t||i*r).toString()+"px ";return bh.includes(n)?a+=n:a+='"'+n+'"',o!==ee.normal&&(a=o+" "+a),s!==ie.normal&&(a=s+" "+a),a},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],o=i[1],s=i[2],a=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*o+", "+255*s+", "+a+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,o=e.shadowOffsetY,s=i[0],a=i[1],u=i[2],h=i[3];t&&(t.shadowColor="rgba("+255*s+", "+255*a+", "+255*u+", "+h+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-o)},t}();pt(exports.TextComponent,[Eh]);var Sh=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Vt),_h=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Re);exports.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return kt(e,t),e}(Re),u([we()],exports.BinaryAsset.prototype,"buffer",void 0),exports.BinaryAsset=u([Ae(pe.BinaryAsset)],exports.BinaryAsset);var Ch=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=Me(e);if(r)for(var n,s=o(Object.keys(r));!(n=s()).done;){var a=n.value,u=e[a];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(u)?i[a]=u:ot(u)?(i[a]||(i[a]=[]),t.serializeArrayProperty(u,i[a],0)):Re.is(u)?i[a]={id:u.getInstanceId()}:at(u)&&(i[a]||(i[a]={}),t.serializeObjectProperty(u,i[a],0))}for(var h,l=o(Object.keys(e.defination));!(h=l()).done;){var c=h.value,f=e.defination[c];"number"==typeof f||"string"==typeof f||"boolean"==typeof f||t.checkTypedArray(f)?i[c]=f:ot(f)?(i[c]||(i[c]=[]),t.serializeArrayProperty(f,i[c],0)):Re.is(f)?i[c]={id:f.getInstanceId()}:at(f)&&(i[c]||(i[c]={}),t.serializeObjectProperty(f,i[c],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=Me(i),n=i.engine;if(r)for(var s,a=o(Object.keys(r));!(s=a()).done;){var u=s.value,h=e[u];if(void 0!==h){var l=r[u].type;i[u]=t.deserializeProperty(h,n,0,l)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return s(t,Int8Array)||s(t,Uint8Array)||s(t,Uint8ClampedArray)||s(t,Int16Array)||s(t,Uint16Array)||s(t,Int32Array)||s(t,Uint32Array)||s(t,Float32Array)||s(t,Float64Array)||s(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(at(t)&&1===Object.keys(t).length&&"id"in t&&nt(t.id))},t.checkGLTFNode=function(t){return at(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return ht(t)||s(t,e.HTMLImageElement)},t.deserializeProperty=function(e,i,r,n,s){if(void 0===s&&(s=!0),!(r>14)){if(ot(e)){for(var a,u=[],h=o(e);!(a=h()).done;){var l=a.value;u.push(t.deserializeProperty(l,i,r+1,n,s))}return u}if(t.checkDataPath(e)){var c=i.findObject(e);return s?c:e}if(ut(e)){var f;f=n?new n:{};for(var d,p=o(Object.keys(e));!(d=p()).done;){var m=d.value;f[m]=t.deserializeProperty(e[m],i,r+1,void 0,s)}return f}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.serializeObjectProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i={});for(var n,s=o(Object.keys(e));!(n=s()).done;){var a=n.value,u=e[a];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(e)?i[a]=u:ot(u)?(i[a]||(i[a]=[]),t.serializeArrayProperty(u,i[a],r+1)):Re.is(u)?i[a]={id:u.getInstanceId()}:at(u)&&(i[a]||(i[a]={}),t.serializeObjectProperty(u,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.");else{i||(i=[]);for(var n=0;n<e.length;n++){var o=e[n];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[n]=o:ot(o)?(i[n]||(i[n]=[]),t.serializeArrayProperty(o,i[n],r+1)):Re.is(o)?i[n]={id:o.getInstanceId()}:at(o)&&(i[n]||(i[n]={}),t.serializeObjectProperty(o,i[n],r+1))}}},t}(),Ah=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(r){switch(r.dataType){case pe.Material:e=Nr.create(this.engine);break;case pe.Geometry:e=Zr.create(this.engine);break;case pe.Texture:e=yr.create(this.engine);break;default:var n=Ce(r.dataType);n&&(e=new n(this.engine))}if(e)return e.setInstanceId(r.id),this.engine.addInstance(e),Ch.deserialize(r,e),e;console.error("Constructor for DataType: "+r.dataType+" not found.")}else console.error("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),wh=function(){function t(){}return t.prototype.loadGUID=function(t){return r((function(){return h(this,(function(t){return[2,void 0]}))}))()},t}();function Mh(t,e){if(!t.includes(e))return t.push(e),!0}function Rh(t){if(Number.isFinite(t))return[Ut.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===Ut.CONSTANT)return[Ut.CONSTANT,t[1]];if("lines"===e)return[Ut.LINE,t[1]];if(e===Ut.LINE){var r=i.map((function(t){return[Bt.LINE,t]}));return[Ut.BEZIER_CURVE,r]}return"curve"===e||e===Ut.CURVE?[Ut.BEZIER_CURVE,Kh(i)]:t}}function Ih(t,e){return Array.isArray(t)&&"random"===t[0]?[Ut.CONSTANT,t[1][e]]:Rh(t)}function Ph(t){return t&&"color"===t[0]?Lh(t[1],!0):[1,1,1,1]}function Oh(t,e){if(t)return"colors"===t[0]?[Ut.COLORS,t[1].map((function(t){return Lh(t,e)}))]:"gradient"===t[0]?Fh(t[1],e):"color"===t[0]?[Ut.RGBA_COLOR,Lh(t[1],e)]:t}function Nh(t){return t&&"random"===t[0]?[Ut.RANDOM,t[1]]:Rh(t)}function Fh(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach((function(r){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(r),o=Lh(t[r],e);i.push([n,o[0],o[1],o[2],o[3]])})),i=i.sort((function(t,e){return t[0]-e[0]})),[Ut.GRADIENT_COLOR,i]}}function Lh(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else s(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=Vh(i)),i}function Vh(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Dh(t,e){return Array.isArray(t)?t[0]===Ut.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Fh(t[1],e):Fh(t,e)}function kh(t){if(t){if(3===t.length)return[Ut.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===Ut.BEZIER_PATH||e===Ut.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],o=i[2],s=Kh(r);if(!o){o=[];for(var a=0;a<n.length;a++){var u=n[a].slice();0===a?o.push(u):a<n.length-1?(o.push(u),o.push(u)):o.push(u)}}return[Ut.BEZIER_CURVE_PATH,[s,n,o]]}return t}}function zh(t){for(var e,i=o(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function Uh(t){for(var e,i=o(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var Bh,Gh=Math.cos,jh=Math.sin,Xh=Math.PI/180,Hh=180/Math.PI;function Wh(t,e){return t?[t[0]-.5,.5-t[1]]:e?Zh[e]:[0,0]}var Yh,Zh=((Bh={})[Nt.PARTICLE_ORIGIN_CENTER]=[0,0],Bh[Nt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Bh[Nt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Bh[Nt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Bh[Nt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Bh[Nt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Bh[Nt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Bh[Nt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Bh[Nt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Bh);function qh(t,e,i,r){var n=i[0],o=i[1],s=r[0],a=s-n;return[[n+(s-n)/3,o+(t*=a)/3],[s-(s-n)/3,r[1]-(e*=a)/3]]}function Kh(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],o=0;o<t.length-1;o++){var s=t[o][3]*(e-i),a=t[o+1][2]*(e-i),u=[t[o][0],t[o][1]],h=[t[o+1][0],t[o+1][1]];if(u[0]!=h[0]){var l=qh(s,a,u,h),c=l[0],f=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map((function(t,e){return 0===e?[Bt.EASE_OUT,t]:e===n.length-1?[Bt.EASE_IN,t]:[Bt.EASE,t]}))}function Qh(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===Pt.null&&t.endBehavior===Gt.destroy&&(t.endBehavior=Gt.freeze)}))})),t.version=Et["2_1"],t}var Jh=new Map,$h=new Map;function tl(t){for(var e,i=o(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===pe.ShapeComponent){var n=r;if(n.type===ue.Custom){var s,a=n;(null==(s=a.shapes)?void 0:s.length)>0&&a.shapes[0].fill&&(a.fill=a.shapes[0].fill);for(var u,h=new Array(a.easingIns.length),l=new Array(a.easingOuts.length).fill(!1),c=o(a.shapes);!(u=c()).done;)for(var f,d=o(u.value.indexes);!(f=d()).done;){var p=f.value,m=a.points[p.point],v=a.easingIns[p.easingIn],y=a.easingOuts[p.easingOut];h[p.easingIn]||(v.x-=m.x,v.y-=m.y,h[p.easingIn]=!0),l[p.easingOut]||(y.x-=m.x,y.y-=m.y,l[p.easingOut]=!0)}}}}return t.version=Et["3_2"],t}function el(t){Jh.clear(),$h.clear();for(var e,i=t.compositions,r=t.items,n=o(t.components);!(e=n()).done;){var s=e.value;Jh.set(s.id,s)}for(var a,u=o(r);!(a=u()).done;){var h=a.value;$h.set(h.id,h)}for(var l,c=o(i);!(l=c()).done;){sl(l.value)}return t.version=Et["3_3"],t}function il(t){var e;null==(e=t.plugins)||e.forEach((function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")}));for(var i,r=o(t.items);!(i=r()).done;){var n=i.value;if(n.type===Pt.sprite){var s=Jh.get(n.components[0].id);if(s){var a,u=s.renderer.shape,h=void 0;if(Number.isInteger(u))h=null==(a=t.shapes)?void 0:a[u];else h=u;s.renderer.shape=h}}}for(var l,c=t.compositionId,f={},d=o(t.compositions);!(l=d()).done;){var p=l.value,m=ft();f[p.id]=m,p.id===c&&(t.compositionId=m),p.id=m;var v={id:ft(),dataType:"CompositionComponent",items:p.items,timelineAsset:p.timelineAsset,sceneBindings:p.sceneBindings,item:{id:p.id}};p.timelineAsset=void 0,p.sceneBindings=void 0,p.components=[{id:v.id}],t.components.push(v)}for(var y,g=o(t.items);!(y=g()).done;){var x=y.value;if(x.content){var b=x.content.options;b&&void 0!==b.refId&&(b.refId=f[b.refId])}}return t.version=Et["3_4"],t}function rl(t){for(var e,i={},r=o(t.components);!(e=r()).done;){var n=e.value;i[n.id]=n}for(var s,a=o(t.compositions);!(s=a()).done;)for(var u,h=s.value,l=o(h.components);!(u=l()).done;){i[u.value.id].item.id=h.id}for(var c,f=o(t.components);!(c=f()).done;){var d=c.value;if(d.dataType===pe.SpriteComponent){var p=d,m=p.renderer.shape;if(!(null==m||"aPoint"in m&&"index"in m)){var v=ol(m);p.geometry={id:v.id},t.geometries.push(v)}}if(d.dataType===pe.ShapeComponent){var y=d;if(y.fills=[],y.fill){var g={type:se.Solid,color:y.fill.color};y.fills.push(g)}if(delete y.fill,y.strokes=[],y.stroke){var x={type:se.Solid,color:y.stroke.color};y.strokes.push(x),y.strokeWidth=y.stroke.width,y.strokeCap=y.stroke.cap,y.strokeJoin=y.stroke.join,delete y.stroke}}}return t.version="3.5",t}function nl(t){if(t.components)for(var e,i=o(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===pe.RichTextComponent){var n=r;n.options&&void 0===n.options.useLegacyRichText&&(void 0===n.options.lineGap?n.options.useLegacyRichText=!0:n.options.useLegacyRichText=!1)}}return t.version="3.6",t}function ol(t,e){void 0===e&&(e="形状");for(var i=Ta(t),r=i.index,n=void 0===r?[]:r,o=i.aPoint,s=void 0===o?[]:o,a=new Float32Array(s),u=[],h=[],l=0;l<a.length;l+=6)h.push(s[l+2],s[l+3]),u.push(a[l],a[l+1],0);var c=u.length/3,f=n.length,d=4*u.length,p=d+4*h.length,m=2*n.length,v={mode:me.TRIANGLES,vertexData:{vertexCount:c,channels:[]},name:e,indexFormat:ye.UInt16,indexOffset:p,buffer:"",id:ft(),dataType:pe.Geometry,subMeshes:[]};v.vertexData.channels.push({semantic:ge.Position,offset:0,format:ve.Float32,dimension:3}),v.vertexData.channels.push({semantic:ge.Uv,offset:d,format:ve.Float32,dimension:2}),v.subMeshes.push({offset:0,indexCount:f,vertexCount:c});var y=new ArrayBuffer(p+m+(m%4==0?0:2)),g=new Float32Array(y);g.set(u,0),g.set(h,u.length),new Uint16Array(y,p).set(n,0);var x=new Uint8Array(y).slice(0,p+m);return v.binaryData=x,v}function sl(t){for(var e,i=o(t.items);!(e=i()).done;){var r=e.value,n=$h.get(r.id);if(!n)return;if(n.type===Pt.sprite||n.type===Pt.particle||n.type===Pt.spine||n.type===Pt.text||n.type===Pt.richtext||n.type===Pt.video||n.type===Pt.shape){var s=Jh.get(n.components[0].id);s&&al(s)}}}function al(t){var e=t.renderer,i=null==e?void 0:e.maskMode;i&&i!==exports.MaskMode.NONE&&(i===exports.MaskMode.MASK?(t.mask={isMask:!0},Yh=t.id):i!==At.OBSCURED&&i!==At.REVERSE_OBSCURED||(t.mask={inverted:i===At.REVERSE_OBSCURED,reference:{id:Yh}}))}function ul(t){for(var e,i,r,n=function(){var t=h.value;t.endBehavior!==ne&&t.endBehavior!==re||(t.endBehavior=Gt.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===Pt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,i=o(t.items);!(e=i()).done;){var r=e.value;l[r.id]=ft(),r.oldId=r.id,r.id=l[r.id],c[r.id]=r}t.items.forEach((function(e,i){if(e.parentId)if(e.parentId.includes("^")){var r=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=l[r]+"^"+n}else e.parentId=l[e.parentId];s.items.push(e),t.items[i]={id:e.id}}));var n=Xe({},t,{timelineAsset:{id:""},sceneBindings:[]});s.compositions.push(n),function(t,e,i){for(var r,n=[],s=[],a=[],u={tracks:[],id:ft(),dataType:"TimelineAsset"},h=o(t.items);!(r=h()).done;){var l=e[r.value.id],c=[],f={id:ft(),dataType:"ActivationPlayableAsset"};a.push(f);var d={id:ft(),dataType:"ActivationTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:f.id}}]};if(c.push({id:d.id}),s.push(d),l.type!==Pt.particle){var p={id:ft(),dataType:"TransformPlayableAsset",sizeOverLifetime:l.content.sizeOverLifetime,rotationOverLifetime:l.content.rotationOverLifetime,positionOverLifetime:l.content.positionOverLifetime};a.push(p);var m={id:ft(),dataType:"TransformTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:p.id}}]};c.push({id:m.id}),s.push(m)}if(l.type===Pt.sprite||l.type===Pt.text){var v={id:ft(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:l.content.colorOverLifetime};a.push(v);var y={id:ft(),dataType:"SpriteColorTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:v.id}}]};c.push({id:y.id}),s.push(y)}if(l.type===Pt.composition){var g={id:ft(),dataType:"SubCompositionPlayableAsset"};a.push(g);var x={id:ft(),dataType:"SubCompositionTrack",children:[],clips:[{start:l.delay,duration:l.duration,endBehavior:l.endBehavior,asset:{id:g.id}}]};c.push({id:x.id}),s.push(x)}var b={id:ft(),dataType:"ObjectBindingTrack",children:c,clips:[]};s.push(b),u.tracks.push({id:b.id}),n.push({key:{id:b.id},value:{id:l.id}})}for(var T,E=[],S=o(s);!(T=S()).done;){var _=T.value;E.push({id:_.id})}t.timelineAsset={id:u.id},t.sceneBindings=n,i.miscs.push(u);for(var C,A=o(s);!(C=A()).done;){var w=C.value;i.miscs.push(w)}for(var M,R=o(a);!(M=R()).done;){var I=M.value;i.miscs.push(I)}}(n,c,s)},s=Xe({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),a=o(s.images);!(i=a()).done;){i.value.id=ft()}if(null!=(e=s).textures||(e.textures=[]),s.textures.forEach((function(t){var e;t.id=ft(),t.dataType=pe.Texture,t.source={id:null==(e=s.images[t.source])?void 0:e.id}})),s.textures.length<s.images.length)for(var u=s.textures.length;u<s.images.length;u++)s.textures.push({id:ft(),dataType:pe.Texture,source:{id:s.images[u].id},flipY:!0});t.bins&&(r=t.bins,s.bins=r.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:ft()}})));for(var h,l={},c={},f=o(t.compositions);!(h=f()).done;)n();for(var d,p=o(s.items);!(d=p()).done;){var m=d.value;if(m.content){if(m.content.renderer&&void 0!==m.content.renderer.texture){var v=m.content.renderer.texture;m.content.renderer.texture={id:s.textures[v].id}}if(m.content.trails&&void 0!==m.content.trails.texture){var y=m.content.trails.texture;m.content.trails.texture={id:s.textures[y].id}}}if(m.transform){var g,x,b,T=[].concat(null!=(g=m.transform.position)?g:[0,0,0]),E=[].concat(null!=(x=m.transform.rotation)?x:[0,0,0]),S=[].concat(null!=(b=m.transform.scale)?b:[1,1,1]);if(Object.assign(m,{transform:{position:{x:T[0],y:T[1],z:T[2]},eulerHint:{x:E[0],y:E[1],z:E[2]},scale:{x:S[0],y:S[1],z:S[0]}}}),m.type===Pt.sprite&&(m.transform.size={x:S[0],y:S[1]},m.transform.scale={x:1,y:1,z:1}),m.type===Pt.sprite){var _=m.content;_.renderer||(_.renderer={});var C,A,w,M,R=_.renderer,I=Wh(R.anchor,R.particleOrigin),P=m.transform.size;if(!R.anchor&&void 0!==R.particleOrigin)m.transform.position.x+=-I[0]*(null!=(C=null==P?void 0:P.x)?C:1),m.transform.position.y+=-I[1]*(null!=(A=null==P?void 0:P.y)?A:1);m.transform.anchor={x:I[0]*(null!=(w=null==P?void 0:P.x)?w:1),y:I[1]*(null!=(M=null==P?void 0:P.y)?M:1)}}}if(m.type===Pt.particle){var O=m.content;O.renderer||(O.renderer={});var N=O.renderer;O.renderer.anchor=Wh(N.anchor,N.particleOrigin)}if(m.type===Pt.camera&&m.content.positionOverLifetime&&0!==Object.keys(m.content.positionOverLifetime).length&&(m.content.positionOverLifetime.asMovement=!0),void 0!==m.pn){var F=m.pn,L=t.plugins,V=void 0===L?[]:L;void 0!==F&&Number.isInteger(F)&&(m.pluginName=V[F])}switch("editor-gizmo"===m.pluginName&&(m.type="editor-gizmo"),"orientation-transformer"===m.pluginName&&(m.type="orientation-transformer"),m.content.options.target&&"editor-gizmo"===m.pluginName&&(m.content.options.target=l[m.content.options.target]),m.type===Pt.spine&&t.spines&&0!==t.spines.length&&ll(t.spines[m.content.options.spine],m.content,s),m.type!==Pt.sprite&&m.type!==Pt.particle&&m.type!==Pt.mesh&&m.type!==Pt.skybox&&m.type!==Pt.light&&"camera"!==m.type&&m.type!==Pt.tree&&m.type!==Pt.interact&&m.type!==Pt.camera&&m.type!==Pt.text&&m.type!==Pt.spine&&"editor-gizmo"!==m.type&&"orientation-transformer"!==m.type||(m.components=[],s.components.push(m.content),m.content.id=ft(),m.content.item={id:m.id},m.dataType=pe.VFXItemData,m.components.push({id:m.content.id})),m.type!==Pt.null&&m.type!==Pt.composition||(m.components=[],m.dataType=pe.VFXItemData),m.type){case Pt.sprite:m.content.dataType=pe.SpriteComponent;break;case Pt.particle:m.content.dataType=pe.ParticleSystem;break;case Pt.mesh:m.content.dataType=pe.MeshComponent;break;case Pt.skybox:m.content.dataType=pe.SkyboxComponent;break;case Pt.light:m.content.dataType=pe.LightComponent;break;case"camera":m.content.dataType=pe.CameraComponent;break;case"editor-gizmo":m.content.dataType="GizmoComponent";break;case"orientation-transformer":m.content.dataType="OrientationComponent";break;case Pt.tree:m.content.dataType=pe.TreeComponent;break;case Pt.interact:m.content.dataType=pe.InteractComponent;break;case Pt.camera:m.content.dataType=pe.CameraController;break;case Pt.text:m.content.dataType=pe.TextComponent;break;case Pt.spine:m.content.dataType=pe.SpineComponent}}return s.version=Et["3_0"],s}function hl(t){if(t)for(var e,i=o(Object.keys(t));!(e=i()).done;){var r=e.value,n=t[r],s=Array.isArray(n);s&&2===n.length&&Array.isArray(n[1])?t[r]="path"===r?kh(n):Rh(n):s||"object"!=typeof n||hl(n)}}function ll(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}}))}}function cl(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},o={path:kh(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:Rh(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:Rh(n.linearX),linearY:Rh(n.linearY),linearZ:Rh(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Rh(n.orbitalX),orbitalY:Rh(n.orbitalY),orbitalZ:Rh(n.orbitalZ),speedOverLifetime:Rh(n.speedOverLifetime)};Uh(o);var s={options:{startColor:Ph(r.startColor)},positionOverLifetime:o};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var a=t.rotationOverLifetime;if(a){var u=s.rotationOverLifetime={separateAxes:a.separateAxes,asRotation:a.asRotation};u.separateAxes?(u.x=Rh(a.x),u.y=Rh(a.y),u.z=Rh(a.z)):u.z=Rh(a.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=s.colorOverLifetime={opacity:Rh(h.opacity)};h.color&&(l.color=Dh(h.color))}var c=t.sizeOverLifetime;return c&&(s.sizeOverLifetime={separateAxes:c.separateAxes,size:Rh(c.size),x:Rh(c.x),y:Rh(c.y),z:Rh(c.z)}),s}var fl="2.7.3",dl=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,pl=/^(\d+)\.(\d+)$/,ml=!1;function vl(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e,i;(function(t){var e=t.playerVersion||{},i=e.web,r=void 0===i?"":i;if(r){var n,o,s=null!=(n=dl.exec(r))?n:[],a=null!=(o=dl.exec(fl))?o:[],u=s[1],h=s[2],l=a[1],c=a[2];return Number(l)<Number(u)||Number(l)===Number(u)&&Number(c)<Number(h)}return!1})(t)&&console.warn("The JSON need higher than "+(null==(e=t.playerVersion)?void 0:e.web)+" runtime version(current: "+fl+"). Some features may not work as expected.");if(function(t){var e,i=null==(e=t.version)?void 0:e.split(".");!i||Number(i[0])>2||2===Number(i[0])&&Number(i[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==Pt.mesh&&t.type!==Pt.light||(t.endBehavior=1===t.endBehavior?Gt.destroy:t.endBehavior)}))}))}(t),dl.test(t.version))return ml="0"===(null==(i=/^(\d+)/.exec(t.version))?void 0:i[0]),nl(rl(il(el(tl(ul(Qh(function(t){var e;yl=Et["1_0"];var i=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(yl=Et["1_3"]);var r,n=(t.requires||[]).slice(),o=t.images.map((function(e,i){return gl(e,i,t.imageTags||[])})),s=t.textures||o.map((function(t,e){return{source:e,flipY:!0}})),a={plugins:i,shapes:t.shapes||[],type:"ge",version:yl,playerVersion:null!=(r=t.playerVersion)?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return xl(t,{plugins:i,requires:n})})),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:s,bins:(t.bins||[]).slice()};t._textures&&(a._textures=t._textures);return a}(t))))))));ml=!1;var r=pl.exec(t.version)||[],n=Number(r[1]),s=Number(r[2]);if(n)return(n<2||2===n&&s<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,i=o(t.items);!(e=i()).done;)hl(e.value.content)})),t}(t)),n<3&&(t=ul(Qh(t))),r=pl.exec(t.version)||[],n=Number(r[1]),s=Number(r[2]),n<4&&(s<2&&(t=tl(t)),s<3&&(t=el(t)),s<4&&(t=il(t)),s<5&&(t=rl(t)),s<6&&(t=nl(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var yl=Et["1_0"];function gl(t,e,i){var r=i[e];if("string"==typeof t)return{id:ft(),renderLevel:r,url:t};if(t.template)return{id:ft(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:ft(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:ft(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function xl(t,e){var i;void 0===e&&(e={});var r={id:t.id+"",camera:Xe({clipMode:oe},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Sl(t,e)})),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var o=null==(i=t.meta)?void 0:i.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(r.previewSize=o),r}var bl,Tl=[0,0,0,1],El=.5;function Sl(t,e){var i;void 0===e&&(e={});var r,n,o,s,a,u,h=Pt.base,l=t.endBehavior,c=NaN;if(t.content?(h=t.type||Pt.plugin,u=t.pn,a=t.pluginName,o=t.content,n=t.content,isNaN(u)&&!a&&(a=o.options.type),t.duration&&(c=t.duration),r=t.transform||y(n.transform)):t.particle?(h=Pt.particle,r=y((n=t.particle).transform,ml,!0),o=function(t){var e=t.options,i=t.transform,r={type:wt.NONE};if(t.shape){var n,o=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=Xe({},t.shape,{type:wt[o]}),t.shape.upDirection){var s=t.shape.upDirection,a=s[0],u=s[1],h=s[2];0===a&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=Nh(e.turbulenceX),r.turbulenceY=Nh(e.turbulenceY),r.turbulenceZ=Nh(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return zh(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return zh(t)}))),l.rateOverTime&&(l.rateOverTime=Nh(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:Nh(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Nh(e.startSize),startSizeX:Nh(e.startSizeX),startSizeY:Nh(e.startSizeY),sizeAspect:Nh(e.sizeAspect),maxCount:e.maxCount,startDelay:Nh(e.startDelay),startColor:Oh(e.startColor,!0),startRotationZ:Nh(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=Nh(e.startRotationX),c.options.startRotationY=Nh(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:kh(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:Nh(f.x),y:Nh(f.y)}:c.sizeOverLifetime={size:Nh(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?Rh(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Rh(e.gravityModifier),startSpeed:Nh(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:Nh(d.linearX),linearY:Nh(d.linearY),linearZ:Nh(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Nh(d.orbitalX),orbitalY:Nh(d.orbitalY),orbitalZ:Nh(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Rh(d.forceCurve)},Uh(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Nh(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=Rh(m.y),c.rotationOverLifetime.x=Rh(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:Rh(v.opacity)};v.color&&(y.color=Dh(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Rh(g.cycles),animationDelay:Ih(g.animationDelay,0),animationDuration:Ih(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:Nh(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Rh(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Dh(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Dh(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:Nh(x.opacityOverLifetime)}),c.trails&&Uh(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(n)):t.sprite?(h=Pt.sprite,o=function(t,e){var i=cl(t,e),r=t.textureSheetAnimation;return r&&(i.textureSheetAnimation={row:r.row,col:r.col,total:r.total||void 0,animate:r.animate}),i.renderer=t.renderer,t.splits&&(i.splits=t.splits),t.interaction&&(i.interaction=t.interaction),i}(n=t.sprite,r=y(n.transform,!1,!0))):t.cal?(h=Pt.null,o=cl(n=t.cal,r=y(n.transform,!1,!0))):t.ui?(h=Pt.interact,r=y((n=t.ui).transform),o=function(t){var e,i=t.options;switch(i.type){case"click":e={type:Rt.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&Ph(i.previewColor),behavior:i.behavior||It.NOTIFY};break;case"drag":e={type:Rt.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:Rt.MESSAGE}}return{options:e}}(n),r.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=Pt.camera,r=y(n.transform),o=function(t){var e,i=t.options,r={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var o,s={path:kh(null==(o=t.transform)?void 0:o.path),linearX:Rh(null==n?void 0:n.translateX),linearY:Rh(null==n?void 0:n.translateY),linearZ:Rh(null==n?void 0:n.translateZ)};Uh(s),r.positionOverLifetime=s}var a=t.rotationOverLifetime;if(a){var u={separateAxes:a.separateAxes,x:Rh(null==a?void 0:a.rotateX),y:Rh(null==a?void 0:a.rotateY),z:a.separateAxes?Rh(null==a?void 0:a.rotateZ):Rh(a.rotation)};Uh(u),r.rotationOverLifetime=u}return r}(n))),null==(i=o.renderer)?void 0:i.anchor){var f=new Float32Array(o.renderer.anchor);f[0]==El&&f[1]==El?delete o.renderer.anchor:e.requires&&Mh(e.requires,"anchor")}if(n){var d,p,m=null==(d=n.options)?void 0:d.looping;if(m)l=Array.isArray(m)?m[1]?Gt.restart:Gt.destroy:Gt.restart;else l=l||(null==n||null==(p=n.options)?void 0:p.endBehavior)||Gt.destroy;n.options.renderLevel&&(s=n.options.renderLevel),isNaN(c)&&(c=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:c,id:t.id+"",transform:r,endBehavior:l,renderLevel:s,content:o};return a?e.plugins?(Mh(e.plugins,a),v.pn=e.plugins.indexOf(a)):v.pluginName=a:Number.isInteger(u)&&(v.pn=u),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,i){if(t){var r={},n=t.rotation;if(n&&(r.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],i)){var o=(s=Tl,a=r.rotation[0],u=r.rotation[1],h=r.rotation[2],l=Gh(a*Xh/2),c=Gh(u*Xh/2),f=Gh(h*Xh/2),d=jh(a*Xh/2),p=jh(u*Xh/2),m=jh(h*Xh/2),s[0]=d*c*f+l*p*m,s[1]=l*p*f-d*c*m,s[2]=l*c*m+d*p*f,s[3]=l*c*f-d*p*m,s);r.rotation=function(t,e){var i,r,n,o=e[0],s=e[1],a=e[2],u=e[3],h=o+o,l=s+s,c=a+a,f=o*h,d=s*h,p=s*l,m=a*c,v=u*c,y=1-p-m,g=d-v,x=d+v,b=1-f-m,T=a*h-u*l,E=a*l+u*h,S=1-f-p;return t[1]=Math.asin((r=-1,(i=-T)>(n=1)?n:i<r?r:i))*Hh,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,S)*Hh,t[2]=Math.atan2(x,y)*Hh):(t[0]=0,t[2]=Math.atan2(-g,b)*Hh),t}([],o)}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}var s,a,u,h,l,c,f,d,p,m;return{}}}var _l,Cl=((bl={})[St.S]=[St.S,St.BPlus,St.APlus],bl[St.A]=[St.A,St.BPlus,St.APlus],bl[St.B]=[St.B,St.BPlus],bl);function Al(t,e){if(!t||!e)return!0;var i=Cl[e];return!!i&&i.includes(t)}function wl(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},o=n.name,s=n.url;return o&&(e&&e[o]?i=e[o]:s&&(i=s)),i}function Ml(t,e,i){return Rl.apply(this,arguments)}function Rl(){return(Rl=r((function(t,i,r){var n,o;return h(this,(function(a){switch(a.label){case 0:return"string"!=typeof t?[3,2]:[4,rr(t)];case 1:return n=a.sent(),[3,3];case 2:n=t,a.label=3;case 3:if(!n)throw new Error("Image not provided.");if(!i)return[2,n];if(o=wl(i,r)){if(nt(o)&&o!==n.src)return[2,rr(o)];if(s(o,e.HTMLImageElement))return[2,o]}return[2,n]}}))}))).apply(this,arguments)}exports.Scene=void 0,(_l=exports.Scene||(exports.Scene={})).isJSONObject=function(t){return at(t)&&"jsonScene"in t},_l.isURL=function(t){return at(t)&&"url"in t},_l.isWithOptions=function(t){return at(t)&&"options"in t};var Il=1,Pl=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Ki),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=Il++,this.timers=[],this.updateOptions(t)}var i=t.prototype;return i.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,i=void 0===e?10:e;this.timeout=i},i.loadScene=function(t,i,n){var o=this;return r((function(){var s,a,u,l,c,f,d,p,m,v,y,g,x;return h(this,(function(b){return a=nt(t)?t:o.id,u=e.performance.now(),l=[],c=null==i?void 0:i.engine.gpuCapability,d=null!=(f=null==c?void 0:c.detail.compressedTexture)?f:exports.COMPRESSED_TEXTURE.NONE,p={},v=!1,y=new Promise((function(t,i){m=e.window.setTimeout((function(){v=!0,o.removeTimer(m);var t=e.performance.now()-u;i(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+l.join(" ")+", url: "+a+"."))}),1e3*o.timeout),o.timers.push(m)})),g=r((function(t,i){var r,n,o,s;return h(this,(function(a){switch(a.label){case 0:if(v)return[3,4];r=e.performance.now(),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i()];case 2:return n=a.sent(),o=e.performance.now()-r,l.push("["+t+": "+o.toFixed(2)+"]"),p[t]=o,[2,n];case 3:throw s=a.sent(),new Error("Load error in "+t+", "+s+".");case 4:throw new Error("Load canceled.")}}))})),x=r((function(){var i,r,c,f,v,y,x,b,T,E,S,_,C,A;return h(this,(function(h){switch(h.label){case 0:return nt(t)?(r=new e.URL(t,e.location.href).href,o.baseUrl=r,[4,g("loadJSON",(function(){return o.loadJSON(r)}))]):[3,2];case 1:return nt(s=h.sent())&&(s=JSON.parse(s)),[3,3];case 2:s=t,o.baseUrl=e.location.href,h.label=3;case 3:return exports.Scene.isJSONObject(s)?(i=Xe({},s),[3,9]):[3,4];case 4:return[4,g("processJSON",(function(){return o.processJSON(s)}))];case 5:return c=h.sent(),f=c.jsonScene,v=c.pluginSystem,y=f.bins,x=void 0===y?[]:y,b=f.images,T=f.fonts,[4,Promise.all([g("processBins",(function(){return o.processBins(x)})),g("processImages",(function(){return o.processImages(b,d)})),g("plugin:processAssets",(function(){return o.processPluginAssets(f,v,n)})),g("processFontURL",(function(){return o.processFontURL(T)}))])];case 6:return E=h.sent(),S=E[0],_=E[1],[4,g("processTextures",(function(){return o.processTextures(_,S,f)}))];case 7:return C=h.sent(),i={timeInfos:p,url:t,renderLevel:o.options.renderLevel,storage:{},pluginSystem:v,jsonScene:f,bins:S,textureOptions:C,textures:[],images:_,assets:o.assets},[4,g("plugin:prepareResource",(function(){return v.loadResources(i,o.options)}))];case 8:h.sent(),h.label=9;case 9:return A=e.performance.now()-u,it.info("Load asset: totalTime: "+A.toFixed(4)+"ms "+l.join(" ")+", url: "+a+"."),e.window.clearTimeout(m),o.removeTimer(m),i.totalTime=A,i.startTime=u,i.timeInfos=p,[2,i]}}))})),[2,Promise.race([y,x()])]}))}))()},i.getAssets=function(){return this.assets},i.processJSON=function(t){var e=this;return r((function(){var i,r,n;return h(this,(function(o){switch(o.label){case 0:return i=vl(t),r=i.plugins,[4,(n=new xt(void 0===r?[]:r)).processRawJSON(i,e.options)];case 1:return o.sent(),[2,{jsonScene:i,pluginSystem:n}]}}))}))()},i.processBins=function(t){var i=this;return r((function(){var r,n,o;return h(this,(function(a){return r=i.options.renderLevel,n=i.baseUrl,o=t.map((function(o){if(s(o,ArrayBuffer))return o;if(Al(o.renderLevel,r))return i.loadBins(new e.URL(o.url,n).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(o)]}))}))()},i.processFontURL=function(e){var i=this;return r((function(){return h(this,(function(r){return[2,t.loadFontFamily(e,i.baseUrl)]}))}))()},i.processImages=function(t,i){void 0===i&&(i=0);var n=this;return r((function(){var o,a,u,l,c,f,d,p;return h(this,(function(m){switch(m.label){case 0:return o=n.options,a=o.useCompressedTexture,u=o.variables,l=o.disableWebP,c=o.disableAVIF,f=n.baseUrl,d=t.map(r((function(t,r){var o,d,p,m,v,y,g,x,b,T,E,S,_,C,A,w,M,R,I,P,O;return h(this,(function(r){switch(r.label){case 0:if(o=t.url,d=t.webp,p=t.avif,m=new e.URL(o,f).href,v=!l&&d?new e.URL(d,f).href:void 0,y=!c&&p?new e.URL(p,f).href:void 0,g=t.id,!("template"in t))return[3,8];if(x=t.template,!(b=x.background))return[3,7];T=wl(x,u),E=b.type===fe.video,S=b&&E?ur:rr,r.label=1;case 1:return r.trys.push([1,6,,7]),[4,lr(T,S)];case 2:return s(_=r.sent(),e.HTMLVideoElement)?(n.sourceFrom[g]={url:_.src,type:exports.TextureSourceType.video},[2,_]):[3,3];case 3:return b&&Array.isArray(T)&&u&&(u[b.name]=_.src),n.sourceFrom[g]={url:_.src,type:exports.TextureSourceType.image},[4,Ml(_,x,u)];case 4:return[2,r.sent()];case 5:return[3,7];case 6:throw C=r.sent(),new Error("Failed to load. Check the template or if the URL is "+(E?"video":"image")+" type, URL: "+T+", Error: "+(C.message||C)+".");case 7:return[3,9];case 8:if("compressed"in t&&a&&i){if(A=t.compressed,i===exports.COMPRESSED_TEXTURE.ASTC?w=A.astc:i===exports.COMPRESSED_TEXTURE.PVRTC&&(w=A.pvrtc),w)return M=new e.URL(w,f).href,n.sourceFrom[g]={url:M,type:exports.TextureSourceType.compressed},[2,n.loadBins(M)]}else if(s(t,e.HTMLImageElement)||s(t,e.HTMLCanvasElement)||s(t,e.HTMLVideoElement)||s(t,yr))return[2,t];r.label=9;case 9:return y?[4,er(m,y)]:[3,11];case 10:return O=r.sent(),[3,13];case 11:return[4,$i(m,v)];case 12:O=r.sent(),r.label=13;case 13:return I=(R=O).url,P=R.image,n.sourceFrom[g]={url:I,type:exports.TextureSourceType.image},[2,P]}}))}))),[4,Promise.all(d)];case 1:return p=m.sent(),n.assignImagesToAssets(t,p),[2,p]}}))}))()},i.processPluginAssets=function(t,e,i){var n=this;return r((function(){var r,o,s,a,u;return h(this,(function(h){switch(h.label){case 0:return[4,e.processAssets(t,i)];case 1:for(r=h.sent(),o=r.reduce((function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t}),{assets:[],loadedAssets:[]}),s=o.assets,a=o.loadedAssets,u=0;u<s.length;u++)n.assets[s[u].id]=a[u];return[2]}}))}))()},i.processTextures=function(t,i,n){var o=this;return r((function(){var a,u,l;return h(this,(function(c){return u=null!=(a=n.textures)?a:t.map((function(t,e){return{source:e}})),l=u.map(r((function(t,r){var a,u,l,c,f,d;return h(this,(function(h){switch(h.label){case 0:if(s(t,yr))return[2,t];if(!("mipmaps"in t))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,fr(t,i,o.assets,n.bins)];case 2:return[2,h.sent()];case 3:throw a=h.sent(),new Error("Load texture "+r+" fails, error message: "+a+".");case 4:return u=t.source,l=t.id,f="",at(u)?(c=o.assets[u.id],f=u.id,[3,7]):[3,5];case 5:return"string"!=typeof u?[3,7]:[4,rr(dt(u))];case 6:c=h.sent(),h.label=7;case 7:if(c)return d=function(t,i,r){var n={id:r,dataType:pe.Texture};if(s(t,yr))return Xe({},t.source,n);if(s(t,e.HTMLImageElement)||ht(t))return Xe({image:t,sourceType:exports.TextureSourceType.image,sourceFrom:i,keepImageSource:!0,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR},n);if(s(t,e.HTMLVideoElement))return Xe({sourceType:exports.TextureSourceType.video,video:t,minFilter:Ui.LINEAR,magFilter:Ui.LINEAR},n);if(s(t,ArrayBuffer))return Xe({},Sr(t),{sourceFrom:i},n);if("width"in t&&"height"in t&&"data"in t)return Xe({sourceType:exports.TextureSourceType.data,data:t,wrapS:Ui.CLAMP_TO_EDGE,wrapT:Ui.CLAMP_TO_EDGE,minFilter:Ui.NEAREST,magFilter:Ui.NEAREST},n);throw new Error("Invalid texture options.")}(c,o.sourceFrom[f],l),[2,d.sourceType===exports.TextureSourceType.compressed?d:Xe({},d,t)];throw new Error("Invalid texture source: "+u+".")}}))}))),[2,Promise.all(l)]}))}))()},i.loadJSON=function(t){var e=this;return r((function(){return h(this,(function(i){return[2,new Promise((function(i,r){e.downloader.downloadJSON(t,i,(function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)}))}))]}))}))()},i.loadBins=function(t){var e=this;return r((function(){return h(this,(function(i){return[2,new Promise((function(i,r){e.downloader.downloadBinary(t,i,(function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)}))}))]}))}))()},i.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},i.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},i.dispose=function(){this.timers.length&&this.timers.map((function(t){return e.window.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t.loadFontFamily=function(i,n){return void 0===n&&(n=e.location.href),r((function(){var o;return h(this,(function(s){return i?(o=i.map(r((function(i){var r,o,s;return h(this,(function(a){switch(a.label){case 0:if(!i.fontURL||t.fontCache.has(i.fontFamily))return[3,4];Q(i.fontFamily)||console.warn("Risky font family: "+i.fontFamily+"."),a.label=1;case 1:return a.trys.push([1,3,,4]),r=new e.URL(i.fontURL,n).href,[4,(s=new FontFace(null!=(o=i.fontFamily)?o:"","url("+r+")")).load()];case 2:return a.sent(),e.document.fonts.add(s),t.fontCache.add(i.fontFamily),[3,4];case 3:return a.sent(),it.warn("Invalid font family or font source: "+JSON.stringify(i.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(o)]):[2]}))}))()},t}();Pl.fontCache=new Set;var Ol,Nl=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(t.whiteTexture)}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var i=t;return exports.Scene.isURL(t)&&(exports.Scene.isJSONObject(t)||(i=t.url),exports.Scene.isWithOptions(t)&&(e=Xe({},e,t.options))),{source:i,options:e}},e.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===Pt.text||t.type===Pt.richtext){var r=e[t.name];if(!r)return;t.components.forEach((function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==pe.TextComponent&&(null==n?void 0:n.dataType)!==pe.RichTextComponent||(n.options.text=r)}))}}))},e.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++)t.textures[e]=this.engine.findObject({id:t.textureOptions[e].id}),t.textures[e].initialize()},e.prepareAssets=function(t,e){this.engine.clearResources();for(var i,r=o(Object.keys(e));!(i=r()).done;){var n=i.value,s=e[n],a=new _h(this.engine);a.data=s,a.setInstanceId(n)}this.engine.addPackageDatas(t);for(var u,h=o(this.builtinObjects);!(u=h()).done;){var l=u.value;this.engine.addInstance(l)}},e.createShaderVariant=function(){for(var t,e=o(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];s(r,Nr)&&r.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=o(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),Fl=new Int32Array(2),Ll=new Float32Array(Fl.buffer),Vl=new Float64Array(Fl.buffer),Dl=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];!function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(Ol||(Ol={}));var kl=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new e.TextDecoder}var i=t.prototype;return i.clear=function(){this.position_=0},i.bytes=function(){return this.bytes_},i.position=function(){return this.position_},i.setPosition=function(t){this.position_=t},i.capacity=function(){return this.bytes_.length},i.readInt8=function(t){return this.readUint8(t)<<24>>24},i.readUint8=function(t){return this.bytes_[t]},i.readInt16=function(t){return this.readUint16(t)<<16>>16},i.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},i.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},i.readUint32=function(t){return this.readInt32(t)>>>0},i.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},i.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},i.readFloat32=function(t){return Fl[0]=this.readInt32(t),Ll[0]},i.readFloat64=function(t){return Fl[Dl?0:1]=this.readInt32(t),Fl[Dl?1:0]=this.readInt32(t+4),Vl[0]},i.writeInt8=function(t,e){this.bytes_[t]=e},i.writeUint8=function(t,e){this.bytes_[t]=e},i.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},i.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},i.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},i.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},i.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},i.writeFloat32=function(t,e){Ll[0]=e,this.writeInt32(t,Fl[0])},i.writeFloat64=function(t,e){Vl[0]=e,this.writeInt32(t,Fl[Dl?0:1]),this.writeInt32(t+4,Fl[Dl?1:0])},i.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},i.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},i.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},i.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===Ol.UTF8_BYTES?r:this.text_decoder_.decode(r)},i.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},i.__indirect=function(t){return t+this.readInt32(t)},i.__vector=function(t){return t+this.readInt32(t)+4},i.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},i.__has_identifier=function(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},i.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},i.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),zl=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=kl.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=1+~(this.bb.capacity()-this.space+i)&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=2*(i+2);this.addInt16(r);var n=0,o=this.space;t:for(e=0;e<this.vtables.length;e++){var s=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(s)){for(var a=2;a<r;a+=2)if(this.bb.readInt16(o+a)!=this.bb.readInt16(s+a))continue t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){var n=e;if(this.prep(this.minalign,8+r),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var o=3;o>=0;o--)this.writeInt8(n.charCodeAt(o))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw new TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){return null==t?0:(e=s(t,Uint8Array)?t:this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector());var e},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null===r)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=kl.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),Ul=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new Bl(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),Bl=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=Ul.createDataVector(t,this.data);return Ul.createFBEffectsObjectData(t,e,i)},t}(),Gl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new Ul).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new jl(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),jl=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=Gl.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Gl.createFBEffectsPackageData(t,e)},t}(),Xl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new Hl(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),Hl=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return Xl.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),Wl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new Yl(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,o,s){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,o),t.addNormalize(e,s),t.endFBVertexChannel(e)},t}(),Yl=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return Wl.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),Zl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new Wl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new ql(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),ql=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=Zl.createChannelsVector(t,t.createObjectOffsetList(this.channels));return Zl.createFBVertexData(t,this.vertexCount,e)},t}(),Kl=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new Zl).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new Xl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new Ql(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),Ql=function(){function t(t,e,i,r,n,o,s,a,u,h,l,c){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=[]),void 0===s&&(s=0),void 0===a&&(a=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===l&&(l=null),void 0===c&&(c=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=o,this.mode=s,this.buffer=a,this.binaryData=u,this.boneNames=h,this.rootBoneName=l,this.inverseBindMatrices=c}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=Kl.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),o=null!==this.buffer?t.createString(this.buffer):0,s=Kl.createBinaryDataVector(t,this.binaryData),a=Kl.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=Kl.createInverseBindMatricesVector(t,this.inverseBindMatrices);return Kl.startFBGeometryData(t),Kl.addId(t,e),Kl.addName(t,i),Kl.addVertexData(t,r),Kl.addIndexFormat(t,this.indexFormat),Kl.addIndexOffset(t,this.indexOffset),Kl.addSubMeshes(t,n),Kl.addMode(t,this.mode),Kl.addBuffer(t,o),Kl.addBinaryData(t,s),Kl.addBoneNames(t,a),Kl.addRootBoneName(t,u),Kl.addInverseBindMatrices(t,h),Kl.endFBGeometryData(t)},t}(),Jl=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new zl(1),i=new jl,r=[],n=o(this.exportObjectDatas);!(t=n()).done;){var s=t.value,a=void 0;s.dataType===pe.Geometry&&(a=new Bl("Geometry",this.geometryDataToBinary(s))),a&&r.push(a)}return i.exportObjects=r,Gl.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new kl(t),i=Gl.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var o=n.dataArray(),s=n.dataType();if(o){var a=void 0;s===pe.Geometry&&(a=this.binaryToGeometryData(o)),a&&this.exportObjectDatas.push(a)}}}},e.geometryDataToBinary=function(t){var e=new zl(1),i=new Ql,r=t.indexFormat,n=t.indexOffset,s=t.mode,a=t.id,u=t.vertexData,h=t.boneNames,l=void 0===h?[]:h,c=t.rootBoneName,f=void 0===c?"":c,d=t.inverseBindMatrices,p=void 0===d?[]:d,m=t.binaryData,v=void 0===m?[]:m;i.indexFormat=r,i.indexOffset=n,i.mode=s,i.id=a,i.boneNames=l,i.rootBoneName=f,i.inverseBindMatrices=p,i.binaryData=v;var y=new ql;y.vertexCount=u.vertexCount,y.channels=[];for(var g,x=o(u.channels);!(g=x()).done;){var b=g.value,T=b.semantic,E=b.offset,S=b.format,_=b.dimension,C=b.normalize,A=new Yl(T,E,S,_,C);y.channels.push(A)}i.vertexData=y;for(var w,M=[],R=o(t.subMeshes);!(w=R()).done;){var I=w.value,P=I.offset,O=I.indexCount,N=I.vertexCount,F=new Hl(P,O,N);M.push(F)}return i.subMeshes=M,Gl.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new kl(t),i=Kl.getRootAsFBGeometryData(e),r={vertexCount:0,channels:[]},n=i.vertexData();if(n){r.vertexCount=n.vertexCount();for(var o=0;o<n.channelsLength();o++){var s=n.channels(o);if(s){var a,u={semantic:null!=(a=s.semantic())?a:"",offset:s.offset(),format:s.format(),dimension:s.dimension(),normalize:s.normalize()};r.channels.push(u)}}}for(var h=[],l=0;l<i.subMeshesLength();l++){var c=i.subMeshes(l);if(c){var f={offset:c.offset(),vertexCount:c.vertexCount(),indexCount:c.indexCount()};h.push(f)}}for(var d=[],p=0;p<i.boneNamesLength();p++){var m=i.boneNames(p);d.push(m)}var v,y,g,x,b=i.inverseBindMatricesArray();return{vertexData:r,indexFormat:i.indexFormat(),indexOffset:i.indexOffset(),subMeshes:h,mode:i.mode(),buffer:null!=(v=i.buffer())?v:"",boneNames:d,rootBoneName:null!=(y=i.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=i.binaryDataArray())?g:void 0,id:null!=(x=i.id())?x:"",dataType:pe.Geometry}},t}(),$l=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 Ah(this),this.whiteTexture=br(this),this.transparentTexture=Tr(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.findObject=function(t){return ut(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=void 0===r?[]:r,s=i.items,a=void 0===s?[]:s,u=i.materials,h=void 0===u?[]:u,l=i.shaders,c=void 0===l?[]:l,f=i.geometries,d=void 0===f?[]:f,p=i.components,m=void 0===p?[]:p,v=i.animations,y=void 0===v?[]:v,g=i.bins,x=void 0===g?[]:g,b=i.miscs,T=void 0===b?[]:b,E=o(i.compositions);!(e=E()).done;){var S=e.value;this.addEffectsObjectData(S)}for(var _,C=o(a);!(_=C()).done;){var A=_.value;Al(A.renderLevel,t.renderLevel)||(A.components=[],A.type=Pt.null),this.addEffectsObjectData(A)}for(var w,M=o(h);!(w=M()).done;){var R=w.value;this.addEffectsObjectData(R)}for(var I,P=o(c);!(I=P()).done;){var O=I.value;this.addEffectsObjectData(O)}for(var N,F=o(d);!(N=F()).done;){var L=N.value;this.addEffectsObjectData(L)}for(var V,D=o(m);!(V=D()).done;){var k=V.value;this.addEffectsObjectData(k)}for(var z,U=o(y);!(z=U()).done;){var B=z.value;this.addEffectsObjectData(B)}for(var G,j=o(T);!(G=j()).done;){var X=G.value;this.addEffectsObjectData(X)}for(var H=0;H<x.length;H++){var W=x[H],Y=t.bins[H];if(W.dataType===pe.BinaryAsset)W.buffer=Y,W.id&&this.addEffectsObjectData(W);else{var Z=new Jl;Z.deserializeFromBinary(new Uint8Array(Y));for(var q,K=o(Z.exportObjectDatas);!(q=K()).done;){var Q=q.value;this.addEffectsObjectData(Q)}}}for(var J,$=o(n);!(J=$()).done;){var tt=J.value;this.addEffectsObjectData(tt)}},e.createVFXItems=function(t){var e=this;return r((function(){var i,r,n,s,a;return h(this,(function(u){for(i=t.jsonScene,r=o(i.items);!(n=r()).done;)s=n.value,"ECS"!==(a=s.type)&&"camera"!==a&&a!==Pt.sprite&&a!==Pt.particle&&a!==Pt.mesh&&a!==Pt.skybox&&a!==Pt.light&&a!==Pt.tree&&a!==Pt.interact&&a!==Pt.camera||e.database&&e.assetLoader.loadGUID(s);return[2]}))}))()},e.addTexture=function(t){this.destroyed||v(this.textures,t)},e.removeTexture=function(t){this.destroyed||y(this.textures,t)},e.addMaterial=function(t){this.destroyed||v(this.materials,t)},e.removeMaterial=function(t){this.destroyed||y(this.materials,t)},e.addGeometry=function(t){this.destroyed||v(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||y(this.geometries,t)},e.addMesh=function(t){this.destroyed||v(this.meshes,t)},e.removeMesh=function(t){this.destroyed||y(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||v(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||y(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&&it.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}},wi(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),tc=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var i=t.prototype;return i.getFPS=function(){return this.targetFPS},i.setFPS=function(t){this.targetFPS=C(t,1,120),this.interval=Math.floor(1e3/t)-2},i.getPaused=function(){return this.paused},i.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=e.performance.now();var i=e.requestAnimationFrame||function(t){return e.window.setTimeout(t,16.7)},r=function(){t.intervalId=i(r),t.paused||t.tick()};r()}},i.stop=function(){(e.cancelAnimationFrame||e.window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},i.pause=function(){this.paused=!0,this.dt=0},i.resume=function(){this.paused=!1,this.dt=0},i.tick=function(){if(!this.paused){var t=e.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 i=0,r=this.tickers.length;i<r;i++){var n=this.tickers[i];n(this.dt)}}}},i.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},wi(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();gt("camera",us,exports.VFXItem),gt("text",Sh,exports.VFXItem),gt("sprite",Ts,exports.VFXItem),gt("particle",Hu,exports.VFXItem),gt("cal",Wu,exports.VFXItem),gt("interact",ms,exports.VFXItem);var ec;it.info("Core version: 2.7.3.");var ic,rc=((ec={})[Ui.RGBA]=34842,ec[Ui.RGB]=34843,ec[Ui.ALPHA]=33325,ec[Ui.RED]=33325,ec[Ui.LUMINANCE_ALPHA]=33327,ec[Ui.LUMINANCE]=33325,ec),nc=((ic={})[Ui.RGBA]=34836,ic[Ui.RGB]=34837,ic[Ui.ALPHA]=33326,ic[Ui.RED]=33326,ic[Ui.LUMINANCE_ALPHA]=33328,ic[Ui.LUMINANCE]=33326,ic),oc=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,i&&r.fromData(i),r}kt(e,t);var i=e.prototype;return i.bind=function(t){this.engine.bindTexture(this.target,this.textureBuffer,t)},i.initialize=function(){if(!this.initialized){this.engine.addTexture(this);var t=this.engine.gl,e=this.source,i=e.target,r=void 0===i?t.TEXTURE_2D:i,n=e.name;this.textureBuffer=t.createTexture(),lc(this.textureBuffer,n),this.target=r,this.update(this.source),this.release(),this.initialized=!0}},i.clone=function(){var t=new e(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},i.release=function(){switch(this.source.sourceType){case exports.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case exports.TextureSourceType.data:delete this.source.data;break;case exports.TextureSourceType.compressed:case exports.TextureSourceType.mipmaps:delete this.source.mipmaps}},i.update=function(t){var e=this;if(!this.engine||!this.textureBuffer)return this.width=0,void(this.height=0);var i,r,n=this.target,o=this.source,s=this.engine.gl,a=this.engine.gpuCapability.detail,u=o.sourceType,h=o.data,l=o.cube,c=o.image,f=o.video,d=o.mipmaps,p=o.mipmaps,m=t.data,v=t.cube,y=t.generateMipmap,g=t.mipmaps,x=o.format,b=o.type,T=o.internalFormat,E=0,S=0;if(this.bind(u===exports.TextureSourceType.video),b===Ui.HALF_FLOAT?((b=a.halfFloatTexture)||it.error("Half float texture is not support."),ji(s)&&T===x&&(x===Ui.LUMINANCE&&(x=Ui.RED),T=rc[x]),a.halfFloatLinear||(o.minFilter=o.magFilter=s.NEAREST,it.warn("Half float linear not support, change to NEAREST."))):b===s.FLOAT&&((b=a.floatTexture)||it.error("Float texture is not support."),ji(s)&&T===x&&(x===Ui.LUMINANCE&&(x=Ui.RED),T=nc[x]),a.floatLinear||(o.minFilter=s.NEAREST,o.magFilter=s.NEAREST,it.warn("Float linear not support, change to NEAREST."))),void 0===o.premultiplyAlpha&&(o.premultiplyAlpha=!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),void 0===o.flipY&&(o.flipY=!1),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,o.flipY),u===exports.TextureSourceType.framebuffer)m&&(E=null!=(i=m.width)?i:0,S=null!=(r=m.height)?r:0,E&&S&&(this.width!==E||this.height!==S)&&s.texImage2D(n,0,T,E,S,0,x,b,null));else if(u===exports.TextureSourceType.data){var _;if(n===s.TEXTURE_CUBE_MAP)v.forEach((function(t,i){var r=e.texImage2DData(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,x,b,t),n=r[0],o=r[1];E=Math.max(n,E),S=Math.max(o,S)}));else _=this.texImage2DData(s,n,0,T,x,b,h),E=_[0],S=_[1]}else if(u===exports.TextureSourceType.image||u===exports.TextureSourceType.video){if(n===s.TEXTURE_CUBE_MAP)l.forEach((function(t,i){var r=e.texImage2D(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,x,b,t),n=r[0],o=r[1];E=Math.max(n,E),S=Math.max(o,S)}));else if(n===s.TEXTURE_2D){var C,A=null!=c?c:f;C=this.texImage2D(s,n,0,T,x,b,A),E=C[0],S=C[1]}y&&(sc(E)&&sc(S)||ji(s))&&s.generateMipmap(n)}else if(u===exports.TextureSourceType.mipmaps){var w;n===s.TEXTURE_2D?d.forEach((function(t,i){var r;(w="data"in t?e.texImage2DData(s,n,i,T,x,b,t):e.texImage2D(s,n,i,T,x,b,t),0===i)&&(E=(r=w)[0],S=r[1])})):n===s.TEXTURE_CUBE_MAP&&p.forEach((function(t,i){t.forEach((function(t,r){var n;(w="data"in t?e.texImage2DData(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,T,x,b,t):e.texImage2D(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,T,x,b,t),0===i)&&(E=(n=w)[0],S=n[1])}))}))}else u===exports.TextureSourceType.compressed&&g&&0!==g.length&&(E=g[0].width,S=g[0].height,g.forEach((function(t,e){s.compressedTexImage2D(n,e,T,t.width,t.height,0,t.data)})));this.width=E,this.height=S,this.setTextureFilters(s,n,o)},i.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=void 0===r?4:r,o=i.wrapS,s=void 0===o?t.CLAMP_TO_EDGE:o,a=i.wrapT,u=void 0===a?t.CLAMP_TO_EDGE:a,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var l=ji(t)||sc(this.width)&&sc(this.height),c=i.magFilter?i.magFilter:t.NEAREST,f=i.minFilter?i.minFilter:t.NEAREST;l||f!==t.LINEAR_MIPMAP_LINEAR&&f!==t.LINEAR_MIPMAP_NEAREST&&f!==t.NEAREST_MIPMAP_LINEAR&&f!==t.NEAREST_MIPMAP_NEAREST||(f=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,f),t.texParameteri(e,t.TEXTURE_MAG_FILTER,c),t.texParameteri(e,t.TEXTURE_WRAP_S,l?s:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,l?u:t.CLAMP_TO_EDGE)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e,r=this.assembleOptions(i),n=r.sourceType,o=r.sourceFrom,s=r.name,a=void 0===s?"":s;this.source=r,this.sourceType=n,this.sourceFrom=o,this.name=a},i.texImage2D=function(t,e,i,r,n,o,s){var a,u=this,h=this.source,l=h.sourceType,c=h.minFilter,f=h.magFilter,d=h.wrapS,p=h.wrapT,m=null!=(a=this.engine.gpuCapability.detail.maxTextureSize)?a:2048,v=s;if(l!==exports.TextureSourceType.video){var y=c!==t.NEAREST||f!==t.NEAREST||d!==t.CLAMP_TO_EDGE||p!==t.CLAMP_TO_EDGE;(y=y||s.width>m||s.height>m)&&setTimeout((function(){v=u.resizeImage(s)}))}t.texImage2D(e,i,r,n,o,v);var g=[v.width,v.height];return l===exports.TextureSourceType.video?[s.videoWidth,s.videoHeight]:g},i.texImage2DData=function(t,e,i,r,n,o,s){var a=s.data,u=s.width,h=s.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(a.buffer,a.byteOffset,a.byteLength/a.BYTES_PER_ELEMENT):a;return t.texImage2D(e,i,r,u,h,0,n,o,l),[u,h]},i.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;if(ji(this.engine.gl)&&t.width<n&&t.height<n)return t;var o=function(t,e,i,r){var n=t.width,o=t.height,s=Math.min(e,i||no(n)),a=Math.min(e,r||no(o));if(a!==o||s!==n){var u=yh.getCanvas(),h=u.getContext("2d");return u.width=s,u.height=a,null==h||h.drawImage(t,0,0,n,o,0,0,s,a),it.warn("Image resize from "+n+"x"+o+" to "+s+"x"+a+"."),u}}(t,n,e,i);return o||t},i.reloadData=function(){var t=this;return r((function(){return h(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,Ar().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},i.offloadData=function(){if(this.initialized&&Ar().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.engine.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}},i.uploadCurrentVideoFrame=function(){var t=this;return r((function(){return h(this,(function(e){return t.source.sourceType===exports.TextureSourceType.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},i.updateSource=function(t){this.source=this.assembleOptions(Xe({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},i.restore=function(){},i.dispose=function(){this.engine&&this.textureBuffer&&this.engine.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){it.error("This texture has been destroyed.")},this.initialize=ct,void 0!==this.engine&&this.engine.removeTexture(this),t.prototype.dispose.call(this)},e}(yr);function sc(t){return 0==(t&t-1)&&0!==t}var ac=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.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 ji(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),lc(e,t),e},e.bindVertexArray=function(t){var e;ji(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;ji(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),uc=1,hc=function(){function t(t){this.engine=t,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var e={width:1,height:1,data:new Uint8Array([255])},i=this.engine.gl;this.gl=i,this.emptyTexture2D=new oc(t,{data:e,sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new oc(t,{target:i.TEXTURE_CUBE_MAP,cube:[e,e,e,e,e,e],sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+uc,uc++}var e=t.prototype;return e.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.engine;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)}},e.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&v(this.renderbuffers,t),e},e.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)})))},e.drawGeometry=function(t,e,i){if(this.gl){var r=t,n=e.shaderVariant.program;if(n){var o=n.setupAttributes(r),s=this.gl,a=r.indicesBuffer,u=r.drawStart,h=r.drawCount,l=r.mode,c=r.subMeshes;if(c&&c.length){var f,d=c[i];if(h<0)return;if(u=d.offset,a)h=null!=(f=d.indexCount)?f:0;else h=d.vertexCount}a?s.drawElements(l,h,a.type,null!=u?u:0):s.drawArrays(l,u,h),null==o||o.unbind()}}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")},e.createGLFramebuffer=function(t,e){var i=this.gl.createFramebuffer();if(!i)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return v(this.framebuffers,t),lc(i,e,e),i},e.createVAO=function(t){return new ac(this.engine,t)},e.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),y(this.textures,t),delete t.textureBuffer)},e.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},e.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),y(this.framebuffers,t),delete t.fbo)},e.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),y(this.renderbuffers,t),delete t.buffer)},e.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.lost=function(t){it.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},e.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.gpu=this.gl=null,this.destroyed=!0},wi(t,[{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}}]),t}();function lc(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 cc,fc,dc=function(){function t(t,e){this.engine=t,this.byteLength=0,this.destroyed=!1;var i=e.name,r=e.data,n=e.elementCount,o=e.target,s=void 0===o?Ui.ARRAY_BUFFER:o,a=e.type,u=void 0===a?Ui.FLOAT:a,h=e.usage,l=void 0===h?Ui.STATIC_DRAW:h,c=function(t){var e,i;return null!=(i=null==(e=pc[t])?void 0:e.BYTES_PER_ELEMENT)?i:0}(u);this.target=s,this.type=u,this.usage=l,this.glBuffer=this.createGLBuffer(i),this.bytesPerElement=c,r?this.bufferData(r):n&&this.bufferData(c*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.engine.gl.createBuffer();return lc(e,t),e},e.bind=function(){this.engine.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.engine){this.byteLength=e;var i=this.engine.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.engine){var i=this.engine.gl,r=this.target,n=t*this.bytesPerElement,o=n+e.byteLength;i.bindBuffer(r,this.glBuffer),o>this.byteLength&&(this.byteLength=o,i.bufferData(r,o,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.engine.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!ji(this.engine.gl)&&(this.engine.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},wi(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),pc=((cc={})[Ui.INT]=Int32Array,cc[Ui.FLOAT]=Float32Array,cc[Ui.SHORT]=Int16Array,cc[Ui.BYTE]=Int8Array,cc[Ui.UNSIGNED_BYTE]=Uint8Array,cc[Ui.UNSIGNED_INT]=Uint32Array,cc[Ui.UNSIGNED_SHORT]=Uint16Array,cc);var mc=((fc={})[Uint8Array.BYTES_PER_ELEMENT]=Ui.UNSIGNED_BYTE,fc[Uint16Array.BYTES_PER_ELEMENT]=Ui.UNSIGNED_SHORT,fc[Uint32Array.BYTES_PER_ELEMENT]=Ui.UNSIGNED_INT,fc),vc=1,yc=function(t){function i(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}kt(i,t);var r=i.prototype;return r.getOptions=function(){return Xe({},this.options)},r.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;K(e),e.addGeometry(this),Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new dc(t.engine,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},r.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},r.setAttributeData=function(t,e){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,o=i.target;this.bufferProps[r]={data:e,usage:n,target:o,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},r.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},r.setAttributeSubData=function(t,e,i){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&null!=r.data){var n=e,o=e+i.length;if(r.data.length<o){var s=new i.constructor(o);s.set(r.data),r.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];void 0!==a.start&&(a.start=Math.min(a.start,n)),void 0!==a.end&&(a.end=Math.max(a.end,o-1))}r.data.set(i,n),this.dirtyFlags[t].dirty=!0}}},r.getIndexData=function(){return this.indices},r.setIndexData=function(t){(s(t,Uint8Array)||s(t,Uint16Array)||s(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},r.setIndexSubData=function(t,e){if(this.indices){var i,r=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 s=this.dirtyFlags.index;void 0!==s.start&&(s.start=Math.min(s.start,r)),void 0!==s.end&&(s.end=Math.max(s.end,n-1))}null==(i=this.indices)||i.set(e,r),this.dirtyFlags.index.dirty=!0}},r.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*Yr[n]},r.getAttributeNames=function(){return this.attributesName},r.setDrawStart=function(t){this.drawStart=t},r.getDrawStart=function(){return this.drawStart},r.setDrawCount=function(t){this.drawCount=t},r.getDrawCount=function(){return this.drawCount},r.getSkinProps=function(){return this.skin},r.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},r.createIndicesBuffer=function(t){var e=mc[t.BYTES_PER_ELEMENT],i={data:t,target:Ui.ELEMENT_ARRAY_BUFFER,type:e,name:this.name+"##index"};return new dc(this.engine,i)},r.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 o,s,a=t.dirtyFlags[n];if("index"==n)o=t.indicesBuffer,s=r;else{var u=e[n].dataSource;o=t.buffers[u],s=i[u].data}if((a.dirty||a.discard)&&o&&s){if(a.discard)o.bufferData(s);else if(void 0!==a.start&&void 0!==a.end){var h=a.start*s.BYTES_PER_ELEMENT+s.byteOffset,l=a.end-a.start+1,c=new s.constructor(s.buffer,h,l);o.bufferSubData(a.start,c)}a.start=Number.POSITIVE_INFINITY,a.end=0,a.dirty=a.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(r){var n=t.attributesReleasable[r],o=e[r].dataSource;i[o]&&n&&(i[o].data=void 0)})),this.indicesReleasable}},r.processProps=function(t){var e=t,i=e.drawStart,r=void 0===i?0:i,n=e.drawCount,o=e.mode,a=e.indices,u=e.name,h=void 0===u?"effectsGeometry:"+vc++:u,l=e.bufferUsage,c=void 0===l?Ui.STATIC_DRAW:l;this.name=h;var f={},d=[],p={},m={},v={},y=c;this.drawStart=r,void 0!==n&&(this.drawCount=n),this.mode=isNaN(o)?Ui.TRIANGLES:o,Object.keys(e.attributes).forEach((function(t){var i=e.attributes[t],r=i.size,n=i.stride,o=i.offset,a=i.normalize,u=i.type,h=void 0===u?Ui.FLOAT:u,l=i.releasable,c=i.data;if(!h||"dataSource"in i||c||(c=qr(h)),c){var g=s(c,Float32Array)?Ui.FLOAT:Ui.INT;f[t]={data:c,usage:y,target:Ui.ARRAY_BUFFER,name:t},p[t]={size:r,stride:n,offset:o,type:null!=h?h:g,normalize:!!a,dataSource:t},v[t]=null!=l&&l,m[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=i.dataSource;x&&(p[t]={size:r,stride:n,offset:o,type:h,dataSource:x,normalize:!!a})}d.push(t)})),m.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=f,this.attributes=p,this.attributesName=d,this.attributesReleasable=v,this.dirtyFlags=m,this.options=e,this.initialized=!1},r.fromData=function(i){var r,n=this;if(t.prototype.fromData.call(this,i),this.subMeshes=i.subMeshes,i.buffer?r=new Uint8Array(function(t){for(var i=e.atob(t),r=new Uint8Array(i.length),n=0;n<i.length;n++)r[n]=i.charCodeAt(n);var o=r.buffer;return o}(i.buffer)):i.binaryData&&(r=i.binaryData),r){var o=i.vertexData.vertexCount;if(this.hasSemantic(i)){var s={mode:Ui.TRIANGLES,attributes:{}};if(i.vertexData.channels.forEach((function(t){var e,i=null!=(e=gc[t.semantic])?e:t.semantic,a=n.createVertexTypedArray(t,r,o);s.attributes[i]={type:Hi(t.format),size:t.dimension,data:a,normalize:t.normalize}})),i.indexFormat!==ye.None){var a=this.createIndexTypedArray(i.indexFormat,r,i.indexOffset);s.indices={data:a},s.drawCount=a.length}else s.drawCount=o;this.processProps(s)}else{var u=i.vertexData.channels[0],h=i.vertexData.channels[1],l=i.vertexData.channels[2],c=this.createVertexTypedArray(u,r,o),f=this.createVertexTypedArray(h,r,o),d=this.createVertexTypedArray(l,r,o),p=this.createIndexTypedArray(i.indexFormat,r,i.indexOffset),m={mode:Ui.TRIANGLES,attributes:{aPos:{type:Hi(u.format),size:3,data:c,normalize:u.normalize},aUV:{type:Hi(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:Hi(l.format),size:3,data:d,normalize:l.normalize}}};m.indices={data:p},m.drawCount=p.length,this.processProps(m)}this.skin={boneNames:i.boneNames,rootBoneName:i.rootBoneName,inverseBindMatrices:i.inverseBindMatrices}}},r.dispose=function(){var e,i=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){i.buffers[t].dispose()})),this.buffers={},null==(e=this.indicesBuffer)||e.dispose(),Object.keys(this.vaos).forEach((function(t){var e;null==(e=i.vaos[t])||e.dispose(),i.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&this.engine.removeGeometry(this));this.destroyed=!0,t.prototype.dispose.call(this)},r.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case ve.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case ve.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},r.createIndexTypedArray=function(t,e,i){var r=e.buffer;switch(t){case ye.UInt16:return new Uint16Array(r,e.byteOffset+i);case ye.UInt32:return new Uint32Array(r,e.byteOffset+i);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,e.byteOffset+i)}},r.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},wi(i,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),i}(Zr),gc={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"};var xc=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendColor[0]===e&&this.blendColor[1]===i&&this.blendColor[2]===r&&this.blendColor[3]===n||(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===r&&this.blendFunctionParameters[3]===n||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA,Ui.ONE,Ui.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[Ui.FUNC_ADD,Ui.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=Ui.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=[Ui.ALWAYS,Ui.ALWAYS],this.stencilOpFail=[Ui.KEEP,Ui.KEEP],this.stencilOpZFail=[Ui.KEEP,Ui.KEEP],this.stencilOpZPass=[Ui.KEEP,Ui.KEEP],this.culling=!1,this.frontFace=Ui.CCW,this.cullFace=Ui.FRONT},e.apply=function(t){if(t.toggle(Ui.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(Ui.BLEND,this.blending),t.toggle(Ui.DEPTH_TEST,this.depthTest),t.toggle(Ui.STENCIL_TEST,this.stencilTest),t.toggle(Ui.CULL_FACE,this.culling),t.toggle(Ui.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(Ui.BACK,this.stencilMask[1]),t.stencilMaskSeparate(Ui.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(Ui.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(Ui.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(Ui.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(Ui.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,i=e.blendColor,r=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(i[0],i[1],i[2],i[3]),t.blendEquationSeparate(r[0],r[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}(),bc=M,Tc=Oi,Ec=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).floats={},r.ints={},r.vector2s={},r.vector3s={},r.vector4s={},r.colors={},r.quaternions={},r.matrices={},r.matrice3s={},r.textures={},r.floatArrays={},r.vector4Arrays={},r.matrixArrays={},r.samplers=[],r.uniforms=[],r.uniformDirty=!0,r.macrosDirty=!0,r.glMaterialState=new xc,i&&(r.shader=new exports.Shader(e),r.shader.shaderData=Xe({},i.shader,{id:ft(),dataType:pe.Shader})),r}kt(e,t);var i=e.prototype;return i.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},i.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},i.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},i.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach((function(e){var i=t.textures[e];st(i.initialize)?i.initialize():it.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},i.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},i.setupStates=function(t){this.glMaterialState.apply(t)},i.use=function(t,e){var i=t.engine,r=this.shaderVariant;if(r.program){var n;if(r.program.bind(),this.setupStates(i),e){for(var s,a=o(e.uniforms);!(s=a()).done;)n=s.value,this.checkUniform(n);for(var u,h=o(e.samplers);!(u=h()).done;)n=u.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)r.setFloat(n,e.floats[n]);for(n in e.ints)r.setInt(n,e.ints[n]);for(n in e.vector4s)r.setVector4(n,e.vector4s[n]);for(n in e.vector3s)r.setVector3(n,e.vector3s[n]);for(n in e.matrices)r.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)r.setFloat(n,this.floats[n]);for(n in this.ints)r.setInt(n,this.ints[n]);for(n in this.floatArrays)r.setFloats(n,this.floatArrays[n]);for(n in this.textures)r.setTexture(n,this.textures[n]);for(n in this.vector2s)r.setVector2(n,this.vector2s[n]);for(n in this.vector3s)r.setVector3(n,this.vector3s[n]);for(n in this.vector4s)r.setVector4(n,this.vector4s[n]);for(n in this.colors)r.setColor(n,this.colors[n]);for(n in this.quaternions)r.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)r.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)r.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)r.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)r.setMatrixArray(n,this.matrixArrays[n])}else{var l;null==(l=this.engine)||l.renderErrors.add(new Error("Shader program is not initialized."))}},i.getFloat=function(t){return this.floats[t]},i.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},i.getInt=function(t){return this.ints[t]},i.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},i.getFloats=function(t){return this.floatArrays[t]},i.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},i.getVector2=function(t){return this.vector2s[t]},i.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},i.getVector3=function(t){return this.vector3s[t]},i.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},i.getVector4=function(t){return this.vector4s[t]},i.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},i.getColor=function(t){return this.colors[t]},i.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},i.getQuaternion=function(t){return this.quaternions[t]},i.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},i.getMatrix=function(t){return this.matrices[t]},i.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},i.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},i.getVector4Array=function(t){return this.vector4Arrays[t]},i.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=o(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},i.getMatrixArray=function(t){return this.matrixArrays[t]},i.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=o(e);!(i=r()).done;)for(var n=i.value,s=0;s<16;s++)this.matrixArrays[t].push(n.elements[s])},i.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},i.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},i.clone=function(t){var i=t||this.props,r=this.engine;K(r);var n=new e(r,i);return n.glMaterialState=Object.assign(new xc,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},i.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i=Xe({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===Ft.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var r,n,o=e.stringTags.RenderFace;for(r in o===Lt.Front?(this.culling=!0,this.cullFace=Ui.BACK):o===Lt.Back?(this.culling=!0,this.cullFace=Ui.FRONT):this.culling=!1,i.floats)this.setFloat(r,i.floats[r]);for(r in i.ints)this.setInt(r,i.ints[r]);for(r in i.vector4s){var s=i.vector4s[r];this.setVector4(r,new M(s.x,s.y,s.z,s.w))}for(r in i.colors){var a=i.colors[r];this.setColor(r,new R(a.r,a.g,a.b,a.a))}for(r in i.textures){var u=i.textures[r],h=this.engine.findObject(u.texture);this.setTexture(r,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(r+"_ST",new bc(c.x,c.y,l.x,l.y))}if(e.shader){var f=this.engine.findObject(e.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(n=e.stringTags)?n:{},this.initialized=!1},i.toData=function(){var t=this.defination;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=pe.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var o in this.textures){t.textures[o]||(t.textures[o]={texture:this.textures[o]});var s=t.textures[o],a=this.getVector4(o+"_ST");a&&(s.scale={x:a.x,y:a.y},s.offset={x:a.z,y:a.w},delete t.vector4s[o+"_ST"])}return t},i.cloneUniforms=function(t){var e,i=t;for(e in i.floats)this.setFloat(e,i.floats[e]);for(e in i.ints)this.setInt(e,i.ints[e]);for(e in i.floatArrays)this.setFloats(e,i.floatArrays[e]);for(e in i.textures)this.setTexture(e,i.textures[e]);for(e in i.vector2s)this.setVector2(e,i.vector2s[e]);for(e in i.vector3s)this.setVector3(e,i.vector3s[e]);for(e in i.vector4s)this.setVector4(e,i.vector4s[e]);for(e in i.colors)this.setColor(e,i.colors[e]);for(e in i.quaternions)this.setQuaternion(e,i.quaternions[e]);for(e in i.matrices)this.setMatrix(e,i.matrices[e]);for(e in i.vector4Arrays){for(var r=[],n=0;n<i.vector4Arrays[e].length;n+=4)r.push(new bc(i.vector4Arrays[e][n],i.vector4Arrays[e][n+1],i.vector4Arrays[e][n+2],i.vector4Arrays[e][n+3]));this.setVector4Array(e,r)}for(e in i.matrixArrays){for(var o=[],s=0;s<i.matrixArrays[e].length;s+=16){for(var a=Tc.fromIdentity(),u=0;u<16;u++)a.elements[u]=i.matrixArrays[e][s+u];o.push(a)}this.setMatrixArray(e,o)}},i.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},i.dispose=function(){var e;this.destroyed||(null==(e=this.shaderVariant)||e.dispose(),this.textures={},this.shaderSource=null,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=ct,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this),t.prototype.dispose.call(this))},wi(e,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask[0]},set:function(t){this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Nr),Sc=function(){function t(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.engine.shaderLibrary.addShader(e)}}var e=t.prototype;return e.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},e.copyTexture=function(t,e){this.renderer&&(t.initialize(),e.initialize(),e.updateSource({sourceType:exports.TextureSourceType.framebuffer,data:{width:e.getWidth()||t.getWidth(),height:e.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,e):this.copy1(t,e))},e.copy2=function(t,e){var i=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(i)},e.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)}}},e.createCopyRenderPass=function(){var t="mri-copy-mesh",e={texture:{format:Ui.RGBA}},i=this.renderer.engine,r=new yc(i,{name:t,mode:Ui.TRIANGLE_STRIP,attributes:{aPos:{type:Ui.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=i.gpuCapability.level,o=new Ec(i,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===n?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1}});o.blending=!1,o.depthTest=!1,o.culling=!1;var s=new sn(i,{name:t,geometry:r,material:o,priority:0});return new _c(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:exports.TextureLoadAction.whatever},attachments:[e],meshes:[s]})},e.dispose=function(){var t;this.renderer&&(null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0)},t}(),_c=function(t){function e(){return t.apply(this,arguments)}kt(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}(cn),Cc=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=[],K(t),this.gl=Ni(t,e,i),this.contextLostListener=function(t){for(var e,i,n=o(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=o(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}(),Ac=function(){function t(t,e,i){this.engine=t,this.program=e,this.id=i,this.engine.useProgram(e),this.attribInfoMap=this.createAttribMap(),this.engine.useProgram(null)}var e=t.prototype;return e.bind=function(){this.engine.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,o=this.engine.gl;return t.vaos[n]?i=t.vaos[n]:((i=new ac(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),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 s=t.buffers[n.dataSource];if(!s)throw new Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");s.bind(),o.enableVertexAttribArray(i.loc),o.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.engine.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var o=t.getActiveAttrib(e,n);if(o){var s=o.name,a=o.type,u=o.size,h=t.getAttribLocation(e,s);i[s]={type:a,name:s,size:u,loc:h}}}return i},e.dispose=function(){this.engine&&this.engine.gl.deleteProgram(this.program)},t}(),wc=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}kt(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.engine.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.engine.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.engine.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.engine.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.engine.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.engine.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.engine.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.engine.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.engine.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.engine.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.engine.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.engine.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.engine.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i=e.slice();t=t.concat(i);for(var r,n=this.engine.getUniforms(this.program.program,t),o=0;o<t.length;o++)this.uniformLocations[t[o]]=n[o];for(r=0;r<i.length;r++){null==this.uniformLocations[i[r]]&&(i.splice(r,1),r--)}for(r=0;r<i.length;r++){var s=i[r];this.samplerChannels[s]=r}},i.toData=function(){var t=this.defination;t.dataType=pe.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var e;this.compileResult&&this.compileResult.shared||(null==(e=this.program)||e.dispose(),t.prototype.dispose.call(this))},e}(Lr),Mc=0,Rc=function(){function t(t){this.engine=t,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var i=t.prototype;return i.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=o(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(t,e){var i,r,n=[];t.macros&&(i=n).push.apply(i,[].concat(t.macros));e&&(r=n).push.apply(r,[].concat(e));var o=Xe({},t,{vertex:_n.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.vertex,shader:t.vertex,macros:n}),fragment:_n.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.fragment,shader:t.fragment,macros:n})}),s=this.computeShaderCacheId(o);if(this.cachedShaders[s])return s;this.shaderAllDone=!1;var a=!1;return(o.shared||o.cacheId)&&(a=!0),this.cachedShaders[s]=new wc(this.engine,Xe({},o,{vertex:o.vertex,fragment:o.fragment,name:o.name||s,shared:a})),this.cachedShaders[s].id=s,s},i.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},i.compileShader=function(t,i){var r=this,n=t.source,o=n.shared,s=n.vertex,a=n.fragment,u=n.name,h=t.source.cacheId,l=!1;(o||h)&&(l=!0);var c=this.engine.gl,f={shared:l,status:exports.ShaderCompileResultStatus.compiling},d=this.createProgram(c,s,a,f),p=this.glAsyncCompileExt,m=e.performance.now(),v=function(i){f.status=exports.ShaderCompileResultStatus.success,f.compileTime=e.performance.now()-m,t.program=i,t.initialized=!0,void 0!==r.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),r.programMap[t.id]=i},y=function(){if(r.engine.isDestroyed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==i?void 0:i(f);if(t.initialized)return null==i?void 0:i(f);var n=(!i||!p||p&&1==c.getProgramParameter(f.program,p.COMPLETION_STATUS_KHR))&&d();if(n){if(f.status!==exports.ShaderCompileResultStatus.fail){lc(n,u);var o=new Ac(r.engine,n,t.id);if(c.validateProgram(n),c.getProgramParameter(n,c.VALIDATE_STATUS))v(o);else{var h=c.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))||(null==h?void 0:h.includes("Two textures of different types use the same sampler"))?v(o):(f.status=exports.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",s,"\nfragment:\n",a),c.deleteProgram(n))}}null==i||i(f)}else i&&e.requestAnimationFrame(y)};t.compileResult=f,y()},i.computeShaderCacheId=function(t){var e=t.vertex,i=void 0===e?"":e,r=t.fragment,n=void 0===r?"":r,o=t.shared,s=t.cacheId;return o||s?s||"shared_"+Pc(i,n):"instanced_"+Mc++},i.createProgram=function(t,e,i,r){var n=t.createProgram(),o=this.createGLShader(t,t.VERTEX_SHADER,e),s=this.createGLShader(t,t.FRAGMENT_SHADER,i);return n&&o&&s?(t.attachShader(n,o),t.attachShader(n,s),t.linkProgram(n),r.program=n,r.status=exports.ShaderCompileResultStatus.compiling,function(){if(r.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var a=t.getProgramInfoLog(n);console.error("Failed to link program: "+a+".");var u=Ic(t,o,"vertex",e),h=Ic(t,s,"fragment",i);return r.status=exports.ShaderCompileResultStatus.fail,u&&(r.error=u.error,r.status=u.status),h&&(r.error=h.error,r.status=h.status),n}return n}):(r.status=exports.ShaderCompileResultStatus.fail,function(){return null})},i.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Pc(null!=i?i:""),o=r.get(n);if(o)return o;var s=t.createShader(e);return s&&(t.shaderSource(s,i),t.compileShader(s),r.set(n,s)),s},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.engine){var e=this.engine.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}},t}();function Ic(t,e,i,r){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+i+" error: "+n,(null!=r?r:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:exports.ShaderCompileResultStatus.fail}}}function Pc(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var o=e[n],s=0;s<o.length;s++)r=Math.imul(31,r)+o.charCodeAt(s)|0;return r}var Oc=function(t){function e(e){var i;return(i=t.call(this)||this).gl=e,i.gpuCapability=new Un(e),i.gl=e,i.shaderLibrary=new Rc(Cs(i)),i.maxTextureCount=i.gl.TEXTURE0+i.gl.getParameter(i.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,i.reset(),i}kt(e,t);var i=e.prototype;return i.dispose=function(){this.destroyed||(t.prototype.dispose.call(this),this.shaderLibrary.dispose(),this.reset())},i.getGLRenderer=function(){return this.renderer},i.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},i.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=Ui.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},i.toggle=function(t,e){e?this.enable(t):this.disable(t)},i.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},i.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},i.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},i.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},i.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},i.useProgram=function(t){this.set1("useProgram",t)},i.clear=function(t){this.gl.clear(t)},i.clearDepth=function(t){this.set1("clearDepth",t)},i.depthFunc=function(t){this.set1("depthFunc",t)},i.depthMask=function(t){this.set1("depthMask",t)},i.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},i.depthRange=function(t,e){this.set2("depthRange",t,e)},i.clearStencil=function(t){this.set1("clearStencil",t)},i.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},i.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},i.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},i.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},i.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},i.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},i.cullFace=function(t){this.set1("cullFace",t)},i.frontFace=function(t){this.set1("frontFace",t)},i.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},i.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},i.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},i.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},i.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},i.blendEquation=function(t){this.set1("blendEquation",t)},i.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},i.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},i.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},i.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},i.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},i.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},i.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)},i.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)},i.set4=function(t,e,i,r,n){var o=this.glCapabilityCache[t];o||(o=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),o.x===e&&o.y===i&&o.z===r&&o.w===n||this.gl[t](o.x=e,o.y=i,o.z=r,o.w=n)},i.get=function(t){return this.glCapabilityCache[t]},i.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},i.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},i.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},i.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},i.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},i.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},i.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},i.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},i.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},i.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},i.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},i.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},i.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)}},i.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},i.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},i.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},i.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},e}($l),Nc=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}kt(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){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer,r=i.gl;i.engine.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):it.error("Invalid render buffer size: "+t+"x"+e+".")}}else it.error("Can't set size for uninitialized render buffer.")},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=ct},e}(kn),Fc=1,Lc=function(t){function e(e,i){var r;(r=t.call(this)||this).attachmentTextures=[];var n,o=e.depthStencilAttachment,s=e.viewport,a=e.isCustomViewport,u=e.storeAction,h=e.viewportScale,l=void 0===h?1:h,c=e.name,f=void 0===c?"GLFramebuffer"+Fc++:c;return r.renderer=i,r.engine=i.engine,r.depthStencilStorageType=null!=(n=null==o?void 0:o.storageType)?n:exports.RenderPassAttachmentStorageType.none,r.viewport=s,r.isCustomViewport=!!a,r.viewportScale=l,r.name=f,r.storeAction=u,r.updateProps(e),r}kt(e,t);var i=e.prototype;return i.getDepthTexture=function(){return this.depthTexture},i.getStencilTexture=function(){return this.stencilTexture},i.getColorTextures=function(){return this.colorTextures},i.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.updateProps=function(t){var e,i,r=this.renderer,n=this.engine.gpuCapability,o=null!=(i=t.depthStencilAttachment)?i:{storageType:exports.RenderPassAttachmentStorageType.none},a=t.attachments.length>0,u=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var h=null==(e=t.depthStencilAttachment)?void 0:e.texture,l=n.detail.readableDepthStencilTextures,c=o.storageType,f=o.storage;if(this.colorTextures=t.attachments.slice(),!a&&c!==exports.RenderPassAttachmentStorageType.none)throw new Error("Use depth stencil attachment without color attachments.");switch(a&&(this.fbo=r.glRenderer.createGLFramebuffer(this,this.name)),c){case exports.RenderPassAttachmentStorageType.depth_stencil_opaque:if(f){if(!s(f,Nc))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Nc({format:Ui.DEPTH_STENCIL,attachment:Ui.DEPTH_STENCIL_ATTACHMENT,storageType:c},r.glRenderer);u=!1;break;case exports.RenderPassAttachmentStorageType.depth_16_opaque:if(f){if(!s(f,Nc))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Nc({attachment:Ui.DEPTH_ATTACHMENT,format:Ui.DEPTH_COMPONENT16,storageType:c},r.glRenderer);break;case exports.RenderPassAttachmentStorageType.stencil_8_opaque:if(f){if(!s(f,Nc))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Nc({attachment:Ui.STENCIL_ATTACHMENT,format:Ui.STENCIL_INDEX8,storageType:c},r.glRenderer);break;case exports.RenderPassAttachmentStorageType.depth_16_texture:if(!l)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new oc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:Ui.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:Ui.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!l)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new oc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:Ui.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},i.getStoreAttachments=function(t,e){var i=this.renderer.glRenderer.gl,r=this.colorTextures.length;if(t&&ji(i)&&r>0){var n=[];if(t.depthAction===exports.TextureStoreAction.clear&&this.depthStorage&&v(n,e?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===exports.TextureStoreAction.clear&&this.stencilStorage&&v(n,e?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===exports.TextureStoreAction.clear)for(var o=0;o<r;o++)v(n,i["COLOR_ATTACHMENT"+o]);return n}},i.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;ji(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.engine.bindSystemFramebuffer()},i.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,i=this.renderer.engine,r=this.viewport,n=r[0],o=r[1],s=r[2],a=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,o,s,a);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(i.textureUnitDict).forEach((function(e){var r=i.textureUnitDict[e];r&&r!==u&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)i.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var l=this,c=l.depthStencilRenderbuffer,f=l.depthTexture,d=l.stencilTexture;if(i.activeTexture(e.TEXTURE0),c)c.setSize(s,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,c.attachment,e.RENDERBUFFER,c.buffer);else if(f){f.source.data={width:s,height:a},f.update({data:{width:s,height:a,data:new Uint16Array(0)}});var p=f&&d?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,p,e.TEXTURE_2D,f.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var m=e.checkFramebufferStatus(e.FRAMEBUFFER);if(m!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+m+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+".");this.ready=!0}}},i.resetColorTextures=function(t){var e=t,i=this.renderer.glRenderer.gl,r=this.engine.gpuCapability,n=this.viewport,s=[];if(e){for(var a,u=o(e);!(a=u()).done;){a.value.initialize()}this.colorTextures=e.slice()}this.renderer.engine.activeTexture(i.TEXTURE0),this.colorTextures.forEach((function(t,e){var o={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:o}),r.framebufferTexture2D(i,i.FRAMEBUFFER,e,i.TEXTURE_2D,t.textureBuffer),s.push(!0)})),r.drawBuffers(i,s),this.updateAttachmentTextures()},i.resize=function(t,e,i,r){var n=this.viewport,o=n[0],s=n[1],a=n[2],u=n[3];o===t&&s===e&&a===i&&u===r||(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},i.dispose=function(t){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var e,i,r=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:exports.RenderPassDestroyAttachmentType.force;if(r===exports.RenderPassDestroyAttachmentType.force||r===exports.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)null==(e=this.depthStencilRenderbuffer)||e.dispose(),null==(i=this.depthTexture)||i.dispose();this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},wi(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(Hn),Vc=function(t){function e(e,i,r){var n;(n=t.call(this)||this).canvas=e,n.temporaryRTs={};var o=Xe({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},r);n.context=new Cc(e,i,o);var s=n.context.gl;return K(s),n.engine=new Oc(s),n.engine.renderer=Cs(n),n.glRenderer=new hc(n.engine),n.extension=new Sc(Cs(n)),n.renderingData={currentFrame:{}},n.framebuffer=new Lc({storeAction:{},viewport:[0,0,n.width,n.height],attachments:[new oc(n.engine,{sourceType:exports.TextureSourceType.framebuffer,data:{width:n.width,height:n.height}})],depthStencilAttachment:{storageType:exports.RenderPassAttachmentStorageType.none}},Cs(n)),n}kt(e,t);var i=e.prototype;return i.renderRenderFrame=function(t){var e,i=t;i.resource&&i.resource.color_b.initialize();var r=i._renderPasses;if(this.isDestroyed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=i.renderer.getShaderLibrary())||e.compileAllShaders(),this.setFramebuffer(null),this.clear(i.clearAction);var n=i.camera;this.renderingData.currentFrame=i,this.renderingData.currentCamera=n,this.setGlobalMatrix("effects_MatrixInvV",n.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",n.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",n.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",n.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",n.position),W(r);for(var s,a=o(r);!(s=a()).done;){var u=s.value,h=u.delegate;null==h.willBeginRenderPass||h.willBeginRenderPass.call(h,u,this.renderingData),this.renderRenderPass(u),null==h.didEndRenderPass||h.didEndRenderPass.call(h,u,this.renderingData)}for(var l,c=o(r);!(l=c()).done;){l.value.frameCleanup(this)}}},i.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},i.renderMeshes=function(t){for(var e,i=this.renderingData.currentPass.delegate,r=o(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)}},i.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},i.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},i.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},i.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},i.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},i.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},i.drawGeometry=function(t,e,i,r){if(void 0===r&&(r=0),t&&i){i.initialize(),t.initialize(),t.flush();var n=this.renderingData;i.setMatrix("effects_ObjectToWorld",e);try{i.use(this,n.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,i,r)}},i.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.engine.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},i.getFramebuffer=function(){return this.framebuffer},i.getTemporaryRT=function(t,e,i,r,n,o){if(this.temporaryRTs[t])return this.temporaryRTs[t];var s,a,u=exports.RenderPassAttachmentStorageType.none;n===exports.FilterMode.Linear?s=Ui.LINEAR:n===exports.FilterMode.Nearest&&(s=Ui.NEAREST),o===exports.RenderTextureFormat.RGBA32?a=Ui.UNSIGNED_BYTE:o===exports.RenderTextureFormat.RGBAHalf&&(a=Ui.HALF_FLOAT),0===r?u=exports.RenderPassAttachmentStorageType.none:16===r?u=exports.RenderPassAttachmentStorageType.depth_16_opaque:24===r&&(u=exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var h=new oc(this.engine,{sourceType:exports.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:Ui.RGBA,format:Ui.RGBA,type:a}),l=new Lc({name:t,storeAction:{},viewport:[0,0,e,i],viewportScale:1,isCustomViewport:!0,attachments:[h],depthStencilAttachment:{storageType:u}},this);return this.temporaryRTs[t]=l,l},i.setViewport=function(t,e,i,r){this.engine.viewport(t,e,i,r)},i.clear=function(t){var e=this.engine,i=0;if(t.colorAction===exports.TextureLoadAction.clear){var r=t.clearColor;r&&e.clearColor(r[0],r[1],r[2],r[3]),e.colorMask(!0,!0,!0,!0),i=Ui.COLOR_BUFFER_BIT}if(t.stencilAction===exports.TextureLoadAction.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),i|=Ui.STENCIL_BUFFER_BIT),t.depthAction===exports.TextureLoadAction.clear){var n=t.clearDepth;e.depthMask(!0),e.clearDepth(Number.isFinite(n)?n:1),i|=Ui.DEPTH_BUFFER_BIT}i&&e.clear(i)},i.addLostHandler=function(t){this.context.addLostHandler(t)},i.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},i.getShaderLibrary=function(){return this.engine.shaderLibrary},i.getWidth=function(){return this.width},i.getHeight=function(){return this.height},i.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},i.lost=function(t){t.preventDefault(),this.extension.dispose(),this.glRenderer.lost(t)},i.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context.");var e=this.engine;e.reset(),e.shaderLibrary=new Rc(e),e.gpuCapability=new Un(t),this.glRenderer=new hc(this.engine),this.extension=new Sc(this)},i.resize=function(t,e){var i=this.glRenderer;i&&(this.width===t&&this.height===e||i.resize(t,e))},i.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},wi(e,[{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}}]),e}(Wn),Dc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY",kc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT",zc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW",Uc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Bc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Gc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",jc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var Xc=new Map;var Hc=!1,Wc=1,Yc=function(t){function i(i){var n;(n=t.call(this)||this).compositions=[],n.displayScale=1,n.resumePending=!1,n.disposed=!1,n.assetManagers=[],n.speed=1,n.baseCompositionIndex=0,n.useExternalCanvas=!1,n.lost=function(t){var e;null==(e=n.ticker)||e.pause(),n.compositions.forEach((function(e){return e.lost(t)})),n.renderer.lost(t),n.handleEmitEvent("webglcontextlost",t)};var s=Cs(n);n.restore=r((function(){var t;return h(this,(function(i){switch(i.label){case 0:return s.renderer.restore(),[4,Promise.all(s.compositions.map(r((function(t){var e,i,r,n,o,a,u,l,c,f,d;return h(this,(function(h){switch(h.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.reusable,o=t.renderOrder,a=t.transform,u=t.videoState,[4,s.loadScene(i)];case 1:(l=h.sent()).speed=r,l.reusable=n,l.renderOrder=o,l.transform.setPosition(a.position.x,a.position.y,a.position.z),l.transform.setRotation(a.rotation.x,a.rotation.y,a.rotation.z),l.transform.setScale(a.scale.x,a.scale.y,a.scale.z),c=0,h.label=2;case 2:return c<u.length?u[c]?((f=l.textures[c].source.video).currentTime=null!=(d=u[c])?d:0,[4,f.play()]):[3,4]:[3,5];case 3:h.sent(),h.label=4;case 4:return c++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return s.compositions=i.sent(),s.emit("webglcontextrestored"),null==(t=s.ticker)||t.resume(),k()&&s.canvas&&(s.canvas.style.display="none",e.window.setTimeout((function(){s.canvas.style.display=""}),0)),[2]}}))})),n.handleClick=function(t){var e=t.x,i=t.y,r=[];n.compositions.forEach((function(t){for(var s,a=o(t.hitTest(e,i));!(s=a()).done;){var u=s.value;r.push(Xe({},u,{player:Cs(n),composition:t}))}}));for(var s=0;s<r.length;s++){var a=r[s],u=a.behavior||It.NOTIFY;u===It.NOTIFY?(n.emit("click",Xe({},a,{compositionId:a.composition.id,compositionName:a.composition.name})),a.composition.emit("click",Xe({},a,{compositionId:a.composition.id,compositionName:a.composition.name}))):u===It.RESUME_PLAYER&&n.resume()}};var a=i.container,u=i.canvas,l=i.fps,c=i.name,f=i.pixelRatio,d=i.manualRender,p=i.reportGPUTime,m=i.renderFramework,v=i.notifyTouch,y=i.onError,g=i.interactive,x=void 0!==g&&g,b=i.renderOptions,T=void 0===b?{}:b,E=i.env,S=void 0===E?"":E,_=T.willCaptureImage,C=T.premultipliedAlpha;if(n.onError=y,Hc||"debug-disable"===m)return vh(n);var A,w=(A=/iPhone OS (\d+)_(\d+)/.exec(e.navigator.userAgent))&&("13"===A[1]||"16"===A[1]&&"5"===A[2])?"webgl":"webgl2";m&&(w="webgl"===m?"webgl":"webgl2"),n.reportGPUTime=p,n.pixelRatio=Number.isFinite(f)?f:L(),n.offscreenMode=!0,n.env=S,n.name=c||""+Wc++;try{if(zi.length)throw new Error("Errors before player create: "+zi.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?(n.canvas=u,n.useExternalCanvas=!0):(Zc(a),n.canvas=e.document.createElement("canvas"),a.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.renderer=Wn.create(n.canvas,w,{preserveDrawingBuffer:_,premultipliedAlpha:C}),n.renderer.env=S,n.renderer.addLostHandler({lost:n.lost}),n.renderer.addRestoreHandler({restore:n.restore}),n.gpuCapability=n.renderer.engine.gpuCapability,n.assetService=new Nl(n.renderer.engine),d||(n.ticker=new tc(l),n.ticker.add(n.tick.bind(Cs(n)))),n.event=new ds(n.canvas,!!v),n.event.bindListeners(),n.event.addEventListener(hs,n.handleClick),n.interactive=x,n.resize(),Xu(n.gpuCapability.detail),Xc.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&&it.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+jc+".")})),Xc.set(n.canvas,Cs(n)),function(){for(var t,e=[],i=o(Xc.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&it.error("Current running player count: "+e.length+", see "+Gc+".",e)}()}catch(t){n.canvas&&!n.useExternalCanvas&&n.canvas.remove(),n.handleThrowError(t)}return n}kt(i,t);var n=i.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.sort((function(t,e){return t.getIndex()-e.getIndex()}))},n.getAssetManager=function(){return this.assetManagers},n.loadScene=function(t,i){var n=this;return r((function(){var s,a,u,l,c,f,d,p,m,v,y,g,x,b,T,E,S,_,C,A,w,M;return h(this,(function(R){switch(R.label){case 0:for(K(n.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),l=e.performance.now(),c=[],f=[],p=null==(d=null==i?void 0:i.autoplay)||d,m=null==(a=n.renderer.engine.gpuCapability)||null==(s=a.detail)?void 0:s.asyncShaderCompile,v=n.baseCompositionIndex,ot(t)?(y=c).push.apply(y,[].concat(t)):c.push(t),n.baseCompositionIndex+=c.length,p&&(n.autoPlaying=!0),g=o(n.assetManagers);!(x=g()).done;)x.value.dispose();return n.assetManagers=[],b=[],[4,Promise.all(c.map(r((function(t,e){var r,o,s,a,u,l,c,d;return h(this,(function(h){switch(h.label){case 0:return r=n.assetService.assembleSceneLoadOptions(t,Xe({autoplay:p},i)),o=r.source,s=r.options,u=null!=(a=null==s?void 0:s.autoplay)?a:p,l=new Pl(s),n.assetManagers.push(l),[4,l.loadScene(o,n.renderer,{env:n.env})];case 1:return c=h.sent(),n.disposed?(f.length=0,[2]):(n.assetService.prepareAssets(c,c.assets),n.assetService.updateTextVariables(c,l.options.variables),n.assetService.initializeTexture(c),c.pluginSystem.precompile(c.jsonScene.compositions,n.renderer),(d=n.createComposition(c,s)).setIndex(v+e),f[e]=d,b[e]=u,[2])}}))}))))];case 1:return R.sent(),T=e.performance.now(),[4,new Promise((function(t){var e;null==(e=n.renderer.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:for(R.sent(),E=e.performance.now()-T,S=0;S<f.length;S++)b[S]?f[S].play():f[S].pause(),n.compositions.push(f[S]);for(null==(u=n.ticker)||u.start(),f.some((function(t){return!t.getPaused()}))&&n.emit("play",{time:0}),_=f.map((function(t){return t.name})),C=e.performance.now()-l,A=o(f);!(w=A()).done;)(M=w.value).statistic.compileTime=E,M.statistic.firstFrameTime=C;return it.info("First frame ["+_+"]: "+C.toFixed(4)+"ms."),it.info("Shader "+(m?"async":"sync")+" compile ["+_+"]: "+E.toFixed(4)+"ms."),[2,ot(t)?f:f[0]]}}))}))()},n.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=this.renderer,n=new Fu(Xe({},e,{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,handleItemMessage:function(t){i.emit("message",t)}}),t);return this.ticker&&e.renderLevel===St.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==Qo&&this.assetService.createShaderVariant(),n},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(),this.emit("play",{time:0})},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),this.emit("play",{time:t})},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),this.emit("pause")},n.playSequence=function(t){for(var e,i=function(e){t[e].on("end",(function(){t[e+1].play()}))},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},n.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),this.compositions.map((function(t){t.pause()})),t&&t.offloadTexture&&this.offloadTexture())},n.resume=function(){var t=this;return r((function(){var e;return h(this,(function(i){switch(i.label){case 0:return t.resumePending?[2]:t.paused?(t.resumePending=!0,[4,Promise.all(t.compositions.map((function(t){return t.reloadTexture()})))]):[3,2];case 1:i.sent(),t.resumePending=!1,t.emit("resume"),i.label=2;case 2:return t.compositions.map((function(t){t.resume()})),null==(e=t.ticker)||e.resume(),[2]}}))}))()},n.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},n.doTick=function(t,e){var i,r=this,n=this.renderer.engine.renderErrors;n.size>0&&(this.handleEmitEvent("rendererror",n.values().next().value),null==(i=this.ticker)||i.pause());t=Math.min(t,33)*this.speed;var o=this.compositions,s=!1;o.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var a,u=[],h=0;h<o.length;h++){var l=o[h];l.textureOffloaded?(s=!0,it.error("Composition "+l.name+" texture offloaded, skip render."),u.push(l)):(!l.isDestroyed&&l.renderer&&l.update(t),l.isDestroyed||u.push(l))}if(this.compositions=u,this.baseCompositionIndex=this.compositions.length,s)return this.handleEmitEvent("rendererror",new Error("Play when texture offloaded.")),null==(a=this.ticker)?void 0:a.pause();if(!this.paused||e){var c=this.gpuCapability.level,f=this.renderer.context.gl,d=2===c&&this.reportGPUTime?Fi(f):void 0;if(null==d||d.begin(),this.compositions.length||this.compositions.length<o.length||e){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var p=0;p<o.length;p++)!o[p].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(o[p].renderFrame)}null==d||d.end(),null==d||d.getTime().then((function(t){return null==r.reportGPUTime?void 0:r.reportGPUTime.call(r,null!=t?t:0)})).catch,this.autoPlaying&&this.emit("update",{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,i,r,n,o=this,s=this.canvas.parentElement;if(s){var a=this.getTargetSize(s);t=a[0],i=a[1],r=a[2],n=a[3]}else t=r=this.canvas.width,i=n=this.canvas.height;var u=t/i;if(t&&i){var h,l=e.document.documentElement.clientWidth;r>2*l&&it.error("DPI overflowed, width "+r+" is more than 2x document width "+l+", see "+kc+".");var c=this.env?this.gpuCapability.detail.maxTextureSize:2048;(r>c||n>c)&&(it.error("Container size overflowed "+r+"x"+n+", see "+Dc+"."),u>1?(r=Math.round(c),n=Math.round(c/u)):(n=Math.round(c),r=Math.round(c*u))),this.renderer.resize(r,n),this.canvas.style.width=t+"px",this.canvas.style.height=i+"px",it.info("Resize player "+this.name+" ["+r+","+n+","+t+","+i+"]."),null==(h=this.compositions)||h.forEach((function(t){t.camera.aspect=u,t.camera.pixelHeight=o.renderer.getHeight(),t.camera.pixelWidth=o.renderer.getWidth()}))}},n.clearCanvas=function(t){t?this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.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){var i,r,n;if(it.info("Call player destroyed: "+this.name+"."),!this.disposed){Xc.delete(this.canvas),this.pause(),null==(i=this.ticker)||i.stop(),this.assetManagers.forEach((function(t){return t.dispose()})),this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.renderer&&(this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.renderer.dispose(!t)),null==(r=this.event)||r.dispose(),null==(n=this.assetService)||n.dispose(),s(this.canvas,e.HTMLCanvasElement)&&!t&&this.renderer.context&&(yh.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var o="Never use destroyed player: "+this.name+" again, see "+Bc+".",a=function(){return function(t){throw new Error(t)}(o)},u=function(){return t=o,Promise.reject(t);var t};this.tick=a,this.resize=a,this.loadScene=u,this.play=u,this.gotoAndPlay=u,this.gotoAndStop=u,this.playSequence=a,this.destroyCurrentCompositions=a,this.resume=u,this.disposed=!0}},n.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},n.getTargetSize=function(t){Zc(t);var i,r,n=this.displayAspect,o=null==e.window.getComputedStyle?void 0:e.window.getComputedStyle.call(e.window,t),s=0,a=0;(o?(s=parseInt(o.width,10),a=parseInt(o.height,10)):(s=t.clientWidth,a=t.clientHeight),n)?s/a>n?i=(r=a*this.displayScale)*n:r=(i=s*this.displayScale)/n:(i=s,r=a);var u=this.pixelRatio,h=i,l=r;if(i=Math.round(i*u),(r=Math.round(r*u))<1||r<1){if(!this.offscreenMode)throw new Error("Invalid container size "+i+"x"+r+", see "+zc+".");i=r=h=l=1}return[h,l,i,r]},n.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},n.handleEmitEvent=function(t,i){this.onError?s(i,e.Event)?this.onError(new Error(i.type,{cause:t}),i):s(i,Error)?this.onError(new Error(i.message,{cause:t}),i):this.onError(new Error("Unknown error.",{cause:t}),i):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,i))},wi(i,[{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),i}(Ru);function Zc(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Uc+".")}u([function(t,e,i){var n=i.value;return i.value=r((function(){var e,i,r,o,s=arguments;return h(this,(function(a){switch(a.label){case 0:for(e=s.length,i=new Array(e),r=0;r<e;r++)i[r]=s[r];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.apply(this,i)];case 2:return[2,a.sent()];case 3:return o=a.sent(),t.handleThrowError.call(this,o),[3,4];case 4:return[2]}}))})),i}],Yc.prototype,"loadScene",null),yr.create=function(t,e){return new oc(t,e)},yr.createWithData=function(t,e,i){void 0===e&&(e=X("#fff")),void 0===i&&(i={});var r=i.type,n=void 0===r?Ui.UNSIGNED_BYTE:r,o=i.format,s=void 0===o?Ui.RGBA:o,a=i.internalFormat,u=i.wrapS,h=void 0===u?Ui.MIRRORED_REPEAT:u,l=i.wrapT,c=void 0===l?Ui.MIRRORED_REPEAT:l,f=i.minFilter,d=void 0===f?Ui.NEAREST:f,p=i.magFilter,m=void 0===p?Ui.NEAREST:p,v=i.flipY,y=void 0!==v&&v;return new oc(t,{data:e,type:n,sourceType:exports.TextureSourceType.data,format:s,internalFormat:a||s,wrapS:h,wrapT:c,minFilter:d,magFilter:m,flipY:y})},Nr.create=function(t,e){return new Ec(t,e)},Zr.create=function(t,e){return new yc(t,e)},sn.create=function(t,e){return new sn(t,e)},kn.create=function(t){return new Nc(t)},Hn.create=function(t,e){return new Lc(t,e)},Wn.create=function(t,e,i){return new Vc(t,e,i)},$l.create=function(t){return new Oc(t)};var qc="2.7.3";it.info("Player version: 2.7.3."),exports.AbstractPlugin=Vt,exports.ActivationMixerPlayable=ru,exports.ActivationPlayable=nu,exports.AndNode=oi,exports.Animatable=Ye,exports.AnimationClipNode=We,exports.ApplyAdditiveNode=ri,exports.Asset=_h,exports.AssetLoader=Ah,exports.AssetManager=Pl,exports.AssetService=Nl,exports.BYTES_TYPE_MAP=Yr,exports.Behaviour=Ri,exports.BezierCurve=$o,exports.BezierCurvePath=Vo,exports.BezierCurveQuat=Do,exports.BlendNode=ni,exports.BoolValueNode=Be,exports.COPY_FRAGMENT_SHADER=zr,exports.COPY_MESH_SHADER_ID=Dr,exports.COPY_VERTEX_SHADER=kr,exports.CalculateLoader=Wu,exports.Camera=Is,exports.CameraVFXItemLoader=us,exports.ColorCurve=ss,exports.ColorPlayable=Vu,exports.ColorPropertyMixerPlayable=au,exports.Component=Mi,exports.ComponentTimePlayable=ju,exports.ComponentTimePlayableAsset=Gu,exports.ComponentTimeTrack=zu,exports.Composition=Fu,exports.ConstBoolNode=hi,exports.ConstFloatNode=ui,exports.ControlParameterBoolNode=ci,exports.ControlParameterFloatNode=li,exports.ControlParameterTriggerNode=fi,exports.DEFAULT_FONTS=bh,exports.DEFAULT_FPS=60,exports.Database=wh,exports.Deferred=function(){var t=this;this.promise=new Promise((function(e,i){t.resolve=e,t.reject=i}))},exports.Downloader=Ki,exports.EFFECTS_COPY_MESH_NAME=Vr,exports.EVENT_TYPE_CLICK=hs,exports.EVENT_TYPE_TOUCH_END=fs,exports.EVENT_TYPE_TOUCH_MOVE=cs,exports.EVENT_TYPE_TOUCH_START=ls,exports.EffectComponentTimeTrack=Bu,exports.EffectsObject=Re,exports.EffectsPackage=Jl,exports.Ellipse=ch,exports.Engine=$l,exports.EventEmitter=Ru,exports.EventSystem=ds,exports.Float16ArrayWrapper=qn,exports.FloatComparisonNode=yi,exports.FloatComparisonNodeData=vi,exports.FloatPropertyMixerPlayable=uu,exports.FloatValueNode=Ue,exports.Framebuffer=Hn,exports.GLEngine=Oc,exports.GLGeometry=yc,exports.GLRenderer=Vc,exports.GPUCapability=Un,exports.Geometry=Zr,exports.GlobalUniforms=Dn,exports.GradientValue=No,exports.GraphInstance=Ci,exports.GraphNode=Ve,exports.GraphNodeData=De,exports.GraphicsPath=mh,exports.HELP_LINK=Jo,exports.InteractLoader=ms,exports.InteractMesh=ys,exports.InvalidIndex=Le,exports.KTXTexture=Er,exports.LayerBlendNode=di,exports.LineSegments=Fo,exports.LinearValue=Oo,exports.MaskProcessor=Fr,exports.MaskableGraphic=Yn,exports.Material=Nr,exports.MaterialDataBlock=Mr,exports.Mesh=sn,exports.MeshCollider=bs,exports.NodeTransform=ti,exports.NotNode=ai,exports.OrNode=si,exports.PLAYER_OPTIONS_ENV_EDITOR=Qo,exports.POST_PROCESS_SETTINGS="post_process_settings",exports.ParticleBehaviourPlayable=ka,exports.ParticleBehaviourPlayableAsset=za,exports.ParticleLoader=Hu,exports.ParticleMesh=Ba,exports.ParticleMixerPlayable=hu,exports.ParticleSystemRenderer=Xa,exports.ParticleTrack=Cu,exports.PassTextureCache=Hr,exports.PathSegments=Lo,exports.Playable=Es,exports.PlayableAsset=_s,exports.PlayableOutput=Ss,exports.Player=Yc,exports.PluginSystem=xt,exports.PolyStar=fh,exports.Polygon=oh,exports.Pose=ei,exports.PoseNode=ke,exports.PropertyClipPlayable=ou,exports.PropertyTrack=_u,exports.RENDER_PASS_NAME_PREFIX=Rn,exports.RENDER_PREFER_LOOKUP_TEXTURE=wa,exports.RUNTIME_ENV="runtime_env",exports.RandomSetValue=Ro,exports.RandomValue=Io,exports.RandomVectorValue=Po,exports.RenderFrame=Pn,exports.RenderPass=cn,exports.RenderPassPriorityNormal=an,exports.RenderPassPriorityPostprocess=3e3,exports.RenderPassPriorityPrepare=0,exports.RenderTargetHandle=hn,exports.Renderbuffer=kn,exports.Renderer=Wn,exports.RendererComponent=Ii,exports.RuntimeClip=Su,exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",exports.SPRITE_VERTEX_STRIDE=Ko,exports.SemanticMap=Wr,exports.SerializationHelper=Ch,exports.ShaderFactory=_n,exports.ShaderVariant=Lr,exports.ShapePath=ph,exports.SpriteColorMixerPlayable=lu,exports.SpriteComponentTimeTrack=Uu,exports.SpriteLoader=Ts,exports.StateMachineNode=xi,exports.StateNode=Ti,exports.StaticValue=Mo,exports.SubCompositionClipPlayable=cu,exports.SubCompositionMixerPlayable=fu,exports.TEMPLATE_USE_OFFSCREEN_CANVAS=Ma,exports.TextComponentBase=Eh,exports.TextLayout=gh,exports.TextLoader=Sh,exports.TextStyle=xh,exports.Texture=yr,exports.TextureFactory=Cr,exports.Ticker=tc,exports.TimelineClip=Eu,exports.TimelineInstance=wu,exports.TrackMixerPlayable=iu,exports.Transform=Ms,exports.TransformMixerPlayable=du,exports.TransformPlayable=bu,exports.TransitionNode=Si,exports.ValueGetter=wo,exports.ValueNode=ze,exports.Vector2Curve=qo,exports.Vector2PropertyMixerPlayable=vu,exports.Vector3Curve=Zo,exports.Vector3PropertyMixerPlayable=mu,exports.Vector4Curve=Yo,exports.Vector4PropertyMixerPlayable=pu,exports.addByOrder=Y,exports.addItem=v,exports.addItemWithOrder=function(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var o=t[n];if(r)for(;t[n-1][i]<o[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>o[i]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},exports.applyMixins=pt,exports.assertExist=K,exports.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},exports.base64ToFile=dt,exports.buildLine=$u,exports.calculateTranslation=$n,exports.canUseBOM=D,exports.canvasPool=yh,exports.closePointEps=qu,exports.colorGradingFrag=gn,exports.colorStopsFromGradient=O,exports.colorToArr=I,exports.combineImageTemplate=Ml,exports.createCopyShader=Ur,exports.createGLContext=Ni,exports.createKeyFrameMeta=Go,exports.createShape=Ws,exports.createValueGetter=ns,exports.curveEps=Ku,exports.decimalEqual=ao,exports.defaultPlugins=vt,exports.deserializeMipmapTexture=fr,exports.disableAllPlayer=function(t){Hc=!!t},exports.earcut=ma,exports.effectsClass=Ae,exports.effectsClassStore=_e,exports.enlargeBuffer=g,exports.ensureFixedNumber=Rh,exports.ensureVec3=to,exports.findPreviousRenderPass=function(t,e){var i=t.indexOf(e);return t[i-1]},exports.gaussianDownHFrag=xn,exports.gaussianDownVFrag=bn,exports.gaussianUpFrag=Tn,exports.generateEmptyTypedArray=qr,exports.generateGUID=ft,exports.generateHalfFloatTexture=gr,exports.generateTransparentTexture=Tr,exports.generateWhiteTexture=br,exports.getActivePlayers=function(){return Array.from(Xc.values())},exports.getBackgroundImage=wl,exports.getClass=Ce,exports.getColorFromGradientStops=P,exports.getConfig=Ia,exports.getDefaultTextureFactory=Ar,exports.getGeometryByShape=Ta,exports.getGeometryTriangles=ba,exports.getKTXTextureOptions=Sr,exports.getKeyFrameMetaByRawValue=Bo,exports.getMergedStore=Me,exports.getNodeDataClass=Ne,exports.getParticleMeshShader=function(t,e,i){var r;void 0===i&&(i="");var n,o=t.content,s=+((null==(r=o.renderer)?void 0:r.renderMode)||0),a=[["RENDER_MODE",s],["ENV_EDITOR",i===Qo]],u=e.level,h=e.detail,l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=h.maxVertexUniforms>0,d=(null!=(n=o.positionOverLifetime)?n:{}).speedOverLifetime,p=0,m=0;f&&a.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(a.push(["SPEED_OVER_LIFETIME",!0]),m|=2,Bo(l,d));var v=o.textureSheetAnimation;v&&v.animate&&(a.push(["USE_SPRITE",!0]),m|=4);var y=o.colorOverLifetime;y&&y.color&&(a.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&Bo(l,g);var x,b=o.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[r])&&(Bo(l,b[r]),i=1,m|=1<<7+e),a.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var o=0;(null==b?void 0:b[n])&&(Bo(l,b[n]),o=1,m|=1<<10+e,x=!0),a.push(["ORB_VEL_"+t.toUpperCase(),o])})),(null==b?void 0:b.asMovement)&&(a.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),x&&(null==b?void 0:b.asRotation)&&(a.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64),o.sizeOverLifetime){var T=o.sizeOverLifetime;T.separateAxes?(Bo(l,T.x),a.push(["SIZE_Y_BY_LIFE",1]),m|=16384,Bo(l,T.y)):Bo(l,T.size)}if(o.rotationOverLifetime){var E=o.rotationOverLifetime;E.z&&(Bo(l,null==E?void 0:E.z),m|=32768,a.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(Bo(l,E.x),m|=65536,a.push(["ROT_X_LIFETIME",1])),E.y&&(Bo(l,E.y),m|=1<<17,a.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(a.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=1<<18)}Bo(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(a.push(["FINAL_TARGET",!0]),m|=1<<19,Bo(l,b.forceCurve));var S=h.halfFloatTexture;S&&c.max&&(m|=1<<20);var _=h.maxVertexUniforms,C=l.max+l.curves.length-32>_;Ia(wa)&&(C=!0),2===u&&(l.max=-1,c.index>0&&(c.max=-1)),C&&S&&f&&(p=1);var A=["-p:",s,m,l.index,l.max,c.index,c.max].join("+"),w={fragment:pn,vertex:"#define LOOKUP_TEXTURE_CURVE "+p+"\n"+mn,shared:!0,cacheId:A,macros:a,name:"particle#"+t.name};return a.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",c.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",c.max]),{shader:w,vertex:l.index,fragment:c.index}},exports.getPixelRatio=L,exports.getPlayerByCanvas=function(t){return Xc.get(t)},exports.getPreMultiAlpha=Wi,exports.getStandardComposition=xl,exports.getStandardImage=gl,exports.getStandardItem=Sl,exports.getStandardJSON=vl,exports.getTextureSize=On,exports.glContext=Ui,exports.glType2VertexFormatType=function(t){switch(t){case e.WebGLRenderingContext.FLOAT:return ve.Float32;case e.WebGLRenderingContext.SHORT:return ve.Int16;case e.WebGLRenderingContext.BYTE:return ve.Int8;case e.WebGLRenderingContext.UNSIGNED_SHORT:return ve.UInt16;case e.WebGLRenderingContext.UNSIGNED_BYTE:return ve.UInt8;default:return ve.Float32}},exports.gpuTimer=Fi,exports.imageDataFromColor=X,exports.imageDataFromGradient=H,exports.initErrors=zi,exports.initGLContext=Gi,exports.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.;}",exports.interpolateColor=N,exports.isAlipayMiniApp=G,exports.isAndroid=z,exports.isArray=ot,exports.isCanvas=ht,exports.isCanvasUsedByPlayer=function(t){return Xc.has(t)},exports.isFunction=st,exports.isIOS=k,exports.isIOSByUA=function(){var t=e.navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},exports.isMiniProgram=function(){return G()||j()},exports.isObject=at,exports.isOpenHarmony=U,exports.isPlainObject=ut,exports.isSimulatorCellPhone=B,exports.isString=nt,exports.isUniformStruct=Rr,exports.isUniformStructArray=function(t){return t&&void 0!==t.length&&Rr(t[0])},exports.isValidFontFamily=Q,exports.isWebGL2=ji,exports.isWechatMiniApp=j,exports.itemFrag=dn,exports.itemVert=fn,exports.loadAVIFOptional=er,exports.loadBinary=or,exports.loadBlob=function(t){return ar.apply(this,arguments)},exports.loadImage=rr,exports.loadMedia=lr,exports.loadVideo=ur,exports.loadWebPOptional=$i,exports.logger=it,exports.math=nn,exports.modifyMaxKeyframeShader=function(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var o=0;o<t.macros.length;o++){var s=t.macros[o];if("VERT_CURVE_VALUE_COUNT"===s[0])s[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===s[0]){s[1]=i;break}}},exports.nearestPowerOfTwo=no,exports.nodeDataClass=Oe,exports.noop=rt,exports.normalizeColor=Vh,exports.numberToFix=uo,exports.oldBezierKeyFramesToNew=es,exports.parsePercent=F,exports.particleFrag=pn,exports.particleOriginTranslateMap=ro,exports.particleUniformTypeMap=Ua,exports.particleVert=mn,exports.passRenderLevel=Al,exports.pluginLoaderMap=mt,exports.randomInRange=lt,exports.registerPlugin=gt,exports.removeItem=y,exports.rotateVec2=Ea,exports.screenMeshVert=yn,exports.serialize=we,exports.setBlendMode=Yi,exports.setConfig=function(t,e){return Ra[t]=e},exports.setDefaultTextureFactory=function(t){_r=t},exports.setMaskMode=qi,exports.setMaxSpriteMeshItemCount=function(t){exports.maxSpriteMeshItemCount=t},exports.setRayFromCamera=oo,exports.setSideMode=Zi,exports.setSpriteMeshMaxItemCountByGPU=Xu,exports.sortByOrder=W,exports.spec=Te,exports.thresholdFrag=En,exports.throwDestroyedError=ct,exports.trailVert=vn,exports.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},exports.trianglesFromRect=so,exports.unregisterPlugin=function(t){delete yt[t],delete mt[t],y(vt,t)},exports.valIfUndefined=function(t,e){return null==t?e:t},exports.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",exports.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",exports.vecFill=eo,exports.vecMulCombine=io,exports.version=qc,exports.vertexFormatType2GLType=Hi;
|
|
2
2
|
//# sourceMappingURL=alipay.js.map
|