@galacean/effects 2.9.1 → 2.9.2
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/weapp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{crypto as t,window as e,navigator as i,atob as r,Blob as n,WebGL2RenderingContext as a,WebGLRenderingContext as s,XMLHttpRequest as o,HTMLImageElement as u,URL as h,Image as l,document as c,performance as f,location as d,HTMLCanvasElement as p,HTMLVideoElement as m,TextDecoder as v,cancelAnimationFrame as y,requestAnimationFrame as g,Event as x}from"@galacean/appx-adapter/weapp";function b(t,e,i,r,n,a,s){try{var o=t[a](s),u=o.value}catch(t){return void i(t)}o.done?e(u):Promise.resolve(u).then(r,n)}function T(t){return function(){var e=this,i=arguments;return new Promise((function(r,n){var a=t.apply(e,i);function s(t){b(a,r,n,s,o,"next",t)}function o(t){b(a,r,n,s,o,"throw",t)}s(void 0)}))}}function E(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):E(t,e)}function _(t,e,i,r){var n,a=arguments.length,s=a<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 o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s}function w(t,e){var i,r,n,a={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=o(0),s.throw=o(1),s.return=o(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(o){return function(u){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}var S;"function"==typeof SuppressedError&&SuppressedError;var C=new Uint8Array(16);function A(){if(!S&&!(S=void 0!==t&&t.getRandomValues&&t.getRandomValues.bind(t)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return S(C)}for(var M=[],I=0;I<256;++I)M.push((I+256).toString(16).slice(1));var R={randomUUID:void 0!==t&&t.randomUUID&&t.randomUUID.bind(t)};function O(t,e,i){if(R.randomUUID&&!e&&!t)return R.randomUUID();var r=(t=t||{}).random||(t.rng||A)();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),M[t[e+0]]+M[t[e+1]]+M[t[e+2]]+M[t[e+3]]+"-"+M[t[e+4]]+M[t[e+5]]+"-"+M[t[e+6]]+M[t[e+7]]+"-"+M[t[e+8]]+M[t[e+9]]+"-"+M[t[e+10]]+M[t[e+11]]+M[t[e+12]]+M[t[e+13]]+M[t[e+14]]+M[t[e+15]]}(r)}function P(t,e){return t.includes(e)||t.push(e),t}function N(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function L(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}}function F(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),s=new t.constructor(a);return s.set(t),s}return t}var V=2*Math.PI,k=Math.PI/180,D=180/Math.PI,z=1e-6;function B(t,e){return Math.abs(t-e)<z||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var U=function(t,e,i){return(1-i)*t+i*e};function G(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,a=Math.min(r,n),s=Math.max(r,n);return Math.min(Math.max(t,a),s)}var j=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):E(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):E(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):E(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):E(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,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=z,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}();j.ONE=new j(1,1),j.ZERO=new j(0,0);var X=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):E(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):E(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):E(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):E(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,s=e.y,o=e.z;return this.x=r*o-n*s,this.y=n*a-i*o,this.z=i*s-r*a,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=z,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 j(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}();X.X=new X(1,0,0),X.Y=new X(0,1,0),X.Z=new X(0,0,1),X.ONE=new X(1,1,1),X.ZERO=new X(0,0,0);var W=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(a=t[e+3])?a:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):E(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):E(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):E(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):E(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,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=z,e=this,i=e.x,r=e.y,n=e.z,a=e.w;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t&&Math.abs(a)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new X(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}();W.ONE=new W(1,1,1,1),W.ZERO=new W(0,0,0,0);var H=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,s=n*(1-Math.abs(a%2-1)),o=0,u=0,h=0;a>=0&&a<=1?(o=n,u=s):a>=1&&a<=2?(o=s,u=n):a>=2&&a<=3?(u=n,h=s):a>=3&&a<=4?(u=s,h=n):a>=4&&a<=5?(o=s,h=n):a>=5&&a<=6&&(o=n,h=s);var l=i-n;return this.set(o+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):E(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):E(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):E(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):E(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new W(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,i=e.r,r=e.g,n=e.b,a=e.a,s=Math.max(i,r,n),o=Math.min(i,r,n),u=s-o,h=0,l=0;return 0!==s&&(l=u/s),s!=o&&(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,a)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),(new t).setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();function Y(t,e){var i=[0,0,0,0];if(Ct(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 E(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function Z(t,e,i){if(0===t.length)return[0,0,0,0];var r;if(e<=t[0].time)r=t[0].color.toArray();else if(e>=t[t.length-1].time)r=t[t.length-1].color.toArray();else{r=t[t.length-1].color.toArray();for(var n=1;n<=t.length-1;n++){var a=t[n-1],s=t[n];if(a.time<=e&&e<=s.time){r=K(a.color.toArray(),s.color.toArray(),(e-a.time)/(s.time-a.time));break}}}return i?r.map((function(t){return t/255})):r}function q(t){var e=[];return E(t,Array)?t.forEach((function(t){var i=t[0],r=t[1],n=t[2],a=t[3],s=t[4];e.push({time:Q(i),color:new H(r,n,a,s)})})):Object.keys(t).forEach((function(i){var r=t[i],n=(new H).setFromArray(Y(r));e.push({time:Q(i),color:n})})),e=e.sort((function(t,e){return t.time-e.time}))}function K(t,e,i,r){var n=[],a=1-i;if(r)for(var s=0;s<4;s++)n[s]=t[s]*a+e[s]*i;else{for(var o=0;o<3;o++)n[o]=Math.round(Math.sqrt(t[o]*t[o]*a+e[o]*e[o]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function Q(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function J(){return"object"==typeof e?Math.min(2,e.devicePixelRatio||1):1}H.BLACK=new H(0,0,0,1),H.BLUE=new H(0,0,1,1),H.CLEAR=new H(0,0,0,0),H.CYAN=new H(0,1,1,1),H.GRAY=new H(.5,.5,.5,1),H.GREEN=new H(0,1,0,1),H.MAGENTA=new H(1,0,1,1),H.RED=new H(1,0,0,1),H.WHITE=new H(1,1,1,1),H.YELLOW=new H(1,.92,.016,1);var $,tt=void 0!==e;function et(){return!!i.platform&&/iPad|iPhone|iPod/.test(i.platform)}function it(){var t=i.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0}function rt(){return/\b[Aa]ndroid\b/.test(i.userAgent)}function nt(){return/\bOpenHarmony\b/.test(i.userAgent)}function at(){return rt()||nt()||/\b(iPad|iPhone|iPod)\b/.test(i.userAgent)}function st(){return ot()||ut()}function ot(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function ut(){return"miniprogram"===e.__wxjs_environment}function ht(t){Ct(t)&&(t=Y(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 lt(t){var e=128,i={width:e,height:1,data:new Uint8Array(512)},r=i.data,n=q(t);if(n.length)for(var a=0;a<e;a++){var s=a/127;if(s<=n[0].time)r.set(n[0].color.toArray(),4*a);else if(s>=n[n.length-1].time)r.set(n[n.length-1].color.toArray(),4*a);else for(var o=0;o<n.length-1;o++){var u=n[o],h=n[o+1];if(u.time<=s&&h.time>s){var l=K(u.color.toArray(),h.color.toArray(),(s-u.time)/(h.time-u.time));r.set(l,4*a);break}}}return i}function ct(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++)dt(t,r,e);return t}return pt(t,e)}function ft(t,e,i){return void 0===i&&(i=2),t.includes(e)?t:(t.push(e),1===t.length||1!==i&&dt(t,t.length-1,i),t)}function dt(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 pt(t,e,i,r){if(void 0===i&&(i=0),void 0===r&&(r=t.length-1),i>=r)return t;for(var n,a=t[i],s=i,o=r;s<o;){if(2===e){for(;t[o].priority>a.priority&&o>=s;)o--;for(;t[s].priority<=a.priority&&s<o;)s++}else{for(;t[o].priority<a.priority&&o>=s;)o--;for(;t[s].priority>=a.priority&&s<o;)s++}var u;u=[t[o],t[s]],t[s]=u[0],t[o]=u[1]}return n=[t[s],t[i]],t[i]=n[0],t[s]=n[1],pt(t,e,i,s-1),pt(t,e,o+1,r),t}function mt(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function vt(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)}function yt(t){return gt(t)||!at()}function gt(t){return/^[^\d.][\w-]*$/.test(t)}!function(t){t[t.none=1]="none",t[t.ascending=2]="ascending",t[t.descending=3]="descending"}($||($={}));var xt,bt=function(){var t=this;this.promise=new Promise((function(e,i){t.resolve=e,t.reject=i}))},Tt="[Galacean Effects]";function Et(t){return["%c"+Tt,"color: #AA0100",""+t]}var _t,wt={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(Et(t),[i])),null==xt||xt("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(Et(t))),null==xt||xt("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(Et(t))),null==xt||xt("warn",t,i)},register:function(t){t&&Mt(t)&&(xt=t)}};function St(){}function Ct(t){return"string"==typeof t}!function(t){t[t.destroy=0]="destroy",t[t.keep=1]="keep",t[t.force=0]="force"}(_t||(_t={}));var At=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function Mt(t){return"[object Function]"===Object.prototype.toString.call(t)}function It(t){return"[object Object]"===Object.prototype.toString.call(t)}function Rt(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 Ot(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function Pt(t){return 0==(t&t-1)&&0!==t}function Nt(t,e){return t+Math.random()*(e-t)}function Lt(){throw new Error("Destroyed item cannot be used again.")}function Ft(){return O().replace(/-/g,"")}function Vt(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var a=t.split(",")[1]||t,s=r(a),o=[],u=0;u<s.length;u+=512){for(var h=s.slice(u,u+512),l=new Array(h.length),c=0;c<h.length;c++)l[c]=h.charCodeAt(c);var f=new Uint8Array(l);o.push(f)}var d=new n(o,{type:i});return new File([d],e,{type:i})}function kt(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 Dt={},zt=[];function Bt(t,e){Dt[t]&&wt.error("Duplicate registration for plugin "+t+"."),Dt[t]=e;var i=new e;i.name=t,zt.push(i),zt.sort((function(t,e){return t.order-e.order}))}function Ut(t){delete Dt[t];var e=zt.findIndex((function(e){return e.name===t}));-1!==e&&zt.splice(e,1)}var Gt=function(){function t(){}return t.getPlugins=function(){return zt},t.initializeComposition=function(t,e){zt.forEach((function(i){return i.onCompositionCreated(t,e)}))},t.destroyComposition=function(t){zt.forEach((function(e){return e.onCompositionDestroy(t)}))},t.onAssetsLoadStart=function(t,e){return T((function(){return w(this,(function(i){return[2,Promise.all(zt.map((function(i){return i.onAssetsLoadStart(t,e)})))]}))}))()},t.onAssetsLoadFinish=function(t,e,i){zt.forEach((function(r){return r.onAssetsLoadFinish(t,e,i)}))},t}(),jt={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",ffd:"@galacean/effects-plugin-ffd",ktx2:"@galacean/effects-plugin-ktx2",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 Xt(t){var e=jt[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 Wt,Ht,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee,ie,re,ne,ae=function(){function t(){this.order=100,this.name="Plugin"}var e=t.prototype;return e.onAssetsLoadStart=function(t,e){return T((function(){return w(this,(function(t){return[2]}))}))()},e.onAssetsLoadFinish=function(t,e,i){},e.onCompositionCreated=function(t,e){},e.onCompositionDestroy=function(t){},t}();function se(t,e){return se=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},se(t,e)}function oe(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&&se(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["3_6"]="3.6",t["3_7"]="3.7",t.LATEST="3.7"}(Wt||(Wt={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(Ht||(Ht={})),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"}(Yt||(Yt={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(Zt||(Zt={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(qt||(qt={})),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"}(Kt||(Kt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(Qt||(Qt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Jt||(Jt={})),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"}($t||($t={})),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"}(te||(te={})),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"}(ee||(ee={})),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"}(ie||(ie={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(re||(re={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(ne||(ne={}));var ue,he,le,ce,fe,de,pe,me,ve,ye,ge,xe,be,Te,Ee,_e,we,Se,Ce,Ae=1,Me=3,Ie=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(ue||(ue={})),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"}(he||(he={})),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"}(le||(le={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(ce||(ce={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(fe||(fe={})),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"}(de||(de={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(pe||(pe={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(me||(me={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(ve||(ve={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(ye||(ye={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(ge||(ge={})),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"}(xe||(xe={})),function(t){t[t.visible=0]="visible",t[t.display=1]="display",t[t.clip=2]="clip",t[t.ellipsis=3]="ellipsis"}(be||(be={})),function(t){t[t.autoWidth=0]="autoWidth",t[t.autoHeight=1]="autoHeight",t[t.fixed=2]="fixed"}(Te||(Te={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Ee||(Ee={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(_e||(_e={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(we||(we={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Se||(Se={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Ce||(Ce={}));var Re,Oe,Pe,Ne,Le,Fe,Ve,ke,De,ze,Be,Ue,Ge,je,Xe={WhiteTexture:"whitetexture00000000000000000000",EmptyTexture:"emptyTexture00000000000000000000",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"}(Re||(Re={})),function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(Oe||(Oe={})),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"}(Pe||(Pe={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(Ne||(Ne={})),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"}(Fe||(Fe={})),function(t){t.video="video",t.image="image"}(Ve||(Ve={})),function(t){t.video="video",t.audio="audio"}(ke||(ke={})),function(t){t.L30="hev1.1.0.L30.B0",t.L60="hev1.1.0.L60.B0",t.L63="hev1.1.0.L63.B0",t.L90="hev1.1.0.L90.B0",t.L93="hev1.1.0.L93.B0",t.L120="hev1.1.0.L120.B0",t.L150="hev1.1.0.L150.B0",t.L180="hev1.1.0.L180.B0"}(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.FrameComponent="FrameComponent",t.Animator="Animator",t.TimelineClip="TimelineClip"}(ze||(ze={})),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"}(Be||(Be={})),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"}(Ue||(Ue={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(Ge||(Ge={})),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"}(je||(je={}));var We=Wt.LATEST,He=Object.freeze({__proto__:null,LATEST_VERSION:We,get RenderLevel(){return Ht},get BlendingMode(){return Yt},get SideMode(){return Zt},get ObscuredMode(){return qt},get ParticleEmitterShapeType(){return Kt},get PluginType(){return Qt},get InteractType(){return Jt},get InteractBehavior(){return $t},get ItemType(){return te},get RenderMode(){return ee},get ParticleOrigin(){return ie},get RenderType(){return re},get RenderFace(){return ne},get CameraClipMode(){return ue},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:Ae,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:Me,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:Ie,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return he},get BezierKeyframeType(){return le},get JSONSceneVersion(){return Wt},get EndBehavior(){return ce},get ParticleInteractionBehavior(){return fe},get ShapeArcMode(){return de},get LightType(){return pe},get ModelBoundingType(){return me},get CameraType(){return ve},get MaterialType(){return ye},get MaterialBlending(){return ge},get RenderMode3D(){return xe},get TextOverflow(){return be},get TextSizeMode(){return Te},get TextBaseline(){return Ee},get TextAlignment(){return _e},get TextVerticalAlign(){return we},get TextWeight(){return Se},get FontStyle(){return Ce},BuiltinObjectGUID:Xe,get FillType(){return Re},get TexturePaintScaleMode(){return Oe},get ShapePrimitiveType(){return Pe},get LineCap(){return Ne},get LineJoin(){return Le},get NodeDataType(){return Fe},get BackgroundType(){return Ve},get MultimediaType(){return ke},get HevcVideoCodec(){return De},get DataType(){return ze},get GeometryType(){return Be},get VertexFormatType(){return Ue},get IndexFormatType(){return Ge},get VertexBufferSemantic(){return je}});function Ye(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 Ze(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 Ye(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)?Ye(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.")}var qe=new Map,Ke=new Map,Qe={};function Je(t){return Qe[t]}function $e(t){return function(e,i){Qe[t]&&console.warn("Class "+t+" is already registered."),Qe[t]=e}}function ti(t,e){return function(t,e){return function(i,r){var n=function(t){var e=t.constructor;qe.get(e)||qe.set(e,{});return qe.get(e)}(i);n&&(n[r]||(n[r]={type:t,sourceName:e}))}}(t,e)}function ei(t){var e=t.constructor;if(Ke.get(e))return Ke.get(e);var i={};Ke.set(e,i);for(var r=t,n=e;n;){var a=qe.get(n);for(var s in a)i[s]=a[s];var o=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(o).constructor)===Object)break;r=o}return i}var ii=function(){function t(t){this.engine=t,this.guid=Ft(),this.definition={},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 E(e,t)&&"guid"in e},t}(),ri=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),ni={};function ai(t){return function(e,i){ni[t]&&console.warn("NodeData Class "+t+" is already registered."),ni[t]=e}}function si(t){return ni[t]}var oi,ui=-1,hi=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}(),li=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}(),ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.previousTime=0,e.currentTime=0,e}oe(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}(hi),fi=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.setValue=function(t){},e}(hi),di=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(fi),pi=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(fi),mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).nodeDatas=[],e.graphDataSet=new ri,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=ui,e}return oe(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,a=0;a<n;a++)this.parameterLookupMap.set(i.controlParameterIDs[a],a);this.nodeDatas=[];for(var s=0;s<r.length;s++)this.nodeDatas[s]=e.createNodeData(r[s].type),this.nodeDatas[s].load(r[s]);this.graphDataSet=new ri,this.graphDataSet.resources=[];for(var o,u=Ze(i.graphDataSet.resources);!(o=u()).done;){var h=o.value,l=this.engine.findObject(h);this.graphDataSet.resources.push(l)}},e.createNodeData=function(t){var e=si(t);if(e)return new e;throw new Error("Unknown node type: "+t+".")},e}(ii);mi=_([$e("AnimationGraphAsset")],mi),function(t){t[t.Active=0]="Active",t[t.Inactive=1]="Inactive"}(oi||(oi={}));var vi=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}(),yi=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 gi(){return gi=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},gi.apply(this,arguments)}var xi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Ti,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=gi({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(li);xi=_([ai(Fe.AnimationClipNodeData)],xi);var bi,Ti=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).animation=null,e.animatable=null,e}oe(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=G(this.currentTime,0,1),this.sampleEvents(t);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.sampleEvents=function(t){if(this.animatable&&0!==this.animatable.events.length)for(var e,i=this.previousTime*this.duration,r=this.currentTime*this.duration,n=Ze(this.animatable.events);!(e=n()).done;){var a=e.value,s=a.data.startTime;(this.previousTime<=this.currentTime?i<s&&s<=r:s>i||s<=r)&&(a.currentTime=r,a.deltaTime=t.deltaTime,t.activeEvents.push(a))}},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 Ei(e.skeleton,this.animation))},e}(ci);!function(t){t[t.Position=0]="Position",t[t.Scale=1]="Scale",t[t.Rotation=2]="Rotation",t[t.Euler=3]="Euler"}(bi||(bi={}));var Ei=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.events=[],this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=Ze(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var a,s=Ze(e.scaleCurves);!(a=s()).done;){var o=a.value;this.addTransformCurveInfo(o,1)}for(var u,h=Ze(e.rotationCurves);!(u=h()).done;){var l=u.value;this.addTransformCurveInfo(l,2)}for(var c,f=Ze(e.eulerCurves);!(c=f()).done;){var d=c.value;this.addTransformCurveInfo(d,3)}for(var p,m=Ze(e.floatCurves);!(p=m()).done;){var v=p.value;this.addFloatCurveInfo(v)}for(var y,g=Ze(e.colorCurves);!(y=g()).done;){var x=y.value;this.addColorCurveInfo(x)}for(var b,T=Ze(this.animationClip.events);!(b=T()).done;){var E=b.value;this.events.push({data:E,currentTime:0,deltaTime:0})}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=G(t,0,this.animationClip.duration),n=Ze(this.transformCurveInfos);!(i=n()).done;){var a=i.value,s=a.curve.keyFrames.getValue(r),o=e.parentSpaceTransforms[a.boneIndex];switch(a.type){case 0:o.position.copyFrom(s);break;case 1:o.scale.copyFrom(s);break;case 2:o.rotation.copyFrom(s);break;case 3:o.euler.copyFrom(s)}}for(var u,h=Ze(this.floatCurveInfos);!(u=h()).done;){var l=u.value,c=l.curve.keyFrames.getValue(r);e.floatPropertyValues[l.animatedObjectIndex]=c}for(var f,d=Ze(this.colorCurveInfos);!(f=d()).done;){var p=f.value,m=p.curve.keyFrames.getValue(r);e.colorPropertyValues[p.animatedObjectIndex]=m}},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}(),_i=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],a=e[1],s=e[5],o=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-o)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>s&&i>l){var d=2*Math.sqrt(1+i-s-l);this.w=(h-o)/d,this.x=.25*d,this.y=(r+a)/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+a)/p,this.y=.25*p,this.z=(o+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-s);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(o+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(G(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,a=t.w,s=e.x,o=e.y,u=e.z,h=e.w;return this.x=i*h+a*s+r*u-n*o,this.y=r*h+a*o+n*s-i*u,this.z=n*h+a*u+i*o-r*s,this.w=a*h-i*s-r*o-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this,r=i.x,n=i.y,a=i.z,s=i.w,o=s*t.w+r*t.x+n*t.y+a*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=s,this.x=r,this.y=n,this.z=a,this;var u=1-o*o;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*a+e*this.z,this.normalize(),this}var l=Math.sqrt(u),c=Math.atan2(l,o),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=a*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,a=i.z,s=i.w,o=t.x,u=t.y,h=t.z,l=s*o+n*h-a*u,c=s*u+a*o-r*h,f=s*h+r*u-n*o,d=-r*o-n*u-a*h,p=null!=e?e:t;return p.x=l*s+d*-r+c*-a-f*-n,p.y=c*s+d*-n+f*-r-l*-a,p.z=f*s+d*-a+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(X.ZERO,this,X.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}();_i.tempVec0=new X;var wi=new _i,Si=function(){},Ci=function(t){function e(){return t.apply(this,arguments)}oe(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}(Si),Ai=function(t){function e(){return t.apply(this,arguments)}oe(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=wi.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}(Si),Mi=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 a=0;a<t.parentSpaceTransforms.length;a++){var s=t.parentSpaceTransforms[a],o=e.parentSpaceTransforms[a],u=r.parentSpaceTransforms[a],h=s.position,l=o.position,c=u.position;n.blendVector3(h,l,i,c);var f=s.rotation,d=o.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=s.scale,v=o.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=s.euler,x=o.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var E=t.floatPropertyValues[T],_=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,_,i)}for(var w=0;w<t.colorPropertyValues.length;w++){var S=t.colorPropertyValues[w],C=e.colorPropertyValues[w],A=r.colorPropertyValues[w];n.blendColor(S,C,i,A)}},t}();Mi.normalBlendFunction=new Ci,Mi.additiveBlendFunction=new Ai;var Ii=function(){function t(t){this.position=new X,this.rotation=new _i,this.scale=new X,this.euler=new X,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}(),Ri=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=Ze(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push((new Ii).copyFrom(r))}for(var n,a=Ze(t.defaultFloatPropertyValues);!(n=a()).done;){var s=n.value;this.floatPropertyValues.push(s)}for(var o,u=Ze(t.defaultColorPropertyValues);!(o=u()).done;){var h=o.value;this.colorPropertyValues.push((new H).copyFrom(h))}}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}(),Oi=function(t){this.pose=new Ri(t)},Pi=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Ni,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}(li);Pi=_([ai(Fe.ApplyAdditiveNodeData)],Pi);var Ni=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}oe(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new Oi(e.skeleton),this.additiveNodeResult=new Oi(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){Mi.additiveBlend(t,e,i,r)},e}(ci),Li=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Fi,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}(li);Li=_([ai(Fe.BlendNodeData)],Li);var Fi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).source0=null,e.source1=null,e.inputParameterValueNode=null,e}oe(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new Oi(e.skeleton),this.source1Result=new Oi(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){Mi.localBlend(t,e,i,r)},e}(ci),Vi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(ki,t),r=Ze(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}(li);Vi=_([ai(Fe.AndNodeData)],Vi);var ki=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}oe(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=Ze(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=Ze(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=Ze(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(pi),Di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(zi,t),r=Ze(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}(li);Di=_([ai(Fe.OrNodeData)],Di);var zi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}oe(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=Ze(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=Ze(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=Ze(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(pi),Bi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ui,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Ui,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(li);Bi=_([ai(Fe.NotNodeData)],Bi);var Ui=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.result=!1,e}oe(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}(pi),Gi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ji,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(li);Gi=_([ai(Fe.ConstFloatNodeData)],Gi);var ji=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}return oe(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(di),Xi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Wi,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(li);Xi=_([ai(Fe.ConstBoolNodeData)],Xi);var Wi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}return oe(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(pi),Hi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Yi,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(li);Hi=_([ai(Fe.ControlParameterFloatNodeData)],Hi);var Yi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}oe(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}(di),Zi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(qi,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(li);Zi=_([ai(Fe.ControlParameterBoolNodeData)],Zi);var qi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}oe(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}(pi),Ki=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Qi,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(li);Ki=_([ai(Fe.ControlParameterTriggerNodeData)],Ki);var Qi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}oe(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}(pi),Ji=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNodeIndex=ui,e.layerDatas=[],e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode($i,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=Ze(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:ui,e.layerDatas)for(var r,n=Ze(e.layerDatas);!(r=n()).done;){var a=r.value;this.layerDatas.push(gi({inputNodeIndex:ui,weightValueNodeIndex:ui},a))}},e}(li);Ji=_([ai(Fe.LayerBlendNodeData)],Ji);var $i=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseLayerNode=null,e.layers=[],e}oe(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new Oi(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var r,n=Ze(this.layers);!(r=n()).done;){var a,s,o=r.value;null==(a=o.inputNode)||a.initialize(e),null==(s=o.weightValueNode)||s.initialize(e)}},i.shutdownInternal=function(e){var i;null==(i=this.baseLayerNode)||i.shutdown(e);for(var r,n=Ze(this.layers);!(r=n()).done;){var a,s,o=r.value;null==(a=o.inputNode)||a.shutdown(e),null==(s=o.weightValueNode)||s.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=Ze(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 a=n.weightValueNode.getValue(t);Mi.localBlend(e.pose,this.layerNodeResult.pose,a,e.pose)}}return e},e}(ci),tr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ui,e.comparandValueNodeIndex=ui,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ir,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}(li);tr=_([ai(Fe.EqualNodeData)],tr);var er,ir=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}oe(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}(pi),rr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ui,e.comparandValueNodeIndex=ui,e}return oe(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(li);!function(t){t[t.GreaterThan=0]="GreaterThan",t[t.LessThan=1]="LessThan"}(er||(er={}));var nr=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}oe(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}(pi),ar=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.instantiate=function(t){var e=this.createNode(nr,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(rr);ar=_([ai(Fe.GreaterNodeData)],ar);var sr=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.instantiate=function(t){var e=this.createNode(nr,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(rr);sr=_([ai(Fe.LessNodeData)],sr);var or=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(hr,t),r=Ze(this.stateDatas);!(e=r()).done;){var n=e.value,a={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};i.states.push(a);for(var s,o=Ze(n.transitionDatas);!(s=o()).done;){var u=s.value,h={transitionNode:t.getNode(u.transitionNodeIndex),conditionNode:t.getNode(u.conditionNodeIndex),targetStateIndex:u.targetStateIndex};a.transitions.push(h)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex,this.machineName=e.machineName},e}(li);or=_([ai(Fe.StateMachineNodeData)],or);var ur,hr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).states=[],e.activeTransition=null,e.activeStateIndex=ui,e}oe(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===oi.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=ui,n=i.transitions.length,a=0;a<n;a++){var s=i.transitions[a];if(s.targetStateIndex===ui)throw new Error("Invalid target state index.");if(!this.states[s.targetStateIndex].stateNode.isTransitioning()){var o=!1;if(s.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>s.transitionNode.exitTime&&(o=!0)}else null!==s.conditionNode&&s.conditionNode.getValue(t)&&(o=!0);if(o){r=a;break}}}if(r!==ui){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=ui,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=Ze(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=Ze(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(ci);!function(t){t[t.None=0]="None",t[t.TransitioningIn=1]="TransitioningIn",t[t.TransitioningOut=2]="TransitioningOut"}(ur||(ur={}));var lr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNodeIndex=ui,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(fr,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}(li);lr=_([ai(Fe.StateNodeData)],lr);var cr,fr=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}oe(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}(ci);!function(t){t[t.State=0]="State",t[t.Transition=1]="Transition",t[t.CachedPose=2]="CachedPose"}(cr||(cr={}));var dr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=ui,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(mr,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}(li);dr=_([ai(Fe.TransitionNodeData)],dr);var pr,mr=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}oe(e,t);var i=e.prototype;return i.evaluate=function(t,e){mt(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=G(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=oi.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult),a=e;if(this.registerPoseTasksAndUpdateRootMotion(i,n,a),this.blendedDuration=U(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(),a},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 Oi(e.skeleton),this.targetNodeResult=new Oi(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},i.shutdownInternal=function(e){this.targetNode.setTransitioningState(ur.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(ur.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=U(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=G(this.blendWeight,0,1))},i.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;Mi.localBlend(t.pose,e.pose,r,i.pose)},e}(ci);!function(t){t[t.Float=0]="Float",t[t.Color=1]="Color"}(pr||(pr={}));var vr=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=Ze(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var a,s=Ze(e.rotation);!(a=s()).done;){var o=a.value;this.addReferenceTransform(o)}for(var u,h=Ze(e.scale);!(u=h()).done;){var l=u.value;this.addReferenceTransform(l)}for(var c,f=Ze(e.euler);!(c=f()).done;){var d=c.value;this.addReferenceTransform(d),this.useEuler=!0}for(var p=0;p<e.floats.length;p++){var m=e.floats[p];this.addRecordedProperty(m.path,m.className,m.property,0)}for(var v=0;v<e.colors.length;v++){var y=e.colors[v];this.addRecordedProperty(y.path,y.className,y.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 Ii(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 a=this.findTarget(t);if(a){var s;(s="VFXItem"===e?a:a.getComponent(Je(e)))||console.error("The "+e+" Component was not found.");for(var o=i.split("."),u=o[o.length-1],h=s,l=0;l<o.length-1;l++){var c=h[o[l]];void 0===c&&console.error("The "+o[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 H).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=Ze(i);!(e=n()).done;){var a=e.value,s=r.find(a);if(!s)return null;r=s}return r},t}(),yr=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.activeEvents=[],this.context=new vi;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=Ze(t.graphDataSet.resources);!(i=n()).done;){var a=i.value;if(a){for(var s,o=Ze(a.positionCurves);!(s=o()).done;){var u=s.value;r.position.push(u.path)}for(var h,l=Ze(a.rotationCurves);!(h=l()).done;){var c=h.value;r.rotation.push(c.path)}for(var f,d=Ze(a.scaleCurves);!(f=d()).done;){var p=f.value;r.scale.push(p.path)}for(var m,v=Ze(a.eulerCurves);!(m=v()).done;){var y=m.value;r.euler.push(y.path)}for(var g,x=Ze(a.floatCurves);!(g=x()).done;){var b=g.value;r.floats.push(b)}for(var T,E=Ze(a.colorCurves);!(T=E()).done;){var _=T.value;r.colors.push(_)}}}this.skeleton=new vr(e,r),this.result=new Oi(this.skeleton),this.context.skeleton=this.skeleton,this.context.activeEvents=this.activeEvents;var w=new yi;w.nodes=this.nodes,w.nodeDatas=t.nodeDatas,w.dataSet=t.graphDataSet;for(var S=0;S<t.nodeDatas.length;S++)w.nodes[S]||t.nodeDatas[S].instantiate(w);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.activeEvents.length=0,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];E(i,Qi)&&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=Ze(this.nodes);!(e=r()).done;){var n=e.value;E(n,hr)&&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."),ui)},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!==ui&&this.nodes[i].setValue(e)},t}();function gr(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 xr(t,e,i){return e&&gr(t.prototype,e),i&&gr(t,i),t}var br=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}oe(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.onPreRender=function(){},i.onDestroy=function(){},i.onApplyAnimationProperties=function(){},i.onParentChanged=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&&N(this.item.components,this),t.prototype.dispose.call(this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},xr(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}(ii);_([ti()],br.prototype,"item",void 0),_([ti()],br.prototype,"_enabled",void 0);var Tr,Er,_r=function(t){function e(){return t.apply(this,arguments)}oe(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}(br),wr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).graphInstance=null,e.graphAsset=null,e}oe(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 yr(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,a=e.pose.parentSpaceTransforms[r].rotation,s=e.pose.parentSpaceTransforms[r].scale,o=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(s.x,s.y,s.z),this.graphInstance.skeleton.useEuler?i[r].setRotation(o.x,o.y,o.z):i[r].setQuaternion(a.x,a.y,a.z,a.w)}for(var u=this.graphInstance.skeleton.floatAnimatedObjects,h=0;h<u.length;h++){var l=u[h],c=l.propertyName;l.directTarget[c]=e.pose.floatPropertyValues[h],E(l.target,br)&&l.target.onApplyAnimationProperties()}for(var f=this.graphInstance.skeleton.colorAnimatedObjects,d=0;d<f.length;d++){var p=f[d],m=p.propertyName;p.directTarget[m]=e.pose.colorPropertyValues[d],E(p.target,br)&&p.target.onApplyAnimationProperties()}for(var v,y=Ze(this.graphInstance.activeEvents);!(v=y()).done;){var g=v.value;g.data.event.onEvent(this.item,g)}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(br);function Sr(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 Cr(t){var i=t.getExtension("EXT_disjoint_timer_query_webgl2");if(i){var r=t.createQuery(),n=T((function(){return w(this,(function(a){return[2,new Promise((function(a,s){if(r){var o=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(i.GPU_DISJOINT_EXT);if(o&&!u){var h=t.getQueryParameter(r,t.QUERY_RESULT);a(h/1e3/1e3)}(o||u)&&(t.deleteQuery(r),r=null),null!==o&&r&&e.setTimeout((function(){n().then(a).catch}),1)}}))]}))}));if(!r)return;return{begin:function(){r&&t.beginQuery(i.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(i.TIME_ELAPSED_EXT)},getTime:n}}}wr=_([$e("Animator")],wr),function(t){t[t.vertex=0]="vertex",t[t.fragment=1]="fragment"}(Tr||(Tr={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Er||(Er={}));var Ar,Mr,Ir=[],Rr={},Or="WebGL Constants not in global, please check your environment";function Pr(){"function"==typeof a?Lr(a):void 0!==s?(Lr(s),Lr(s.prototype)):tt?Ir.push(et()?"iOS16 lockdown mode, WebGL Constants not in global":Or):Ir.push(Or),Ir.length||"HALF_FLOAT"in Rr||(Rr.HALF_FLOAT=5131)}function Nr(t){return void 0!==a&&"WebGL2RenderingContext"===t.constructor.name}function Lr(t){for(var e in t)/^[A-Z_]/.test(e)&&(Rr[e]=t[e])}function Fr(t){switch(t){case Ue.Float32:return s.FLOAT;case Ue.Int16:return s.SHORT;case Ue.Int8:return s.BYTE;case Ue.UInt16:return s.UNSIGNED_SHORT;case Ue.UInt8:return s.UNSIGNED_BYTE;default:return s.FLOAT}}function Vr(t){switch(t){case s.FLOAT:return Ue.Float32;case s.SHORT:return Ue.Int16;case s.BYTE:return Ue.Int8;case s.UNSIGNED_SHORT:return Ue.UInt16;case s.UNSIGNED_BYTE:return Ue.UInt8;default:return Ue.Float32}}function kr(t,e){return null==t?e:t}function Dr(t){switch(t){case Yt.ALPHA:case Yt.ADD:case Yt.SUBTRACTION:case Yt.STRONG_LIGHT:case Yt.WEAK_LIGHT:return 1;case Yt.SUPERPOSITION:return 2;case Yt.BRIGHTNESS:return 3;case Yt.MULTIPLY:return 0;default:return 1}}function zr(t,e){switch(e){case void 0:case Yt.ALPHA:t.blendFunction=[Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA,Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA];break;case Yt.ADD:t.blendFunction=[Rr.ONE,Rr.ONE,Rr.ONE,Rr.ONE];break;case Yt.SUBTRACTION:t.blendFunction=[Rr.ONE,Rr.ONE,Rr.ZERO,Rr.ONE],t.blendEquation=[Rr.FUNC_REVERSE_SUBTRACT,Rr.FUNC_REVERSE_SUBTRACT];break;case Yt.SUPERPOSITION:t.blendFunction=[Rr.ONE,Rr.ONE,Rr.ONE,Rr.ONE];break;case Yt.MULTIPLY:t.blendFunction=[Rr.DST_COLOR,Rr.ONE_MINUS_SRC_ALPHA,Rr.DST_COLOR,Rr.ONE_MINUS_SRC_ALPHA];break;case Yt.BRIGHTNESS:t.blendFunction=[Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA,Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA];break;case Yt.STRONG_LIGHT:t.blendFunction=[Rr.DST_COLOR,Rr.DST_ALPHA,Rr.ZERO,Rr.ONE];break;case Yt.WEAK_LIGHT:t.blendFunction=[Rr.DST_COLOR,Rr.ZERO,Rr.ZERO,Rr.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Br(t,e){e===Zt.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=Rr.CW,t.cullFace=e===Zt.BACK?Rr.BACK:Rr.FRONT)}function Ur(t,e){switch(e){case void 0:t.stencilTest=!1;break;case Er.MASK:t.stencilTest=!0,t.stencilFunc=[Rr.ALWAYS,Rr.ALWAYS],t.stencilOpZPass=[Rr.REPLACE,Rr.REPLACE];break;case Er.OBSCURED:t.stencilTest=!0,t.stencilFunc=[Rr.EQUAL,Rr.EQUAL];break;case Er.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[Rr.NOTEQUAL,Rr.NOTEQUAL];break;case Er.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}Ir.length||Pr(),function(t){t[t.whatever=0]="whatever",t[t.clear=2]="clear"}(Ar||(Ar={})),function(t){t[t.none=0]="none",t[t.data=1]="data",t[t.image=2]="image",t[t.compressed=3]="compressed",t[t.video=4]="video",t[t.canvas=5]="canvas",t[t.framebuffer=6]="framebuffer",t[t.mipmaps=7]="mipmaps"}(Mr||(Mr={}));var Gr=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.downloadText=function(t,e,i){this.download(t,"text",e,i)},e.download=function(e,i,r,n){var a=this;if(void 0===i&&(i="json"),!this.start(e,r,n)){var s=new o,u=function(){a.finish(e,s.status,s.response)};s.responseType=i,s.addEventListener("load",(function(){200==s.status||0==s.status&&t.trustXHRStatusZero?a.finish(e,200,s.response):u()})),s.addEventListener("error",u),s.open("GET",e,!0),s.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(e,i,r){var n=this.callbacks[e];delete this.callbacks[e];for(var a=200==i||0==i&&t.trustXHRStatusZero?[r]:[i,r],s=a.length-1,o=n.length;s<o;s+=2)n[s].apply(null,a)},t}();Gr.trustXHRStatusZero=!1;var jr=!1,Xr=!1;function Wr(t,e){return Hr.apply(this,arguments)}function Hr(){return(Hr=T((function(t,e){return w(this,(function(i){switch(i.label){case 0:return!jr&&e?[3,2]:[4,qr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,qr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),jr=!0,[4,qr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Yr(t,e){return Zr.apply(this,arguments)}function Zr(){return(Zr=T((function(t,e){return w(this,(function(i){switch(i.label){case 0:return!Xr&&e?[3,2]:[4,qr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,qr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Xr=!0,[4,qr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function qr(t){return Kr.apply(this,arguments)}function Kr(){return(Kr=T((function(t){var e,i;return w(this,(function(r){if(e="",E(t,u)){if(t.complete)return[2,t];e=t.src}else E(t,n)?(e=h.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,r){var n=new l;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&h.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&h.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e}))]}))}))).apply(this,arguments)}function Qr(t){return Jr.apply(this,arguments)}function Jr(){return(Jr=T((function(t){return w(this,(function(e){return[2,new Promise((function(e,i){(new Gr).downloadBinary(t,e,(function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function $r(t){return tn.apply(this,arguments)}function tn(){return(tn=T((function(t){return w(this,(function(e){return[2,new Promise((function(e,i){(new Gr).downloadBlob(t,e,(function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function en(t){return rn.apply(this,arguments)}function rn(){return(rn=T((function(t){var e;return w(this,(function(i){return e=c.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,e.autoplay=!1,rt()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,i){var r=!1,n=function(){r||(r=!0,s(),t(e))},a=function(){r||(r=!0,s(),i("Load video fail."))},s=function(){e.removeEventListener("loadeddata",n),e.removeEventListener("canplay",n),e.removeEventListener("error",a)};e.addEventListener("loadeddata",n),e.addEventListener("canplay",n),e.addEventListener("error",a),e.play().catch((function(t){console.warn("Autoplay blocked:",t)}))}))]}))}))).apply(this,arguments)}function nn(t,e){return an.apply(this,arguments)}function an(){return(an=T((function(t,e){return w(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 sn(t,e,i){return on.apply(this,arguments)}function on(){return(on=T((function(t,e,i,r){var n,a,s,o,u,h,l,c,f;return w(this,(function(d){switch(d.label){case 0:return void 0===r&&(r=[]),34067!==t.target?[3,2]:(n=t.mipmaps,a=t.target,s=n.map((function(t){return Promise.all(t.map((function(t){return t.id?i[t.id]:un(t,e)})))})),[4,Promise.all(s)]);case 1:return o=d.sent(),[2,gi({keepImageSource:!1},t,{mipmaps:o,sourceFrom:{target:a,type:Mr.mipmaps}})];case 2:return u=t.mipmaps,h=t.target,l=u.map((function(t){return un(t,e)})),[4,Promise.all(l)];case 3:return c=d.sent(),f=r[u[0][1][0]].url,[2,gi({keepImageSource:!1},t,{mipmaps:c,sourceType:Mr.mipmaps,sourceFrom:{target:h,bin:f,type:Mr.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function un(t,e){return hn.apply(this,arguments)}function hn(){return hn=T((function(t,e){var i,r,a,s,o;return w(this,(function(u){if(i=t[1],r=i[0],a=i[1],s=i[2],!(o=e[r]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,qr(new n([new Uint8Array(o,a,s)]))]}))})),hn.apply(this,arguments)}var ln=1,cn=function(t){function e(e){var i;return(i=t.call(this,e)||this).destroyed=!1,i.id="Tex"+ln++,i}oe(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?Rr.TEXTURE_2D:e,r=t.format,n=void 0===r?Rr.RGBA:r;return t.sourceType||(t.sourceType="image"in t?Mr.image:"data"in t?Mr.data:"video"in t?Mr.video:0),gi({minFilter:Rr.NEAREST,magFilter:Rr.NEAREST,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE,target:i,format:Rr.RGBA,internalFormat:n,type:Rr.UNSIGNED_BYTE},t)},e.fromImage=function(t,i,r){return T((function(){var n,a;return w(this,(function(s){switch(s.label){case 0:return[4,qr(t)];case 1:return n=s.sent(),(a=e.create(i,gi({sourceType:Mr.image,image:n,target:Rr.TEXTURE_2D,id:Ft(),flipY:!0},r))).initialize(),[2,a]}}))}))()},e.fromVideo=function(t,i,r){return T((function(){var n,a;return w(this,(function(s){switch(s.label){case 0:return[4,en(t)];case 1:return n=s.sent(),(a=e.create(i,gi({sourceType:Mr.video,video:n,id:Ft(),flipY:!0},r))).initialize(),[2,a]}}))}))()},xr(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(ii);function fn(t,e,i,r){var n,a,s=e.length/i/r;return a=n=4===s||0===s?Rr.RGBA:3===s?Rr.RGB:2===s?Rr.LUMINANCE_ALPHA:Rr.LUMINANCE,cn.createWithData(t,{data:e,width:i,height:r},{type:Rr.HALF_FLOAT,format:n,internalFormat:a,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE})}var dn={type:Rr.UNSIGNED_BYTE,format:Rr.RGBA,internalFormat:Rr.RGBA,wrapS:Rr.MIRRORED_REPEAT,wrapT:Rr.MIRRORED_REPEAT,minFilter:Rr.NEAREST,magFilter:Rr.NEAREST};function pn(t){return cn.create(t,gi({id:Xe.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:Mr.data},dn))}function mn(t){return cn.create(t,gi({id:Xe.EmptyTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:Mr.data},dn))}var vn,yn=new(function(){function t(){this.loaders=new Map,this.instances=new Map}var e=t.prototype;return e.register=function(t,e){this.loaders.has(t)?console.warn('TextureLoader for type "'+t+'" is already registered, skipping.'):this.loaders.set(t,e)},e.unregister=function(t){var e=this.instances.get(t);e&&(e.dispose(),this.instances.delete(t)),this.loaders.delete(t)},e.getLoader=function(t){if(this.instances.has(t))return this.instances.get(t);var e=this.loaders.get(t);if(!e)return console.error('TextureLoader for type "'+t+'" is not registered.'),null;var i=e();return this.instances.set(t,i),i},e.has=function(t){return this.loaders.has(t)},e.getRegisteredTypes=function(){return Array.from(this.loaders.keys())},e.dispose=function(){this.instances.forEach((function(t){return t.dispose()})),this.instances.clear(),this.loaders.clear()},t}()),gn=function(){function t(){this.reloadPending={}}var e=t.prototype;return e.reload=function(t){var e=this;return T((function(){var i,r;return w(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]}}))}))()},e.canOffloadTexture=function(t){if(t){var e=t.type;if(e===Mr.compressed||e===Mr.image){var i=t.target,r=t.map,n=t.url;return i===Rr.TEXTURE_CUBE_MAP?"object"==typeof r&&!!r:Ct(n)&&n.length>0}if(e===Mr.mipmaps){var a=t.bin,s=t.mipmaps,o=t.target,u=t.maps,h=t.urls;return a?s.length>0:o===Rr.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return Ct(t)&&t.length>0}))}}return!1},e.loadSource=function(t,e){var i=this;return T((function(){var r,n,a,s,o,u,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,S;return w(this,(function(w){switch(w.label){case 0:return r=t.type,n=t.target,a=t.map,s=t.url,o=t.bin,u=t.mipmaps,h=t.urls,l=t.maps,n!==Rr.TEXTURE_CUBE_MAP||r===Mr.mipmaps?[3,2]:[4,i.loadCubeMap(a)];case 1:return c=w.sent(),[2,gi({},e,{cube:c,target:Rr.TEXTURE_CUBE_MAP,sourceType:Mr.image,sourceFrom:{type:Mr.image,map:gi({},a),target:Rr.TEXTURE_CUBE_MAP}})];case 2:return r!==Mr.image?[3,4]:[4,qr(s)];case 3:return f=w.sent(),[2,gi({},e,{image:f,sourceType:Mr.image,sourceFrom:{type:r,url:s,target:Rr.TEXTURE_2D}})];case 4:return r!==Mr.video?[3,6]:[4,en(s)];case 5:return d=w.sent(),[2,gi({},e,{video:d,sourceType:Mr.video})];case 6:return r!==Mr.compressed?[3,14]:[4,Qr(s)];case 7:if(p=w.sent(),!(m=yn.getLoader("ktx2")))return[3,12];w.label=8;case 8:return w.trys.push([8,10,,11]),[4,m.loadFromBuffer(p)];case 9:return(v=w.sent()).sourceType===Mr.compressed?[2,gi({sourceType:v.sourceType,type:v.type,target:v.target,internalFormat:v.internalFormat,format:v.format,mipmaps:v.mipmaps,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR,sourceFrom:t},e)]:[3,11];case 10:throw y=w.sent(),new Error("Failed to parse KTX2 from "+(null!=(g=null==t?void 0:t.url)?g:"buffer")+": "+(y.message||y));case 11:return[3,13];case 12:throw new Error("KTX2 loader not found. Please register it first.");case 13:return[3,23];case 14:return r!==Mr.mipmaps?[3,23]:o?[4,Qr(o)]:[3,19];case 15:return x=w.sent(),b=null!=n?n:Rr.TEXTURE_2D,T=b===Rr.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==Rr.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(u.map((function(t){return i.loadMipmapImages(t,x)})))];case 16:return E=w.sent(),[3,18];case 17:E=i.loadMipmapImages(u,x),w.label=18;case 18:return[2,gi({},e,{mipmaps:E,target:b,sourceType:Mr.mipmaps,sourceFrom:{bin:o,mipmaps:T,target:b,type:Mr.mipmaps}})];case 19:return n!==Rr.TEXTURE_2D&&n?[3,21]:[4,Promise.all(h.map((function(t){return qr(t)})))];case 20:return _=w.sent(),[2,gi({},e,{mipmaps:_,target:Rr.TEXTURE_2D,sourceType:Mr.mipmaps,sourceFrom:{type:r,urls:h.slice(),target:Rr.TEXTURE_2D}})];case 21:return n!==Rr.TEXTURE_CUBE_MAP?[3,23]:[4,Promise.all(l.map((function(t){return i.loadCubeMap(t)})))];case 22:return S=w.sent(),[2,gi({},e,{mipmaps:S,target:Rr.TEXTURE_CUBE_MAP,sourceType:Mr.mipmaps,sourceFrom:{type:r,maps:l.map((function(t){return gi({},t)})),target:Rr.TEXTURE_CUBE_MAP}})];case 23:throw new Error("Invalid resource type: "+r+".")}}))}))()},e.loadMipmapImages=function(t,e){return T((function(){return w(this,(function(i){return[2,Promise.all(t.map((function(t){return qr(new n([new Uint8Array(e,t[0],t[1])]))})))]}))}))()},e.loadCubeMap=function(t){return T((function(){return w(this,(function(e){return[2,Promise.all(t.map((function(t){return qr(t)})))]}))}))()},t}();function xn(){return vn||(vn=new gn),vn}function bn(t){vn=t}var Tn=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 En(t){return"object"==typeof t&&t&&void 0===t.length&&E(t,cn)}function _n(t){return t&&void 0!==t.length&&En(t[0])}var wn,Sn=function(){function t(t,e,i,r,n,a,s,o,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===a&&(a=1),void 0===s&&(s=0),void 0===o&&(o=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,a,s,o,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,s,o,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]=a,v[6]=s,v[7]=o,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,a,s,o,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]=a,v[9]=s,v[13]=o,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),a=Math.sin(i),s=1-n,o=r.x,u=r.y,h=r.z,l=s*o,c=s*u;return this.set(l*o+n,l*u+a*h,l*h-a*u,0,l*u-a*h,c*u+n,c*h+a*o,0,l*h+a*u,c*h-a*o,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(X.ZERO,t,X.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,s=t.tempVec2;s.subtractVectors(e,i),s.normalize(),n.crossVectors(r,s),n.normalize(),a.crossVectors(s,n);var o=this.elements;return o[0]=n.x,o[1]=a.x,o[2]=s.x,o[3]=0,o[4]=n.y,o[5]=a.y,o[6]=s.y,o[7]=0,o[8]=n.z,o[9]=a.z,o[10]=s.z,o[11]=0,o[12]=-n.dot(e),o[13]=-a.dot(e),o[14]=-s.dot(e),o[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"==typeof t){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,a=i[0],s=i[4],o=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],_=r[8],w=r[12],S=r[1],C=r[5],A=r[9],M=r[13],I=r[2],R=r[6],O=r[10],P=r[14],N=r[3],L=r[7],F=r[11],V=r[15];return n[0]=a*T+s*S+o*I+u*N,n[4]=a*E+s*C+o*R+u*L,n[8]=a*_+s*A+o*O+u*F,n[12]=a*w+s*M+o*P+u*V,n[1]=h*T+l*S+c*I+f*N,n[5]=h*E+l*C+c*R+f*L,n[9]=h*_+l*A+c*O+f*F,n[13]=h*w+l*M+c*P+f*V,n[2]=d*T+p*S+m*I+v*N,n[6]=d*E+p*C+m*R+v*L,n[10]=d*_+p*A+m*O+v*F,n[14]=d*w+p*M+m*P+v*V,n[3]=y*T+g*S+x*I+b*N,n[7]=y*E+g*C+x*R+b*L,n[11]=y*_+g*A+x*O+b*F,n[15]=y*w+g*M+x*P+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],a=t[1],s=t[5],o=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*o*l-r*u*l-n*s*c+i*u*c+r*s*f-i*o*f)+t[7]*(+e*o*f-e*u*c+n*a*c-r*a*f+r*u*h-n*o*h)+t[11]*(+e*u*l-e*s*f-n*a*l+i*a*f+n*s*h-i*u*h)+t[15]*(-r*s*h-e*o*l+e*s*c+r*a*l-i*a*c+i*o*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],s=t[5],o=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*o*f-s*m*f-l*o*v+s*c*v,g=d*c*u-h*m*u-d*o*f+a*m*f+h*o*v-a*c*v,x=h*p*u-d*l*u+d*s*f-a*p*f-h*s*v+a*l*v,b=d*l*o-h*p*o-d*s*c+a*p*c+h*s*m-a*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*o*n+p*r*u-i*m*u-s*r*v+i*o*v)*E,t[3]=(l*o*n-s*c*n-l*r*u+i*c*u+s*r*f-i*o*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*o*n-a*m*n-d*r*u+e*m*u+a*r*v-e*o*v)*E,t[7]=(a*c*n-h*o*n+h*r*u-e*c*u-a*r*f+e*o*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]=(a*p*n-d*s*n+d*i*u-e*p*u-a*i*v+e*s*v)*E,t[11]=(h*s*n-a*l*n-h*i*u+e*l*u+a*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-a*p*r-d*i*o+e*p*o+a*i*m-e*s*m)*E,t[15]=(a*l*r-h*s*r+h*i*o-e*l*o-a*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=X.ZERO);var n=this.elements,a=e.x,s=e.y,o=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=a+a,d=s+s,p=o+o,m=a*f,v=a*d,y=a*p,g=s*d,x=s*p,b=o*p,T=u*f,E=u*d,_=u*p,w=i.x,S=i.y,C=i.z;return n[0]=(1-(g+b))*w,n[1]=(v+_)*w,n[2]=(y-E)*w,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+b))*S,n[6]=(x+T)*S,n[7]=0,n[8]=(y+E)*C,n[9]=(x-T)*C,n[10]=(1-(m+g))*C,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,a=this.elements,s=n.set(a[0],a[1],a[2]).length(),o=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();this.determinant()<0&&(s=-s),e.x=a[12],e.y=a[13],e.z=a[14];var h=t.tempMat0;h.copyFrom(this);var l=1/s,c=1/o,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=o,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new X,e=new _i,i=new X;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var s=1/(e-t),o=1/(i-r),u=1/(a-n),h=-(e+t)*s,l=-(i+r)*o,c=-(a+n)*u;s*=2,o*=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]=o,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 a=1/Math.tan(.5*t),s=1/(i-r),o=this.elements;return o[0]=n?a:a/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n?a*e:a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(r+i)*s,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*r*i*s,o[15]=0,null!==r&&r!==1/0||(o[10]=-1,o[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;s.x=a[0]*i+a[4]*r+a[8]*n+a[12],s.y=a[1]*i+a[5]*r+a[9]*n+a[13],s.z=a[2]*i+a[6]*r+a[10]*n+a[14];var o=a[3]*i+a[7]*r+a[11]*n+a[15];return s.multiply(1/o)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n+a[12],s.y=a[1]*i+a[5]*r+a[9]*n+a[13],s.z=a[2]*i+a[6]*r+a[10]*n+a[14],s},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n,s.y=a[1]*i+a[5]*r+a[9]*n,s.z=a[2]*i+a[6]*r+a[10]*n,s.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,s=this.elements,o=null!=e?e:t;return o.x=s[0]*i+s[4]*r+s[8]*n+s[12]*a,o.y=s[1]*i+s[5]*r+s[9]*n+s[13]*a,o.z=s[2]*i+s[6]*r+s[10]*n+s[14]*a,o.w=s[3]*i+s[7]*r+s[11]*n+s[15]*a,o},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!B(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return(new t).lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,a){return(new t).perspective(e,i,r,n,a)},t.fromColumnVectors=function(e,i,r,n){return(new t).setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromScale=function(e,i,r){return(new t).setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return(new t).setFromTranslation(e,i,r)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return(new t).setFromRotationAxis(e,i)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,i,r){return(new t).setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return(new t).setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,a,s,o,u,h,l,c,f,d,p,m,v){return new t(e,a,h,d,i,s,l,p,r,o,c,m,n,u,f,v)},t}();Sn.IDENTITY=new Sn(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),Sn.ZERO=new Sn(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Sn.tempVec0=new X,Sn.tempVec1=new X,Sn.tempVec2=new X,Sn.tempMat0=new Sn,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"}(wn||(wn={}));var Cn=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],a=i[8],s=i[1],o=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case wn.XYZ:this.y=Math.asin(G(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,o),this.z=0);break;case wn.YXZ:this.x=Math.asin(-G(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(a,c),this.z=Math.atan2(s,o)):(this.y=Math.atan2(-h,r),this.z=0);break;case wn.ZXY:this.x=Math.asin(G(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,o)):(this.y=0,this.z=Math.atan2(s,r));break;case wn.ZYX:this.y=Math.asin(-G(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,o));break;case wn.YZX:this.z=Math.asin(G(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,o),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case wn.XZY:this.z=Math.asin(-G(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(l,o),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=D,this.y*=D,this.z*=D,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,a,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!=(a=t[e+2])?a: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 _i;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,a=e.order,s=Math.cos(i*k*.5),o=Math.cos(r*k*.5),u=Math.cos(n*k*.5),h=Math.sin(i*k*.5),l=Math.sin(r*k*.5),c=Math.sin(n*k*.5);switch(a){case wn.XYZ:t.set(h*o*u+s*l*c,s*l*u-h*o*c,s*o*c+h*l*u,s*o*u-h*l*c);break;case wn.YXZ:t.set(h*o*u+s*l*c,s*l*u-h*o*c,s*o*c-h*l*u,s*o*u+h*l*c);break;case wn.ZXY:t.set(h*o*u-s*l*c,s*l*u+h*o*c,s*o*c+h*l*u,s*o*u-h*l*c);break;case wn.ZYX:t.set(h*o*u-s*l*c,s*l*u+h*o*c,s*o*c-h*l*u,s*o*u+h*l*c);break;case wn.YZX:t.set(h*o*u+s*l*c,s*l*u+h*o*c,s*o*c-h*l*u,s*o*u-h*l*c);break;case wn.XZY:t.set(h*o*u-s*l*c,s*l*u-h*o*c,s*o*c+h*l*u,s*o*u+h*l*c);break;default:console.error("unknown euler order: "+a)}return t},e.toMatrix4=function(t){var e=t.elements,i=this,r=i.x,n=i.y,a=i.z,s=i.order,o=Math.cos(r*k),u=Math.sin(r*k),h=Math.cos(n*k),l=Math.sin(n*k),c=Math.cos(a*k),f=Math.sin(a*k);if(s===wn.XYZ){var d=o*c,p=o*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]=o*h}else if(s===wn.YXZ){var y=h*c,g=h*f,x=l*c,b=l*f;e[0]=y+b*u,e[4]=x*u-g,e[8]=o*l,e[1]=o*f,e[5]=o*c,e[9]=-u,e[2]=g*u-x,e[6]=b+y*u,e[10]=o*h}else if(s===wn.ZXY){var T=h*c,E=h*f,_=l*c,w=l*f;e[0]=T-w*u,e[4]=-o*f,e[8]=_+E*u,e[1]=E+_*u,e[5]=o*c,e[9]=w-T*u,e[2]=-o*l,e[6]=u,e[10]=o*h}else if(s===wn.ZYX){var S=o*c,C=o*f,A=u*c,M=u*f;e[0]=h*c,e[4]=A*l-C,e[8]=S*l+M,e[1]=h*f,e[5]=M*l+S,e[9]=C*l-A,e[2]=-l,e[6]=u*h,e[10]=o*h}else if(s===wn.YZX){var I=o*h,R=o*l,O=u*h,P=u*l;e[0]=h*c,e[4]=P-I*f,e[8]=O*f+R,e[1]=f,e[5]=o*c,e[9]=-u*c,e[2]=-l*c,e[6]=R*f+O,e[10]=I-P*f}else if(s===wn.XZY){var N=o*h,L=o*l,F=u*h,V=u*l;e[0]=h*c,e[4]=-f,e[8]=l*c,e[1]=N*f+V,e[5]=o*c,e[9]=L*f-F,e[2]=F*f-L,e[6]=u*c,e[10]=V*f+N}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}();Cn.DEFAULT_ORDER=wn.ZYX,Cn.tempQuat0=new _i,Cn.tempMat0=new Sn;var An=function(){function t(t,e,i,r,n,a,s,o,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,s,o,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,s,o,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=s,h[1]=e,h[4]=n,h[7]=o,h[2]=i,h[5]=a,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,s,o,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=a,h[2]=s,h[5]=o,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,a=e+e,s=i+i,o=r+r,u=e*a,h=e*s,l=e*o,c=i*s,f=i*o,d=r*o,p=n*a,m=n*s,v=n*o,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],a=r[3],s=r[6],o=r[1],u=r[4],h=r[7];return r[0]=e*n+i*o,r[3]=e*a+i*u,r[6]=e*s+i*h,r[1]=-i*n+e*o,r[4]=-i*a+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,a=i[0],s=i[3],o=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]=a*p+s*y+o*b,n[3]=a*m+s*g+o*T,n[6]=a*v+s*x+o*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],a=t[4],s=t[7],o=t[2],u=t[5],h=t[8];return e*(a*h-u*s)+n*(u*r-i*h)+o*(i*s-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],s=t[7],o=t[2],u=t[5],h=t[8],l=h*a-u*s,c=u*r-h*i,f=s*i-a*r,d=e*l+n*c+o*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(o*s-h*n)*p,t[2]=(u*n-o*a)*p,t[3]=c*p,t[4]=(h*e-o*r)*p,t[5]=(o*i-u*e)*p,t[6]=f*p,t[7]=(n*r-s*e)*p,t[8]=(a*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[3]*r+a[6]*n,s.y=a[1]*i+a[4]*r+a[7]*n,s.z=a[2]*i+a[5]*r+a[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(!B(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return(new t).setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,a,s,o,u,h){return new t(e,n,o,i,a,u,r,s,h)},t}(),Mn=function(){function t(t,e){void 0===t&&(t=X.ZERO),void 0===e&&(e=X.X),this.origin=new X,this.direction=new X,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 X;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,s,o,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,_=b.z,w=1/d,S=1/p,C=1/m;if(w>=0?(i=(y-h)*w,r=(T-h)*w):(i=(T-h)*w,r=(y-h)*w),S>=0?(n=(g-l)*S,a=(E-l)*S):(n=(E-l)*S,a=(g-l)*S),!(i>a||n>r||((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),C>=0?(s=(x-c)*C,o=(_-c)*C):(s=(_-c)*C,o=(x-c)*C),i>o||s>r||((s>i||i!=i)&&(i=s),(o<r||r!=r)&&(r=o),r<0))))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new X).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),s=n.dot(n)-a*a,o=e.radius*e.radius;if(!(s>o)){var u=Math.sqrt(o-s),h=a-u,l=a+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,s=e.p1,o=e.p2,u=t.tempVec0.subtractVectors(s,a),h=t.tempVec1.subtractVectors(o,a),l=t.tempVec2.subtractVectors(this.origin,a),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}();Mn.tempVec0=new X,Mn.tempVec1=new X,Mn.tempVec2=new X,Mn.tempVec3=new X;var In,Rn,On=function(){function t(t,e){void 0===t&&(t=new X(1/0,1/0,1/0)),void 0===e&&(e=new X(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,a=-1/0,s=-1/0,o=0,u=t.length;o<u;o+=3){var h=t[o],l=t[o+1],c=t[o+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>a&&(a=l),c>s&&(s=c)}return this.min.set(e,i,r),this.max.set(n,a,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 X),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 X),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,a=0,s=n.length;a<s;a++)this.expandByObject(n[a]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new X),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 X;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 X),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 X),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 X),this.isEmpty())return[];var i=[];return i[0]=new X(this.min.x,this.min.y,this.min.z),i[1]=new X(this.min.x,this.min.y,this.max.z),i[2]=new X(this.min.x,this.max.y,this.min.z),i[3]=new X(this.min.x,this.max.y,this.max.z),i[4]=new X(this.max.x,this.min.y,this.min.z),i[5]=new X(this.max.x,this.min.y,this.max.z),i[6]=new X(this.max.x,this.max.y,this.min.z),i[7]=new X(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 X;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}(),Pn=function(){function t(t,e){void 0===t&&(t=X.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var a=(new On).setFromPoints(t);a.getCenter(i),this.radius=a.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new X),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 On),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],a=Math.sqrt(Math.max(i,r,n));return this.center.applyMatrix(t),this.radius=this.radius*a,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new X).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 X,i=new X;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 X).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 wn},Euler:Cn,Quaternion:_i,Vector2:j,Vector3:X,Vector4:W,Matrix3:An,Matrix4:Sn,Ray:Mn,PI2:V,DEG2RAD:k,RAD2DEG:D,NumberEpsilon:z,isZero:function(t){return isNaN(t)||Math.abs(t)<z},isEqual:B,damp:function(t,e,i,r){return U(t,e,1-Math.exp(-i*r))},lerp:U,degToRad:function(t){return t*k},radToDeg:function(t){return t*D},clamp:G,Color:H,Box3:On,Sphere:Pn});!function(t){t[t.noShader=0]="noShader",t[t.success=1]="success",t[t.fail=2]="fail",t[t.compiling=3]="compiling"}(In||(In={})),function(t){t.GLSL1="100",t.GLSL3="300 es"}(Rn||(Rn={}));var Ln=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return oe(e,t),e.prototype.initialize=function(){},e}(ii),Fn=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=Ze(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(ii);Fn=_([$e(ze.Shader)],Fn);var Vn,kn=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=[Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA,Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[Rr.FUNC_ADD,Rr.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=Rr.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=[Rr.ALWAYS,Rr.ALWAYS],this.stencilOpFail=[Rr.KEEP,Rr.KEEP],this.stencilOpZFail=[Rr.KEEP,Rr.KEEP],this.stencilOpZPass=[Rr.KEEP,Rr.KEEP],this.culling=!1,this.frontFace=Rr.CCW,this.cullFace=Rr.FRONT},e.apply=function(t){if(t.setSampleAlphaToCoverage(this.sampleAlphaToCoverage),t.setBlending(this.blending),t.setDepthTest(this.depthTest),t.setStencilTest(this.stencilTest),t.setCulling(this.culling),t.setPolygonOffsetFill(this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(Rr.BACK,this.stencilMask[1]),t.stencilMaskSeparate(Rr.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(Rr.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(Rr.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(Rr.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(Rr.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}();!function(t){t[t.normal=0]="normal",t[t.transformFeedback=1]="transformFeedback"}(Vn||(Vn={}));var Dn=1,zn=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,r.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.materialState=new kn,i){var n=i.name,a=void 0===n?"Material"+Dn++:n,s=i.renderType,o=void 0===s?0:s,u=i.shader;r.name=a,r.renderType=o,r.shaderSource=u,r.props=i,r._shader=new Fn(e),r._shader.shaderData=gi({},i.shader,{id:Ft(),dataType:ze.Shader})}else r.name="Material"+Dn++,r.renderType=0;return r}oe(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];Mt(i.initialize)?i.initialize():wt.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.materialState.apply(t)},i.use=function(t,e){var i,r=t.engine,n=this.shaderVariant;if(n.bind(),this.setupStates(r),e){for(var a,s=Ze(e.uniforms);!(a=s()).done;)i=a.value,this.checkUniform(i);for(var o,u=Ze(e.samplers);!(o=u()).done;)i=o.value,this.samplers.includes(i)||(this.samplers.push(i),this.uniformDirty=!0)}if(this.uniformDirty&&(n.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(i in e.floats)n.setFloat(i,e.floats[i]);for(i in e.ints)n.setInt(i,e.ints[i]);for(i in e.vector4s)n.setVector4(i,e.vector4s[i]);for(i in e.vector3s)n.setVector3(i,e.vector3s[i]);for(i in e.matrices)n.setMatrix(i,e.matrices[i])}for(i in this.textures)this.textures[i].initialize();for(i in this.floats)n.setFloat(i,this.floats[i]);for(i in this.ints)n.setInt(i,this.ints[i]);for(i in this.floatArrays)n.setFloats(i,this.floatArrays[i]);for(i in this.textures)n.setTexture(i,this.textures[i]);for(i in this.vector2s)n.setVector2(i,this.vector2s[i]);for(i in this.vector3s)n.setVector3(i,this.vector3s[i]);for(i in this.vector4s)n.setVector4(i,this.vector4s[i]);for(i in this.colors)n.setColor(i,this.colors[i]);for(i in this.quaternions)n.setQuaternion(i,this.quaternions[i]);for(i in this.matrices)n.setMatrix(i,this.matrices[i]);for(i in this.matrice3s)n.setMatrix3(i,this.matrice3s[i]);for(i in this.vector4Arrays)n.setVector4Array(i,this.vector4Arrays[i]);for(i in this.matrixArrays)n.setMatrixArray(i,this.matrixArrays[i])},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=Ze(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=Ze(e);!(i=r()).done;)for(var n=i.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},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;mt(r);var n=e.create(r,i);return n.materialState=Object.assign(new kn,n.materialState),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.cloneUniforms=function(t){var e;for(e in t.floats)this.setFloat(e,t.floats[e]);for(e in t.ints)this.setInt(e,t.ints[e]);for(e in t.floatArrays)this.setFloats(e,t.floatArrays[e]);for(e in t.textures)this.setTexture(e,t.textures[e]);for(e in t.vector2s)this.setVector2(e,t.vector2s[e]);for(e in t.vector3s)this.setVector3(e,t.vector3s[e]);for(e in t.vector4s)this.setVector4(e,t.vector4s[e]);for(e in t.colors)this.setColor(e,t.colors[e]);for(e in t.quaternions)this.setQuaternion(e,t.quaternions[e]);for(e in t.matrices)this.setMatrix(e,t.matrices[e]);for(e in t.vector4Arrays){for(var i=[],r=0;r<t.vector4Arrays[e].length;r+=4)i.push(new W(t.vector4Arrays[e][r],t.vector4Arrays[e][r+1],t.vector4Arrays[e][r+2],t.vector4Arrays[e][r+3]));this.setVector4Array(e,i)}for(e in t.matrixArrays){for(var n=[],a=0;a<t.matrixArrays[e].length;a+=16){for(var s=Sn.fromIdentity(),o=0;o<16;o++)s.elements[o]=t.matrixArrays[e][a+o];n.push(s)}this.setMatrixArray(e,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=gi({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===re.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,a=e.stringTags.RenderFace;for(r in a===ne.Front?(this.culling=!0,this.cullFace=Rr.BACK):a===ne.Back?(this.culling=!0,this.cullFace=Rr.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 W(s.x,s.y,s.z,s.w))}for(r in i.colors){var o=i.colors[r];this.setColor(r,new H(o.r,o.g,o.b,o.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 W(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.definition;for(var e in this._shader&&(t.shader=this._shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=ze.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 a in this.textures){t.textures[a]||(t.textures[a]={texture:this.textures[a]});var s=t.textures[a],o=this.getVector4(a+"_ST");o&&(s.scale={x:o.x,y:o.y},s.offset={x:o.z,y:o.w},delete t.vector4s[a+"_ST"])}return t},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=Lt,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this),t.prototype.dispose.call(this))},xr(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",get:function(){return this.materialState.blending},set:function(t){void 0!==t&&this.materialState.setBlending(t)}},{key:"blendColor",get:function(){return this.materialState.blendColor},set:function(t){t&&this.materialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.materialState.blendFunctionParameters},set:function(t){t&&this.materialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.materialState.blendEquationParameters},set:function(t){t&&this.materialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.materialState.depthTest},set:function(t){void 0!==t&&this.materialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.materialState.depthMask},set:function(t){void 0!==t&&this.materialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.materialState.depthRange},set:function(t){t&&this.materialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.materialState.depthFunc},set:function(t){void 0!==t&&this.materialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.materialState.polygonOffsetFill},set:function(t){void 0!==t&&this.materialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.materialState.polygonOffset},set:function(t){t&&this.materialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.materialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.materialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.materialState.colorMask[0]},set:function(t){this.materialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.materialState.stencilTest},set:function(t){void 0!==t&&this.materialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.materialState.stencilMask},set:function(t){t&&this.materialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.materialState.stencilRef},set:function(t){t&&this.materialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.materialState.stencilFunc},set:function(t){t&&this.materialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.materialState.stencilOpFail},set:function(t){t&&this.materialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.materialState.stencilOpZFail},set:function(t){t&&this.materialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.materialState.stencilOpZPass},set:function(t){t&&this.materialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.materialState.culling},set:function(t){void 0!==t&&this.materialState.setCulling(t)}},{key:"frontFace",get:function(){return this.materialState.frontFace},set:function(t){void 0!==t&&this.materialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.materialState.cullFace},set:function(t){void 0!==t&&this.materialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(ii);zn.create=function(t,e){return new zn(t,e)};var Bn,Un=function(){function t(){this.alphaMaskEnabled=!1,this.isMask=!1,this.inverted=!1,this.maskMode=Er.NONE,this.maskReferences=[],this.expectedStencilValue=0,this.prevStencilFunc=[0,0],this.prevStencilOpZPass=[0,0],this.prevStencilRef=[0,0],this.prevStencilMask=[0,0],this.stencilClearAction={stencilAction:Ar.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.setMaskOptions=function(t,e){var i=e.isMask,r=void 0!==i&&i,n=e.inverted,a=void 0!==n&&n,s=e.reference,o=e.alphaMaskEnabled,u=void 0!==o&&o;if(this.alphaMaskEnabled=u,this.isMask=r,this.inverted=a,this.maskReferences=[],r)this.maskMode=Er.MASK;else{this.maskMode=a?Er.REVERSE_OBSCURED:Er.OBSCURED;var h=t.findObject(s);h&&this.maskReferences.push({maskable:h,inverted:a})}},e.addMaskReference=function(t,e){if(void 0===e&&(e=!1),!this.maskReferences.some((function(e){return e.maskable===t}))){if(this.maskReferences.length>=255)return void console.warn("Maximum of 255 mask references exceeded. Additional masks will be ignored.");this.maskReferences.push({maskable:t,inverted:e})}},e.removeMaskReference=function(t){var e=this.maskReferences.findIndex((function(e){return e.maskable===t}));-1!==e&&this.maskReferences.splice(e,1)},e.clearMaskReferences=function(){this.maskReferences=[]},e.drawStencilMask=function(t,e){for(var i,r=e.frameClipMasks,n=Ze(r);!(i=n()).done;){var a=i.value;this.addMaskReference(a,!1)}if(this.maskReferences.length>0){t.clear(this.stencilClearAction);for(var s,o=[],u=[],h=Ze(this.maskReferences);!(s=h()).done;){var l=s.value;l.inverted?u.push(l):o.push(l)}for(var c=0;c<o.length;c++)o[c].maskable.drawStencilMask(c);for(var f,d=o.length,p=Ze(u);!(f=p()).done;){f.value.maskable.drawStencilMask(d)}this.expectedStencilValue=d}for(var m,v=Ze(e.materials);!(m=v()).done;){var y=m.value;this.setupMaskedMaterial(y)}for(var g,x=Ze(r);!(g=x()).done;){var b=g.value;this.removeMaskReference(b)}},e.drawGeometryMask=function(t,e,i,r,n,a){void 0===a&&(a=0);var s=r.colorMask,o=r.stencilTest;this.copyStencilArrayValue(this.prevStencilFunc,r.stencilFunc),this.copyStencilArrayValue(this.prevStencilOpZPass,r.stencilOpZPass),this.copyStencilArrayValue(this.prevStencilRef,r.stencilRef),this.copyStencilArrayValue(this.prevStencilMask,r.stencilMask),this.setupMaskMaterial(r,n),t.drawGeometry(e,i,r,a),r.colorMask=s,r.stencilTest=o,r.stencilFunc=this.prevStencilFunc,r.stencilOpZPass=this.prevStencilOpZPass,r.stencilRef=this.prevStencilRef,r.stencilMask=this.prevStencilMask},e.setupMaskMaterial=function(t,e){t.stencilTest=!0,t.stencilFunc=[Rr.EQUAL,Rr.EQUAL],t.stencilRef=[e,e],t.stencilMask=[255,255],t.stencilOpZPass=[Rr.INCR,Rr.INCR],t.colorMask=!1},e.setupMaskedMaterial=function(t){this.maskReferences.length>0?(t.stencilTest=!0,t.stencilRef=[this.expectedStencilValue,this.expectedStencilValue],t.stencilMask=[255,255],t.stencilFunc=[Rr.EQUAL,Rr.EQUAL],t.stencilOpZPass=[Rr.KEEP,Rr.KEEP]):t.stencilTest=!1},e.copyStencilArrayValue=function(t,e){e&&(t[0]=e[0],t[1]=e[1])},xr(t,[{key:"maskable",get:function(){return this.maskReferences.length>0?this.maskReferences[0].maskable:null},set:function(t){this.maskReferences=[],t&&this.maskReferences.push({maskable:t,inverted:this.maskMode===Er.REVERSE_OBSCURED})}}]),t}();!function(t){t[t.triangle=1]="triangle",t[t.box=2]="box",t[t.sphere=3]="sphere",t[t.custom=4]="custom"}(Bn||(Bn={}));var Gn=function(){this.position=new j,this.delta=new j,this.pointerCurrentRaycast=new jn},jn=function(){this.point=null,this.item=null},Xn=function(){function t(t,e,i){this.vectors=[],this.vectorsWorld=[],this.directions=[];for(var r=0;r<8;r++)this.vectors.push(new X),this.vectorsWorld.push(new X);for(var n=0;n<3;n++)this.directions.push(new X);this.minimum=new X,this.maximum=new X,this.minimumWorld=new X,this.maximumWorld=new X,this.center=new X,this.centerWorld=new X,this.extendSize=new X,this.extendSizeWorld=new X,this.worldMatrix=i||Sn.fromIdentity(),this.reConstruct(t,e,i)}var e=t.prototype;return e.reConstruct=function(e,i,r){var n=e.x,a=e.y,s=e.z,o=i.x,u=i.y,h=i.z;this.minimum.set(n,a,s),this.maximum.set(o,u,h),this.vectors[0].set(n,a,s),this.vectors[1].set(o,u,h),this.vectors[2].set(o,a,s),this.vectors[3].set(n,u,s),this.vectors[4].set(n,a,h),this.vectors[5].set(o,u,s),this.vectors[6].set(n,u,h),this.vectors[7].set(o,a,h);var l=t.tempVector0,c=t.tempVector1;l.copyFrom(i).add(e),this.center.copyFrom(l).scale(.5),c.copyFrom(i).subtract(e),this.extendSize.copyFrom(c).scale(.5),this.worldMatrix=r||Sn.fromIdentity(),this.update(this.worldMatrix)},e.update=function(e){var i=this.minimumWorld,r=this.maximumWorld,n=this.vectorsWorld,a=this.vectors;if(e.isIdentity()){i.copyFrom(this.minimum),r.copyFrom(this.maximum);for(var s=0;s<8;s++)n[s].copyFrom(a[s]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{i.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(var o=0;o<8;o++){e.transformPoint(a[o],n[o]);var u=n[o];i.x=Math.min(i.x,u.x),i.y=Math.min(i.y,u.y),i.z=Math.min(i.z,u.z),r.x=Math.max(r.x,u.x),r.y=Math.max(r.y,u.y),r.z=Math.max(r.z,u.z)}var h=t.tempVector0,l=t.tempVector1;h.copyFrom(r).subtract(i),this.extendSizeWorld.copyFrom(h).scale(.5),l.copyFrom(r).add(i),this.centerWorld.copyFrom(l).scale(.5)}var c=e.elements;this.directions[0].set(c[0],c[1],c[2]),this.directions[1].set(c[4],c[5],c[6]),this.directions[2].set(c[8],c[9],c[10]),this.worldMatrix=e},e.scale=function(e){var i=t.tempVector0;i.copyFrom(this.maximum).subtract(this.minimum);var r=i.length();i.scale(1/r);var n=r*e;i.scale(.5*n);var a=t.tempVector1,s=t.tempVector2;return a.copyFrom(this.center).subtract(i),s.copyFrom(this.center).add(i),this.reConstruct(a,s,this.worldMatrix),this},e.getWorldMatrix=function(){return this.worldMatrix},e.intersectsPoint=function(t){var e=this.minimumWorld,i=this.maximumWorld,r=-1e-6;return!(i.x-t.x<r||r>t.x-e.x)&&(!(i.y-t.y<r||r>t.y-e.y)&&!(i.z-t.z<r||r>t.z-e.z))},e.intersectsBox=function(t){return this.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.intersectsMinMax=function(t,e){var i=this.minimumWorld,r=this.maximumWorld;return!(r.x<t.x||i.x>e.x)&&(!(r.y<t.y||i.y>e.y)&&!(r.z<t.z||i.z>e.z))},t.intersects=function(t,e){return t.intersectsMinMax(e.minimumWorld,e.maximumWorld)},t}();Xn.tempVector0=new X,Xn.tempVector1=new X,Xn.tempVector2=new X;var Wn=function(){function t(){this.boundingBox=new Xn(new X,new X),this.triangles=[],this.worldMatrix=new Sn,this.assemblyTriangles=function(t,e,i,r,n){for(var a=i;a<r;a+=3){var s=3*e[a],o=3*e[a+1],u=3*e[a+2],h={x:t[s],y:t[s+1],z:t[s+2]},l={x:t[o],y:t[o+1],z:t[o+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.reConstruct=function(t,e,i){this.boundingBox.reConstruct(t,e,i)},e.getRawBoundingBoxTriangle=function(){return this.applyWorldMatrix(this.boundingBoxTriangle.area),this.boundingBoxTriangle},e.getBoundingBoxTriangle=function(t){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,n=Number.MAX_VALUE,a=Number.MAX_VALUE,s=Ze(this.boundingBoxTriangle.area);!(e=s()).done;){var o=e.value;i=Math.max(o.p0.x,o.p1.x,o.p2.x,i),r=Math.max(o.p0.y,o.p1.y,o.p2.y,r),n=Math.min(o.p0.x,o.p1.x,o.p2.x,n),a=Math.min(o.p0.y,o.p1.y,o.p2.y,a)}var u=[],h=new X(n,r,0),l=new X(i,r,0),c=new X(i,a,0),f=new X(n,a,0);return u.push({p0:h,p1:l,p2:c}),u.push({p0:h,p1:c,p2:f}),this.applyWorldMatrix(u),{type:Bn.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var i,r=[],n=Ze(this.triangles);!(i=n()).done;){var a=i.value;r.push({p0:a.p0,p1:a.p1,p2:a.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxTriangle={type:Bn.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,a=Ze(t.subMeshes);!(n=a()).done;){var s=n.value;if(void 0!==s.indexCount){var o=e.BYTES_PER_ELEMENT,u=s.offset/o,h=u+s.indexCount;this.assemblyTriangles(i,e,u,h,r)}}return r},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new X),t.p1=e.worldMatrix.transformPoint(t.p1,new X),t.p2=e.worldMatrix.transformPoint(t.p2,new X)})),t},t}(),Hn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e.frameClipMasks=[],e.maskManager=new Un,e._priority=0,e.boundingBoxInfo=new Wn,e}oe(e,t);var i=e.prototype;return 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)},i.onParentChanged=function(){this.frameClipMasks=[]},i.getBoundingBoxInfo=function(){return this.boundingBoxInfo},i.render=function(t){},xr(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}(br);_([ti()],Hn.prototype,"materials",void 0),_([ti()],Hn.prototype,"_priority",void 0);var Yn,Zn=6,qn="PRE_COLOR_0",Kn="PRE_COLOR_SIZE_0",Qn="PRE_MAIN_COLOR_0",Jn="PRE_MAIN_COLOR_SIZE_0",$n="editor",ta={"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","Container size overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY","Container is not an HTMLElement":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Invalid container size":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW","DPI overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT"},ea=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 a;null==(a=e.listeners[t])||a.forEach((function(i){var n=i.listener,a=i.options;n.apply(void 0,[].concat(r)),(null==a?void 0:a.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})))||[]}},ia=new _i,ra=new X,na=new X,aa=1,sa=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new X(0,0,0),this.quat=new _i(0,0,0,1),this.rotation=new Cn(0,0,0),this.scale=new X(1,1,1),this.anchor=new X(0,0,0),this.size=new j(1,1),this.children=[],this.worldMatrix=Sn.fromIdentity(),this.localMatrix=Sn.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new X(0,0,0),quat:new _i(0,0,0,1),scale:new X(1,1,1)},this.name="transform_"+aa++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){this.position.x===t&&this.position.y===e&&this.position.z===i||(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){0===t&&0===e&&0===i||(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===i||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){this.quat.x===t&&this.quat.y===e&&this.quat.z===i&&this.quat.w===r||(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){this.scale.x===t&&this.scale.y===e&&this.scale.z===i||(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,a=t.size,s=t.quat,o=t.name,u=t.anchor;if(o&&(this.name=o),i&&(E(i,X)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),s)E(s,_i)?this.setQuaternion(s.x,s.y,s.z,s.w):this.setQuaternion(s[0],s[1],s[2],s[3]);else if(r){var h=e?-1:1;E(r,Cn)?this.setRotation(r.x*h,r.y*h,r.z*h):this.setRotation(r[0]*h,r[1]*h,r[2]*h)}n&&(E(n,X)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(E(u,j)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){P(this.children,t)},e.removeChild=function(t){N(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Cn)},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.setWorldPosition=function(t,e,i){var r=this.getParentMatrix();r?(ra.set(0,0,0),ia.set(0,0,0,1),na.set(1,1,1),r.decompose(ra,ia,na),ra.set(t-ra.x,e-ra.y,i-ra.z),ia.invert(),ra.applyQuaternion(ia),ra.x=0!==na.x?ra.x/na.x:0,ra.y=0!==na.y?ra.y/na.y:0,ra.z=0!==na.z?ra.z/na.z:0,this.setPosition(ra.x,ra.y,ra.z)):this.setPosition(t,e,i)},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Cn)},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 X).copyFrom(t.position),t.quat?e.quat=new _i(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new Cn(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=(new X).copyFrom(t.scale),t.size&&(e.size=(new j).copyFrom(t.size)),t.anchor&&(e.anchor=(new j).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=ia.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},xr(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}(),oa=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).children=[],r.transform=new sa,r.time=-1,r.duration=0,r.endBehavior=ce.forward,r.type=te.base,r.components=[],r.isDuringPlay=!1,r.isManuallySetRenderOrder=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new ea,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=e,i&&r.fromData(i),r}oe(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=Ze(this.components);!(i=r()).done;){var n=i.value;if(E(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,i=[],r=Ze(this.components);!(e=r()).done;){var n=e.value;E(n,t)&&i.push(n)}return i},i.getDescendants=function(t,e){var i=[];return this.getDescendantsInternal(i,t,e),i},i.setParent=function(t){(t!==this||t)&&(this.parent&&N(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.onParentChanged(),!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=Ze(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 sa({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 Cn(t,e,i),n=_i.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,i){this.transform.scaleBy(t,e,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.setWorldPosition=function(t,e,i){this.transform.setWorldPosition(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,a=r.y,s=this.composition.engine.canvas.getBoundingClientRect(),o=s.width,u=s.height;this.transform.setPosition((2*t/o-1)*n,(1-2*e/u)*a,i)}},i.translateByPixel=function(t,e){if(this.composition){var i=this.composition.engine.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,s=this.composition.camera.getInverseVPRatio(a),o=s.x,u=s.y;this.transform.translate(2*t*o/r,-2*e*u/n,0)}},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.hitTest=function(t,i,r,n,a,s,o){var u;if(!this.isActive)return!1;var h=!1,l=null==o?void 0:o.maxCount,c=this.getHitTestParams(s);if(c){var f=c.clipMasks,d=!0;if(f.length>0&&!function(t,e){for(var i,r=Ze(e);!(i=r()).done;){var n=i.value.item;if(n.isActive&&n.transform.getValid()){var a=n.transform,s=a.getWorldMatrix(),o=a.size.x,u=a.size.y,h=new X(-.5*o,.5*u,0).applyMatrix(s),l=new X(-.5*o,-.5*u,0).applyMatrix(s),c=new X(.5*o,.5*u,0).applyMatrix(s),f={p0:h,p1:l,p2:c},d={p0:c,p1:l,p2:new X(.5*o,-.5*u,0).applyMatrix(s)};if(!t.intersectTriangle(f)&&!t.intersectTriangle(d))return!1}}return!0}(t,f)&&(d=!1),d){var p=!1,m=new X;if(c.type===Bn.triangle){for(var v=c.triangles,y=c.backfaceCulling,g=0;g<v.length;g++)if(t.intersectTriangle(v[g],m,y)){p=!0,a.push(m);break}}else if(c.type===Bn.box){var x=c.center,b=c.size,T=x.clone().addScaledVector(b,.5),E=x.clone().addScaledVector(b,-.5);t.intersectBox({min:T,max:E},m)&&(p=!0,a.push(m))}else if(c.type===Bn.sphere){var _=c.center,w=c.radius;t.intersectSphere({center:_,radius:w},m)&&(p=!0,a.push(m))}else if(c.type===Bn.custom){var S=c.collect(t,new j(i,r));S&&S.length>0&&(S.forEach((function(t){a.push(t)})),p=!0)}if(p){var C,A={id:this.getInstanceId(),name:this.name,position:a[a.length-1],parentId:this.parentId,hitPositions:a,behavior:c.behavior,item:this,composition:this.composition};if(n.push(A),h=!0,null==o||null==(C=o.stop)?void 0:C.call(o,A))return!0}}}for(var M,I=Ze(this.children);!(M=I()).done;){var R,O=M.value;if(void 0!==l&&n.length>=l)break;(null==o||null==(R=o.skip)?void 0:R.call(o,O))||O.hitTest(t,i,r,n,a,s,o)&&(h=!0)}return e.isComposition(this)&&h&&this!==(null==(u=this.composition)?void 0:u.rootItem)&&n.push({id:this.getInstanceId(),name:this.name,position:a[a.length-1],parentId:this.parentId,hitPositions:a,behavior:$t.NONE,item:this,composition:this.composition}),h},i.getCurrentPosition=function(){var t=new X;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,a=i[r];if(r++,a.name===t)return a;(n=i).push.apply(n,[].concat(a.children))}},i.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.refreshGUIDRecursive();var e=this.engine.findObject({id:this.definition.id});return e.refreshGUIDRecursive(),this.refreshGUIDRecursive(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=Ze(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},i.awake=function(){for(var t,e=Ze(this.components);!(t=e()).done;){var i=t.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var r,n=Ze(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=Ze(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=Ze(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},i.onDisable=function(){this.isEnabled=!1;for(var t,e=Ze(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},i.onParentChanged=function(){for(var t,e=Ze(this.components);!(t=e()).done;){t.value.onParentChanged()}for(var i,r=Ze(this.children);!(i=r()).done;){i.value.onParentChanged()}},i.setRendererComponentOrder=function(t){for(var e,i=Ze(this.components);!(e=i()).done;){var r=e.value;E(r,Hn)&&(r.priority=t)}},i.fromData=function(i){t.prototype.fromData.call(this,i);var r,n=i.id,a=i.name,s=i.parentId,o=i.endBehavior,u=i.transform,h=i.duration,l=void 0===h?0:h,c=i.visible,f=void 0===c||c;if(this.type=i.type,this.props=i,this.id=n.toString(),this.parentId=s,this.components.length=0,e.isComposition(this)){var d=this.definition.content.options.refId,p=this.engine.findEffectsObjectData(d);if(!p)throw new Error("Referenced precomposition with Id: "+d+" does not exist.");this.instantiatePreComposition(p)}if(this.name=a,this.duration=l,this.endBehavior=o,u&&this.transform.fromData(u),this.transform.name=this.name,this.transform.engine=this.engine,i.content||(i.content={options:{}}),l<0)throw new Error("Item duration can't be less than 0, see "+ta["Item duration can't be less than 0"]+".");if(i.components)for(var m,v=Ze(i.components);!(m=v()).done;){var y=m.value,g=this.engine.findObject(y);this.components.push(g)}for(var x,b=Ze(null!=(r=i.children)?r:[]);!(x=b()).done;){var T=x.value;this.engine.findObject(T).setParent(this)}this.setVisible(f)},i.toData=function(){var t,e;(this.definition.id=this.guid,this.definition.transform=this.transform.toData(),this.definition.dataType=ze.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.definition.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.definition.components){this.definition.components=[];for(var i,r=Ze(this.components);!(i=r()).done;){var n=i.value;E(n,qs)&&this.definition.components.push(n)}}this.definition.content={}},i.dispose=function(){if(this.composition){this.composition.destroyItem(this);for(var e,i=Ze(this.components.slice());!(e=i()).done;){e.value.dispose()}this.components=[],this._composition=null,this.transform.setValid(!1)}this.resetChildrenParent(),t.prototype.dispose.call(this)},i.resetChildrenParent=function(){for(var t,e=Ze(this.children);!(t=e()).done;){var i=t.value;this.parent&&i.setParent(this.parent)}var r;this.parent&&N(null==(r=this.parent)?void 0:r.children,this)},i.instantiatePreComposition=function(t,e){void 0===e&&(e=!0),this.name=t.name,this.duration=t.duration,this.endBehavior=t.endBehavior;var i,r=this.getInstanceId();this.setInstanceId(t.id);for(var n,a=Ze(t.components);!(n=a()).done;){var s=n.value,o=this.engine.findObject(s);o.item=this,this.components.push(o)}for(var u,h=Ze(null!=(i=t.children)?i:[]);!(u=h()).done;){var l=u.value;this.engine.findObject(l).setParent(this)}if(e){for(var c,f=Ze(this.components);!(c=f()).done;){c.value.setInstanceId(Ft())}for(var d,p=Ze(this.children);!(d=p()).done;){d.value.refreshGUIDRecursive()}}this.setInstanceId(r)},i.refreshGUIDRecursive=function(t){var e,i=null!=(e=null==t?void 0:t.get(this))?e:Ft();this.setInstanceId(i);for(var r,n=Ze(this.components);!(r=n()).done;){var a,s=r.value,o=null!=(a=null==t?void 0:t.get(s))?a:Ft();s.setInstanceId(o)}for(var u,h=Ze(this.children);!(u=h()).done;){u.value.refreshGUIDRecursive(t)}},i.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=Ze(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=Ze(this.children);!(n=a()).done;){n.value.gatherPreviousObjectID(t)}},i.getDescendantsInternal=function(t,e,i){if(void 0===e&&(e=!1),this.children)for(var r=0;r<this.children.length;r++){var n=this.children[r];i&&!i(n)||t.push(n),e||n.getDescendantsInternal(t,!1,i)}},e.isComposition=function(t){return t.type===te.composition},e.isSprite=function(t){return t.type===te.sprite},e.isParticle=function(t){return t.type===te.particle},e.isNull=function(t){return t.type===te.null},e.isTree=function(t){return t.type===te.tree},e.isCamera=function(t){return t.type===te.camera},e.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},xr(e,[{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=Ze(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){this.listIndex=t,this.isManuallySetRenderOrder=!0,this.setRendererComponentOrder(t)}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),e}(ii);oa=_([$e(ze.VFXItemData)],oa),function(t){t.is=function(t,e){return t.type===e},t.isComposition=function(t){return t.type===te.composition},t.isParticle=function(t){return t.type===te.particle},t.isNull=function(t){return t.type===te.null}}(Yn||(Yn={}));var ua,ha,la=(ua=new Float32Array(1),ha=new Int32Array(ua.buffer),function(t){ua[0]=t;var e=ha[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)}),ca=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]=la(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=la(t[i])},t}();function fa(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}var da,pa=new Cn,ma=new Sn;function va(t,e,i,r,n,a,s){var o=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;o.copyFrom(a),o.addScaledVector(s,h),o.addScaledVector(i,c);var f=e.linearVelOverLifetime||{},d=e.orbitalVelOverLifetime||{};if(d.enabled){var p=new X;d.center&&p.setFromArray(d.center);var m=o.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}));pa.setFromArray(y).negate(),ma.setFromEuler(pa);var g=ma.transformPoint(m);o.addVectors(p,g)}if(f.enabled){var x=f.asMovement,b=f.x,T=f.y,E=f.z;if(b){var _=x?b.getValue(u):b.getIntegrateValue(0,r,n);o.x=o.x+_}if(T){var w=x?T.getValue(u):T.getIntegrateValue(0,r,n);o.y=o.y+w}if(E){var S=x?E.getValue(u):E.getIntegrateValue(0,r,n);o.z=o.z+S}}return o}function ya(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function ga(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function xa(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var s=0;s<i.length;s++)t[s]=i[s];return t}var ba=((da={})[ie.PARTICLE_ORIGIN_CENTER]=[0,0],da[ie.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],da[ie.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],da[ie.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],da[ie.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],da[ie.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],da[ie.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],da[ie.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],da[ie.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],da);function Ta(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function Ea(t,e,i){var r=i.position,n=new X(t,e,0),a=new X;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new Mn(r,a)}function _a(t,e,i){var r=t.x,n=t.y,a=t.z,s=new X(r-e,n+i,a),o=new X(r-e,n-i,a),u=new X(r+e,n-i,a),h=new X(r+e,n+i,a);return[{p0:s,p1:o,p2:u},{p0:s.clone(),p1:u.clone(),p2:h}]}function wa(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function Sa(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function Ca(t,e,i,r,n){void 0===r&&(r=null);var a=new X(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new X(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);n||(n=3);for(var o=e,u=e*n;o<e+i;o++,u+=n){var h=t[u],l=t[u+1],c=t[u+2];a.x=Math.min(a.x,h),a.y=Math.min(a.y,l),a.z=Math.min(a.z,c),s.x=Math.max(s.x,h),s.y=Math.max(s.y,l),s.z=Math.max(s.z,c)}return r&&(a.x-=a.x*r.x+r.y,a.y-=a.y*r.x+r.y,a.z-=a.z*r.x+r.y,s.x+=s.x*r.x+r.y,s.y+=s.y*r.x+r.y,s.z+=s.z*r.x+r.y),{minimum:a,maximum:s}}var Aa={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,a=e[r],s=e[n];return new j(a,s)},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===le.LINE||i===le.EASE_OUT?0:i===le.EASE_IN||i===le.EASE||i===le.HOLD&&r===le.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!==le.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==le.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[le.EASE,le.EASE_IN,le.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[le.EASE,le.EASE_OUT,le.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===le.HOLD&&[le.HOLD,le.LINE_OUT,le.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===le.HOLD&&[le.HOLD,le.LINE,le.EASE_IN].includes(i)}},Ma=function(t,e){this.points=t,this.totalLength=e},Ia={},Ra={},Oa=.1;function Pa(t,e){return 1-3*e+3*t}function Na(t,e){return 3*e-6*t}function La(t){return 3*t}function Fa(t,e,i){return((Pa(e,i)*t+Na(e,i))*t+La(e))*t}function Va(t,e,i){return 3*Pa(e,i)*t*t+2*Na(e,i)*t+La(e)}function ka(t,e,i,r){var n=Sa(e.x-t.x,3)+"_"+Sa(e.y-t.y,3)+"_"+Sa(e.z-t.z,3)+"&"+(Sa(i.x-t.x,3)+"_"+Sa(i.y-t.y,3)+"_"+Sa(i.z-t.z,3))+"&"+(Sa(r.x-t.x,3)+"_"+Sa(r.y-t.y,3)+"_"+Sa(r.z-t.z,3));if(Ra[n])return{data:Ra[n],interval:t};for(var a=[],s=null,o=0,u=0,h=0;h<300;h+=1){var l=new X,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,o+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new Ma(a,o);return Ra[n]=f,{data:f,interval:new X(t.x,t.y,t.z)}}var Da=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=ka(t,e,i,r),a=n.data,s=n.interval;this.lengthData=a,this.interval=s,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(wa(1-t,0))return e.points[299].point.clone().add(this.interval);if(wa(e.totalLength,0))return this.p1.clone();var i=new X,r=Sa(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(wa(n,r))return e.points[a].point.clone().add(this.interval);var s=!0,o=1;for(r<n&&(o=-1);s;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}o>0&&a<299?(a+=o,n+=Sa(e.points[a].partialLength,5)):o<0&&a>0?(n-=Sa(e.points[a].partialLength,5),a+=o):s=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),za=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new _i,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):wa(1-t,0)?this.temp.copyFrom(this.p2):(ja.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),Ba=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new j,this.control2=new j,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(),Fa(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 a=1-n,s=a*a,o=n*n;return t*(s*a)+e*s*n*3+i*a*o*3+r*(o*n)},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=Fa(t*Oa,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+=Oa;var n=i+(t-e[--r])/(e[r+1]-e[r])*Oa,a=Va(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=Va(e,i,r);if(0===a)return e;e-=(Fa(e,i,r)-t)/a}return e}(t,n,this.control1.x,this.control2.x):0===a?n:function(t,e,i,r,n){var a,s,o=0;do{(a=Fa(s=e+(i-e)/2,r,n)-t)>0?i=s:e=s}while(Math.abs(a)>1e-7&&++o<10);return s}(t,i,i+Oa,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 Ua(t,e){var i=Ga(t,e,!0),r=i.p0,n=i.p1,a=i.p2,s=i.p3;mt(a),mt(s);var o,u,h=s.x-r.x,l=s.y-r.y,c=Sa((n.x-r.x)/h,5),f=Sa((a.x-r.x)/h,5);wa(l,0)?o=u=NaN:(o=Sa((n.y-r.y)/l,5),u=Sa((a.y-r.y)/l,5)),c<0&&(c=0),f<0&&(f=0),c>1&&(c=1),f>1&&(f=1);var d,p=("bez_"+c+"_"+o+"_"+f+"_"+u).replace(/\./g,"p");return Ia[p]?d=Ia[p]:(d=wa(l,0)?new Ba:new Ba(c,o,f,u),Ia[p]=d),{points:[r,n,a,s],timeInterval:h,valueInterval:l,curve:d}}function Ga(t,e,i){var r=t[1],n=Aa.isHoldOutKeyframe(t),a=Aa.isHoldInKeyframe(e),s=!a&&Aa.isRightSideEase(t),o=!n&&Aa.isLeftSideEase(e);if(s&&!o&&!a){var u=new j(r[r.length-4],r[r.length-3]),h=new j(r[r.length-2],r[r.length-1]),l=Aa.getPointInCurve(e),c=new j(l.x,l.y);return{type:"ease",p0:u,p1:h,p2:new j(c.x-(c.x-u.x)/10,c.y),p3:c}}if(!s&&o&&!n){var f=e[1],d=Aa.getPointInCurve(t),p=new j(d.x,d.y),m=new j(f[0],f[1]),v=new j(f[2],f[3]);return{type:"ease",p0:p,p1:new j(p.x+(v.x-p.x)/10,p.y),p2:m,p3:v}}if(s&&o){var y=e[1];return{type:"ease",p0:new j(r[r.length-4],r[r.length-3]),p1:new j(r[r.length-2],r[r.length-1]),p2:new j(y[0],y[1]),p3:new j(y[2],y[3])}}var g=Aa.getPointInCurve(t),x=Aa.getPointInCurve(e);return n?x.y=g.y:a&&(g.y=x.y),i?{type:"line",p0:g,p1:new j((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new j((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}:{type:"line",p0:g,p1:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var ja=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,s=e.z,o=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r)return t.x=n,t.y=a,t.z=s,void(t.w=o);if(1===r)return t.x=u,t.y=h,t.z=l,void(t.w=c);if(o!==c||n!==u||a!==h||s!==l){var f=1-r,d=n*u+a*h+s*l+o*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,a=a*f+h*g,s=s*f+l*g,o=o*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+s*s+o*o);n*=x,a*=x,s*=x,o*=x}}t.x=n,t.y=a,t.z=s,t.w=o},t}(),Xa="not_implement",Wa=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(Xa)},e.getIntegrateValue=function(t,e,i){throw new Error(Xa)},e.getIntegrateByTime=function(t,e){throw new Error(Xa)},e.getValue=function(t){throw new Error(Xa)},e.getMaxTime=function(){throw new Error(Xa)},e.toUniform=function(t){throw new Error(Xa)},e.map=function(t){throw new Error(Xa)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(Xa)},t.getAllData=function(t,e){for(var i=new(e?ca:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var s=a[r].toData();i.set(s,n),n+=s.length}return e?i.data:i},t}(),Ha=function(t){function e(){return t.apply(this,arguments)}oe(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}(Wa),Ya=function(t){function e(){return t.apply(this,arguments)}oe(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}(Wa),Za=function(t){function e(){return t.apply(this,arguments)}oe(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}(Wa),qa=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(Wa),Ka=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return rs(e,0,this.xCoord,this.min,this.max)-rs(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}(Wa),Qa=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=q(t)},i.getStops=function(){return this.stops},i.getValue=function(t){var e=this.stops;if(0===e.length)return[0,0,0,0];if(t<=e[0].time)return e[0].color.toArray();var i=e.length-1;if(t>=e[i].time)return e[i].color.toArray();for(var r=0;r<i;r++){var n=e[r],a=e[r+1];if(n.time<=t&&a.time>t){var s=(t-n.time)/(a.time-n.time);return K(n.color.toArray(),a.color.toArray(),s,!0)}}return e[i].color.toArray()},e}(Wa),Ja=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1],s=n[0],o=a[0];if(t>=s&&t<=o){var u=(t-s)/(o-s),h=n[1];return h+u*(a[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,a=e?rs:is,s=0;s<n;s++){var o=i[s],u=i[s+1],h=o[0],l=u[0];if(t>h&&t<=l)return r+a(t,h,l,o[1],u[1]);r+=a(l,h,l,o[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=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}(Wa),$a=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],a=e[r+1];if(n[0]<=t&&a[0]>=t){var s=a[1]-n[1],o=void 0;if(0===s)o=(t-n[0])/(a[0]-n[0]);else o=(ns(t,n,a)-n[1])/s;return this.calculateVec(r,o)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(Wa),ts=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var a=e[n],s=e[n+1],o=new X(i[n][0],i[n][1],i[n][2]),u=new X(i[n+1][0],i[n+1][1],i[n+1][2]),h=new X(r[2*n][0],r[2*n][1],r[2*n][2]),l=new X(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=Ua(a,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Da(o,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=Sa(t,5),i=0,r=new X,n=this.keyTimeData;if(!n.length)return r;var a=this.curveSegments[n[0]].timeStart,s=this.curveSegments[n[n.length-1]].timeEnd;if(e<=a)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 o=0;o<n.length;o++){var u=this.curveSegments[n[o]].timeStart,h=this.curveSegments[n[o]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[o]].pathCurve;i=this.getPercValue(n[o],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=Sa((e-r.x)/n,4);return G(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Wa),es=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var a=e[n],s=e[n+1],o=_i.fromArray(i[n]),u=_i.fromArray(i[n+1]),h=_i.fromArray(r[2*n]),l=_i.fromArray(r[2*n+1]),c=Ua(a,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new za(o,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=Sa(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<r.length;s++){var o=r[s].split("&"),u=o[0],h=o[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,a=Sa((e-r.x)/n,4);return G(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Wa);function is(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function rs(t,e,i,r,n){var a=t*t,s=e*e;return(2*(a*t)*(r-n)+3*a*(e*n-i*r)-s*e*(2*r+n)+3*s*i*r)/(6*(e-i))}function ns(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,s=(t-e[0])/r,o=s*s,u=o*s,h=u-2*o+s,l=u-o,c=-2*u+3*o;return(2*u-3*o+1)*e[1]+h*n+l*a+c*i[1]}function as(t,e){if(e){var i=e[0],r=e[1];if(i===he.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===he.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var s=Math.ceil(a/2);t.lineSegCount+=s,t.curves.push(r),t.index+=s,t.max=Math.max(t.max,s)}else if(i===he.BEZIER_CURVE){var o=r.length-1;t.index+=2*o,t.curves.push(r),t.max=Math.max(t.max,2*o),t.curveCount+=2*o}}}function ss(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(os=function(){return!!t})()}function us(t,e,i){return us=os()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&se(n,i.prototype),n},us.apply(null,arguments)}var hs,ls,cs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new W,e}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=xs(t[0]),this.yCurve=xs(t[1]),this.zCurve=xs(t[2]),this.wCurve=xs(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}(Wa),fs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new X,e}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=xs(t[0]),this.yCurve=xs(t[1]),this.zCurve=xs(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}(Wa),ds=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new j,e}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=xs(t[0]),this.yCurve=xs(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}(Wa);!function(t){t[t.Cubic=0]="Cubic",t[t.Linear=1]="Linear",t[t.Constant=2]="Constant"}(hs||(hs={})),function(t){t[t.None=0]="None",t[t.In=1]="In",t[t.Out=2]="Out",t[t.Both=3]="Both"}(ls||(ls={}));var ps=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=vs(t);var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=ms(e[i],e[i+1]),n=r.points,a=r.curve,s=r.timeInterval,o=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:o,curve:a,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,a=this.keyFrames[r+1].time;if(t>=n&&t<a){var s=this.curveInfos[r],o=s.points[0],u=s.timeInterval,h=s.valueInterval,l=(t-o.x)/u,c=0;c=1===this.keyFrames[r].tangentMode?l:s.curve.getValue(l),e=o.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,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var s=0;s<a.length;s++){var o=this.curveMap[a[s]].timeStart,u=this.curveMap[a[s]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[s],Number(u))),r>=Number(o)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[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,a=i.valueInterval,s=0,o=(e-r.x)/20,u=0;u<=20;u++){var h=u*o/n,l=r.y+a*i.curve.getValue(h);s+=0===u||20===u?l:u%2==1?4*l:2*l}return s*=o/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}(Wa);function ms(t,e){var i=new j(t.time,t.value),r=new j,n=new j,a=new j,s=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,o=2===t.tangentMode,u=(s?t.outWeight:1)*(e.time-t.time)/3;r.x=t.time+u,r.y=t.value+u*(o?0:t.outSlope);var h=(s?e.inWeight:1)*(e.time-t.time)/3;n.x=e.time-h,n.y=e.value-h*(o?0:e.inSlope),a.x=e.time,a.y=o?t.value:e.value,mt(n),mt(a);var l,c,f=a.x-i.x,d=a.y-i.y,p=Sa((r.x-i.x)/f,5),m=Sa((n.x-i.x)/f,5);wa(d,0)?l=c=NaN:(l=Sa((r.y-i.y)/d,5),c=Sa((n.y-i.y)/d,5)),p<0&&(console.error("Invalid bezier points, x1 < 0",i,r,n,a),p=0),m<0&&(console.error("Invalid bezier points, x2 < 0",i,r,n,a),m=0),p>1&&(console.error("Invalid bezier points, x1 >= 1",i,r,n,a),p=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",i,r,n,a),m=1);var v,y=("bez_"+p+"_"+l+"_"+m+"_"+c).replace(/\./g,"p");return Ia[y]?v=Ia[y]:(v=wa(d,0)?new Ba:s?new Ba(p,l,m,c):new Ba(l,c),Ia[y]=v),{points:[i,r,n,a],timeInterval:f,valueInterval:d,curve:v}}function vs(t){for(var e=t,i=[],r=[],n={x:0,y:0},a=0;a<e.length;a++){var s=e[a],o=Ga(s,a+1<e.length?e[a+1]:e[a],!0),u=o.p0,h=o.p1,l=o.p2,c=o.p3,f=o.type;mt(l),mt(c);var d={leftControl:n,value:u,rightControl:h,tangentMode:"line"===f?1:0};s[0]===le.HOLD&&(d.tangentMode=2),r.push(d),n=l}for(var p=function(t,e){return(e.y-t.y)/(e.x-t.x+z)},m=0;m<r.length;m++){var v=r[m].leftControl,y=r[m].value,g=r[m].rightControl,x=0,b=0;m>0&&(x=p(v,y)),m<r.length-1&&(b=p(y,g));var T={time:y.x,value:y.y,inSlope:x,outSlope:b,inWeight:0,outWeight:0,tangentMode:r[m].tangentMode,weightedMode:3};i.push(T),m>0&&(T.inWeight=(y.x-v.x)/((y.x-r[m-1].value.x)/3)),m+1<r.length&&(T.outWeight=(g.x-y.x)/((r[m+1].value.x-y.x)/3))}return i}var ys,gs=((ys={})[he.RANDOM]=function(t){return E(t[0],Array)?new qa(t):new Za(t)},ys[he.CONSTANT]=function(t){return new Ha(t)},ys[he.CONSTANT_VEC2]=function(t){return new Ha(t)},ys[he.CONSTANT_VEC3]=function(t){return new Ha(t)},ys[he.CONSTANT_VEC4]=function(t){return new Ha(t)},ys[he.RGBA_COLOR]=function(t){return new Ha(t)},ys[he.COLORS]=function(t){return new Ya(t.map((function(t){return Y(t,!1)})))},ys[he.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Ka([t[0][1],t[1][1]]):new Ja(t)},ys[he.GRADIENT_COLOR]=function(t){return new Qa(t)},ys[he.LINEAR_PATH]=function(t){return new $a(t)},ys[he.BEZIER_CURVE]=function(t){return 1===t.length?new Ha(t[0][1][1]):new ps(t)},ys[he.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Ha(us(X,[].concat(t[1][0]))):new ts(t)},ys[he.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new Ha(us(_i,[].concat(t[1][0]))):new es(t)},ys[he.COLOR_CURVE]=function(t){return new bs(t)},ys[he.VECTOR4_CURVE]=function(t){return new cs(t)},ys[he.VECTOR2_CURVE]=function(t){return new ds(t)},ys[27]=function(t){return new fs(t)},ys);function xs(t){if(!t||!isNaN(+t))return new Ha(t||0);if(E(t,Wa))return t;if(Mt(gs[t[0]]))return gs[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+ta["ValueType: 21/22 is not supported"]+".")}var bs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new H,e}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=xs(t[0]),this.gCurve=xs(t[1]),this.bCurve=xs(t[2]),this.aCurve=xs(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}(Wa),Ts=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},xr(t,null,[{key:"shared",get:function(){return Es.x=0,Es.y=0,Es}}]),t}(),Es=new Ts,_s=1e-4,ws=1e-4;function Ss(t,e,i,r,n,a,s,o){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*a+u,d=e+r*a+h;return o.push(l,c),o.push(f,d),2}function Cs(t,e,i,r,n,a,s,o){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,a-e);o&&l<c?l+=2*Math.PI:!o&&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,o){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,a)}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,a),s.push(t,e)}return 2*v}function As(t,e,i,r,n,a,s,o,u){var h=_s;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],a=t[e-1];r<e;r+=2){var s=t[r],o=t[r+1];i+=(s-n)*(o+a),n=s,a=o}return i<0?-1:1}(t);i&&(f*=-1),c=(c-.5)*f+.5}var d=new Ts(t[0],t[1]),p=new Ts(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,E=x.length/2,_=l.width/2,w=_*_,S=l.miterLimit*l.miterLimit,C=t[0],A=t[1],M=t[2],I=t[3],R=0,O=0,P=-(A-I),N=C-M,L=0,F=0,V=Math.sqrt(P*P+N*N)+z;P/=V,N/=V,P*=_,N*=_;var k=2*(1-c),D=2*c;m||(l.cap===Ne.Round?T+=Cs(C-P*(k-D)*.5,A-N*(k-D)*.5,C-P*k,A-N*k,C+P*D,A+N*D,x,!0)+2:l.cap===Ne.Square&&(T+=Ss(C,A,P,N,k,D,!0,x))),x.push(C-P*k,A-N*k),x.push(C+P*D,A+N*D);for(var B=1;B<b-1;++B){C=t[2*(B-1)],A=t[2*(B-1)+1],M=t[2*B],I=t[2*B+1],R=t[2*(B+1)],O=t[2*(B+1)+1],P=-(A-I),N=C-M,P/=V=Math.sqrt(P*P+N*N)+z,N/=V,P*=_,N*=_,L=-(I-O),F=M-R,L/=V=Math.sqrt(L*L+F*F)+z,F/=V,L*=_,F*=_;var U=M-C,G=A-I,j=M-R,X=O-I,W=U*j+G*X,H=G*j-X*U,Y=H<0;if(Math.abs(H)<.001*Math.abs(W))x.push(M-P*k,I-N*k),x.push(M+P*D,I+N*D),W>=0&&(l.join===Le.Round?T+=Cs(M,I,M-P*k,I-N*k,M-L*k,I-F*k,x,!1)+4:T+=2,x.push(M-L*D,I-F*D),x.push(M+L*k,I+F*k));else{var Z=(-P+C)*(-N+I)-(-P+M)*(-N+A),q=(-L+R)*(-F+I)-(-L+M)*(-F+O),K=(U*q-j*Z)/H,Q=(X*Z-G*q)/H,J=(K-M)*(K-M)+(Q-I)*(Q-I),$=M+(K-M)*k,tt=I+(Q-I)*k,et=M-(K-M)*D,it=I-(Q-I)*D,rt=Y?k:D;J<=Math.min(U*U+G*G,j*j+X*X)+rt*rt*w?l.join===Le.Bevel||J/w>S?(Y?(x.push($,tt),x.push(M+P*D,I+N*D),x.push($,tt),x.push(M+L*D,I+F*D)):(x.push(M-P*k,I-N*k),x.push(et,it),x.push(M-L*k,I-F*k),x.push(et,it)),T+=2):l.join===Le.Round?Y?(x.push($,tt),x.push(M+P*D,I+N*D),T+=Cs(M,I,M+P*D,I+N*D,M+L*D,I+F*D,x,!0)+4,x.push($,tt),x.push(M+L*D,I+F*D)):(x.push(M-P*k,I-N*k),x.push(et,it),T+=Cs(M,I,M-P*k,I-N*k,M-L*k,I-F*k,x,!1)+4,x.push(M-L*k,I-F*k),x.push(et,it)):(x.push($,tt),x.push(et,it)):(x.push(M-P*k,I-N*k),x.push(M+P*D,I+N*D),l.join===Le.Round?T+=Y?Cs(M,I,M+P*D,I+N*D,M+L*D,I+F*D,x,!0)+2:Cs(M,I,M-P*k,I-N*k,M-L*k,I-F*k,x,!1)+2:l.join===Le.Miter&&J/w<=S&&(Y?(x.push(et,it),x.push(et,it)):(x.push($,tt),x.push($,tt)),T+=2),x.push(M-L*k,I-F*k),x.push(M+L*D,I+F*D),T+=2)}}C=t[2*(b-2)],A=t[2*(b-2)+1],M=t[2*(b-1)],P=-(A-(I=t[2*(b-1)+1])),N=C-M,P/=V=Math.sqrt(P*P+N*N)+z,N/=V,P*=_,N*=_,x.push(M-P*k,I-N*k),x.push(M+P*D,I+N*D),m||(l.cap===Ne.Round?T+=Cs(M-P*(k-D)*.5,I-N*(k-D)*.5,M-P*k,I-N*k,M+P*D,I+N*D,x,!1)+2:l.cap===Ne.Square&&(T+=Ss(M,I,P,N,k,D,!1,x)));for(var nt=E;nt<T+E-2;++nt)C=x[2*nt],A=x[2*nt+1],M=x[2*(nt+1)],I=x[2*(nt+1)+1],R=x[2*(nt+2)],O=x[2*(nt+2)+1],Math.abs(C*(I-O)+M*(O-A)+R*(A-I))<1e-8||o.push(nt,nt+1,nt+2)}}var Ms=function(){},Is="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Rs={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 a(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 o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function 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,_(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,_(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),_(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,_(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 _(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 w(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 S=4e150;function C(t,e){t.f+=e.f,t.b.f+=e.b.f}function A(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>=a(i.b.a,e.a,i.a):0<=a(e.b.a,i.a,e.a):0>=a(i.b.a,t,i.a):i.b.a===t?0<=a(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 I(t,e){p(t.a),t.c=!1,t.a=e,e.i=t}function R(t){var e=t.a.a;do{t=dt(t)}while(t.a.a===e);return t.c&&(I(t,e=v(ft(t).a.b,t.a.e)),t=dt(t)),t}function O(t,e,i){var r=new ct;return r.a=i,r.e=W(t.f,e.e,r),i.i=r}function P(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 L(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}I(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 F(t,e,i,r,n,a){var s=!0;do{O(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=P(t,r.f),e.b=!0,!s&&z(t,e)&&(C(i,n),M(e),p(n)),s=!1,e=r,n=i;e.b=!0,a&&U(t,e)}function V(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=i[0])}function k(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 D(t,e,i,r,n){var a=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),o=n+1;r[n]=.5*s/(a+s),r[o]=.5*a/(a+s),t.g[0]+=r[n]*e.g[0]+r[o]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[o]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[o]*i.g[2]}function z(t,e){var n=ft(e),s=e.a,o=n.a;if(r(s.a,o.a)){if(0<a(o.b.a,s.a,o.a))return!1;if(i(s.a,o.a)){if(s.a!==o.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;k(t,$(o),s)}}else m(o.b),d(s,$(o)),e.b=n.b=!0}else{if(0>a(s.b.a,o.a,s.a))return!1;dt(e).b=e.b=!0,m(s.b),d($(o),s)}return!0}function B(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(a(y,t.a,p),a(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<a(g,p,v))return!1}else if(0>a(y,v,p))return!1;var b,T,E=y,_=p,w=g,S=v;if(r(E,_)||(b=E,E=_,_=b),r(w,S)||(b=w,w=S,S=b),r(E,w)||(b=E,E=w,w=b,b=_,_=S,S=b),r(w,_)?r(_,S)?(0>(b=n(E,w,_))+(T=n(w,_,S))&&(b=-b,T=-T),x.b=c(b,w.b,T,_.b)):(0>(b=a(E,w,_))+(T=-a(E,S,_))&&(b=-b,T=-T),x.b=c(b,w.b,T,S.b)):x.b=(w.b+_.b)/2,s(E,_)||(b=E,E=_,_=b),s(w,S)||(b=w,w=S,S=b),s(E,w)||(b=E,E=w,w=b,b=_,_=S,S=b),s(w,_)?s(_,S)?(0>(b=o(E,w,_))+(T=o(w,_,S))&&(b=-b,T=-T),x.a=c(b,w.a,T,_.a)):(0>(b=u(E,w,_))+(T=-u(E,S,_))&&(b=-b,T=-T),x.a=c(b,w.a,T,S.a)):x.a=(w.a+_.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<=a(y,t.a,x)||!i(g,t.a)&&0>=a(g,t.a,x)){if(g===t.a)return m(l.b),d(f.b,l),l=ft(e=R(e)).a,L(t,ft(e),h),F(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),F(t,e,(f=L(t,h,null)).c,l.b.c,p,!0),!0}return 0<=a(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>=a(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,D(l,p,y,f,0),D(l,v,g,f,2),V(t,l,x,f,!0),dt(e).b=e.b=h.b=!0,!1}function U(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,o=i.a;if(n=s.b.a!==o.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>a(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<a(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(o),o=(i=ft(e)).a):e.c&&(M(e),p(s),s=(e=dt(i)).a)),s.a!==o.a)if(s.b.a===o.b.a||e.c||i.c||s.b.a!==t.a&&o.b.a!==t.a)z(t,e);else if(B(t,e))break;s.a===o.a&&s.b.a===o.b.a&&(C(o,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 o=(c=n.f).a;do{o=o.a}while(null!==o.b&&!c.c(c.b,h,o.b));var u=ft(c=o.b),h=c.a;o=u.a;if(0===a(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(o.b.a,h.b.a)?c:u;u=void 0;c.d||l.c?(u=l===c?v(s.c.b,h.e):v(o.b.c.b,s.c).b,l.c?I(l,u):(h=n,(c=O(n,c,u)).f=dt(c).f+c.a.f,c.d=P(h,c.f)),G(n,s)):F(n,c,s.c,s.c,null,!0)}return}if(c=(h=ft(n=R(n.i))).a,(h=L(t,h,null)).c===c){h=(c=h).c,o=ft(n),u=n.a,l=o.a;var c,f=!1;u.b.a!==l.b.a&&B(t,n),i(u.a,t.a)&&(d($(h),u),h=ft(n=R(n)).a,L(t,ft(n),o),f=!0),i(l.a,t.a)&&(d(c,$(l)),c=L(t,o,null),f=!0),f?F(t,n,c.c,h,h,!0):(s=r(l.a,u.a)?$(l):u,F(t,n,s=v(c.c.b,s),s.c,s.c,!1),s.b.i.c=!0,U(t,n))}else F(t,n,h.c,c,c,!0)}function j(t,e){var i=new ct,r=f(t.b);r.a.b=S,r.a.a=e,r.b.a.b=-S,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=W(r=t.f,r.a,i),i.e=r}function X(t){this.a=new H,this.b=t,this.c=A}function W(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i));return t=new H(i,e.a,e),e.a.c=t,e.a=t}function H(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 at}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(ot(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 at(){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 ot(t){return t.e[t.d[1]]}function ut(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),a}function ht(t,e){for(var i=t.d,n=t.e,a=t.c,s=e,o=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[o],n[h])){i[s]=o,a[o]=s;break}i[s]=h,a[h]=s,s=u}}function lt(t,e){for(var i=t.d,n=t.e,a=t.c,s=e,o=i[s];;){var u=s>>1,h=i[u];if(0===u||r(n[h],n[o])){i[s]=o,a[o]=s;break}i[s]=h,a[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 a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}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],o=this.j[2]];if(0===c&&0===n&&0===o){for(var n=[-2e150,-2e150,-2e150],s=[2e150,2e150,2e150],o=[],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,o[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],o=o[c],u=[0,0,0],s=[s.g[0]-o.g[0],s.g[1]-o.g[1],s.g[2]-o.g[2]],f=[0,0,0],c=t.e;c!==t;c=c.e)f[0]=c.g[0]-o.g[0],f[1]=c.g[1]-o.g[1],f[2]=c.g[2]-o.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[w(s)]=1)}t=!0}for(u=w(e),c=this.b.c,n=(u+1)%3,o=(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[o];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&&(k(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,-S),j(this,S);null!==(e=nt(this.e));){for(;;){t:if(c=this.e,0===c.a)t=ot(c.b);else if(t=c.c[c.d[c.a-1]],0!==c.b.a&&(c=ot(c.b),r(c,t))){t=c;break t}if(null===t||!i(t,e))break;t=nt(this.e),k(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&&(C(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,o=void 0;c.e!==n;)if(r(c.b.a,n.a)){for(;n.e!==c&&(h(n.e)||0>=a(n.a,n.b.a,n.e.b.a));)n=(o=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==c&&(l(c.c.b)||0<=a(c.b.a,c.a,c.c.b.a));)c=(o=v(c,c.c.b)).b;c=c.e}for(;n.e.e!==c;)n=(o=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,o=e.a.d;o!==e.a;o=o.d)if(o.c){c||(this.h&&this.h(4,this.c),c=!0),u=o.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!==o.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){o=(n=c.a).e,u=void 0;do{o=(u=o).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},Is.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=Is.libtess}(Rs);var Os=function(){var t=new Rs.exports.GluTesselator;return t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==Rs.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,i){return[t[0],t[1],t[2]]})),t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function Ps(t){Os.gluTessNormal(0,0,1);var e=[];Os.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){Os.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];Os.gluTessVertex(a,a)}Os.gluTessEndContour()}return Os.gluTessEndPolygon(),e}var Ns=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 a=Array.isArray(i[0])?i[0]:i;if("number"!=typeof a[0]){for(var s=[],o=0,u=a.length;o<u;o++)s.push(a[o].x,a[o].y);a=s}return n.points=a,n.closePath=!0,n}oe(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,a=r-1;n<r;a=n++){var s=this.points[2*n],o=this.points[2*n+1],u=this.points[2*a],h=this.points[2*a+1];o>e!=h>e&&t<(e-o)/(h-o)*(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,e){for(var i=0;i<this.points.length;i++)t[i]=this.points[i]},i.triangulate=function(t,e,i,r,n){var a=Ps([t]),s=e.length/2;0===a.length&&this.getLineEndPointsTriangle(t,a);for(var o=0;o<a.length;o++)e[2*i+o]=a[o];for(var u=a.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],a=t[1],s=t[0],o=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,a=l),h>s&&(s=h,o=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<a&&(n=f,a=d),d>o&&(s=f,o=d)}e.push(n,a,s,o,s,o)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},xr(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(Ms),Ls=8,Fs=1.1920929e-7;function Vs(t,e,i,r,n,a,s,o,u,h,l){var c=null!=l?l:1,f=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/c;return function(t,e,i,r,n,a,s,o,u,h){ks(t,e,i,r,n,a,s,o,u,h,0),u.push(s,o)}(e,i,r,n,a,s,o,u,t,f*=f),t}function ks(t,e,i,r,n,a,s,o,u,h,l){if(!(l>Ls)){var c=(t+i)/2,f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+s)/2,v=(a+o)/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-t,w=o-e,S=Math.abs((i-s)*w-(r-o)*_),C=Math.abs((n-s)*w-(a-o)*_);if(S>Fs&&C>Fs){if((S+C)*(S+C)<=h*(_*_+w*w))return void u.push(T,E)}else if(S>Fs){if(S*S<=h*(_*_+w*w))return void u.push(T,E)}else if(C>Fs){if(C*C<=h*(_*_+w*w))return void u.push(T,E)}else if((_=T-(t+s)/2)*_+(w=E-(e+o)/2)*w<=h)return void u.push(T,E)}ks(t,e,c,f,y,g,T,E,u,h,l+1),ks(T,E,x,b,m,v,s,o,u,h,l+1)}}var Ds,zs=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}oe(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 a=i/2,s=r-a,o=n-a,u=r+a,h=n+a,l=t-this.x,c=e-this.y;return l*l/(s*s)+c*c/(o*o)>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,e){var i=this.x,r=this.y,n=this.halfWidth,a=this.halfHeight;if(!(n>=0&&a>=0))return t;var s=null!=e?e:1,o=Math.ceil(Math.sqrt(s*(n+a))),u=8*o+0+0;if(0===u)return t;if(0===o)return t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,t[5]=t[7]=r-0,t;var h=0,l=4*o+0+2,c=l,f=u,d=0+n,p=0,m=i+d,v=i-d,y=r+p;t[h++]=m,t[h++]=y,t[--l]=y,t[--l]=v;for(var g=1;g<o;g++){var x=Math.PI/2*(g/o),b=0+Math.cos(x)*n,T=0+Math.sin(x)*a,E=i+b,_=i-b,w=r+T,S=r-T;t[h++]=E,t[h++]=w,t[--l]=w,t[--l]=_,t[c++]=_,t[c++]=S,t[--f]=S,t[--f]=E}m=i+(d=0),v=i-d,y=r+(p=0+a);var C=r-p;return t[h++]=m,t[h++]=y,t[--f]=C,t[--f]=m,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,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}(Ms);!function(t){t[t.Star=0]="Star",t[t.Polygon=1]="Polygon"}(Ds||(Ds={}));var Bs,Us=function(t){function e(e,i,r,n,a,s){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=0),(o=t.call(this)||this).pointCount=e,o.outerRadius=i,o.innerRadius=r,o.outerRoundness=n,o.innerRoundness=a,o.starType=s,o.v=[],o.in=[],o.out=[],o}oe(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,e){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var i=null!=e?e:1,r=0;r<this.v.length-2;r+=2)Vs(t,this.v[r],this.v[r+1],this.out[r],this.out[r+1],this.in[r+2],this.in[r+3],this.v[r+2],this.v[r+3],void 0,i);var n=this.v.length-1;Vs(t,this.v[n-1],this.v[n],this.out[n-1],this.out[n],this.in[0],this.in[1],this.v[0],this.v[1],void 0,i)},i.triangulate=function(t,e,i,r,n){for(var a=Ps([t]),s=e.length/2,o=0;o<a.length;o++)e[2*i+o]=a[o];for(var u=a.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),a=2*Math.PI/n,s=!0,o=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*o/(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?o: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*a}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,a=2*Math.PI*r/(4*e),s=.5*-Math.PI;for(t=0;t<e;t++){var o=r*Math.cos(s),u=r*Math.sin(s),h=0===o&&0===u?0:u/Math.sqrt(o*o+u*u),l=0===o&&0===u?0:-o/Math.sqrt(o*o+u*u),c=2*t;this.v[c]=o,this.v[c+1]=u,this.in[c]=o+h*a*n*1,this.in[c+1]=u+l*a*n*1,this.out[c]=o-h*a*n*1,this.out[c+1]=u-l*a*n*1,s+=1*i}},e}(Ms),Gs=function(t){function e(e,i,r,n,a){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=20),(s=t.call(this)||this).x=e,s.y=i,s.width=r,s.height=n,s.roundness=a,s}oe(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,e){var i,r=this.width/2,n=this.height/2,a=this.x+r,s=this.y+n,o=i=Math.max(0,Math.min(this.roundness/100,1)*Math.min(r,n)),u=r-o,h=n-i;if(o>=0&&i>=0&&u>=0&&h>=0){var l=null!=e?e:1,c=Math.ceil(Math.sqrt(l*(o+i))),f=8*c+(u?4:0)+(h?4:0);if(0!==f){if(0===c)return t[0]=t[6]=a+u,t[1]=t[3]=s+h,t[2]=t[4]=a-u,void(t[5]=t[7]=s-h);var d=0,p=4*c+(u?2:0)+2,m=p,v=f,y=u+o,g=h,x=a+y,b=a-y,T=s+g;if(t[d++]=x,t[d++]=T,t[--p]=T,t[--p]=b,h){var E=s-g;t[m++]=b,t[m++]=E,t[--v]=E,t[--v]=x}for(var _=1;_<c;_++){var w=Math.PI/2*(_/c),S=u+Math.cos(w)*o,C=h+Math.sin(w)*i,A=a+S,M=a-S,I=s+C,R=s-C;t[d++]=A,t[d++]=I,t[--p]=I,t[--p]=M,t[m++]=M,t[m++]=R,t[--v]=R,t[--v]=A}x=a+(y=u),b=a-y,T=s+(g=h+i);var O=s-g;t[d++]=x,t[d++]=T,t[--v]=O,t[--v]=x,u&&(t[d++]=b,t[d++]=T,t[--v]=O,t[--v]=b)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,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}(Ms),js=function(t){function e(e,i,r,n,a,s){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=0),(o=t.call(this)||this).x=e,o.y=i,o.x2=r,o.y2=n,o.x3=a,o.y3=s,o}oe(e,t);var i=e.prototype;return i.contains=function(t,e){var i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),r=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(i<0!=r<0&&0!==i&&0!==r)return!1;var n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return 0===n||n<0==i+r<=0},i.clone=function(){return new e(this.x,this.y,this.x2,this.y2,this.x3,this.y3)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getBounds=function(t){t=t||new Gs;var e=Math.min(this.x,this.x2,this.x3),i=Math.max(this.x,this.x2,this.x3),r=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=r,t.width=i-e,t.height=n-r,t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t,e){t[0]=this.x,t[1]=this.y,t[2]=this.x2,t[3]=this.y2,t[4]=this.x3,t[5]=this.y3},i.triangulate=function(t,e,i,r,n){var a=0;e[(i*=2)+a]=t[0],e[i+a+1]=t[1],e[i+(a+=2)]=t[2],e[i+a+1]=t[3],e[i+(a+=2)]=t[4],e[i+a+1]=t[5];var s=i/2;r[n++]=s,r[n++]=s+1,r[n++]=s+2},e}(Ms),Xs=function(t){function e(e,i,r){var n;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),(n=t.call(this)||this).x=e,n.y=i,n.radius=r,n}oe(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.radius)},i.contains=function(t,e){if(this.radius<=0)return!1;var i=this.radius*this.radius,r=this.x-t,n=this.y-e;return(r*=r)+(n*=n)<=i},i.strokeContains=function(t,e,i,r){if(void 0===r&&(r=.5),0===this.radius)return!1;var n=this.x-t,a=this.y-e,s=this.radius,o=(1-r)*i,u=Math.sqrt(n*n+a*a);return u<=s+o&&u>s-(i-o)},i.getBounds=function(t){return t||(t=new Gs),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t,e){var i=this.x,r=this.y,n=this.radius,a=this.radius;if(!(n<=0)){var s=null!=e?e:1,o=Math.ceil(Math.sqrt(s*(n+a))),u=8*o+0+0;if(0!==u){if(0===o)return t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,void(t[5]=t[7]=r-0);var h=0,l=4*o+0+2,c=l,f=u,d=0+n,p=0,m=i+d,v=i-d,y=r+p;t[h++]=m,t[h++]=y,t[--l]=y,t[--l]=v;for(var g=1;g<o;g++){var x=Math.PI/2*(g/o),b=0+Math.cos(x)*n,T=0+Math.sin(x)*a,E=i+b,_=i-b,w=r+T,S=r-T;t[h++]=E,t[h++]=w,t[--l]=w,t[--l]=_,t[c++]=_,t[c++]=S,t[--f]=S,t[--f]=E}m=i+(d=0),v=i-d,y=r+(p=0+a);var C=r-p;t[h++]=m,t[h++]=y,t[--f]=C,t[--f]=m}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,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}(Ms),Ws=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=Ze(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],n[7]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"lineTo":this.lineTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);break;case"circle":this.circle(n[0],n[1],n[2],n[3]);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"triangle":this.triangle(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,s,o){this.ensurePoly();var u=this.currentPoly;return Vs(u.points,u.lastX,u.lastY,t,e,i,r,n,a,s,o),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.lineTo=function(t,e){this.ensurePoly();var i=this.currentPoly.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new zs(t,e,i,r),n),this},e.circle=function(t,e,i,r){return this.drawShape(new Xs(t,e,i),r),this},e.polyStar=function(t,e,i,r,n,a,s){return this.drawShape(new Us(t,e,i,r,n,a),s),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new Gs(t,e,i,r,n),a),this},e.triangle=function(t,e,i,r,n,a,s){return this.drawShape(new js(t,e,i,r,n,a),s),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 Ns).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 Ns,this.currentPoly.points.push(0,0))},t}(),Hs=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,s,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,s,o]}),this.dirty=!0,this},e.lineTo=function(t,e){return this.instructions.push({action:"lineTo",data:[t,e]}),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.circle=function(t,e,i,r){return this.instructions.push({action:"circle",data:[t,e,i,r]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,a){return this.instructions.push({action:"rect",data:[t,e,i,r,n,a]}),this.dirty=!0,this},e.triangle=function(t,e,i,r,n,a,s){return this.instructions.push({action:"triangle",data:[t,e,i,r,n,a,s]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,a,s){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,a,s]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},xr(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new Ws(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();!function(t){t[t.EveryUpdate=0]="EveryUpdate",t[t.Manual=1]="Manual"}(Bs||(Bs={}));var Ys=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).items=[],e.state=wu.Stopped,e.updateMode=0,e.playOnStart=!1,e.endBehavior=ce.forward,e.time=0,e.lastTime=0,e.sceneBindings=[],e.timelineAsset=null,e._timelineInstance=null,e.nestedCompositions=[],e}oe(e,t);var i=e.prototype;return i.onStart=function(){this.playOnStart&&this.play()},i.pause=function(){this.state=wu.Paused;for(var t,e=Ze(this.nestedCompositions);!(t=e()).done;){t.value.pause()}},i.play=function(){this.state=wu.Playing;for(var t,e=Ze(this.nestedCompositions);!(t=e()).done;){t.value.play()}},i.stop=function(){this.state=wu.Stopped,this.time=0,this.lastTime=0;for(var t,e=Ze(this.nestedCompositions);!(t=e()).done;){t.value.stop()}},i.getTime=function(){return this.time},i.setTime=function(t){this.time=t},i.onUpdate=function(t){this.state===wu.Playing&&0===this.updateMode&&this.tick(t/1e3)},i.tick=function(t){if(this.timelineInstance){var e=this.time;if(wa(this.lastTime,this.time)&&(e+=t),e>this.item.duration)switch(this.endBehavior){case ce.forward:break;case ce.freeze:e=this.item.duration;break;case ce.restart:e%=this.item.duration;break;case ce.destroy:return void this.item.dispose()}this.timelineInstance.evaluate(e,t),this.lastTime=this.time=e}},i.onEnable=function(){this.item.getDescendants(!1,(function(t){return t.setActive(!0),!1}))},i.onDisable=function(){this.item.getDescendants(!1,(function(t){return t.setActive(!1),!1}))},i.onDestroy=function(){this.item.getDescendants().forEach((function(t){return t.dispose()}))},i.setChildrenRenderOrder=function(t){if(!this.timelineInstance)return t;var i=[];this.collectChildren(this.item,i);for(var r,n=new Set,a=Ze(this.timelineInstance.masterTrackInstances);!(r=a()).done;){var s=r.value;E(s.boundObject,oa)&&n.add(s.boundObject)}for(var o=[],u=0;u<i.length;u++)n.has(i[u])&&o.push(u);for(var h,l=[],c=Ze(this.timelineInstance.masterTrackInstances);!(h=c()).done;){var f=h.value;E(f.boundObject,oa)&&l.push(f.boundObject)}for(var d=0;d<o.length&&d<l.length;d++)i[o[d]]=l[d];for(var p,m=Ze(i);!(p=m()).done;){var v=p.value,y=t++;v.isManuallySetRenderOrder||v.setRendererComponentOrder(y);var g=v.getComponent(e);g&&(t=g.setChildrenRenderOrder(t))}return t},i.collectChildren=function(t,e){for(var i,r=Ze(t.children);!(i=r()).done;){var n=i.value;e.push(n),oa.isComposition(n)||this.collectChildren(n,e)}},i.fromData=function(e){t.prototype.fromData.call(this,e),this._timelineInstance=null},xr(e,[{key:"timelineInstance",get:function(){if(!this._timelineInstance&&this.timelineAsset){this._timelineInstance=new ec(this.timelineAsset,this.sceneBindings),this.nestedCompositions=[];for(var t,i=Ze(this._timelineInstance.masterTrackInstances);!(t=i()).done;){var r=t.value.boundObject;if(E(r,oa)&&oa.isComposition(r)){var n=r.getComponent(e);n.updateMode=1,this.nestedCompositions.push(n)}}}return this._timelineInstance}}]),e}(br);_([ti()],Ys.prototype,"items",void 0),_([ti()],Ys.prototype,"sceneBindings",void 0),_([ti()],Ys.prototype,"timelineAsset",void 0),Ys=_([$e("CompositionComponent")],Ys);var Zs=function(t){function e(e){var i;return(i=t.call(this,e)||this).getHitTestParams=function(t){var e=i.transform.getWorldMatrix();i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area,clipMasks:i.frameClipMasks}},i}oe(e,t);var i=e.prototype;return i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e=0;e<this.materials.length;e++){var i=this.materials[e];t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),i,e)}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++){var i=this.materials[e];this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),i,t,e)}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData("aPos");if(t){var e=Ca(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.mask;i&&this.maskManager.setMaskOptions(this.engine,i)},e}(Hn);_([ti()],Zs.prototype,"geometry",void 0);var qs=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}oe(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 W;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}(Zs);qs=_([$e(ze.EffectComponent)],qs);var Ks=new X(0,0,0),Qs=new X(0,0,0),Js=function(){this.target=null,this.weight=1},$s=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).positionAtRest=new X(0,0,0),e.positionOffset=new X(0,0,0),e.weight=1,e.constrainX=!0,e.constrainY=!0,e.constrainZ=!0,e.targets=[],e}oe(e,t);var i=e.prototype;return i.onStart=function(){var t=this.item.transform.getWorldPosition();this.positionAtRest.copyFrom(t)},i.onUpdate=function(t){if(0!==this.targets.length){Ks.set(0,0,0);for(var e,i=0,r=Ze(this.targets);!(e=r()).done;){var n=e.value;if(n.target){var a=n.target.transform.getWorldPosition(),s=n.weight;Ks.x+=a.x*s,Ks.y+=a.y*s,Ks.z+=a.z*s,i+=s}}i>0&&(Ks.x/=i,Ks.y/=i,Ks.z/=i),Ks.x+=this.positionOffset.x,Ks.y+=this.positionOffset.y,Ks.z+=this.positionOffset.z,Qs.set(this.lerp(this.positionAtRest.x,Ks.x,this.weight),this.lerp(this.positionAtRest.y,Ks.y,this.weight),this.lerp(this.positionAtRest.z,Ks.z,this.weight)),Ks.copyFrom(this.item.transform.getWorldPosition());var o=this.constrainX?Qs.x:Ks.x,u=this.constrainY?Qs.y:Ks.y,h=this.constrainZ?Qs.z:Ks.z;this.item.transform.setWorldPosition(o,u,h)}},i.addTarget=function(t,e){void 0===e&&(e=1);var i=new Js;i.target=t,i.weight=Math.max(0,Math.min(1,e)),this.targets.push(i)},i.removeTarget=function(t){var e=this.targets.findIndex((function(e){return e.target===t}));-1!==e&&this.targets.splice(e,1)},i.clearTargets=function(){this.targets=[]},i.setPositionOffset=function(t,e,i){this.positionOffset.set(t,e,i)},i.setWeight=function(t){this.weight=Math.max(0,Math.min(1,t))},i.lerp=function(t,e,i){return t+(e-t)*i},i.fromData=function(e){t.prototype.fromData.call(this,e),this.positionAtRest.copyFrom(e.positionAtRest),this.positionOffset.copyFrom(e.positionOffset),this.weight=e.weight,this.constrainX=e.constrainX,this.constrainY=e.constrainY,this.constrainZ=e.constrainZ,this.targets=[];for(var i,r=Ze(e.targets);!(i=r()).done;){var n=i.value,a=new Js;a.target=this.engine.findObject(n.target),a.weight=n.weight,this.targets.push(a)}},e}(br);$s=_([$e("PositionConstraint")],$s);var to=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 oe(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(br);_([ti()],to.prototype,"bloom",void 0),_([ti()],to.prototype,"vignette",void 0),_([ti()],to.prototype,"tonemapping",void 0),_([ti()],to.prototype,"colorAdjustments",void 0),to=_([$e(ze.PostProcessVolume)],to);var eo,io,ro="effects-internal-copy",no="effects-internal-copy-mesh",ao="\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}",so="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(t){t[t.Nearest=0]="Nearest",t[t.Linear=1]="Linear"}(eo||(eo={})),function(t){t[t.RGBA32=0]="RGBA32",t[t.RGBAHalf=1]="RGBAHalf"}(io||(io={}));var oo,uo,ho=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){},xr(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),lo=0,co=1e3,fo=3e3;!function(t){t[t.none=0]="none",t[t.color=1]="color",t[t.stencil_8_opaque=2]="stencil_8_opaque",t[t.depth_16_opaque=3]="depth_16_opaque",t[t.depth_stencil_opaque=4]="depth_stencil_opaque",t[t.depth_16_texture=5]="depth_16_texture",t[t.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture"}(oo||(oo={})),function(t){t[t.store=0]="store",t[t.clear=2]="clear"}(uo||(uo={}));var po,mo=function(){function t(t,e){if(this.destroyed=!1,e){var i=e.texture,r=e.size;if(E(i,cn))this.texture=i,this.externalTexture=!0;else if(i){var n=i.wrapT,a=i.wrapS,s=i.minFilter,o=i.magFilter,u=i.internalFormat,h=i.format,l=void 0===h?Rr.RGBA:h,c=i.type,f=void 0===c?Rr.UNSIGNED_BYTE:c;this.externalTexture=!1,this.textureOptions={size:r,format:l,type:f,internalFormat:u||l,wrapT:n,wrapS:a,minFilter:s,magFilter:o,name:e.name},this.texture=cn.create(t,gi({},this.textureOptions,{sourceType:Mr.framebuffer,data:{width:r[0],height:r[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},xr(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}();!function(t){t[t.force=0]="force",t[t.keep=1]="keep",t[t.keepExternal=2]="keepExternal",t[t.destroy=0]="destroy"}(po||(po={}));var vo,yo=1,go=function(){function t(t){this.priority=0,this.name="RenderPass"+yo++,this.meshes=[],this.disposed=!1,this.framebuffer=null,this.renderer=t}var e=t.prototype;return e.addMesh=function(t){ft(this.meshes,t)},e.removeMesh=function(t){N(this.meshes,t)},e.configure=function(t){},e.execute=function(t){},e.onCameraCleanup=function(t){},e.getViewport=function(){var t,e=null==(t=this.framebuffer)?void 0:t.viewport;if(e)return e;var i=this.renderer;return i?[0,0,i.getWidth(),i.getHeight()]:[0,0,0,0]},e.dispose=function(t){if(!this.disposed){var e=(null==t?void 0:t.meshes)||void 0;e!==_t.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0,this.disposed=!0}},xr(t,[{key:"isDisposed",get:function(){return this.disposed}},{key:"viewport",get:function(){return this.getViewport()}}]),t}(),xo=function(t){function e(e){var i;return(i=t.call(this,e)||this).useRenderTarget=!1,i.priority=1e3,i.name="DrawObjectPass",i}oe(e,t);var i=e.prototype;return i.setup=function(t){this.useRenderTarget=t},i.configure=function(t){this.useRenderTarget&&(this.framebuffer=t.getTemporaryRT("DrawObjectPass",t.getWidth(),t.getHeight(),16,eo.Linear,io.RGBAHalf),t.setFramebuffer(this.framebuffer))},i.execute=function(t){this.useRenderTarget&&t.clear({colorAction:Ar.clear,depthAction:Ar.clear,stencilAction:Ar.clear}),this.meshes.sort((function(t,e){return t.priority-e.priority})),t.renderMeshes(this.meshes)},i.onCameraCleanup=function(t){this.useRenderTarget&&this.framebuffer&&t.releaseTemporaryRT(this.framebuffer)},e}(go),bo=((vo={})[Rr.FLOAT]=Float32Array.BYTES_PER_ELEMENT,vo[Rr.INT]=Int32Array.BYTES_PER_ELEMENT,vo[Rr.SHORT]=Int16Array.BYTES_PER_ELEMENT,vo[Rr.BYTE]=Int8Array.BYTES_PER_ELEMENT,vo),To=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}oe(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(ii);function Eo(t){return t===Rr.INT?new Int32Array(0):t===Rr.SHORT?new Int16Array(0):new Float32Array(0)}var _o=1,wo=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,a=i.geometry,s=i.name,o=void 0===s?"<unnamed>":s,u=i.priority,h=void 0===u?0:u,l=i.worldMatrix,c=void 0===l?Sn.fromIdentity():l;r.id="Mesh"+_o++,r.name=o,r.geometry=a,r.material=n,r.priority=h,r.worldMatrix=c}else r.id="Mesh"+_o++,r.name="<unnamed>",r.worldMatrix=Sn.fromIdentity(),r._priority=0;return r}oe(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!==_t.keep&&this.material.dispose(),this.material=t},i.restore=function(){},i.dispose=function(e){this.destroyed||((null==e?void 0:e.geometries)!==_t.keep&&this.geometry.dispose(),(null==e?void 0:e.material)!==_t.keep&&this.material.dispose(),this.destroyed=!0,void 0!==this.engine&&this.engine.removeMesh(this),t.prototype.dispose.call(this))},xr(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Hn),So="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.;}",Co="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);}}",Ao="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;}",Mo="#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",Io="#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;}}",Ro="#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;}",Oo="#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.;}",Po="#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",No="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",Lo="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);}",Fo="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);}",Vo="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);}",ko="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);}",Do="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);}",zo={},Bo=function(){function t(){}return t.registerInclude=function(t,e){zo[t]&&wt.warn('The "'+t+'" shader include already exist.'),zo[t]=e},t.unRegisterInclude=function(t){delete zo[t]},t.unRegisterAllIncludes=function(){Object.keys(zo).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var i=e.level,r=e.shaderType,n=e.shader,a=e.macros,s=e.removeVersion,o=t.genMacroString(i,a),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===Tr.fragment)),s?o+h:u+o+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=zo[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 a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[1])}return i.forEach((function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},t}(),Uo=function(t){function e(e,i){var r;void 0===i&&(i=4),(r=t.call(this,e)||this).tempRTs=[],r.iterationCount=i;var n=r.renderer.engine;return r.thresholdMaterial=zn.create(n,{shader:{vertex:No,fragment:Do,glslVersion:Rn.GLSL1}}),r.thresholdMaterial.blending=!1,r.thresholdMaterial.depthTest=!1,r.thresholdMaterial.culling=!1,r.downSampleHMaterial=zn.create(n,{shader:{vertex:No,fragment:Fo,glslVersion:Rn.GLSL1}}),r.downSampleHMaterial.blending=!1,r.downSampleHMaterial.depthTest=!1,r.downSampleHMaterial.culling=!1,r.downSampleVMaterial=zn.create(n,{shader:{vertex:No,fragment:Vo,glslVersion:Rn.GLSL1}}),r.downSampleVMaterial.blending=!1,r.downSampleVMaterial.depthTest=!1,r.downSampleVMaterial.culling=!1,r.upSampleMaterial=zn.create(n,{shader:{vertex:No,fragment:ko,glslVersion:Rn.GLSL1}}),r.upSampleMaterial.blending=!1,r.upSampleMaterial.depthTest=!1,r.upSampleMaterial.culling=!1,r.priority=5e3,r.name="BloomPass",r}oe(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture},i.execute=function(t){var e,i,r,n=t.getWidth(),a=t.getHeight(),s=null!=(r=null==(i=t.renderingData.currentFrame.globalVolume)||null==(e=i.bloom)?void 0:e.threshold)?r:1;this.thresholdRT=t.getTemporaryRT("_BloomThreshold",n,a,0,eo.Linear,io.RGBAHalf),this.thresholdMaterial.setFloat("_Threshold",s),t.blit(this.mainTexture,this.thresholdRT,this.thresholdMaterial);for(var o=this.thresholdRT.getColorTextures()[0],u=0;u<this.iterationCount;u++){var h=Math.floor(n/Math.pow(2,u+1)),l=Math.floor(a/Math.pow(2,u+1)),c=t.getTemporaryRT("_BloomDownH"+u,h,l,0,eo.Linear,io.RGBAHalf);this.downSampleHMaterial.setVector2("_TextureSize",Wo(o)),t.blit(o,c,this.downSampleHMaterial);var f=t.getTemporaryRT("_BloomDownV"+u,h,l,0,eo.Linear,io.RGBAHalf);this.downSampleVMaterial.setVector2("_TextureSize",Wo(c.getColorTextures()[0])),t.blit(c.getColorTextures()[0],f,this.downSampleVMaterial),t.releaseTemporaryRT(c),this.tempRTs.push(f),o=f.getColorTextures()[0]}t.releaseTemporaryRT(this.thresholdRT);for(var d=this.iterationCount-1;d>0;d--){var p=Math.floor(n/Math.pow(2,d-1)),m=Math.floor(a/Math.pow(2,d-1)),v=t.getTemporaryRT("_BloomUp"+d,p,m,0,eo.Linear,io.RGBAHalf),y=this.tempRTs[d-1].getColorTextures()[0];this.upSampleMaterial.setTexture("_GaussianDownTex",y),this.upSampleMaterial.setVector2("_GaussianDownTextureSize",Wo(y)),t.blit(o,v,this.upSampleMaterial),o=v.getColorTextures()[0],this.tempRTs.push(v)}t.setFramebuffer(this.tempRTs[this.tempRTs.length-1])},i.onCameraCleanup=function(t){for(var e=0;e<this.tempRTs.length;e++)t.releaseTemporaryRT(this.tempRTs[e]);this.tempRTs=[]},i.dispose=function(e){this.thresholdMaterial.dispose(),this.downSampleHMaterial.dispose(),this.downSampleVMaterial.dispose(),this.upSampleMaterial.dispose(),t.prototype.dispose.call(this,e)},e}(go),Go=function(t){function e(e,i){var r,n="PostProcess",a=(r=t.call(this,e)||this).renderer.engine;r.sceneTextureHandle=i||new mo(a);var s=To.create(a,{name:n,mode:Rr.TRIANGLE_STRIP,attributes:{aPos:{type:Rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=zn.create(a,{name:n,shader:{vertex:No,fragment:Lo,glslVersion:Rn.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,r.screenMesh=wo.create(a,{name:n,geometry:s,material:o,priority:0}),r.priority=5e3,r.name="ToneMappingPass",r}oe(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:Ar.clear,depthAction:Ar.clear,stencilAction:Ar.clear});var e=t.renderingData.currentFrame.globalVolume,i=gi({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),r=gi({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=gi({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),a=gi({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 j(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new X(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(a.active)),t.renderMeshes([this.screenMesh])},e}(go),jo=1,Xo=function(){function t(t){this.disposed=!1,this.postProcessingEnabled=!1,this.enableHDR=!0;var e=t.camera,i=t.renderer,r=t.editorTransform,n=void 0===r?[1,1,0,0]:r,a=t.globalVolume,s=t.postProcessingEnabled,o=void 0!==s&&s,u=i.engine;if(a&&(this.globalVolume=a),this.postProcessingEnabled=o,this.globalUniforms=new Yo,this.renderer=i,o&&this.enableHDR&&!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");this.drawObjectPass=new xo(i);var h=[this.drawObjectPass];if(this.setRenderPasses(h),o){var l=new mo(u),c=new Uo(i,7);c.sceneTextureHandle=l,this.addRenderPass(c);var f=new Go(i,l);this.addRenderPass(f)}this.name="RenderFrame"+jo++,this.camera=e,this.editorTransform=W.fromArray(n)}var e=t.prototype;return e.setup=function(){this.drawObjectPass.setup(this.postProcessingEnabled)},e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){var e=(null==t?void 0:t.passes)?t.passes:void 0;e!==_t.keep&&this.renderPasses.forEach((function(t){t.dispose(e)})),this.renderPasses.length=0,this.disposed=!0},e.setRenderPasses=function(t){this.renderPasses=t.slice()},e.addRenderPass=function(t){this.renderPasses.push(t)},e.removeRenderPass=function(t){N(this.renderPasses,t)},xr(t,[{key:"isDisposed",get:function(){return this.disposed}}]),t}();function Wo(t){return t?new j(t.getWidth(),t.getHeight()):new j}var Ho,Yo=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Zo=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 xr(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),qo=function(){function t(t){this.engine=t,this.temporaryRTs=[],this.currentFrame=0,this.maxUnusedFrames=4}var e=t.prototype;return e.flush=function(t,e){void 0===t&&(t=!1),void 0===e&&(e=-1),this.currentFrame++;for(var i=e>=0?e:this.maxUnusedFrames,r=0;r<this.temporaryRTs.length;r++){var n=this.temporaryRTs[r];!n.isOccupied&&(t||this.currentFrame-n.lastFrameReleased>i)&&(n.RT.dispose(),this.temporaryRTs.splice(r--,1))}},e.get=function(t,e,i,r,n,a){void 0===r&&(r=0),void 0===n&&(n=eo.Linear),void 0===a&&(a=io.RGBA32);for(var s,o,u,h=e+"_"+i+"_"+r+"_"+n+"_"+a,l=Ze(this.temporaryRTs);!(s=l()).done;){var c=s.value;if(!c.isOccupied&&c.descriptionHash===h)return c.isOccupied=!0,c.RT.name=t,c.RT}var f=oo.none;n===eo.Linear?o=Rr.LINEAR:n===eo.Nearest&&(o=Rr.NEAREST),a===io.RGBA32?u=Rr.UNSIGNED_BYTE:a===io.RGBAHalf&&(u=Rr.HALF_FLOAT),0===r?f=oo.none:16===r?f=oo.depth_stencil_opaque:24===r&&(f=oo.depth_24_stencil_8_texture);var d=cn.create(this.engine,{sourceType:Mr.framebuffer,minFilter:o,magFilter:o,internalFormat:Rr.RGBA,format:Rr.RGBA,type:u}),p={RT:ho.create({name:t,storeAction:{},viewport:[0,0,e,i],attachments:[d],depthStencilAttachment:{storageType:f}},this.engine.renderer),lastFrameReleased:0,descriptionHash:h,isOccupied:!0};return this.temporaryRTs.push(p),p.RT},e.release=function(t){for(var e,i=Ze(this.temporaryRTs);!(e=i()).done;){var r=e.value;if(r.RT===t){r.isOccupied=!1,r.lastFrameReleased=this.currentFrame;break}}},e.dispose=function(){for(var t,e=Ze(this.temporaryRTs);!(t=e()).done;){t.value.RT.dispose()}},t}(),Ko="function"==typeof a,Qo=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.isCompressedFormatSupported=function(t){return!!this.compressTextureCapabilityList.get(t)},e.setupCapability=function(t){var e,i=Ko&&E(t,a)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),s=t.getExtension("WEBGL_depth_texture"),o=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),s&&(this.UNSIGNED_INT_24_8=s.UNSIGNED_INT_24_8_WEBGL),r&&!o&&(o=Jo(t,t.HALF_FLOAT)),r&&!u&&(u=Jo(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=r||t.getExtension("OES_texture_float")?t.FLOAT:0,l=r?a.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0;this.compressTextureCapabilityList=new Map([["WEBGL_compressed_texture_astc",!!t.getExtension("WEBGL_compressed_texture_astc")],["WEBKIT_WEBGL_compressed_texture_astc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_astc")],["WEBGL_compressed_texture_etc",!!t.getExtension("WEBGL_compressed_texture_etc")],["WEBKIT_WEBGL_compressed_texture_etc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_etc")],["WEBGL_compressed_texture_etc1",!!t.getExtension("WEBGL_compressed_texture_etc1")],["WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBGL_compressed_texture_pvrtc")||!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["WEBKIT_WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["EXT_sRGB",!!t.getExtension("EXT_sRGB")]]);var c,f,d={floatTexture:h,halfFloatTexture:l,maxSample:r?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),halfFloatLinear:o,floatLinear:u,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),ktx2Support:(c=this.compressTextureCapabilityList,f=c.get("WEBGL_compressed_texture_astc")||c.get("WEBKIT_WEBGL_compressed_texture_astc"),!!f),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!s,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=d,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw new Error("Draw multiple color buffers not available.");var s=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];s?t.framebufferTexture2D(e,s,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.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.")},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},xr(t,[{key:"isWebGL2",get:function(){return 2===this.level}}]),t}();function Jo(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(t){t.astc="WEBGL_compressed_texture_astc",t.astc_webkit="WEBKIT_WEBGL_compressed_texture_astc",t.etc="WEBGL_compressed_texture_etc",t.etc_webkit="WEBKIT_WEBGL_compressed_texture_etc",t.etc1="WEBGL_compressed_texture_etc1",t.pvrtc="WEBGL_compressed_texture_pvrtc",t.pvrtc_webkit="WEBKIT_WEBGL_compressed_texture_pvrtc",t.sRGB="EXT_sRGB"}(Ho||(Ho={}));var $o,tu=function(){function t(t){this.engine=t,this.currentFramebuffer=null,this.disposed=!1,this.blitGeometry=null,this.blitMaterial=null}var e=t.prototype;return e.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},e.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},e.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},e.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},e.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},e.getFramebuffer=function(){return this.currentFramebuffer},e.setFramebuffer=function(t){t?(this.currentFramebuffer=t,this.currentFramebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.currentFramebuffer=null,this.engine.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},e.setViewport=function(t,e,i,r){this.engine.viewport(t,e,i,r)},e.clear=function(t){this.engine.clear(t)},e.getWidth=function(){return this.engine.getWidth()},e.getHeight=function(){return this.engine.getHeight()},e.getShaderLibrary=function(){return this.engine.getShaderLibrary()},e.renderRenderFrame=function(t){var e,i=t,r=i.renderPasses;if(this.disposed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=i.renderer.engine.getShaderLibrary())||e.compileAllShaders(),i.setup(),this.setFramebuffer(null);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),ct(r);for(var a,s=Ze(r);!(a=s()).done;){var o=a.value;this.renderRenderPass(o)}for(var u,h=Ze(r);!(u=h()).done;){u.value.onCameraCleanup(this)}}},e.renderRenderPass=function(t){this.renderingData.currentPass=t,t.configure(this),t.execute(this)},e.renderMeshes=function(t){for(var e,i=Ze(t);!(e=i()).done;){e.value.render(this)}},e.drawGeometry=function(t,e,i,r){void 0===r&&(r=0),this.engine.drawGeometry(t,e,i,r)},e.getTemporaryRT=function(t,e,i,r,n,a){return this.engine.renderTargetPool.get(t,e,i,r,n,a)},e.releaseTemporaryRT=function(t){this.engine.renderTargetPool.release(t)},e.blit=function(t,e,i){this.blitGeometry||(this.blitGeometry=To.create(this.engine,{mode:Rr.TRIANGLE_STRIP,attributes:{aPos:{type:Rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4})),this.blitMaterial||(this.blitMaterial=zn.create(this.engine,{shader:{vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos, 0.0, 1.0);\n vTex = (aPos + vec2(1.0)) / 2.0;\n}",fragment:"\nprecision mediump float;\nvarying vec2 vTex;\nuniform sampler2D _MainTex;\nvoid main(){\n gl_FragColor = texture2D(_MainTex, vTex);\n}"}}),this.blitMaterial.blending=!1,this.blitMaterial.depthTest=!1,this.blitMaterial.culling=!1);var r=i||this.blitMaterial;r.setTexture("_MainTex",t);var n=this.currentFramebuffer;if(e){var a=e.viewport,s=a[0],o=a[1],u=a[2],h=a[3];this.setFramebuffer(e),this.setViewport(s,o,u,h)}else this.setFramebuffer(null),this.setViewport(0,0,this.getWidth(),this.getHeight());this.drawGeometry(this.blitGeometry,Sn.IDENTITY,r),this.setFramebuffer(n)},e.dispose=function(){var t,e;this.disposed||(null==(t=this.blitGeometry)||t.dispose(),this.blitGeometry=null,null==(e=this.blitMaterial)||e.dispose(),this.blitMaterial=null,this.disposed=!0)},e.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},t.create=function(e){return new t(e)},xr(t,[{key:"renderingData",get:function(){return this.engine.renderingData}}]),t}(),eu=function(){function t(t){this.engine=t,this.graphicsPath=new Hs,this.vertices=[],this.colors=[],this.indices=[],this.lineStyle={width:1,alignment:.5,cap:Ne.Butt,join:Le.Miter,miterLimit:10},this.transformStack=[],this.currentTransform=An.fromIdentity(),this.geometry=To.create(this.engine,{attributes:{aPos:{type:Rr.FLOAT,size:2,data:new Float32Array([-.5,.5,-.5,-.5,.5,.5,.5,-.5])},aColor:{type:Rr.FLOAT,size:4,data:new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])},aUV:{size:2,offset:0,releasable:!0,type:Rr.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:Rr.TRIANGLES,drawCount:6}),this.material=zn.create(this.engine,{shader:{vertex:"attribute vec2 aPos;\n attribute vec4 aColor;\n varying vec4 vColor;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision mediump float;\n varying vec4 vColor;\n void main() {\n vec4 color = vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.material.depthTest=!1,this.material.depthMask=!1,this.material.blending=!0}var e=t.prototype;return e.begin=function(){this.indices.length=0,this.vertices.length=0,this.colors.length=0,this.transformStack=[],this.currentTransform=An.fromIdentity();var t=this.engine.canvas.getBoundingClientRect(),e=t.width,i=t.height,r=new Sn(2/e,0,0,0,0,2/i,0,0,0,0,-1,0,-1,-1,0,1);this.material.setMatrix("effects_MatrixVP",r)},e.pushTransform=function(t){this.transformStack.push(this.currentTransform.clone()),this.currentTransform=this.currentTransform.premultiply(t)},e.popTransform=function(){var t=this.transformStack.pop();t?this.currentTransform=t:console.warn("Render2D: 变换栈为空,无法弹出")},e.end=function(){if(0!==this.currentVertexCount&&0!==this.currentIndexCount){var t=new Float32Array(this.vertices),e=new Float32Array(this.colors),i=new Uint16Array(this.indices);this.geometry.setAttributeData("aPos",t),this.geometry.setAttributeData("aColor",e),this.geometry.setIndexData(i),this.geometry.setDrawCount(this.currentIndexCount),this.engine.renderer.drawGeometry(this.geometry,Sn.IDENTITY,this.material)}},e.drawLines=function(t,e,i){if(void 0===e&&(e=H.WHITE),void 0===i&&(i=1),!t||t.length<4||t.length%2!=0)console.warn("drawLines: 至少需要2个点(4个数值), 且数组长度必须为偶数");else{var r=t.length/2,n=t[0]===t[t.length-2]&&t[1]===t[t.length-1],a=n?r-1:r;this.graphicsPath.clear(),this.graphicsPath.moveTo(t[0],t[1]);for(var s=1;s<a;s++)this.graphicsPath.lineTo(t[2*s],t[2*s+1]);this.buildShapeLine(this.graphicsPath.shapePath,e,i,n)}},e.drawLine=function(t,e,i,r,n,a){void 0===n&&(n=H.WHITE),void 0===a&&(a=1),this.graphicsPath.clear(),this.graphicsPath.moveTo(t,e),this.graphicsPath.lineTo(i,r),this.buildShapeLine(this.graphicsPath.shapePath,n,a,closed)},e.drawBezier=function(t,e,i,r,n,a,s,o,u,h){void 0===u&&(u=H.WHITE),void 0===h&&(h=1),this.graphicsPath.clear(),this.graphicsPath.moveTo(t,e),this.graphicsPath.bezierCurveTo(i,r,n,a,s,o),this.buildShapeLine(this.graphicsPath.shapePath,u,h,!1)},e.drawTriangle=function(t,e,i,r,n,a,s,o){void 0===s&&(s=H.WHITE),void 0===o&&(o=1),this.graphicsPath.clear(),this.graphicsPath.triangle(t,e,i,r,n,a),this.buildShapeLine(this.graphicsPath.shapePath,s,o,!0)},e.drawRectangle=function(t,e,i,r,n,a){void 0===n&&(n=H.WHITE),void 0===a&&(a=1),this.graphicsPath.clear(),this.graphicsPath.rect(t,e,i,r,0),this.buildShapeLine(this.graphicsPath.shapePath,n,a,!0)},e.drawCircle=function(t,e,i,r,n){void 0===r&&(r=H.WHITE),void 0===n&&(n=1),this.graphicsPath.clear(),this.graphicsPath.circle(t,e,i),this.buildShapeLine(this.graphicsPath.shapePath,r,n,!0)},e.fillTriangle=function(t,e,i,r,n,a,s){void 0===s&&(s=H.WHITE),this.graphicsPath.clear(),this.graphicsPath.triangle(t,e,i,r,n,a),this.buildShape(this.graphicsPath.shapePath,s)},e.fillRectangle=function(t,e,i,r,n){void 0===n&&(n=H.WHITE),this.graphicsPath.clear(),this.graphicsPath.rect(t,e,i,r,0),this.buildShape(this.graphicsPath.shapePath,n)},e.fillCircle=function(t,e,i,r){void 0===r&&(r=H.WHITE),this.graphicsPath.clear(),this.graphicsPath.circle(t,e,i),this.buildShape(this.graphicsPath.shapePath,r)},e.dispose=function(){this.geometry.dispose(),this.material.dispose()},e.buildShape=function(t,e){for(var i,r=Ze(t.shapePrimitives);!(i=r()).done;){var n=i.value.shape,a=[],s=this.indices.length,o=this.vertices.length/2;n.build(a),n.triangulate(a,this.vertices,o,this.indices,s),this.applyTransformAndColor(o,this.vertices.length/2-o,e)}},e.buildShapeLine=function(t,e,i,r){void 0===r&&(r=!1);for(var n,a=Ze(t.shapePrimitives);!(n=a()).done;){var s=n.value.shape,o=[];this.indices.length;var u=this.vertices.length/2;s.build(o),this.lineStyle.width=i,As(o,this.lineStyle,!1,r,this.vertices,0,0,this.indices),this.applyTransformAndColor(u,this.vertices.length/2-u,e)}},e.applyTransformAndColor=function(t,e,i){for(var r=0;r<e;r++){var n=2*(t+r),a=4*(t+r);this.applyTransform(this.vertices[n],this.vertices[n+1],this.vertices,n),this.colors[a]=i.r,this.colors[a+1]=i.g,this.colors[a+2]=i.b,this.colors[a+3]=i.a}},e.applyTransform=function(t,e,i,r){void 0===r&&(r=0);var n=this.currentTransform.elements;i[r]=n[0]*t+n[3]*e+n[6],i[r+1]=n[1]*t+n[4]*e+n[7]},xr(t,[{key:"currentVertexCount",get:function(){return this.vertices.length/2}},{key:"currentIndexCount",get:function(){return this.indices.length}}]),t}(),iu=function(t){function e(e){var i;(i=t.call(this,e)||this).visible=!0,i._color=new H(1,1,1,1),i.getHitTestParams=function(t){var e=Sn.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.boundingBoxInfo.setGeometry(i.geometry,e);var n,a=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(a)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===Zt.FRONT,clipMasks:i.frameClipMasks}}},i.renderer={renderMode:ee.MESH,blending:Yt.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:Zt.DOUBLE,mask:0},i.defaultGeometry=To.create(i.engine,{attributes:{aPos:{type:Rr.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:Rr.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:Rr.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var r=zn.create(i.engine,{shader:{fragment:Ao,vertex:Co,shared:!0}});return i.material=r,i.material.setColor("_Color",new H(1,1,1,1)),i.configureMaterial(i.renderer),i}oe(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){E(t,H)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return T((function(){var i;return w(this,(function(r){switch(r.label){case 0:return"string"!=typeof t?[3,2]:[4,cn.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.onUpdate=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!==ee.BILLBOARD&&this.renderer.renderMode!==ee.VERTICAL_BILLBOARD&&this.renderer.renderMode!==ee.HORIZONTAL_BILLBOARD||i.setVector3("_Scale",this.transform.scale)}},i.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t,this),this.draw(t))},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.materials[e],t,e)},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle(this.transform.size)},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData("aPos");if(t){var e=Ca(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.texture,a=this.maskManager.maskMode,s=this.material;s.blending=!0,s.depthTest=!0,s.depthMask=i,zr(s,r),Br(s,e),s.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',s.setVector4("_TexOffset",new W(0,0,1,1)),s.setTexture("_MainTex",n);var o=Dr(r),u=new W;return u.x=t.occlusion?+t.transparentOcclusion:1,u.y=o,u.z=t.renderMode,u.w=a,s.setVector4("_TexParams",u),0===u.x||this.maskManager.alphaMaskEnabled?s.enableMacro("ALPHA_CLIP"):s.disableMacro("ALPHA_CLIP"),s},i.draw=function(t){for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.materials[e],e)},i.fromData=function(e){var i;t.prototype.fromData.call(this,e);var r,n,a,s=null!=(i=e.renderer)?i:{},o=e.mask;o&&this.maskManager.setMaskOptions(this.engine,o),this.renderer={renderMode:null!=(r=s.renderMode)?r:ee.MESH,blending:null!=(n=s.blending)?n:Yt.ALPHA,texture:s.texture?this.engine.findObject(s.texture):this.engine.whiteTexture,occlusion:!!s.occlusion,transparentOcclusion:!!s.transparentOcclusion||this.maskManager.maskMode===Er.MASK,side:null!=(a=s.side)?a:Zt.DOUBLE,mask:this.maskManager.getRefValue()},this.configureMaterial(this.renderer)},xr(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(Hn);!function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}($o||($o={}));var ru=function(t){function e(e){var i;(i=t.call(this,e)||this).shapeDirty=!0,i.materialDirty=!0,i.graphicsPath=new Hs,i.fills=[],i.strokeAttributes={width:1,alignment:.5,cap:Ne.Butt,join:Le.Miter,miterLimit:10},i.strokeWidth=1,i.strokeCap=Ne.Butt,i.strokeJoin=Le.Miter,i.strokes=[],i.fillMaterials=[],i.strokeMaterials=[],i.getHitTestParams=function(t){var e=Sn.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix());if(t){i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{behavior:0,type:r.type,triangles:r.area,backfaceCulling:i.rendererOptions.side===Zt.FRONT,clipMasks:i.frameClipMasks}}},i.rendererOptions={renderMode:ee.MESH,blending:Yt.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:Zt.DOUBLE,mask:0};var r={type:Re.Solid,color:new H(1,1,1,1)};i.strokes.push(r);var n={type:Re.Solid,color:new H(1,1,1,1)};return i.fills.push(n),i.shapeAttributes={type:Pe.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i.geometry=To.create(i.engine,{attributes:{aPos:{type:Rr.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:Rr.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:Rr.TRIANGLES,drawCount:6}),i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),i}oe(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){if(this.shapeDirty){var e=this.computeScreenScale();this.buildPath(this.shapeAttributes,e),this.buildGeometryFromPath(this.graphicsPath.shapePath,e),this.shapeDirty=!1}this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.draw(t)},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=0;e<this.fillMaterials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],t,0);for(var i=0;i<this.strokeMaterials.length;i++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],t,1)}},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.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData("aPos");if(t){var e=Ca(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.buildGeometryFromPath=function(t,e){var i=t.shapePrimitives,r=[],n=[];if(this.fills.length>0)for(var a,s=Ze(i);!(a=s()).done;){var o=a.value.shape,u=[],h=n.length,l=r.length/2;o.build(u,e),o.triangulate(u,r,l,n,h)}var c=n.length;if(this.strokes.length>0)for(var f,d=Ze(i);!(f=d()).done;){var p=f.value.shape,m=[],v=this.strokeAttributes;v.cap=this.strokeCap,v.join=this.strokeJoin,v.width=this.strokeWidth;var y=!0;this.shapeAttributes.type===Pe.Custom&&(y=p.closePath),p.build(m,e),As(m,v,!1,y,r,0,0,n)}var g=n.length-c,x=r.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<n.length)&&(E=new Uint16Array(n.length));for(var _=Number.MAX_VALUE,w=Number.MAX_VALUE,S=Number.MIN_VALUE,C=Number.MIN_VALUE,A=0;A<x;A++){var M=3*A,I=2*A,R=r[I],O=r[I+1];b[M]=R,b[M+1]=O,b[M+2]=0,_=Math.min(_,R),w=Math.min(w,O),S=Math.max(S,R),C=Math.max(C,O)}for(var P=S-_,N=C-w,L=0;L<x;L++){var F=3*L,V=2*L;T[V]=(b[F]-_)/P,T[V+1]=(b[F+1]-w)/N}E.set(n),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(n.length);var k=this.geometry.subMeshes[0],D=this.geometry.subMeshes[1];k.indexCount=c,D.offset=2*c,D.indexCount=g},i.computeScreenScale=function(){var t=this.item.composition;if(!t)return 1;var i=t.camera;if(!i)return 1;var r=i.getModelViewProjection(e.tempMVP,this.transform.getWorldMatrix()).elements,n=Math.abs(r[15])||1,a=Math.sqrt(r[0]*r[0]+r[1]*r[1])/n,s=Math.sqrt(r[4]*r[4]+r[5]*r[5])/n,o=Math.max(a,s),u=this.engine.canvas.getBoundingClientRect(),h=o*(Math.max(u.width,u.height)/2)*this.engine.pixelRatio;return Math.max(1,Math.min(2e3,h))},i.buildPath=function(t,e){void 0===e&&(e=1),this.graphicsPath.clear();var i=e;switch(t.type){case Pe.Custom:for(var r,n=this.shapeAttributes,a=n.points,s=n.easingIns,o=n.easingOuts,u=Ze(n.shapes);!(r=u()).done;){var h=r.value,l=h.indexes,c=a[l[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var f=1;f<l.length;f++){var d=l[f],p=l[f-1],m=a[d.point],v=a[p.point],y=o[p.easingOut],g=s[d.easingIn];this.graphicsPath.bezierCurveTo(y.x+v.x,y.y+v.y,g.x+m.x,g.y+m.y,m.x,m.y,void 0,i)}if(h.close){var x=l[0],b=l[l.length-1],T=a[x.point],E=a[b.point],_=o[b.easingOut],w=s[x.easingIn];this.graphicsPath.bezierCurveTo(_.x+E.x,_.y+E.y,w.x+T.x,w.y+T.y,T.x,T.y,void 0,i),this.graphicsPath.closePath()}}break;case Pe.Ellipse:var S=t;this.graphicsPath.ellipse(0,0,S.xRadius,S.yRadius);break;case Pe.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case Pe.Star:var A=t;this.graphicsPath.polyStar(A.pointCount,A.outerRadius,A.innerRadius,A.outerRoundness,A.innerRoundness,Ds.Star);break;case Pe.Polygon:var M=t;this.graphicsPath.polyStar(M.pointCount,M.radius,M.radius,M.roundness,M.roundness,Ds.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===Re.Solid)t.color=e.color;else if(e.type===Re.GradientLinear||e.type===Re.GradientAngular||e.type===Re.GradientRadial)this.updateGradientMaterial(t,e.gradientStops,e.startPoint,e.endPoint);else if(e.type===Re.Texture){t.setInt("_ImageScaleMode",e.scaleMode),t.setVector2("_ImageSize",new j(e.texture.getWidth(),e.texture.getHeight()));var i=this.getBoundingBox(),r=i.area[0].p1,n=i.area[1].p2;t.setVector2("_DestSize",new j(r.x-n.x,r.y-n.y)),t.setFloat("_ImageOpacity",e.opacity),t.setFloat("_ImageScalingFactor",e.scalingFactor),t.setTexture("_ImageTex",e.texture);var a=e.textureTransform;t.setMatrix3("_TextureTransform",(new An).scale(a.scale.x,a.scale.y).rotate(a.rotation).translate(a.offset.x,a.offset.y).invert())}},i.updateGradientMaterial=function(t,e,i,r){for(var n,a=[],s=[],o=Ze(e.stops);!(n=o()).done;){var u=n.value,h=u.color;a.push(new W(h.r,h.g,h.b,h.a)),s.push(u.time)}t.setVector4Array("_Colors",a),t.setFloats("_Stops",s),t.setInt("_StopsCount",s.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;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);}}if(_StopsCount>0){finalColor=_Colors[0];for(int i=1;i<_MAX_STOPS;i++){if(i>=_StopsCount)break;float localT=smoothstep(_Stops[i-1],_Stops[i],t);finalColor=mix(finalColor,_Colors[i],localT);}}}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:Rn.GLSL1}},i=zn.create(this.engine,e),r=t,n=r.side,a=r.occlusion,s=r.blending,o=r.texture,u=this.maskManager.maskMode;i.blending=!0,i.depthTest=!0,i.depthMask=a,zr(i,s),Br(i,n),i.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',i.setVector4("_TexOffset",new W(0,0,1,1)),i.setTexture("_ImageTex",o);var h=Dr(s),l=new W;return l.x=r.occlusion?+r.transparentOcclusion:1,l.y=h,l.z=r.renderMode,l.w=u,i.setVector4("_TexParams",l),0===l.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(this.engine,e.mask);var r,n,a,s,o,u=null!=(i=e.renderer)?i:{};this.rendererOptions={renderMode:ee.MESH,blending:null!=(r=u.blending)?r:Yt.ALPHA,texture:u.texture?this.engine.findObject(u.texture):this.engine.whiteTexture,occlusion:!!u.occlusion,transparentOcclusion:!!u.transparentOcclusion||this.maskManager.maskMode===Er.MASK,side:null!=(n=u.side)?n:Zt.DOUBLE,mask:this.maskManager.getRefValue()},this.strokeCap=null!=(a=e.strokeCap)?a:Ne.Butt,this.strokeWidth=null!=(s=e.strokeWidth)?s:1,this.strokeJoin=null!=(o=e.strokeJoin)?o:Le.Miter,this.fills.length=0,this.fillMaterials.length=0;for(var h,l=Ze(e.fills);!(h=l()).done;){var c=h.value;this.fills.push(this.createPaint(c)),this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}this.strokes.length=0,this.strokeMaterials.length=0;for(var f,d=Ze(e.strokes);!(f=d()).done;){var p=f.value;this.strokes.push(this.createPaint(p)),this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}switch(this.materials=[].concat(this.fillMaterials,this.strokeMaterials),e.type){case Pe.Custom:for(var m,v=e,y={type:Pe.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},g=Ze(v.points);!(m=g()).done;){var x=m.value;y.points.push(new j(x.x,x.y))}for(var b,T=Ze(v.easingIns);!(b=T()).done;){var E=b.value;y.easingIns.push(new j(E.x,E.y))}for(var _,w=Ze(v.easingOuts);!(_=w()).done;){var S=_.value;y.easingOuts.push(new j(S.x,S.y))}y.shapes=v.shapes,this.shapeAttributes=y;break;case Pe.Ellipse:var C=e,A={type:Pe.Ellipse,xRadius:C.xRadius,yRadius:C.yRadius};this.shapeAttributes=A;break;case Pe.Rectangle:var M=e,I={type:Pe.Rectangle,width:M.width,height:M.height,roundness:M.roundness};this.shapeAttributes=I;break;case Pe.Star:var R=e,O={type:Pe.Star,pointCount:R.pointCount,innerRadius:R.innerRadius,outerRadius:R.outerRadius,innerRoundness:R.innerRoundness,outerRoundness:R.outerRoundness};this.shapeAttributes=O;break;case Pe.Polygon:var P=e,N={type:Pe.Polygon,pointCount:P.pointCount,radius:P.radius,roundness:P.roundness};this.shapeAttributes=N}},i.createPaint=function(t){var e;switch(t.type){case Re.Solid:e={type:t.type,color:(new H).copyFrom(t.color)};break;case Re.GradientLinear:case Re.GradientAngular:case Re.GradientRadial:e={type:t.type,gradientStops:xs(t.gradientStops),startPoint:(new j).copyFrom(t.startPoint),endPoint:(new j).copyFrom(t.endPoint)};break;case Re.Texture:var i,r,n,a=gi({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 j).copyFrom(a.offset),rotation:a.rotation,scale:(new j).copyFrom(a.scale)}}}return e},i.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},xr(e,[{key:"shape",get:function(){return this.shapeAttributes}}]),e}(Hn);ru.tempMVP=Sn.fromIdentity(),ru=_([$e("ShapeComponent")],ru);var nu,au=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}oe(e,t);var i=e.prototype;return i.onStart=function(){this.effectComponent=this.item.getComponent(qs)},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 a=t;this.loop&&(a>.5&&(a=1-a),a*=2),e=this.startPositionX*(1-a)+a*this.endPositionX,i=this.startPositionY*(1-a)+a*this.endPositionY,r=this.startPositionZ*(1-a)+a*this.endPositionZ}var s=this.effectComponent.material;s.setFloat("_PosX",e*this.amountOfMotion),s.setFloat("_PosY",i*this.amountOfMotion),s.setFloat("_PosZ",r*this.amountOfMotion)}},e}(br);_([ti()],au.prototype,"loop",void 0),_([ti()],au.prototype,"amountOfMotion",void 0),_([ti()],au.prototype,"animationLength",void 0),_([ti()],au.prototype,"mode",void 0),_([ti()],au.prototype,"startPositionX",void 0),_([ti()],au.prototype,"startPositionY",void 0),_([ti()],au.prototype,"startPositionZ",void 0),_([ti()],au.prototype,"endPositionX",void 0),_([ti()],au.prototype,"endPositionY",void 0),_([ti()],au.prototype,"endPositionZ",void 0),_([ti()],au.prototype,"amplitudeX",void 0),_([ti()],au.prototype,"amplitudeY",void 0),_([ti()],au.prototype,"amplitudeZ",void 0),_([ti()],au.prototype,"phaseX",void 0),_([ti()],au.prototype,"phaseY",void 0),_([ti()],au.prototype,"phaseZ",void 0),au=_([$e("Fake3DComponent")],au),function(t){t[t.Circular=0]="Circular",t[t.Linear=1]="Linear"}(nu||(nu={}));var su=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).color=new H(1,1,1,1),e.worldMatrix=new Sn,e.getHitTestParams=function(t){var i=Sn.fromScale(e.transform.size.x,e.transform.size.y,1).premultiply(e.transform.getWorldMatrix());if(t){e.boundingBoxInfo.setGeometry(e.clipGeometry,i);var r=e.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area,clipMasks:e.frameClipMasks}}},e}oe(e,t);var i=e.prototype;return i.onAwake=function(){this.clipGeometry=To.create(this.engine,{attributes:{aPos:{type:Rr.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:Rr.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:Rr.TRIANGLES,drawCount:6});var t=zn.create(this.engine,{shader:{fragment:"\n precision mediump float;\n\n uniform vec4 _Color;\n\n void main() {\n gl_FragColor = _Color;\n }\n ",vertex:"\n precision highp float;\n attribute vec3 aPos;\n uniform mat4 effects_ObjectToWorld;\n uniform mat4 effects_MatrixVP;\n void main() {\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * vec4(aPos, 1.0);\n }\n ",shared:!0}});t.depthTest=!0,t.depthMask=!1,t.setColor("_Color",this.color),this.material=t},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onPreRender=function(){this.setClipRectangle(),this.material.setColor("_Color",this.color)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),ou(this.worldMatrix,this.transform.size.x,this.transform.size.y),t.drawGeometry(this.clipGeometry,this.worldMatrix,this.material)},i.onDestroy=function(){this.clipGeometry.dispose(),this.material.dispose()},i.drawStencilMask=function(t){this.isActiveAndEnabled&&(this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),ou(this.worldMatrix,this.transform.size.x,this.transform.size.y),this.maskManager.drawGeometryMask(this.engine.renderer,this.clipGeometry,this.worldMatrix,this.material,t))},i.fromData=function(e){t.prototype.fromData.call(this,e),e.color&&this.color.copyFrom(e.color)},i.setClipRectangle=function(){this.setClipRectangleRecursive(this.item)},i.setClipRectangleRecursive=function(t){for(var e,i=Ze(t.children);!(e=i()).done;){var r=e.value,n=r.getComponent(Hn);n&&P(n.frameClipMasks,this),this.setClipRectangleRecursive(r)}},e}(Hn);function ou(t,e,i){var r=t.elements;r[0]*=e,r[1]*=e,r[2]*=e,r[3]*=e,r[4]*=i,r[5]*=i,r[6]*=i,r[7]*=i}su=_([$e("FrameComponent")],su);var uu=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}oe(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}(br);function hu(t){return hu=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},hu(t)}function lu(t){var e="function"==typeof Map?new Map:void 0;return lu=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return us(t,arguments,hu(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),se(r,t)},lu(t)}uu=_([$e(ze.CameraController)],uu);var cu,fu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(lu(ae)),du="click",pu="touchstart",mu="touchmove",vu="touchend";!function(t){t[t.PointerDown=0]="PointerDown",t[t.PointerUp=1]="PointerUp",t[t.PointerMove=2]="PointerMove"}(cu||(cu={}));var yu=function(){function t(t,e){void 0===e&&(e=!1),this.engine=t,this.allowPropagation=e,this.enabled=!0,this.skipPointerMovePicking=!0,this.handlers={},this.nativeHandlers={},this.target=null}var e=t.prototype;return e.bindListeners=function(t){var e,i,r,n,a,s=this;this.target=t,a=function(t){return t};var o,u="mousedown",h="mousemove",l="mouseup",c="mouseleave",d=function(t,e,i,r,a){void 0===r&&(r=0),void 0===a&&(a=0);var o=0,u=0,h=f.now();if(!s.target)return wt.warn("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:r,dy:a,ts:h,width:0,height:0,origin:t};var l=s.target,c=l.width,d=l.height;if(n){var p=h-n.ts;o=(r-n.dx)/p||0,u=(a-n.dy)/p||0,n={dx:r,dy:a,ts:h}}return{x:e,y:i,vx:o,vy:u,dx:r,dy:a,ts:h,width:c,height:d,origin:t}};at()&&(a=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},u="touchstart",h="touchmove",l="touchend",c="touchcancel"),this.nativeHandlers=((o={})[u]=function(t){if(s.enabled){var o=a(t),u=gu(o);e=u.x,i=u.y,n=r={clientX:o.clientX,clientY:o.clientY,ts:f.now(),x:e,y:i},s.dispatchEvent(pu,d(t,e,i))}},o[h]=function(t){if(r&&s.enabled){var n=gu(a(t));e=n.x,i=n.y,s.dispatchEvent(mu,d(t,e,i,e-r.x,i-r.y))}},o[l]=function(t){if(r&&s.enabled){!s.allowPropagation&&t.cancelable&&(t.preventDefault(),t.stopPropagation());var n=a(t),o=gu(n),u=Math.abs(r.clientX-n.clientX)+Math.abs(r.clientY-n.clientY);e=o.x,i=o.y,u<4&&s.dispatchEvent(du,d(t,e,i)),s.dispatchEvent(vu,d(t,e,i,e-r.x,i-r.y))}r=0},o),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])})),this.addEventListener(du,this.onClick.bind(this)),this.addEventListener(pu,this.onPointerDown.bind(this)),this.addEventListener(vu,this.onPointerUp.bind(this)),this.addEventListener(mu,this.onPointerMove.bind(this))},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach((function(t){return t(e)}))},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),P(i,e),function(){N(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&N(i,e)},e.onClick=function(t){for(var e,i=t.x,r=t.y,n=[],a=Ze(this.engine.compositions);!(e=a()).done;){var s,o=e.value;(s=n).push.apply(s,[].concat(o.hitTest(i,r)))}for(var u,h=Ze(n);!(u=h()).done;){var l=u.value,c=l.item.composition;if(c){var f=gi({},l,{compositionId:c.id,compositionName:c.name});l.item.emit("click",l),c.emit("click",f),this.engine.emit("click",f)}}},e.onPointerDown=function(t){this.handlePointerEvent(t,0)},e.onPointerUp=function(t){this.handlePointerEvent(t,1)},e.onPointerMove=function(t){this.handlePointerEvent(t,2)},e.handlePointerEvent=function(t,e){var i=null,r=t.x,n=t.y,a=t.width,s=t.height;if(2!==e||!this.skipPointerMovePicking)for(var o,u=Ze(this.engine.compositions);!(o=u()).done;){var h=o.value.hitTest(r,n);h.length>0&&(i=h[h.length-1])}var l=new Gn;l.position.x=(r+1)/2*a,l.position.y=(n+1)/2*s,l.delta.x=t.vx*a,l.delta.y=t.vy*s;var c=l.pointerCurrentRaycast;i&&(c.point=i.position,c.item=i.item);var f="pointerdown";switch(e){case 0:f="pointerdown";break;case 1:f="pointerup";break;case 2:f="pointermove"}if(i){var d=i.item,p=d.composition;d.emit(f,l),p.emit(f,l),this.engine.emit(f,l)}},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={})},t}();function gu(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,s=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-s)/n.height*2}}var xu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(lu(ae)),bu=1,Tu=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 X,n=new _i,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},e.createMaterial=function(){var t=[["ENV_EDITOR",this.engine.env===$n]],e=xs(this.color).getValue(0),i={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:Rn.GLSL1,macros:t}},r=zn.create(this.engine,i);return r.blending=!0,r.depthTest=!1,r.setVector4("uPos",new W(0,0,0,0)),r.setVector2("uSize",new j(1,1)),r.setVector4("uColor",new W(e[0]/255,e[1]/255,e[2]/255,e[3])),r.setQuaternion("uQuat",new _i(0,0,0,0)),r},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return To.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:Rr.LINES,maxVertex:4})},e.createMesh=function(t,e){return wo.create(this.engine,{name:"Interact_preview"+bu++,priority:0,worldMatrix:Sn.fromIdentity(),geometry:t,material:e})},t}(),Eu=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,clipMasks:e.frameClipMasks}:void 0}},e}oe(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.env,e=this.interactData.options,i=e.type,r=e.showPreview;i===Jt.CLICK&&(this.clickable=!0,r&&t===$n&&(this.previewContent=new Tu(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.env;if(e===Jt.CLICK)this.clickable=!0;else if(e===Jt.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==$n||n){var a,s=(null!=(a=this.item.composition)?a:{}).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,a=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,a.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,_u(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,a=n.position,s=n.fov,o=e.dy,u=e.dx*e.width/e.height,h=a[2],l=Math.tan(s*Math.PI/180/2)*Math.abs(h),c=o*l,f=u*l,d=this.dragRange,p=d.dxRange,m=d.dyRange,v=a[0]-this.dragRatio[0]*f,y=a[1]-this.dragRatio[1]*c,g=p[0],x=p[1],b=m[0],T=m[1];if(v=G(v,g,x),y=G(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 X(v,y,h)}},i.beginDragTarget=function(t,i){var r=this;if("camera"===t.target){var n,a={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;!_u(e,3)&&e&&(e.vx*=r.speed,e.vy*=r.speed,r.dragEvent=gi({},n)),n=null}}};Object.keys(a).forEach((function(t){i.addEventListener(t,a[t])})),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(a).forEach((function(t){i.removeEventListener(t,a[t])}))}}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=_a(X.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:Bn.triangle,area:e}},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===Jt.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,a=0;if("number"==typeof e)i=e,r=e,n=e,a=e;else if(At(e)){var s,o,u,h,l;i=void 0===(o=(s=e)[0])?0:o,r=void 0===(u=s[1])?0:u,n=void 0===(h=s[2])?0:h,a=void 0===(l=s[3])?0:l}if(t.x<a-1||t.x>1-r||t.y<i-1||t.y>1-n)return!0}return!1},xr(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(Hn);function _u(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}Eu=_([$e(ze.InteractComponent)],Eu);var wu,Su=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return oe(e,t),e}(lu(ae)),Cu=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}(),Au=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}(),Mu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(ii);!function(t){t[t.Playing=0]="Playing",t[t.Paused=1]="Paused",t[t.Stopped=2]="Stopped"}(wu||(wu={}));var Iu=[1,1,1,1],Ru=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}oe(e,t);var i=e.prototype;return i.processFrame=function(t){var e=t.output.getUserData();if(E(e,oa)){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 a,s,o,u=ga(Iu,1),h=this.time/this.getDuration(),l=this.opacityOverLifetime,c=this.colorOverLifetime;if(c&&(u=Z(c,h,!0),a=!0),l&&(u[3]*=l.getValue(h),a=!0),a)xa(this.renderColor,u,this.startColor),null==(o=this.activeMaterial)||null==(s=o.getColor("_Color"))||s.setFromArray(this.renderColor)}},i.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;i&&(this.opacityOverLifetime=xs(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===he.GRADIENT_COLOR&&(this.colorOverLifetime=q(i.color[1])));return this},i.getActiveComponent=function(t){return t.getComponent(iu)},e}(Cu),Ou=function(){function t(){}return t.prototype.onEvent=function(t,e){},t}(),Pu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.onEvent=function(t,e){t.emit("animationevent",e)},e}(lu(Ou)),Nu=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.events=[],e}oe(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=G(e,0,this.duration),n=Ze(this.positionCurves);!(i=n()).done;){var a=i.value,s=a.keyFrames.getValue(r),o=this.findTarget(t,a.path);null==o||o.transform.setPosition(s.x,s.y,s.z)}for(var u,h=Ze(this.rotationCurves);!(u=h()).done;){var l=u.value,c=l.keyFrames.getValue(r),f=this.findTarget(t,l.path);null==f||f.transform.setQuaternion(c.x,c.y,c.z,c.w)}for(var d,p=Ze(this.eulerCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(r),y=this.findTarget(t,m.path);null==y||y.transform.setRotation(v.x,v.y,v.z)}for(var g,x=Ze(this.scaleCurves);!(g=x()).done;){var b=g.value,T=b.keyFrames.getValue(r),E=this.findTarget(t,b.path);null==E||E.transform.setScale(T.x,T.y,T.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=Ze(t.positionCurves);!(i=r()).done;){var n=i.value,a={path:n.path,keyFrames:xs(n.keyFrames)};e=Math.max(e,a.keyFrames.getMaxTime()),this.positionCurves.push(a)}if(t.rotationCurves)for(var s,o=Ze(t.rotationCurves);!(s=o()).done;){var u=s.value,h={path:u.path,keyFrames:xs(u.keyFrames)};e=Math.max(e,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}if(t.eulerCurves)for(var l,c=Ze(t.eulerCurves);!(l=c()).done;){var f=l.value,d={path:f.path,keyFrames:xs(f.keyFrames)};e=Math.max(e,d.keyFrames.getMaxTime()),this.eulerCurves.push(d)}if(t.scaleCurves)for(var p,m=Ze(t.scaleCurves);!(p=m()).done;){var v=p.value,y={path:v.path,keyFrames:xs(v.keyFrames)};e=Math.max(e,y.keyFrames.getMaxTime()),this.scaleCurves.push(y)}if(t.floatCurves)for(var g,x=Ze(t.floatCurves);!(g=x()).done;){var b=g.value,T={path:b.path,keyFrames:xs(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,T.keyFrames.getMaxTime()),this.floatCurves.push(T)}if(t.colorCurves)for(var E,_=Ze(t.colorCurves);!(E=_()).done;){var w=E.value,S={path:w.path,keyFrames:xs(w.keyFrames),property:w.property,className:w.className};e=Math.max(e,S.keyFrames.getMaxTime()),this.colorCurves.push(S)}if(void 0!==t.duration?this.duration=t.duration:this.duration=e,t.events)for(var C,A=Ze(t.events);!(C=A()).done;){var M,I=C.value,R={name:I.name,startTime:I.startTime,duration:null!=(M=I.duration)?M:0,event:new Pu};this.events.push(R)}},i.findTarget=function(t,e){for(var i,r=t,n=Ze(e.split("."));!(i=n()).done;){for(var a,s=i.value,o=!1,u=Ze(r.children);!(a=u()).done;){var h=a.value;if(h.name===s){r=h,o=!0;break}}if(!o)return}return r},e}(ii);Nu=_([$e(ze.AnimationClip)],Nu);var Lu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}oe(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=Ze(this.clipPlayables);!(e=i()).done;){e.value.processFrame(t)}this.evaluate(t)},i.setClipWeight=function(t,e){if(E(t,Cu)){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}(Cu),Fu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(E(e,oa)){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}(Lu),Vu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();E(e,oa)&&(e.time=this.time)},e}(Cu),ku=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(Cu),Du=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyPath="",e.propertyName="",e}oe(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 a=this.getClipPlayable(r);if(!E(a,ku)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var s=a.value;this.addWeightedValue(s,n),i=!0}}i&&(this.directTarget[this.propertyName]=this.propertyValue,E(e,br)&&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}(Lu),zu=function(t){function e(){return t.apply(this,arguments)}oe(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}(Du),Bu=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(Du),Uu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){},e}(Lu),Gu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){},e}(Lu),ju=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();E(e,Ys)&&e.tick(this.getTime()-e.getTime())},e}(Cu),Xu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(E(e,Ys)){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}(Lu),Wu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){},e}(Lu),Hu=function(t){function e(){return t.apply(this,arguments)}oe(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}(Du),Yu=function(t){function e(){return t.apply(this,arguments)}oe(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}(Du),Zu=function(t){function e(){return t.apply(this,arguments)}oe(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}(Du),qu=new Cn,Ku=new X(1,1,1),Qu=new X,Ju=function(t){function e(){return t.apply(this,arguments)}oe(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 X(e.x,e.y,e.x)};var i,r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=xs(r.path));var s=r.linearX||r.linearY||r.linearZ;s&&(this.linearVelOverLifetime={x:r.linearX&&xs(r.linearX),y:r.linearY&&xs(r.linearY),z:r.linearZ&&xs(r.linearZ),asMovement:r.asMovement,enabled:!!s});var o=r.orbitalX||r.orbitalY||r.orbitalZ;o&&(this.orbitalVelOverLifetime={x:r.orbitalX&&xs(r.orbitalX),y:r.orbitalY&&xs(r.orbitalY),z:r.orbitalZ&&xs(r.orbitalZ),center:ya(r.orbCenter),asRotation:r.asRotation,enabled:!!o}),this.speedOverLifetime=r.speedOverLifetime&&xs(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=xs(a.x||1),this.sizeYOverLifetime=xs(a.y||1),this.sizeZOverLifetime=xs(a.z||1)):this.sizeXOverLifetime=xs(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:xs(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=xs(n.x||0),u.y=xs(n.y||0)}this.gravity=X.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=xs(null!=(i=null==r?void 0:r.gravityOverLifetime)?i:0),this.direction=(null==r?void 0:r.direction)?X.fromArray(r.direction).normalize():new X,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();E(e,oa)&&(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,this.sizeXOverLifetime){Ku.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(Ku.y=this.sizeYOverLifetime.getValue(r),Ku.z=this.sizeZOverLifetime.getValue(r)):Ku.z=Ku.y=Ku.x;var n=this.originalTransform.scale;e.transform.setScale(Ku.x*n.x,Ku.y*n.y,Ku.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},s=a(this.rotationOverLifetime.z),o=this.rotationOverLifetime.separateAxes;qu.x=o?a(this.rotationOverLifetime.x):0,qu.y=o?a(this.rotationOverLifetime.y):0,qu.z=s;var u=qu.addEulers(this.originalTransform.rotation,qu);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Qu;va(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}(Cu),$u=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new Ju;return t.data=this.transformAnimationData,t},i.fromData=function(t){this.transformAnimationData=t},e}(Mu);$u=_([$e(ze.TransformPlayableAsset)],$u);var th,eh=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===ce.restart?e%=i:this.endBehavior===ce.freeze&&(e=Math.min(i,e))),e},t}(),ih=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}oe(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){return t},i.createTrackMixer=function(){return new Lu},i.createOutput=function(){return new Au},i.createPlayableGraph=function(t){return this.createMixerPlayableGraph(t)},i.createMixerPlayableGraph=function(t){for(var e,i=[],r=Ze(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=Ze(t);!(i=n()).done;){var a=i.value,s=this.createClipPlayable(a);s.setDuration(a.duration);var o=new rh(a,s,r);e.push(o),r.clipPlayables.push(s),r.setClipWeight(s,0)}return r},i.createPlayable=function(){return new Cu},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 eh;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=Ze(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=Ze(this.children);!(i=r()).done;){i.value.parent=this}},e}(Mu);_([ti(eh)],ih.prototype,"clips",void 0),_([ti()],ih.prototype,"children",void 0),ih=_([$e(ze.TrackAsset)],ih),function(t){t[t.MasterTrack=0]="MasterTrack",t[t.ObjectTrack=1]="ObjectTrack"}(th||(th={}));var rh=function(){function t(t,e,i){this.clip=t,this.playable=e,this.parentMixer=i}return t.prototype.evaluateAt=function(t){var e=this.clip,i=1,r=!1,n=!1;t>=e.start+e.duration&&e.endBehavior===ce.destroy?(i=0,r=!0):t-this.clip.start>=0?(i=1,n=!0):t<e.start&&(i=0),n&&this.playable.getPlayState()!==wu.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,i);var a=e.toLocalTime(t);this.playable.setTime(a),r&&this.playable.getPlayState()===wu.Playing&&this.playable.pause()},xr(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}(),nh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Fu},e}(ih);nh=_([$e(ze.ActivationTrack)],nh);var ah=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}return oe(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(ih);_([ti()],ah.prototype,"path",void 0);var sh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new Bu;return t.propertyPath=this.path,t},e}(ah);sh=_([$e(ze.FloatPropertyTrack)],sh);var oh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Gu},e}(ih);oh=_([$e(ze.SpriteColorTrack)],oh);var uh=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){if(!E(t,oa))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");return t.getComponent(Ys)},i.createTrackMixer=function(){return new Xu},e}(ih);uh=_([$e(ze.SubCompositionTrack)],uh);var hh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Wu},e}(ih);hh=_([$e(ze.TransformTrack)],hh);var lh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.updateAnimatedObject=function(t){if(!E(t,Hn))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}(ih);_([ti()],lh.prototype,"index",void 0),lh=_([$e("MaterialTrack")],lh);var ch=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Uu},e}(ih),fh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new Hu;return t.propertyPath=this.path,t},e}(ah);fh=_([$e(ze.Vector4PropertyTrack)],fh);var dh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new Yu;return t.propertyPath=this.path,t},e}(ah);dh=_([$e(ze.Vector3PropertyTrack)],dh);var ph=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new Zu;return t.propertyPath=this.path,t},e}(ah);ph=_([$e(ze.Vector2PropertyTrack)],ph);var mh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new zu;return t.propertyPath=this.path,t},e}(ah);mh=_([$e(ze.ColorPropertyTrack)],mh);var vh=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=yh(this.arc,this.arcMode,t)*k,i=Math.cos(e)*this.radius,r=Math.sin(e)*this.radius,n=new X(i,r,0),a=Math.tan(this.angle*k),s=n.clone().multiply(a);return s.z+=1,{position:n.multiply(Nt(0,1)),direction:s.normalize()}},t}();function yh(t,e,i){if(e===de.RANDOM)t=Nt(0,t);else if(e===de.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===de.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===de.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var gh,xh=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=yh(this.arc,this.arcMode,t)*k,i=new X(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),bh=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=Nt(-this._d,this._d),i=Nt(-this._h,this._h);return{direction:new X(0,0,1),position:new X(e,i,0)}},t}(),Th=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=yh(this.arc,this.arcMode,t)*k,i=new X(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),s=Math.tan(e),o=new X;return e<a?o.set(r,r*s,0):e>=a&&e<Math.PI-a?o.set(n/s,n,0):e<Math.PI+a?o.set(-r,-r*s,0):e<2*Math.PI-a?o.set(-n/s,-n,0):o.set(r,r*s,0),{direction:i,position:o}},t}(),Eh=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===de.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):Nt(0,1);return{direction:new X(0,1,0),position:new X(this._d*(e-.5),0,0)}},t}(),_h=new Sn,wh=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=Nt(0,2*Math.PI),n=yh(this.arc,this.arcMode,t)*k,a=_h.setFromRotationZ(n),s=new X(Math.cos(r),Math.sin(r),0),o=new X(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(s),position:a.transformPoint(o)}},t}(),Sh=new Sn,Ch=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 Nt(-90,90)},e.generate=function(t){var e=yh(this.arc,this.arcMode,t)*k,i=this.getHorizontalAngle()*k,r=this.radius,n=new X(Math.cos(i),0,Math.sin(i)),a=Sh.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),Ah=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.getHorizontalAngle=function(){return Nt(0,90)},e}(Ch),Mh=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=G(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=e.length/2-1,r=Math.floor(yh(i,this.arcMode,t)),n=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,a=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,s=new X(n,a,0);return{position:new X(n*this.width,a*this.height,0),direction:s.normalize()}},t}(),Ih=function(){function t(){}return t.prototype.generate=function(){return{position:new X,direction:new X}},t}(),Rh=((gh={})[Kt.NONE]=Ih,gh[Kt.CONE]=vh,gh[Kt.SPHERE]=Ch,gh[Kt.HEMISPHERE]=Ah,gh[Kt.CIRCLE]=xh,gh[Kt.DONUT]=wh,gh[Kt.RECTANGLE]=bh,gh[Kt.EDGE]=Eh,gh[Kt.RECTANGLE_EDGE]=Th,gh[Kt.TEXTURE]=Mh,gh);function Oh(t){if(!t)return new Ih;var e=gi({radius:1,arc:360,angle:0,arcMode:de.RANDOM},t),i=t.type,r=Rh[i];if(!r)throw new Error("Invalid shape: "+i+".");var n=new r(e);if(i!==Kt.NONE){var a=t.alignSpeedDirection,s=t.upDirection,o=void 0===s?[0,0,1]:s;n.alignSpeedDirection=a,n.upDirection=X.fromArray(o).normalize()}return n}function Ph(t,e,i,r,n){var a,s;if(n===function(t,e,i,r){for(var n=0,a=e,s=i-r;a<i;a+=r)n+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)s=Kh(a,t[a],t[a+1],s);else for(a=i-r;a>=e;a-=r)s=Kh(a,t[a],t[a+1],s);return s&&Xh(s,s.next)&&(Qh(s),s=s.next),s}function Nh(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Xh(r,r.next)&&0!==jh(r.prev,r,r.next))r=r.next;else{if(Qh(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Lh(t){var e=t.prev,i=t,r=t.next;if(jh(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Uh(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&jh(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Fh(t,e,i,r){var n=t.prev,a=t,s=t.next;if(jh(n,a,s)>=0)return!1;for(var o=n.x<a.x?n.x<s.x?n.x:s.x:a.x<s.x?a.x:s.x,u=n.y<a.y?n.y<s.y?n.y:s.y:a.y<s.y?a.y:s.y,h=n.x>a.x?n.x>s.x?n.x:s.x:a.x>s.x?a.x:s.x,l=n.y>a.y?n.y>s.y?n.y:s.y:a.y>s.y?a.y:s.y,c=zh(o,u,e,i,r),f=zh(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&&Uh(n.x,n.y,a.x,a.y,s.x,s.y,d.x,d.y)&&jh(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==t.prev&&p!==t.next&&Uh(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&jh(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&Uh(n.x,n.y,a.x,a.y,s.x,s.y,d.x,d.y)&&jh(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&Uh(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&jh(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Vh(t,e){return t.x-e.x}function kh(t,e){if(e=function(t,e){var i,r=e,n=t.x,a=t.y,s=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var o=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=n&&o>s){if(s=o,o===n){if(a===r.y)return r;if(a===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&&Uh(a<c?n:s,a,l,c,a<c?s:n,a,r.x,r.y)&&(u=Math.abs(a-r.y)/(n-r.x),Zh(r,t)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&Dh(i,r)))&&(i=r,f=u)),r=r.next}while(r!==h);return i}(t,e),e){var i=qh(e,t);Nh(e,e.next),Nh(i,i.next)}}function Dh(t,e){return jh(t.prev,t,e.prev)<0&&jh(e.next,t,t.next)<0}function zh(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 Bh(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 Uh(t,e,i,r,n,a,s,o){return(n-s)*(e-o)-(t-s)*(a-o)>=0&&(t-s)*(r-o)-(i-s)*(e-o)>=0&&(i-s)*(a-o)-(n-s)*(r-o)>=0}function Gh(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&&Wh(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Zh(t,e)&&Zh(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(jh(t.prev,t,e.prev)||jh(t,e.prev,e))||Xh(t,e)&&jh(t.prev,t,t.next)>0&&jh(e.prev,e,e.next)>0)}function jh(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Xh(t,e){return t.x===e.x&&t.y===e.y}function Wh(t,e,i,r){var n=Yh(jh(t,e,i)),a=Yh(jh(t,e,r)),s=Yh(jh(i,r,t)),o=Yh(jh(i,r,e));return n!==a&&s!==o||(!(0!==n||!Hh(t,i,e))||(!(0!==a||!Hh(t,r,e))||(!(0!==s||!Hh(i,t,r))||!(0!==o||!Hh(i,e,r)))))}function Hh(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 Yh(t){return t>0?1:t<0?-1:0}function Zh(t,e){return jh(t.prev,t,t.next)<0?jh(t,e,t.next)>=0&&jh(t,t.prev,e)>=0:jh(t,e,t.prev)<0||jh(t,t.next,e)<0}function qh(t,e){var i=new Jh(t.i,t.x,t.y),r=new Jh(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function Kh(t,e,i,r){var n=new Jh(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 Qh(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 Jh(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 $h=0;function tl(t,e,i,r){i=i||2,$h=r||0;var n,a,s,o,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=Ph(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,a,s,o=[];for(n=0,a=e.length;n<a;n++)(s=Ph(t,e[n]*r,n<a-1?e[n+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),o.push(Bh(s));for(o.sort(Vh),n=0;n<o.length;n++)kh(o[n],i),i=Nh(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=s=t[0],a=o=t[1];for(var m=i;m<f;m+=i)(u=t[m])<n&&(n=u),(h=t[m+1])<a&&(a=h),u>s&&(s=u),h>o&&(o=h);l=0!==(l=Math.max(s-n,o-a))?1/l:0}return el(d,p,i,n,a,l),p}function el(t,e,i,r,n,a,s){if(t){!s&&a&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=zh(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,s,o,u,h=1;do{for(i=t,t=null,a=null,s=0;i;){for(s++,r=i,o=0,e=0;e<h&&(o++,r=r.nextZ);e++);for(u=h;o>0||u>0&&r;)0!==o&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,o--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(s>1)}(n)}(t,r,n,a);for(var o,u,h=t;t.prev!==t.next;)if(o=t.prev,u=t.next,a?Fh(t,r,n,a):Lh(t))e.push(o.i/i+$h),e.push(t.i/i+$h),e.push(u.i/i+$h),Qh(t),t=u.next,h=u.next;else if((t=u)===h){s?1===s?el(t=il(Nh(t),e,i),e,i,r,n,a,2):2===s&&rl(t,e,i,r,n,a):el(Nh(t),e,i,r,n,a,1);break}}}function il(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!Xh(n,a)&&Wh(n,r,r.next,a)&&Zh(n,a)&&Zh(a,n)&&(e.push(n.i/i+$h),e.push(r.i/i+$h),e.push(a.i/i+$h),Qh(r),Qh(r.next),r=t=a),r=r.next}while(r!==t);return Nh(r)}function rl(t,e,i,r,n,a){var s=t;do{for(var o=s.next.next;o!==s.prev;){if(s.i!==o.i&&Gh(s,o)){var u=qh(s,o);return s=Nh(s,s.next),u=Nh(u,u.next),el(s,e,i,r,n,a),void el(u,e,i,r,n,a)}o=o.next}s=s.next}while(s!==t)}var nl=2;function al(t,e){for(var i=t.s,r=t.p,n=i[1],a=r[1],s=0,o=0;o<n.length;o++){s+=n[o].length-1}var u,h=new Float32Array(s*Zn),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=a[b],_=a[b+1]||a[0],w=T,S=[0,0],C=0;C<w.length-1;C++){ul(S,w[C],E,_,E[4],E[5],_[2],_[3]),M(S[0],S[1])}var A=tl(Array.from(h),null,Zn,c);return{aPoint:h,index:new Uint16Array(A)};function M(t,e){h[d++]=t/2,h[d++]=e/2,f?(g[0]=t,g[1]=e,ol(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+=nl}}function sl(t,e){for(var i=[],r=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[he.SHAPE_POINTS,t.p],s:[he.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[he.SHAPE_POINTS,t.g.p],s:[he.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,a=0,s=0,o=0;o<r.length;o++){var u=al(r[o],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,i.push(u),a+=u.aPoint.length,s+=u.index.length}if(1===i.length)return i[0];for(var h=new Float32Array(a),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 ol(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],s=e[1];return t[0]=r*a+n*s,t[1]=-n*a+r*s,t}function ul(t,e,i,r,n,a,s,o){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*a+c*o+f*r[1],t}var hl=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=E(r,Wa)?r:xs(r),this.cycles=+n||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),ll=function(t){this.content=t},cl=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 ll(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 ll(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,a=t.next;n.next=a,a&&(a.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do{t.call(e||this,i.content,r++)}while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do{t.call(e||this,i.content,r--)}while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),fl="runtime_env",dl="lookup_texture",pl="offscreen_canvas",ml="post_process_settings",vl={};function yl(t){return vl[t]}function gl(t,e){return vl[t]=e}var xl=new X,bl=new X,Tl=function(){function t(t,e){this.pointStart=[];var i=e.colorOverLifetime,r=e.colorOverTrail,n=e.maxTrailCount,a=e.opacityOverLifetime,s=void 0===a?xs(1):a,o=e.widthOverTrail,u=e.name,h=e.occlusion,l=e.blending,c=e.texture,f=e.transparentOcclusion,d=e.minimumVertexDistance,p=e.lifetime,m=e.matrix,v=t.gpuCapability,y=v.detail,g=v.level,x=Math.max(e.pointCountPerTrail,2),b={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},T=y.maxVertexTextures>0,_=(null!=t?t:{}).env,w={},S=[["ENABLE_VERTEX_TEXTURE",T],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",_===$n]],C=n>64,A=0;i&&(S.push(["COLOR_OVER_LIFETIME",!0]),A|=1,w.uColorOverLifetime=cn.createWithData(t,lt(i))),r&&(S.push(["COLOR_OVER_TRAIL",!0]),A|=4,w.uColorOverTrail=cn.createWithData(t,lt(r))),C?(S.push(["ATTR_TRAIL_START",1]),A|=8):w.uTrailStart=new Float32Array(n),w.uOpacityOverLifetimeValue=s.toUniform(b);var M=o.toUniform(b);S.push(["VERT_CURVE_VALUE_COUNT",b.index],["VERT_MAX_KEY_FRAME_COUNT",b.max]),w.uVCurveValues=Wa.getAllData(b);var I={shader:{vertex:Ro,fragment:Mo,macros:S,glslVersion:1===g?Rn.GLSL1:Rn.GLSL3,shared:!0,name:"trail#"+u,cacheId:"-t:+"+A+"+"+b.index+"+"+b.max}},R=x*n*2,O=(x-1)*n,P=Float32Array.BYTES_PER_ELEMENT,N=12*P,L={attributes:{aColor:{size:4,stride:N,data:new Float32Array(12*R)},aSeed:{size:1,stride:N,offset:4*P,dataSource:"aColor"},aInfo:{size:3,stride:N,offset:5*P,dataSource:"aColor"},aPos:{size:4,stride:N,offset:8*P,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(R)},aDir:{size:3,data:new Float32Array(3*R)}},indices:{data:new Uint16Array(6*R)},drawCount:6*O,name:"trail#"+u,bufferUsage:Rr.DYNAMIC_DRAW};if(C)L.attributes.aTrailStart={size:1,data:new Float32Array(R)};else{var F=new Float32Array(R);L.attributes.aTrailStartIndex={size:1,data:F};for(var V=0;V<n;V++)for(var k=2*x,D=V*k,z=0;z<k;z++)F[D+z]=V}var B=Dr(l),U=zn.create(t,I);U.blending=!0,U.depthMask=h,U.depthTest=!0,zr(U,l);var G=this.mesh=wo.create(t,{name:"MTrail_"+u,material:U,geometry:To.create(t,L)}),X=null!=c?c:cn.createWithData(t);Object.keys(w).map((function(t){var e=w[t];if(E(e,cn))U.setTexture(t,e);else if("uTrailStart"===t)U.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new W(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}U.setVector4Array(t,i)}else U.setVector4(t,W.fromArray(e))})),U.setFloat("uTime",0),U.setVector4("uWidthOverTrail",W.fromArray(M)),U.setVector2("uTexOffset",new j(0,0)),U.setVector4("uTextureMap",new W(0,0,1,1)),U.setVector4("uParams",new W(0,x-1,0,0)),U.setTexture("uMaskTex",X),U.setVector4("uColorParams",new W(c?1:0,+B,0,+(h&&!f))),this.maxTrailCount=n,this.pointCountPerTrail=x,this.checkVertexDistance=d>0,this.minimumVertexDistance=Math.pow(d||.001,2),this.useAttributeTrailStart=C,this.lifetime=p,m&&(this.mesh.worldMatrix=m),this.geometry=G.firstGeometry(),this.trailCursors=new Uint16Array(n)}var e=t.prototype;return e.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,a=this.geometry,s=n-1,o=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,xl);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+o,f=Sl(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),a.setAttributeSubData("aDir",v,y),a.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,a.setAttributeSubData("aColor",24*c,x),u>=0){var T=this.getTrailPosition(t,h,bl),E=new Float32Array(Sl(T,l,e)),_=6*(t*n+u);a.setAttributeSubData("aDir",_,E),a.setAttributeSubData("aDir",_+3,E);var w=t*n*2,S=new Uint16Array([2*u+w,2*u+1+w,2*o+w,2*o+w,2*u+1+w,2*o+1+w]),C=6*(t*s+(r-1)%s);a.setIndexSubData(C,S)}r=++this.trailCursors[t];var A=this.mesh.material,M=A.getVector4("uParams"),I=p[2];if(this.useAttributeTrailStart){for(var R=2*n,O=new Float32Array(R),P=0;P<R;P++)O[P]=I;a.setAttributeSubData("aTrailStart",t*O.length,O)}else{var N=A.getFloats("uTrailStart");null!=N&&(N[t]=I,A.setFloats("uTrailStart",N))}M&&(M.y=Math.max(M.y,r-1)-Math.max(0,r-n),A.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,a=this.geometry.getAttributeData("aColor");return mt(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();mt(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");mt(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();mt(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){},xr(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}(),El=new X,_l=new X,wl=new X;function Sl(t,e,i){var r=El;return t||i?(t?i?(_l.subtractVectors(e,t).normalize(),_l.subtractVectors(i,e),wl.copyFrom(_l).normalize(),r.addVectors(_l,wl)):r.subtractVectors(e,t):r.subtractVectors(i,e),r.normalize().toArray()):[0,0,0]}var Cl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).particleSystem=null,e}oe(e,t);var i=e.prototype;return i.getParticleSystem=function(t){if(this.particleSystem)return this.particleSystem;var e=t.output.getUserData();return E(e,oa)?(this.particleSystem=e.getComponent(Nl),this.particleSystem):null},i.processFrame=function(t){var e=this.getParticleSystem(t);if(e){this.time>=0&&this.time<e.time&&e.reset();for(;e.time+.016<this.time;)e.simulate(.016);e.simulate(this.time-e.time)}},e}(Cu),Al=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){return new Cl},e}(Mu),Ml={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"},Il=function(){function t(t,e){this.particleCount=0,this.cachedRotationVector3=new X,this.cachedRotationMatrix=new An,this.cachedLinearMove=new X,this.tempMatrix3=new An,this.VERT_MAX_KEY_FRAME_COUNT=0;var i,r,n=(null!=t?t:{}).env,a=e.speedOverLifetime,s=e.colorOverLifetime,o=e.linearVelOverLifetime,u=e.orbitalVelOverLifetime,h=e.sizeOverLifetime,l=e.rotationOverLifetime,c=e.sprite,f=e.gravityModifier,d=e.maxCount,p=e.textureFlip,m=e.useSprite,v=e.name,y=e.gravity,g=e.forceTarget,x=e.side,b=e.occlusion,T=e.anchor,_=e.blending,w=e.transparentOcclusion,S=e.renderMode,C=void 0===S?0:S,A=e.diffuse,M=void 0===A?cn.createWithData(t):A,I=t.gpuCapability.detail,R=I.halfFloatTexture,O=I.maxVertexUniforms,P=[["RENDER_MODE",+C],["ENV_EDITOR",n===$n]],N=t.gpuCapability.level,L={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},F={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},V=O>0,k={},D=0,z=0;(this.useSprite=m,V&&P.push(["ENABLE_VERTEX_TEXTURE",!0]),a&&(P.push(["SPEED_OVER_LIFETIME",!0]),z|=2,k.uSpeedLifetimeValue=a.toUniform(L)),(null==c?void 0:c.animate)&&(P.push(["USE_SPRITE",!0]),z|=4,k.uFSprite=k.uSprite=new Float32Array([c.col,c.row,c.total,c.blend?1:0]),this.useSprite=!0),(null==s?void 0:s.color)&&(P.push(["COLOR_OVER_LIFETIME",!0]),z|=16,k.uColorOverLifetime=E(s.color,cn)?s.color:cn.createWithData(t,lt(s.color))),(null==s?void 0:s.opacity)?k.uOpacityOverLifetimeValue=s.opacity.toUniform(L):k.uOpacityOverLifetimeValue=xs(1).toUniform(L),["x","y","z"].forEach((function(t,e){var r=0,n=0;(null==o?void 0:o[t])&&(k["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=o[t].toUniform(L),r=1,z|=1<<7+e,o.enabled=!0),P.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==u?void 0:u[t])&&(k["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=u[t].toUniform(L),n=1,z|=1<<10+e,i=!0,u.enabled=!0),P.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==o?void 0:o.asMovement)&&(P.push(["AS_LINEAR_MOVEMENT",!0]),z|=32),i&&((null==u?void 0:u.asRotation)&&(P.push(["AS_ORBITAL_MOVEMENT",!0]),z|=64),k.uOrbCenter=new Float32Array((null==u?void 0:u.center)||[0,0,0])),k.uSizeByLifetimeValue=null==h?void 0:h.x.toUniform(L),null==h?void 0:h.separateAxes)&&(P.push(["SIZE_Y_BY_LIFE",1]),z|=16384,k.uSizeYByLifetimeValue=null==h||null==(r=h.y)?void 0:r.toUniform(L));if((null==l?void 0:l.z)&&(k.uRZByLifeTimeValue=l.z.toUniform(L),z|=32768,P.push(["ROT_Z_LIFETIME",1])),(null==l?void 0:l.x)&&(k.uRXByLifeTimeValue=l.x.toUniform(L),z|=65536,P.push(["ROT_X_LIFETIME",1])),(null==l?void 0:l.y)&&(k.uRYByLifeTimeValue=l.y.toUniform(L),z|=1<<17,P.push(["ROT_Y_LIFETIME",1])),(null==l?void 0:l.asRotation)&&(P.push(["ROT_LIFETIME_AS_MOVEMENT",1]),z|=1<<18),k.uGravityModifierValue=f.toUniform(L),g&&(P.push(["FINAL_TARGET",!0]),z|=1<<19,k.uFinalTarget=new Float32Array(g.target||[0,0,0]),k.uForceCurve=g.curve.toUniform(L)),R&&F.max?(z|=1<<20,k.uFCurveValueTexture=fn(t,Wa.getAllData(F,!0),F.index,1)):k.uFCurveValues=Wa.getAllData(F),L.max+L.curves.length-32>O&&R&&V){var B=fn(t,Wa.getAllData(L,!0),L.index,1);k.uVCurveValueTexture=B,D=1}else k.uVCurveValues=Wa.getAllData(L);var U=["-p:",C,z,L.index,L.max,F.index,F.max].join("+");P.push(["VERT_CURVE_VALUE_COUNT",L.index],["FRAG_CURVE_VALUE_COUNT",F.index],["VERT_MAX_KEY_FRAME_COUNT",L.max],["FRAG_MAX_KEY_FRAME_COUNT",F.max]),this.VERT_MAX_KEY_FRAME_COUNT=L.max;var G={shader:{fragment:Mo,vertex:"#define LOOKUP_TEXTURE_CURVE "+D+"\n"+Io,glslVersion:1===N?Rn.GLSL1:Rn.GLSL3,shared:!0,cacheId:U,macros:P,name:"particle#"+v}},H=Dr(_);k.uTexOffset=new Float32Array(M?[1/M.getWidth(),1/M.getHeight()]:[0,0]),k.uMaskTex=M,k.uColorParams=new Float32Array([M?1:0,+H,0,+(!!b&&!w)]),k.uParams=[0,0,0,0],k.uAcceleration=[(null==y?void 0:y[0])||0,(null==y?void 0:y[1])||0,(null==y?void 0:y[2])||0,0];var Y=zn.create(t,G);Y.blending=!0,Y.depthTest=!0,Y.depthMask=!!b,zr(Y,_),Br(Y,x),Object.keys(k).map((function(t){var e=k[t];if(E(e,cn))Y.setTexture(t,e);else{var i=[];switch(Ml[t]){case"vec4":Y.setVector4(t,W.fromArray(e));break;case"vec3":Y.setVector3(t,X.fromArray(e));break;case"vec2":Y.setVector2(t,j.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new W(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}Y.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),Y.setVector3("emissionColor",new X(0,0,0)),Y.setFloat("emissionIntensity",0);var Z=To.create(t,function(t,e,i){var r=Float32Array.BYTES_PER_ELEMENT,n=12*r,a={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&&(a.aSprite={size:3,stride:3*r,data:new Float32Array(0)});return{attributes:a,indices:{data:new Uint16Array(0)},name:i,maxVertex:t}}(4*d,this.useSprite,"particle#"+v)),q=wo.create(t,{name:"MParticle_"+v,material:Y,geometry:Z});this.anchor=T,this.mesh=q,this.geometry=q.firstGeometry(),this.forceTarget=g,this.sizeOverLifetime=h,this.speedOverLifetime=a,this.linearVelOverLifetime=o,this.orbitalVelOverLifetime=u,this.orbitalVelOverLifetime=u,this.gravityModifier=f,this.rotationOverLifetime=l,this.maxCount=d,this.textureOffsets=p?[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 mt(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],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.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,a=this.geometry,s=r>this.maxParticleBufferCount,o=1;this.particleCount>300?o=(this.particleCount+100)/this.particleCount:this.particleCount>100?o=1.4:this.particleCount>0&&(o=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 X,c=new _i,f=new X(1,1,1);e.transform.assignWorldTRS(l,c,f);var d,p=sa.getRotation(c,new Cn),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();h&&(d=e.sprite);for(var w=0;w<4;w++){var S=2*w,C=3*w,A=4*w,M=12*w,I=8*w;u.aPos.set(m,M),b.fill(u.aPos,M+3),u.aRot.set(v,I),u.aRot[I+3]=_,u.aRot.set(T,I+4),h&&u.aSprite.set(d,C);var R=e.uv||x;if(R){var O=h?1-y[S+1]:y[S+1];g[0]=R[0]+y[S]*R[2],g[1]=R[1]+O*R[3]}u.aOffset.set(g,A);for(var P=w+w,N=(E[P]-this.anchor.x)*f.x,L=(E[P+1]-this.anchor.y)*f.y,V=0;V<3;V++)u.aPos[M+6+V]=e.dirX.getElement(V)*N,u.aPos[M+9+V]=e.dirY.getElement(V)*L}var k=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(s){var D=F(a.getIndexData(),6*r,6*i,o);D.set(k,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,k);Object.keys(u).forEach((function(e){var r=u[e],h=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=a.getAttributeData(e);mt(l);var c=F(l,n*h,4*i*h,o);c.set(r,r.length*t),a.setAttributeData(e,c)}else a.setAttributeSubData(e,r.length*t,r)})),this.particleCount=Math.max(r,this.particleCount),a.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var s=0,o=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],o=n[f+1],u=n[f+2];var d=i-a[4*c+2],p=a[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,o=o*x+y,u=u*x+g}else s+=v,o+=y,u+=g}var b=3*c;if(a[4*c+2]<i){var T=s*(e/1e3),E=o*(e/1e3),_=u*(e/1e3);r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},e.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),a=this.geometry.getAttributeData("aSeed"),s=this.time,o=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var h=G((s-r[4*u+2])/r[4*u+3],0,1),l=8*u,c=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),f=a[8*u+3],d=c;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(E(this.rotationOverLifetime.x,Za)?d.x+=this.rotationOverLifetime.x.getValue(h,f):d.x+=this.rotationOverLifetime.x.getValue(h)),this.rotationOverLifetime.y&&(E(this.rotationOverLifetime.y,Za)?d.y+=this.rotationOverLifetime.y.getValue(h,f):d.y+=this.rotationOverLifetime.y.getValue(h)),this.rotationOverLifetime.z&&(E(this.rotationOverLifetime.z,Za)?d.z+=this.rotationOverLifetime.z.getValue(h,f):d.z+=this.rotationOverLifetime.z.getValue(h))):o.setZero(),0===d.dot(d)&&o.identity();var p=Math.PI/180,m=d.x*p,v=d.y*p,y=d.z*p,g=Math.sin(m),x=Math.sin(v),b=Math.sin(y),T=Math.cos(m),_=Math.cos(v),w=Math.cos(y);o.set(w,-b,0,b,w,0,0,0,1),o.multiply(this.tempMatrix3.set(_,0,x,0,1,0,-x,0,_)),o.multiply(this.tempMatrix3.set(1,0,0,0,T,-g,0,g,T));var S=9*u,C=o.elements;i.set(C,S),u+4<=t&&(i.set(C,S+9),i.set(C,S+18),i.set(C,S+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"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var s=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var o=0;o<t;o+=4){var u=a-r[4*o+2],h=r[4*o+3],l=u/h,c=n[8*o+3];s.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(E(this.linearVelOverLifetime.x,Za)?s.x=this.linearVelOverLifetime.x.getValue(l,c):s.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(E(this.linearVelOverLifetime.y,Za)?s.y=this.linearVelOverLifetime.y.getValue(l,c):s.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(E(this.linearVelOverLifetime.z,Za)?s.z=this.linearVelOverLifetime.z.getValue(l,c):s.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(E(this.linearVelOverLifetime.x,Za)?s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,c):s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.y&&(E(this.linearVelOverLifetime.y,Za)?s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,c):s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.z&&(E(this.linearVelOverLifetime.z,Za)?s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,c):s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,h)));var f=3*o;i[f]=s.x,i[f+1]=s.y,i[f+2]=s.z,i[f+3]=s.x,i[f+4]=s.y,i[f+5]=s.z,i[f+6]=s.x,i[f+7]=s.y,i[f+8]=s.z,i[f+9]=s.x,i[f+10]=s.y,i[f+11]=s.z}this.geometry.setAttributeData("aLinearMove",i)},e.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},t}();function Rl(t,e,i){var r;void 0===i&&(i="");var n,a=t.content,s=+((null==(r=a.renderer)?void 0:r.renderMode)||0),o=[["RENDER_MODE",s],["ENV_EDITOR",i===$n]],u=e.detail,h={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},c=u.maxVertexUniforms>0,f=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,d=0,p=0;c&&o.push(["ENABLE_VERTEX_TEXTURE",!0]),f&&(o.push(["SPEED_OVER_LIFETIME",!0]),p|=2,as(h,f));var m=a.textureSheetAnimation;m&&m.animate&&(o.push(["USE_SPRITE",!0]),p|=4);var v=a.colorOverLifetime;v&&v.color&&(o.push(["COLOR_OVER_LIFETIME",!0]),p|=16);var y=v&&v.opacity;y&&as(h,y);var g,x=a.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==x?void 0:x[r])&&(as(h,x[r]),i=1,p|=1<<7+e),o.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==x?void 0:x[n])&&(as(h,x[n]),a=1,p|=1<<10+e,g=!0),o.push(["ORB_VEL_"+t.toUpperCase(),a])})),(null==x?void 0:x.asMovement)&&(o.push(["AS_LINEAR_MOVEMENT",!0]),p|=32),g&&(null==x?void 0:x.asRotation)&&(o.push(["AS_ORBITAL_MOVEMENT",!0]),p|=64),a.sizeOverLifetime){var b=a.sizeOverLifetime;b.separateAxes?(as(h,b.x),o.push(["SIZE_Y_BY_LIFE",1]),p|=16384,as(h,b.y)):as(h,b.size)}if(a.rotationOverLifetime){var T=a.rotationOverLifetime;T.z&&(as(h,null==T?void 0:T.z),p|=32768,o.push(["ROT_Z_LIFETIME",1])),T.separateAxes&&(T.x&&(as(h,T.x),p|=65536,o.push(["ROT_X_LIFETIME",1])),T.y&&(as(h,T.y),p|=1<<17,o.push(["ROT_Y_LIFETIME",1]))),(null==T?void 0:T.asRotation)&&(o.push(["ROT_LIFETIME_AS_MOVEMENT",1]),p|=1<<18)}as(h,null==x?void 0:x.gravityOverLifetime),(null==x?void 0:x.forceTarget)&&(o.push(["FINAL_TARGET",!0]),p|=1<<19,as(h,x.forceCurve));var E=u.halfFloatTexture;E&&l.max&&(p|=1<<20);var _=u.maxVertexUniforms,w=h.max+h.curves.length-32>_;yl(dl)&&(w=!0),w&&E&&c&&(d=1);var S=["-p:",s,p,h.index,h.max,l.index,l.max].join("+"),C={fragment:Mo,vertex:"#define LOOKUP_TEXTURE_CURVE "+d+"\n"+Io,shared:!0,cacheId:S,macros:o,name:"particle#"+t.name};return o.push(["VERT_CURVE_VALUE_COUNT",h.index],["FRAG_CURVE_VALUE_COUNT",l.index],["VERT_MAX_KEY_FRAME_COUNT",h.max],["FRAG_MAX_KEY_FRAME_COUNT",l.max]),{shader:C,vertex:h.index,fragment:l.index}}function Ol(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var a=0;a<t.macros.length;a++){var s=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===s[0])s[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===s[0]){s[1]=i;break}}}var Pl=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="ParticleSystemRenderer",i}oe(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new W;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e,i=Ze(this.meshes);!(e=i()).done;){e.value.render(t)}},i.setup=function(t,e){void 0===e&&(e=null),this.meshes=[],this.materials=[],this.particleMesh=new Il(this.engine,t),e&&(this.trailMesh=new Tl(this.engine,e)),this.meshes.push(this.particleMesh.mesh),this.materials.push(this.particleMesh.mesh.material),this.trailMesh&&(this.meshes.push(this.trailMesh.mesh),this.materials.push(this.trailMesh.mesh.material))},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}(Hn),Nl=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).particleMeshProps=null,r.trailMeshProps=null,r.getHitTestParams=function(t){var e=r.interaction;if(t||e)return{type:Bn.custom,clipMasks:r.renderer.frameClipMasks,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)===fe.removeParticle,ray:t})}}},r.maskManager=new Un,i&&r.fromData(i),r}oe(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]===he.CONSTANT_VEC3?e.add(r[1]):t=xs(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},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 a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},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 a=r.first;r.removeNode(a),i=n[1]=a.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},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 cl((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1},i.onStart=function(){var t=this;this.particleMeshProps&&(this.renderer=this.item.addComponent(Pl),this.renderer.setup(this.particleMeshProps,this.trailMeshProps),this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes,this.startEmit(),this.initEmitterTransform(),this.item.on("click",(function(){var e;if((null==(e=t.interaction)?void 0:e.behavior)===fe.removeParticle){var i=t.clickedPoint.content[1];t.renderer.removeParticlePoint(i),t.clearPointTrail(i),t.clickedPoint.content=[0]}})))},i.onUpdate=function(t){this.frozen||this.update(t)},i.simulate=function(t){this.update(1e3*t),this.frozen=!0},i.update=function(t){var e=this;if(this.started){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var s=this.particleLink,o=(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],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,o,a,n)})))};if(!this.ended){var c=this.item.duration,f=this.lifetime;if(u<c){var d=1/a.rateOverTime.getValue(f),p=Math.floor((u-this.lastEmitTime)/d),m=p,v=d/p,y=i,g=r.maxCount;this.updateEmitterTransform(u);for(var x=function(){var t=s.first;return e.emissionStopped||s.length===g&&t&&t.content[0]-n>u},b=0;b<m&&b<g&&!x();b++){var T=this.createPoint(f);T.delay+=y+b*v,this.addParticle(T,g),this.lastEmitTime=u}for(var E=a.bursts,_=(null==E?void 0:E.length)-1,w=0;_>=0&&w<g&&!x();_--){var S=E[_],C=!S.disabled&&S.getGeneratorOptions(u,f);if(C){var A=a.burstOffsets[_],M=A&&A[C.cycleIndex]||[0,0,0];S.once&&this.removeBurst(_);for(var I=0;I<C.count&&w<g;I++){var R;if(x())break;var O=this.initPoint(this.shape.generate({total:C.total,index:C.index,burstIndex:I,burstCount:C.count}));O.delay+=y,w++,(R=O.transform).translate.apply(R,[].concat(M)),this.addParticle(O,g)}}}}else if(this.options.looping)l(),this.loopStartTime=i-c,this.lastEmitTime-=c,this.time-=c,a.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=c,t[2]-=c,t[3]&&(t[3].delay-=c)})),this.renderer.minusTimeForLoop(c);else{this.ended=!0,this.item.endBehavior===ce.freeze&&(this.frozen=!0)}}l()}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e,i=Ze(this.renderer.meshes);!(e=i()).done;){var r=e.value;this.maskManager.drawGeometryMask(this.engine.renderer,r.geometry,r.worldMatrix,r.material,t)}},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 a=t.last,s=!1;!s;){var o=a.content[0],u=a.content[3];if(o>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),a.pre?a=a.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=[],a=new X,s=!1;if(r&&r.content)do{var o=r.content,u=o[0];o[2];var h=o[3];if(u>this.timePassed){var l=this.getPointPosition(h),c=t.ray,f=!1;c&&(f=!!c.intersectSphere({center:l,radius:t.radius},a)),f&&(this.clickedPoint=r,n.push(l),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 a=this.trails,s=this.getPointPosition(i),o=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(l*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){s.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&s.subtract(c)}n.addTrailPoint(t,s,{color:o,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,a=t.gravity,s=void 0===a?[]:a,o=this.options.forceTarget,u=this.time-n,h=new X,l=X.fromArray(s);e.assignWorldTRS(h);var c=va(new X,this.options,l,u,r,h,i);if(o){var f=o.target||[0,0,0],d=o.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),a=e.particleFollowParent?Sn.IDENTITY:this.transform.getWorldMatrix(),s=t.position,o=a.transformPoint(s,new X),u=new sa({position:o,valid:!0}),h=t.direction;if(h=a.transformNormal(h,Ll).normalize(),e.startTurbulence&&e.turbulence){for(var l=0;l<3;l++)zl.setElement(l,e.turbulence[l].getValue(i));Bl.setFromVector3(zl.negate()),Gl.setFromEuler(Bl).transformNormal(h).normalize()}var c,f=kl,d=Dl;r.alignSpeedDirection?(d.copyFrom(h),this.upDirectionWorld||(r.upDirection?this.upDirectionWorld=r.upDirection.clone():this.upDirectionWorld=X.Z.clone(),a.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=Ul)[0]=p.animationDelay.getValue(i),c[1]=p.animationDuration.getValue(i),c[2]=p.cycles.getValue(i));var m=Vl;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=Fl;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 X;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:Xl(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&&E(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:Bn.sphere,area:t}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e;this.props=i;var r,n,a,s,o,u=i.options,h=i.positionOverLifetime,l=void 0===h?{}:h,c=i.shape,f=null==l?void 0:l.gravityOverLifetime,d=ya(null==l?void 0:l.gravity),p=i.textureSheetAnimation,m=p?{animationDelay:xs(p.animationDelay||0),animationDuration:xs(p.animationDuration||1),cycles:xs(p.cycles||1),animate:p.animate,col:p.col,row:p.row,total:p.total||p.col*p.row}:void 0,v=!!(c&&c.turbulenceX||(null==c?void 0:c.turbulenceY)||(null==c?void 0:c.turbulenceZ));v&&(r=[xs(null!=(n=c.turbulenceX)?n:0),xs(null!=(a=c.turbulenceY)?a:0),xs(null!=(s=c.turbulenceZ)?s:0)]);this.name="ParticleSystem",this.shape=Oh(c),this.emission={rateOverTime:xs(i.emission.rateOverTime),burstOffsets:jl(null!=(o=i.emission.burstOffsets)?o:[]),bursts:(i.emission.bursts||[]).map((function(t){return new hl(t)}))},this.textureSheetAnimation=m;var y,g,x=i.renderer||{},b=i.rotationOverLifetime;b&&((y={}).asRotation=!!b.asRotation,y.z=b.z?xs(b.z):xs(0),b.separateAxes&&(y.x=b.x&&xs(b.x),y.y=b.y&&xs(b.y))),(null==l?void 0:l.forceTarget)&&(g={target:l.target||[0,0,0],curve:xs(l.forceCurve||[he.LINE,[[0,0],[1,1]]])});var T={x:l.linearX&&xs(l.linearX||0),y:l.linearY&&xs(l.linearY||0),z:l.linearZ&&xs(l.linearZ||0),asMovement:l.asMovement},_={x:l.orbitalX&&xs(l.orbitalX),y:l.orbitalY&&xs(l.orbitalY),z:l.orbitalZ&&xs(l.orbitalZ),center:l.orbCenter,asRotation:l.asRotation},w=i.sizeOverLifetime||{},S=i.colorOverLifetime,C=(null==w?void 0:w.separateAxes)?{separateAxes:!0,x:xs(w.x),y:xs(w.y)}:{separateAxes:!1,x:xs(("size"in w?w.size:w.x)||1)};x.anchor=x.anchor||[0,0];var A,M,I=j.fromArray(x.anchor);this.options={particleFollowParent:!!u.particleFollowParent,startLifetime:xs(u.startLifetime),startDelay:xs(u.startDelay||0),startSpeed:xs(l.startSpeed||0),startColor:xs(u.startColor),looping:null!=(A=u.looping)&&A,maxCount:null!=(M=u.maxCount)?M:0,gravityModifier:xs(f||0),gravity:d,start3DSize:!!u.start3DSize,startTurbulence:v,turbulence:r,speedOverLifetime:l.speedOverLifetime&&xs(l.speedOverLifetime),linearVelOverLifetime:T,orbitalVelOverLifetime:_,forceTarget:g},u.startRotationZ&&(this.options.startRotation=xs(u.startRotationZ||0)),(u.startRotationX||u.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=xs(u.startRotationX||0),this.options.startRotationY=xs(u.startRotationY||0),this.options.startRotationZ=xs(u.startRotationZ||0)),u.start3DSize?(this.options.startSizeX=xs(u.startSizeX),this.options.startSizeY=xs(u.startSizeY)):(this.options.startSize=xs(u.startSize),this.options.sizeAspect=xs(u.sizeAspect||1)),i.mask&&this.maskManager.setMaskOptions(this.engine,i.mask);var R={name:this.name,matrix:Sn.IDENTITY,shaderCachePrefix:"",renderMode:x.renderMode||ee.BILLBOARD,side:x.side||Zt.DOUBLE,gravity:d,blending:x.blending||Yt.ALPHA,rotationOverLifetime:y,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:m,occlusion:!!x.occlusion,transparentOcclusion:!!x.transparentOcclusion,maxCount:u.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:g,diffuse:x.texture?this.engine.findObject(x.texture):void 0,sizeOverLifetime:C,anchor:I};if(S){var O=S.color,P=S.opacity;R.colorOverLifetime={},P&&(R.colorOverLifetime.opacity=xs(S.opacity)),O&&(O[0]===he.GRADIENT_COLOR?R.colorOverLifetime.color=S.color[1]:O[0]===he.RGBA_COLOR?R.colorOverLifetime.color=cn.createWithData(this.engine,{data:new Uint8Array(O[1]),width:1,height:1}):E(O,cn)&&(R.colorOverLifetime.color=O))}var N,L=[],F=[0,0,1,1];if(i.splits){var V=i.splits[0];F=(N=V[4])?[V[0],V[1],V[3],V[2]]:[V[0],V[1],V[2],V[3]]}if(m&&!m.animate)for(var k=N?m.row:m.col,D=N?m.col:m.row,z=m.total||k*D,B=0,U=0;U<k;U++)for(var G=0;G<D&&B<z;G++,B++)L.push([U*F[2]/k+F[0],G*F[3]/D+F[1],F[2]/k,F[3]/D]);else L.push(F);this.uvs=L,R.textureFlip=N;var X,W=i.trails;W&&(this.trails={lifetime:xs(W.lifetime),dieWithParticles:!1!==W.dieWithParticles,sizeAffectsWidth:!!W.sizeAffectsWidth,sizeAffectsLifetime:!!W.sizeAffectsLifetime,inheritParticleColor:!!W.inheritParticleColor,parentAffectsPosition:!!W.parentAffectsPosition},X={name:"Trail",matrix:Sn.IDENTITY,minimumVertexDistance:W.minimumVertexDistance||.02,maxTrailCount:u.maxCount,pointCountPerTrail:Math.round(W.maxPointPerTrail)||32,blending:W.blending,texture:W.texture?this.engine.findObject(W.texture):void 0,opacityOverLifetime:xs(W.opacityOverLifetime||1),widthOverTrail:xs(W.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!W.occlusion,transparentOcclusion:!!W.transparentOcclusion,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},W.colorOverLifetime&&W.colorOverLifetime[0]===he.GRADIENT_COLOR&&(X.colorOverLifetime=W.colorOverLifetime[1]),W.colorOverTrail&&W.colorOverTrail[0]===he.GRADIENT_COLOR&&(X.colorOverTrail=W.colorOverTrail[1])),this.particleMeshProps=R,X&&(this.trailMeshProps=X);var H,Y=i.interaction;Y&&(this.interaction={multiple:Y.multiple,radius:null!=(H=Y.radius)?H:.4,behavior:Y.behavior});this.item.getHitTestParams=this.getHitTestParams},xr(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}(br);Nl=_([$e(ze.ParticleSystem)],Nl);var Ll=new X,Fl=new j,Vl=new Cn,kl=new X,Dl=new X,zl=new X,Bl=new Cn,Ul=[0,0,0],Gl=new Sn;function jl(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var i=E(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 Xl(t,e){var i=Math.floor(Math.random()*t.length),r=t[i];return e||t.splice(i,1),r}var Wl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.create=function(t,e){var i=e[this.getInstanceId()];if(E(i,oa))for(var r,n=Ze(this.getChildTracks());!(r=n()).done;){var a=r.value;if(E(a,nh)){if(i.getComponent(Nl))for(var s,o=t.createTrack(ch,this,"ParticleTrack"),u=Ze(a.getClips());!(s=u()).done;){var h=s.value,l=o.createClip(Al);l.start=h.start,l.duration=h.duration,l.endBehavior=h.endBehavior}if(i.getComponent(lc))for(var c,f=t.createTrack(sc,this,"SpriteComponentTimeTrack"),d=Ze(a.getClips());!(c=d()).done;){var p=c.value,m=f.createClip(uc);m.start=p.start,m.duration=p.duration,m.endBehavior=p.endBehavior}if(i.getComponent(qs))for(var v,y=t.createTrack(oc,this,"EffectComponentTimeTrack"),g=Ze(a.getClips());!(v=g()).done;){var x=v.value,b=y.createClip(uc);b.start=x.start,b.duration=x.duration,b.endBehavior=x.endBehavior}break}}},e}(ih);Wl=_([$e(ze.ObjectBindingTrack)],Wl);var Hl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){return new Vu},e}(Mu);Hl=_([$e(ze.ActivationPlayableAsset)],Hl);var Yl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Yl.prototype,"curveData",void 0),Yl=_([$e(ze.ColorPropertyPlayableAsset)],Yl);var Zl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Zl.prototype,"curveData",void 0),Zl=_([$e(ze.FloatPropertyPlayableAsset)],Zl);var ql=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){return new ju},e}(Mu);ql=_([$e(ze.SubCompositionPlayableAsset)],ql);var Kl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Kl.prototype,"curveData",void 0),Kl=_([$e(ze.Vector4PropertyPlayableAsset)],Kl);var Ql=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Ql.prototype,"curveData",void 0),Ql=_([$e(ze.Vector3PropertyPlayableAsset)],Ql);var Jl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Jl.prototype,"curveData",void 0),Jl=_([$e(ze.Vector2PropertyPlayableAsset)],Jl);var $l=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}(),tc=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}oe(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=Ze(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,s=Ze(t.getChildTracks());!(a=s()).done;){var o=a.value;this.addSubTracksRecursive(o,e)}},xr(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=Ze(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(ii);_([ti()],tc.prototype,"tracks",void 0),tc=_([$e(ze.TimelineAsset)],tc);var ec=function(){function t(t,e){this.masterTrackInstances=[],this.clips=[];for(var i,r={},n=Ze(e);!(i=n()).done;){var a=i.value;r[a.key.getInstanceId()]=a.value}for(var s,o=Ze(t.tracks);!(s=o()).done;){var u=s.value;E(u,Wl)&&u.create(t,r)}this.compileTracks(t.flattenedTracks,e)}var e=t.prototype;return e.evaluate=function(t,e){for(var i,r=Ze(this.clips);!(i=r()).done;){i.value.evaluateAt(t)}for(var n,a=Ze(this.masterTrackInstances);!(n=a()).done;){var s=n.value;this.tickTrack(s,e)}},e.compileTracks=function(t,e){for(var i,r=t,n={},a=Ze(r);!(i=a()).done;){var s=i.value,o=s.createPlayableGraph(this.clips),u=s.createOutput(),h=new $l(s,o,u);n[s.getInstanceId()]=h,s.parent||this.masterTrackInstances.push(h)}for(var l,c=Ze(r);!(l=c()).done;)for(var f,d=l.value,p=n[d.getInstanceId()],m=Ze(d.getChildTracks());!(f=m()).done;){var v=n[f.value.getInstanceId()];p.addChild(v)}for(var y,g=Ze(e);!(y=g()).done;){var x=y.value;n[x.key.getInstanceId()].boundObject=x.value}for(var b,T=Ze(this.masterTrackInstances);!(b=T()).done;){var E=b.value;this.updateTrackAnimatedObject(E)}},e.tickTrack=function(t,e){var i=t.output.context;i.deltaTime=e,t.output.setUserData(t.boundObject);for(var r,n=Ze(t.mixer.clipPlayables);!(r=n()).done;){var a=r.value;a.getPlayState()===wu.Playing&&a.processFrame(i)}t.mixer.evaluate(i);for(var s,o=Ze(t.children);!(s=o()).done;){var u=s.value;this.tickTrack(u,e)}},e.updateTrackAnimatedObject=function(t){for(var e,i=Ze(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}(),ic=[[0,0,1,1,0]],rc=0,nc=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new Ru;return t.create(this.data),t},i.fromData=function(t){this.data=t},e}(Mu);nc=_([$e(ze.SpriteColorPlayableAsset)],nc);var ac=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Lu},e}(ih),sc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(lc)},e}(ac),oc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(qs)},e}(ac),uc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){return new hc},e}(Mu),hc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(Cu),lc=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).time=0,r.duration=1,r.splits=ic,r.name="MSprite"+rc++,i&&r.fromData(i),r}oe(e,t);var i=e.prototype;return i.onUpdate=function(e){var i=this;t.prototype.onUpdate.call(this,e);var r,n=this.time,a=this.duration,s=this.textureSheetAnimation,o=null==(r=null==s?void 0:s.loop)||r;n>a&&o&&(n%=a);var u=Math.min(Math.max(n/a,0),1),h=this.renderer.texture.source.video;if(h&&(0===n?h.pause():h.play().catch((function(t){i.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),s){var l,c,f,d,p,m=s.total||s.row*s.col,v=0,y=0,g=1,x=1;if(this.splits){var b=this.splits[0];c=b[4],v=b[0],y=b[1],c?(g=b[3],x=b[2]):(g=b[2],x=b[3])}if(c?(f=1/s.row*g,d=1/s.col*x):(f=1/s.col*g,d=1/s.row*x),s.animate){var T=Math.round(u*(m-1)),E=Math.floor(T/s.col),_=T-E*s.col;p=c?[f*E,d*(s.col-_)]:[f*_,d*(1+E)]}else p=[0,d];null==(l=this.material.getVector4("_TexOffset"))||l.setFromArray([v+p[0],x+y-p[1],f,d])}this.time=n+e/1e3},i.onDisable=function(){t.prototype.onDisable.call(this),this.time=0},i.onDestroy=function(){var t=this.renderer.texture.source;t.sourceType===Mr.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]),a=n?e[3]:e[2],s=n?e[2]:e[3],o=n?-Math.PI/2:0,u=t.getAttributeData("aUV"),h=t.getAttributeData("aPos"),l=t.getIndexData(),c=[0,0];if(u&&h&&l){for(var f=u.length/2,d=0;d<f;d++){var p=3*d,m=2*d,v=h[p],y=h[p+1];c[0]=v,c[1]=y,ol(c,c,o),u[m]=(c[0]+.5)*a+i,u[m+1]=(c[1]+.5)*s+r}this.geometry.setAttributeData("aPos",h.slice()),this.geometry.setAttributeData("aUV",u.slice()),this.geometry.setIndexData(l.slice()),this.geometry.setDrawCount(l.length)}this.geometry.subMeshes.length=0;for(var g,x=Ze(t.subMeshes);!(g=x()).done;){var b=g.value;this.geometry.subMeshes.push({offset:b.offset,indexCount:b.indexCount,vertexCount:b.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=[],a=[],s=[],o=0;o<2;o++)for(var u=0;u<2;u++){var h=4*(2*u+o),l=e?[0,0,1,1,t[0][4]]:t[2*u+o],c=l[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],f=((o+o+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),a.push(h,1+h,2+h,2+h,1+h,3+h)}i.setAttributeData("aPos",new Float32Array(s)),i.setIndexData(new Uint16Array(a)),i.setAttributeData("aUV",new Float32Array(n)),i.setDrawCount(a.length)},i.fromData=function(e){var i;t.prototype.fromData.call(this,e);var r=null!=(i=e.splits)?i:ic,n=e.textureSheetAnimation;this.splits=r,this.textureSheetAnimation=n;var a=e.geometry?this.engine.findObject(e.geometry):this.defaultGeometry;1===r.length?this.updateGeometry(a):this.updateGeometryFromMultiSplit(),this.interaction=e.interaction;var s,o=e.options.startColor||[1,1,1,1];this.material.setColor("_Color",(new H).setFromArray(o)),this.duration=null!=(s=e.duration)?s:this.item.duration},e}(iu);lc=_([$e(ze.SpriteComponent)],lc);var cc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(lu(ae)),fc=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 mt(t),t}if(yl(pl))return e._createOffscreenCanvas(10,10);var i=c.createElement("canvas");return i.getContext("2d",{willReadFrequently:!0}),i},i.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?P(this.elements,t):t.remove()},t}()),dc=function(){function t(t){this.width=0,this.height=0,this.autoResize=Te.fixed,this.keepWordIntact=!0,this.update(t)}var e=t.prototype;return e.update=function(t){var e=t.textHeight,i=void 0===e?100:e,r=t.textWidth,n=void 0===r?100:r,a=t.textOverflow,s=void 0===a?be.clip:a,o=t.textVerticalAlign,u=void 0===o?we.top:o,h=t.textAlign,l=void 0===h?_e.left:h,c=t.letterSpace,f=void 0===c?0:c,d=t.fontSize,p=t.lineHeight,m=void 0===p?d:p,v=t.autoResize,y=void 0===v?Te.fixed:v,g=t.keepWordIntact,x=void 0===g||g;this.letterSpace=f,this.overflow=s,this.textVerticalAlign=u,this.textAlign=l,this.width=n,this.height=i,this.autoResize=y,this.keepWordIntact=x,this.lineHeight=m},e.getOffsetY=function(t,e,i,r,n){var a=(i-r)/3,s=r,o=void 0!==n?n:i*(e-1),u=0;switch(this.textVerticalAlign){case we.top:u=s+a;break;case we.middle:u=(this.height-o+s)/2;break;case we.bottom:u=this.height-o-a}return u},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case _e.left:i=0;break;case _e.middle:i=(this.width-e)/2;break;case _e.right:i=this.width-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),pc=function(){function t(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0,this.update(t)}return t.prototype.update=function(t){var e,i,r,n,a,s,o,u=t.textColor,h=void 0===u?[1,1,1,1]:u,l=t.fontSize,c=void 0===l?40:l,f=t.outline,d=t.shadow,p=t.fontWeight,m=void 0===p?"normal":p,v=t.fontStyle,y=void 0===v?"normal":v,g=t.fontFamily,x=void 0===g?"sans-serif":g;(this.textColor=[].concat(h),this.textWeight=m,this.fontStyle=y,this.fontFamily=x,this.fontSize=c,this.isOutlined=!1,this.outlineColor=[1,1,1,1],this.outlineWidth=0,f&&(null!=(e=f.outlineWidth)?e:0)>0)&&(this.isOutlined=!0,this.outlineColor=[].concat(null!=(i=f.outlineColor)?i:[1,1,1,1]),this.outlineWidth=null!=(r=f.outlineWidth)?r:0);(this.hasShadow=!1,this.shadowBlur=2,this.shadowColor=[0,0,0,1],this.shadowOffsetX=0,this.shadowOffsetY=0,d)&&(this.hasShadow=!0,this.shadowBlur=null!=(n=d.shadowBlur)?n:2,this.shadowColor=[].concat(null!=(a=d.shadowColor)?a:[0,0,0,1]),this.shadowOffsetX=null!=(s=d.shadowOffsetX)?s:0,this.shadowOffsetY=null!=(o=d.shadowOffsetY)?o:0);this.fontOffset=0,this.fontStyle!==Ce.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},t}(),mc=function(){function t(){this.isDirty=!0,this.maxLineWidth=0,this.ALPHA_FIX_VALUE=1/255}var e=t.prototype;return e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextVerticalAlign=function(t){this.textLayout.textVerticalAlign!==t&&(this.textLayout.textVerticalAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){console.warn("setTextBaseline 已废弃,请改用 setTextVerticalAlign。本次调用将转调用 setTextVerticalAlign。"),this.setTextVerticalAlign(t)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){yt(t)?this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("Risky font family, ignored:",t)},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.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontFamily,n=e.textWeight,a=e.fontStyle,s=(t||i).toString()+"px ";return["serif","sans-serif","monospace","courier"].includes(r)?s+=r:s+='"'+r+'"',n!==Se.normal&&(s=n+" "+s),a!==Ce.normal&&(s=a+" "+s),s},e.setupOutline=function(t){void 0===t&&(t=1);var e=this.context,i=this.textStyle,r=i.outlineColor,n=i.outlineWidth,a=r[0],s=r[1],o=r[2],u=r[3];e&&(e.strokeStyle="rgba("+255*a+", "+255*s+", "+255*o+", "+u+")",e.lineWidth=2*n/t)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.shadowColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,s=e.fontScale,o=i[0],u=i[1],h=i[2],l=i[3];t&&(t.shadowColor="rgba("+255*o+", "+255*u+", "+255*h+", "+l+")",t.shadowBlur=r*s,t.shadowOffsetX=n*s,t.shadowOffsetY=-a*s)},e.disposeTextTexture=function(){var t=this.renderer.texture;t&&t!==this.engine.whiteTexture&&t.dispose()},e.renderToTexture=function(t,e,i,r,n){if(void 0===n&&(n={}),this.context&&this.canvas){var a=this.context;a.save(),this.canvas.width=t,this.canvas.height=e,a.setTransform(1,0,0,1,0,0),i||(a.translate(0,e),a.scale(1,-1)),a.clearRect(0,0,t,e),a.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",r(a),a.restore();var s=a.getImageData(0,0,t,e),o=cn.createWithData(this.engine,{data:new Uint8Array(s.data),width:s.width,height:s.height},{flipY:i,magFilter:Rr.LINEAR,minFilter:Rr.LINEAR,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE});!1!==n.disposeOld&&this.disposeTextTexture(),this.renderer.texture=o,this.material.setTexture("_MainTex",o)}},e.initTextBase=function(t){this.engine=t,this.canvas=fc.getCanvas(),fc.saveCanvas(this.canvas),this.context=this.canvas.getContext("2d",{willReadFrequently:!0})},t}(),vc=["serif","sans-serif","monospace","courier"],yc=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,gc=function(t){return" "===t||"\t"===t||" "===t},xc=0,bc=function(t){function e(e){var i;(i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.effectScaleX=1,i.effectScaleY=1,i.maxLineWidth=0,i.name="MText"+xc++,i.canvas=fc.getCanvas(),fc.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0});var r=i.getDefaultProps().options;return i.updateWithOptions(r),i}oe(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture();for(var i,r=Ze(this.materials);!(i=r()).done;){var n=i.value,a=this.transform.size.x,s=this.transform.size.y,o=this.getTextureExpandScale();a*=o[0],s*=o[1],n.setVector2("_Size",new j(a,s))}},i.render=function(t){this.maskManager.drawStencilMask(t,this),t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.material)},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.resetState(),this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new H(1,1,1,1))},i.resetState=function(){this.disposeTextTexture(),this.isDirty=!0,this.lineCount=0,this.maxLineWidth=0},i.updateWithOptions=function(t){this.textStyle?this.textStyle.update(t):this.textStyle=new pc(t),this.textLayout?this.textLayout.update(t):this.textLayout=new dc(t),this.text=t.text.toString()},i.getLineCount=function(t){var e=this.context,i=this.textLayout,r=i.letterSpace,n=i.overflow;this.maxLineWidth=0;var a=this.textLayout.width+this.textStyle.fontOffset,s=1,o=0,u=0;if(e&&(e.font=this.getFontDesc(this.textStyle.fontSize)),n===be.display){for(var h=0;h<t.length;h++){var l,c,f=t[h],d=null!=(c=null==e||null==(l=e.measureText(f))?void 0:l.width)?c:0;"\n"===f?(s++,o=0,u=0):(u>0&&(o+=r),o+=d,u++,this.maxLineWidth=Math.max(this.maxLineWidth,o))}return s}if(this.textLayout.keepWordIntact)for(var p=0,m=0,v=0;v<t.length;v++){var y,g,x=t[v],b=null!=(g=null==e||null==(y=e.measureText(x))?void 0:y.width)?g:0;if("\n"!==x)o+(u>0?r:0)+b>a&&u>0&&(s++,m>1?(this.maxLineWidth=Math.max(this.maxLineWidth,p),o-=p,u-=m):(this.maxLineWidth=Math.max(this.maxLineWidth,o),o=0,u=0),p=0,m=0),u>0&&(o+=r),o+=b,u++,gc(x)&&(p=o,m=u);else s++,this.maxLineWidth=Math.max(this.maxLineWidth,o),o=0,u=0,p=0,m=0}else for(var T=0;T<t.length;T++){var E,_,w=t[T],S=null!=(_=null==e||null==(E=e.measureText(w))?void 0:E.width)?_:0;u>0&&(o+=r),(o+S>a&&T>0||"\n"===w)&&(s++,this.maxLineWidth=Math.max(this.maxLineWidth,o),o=0,u=0),"\n"!==w&&(o+=S,u++)}return this.maxLineWidth=Math.max(this.maxLineWidth,o),s},i.setLineHeight=function(t){var e=this.textStyle.fontSize,i=Math.max(e,t);this.textLayout.lineHeight!==i&&(this.textLayout.lineHeight=i,this.isDirty=!0)},i.updateTexture=function(t){var e=this;if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var i=this.textStyle,r=this.textLayout,n=i.fontScale;r.autoResize===Te.autoWidth?(r.width=this.getTextWidth(),this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):r.autoResize===Te.autoHeight?(this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):this.lineCount=this.getLineCount(this.text);var a=r.width+i.fontOffset,s=r.height,o=i.fontSize,u=r.lineHeight;i.fontDesc=this.getFontDesc(o);var h=Array.from(this.text||""),l=this.getEffectPadding(),c=l.padL,f=l.padR,d=l.padT,p=l.padB,m=0!=(c|f|d|p),v=this.engine.gpuCapability.detail.maxTextureSize/2,y=m?a+c+f:a,g=m?s+d+p:s,x=Math.max(y,g,1);n=Math.min(n,v/x);var b=Math.ceil(y*n),T=Math.ceil(g*n),E=m?c:0,_=m?t?d:p:0;this.effectScaleX=a>0?b/(a*n):1,this.effectScaleY=s>0?T/(s*n):1;var w=.0123044998279225;this.transform.setSize(a*w,s*w),this.renderToTexture(b,T,t,(function(t){t.scale(n,n),e.maxLineWidth>a&&r.overflow===be.display?t.font=e.getFontDesc(o*a/e.maxLineWidth):t.font=i.fontDesc;var s=i.textColor,l=s[0],c=s[1],f=s[2],d=s[3];t.fillStyle="rgba("+255*l+", "+255*c+", "+255*f+", "+d+")";var p=[],m=0,v=r.getOffsetY(i,e.lineCount,u,o),y=[],g=[];if(r.keepWordIntact)for(var x=-1,b=0;b<h.length;b++){var T=h[b],w=t.measureText(T);if("\n"!==T){if(m+(y.length>0?r.letterSpace:0)+w.width>a&&y.length>0)if(x>0){var S=y.slice(0,x),C=g.slice(0,x),A=S.length>0?C[C.length-1]+t.measureText(S[S.length-1]).width:0;p.push({y:v,width:A,chars:S,charOffsetX:C}),v+=u,y=y.slice(x+1),m=0,g=[];for(var M=0;M<y.length;M++)M>0&&(m+=r.letterSpace),g.push(m),m+=t.measureText(y[M]).width;x=-1}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1;y.length>0&&(m+=r.letterSpace),g.push(m),y.push(T),m+=w.width,gc(T)&&(x=y.length-1)}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1}else for(var I=0;I<h.length;I++){var R=h[I],O=t.measureText(R);y.length>0&&(m+=r.letterSpace),(m+O.width>a&&I>0||"\n"===R)&&(p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[]),"\n"!==R&&(y.push(R),g.push(m),m+=O.width)}y.length>0&&p.push({y:v,width:m,chars:y,charOffsetX:g});var P=i.isOutlined&&i.outlineWidth>0;P&&(i.hasShadow&&e.setupShadow(),e.setupOutline(n),p.forEach((function(e){var n=_+e.y,a=e.chars.join("");if(a.length>0&&yc.test(a)){var s=t.measureText(a).width,o=r.getOffsetX(i,s);t.save(),t.direction="rtl",t.strokeText(a,E+o+s,n),t.restore()}else for(var u=r.getOffsetX(i,e.width),h=0;h<e.chars.length;h++){var l=e.chars[h],c=E+u+e.charOffsetX[h];t.strokeText(l,c,n)}})),i.hasShadow&&(t.shadowColor="transparent")),!P&&i.hasShadow&&e.setupShadow(),p.forEach((function(e){var n=_+e.y,a=e.chars.join("");if(a.length>0&&yc.test(a)){var s=t.measureText(a).width,o=r.getOffsetX(i,s);t.save(),t.direction="rtl",t.fillText(a,E+o+s,n),t.restore()}else for(var u=r.getOffsetX(i,e.width),h=0;h<e.chars.length;h++){var l=e.chars[h],c=E+u+e.charOffsetX[h];t.fillText(l,c,n)}})),i.hasShadow&&(t.shadowColor="transparent")})),this.isDirty=!1}},i.renderText=function(t){this.updateTexture()},i.getTextureExpandScale=function(){return[this.effectScaleX,this.effectScaleY]},i.getEffectPadding=function(){var t=this.textStyle,e=(t.isOutlined&&t.outlineWidth>0?Math.ceil(2*t.outlineWidth):0)+(t.hasShadow&&(t.shadowBlur>0||0!==t.shadowOffsetX||0!==t.shadowOffsetY)?Math.ceil(Math.abs(t.shadowOffsetX)+Math.abs(t.shadowOffsetY)+t.shadowBlur):0);return{padL:e,padR:e,padT:e,padB:e}},i.setAutoResize=function(t){this.textLayout.autoResize!==t&&(this.textLayout.autoResize=t,this.isDirty=!0)},i.setTextWidth=function(t){var e=Math.max(0,Number(t)||0),i=this.textLayout;i.width!==e&&(i.autoResize===Te.autoWidth&&(i.autoResize=Te.autoHeight),i.width=e,this.isDirty=!0)},i.setTextHeight=function(t){var e=Math.max(0,Number(t)||0);if(0!==e){var i=this.textLayout;i.height!==e&&(i.height=e,this.isDirty=!0)}},i.setFontSize=function(t){var e=Math.max(1,Number(t)||1);this.textStyle.fontSize!==e&&(this.textStyle.fontSize=e,this.isDirty=!0)},i.setOutlineWidth=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.outlineWidth!==e&&(this.textStyle.outlineWidth=e,this.isDirty=!0)},i.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},i.setShadowBlur=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.shadowBlur!==e&&(this.textStyle.shadowBlur=e,this.isDirty=!0)},i.setShadowColor=function(t){var e=null!=t?t:[0,0,0,1];this.textStyle.shadowColor!==e&&(this.textStyle.shadowColor=e,this.isDirty=!0)},i.setShadowOffsetX=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetX!==e&&(this.textStyle.shadowOffsetX=e,this.isDirty=!0)},i.setShadowOffsetY=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetY!==e&&(this.textStyle.shadowOffsetY=e,this.isDirty=!0)},i.getTextWidth=function(){var t,e,i,r=this.context;if(!r)return null!=(e=null==(t=this.textLayout)?void 0:t.width)?e:0;var n=(null!=(i=this.text)?i:"").toString(),a=this.textLayout,s=this.textStyle;r.font=this.getFontDesc(s.fontSize);for(var o=0,u=0,h=0;h<n.length;h++){var l=n[h];"\n"!==l?(u+=a.letterSpace||0,u+=r.measureText(l).width):(o=Math.max(o,u),u=0)}o=Math.max(o,u);var c=Math.ceil(o-(s.fontOffset||0)-1e-4)+2;return Math.max(0,c)},i.getDefaultProps=function(){return{id:"default-id-"+Math.random().toString(36).substr(2,9),item:{id:"default-item-"+Math.random().toString(36).substr(2,9)},dataType:ze.TextComponent,options:{text:"默认文本",fontFamily:"AlibabaSans-BoldItalic",fontSize:40,textColor:[1,1,1,1],fontWeight:Se.normal,letterSpace:0,textAlign:_e.middle,fontStyle:Ce.normal,textWidth:200,textHeight:42,lineHeight:40.148},renderer:{renderMode:1,anchor:[.5,.5]}}},e}(iu);kt(bc=_([$e(ze.TextComponent)],bc),[mc]);var Tc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(lu(ae)),Ec=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(ii),_c=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(ii);_([ti()],_c.prototype,"buffer",void 0),_c=_([$e(ze.BinaryAsset)],_c);var wc=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=ei(e);if(r)for(var n,a=Ze(Object.keys(r));!(n=a()).done;){var s=n.value,o=e[s];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(o)?i[s]=o:At(o)?(i[s]||(i[s]=[]),t.serializeArrayProperty(o,i[s],0)):ii.is(o)?i[s]={id:o.getInstanceId()}:It(o)&&(i[s]||(i[s]={}),t.serializeObjectProperty(o,i[s],0))}for(var u,h=Ze(Object.keys(e.definition));!(u=h()).done;){var l=u.value,c=e.definition[l];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(c)?i[l]=c:At(c)?(i[l]||(i[l]=[]),t.serializeArrayProperty(c,i[l],0)):ii.is(c)?i[l]={id:c.getInstanceId()}:It(c)&&(i[l]||(i[l]={}),t.serializeObjectProperty(c,i[l],0))}return i},t.deserialize=function(e,i){i.definition=e;var r=ei(i),n=i.engine;if(r)for(var a,s=Ze(Object.keys(r));!(a=s()).done;){var o=a.value,u=e[o];if(void 0!==u){var h=r[o].type;i[o]=t.deserializeProperty(u,n,0,h)}}i.fromData(i.definition)},t.checkTypedArray=function(t){return E(t,Int8Array)||E(t,Uint8Array)||E(t,Uint8ClampedArray)||E(t,Int16Array)||E(t,Uint16Array)||E(t,Int32Array)||E(t,Uint32Array)||E(t,Float32Array)||E(t,Float64Array)||E(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(It(t)&&1===Object.keys(t).length&&"id"in t&&Ct(t.id))},t.checkGLTFNode=function(t){return It(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return Ot(t)||E(t,u)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),!(r>14)){if(At(e)){for(var s,o=[],u=Ze(e);!(s=u()).done;){var h=s.value;o.push(t.deserializeProperty(h,i,r+1,n,a))}return o}if(t.checkDataPath(e)){var l=i.findObject(e);return a?l:e}if(Rt(e)){var c;c=n?new n:{};for(var f,d=Ze(Object.keys(e));!(f=d()).done;){var p=f.value;c[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return c}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,a=Ze(Object.keys(e));!(n=a()).done;){var s=n.value,o=e[s];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[s]=o:At(o)?(i[s]||(i[s]=[]),t.serializeArrayProperty(o,i[s],r+1)):ii.is(o)?i[s]={id:o.getInstanceId()}:It(o)&&(i[s]||(i[s]={}),t.serializeObjectProperty(o,i[s],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 a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:At(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):ii.is(a)?i[n]={id:a.getInstanceId()}:It(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}}},t}(),Sc=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(r){switch(r.dataType){case ze.Material:e=zn.create(this.engine);break;case ze.Geometry:e=To.create(this.engine);break;case ze.Texture:e=cn.create(this.engine);break;default:var n=Je(r.dataType);n&&(e=new n(this.engine))}if(e)return e.setInstanceId(r.id),this.engine.addInstance(e),wc.deserialize(r,e),e;console.warn("Constructor for DataType: "+r.dataType+" not found.")}else console.warn("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),Cc=function(){function t(){}return t.prototype.loadGUID=function(t){return T((function(){return w(this,(function(t){return[2,void 0]}))}))()},t}();function Ac(t,e){if(!t.includes(e))return t.push(e),!0}function Mc(t){if(Number.isFinite(t))return[he.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===he.CONSTANT)return[he.CONSTANT,t[1]];if("lines"===e)return[he.LINE,t[1]];if(e===he.LINE){var r=i.map((function(t){return[le.LINE,t]}));return[he.BEZIER_CURVE,r]}return"curve"===e||e===he.CURVE?[he.BEZIER_CURVE,qc(i)]:t}}function Ic(t,e){return Array.isArray(t)&&"random"===t[0]?[he.CONSTANT,t[1][e]]:Mc(t)}function Rc(t){return t&&"color"===t[0]?Lc(t[1],!0):[1,1,1,1]}function Oc(t,e){if(t)return"colors"===t[0]?[he.COLORS,t[1].map((function(t){return Lc(t,e)}))]:"gradient"===t[0]?Nc(t[1],e):"color"===t[0]?[he.RGBA_COLOR,Lc(t[1],e)]:t}function Pc(t){return t&&"random"===t[0]?[he.RANDOM,t[1]]:Mc(t)}function Nc(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),a=Lc(t[r],e);i.push([n,a[0],a[1],a[2],a[3]])})),i=i.sort((function(t,e){return t[0]-e[0]})),[he.GRADIENT_COLOR,i]}}function Lc(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 E(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=Fc(i)),i}function Fc(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Vc(t,e){return Array.isArray(t)?t[0]===he.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Nc(t[1],e):Nc(t,e)}function kc(t){if(t){if(3===t.length)return[he.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===he.BEZIER_PATH||e===he.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],s=qc(r);if(!a){a=[];for(var o=0;o<n.length;o++){var u=n[o].slice();0===o?a.push(u):o<n.length-1?(a.push(u),a.push(u)):a.push(u)}}return[he.BEZIER_CURVE_PATH,[s,n,a]]}return t}}function Dc(t){for(var e,i=Ze(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function zc(t){for(var e,i=Ze(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var Bc,Uc=Math.cos,Gc=Math.sin,jc=Math.PI/180,Xc=180/Math.PI;function Wc(t,e){return t?[t[0]-.5,.5-t[1]]:e?Yc[e]:[0,0]}var Hc,Yc=((Bc={})[ie.PARTICLE_ORIGIN_CENTER]=[0,0],Bc[ie.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Bc[ie.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Bc[ie.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Bc[ie.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Bc[ie.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Bc[ie.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Bc[ie.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Bc[ie.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Bc);function Zc(t,e,i,r){var n=i[0],a=i[1],s=r[0],o=s-n;return[[n+(s-n)/3,a+(t*=o)/3],[s-(s-n)/3,r[1]-(e*=o)/3]]}function qc(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],a=0;a<t.length-1;a++){var s=t[a][3]*(e-i),o=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],h=[t[a+1][0],t[a+1][1]];if(u[0]!=h[0]){var l=Zc(s,o,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?[le.EASE_OUT,t]:e===n.length-1?[le.EASE_IN,t]:[le.EASE,t]}))}var Kc=new Map,Qc=new Map;function Jc(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===te.null&&t.endBehavior===ce.destroy&&(t.endBehavior=ce.freeze)}))})),t.version=Wt["2_1"],t}function $c(t){for(var e,i,r,n=function(){var t=u.value;t.endBehavior!==Me&&t.endBehavior!==Ae||(t.endBehavior=ce.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===te.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,i=Ze(t.items);!(e=i()).done;){var r=e.value;h[r.id]=Ft(),r.oldId=r.id,r.id=h[r.id],l[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=h[r]+"^"+n}else e.parentId=h[e.parentId];a.items.push(e),t.items[i]={id:e.id}}));var n=gi({},t,{timelineAsset:{id:""},sceneBindings:[]});a.compositions.push(n),function(t,e,i){for(var r,n=[],a=[],s=[],o={tracks:[],id:Ft(),dataType:"TimelineAsset"},u=Ze(t.items);!(r=u()).done;){var h=e[r.value.id],l=[],c={id:Ft(),dataType:"ActivationPlayableAsset"};s.push(c);var f={id:Ft(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:c.id}}]};if(l.push({id:f.id}),a.push(f),h.type!==te.particle){var d={id:Ft(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};s.push(d);var p={id:Ft(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};l.push({id:p.id}),a.push(p)}if(h.type===te.sprite||h.type===te.text){var m={id:Ft(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};s.push(m);var v={id:Ft(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};l.push({id:v.id}),a.push(v)}if(h.type===te.composition){var y={id:Ft(),dataType:"SubCompositionPlayableAsset"};s.push(y);var g={id:Ft(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};l.push({id:g.id}),a.push(g)}var x={id:Ft(),dataType:"ObjectBindingTrack",children:l,clips:[]};a.push(x),o.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],E=Ze(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:o.id},t.sceneBindings=n,i.miscs.push(o);for(var w,S=Ze(a);!(w=S()).done;){var C=w.value;i.miscs.push(C)}for(var A,M=Ze(s);!(A=M()).done;){var I=A.value;i.miscs.push(I)}}(n,l,a)},a=gi({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),s=Ze(a.images);!(i=s()).done;){i.value.id=Ft()}if(null!=(e=a).textures||(e.textures=[]),a.textures.forEach((function(t){var e;t.id=Ft(),t.dataType=ze.Texture,t.source={id:null==(e=a.images[t.source])?void 0:e.id}})),a.textures.length<a.images.length)for(var o=a.textures.length;o<a.images.length;o++)a.textures.push({id:Ft(),dataType:ze.Texture,source:{id:a.images[o].id},flipY:!0});t.bins&&(r=t.bins,a.bins=r.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:Ft()}})));for(var u,h={},l={},c=Ze(t.compositions);!(u=c()).done;)n();for(var f,d=Ze(a.items);!(f=d()).done;){var p=f.value;if(p.content){if(p.content.renderer&&void 0!==p.content.renderer.texture){var m=p.content.renderer.texture;p.content.renderer.texture={id:a.textures[m].id}}if(p.content.trails&&void 0!==p.content.trails.texture){var v=p.content.trails.texture;p.content.trails.texture={id:a.textures[v].id}}}if(p.transform){var y,g,x,b=[].concat(null!=(y=p.transform.position)?y:[0,0,0]),T=[].concat(null!=(g=p.transform.rotation)?g:[0,0,0]),E=[].concat(null!=(x=p.transform.scale)?x:[1,1,1]);if(Object.assign(p,{transform:{position:{x:b[0],y:b[1],z:b[2]},eulerHint:{x:T[0],y:T[1],z:T[2]},scale:{x:E[0],y:E[1],z:E[0]}}}),p.type===te.sprite&&(p.transform.size={x:E[0],y:E[1]},p.transform.scale={x:1,y:1,z:1}),p.type===te.sprite){var _=p.content;_.renderer||(_.renderer={});var w,S,C,A,M=_.renderer,I=Wc(M.anchor,M.particleOrigin),R=p.transform.size;if(!M.anchor&&void 0!==M.particleOrigin)p.transform.position.x+=-I[0]*(null!=(w=null==R?void 0:R.x)?w:1),p.transform.position.y+=-I[1]*(null!=(S=null==R?void 0:R.y)?S:1);p.transform.anchor={x:I[0]*(null!=(C=null==R?void 0:R.x)?C:1),y:I[1]*(null!=(A=null==R?void 0:R.y)?A:1)}}}if(p.type===te.particle){var O=p.content;O.renderer||(O.renderer={});var P=O.renderer;O.renderer.anchor=Wc(P.anchor,P.particleOrigin)}if(p.type===te.camera&&p.content.positionOverLifetime&&0!==Object.keys(p.content.positionOverLifetime).length&&(p.content.positionOverLifetime.asMovement=!0),void 0!==p.pn){var N=p.pn,L=t.plugins,F=void 0===L?[]:L;void 0!==N&&Number.isInteger(N)&&(p.pluginName=F[N])}switch("editor-gizmo"===p.pluginName&&(p.type="editor-gizmo"),"orientation-transformer"===p.pluginName&&(p.type="orientation-transformer"),p.content.options.target&&"editor-gizmo"===p.pluginName&&(p.content.options.target=h[p.content.options.target]),p.type===te.spine&&t.spines&&0!==t.spines.length&&df(t.spines[p.content.options.spine],p.content,a),p.type!==te.sprite&&p.type!==te.particle&&p.type!==te.mesh&&p.type!==te.skybox&&p.type!==te.light&&"camera"!==p.type&&p.type!==te.tree&&p.type!==te.interact&&p.type!==te.camera&&p.type!==te.text&&p.type!==te.spine&&"editor-gizmo"!==p.type&&"orientation-transformer"!==p.type||(p.components=[],a.components.push(p.content),p.content.id=Ft(),p.content.item={id:p.id},p.dataType=ze.VFXItemData,p.components.push({id:p.content.id})),p.type!==te.null&&p.type!==te.composition||(p.components=[],p.dataType=ze.VFXItemData),p.type){case te.sprite:p.content.dataType=ze.SpriteComponent;break;case te.particle:p.content.dataType=ze.ParticleSystem;break;case te.mesh:p.content.dataType=ze.MeshComponent;break;case te.skybox:p.content.dataType=ze.SkyboxComponent;break;case te.light:p.content.dataType=ze.LightComponent;break;case"camera":p.content.dataType=ze.CameraComponent;break;case"editor-gizmo":p.content.dataType="GizmoComponent";break;case"orientation-transformer":p.content.dataType="OrientationComponent";break;case te.tree:p.content.dataType=ze.TreeComponent;break;case te.interact:p.content.dataType=ze.InteractComponent;break;case te.camera:p.content.dataType=ze.CameraController;break;case te.text:p.content.dataType=ze.TextComponent;break;case te.spine:p.content.dataType=ze.SpineComponent}}return a.version=Wt["3_0"],a}function tf(t){for(var e,i=Ze(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===ze.ShapeComponent){var n=r;if(n.type===Pe.Custom){var a,s=n;(null==(a=s.shapes)?void 0:a.length)>0&&s.shapes[0].fill&&(s.fill=s.shapes[0].fill);for(var o,u=new Array(s.easingIns.length),h=new Array(s.easingOuts.length).fill(!1),l=Ze(s.shapes);!(o=l()).done;)for(var c,f=Ze(o.value.indexes);!(c=f()).done;){var d=c.value,p=s.points[d.point],m=s.easingIns[d.easingIn],v=s.easingOuts[d.easingOut];u[d.easingIn]||(m.x-=p.x,m.y-=p.y,u[d.easingIn]=!0),h[d.easingOut]||(v.x-=p.x,v.y-=p.y,h[d.easingOut]=!0)}}}}return t.version=Wt["3_2"],t}function ef(t){Kc.clear(),Qc.clear();for(var e,i=t.compositions,r=t.items,n=Ze(t.components);!(e=n()).done;){var a=e.value;Kc.set(a.id,a)}for(var s,o=Ze(r);!(s=o()).done;){var u=s.value;Qc.set(u.id,u)}for(var h,l=Ze(i);!(h=l()).done;){lf(h.value)}return t.version=Wt["3_3"],t}function rf(t){var e;null==(e=t.plugins)||e.forEach((function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")}));for(var i,r=Ze(t.items);!(i=r()).done;){var n=i.value;if(n.type===te.sprite){var a=Kc.get(n.components[0].id);if(a){var s,o=a.renderer.shape,u=void 0;if(Number.isInteger(o))u=null==(s=t.shapes)?void 0:s[o];else u=o;a.renderer.shape=u}}}for(var h,l=t.compositionId,c={},f=Ze(t.compositions);!(h=f()).done;){var d=h.value,p=Ft();c[d.id]=p,d.id===l&&(t.compositionId=p),d.id=p;var m={id:Ft(),dataType:"CompositionComponent",items:d.items,timelineAsset:d.timelineAsset,sceneBindings:d.sceneBindings,item:{id:d.id}};d.timelineAsset=void 0,d.sceneBindings=void 0,d.components=[{id:m.id}],t.components.push(m)}for(var v,y=Ze(t.items);!(v=y()).done;){var g=v.value;if(g.content){var x=g.content.options;x&&void 0!==x.refId&&(x.refId=c[x.refId])}}return t.version=Wt["3_4"],t}function nf(t){for(var e,i={},r=Ze(t.components);!(e=r()).done;){var n=e.value;i[n.id]=n}for(var a,s=Ze(t.compositions);!(a=s()).done;)for(var o,u=a.value,h=Ze(u.components);!(o=h()).done;){i[o.value.id].item.id=u.id}for(var l,c=Ze(t.components);!(l=c()).done;){var f=l.value;if(f.dataType===ze.SpriteComponent){var d=f,p=d.renderer.shape;if(!(null==p||"aPoint"in p&&"index"in p)){var m=hf(p);d.geometry={id:m.id},t.geometries.push(m)}}if(f.dataType===ze.ShapeComponent){var v=f;if(v.fills=[],v.fill){var y={type:Re.Solid,color:v.fill.color};v.fills.push(y)}if(delete v.fill,v.strokes=[],v.stroke){var g={type:Re.Solid,color:v.stroke.color};v.strokes.push(g),v.strokeWidth=v.stroke.width,v.strokeCap=v.stroke.cap,v.strokeJoin=v.stroke.join,delete v.stroke}}}return t.version=Wt["3_5"],t}function af(t){if(t.components)for(var e,i=Ze(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===ze.RichTextComponent){var n=r;n.options&&void 0===n.options.useLegacyRichText&&(void 0===n.options.lineGap?n.options.useLegacyRichText=!0:n.options.useLegacyRichText=!1)}(r.dataType===ze.TextComponent||r.dataType===ze.RichTextComponent&&r.options)&&of(r.options),r.dataType===ze.TextComponent&&uf(r.options)}return t.version=Wt["3_6"],t}function sf(t){for(var e,i,r=function(){var e=i.value;if(e.type===te.text&&e.transform){for(var r,a,s,o=t.components.find((function(t){return e.components[0].id===t.id})),u=e.transform.scale.x/(null!=(a=null==(r=o.options)?void 0:r.textWidth)?a:1)/.0123,h=e.transform.scale.x,l=e.transform.scale.y,c=e.transform.scale.z,f=Ze(t.items);!(s=f()).done;){var d=s.value;d.parentId===e.id&&d.transform&&(d.transform.scale.x*=h/u,d.transform.scale.y*=l/u,d.transform.scale.z*=c/u)}e.transform.scale.x=u,e.transform.scale.y=u,e.transform.scale.z=u,n.push({item:e,scaleFactor:u,oldScaleX:h,oldScaleY:l,oldScaleZ:c})}},n=[],a=Ze(t.items);!(i=a()).done;)r();n.length>0&&(null==(e=t.animations)?void 0:e.length)&&function(t,e){for(var i,r=new Map,n=new Map,a=Ze(t.items);!(i=a()).done;){var s=i.value;if(r.set(s.id,s),s.parentId){var o=n.get(s.parentId);o||(o=[],n.set(s.parentId,o)),o.push(s)}}for(var u,h=new Map,l=new Map,c=Ze(e);!(u=c()).done;){var f=u.value;h.set(f.item.id,f);var d=n.get(f.item.id);if(d)for(var p,m=Ze(d);!(p=m()).done;){var v=p.value;l.set(v.id,f)}}for(var y,g=new Map,x=Ze(t.components);!(y=x()).done;){var b=y.value;g.set(b.id,b)}for(var T,E=new Map,_=Ze(t.animations);!(T=_()).done;){var w=T.value;E.set(w.id,w)}for(var S,C=Ze(t.compositions);!(S=C()).done;){for(var A,M,I,R=S.value,O=void 0,P=void 0,N=Ze(R.components);!(I=N()).done;){var L=I.value,F=g.get(L.id);if((null==F?void 0:F.dataType)===ze.Animator?O=F:(null==F?void 0:F.dataType)===ze.CompositionComponent&&(P=F),O&&P)break}if(O){var V=void 0;if(P){var k=P.items;if(k){V=[];for(var D,z=Ze(k);!(D=z()).done;){var B=D.value,U=r.get(B.id);U&&!U.parentId&&V.push(U)}}}if((!V||0===V.length)&&R.children){V=[];for(var G,j=Ze(R.children);!(G=j()).done;){var X=G.value,W=r.get(X.id);W&&V.push(W)}}if(V&&0!==V.length){var H=O,Y=E.get(null==(A=H.graphAsset)?void 0:A.id);if(null==Y||null==(M=Y.graphDataSet)?void 0:M.resources)for(var Z,q=Ze(Y.graphDataSet.resources);!(Z=q()).done;){var K=Z.value,Q=E.get(K.id);if(null==Q?void 0:Q.scaleCurves)for(var J,$=Ze(Q.scaleCurves);!(J=$()).done;){var tt=J.value,et=pf(V,tt.path,n);if(et){var it=h.get(et.id);if(it)mf(tt.keyFrames,it.scaleFactor/it.oldScaleX,it.scaleFactor/it.oldScaleY,it.scaleFactor/it.oldScaleZ);else{var rt=l.get(et.id);rt&&mf(tt.keyFrames,rt.oldScaleX/rt.scaleFactor,rt.oldScaleY/rt.scaleFactor,rt.oldScaleZ/rt.scaleFactor)}}}}}}}}(t,n);for(var s,o=new Map,u=new Map,h=new Map,l=Ze(t.components);!(s=l()).done;){var c=s.value;h.set(c.id,c)}for(var f,d=Ze(t.items);!(f=d()).done;){var p=f.value;p.children=[],o.set(p.id,p)}for(var m,v=Ze(t.compositions);!(m=v()).done;){var y=m.value;y.children=[];for(var g,x=Ze(y.components);!(g=x()).done;){var b=g.value,T=h.get(b.id);if(T.dataType===ze.CompositionComponent){for(var E,_=T,w=Ze(_.items);!(E=w()).done;){var S=E.value,C=o.get(S.id);void 0===C.parentId&&y.children.push({id:C.id})}delete _.items}}u.set(y.id,y)}for(var A,M=Ze(t.items);!(A=M()).done;){var I=A.value;if(I.parentId){var R=o.get(I.parentId);R&&R.children.push({id:I.id})}}return t.version=Wt["3_7"],t}function of(t){t&&void 0===t.TextVerticalAlign&&void 0===t.TextVerticalAlign&&(t.TextVerticalAlign=t.textBaseline)}function uf(t){if(t&&t.textColor){var e,i=t.textColor;t.textColor=[i[0]/255,i[1]/255,i[2]/255,null!=(e=i[3])?e:1]}}function hf(t,e){void 0===e&&(e="形状");for(var i=sl(t),r=i.index,n=void 0===r?[]:r,a=i.aPoint,s=void 0===a?[]:a,o=new Float32Array(s),u=[],h=[],l=0;l<o.length;l+=6)h.push(s[l+2],s[l+3]),u.push(o[l],o[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:Be.TRIANGLES,vertexData:{vertexCount:c,channels:[]},name:e,indexFormat:Ge.UInt16,indexOffset:p,buffer:"",id:Ft(),dataType:ze.Geometry,subMeshes:[]};v.vertexData.channels.push({semantic:je.Position,offset:0,format:Ue.Float32,dimension:3}),v.vertexData.channels.push({semantic:je.Uv,offset:d,format:Ue.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 lf(t){for(var e,i=Ze(t.items);!(e=i()).done;){var r=e.value,n=Qc.get(r.id);if(!n)return;if(n.type===te.sprite||n.type===te.particle||n.type===te.spine||n.type===te.text||n.type===te.richtext||n.type===te.video||n.type===te.shape){var a=Kc.get(n.components[0].id);a&&cf(a)}}}function cf(t){var e=t.renderer,i=null==e?void 0:e.maskMode;i&&i!==Er.NONE&&(i===Er.MASK?(t.mask={isMask:!0},Hc=t.id):i!==qt.OBSCURED&&i!==qt.REVERSE_OBSCURED||(t.mask={inverted:i===qt.REVERSE_OBSCURED,reference:{id:Hc}}))}function ff(t){if(t)for(var e,i=Ze(Object.keys(t));!(e=i()).done;){var r=e.value,n=t[r],a=Array.isArray(n);a&&2===n.length&&Array.isArray(n[1])?t[r]="path"===r?kc(n):Mc(n):a||"object"!=typeof n||ff(n)}}function df(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 pf(t,e,i){var r=function(t){var e;a=null==(e=i.get(a.id))?void 0:e.find((function(e){return e.name===n[t]}))};if(e){for(var n=e.split("/"),a=t.find((function(t){return t.name===n[0]})),s=1;s<n.length&&a;s++)r(s);return a}}function mf(t,e,i,r){if(Array.isArray(t)&&t[0]===he.VECTOR3_CURVE){var n=t[1];Array.isArray(n)&&3===n.length&&(vf(n[0],e),vf(n[1],i),vf(n[2],r))}}function vf(t,e){if(Array.isArray(t)&&t[0]===he.BEZIER_CURVE&&Array.isArray(t[1]))for(var i,r=Ze(t[1]);!(i=r()).done;){var n=i.value;if(Array.isArray(n)&&!(n.length<2)&&Array.isArray(n[1]))for(var a=n[1],s=1;s<a.length;s+=2)a[s]*=e}}function yf(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:kc(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:Mc(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:Mc(n.linearX),linearY:Mc(n.linearY),linearZ:Mc(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Mc(n.orbitalX),orbitalY:Mc(n.orbitalY),orbitalZ:Mc(n.orbitalZ),speedOverLifetime:Mc(n.speedOverLifetime)};zc(a);var s={options:{startColor:Rc(r.startColor)},positionOverLifetime:a};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var o=t.rotationOverLifetime;if(o){var u=s.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=Mc(o.x),u.y=Mc(o.y),u.z=Mc(o.z)):u.z=Mc(o.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=s.colorOverLifetime={opacity:Mc(h.opacity)};h.color&&(l.color=Vc(h.color))}var c=t.sizeOverLifetime;return c&&(s.sizeOverLifetime={separateAxes:c.separateAxes,size:Mc(c.size),x:Mc(c.x),y:Mc(c.y),z:Mc(c.z)}),s}var gf="2.9.1",xf=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,bf=/^(\d+)\.(\d+)$/,Tf=!1;function Ef(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,a,s=null!=(n=xf.exec(r))?n:[],o=null!=(a=xf.exec(gf))?a:[],u=s[1],h=s[2],l=o[1],c=o[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: "+gf+"). 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!==te.mesh&&t.type!==te.light||(t.endBehavior=1===t.endBehavior?ce.destroy:t.endBehavior)}))}))}(t),xf.test(t.version))return Tf="0"===(null==(i=/^(\d+)/.exec(t.version))?void 0:i[0]),sf(af(nf(rf(ef(tf($c(Jc(function(t){var e;_f=Wt["1_0"];var i=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(_f=Wt["1_3"]);var r,n=(t.requires||[]).slice(),a=t.images.map((function(e,i){return wf(e,i,t.imageTags||[])})),s=t.textures||a.map((function(t,e){return{source:e,flipY:!0}})),o={plugins:i,shapes:t.shapes||[],type:"ge",version:_f,playerVersion:null!=(r=t.playerVersion)?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return Sf(t,{plugins:i,requires:n})})),images:a,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:s,bins:(t.bins||[]).slice()};t._textures&&(o._textures=t._textures);return o}(t)))))))));Tf=!1;var r=bf.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]);if(n)return(n<2||2===n&&a<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,i=Ze(t.items);!(e=i()).done;)ff(e.value.content)})),t}(t)),n<3&&(t=$c(Jc(t))),r=bf.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]),n<4&&(a<2&&(t=tf(t)),a<3&&(t=ef(t)),a<4&&(t=rf(t)),a<5&&(t=nf(t)),a<6&&(t=af(t)),a<7&&(t=sf(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var _f=Wt["1_0"];function wf(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 Sf(t,e){var i;void 0===e&&(e={});var r={id:t.id+"",camera:gi({clipMode:Ie},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return If(t,e)})),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var Cf,Af=[0,0,0,1],Mf=.5;function If(t,e){var i;void 0===e&&(e={});var r,n,a,s,o,u,h=te.base,l=t.endBehavior,c=NaN;if(t.content?(h=t.type||te.plugin,u=t.pn,o=t.pluginName,a=t.content,n=t.content,isNaN(u)&&!o&&(o=a.options.type),t.duration&&(c=t.duration),r=t.transform||y(n.transform)):t.particle?(h=te.particle,r=y((n=t.particle).transform,Tf,!0),a=function(t){var e=t.options,i=t.transform,r={type:Kt.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=gi({},t.shape,{type:Kt[a]}),t.shape.upDirection){var s=t.shape.upDirection,o=s[0],u=s[1],h=s[2];0===o&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=Pc(e.turbulenceX),r.turbulenceY=Pc(e.turbulenceY),r.turbulenceZ=Pc(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return Dc(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return Dc(t)}))),l.rateOverTime&&(l.rateOverTime=Pc(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:Pc(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Pc(e.startSize),startSizeX:Pc(e.startSizeX),startSizeY:Pc(e.startSizeY),sizeAspect:Pc(e.sizeAspect),maxCount:e.maxCount,startDelay:Pc(e.startDelay),startColor:Oc(e.startColor,!0),startRotationZ:Pc(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=Pc(e.startRotationX),c.options.startRotationY=Pc(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:kc(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:Pc(f.x),y:Pc(f.y)}:c.sizeOverLifetime={size:Pc(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?Mc(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Mc(e.gravityModifier),startSpeed:Pc(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:Pc(d.linearX),linearY:Pc(d.linearY),linearZ:Pc(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Pc(d.orbitalX),orbitalY:Pc(d.orbitalY),orbitalZ:Pc(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Mc(d.forceCurve)},zc(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Pc(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=Mc(m.y),c.rotationOverLifetime.x=Mc(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:Mc(v.opacity)};v.color&&(y.color=Vc(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Mc(g.cycles),animationDelay:Ic(g.animationDelay,0),animationDuration:Ic(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:Pc(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Mc(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Vc(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Vc(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:Pc(x.opacityOverLifetime)}),c.trails&&zc(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(n)):t.sprite?(h=te.sprite,a=function(t,e){var i=yf(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=te.null,a=yf(n=t.cal,r=y(n.transform,!1,!0))):t.ui?(h=te.interact,r=y((n=t.ui).transform),a=function(t){var e,i=t.options;switch(i.type){case"click":e={type:Jt.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&Rc(i.previewColor),behavior:i.behavior||$t.NOTIFY};break;case"drag":e={type:Jt.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:Jt.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=te.camera,r=y(n.transform),a=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 a,s={path:kc(null==(a=t.transform)?void 0:a.path),linearX:Mc(null==n?void 0:n.translateX),linearY:Mc(null==n?void 0:n.translateY),linearZ:Mc(null==n?void 0:n.translateZ)};zc(s),r.positionOverLifetime=s}var o=t.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:Mc(null==o?void 0:o.rotateX),y:Mc(null==o?void 0:o.rotateY),z:o.separateAxes?Mc(null==o?void 0:o.rotateZ):Mc(o.rotation)};zc(u),r.rotationOverLifetime=u}return r}(n))),null==(i=a.renderer)?void 0:i.anchor){var f=new Float32Array(a.renderer.anchor);f[0]==Mf&&f[1]==Mf?delete a.renderer.anchor:e.requires&&Ac(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]?ce.restart:ce.destroy:ce.restart;else l=l||(null==n||null==(p=n.options)?void 0:p.endBehavior)||ce.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:a};return o?e.plugins?(Ac(e.plugins,o),v.pn=e.plugins.indexOf(o)):v.pluginName=o: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 a=(s=Af,o=r.rotation[0],u=r.rotation[1],h=r.rotation[2],l=Uc(o*jc/2),c=Uc(u*jc/2),f=Uc(h*jc/2),d=Gc(o*jc/2),p=Gc(u*jc/2),m=Gc(h*jc/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,a=e[0],s=e[1],o=e[2],u=e[3],h=a+a,l=s+s,c=o+o,f=a*h,d=s*h,p=s*l,m=o*c,v=u*c,y=1-p-m,g=d-v,x=d+v,b=1-f-m,T=o*h-u*l,E=o*l+u*h,_=1-f-p;return t[1]=Math.asin((r=-1,(i=-T)>(n=1)?n:i<r?r:i))*Xc,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Xc,t[2]=Math.atan2(x,y)*Xc):(t[0]=0,t[2]=Math.atan2(-g,b)*Xc),t}([],a)}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,o,u,h,l,c,f,d,p,m;return{}}}var Rf,Of=((Cf={})[Ht.S]=[Ht.S,Ht.BPlus,Ht.APlus],Cf[Ht.A]=[Ht.A,Ht.BPlus,Ht.APlus],Cf[Ht.B]=[Ht.B,Ht.BPlus],Cf);function Pf(t,e){if(!t||!e)return!0;var i=Of[e];return!!i&&i.includes(t)}function Nf(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,s=n.url;return a&&(e&&e[a]?i=e[a]:s&&(i=s)),i}function Lf(t,e,i){return Ff.apply(this,arguments)}function Ff(){return(Ff=T((function(t,e,i){var r,n;return w(this,(function(a){switch(a.label){case 0:return"string"!=typeof t?[3,2]:[4,qr(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw new Error("Image not provided.");if(!e)return[2,r];if(n=Nf(e,i)){if(Ct(n)&&n!==r.src)return[2,qr(n)];if(E(n,u))return[2,n]}return[2,r]}}))}))).apply(this,arguments)}!function(t){t.isJSONObject=function(t){return It(t)&&"jsonScene"in t},t.isURL=function(t){return It(t)&&"url"in t},t.isWithOptions=function(t){return It(t)&&"options"in t}}(Rf||(Rf={}));var Vf=function(t,e){void 0===e&&(e={}),this.scene=t,this.options=e},kf=1,Df=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Gr),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=kf++,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){var r=this;return T((function(){var n,a,s,o,u,l,c,p,m,v,y,g,x;return w(this,(function(b){return a=Ct(t)?t:r.id,s=f.now(),o=[],u=null==i?void 0:i.engine.gpuCapability,c=null!=(l=null==u?void 0:u.detail.ktx2Support)&&l,p={},v=!1,y=new Promise((function(t,i){m=e.setTimeout((function(){v=!0,r.removeTimer(m);var t=f.now()-s;i(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+o.join(" ")+", url: "+a+"."))}),1e3*r.timeout),r.timers.push(m)})),g=T((function(t,e){var i,r,n,a;return w(this,(function(s){switch(s.label){case 0:if(v)return[3,4];i=f.now(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e()];case 2:return r=s.sent(),n=f.now()-i,o.push("["+t+": "+n.toFixed(2)+"]"),p[t]=n,[2,r];case 3:throw a=s.sent(),new Error("Load error in "+t+", "+a+".");case 4:throw new Error("Load canceled.")}}))})),x=T((function(){var i,u,l,v,y,x,b,T,E,_,S,C,A,M,I;return w(this,(function(w){switch(w.label){case 0:return Ct(t)?(u=new h(t,d.href).href,r.baseUrl=u,[4,g("loadJSON",(function(){return r.loadJSON(u)}))]):[3,2];case 1:return Ct(n=w.sent())&&(n=JSON.parse(n)),[3,3];case 2:n=t,r.baseUrl=d.href,w.label=3;case 3:return Rf.isJSONObject(n)?(i=gi({},n),[3,9]):[3,4];case 4:return[4,g("processJSON",(function(){return r.processJSON(n)}))];case 5:return x=w.sent().jsonScene,i={timeInfos:p,url:t,storage:{},jsonScene:x,bins:[],textureOptions:[],images:[],assets:r.assets},[4,g("plugin:onAssetsLoadStart",(function(){return r.onPluginSceneLoadStart(i)}))];case 6:return w.sent(),b=x.bins,T=void 0===b?[]:b,E=x.images,_=x.fonts,[4,Promise.all([g("processBins",(function(){return r.processBins(T)})),g("processImages",(function(){return r.processImages(E,c)})),g("processFontURL",(function(){return r.processFontURL(_)}))])];case 7:return S=w.sent(),C=S[0],A=S[1],[4,g("processTextures",(function(){return r.processTextures(A,C,x)}))];case 8:M=w.sent(),(l=i.bins).push.apply(l,[].concat(C)),(v=i.textureOptions).push.apply(v,[].concat(M)),(y=i.images).push.apply(y,[].concat(A)),i.renderLevel=r.options.renderLevel,w.label=9;case 9:return I=f.now()-s,wt.info("Load asset: totalTime: "+I.toFixed(4)+"ms "+o.join(" ")+", url: "+a+"."),e.clearTimeout(m),r.removeTimer(m),i.totalTime=I,i.startTime=s,i.timeInfos=p,[2,i]}}))})),[2,Promise.race([y,x()])]}))}))()},i.getAssets=function(){return this.assets},i.processJSON=function(t){return T((function(){var e,i,r,n,a;return w(this,(function(s){for(e=Ef(t),i=e.plugins,r=Ze(void 0===i?[]:i);!(n=r()).done;)if(a=n.value,!Dt[a])throw new Error("The plugin '"+a+"' not found."+Xt(a));return[2,{jsonScene:e}]}))}))()},i.processBins=function(t){var e=this;return T((function(){var i,r,n;return w(this,(function(a){return i=e.options.renderLevel,r=e.baseUrl,n=t.map((function(n){if(E(n,ArrayBuffer))return n;if(Pf(n.renderLevel,i))return e.loadBins(new h(n.url,r).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(n)]}))}))()},i.processFontURL=function(e){var i=this;return T((function(){return w(this,(function(r){return[2,t.loadFontFamily(e,i.baseUrl)]}))}))()},i.processImages=function(t,e){void 0===e&&(e=!1);var i=this;return T((function(){var r,n,a,s,o,l,c,f;return w(this,(function(d){switch(d.label){case 0:return r=i.options,n=r.useCompressedTexture,a=r.variables,s=r.disableWebP,o=r.disableAVIF,l=i.baseUrl,c=t.map(T((function(t,r){var c,f,d,v,y,g,x,b,T,_,S,C,A,M,I,R,O,P,N,L;return w(this,(function(r){switch(r.label){case 0:if(c=t.url,f=t.webp,d=t.avif,v=t.ktx2,y=new h(c,l).href,g=!s&&f?new h(f,l).href:void 0,x=!o&&d?new h(d,l).href:void 0,b=v&&n&&e?new h(v,l).href:void 0,T=t.id,!("template"in t))return[3,8];if(_=t.template,!(S=_.background))return[3,7];C=Nf(_,a),A=S.type===Ve.video,M=S&&A?en:qr,r.label=1;case 1:return r.trys.push([1,6,,7]),[4,nn(C,M)];case 2:return E(I=r.sent(),m)?(i.sourceFrom[T]={url:I.src,type:Mr.video},[2,I]):[3,3];case 3:return S&&Array.isArray(C)&&a&&(a[S.name]=I.src),i.sourceFrom[T]={url:I.src,type:Mr.image},[4,Lf(I,_,a)];case 4:return[2,r.sent()];case 5:return[3,7];case 6:throw R=r.sent(),new Error("Failed to load. Check the template or if the URL is "+(A?"video":"image")+" type, URL: "+C+", Error: "+(R.message||R)+".");case 7:return[3,9];case 8:if("ktx2"in t&&b)return i.sourceFrom[T]={url:b,type:Mr.compressed},[2,i.loadBins(b)];if(E(t,u)||E(t,p)||E(t,m)||E(t,cn))return[2,t];r.label=9;case 9:return x?[4,Yr(y,x)]:[3,11];case 10:return L=r.sent(),[3,13];case 11:return[4,Wr(y,g)];case 12:L=r.sent(),r.label=13;case 13:return P=(O=L).url,N=O.image,i.sourceFrom[T]={url:P,type:Mr.image},[2,N]}}))}))),[4,Promise.all(c)];case 1:return f=d.sent(),i.assignImagesToAssets(t,f),[2,f]}}))}))()},i.onPluginSceneLoadStart=function(t){var e=this;return T((function(){return w(this,(function(i){switch(i.label){case 0:return[4,Gt.onAssetsLoadStart(t,e.options)];case 1:return i.sent(),[2]}}))}))()},i.processTextures=function(t,e,i){var r=this;return T((function(){var n,a,s;return w(this,(function(o){return a=null!=(n=i.textures)?n:t.map((function(t,e){return{source:e}})),s=a.map(T((function(t,n){var a,s,o,u,h,l;return w(this,(function(c){switch(c.label){case 0:if(E(t,cn))return[2,t];if(!("mipmaps"in t))return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,sn(t,e,r.assets,i.bins)];case 2:return[2,c.sent()];case 3:throw a=c.sent(),new Error("Load texture "+n+" fails, error message: "+a+".");case 4:return s=t.source,o=t.id,h="",It(s)?(u=r.assets[s.id],h=s.id,[3,7]):[3,5];case 5:return"string"!=typeof s?[3,7]:[4,qr(Vt(s))];case 6:u=c.sent(),c.label=7;case 7:return u?[4,zf(u,r.sourceFrom[h],o)]:[3,9];case 8:return[2,(l=c.sent()).sourceType===Mr.compressed?l:gi({},l,t)];case 9:throw new Error("Invalid texture source: "+s+".")}}))}))),[2,Promise.all(s)]}))}))()},i.loadJSON=function(t){var e=this;return T((function(){return w(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 T((function(){return w(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.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t.loadFontFamily=function(e,i){return void 0===i&&(i=d.href),T((function(){var r;return w(this,(function(n){return e?(r=e.map(T((function(e){var r,n,a;return w(this,(function(s){switch(s.label){case 0:if(!e.fontURL||t.fontCache.has(e.fontFamily))return[3,4];yt(e.fontFamily)||console.warn("Risky font family: "+e.fontFamily+"."),s.label=1;case 1:return s.trys.push([1,3,,4]),r=new h(e.fontURL,i).href,[4,(a=new FontFace(null!=(n=e.fontFamily)?n:"","url("+r+")")).load()];case 2:return s.sent(),c.fonts.add(a),t.fontCache.add(e.fontFamily),[3,4];case 3:return s.sent(),wt.warn("Invalid font family or font source: "+JSON.stringify(e.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(r)]):[2]}))}))()},t.loadPrecomposition=function(e,i){return T((function(){var r;return w(this,(function(n){switch(n.label){case 0:return[4,new t(i).loadScene(e)];case 1:return r=n.sent(),[2,new Vf(r,i)]}}))}))()},t}();function zf(t,e,i){return Bf.apply(this,arguments)}function Bf(){return(Bf=T((function(t,e,i){var r,n,a,s,o;return w(this,(function(h){switch(h.label){case 0:return r={id:i,dataType:ze.Texture},E(t,cn)?[2,gi({},t.source,r)]:[3,1];case 1:return E(t,u)||Ot(t)?[2,gi({image:t,sourceType:Mr.image,sourceFrom:e,keepImageSource:!0,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR},r)]:[3,2];case 2:return E(t,m)?[2,gi({sourceType:Mr.video,video:t,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR},r)]:[3,3];case 3:if(!E(t,ArrayBuffer))return[3,10];if(!(n=yn.getLoader("ktx2")))return[3,8];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,n.loadFromBuffer(t)];case 5:return a=h.sent(),wt.info("Loading KTX2 texture."),[2,gi({sourceType:a.sourceType,type:a.type,target:a.target,internalFormat:a.internalFormat,format:a.format,mipmaps:a.mipmaps,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR,sourceFrom:e},r)];case 6:throw s=h.sent(),new Error("Failed to parse KTX2 from "+(null!=(o=null==e?void 0:e.url)?o:"buffer")+": "+(s.message||s));case 7:return[3,9];case 8:throw new Error("KTX2 loader not found. Please register it first.");case 9:return[3,11];case 10:if("width"in t&&"height"in t&&"data"in t)return[2,gi({sourceType:Mr.data,data:t,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE,minFilter:Rr.NEAREST,magFilter:Rr.NEAREST},r)];h.label=11;case 11:throw new Error("Invalid texture options.")}}))}))).apply(this,arguments)}Df.fontCache=new Set;var Uf=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(t.whiteTexture),this.builtinObjects.push(t.transparentTexture)}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var i=t;return Rf.isURL(t)&&(Rf.isJSONObject(t)||(i=t.url),Rf.isWithOptions(t)&&(e=gi({},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===te.text||t.type===te.richtext){var r=e[t.name];if(null==r)return;t.components.forEach((function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==ze.TextComponent&&(null==n?void 0:n.dataType)!==ze.RichTextComponent||(n.options.text=r)}))}}))},e.prepareAssets=function(t,e){for(var i,r=Ze(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],s=new Ec(this.engine);s.data=a,s.setInstanceId(n)}this.engine.addPackageDatas(t);for(var o,u=Ze(this.builtinObjects);!(o=u()).done;){var h=o.value;this.engine.addInstance(h)}},e.createShaderVariant=function(){for(var t,e=Ze(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];E(r,zn)&&r.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=Ze(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),Gf=new X(1,1,1),jf=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new sa,this.viewportMatrix=Sn.fromIdentity(),this.viewMatrix=Sn.fromIdentity(),this.projectionMatrix=Sn.fromIdentity(),this.viewProjectionMatrix=Sn.fromIdentity(),this.inverseViewMatrix=Sn.fromIdentity(),this.dirty=!0;var i=e.near,r=void 0===i?.1:i,n=e.far,a=void 0===n?20:n,s=e.fov,o=void 0===s?60:s,u=e.aspect,h=void 0===u?1:u,l=e.clipMode,c=void 0===l?ue.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=new Cn(m[0],m[1],m[2]),y=(new _i).setFromEuler(v);this.options={near:r,far:a,fov:o,aspect:h,clipMode:c},this.transform.setPosition(d[0],d[1],d[2]),this.transform.setQuaternion(y.x,y.y,y.z,y.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 X(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var a=i.projectPoint(e).z,s=r.projectPoint(new X(1,1,a)),o=s.x,u=s.y,h=r.projectPoint(new X(-1,-1,a)),l=h.x,c=h.y;return new X((o-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 gi({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,a=t.aspect,s=t.position,o=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=s,this.rotation=o,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,a=e.far,s=e.clipMode;this.projectionMatrix.perspective(i*k,r,n,a,s===ue.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),Gf),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:Sn.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 X,r=this.getViewProjectionMatrix();i.set(t.x,t.y,t.z),r.projectPoint(i,i);var n=this.engine.canvas.getBoundingClientRect(),a=n.width,s=n.height;return i.x=.5*(i.x+1)*a,i.y=.5*(i.y+1)*s,i.z=.5*(i.z+1),i},e.screenToWorldPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new X,r=this.getInverseViewProjectionMatrix(),n=this.engine.canvas.getBoundingClientRect(),a=n.width,s=n.height,o=t.x/a*2-1,u=t.y/s*2-1,h=2*t.z-1;return i.set(o,u,h),r.projectPoint(i,i),i},xr(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}();function Xf(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var Wf,Hf=function(){function t(){this.update=new Zf,this.lateUpdate=new qf,this.preRender=new Kf}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==br.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==br.prototype.onLateUpdate&&this.lateUpdate.addComponent(t),t.onPreRender!==br.prototype.onPreRender&&this.preRender.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==br.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==br.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t),t.onPreRender!==br.prototype.onPreRender&&this.preRender.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),Yf=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}(),Zf=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=Ze(t);!(i=r()).done;){i.value.onUpdate(e)}},e}(Yf),qf=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=Ze(t);!(i=r()).done;){i.value.onLateUpdate(e)}},e}(Yf),Kf=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=Ze(t);!(i=r()).done;){i.value.onPreRender()}},e}(Yf),Qf=function(t){function e(e,i,r){var n;(n=t.call(this)||this).engine=e,n.sceneTicking=new Hf,n.speed=1,n.isEnded=!1,n.loaderData={},n.startTime=0,n.videos=[],n.postProcessingEnabled=!1,n.destroyed=!1,n.paused=!0,n.isEndCalled=!1,n._textures=[];var a=null!=i?i:{},s=a.reusable,o=void 0!==s&&s,u=a.speed,h=void 0===u?1:u,l=a.baseRenderOrder,c=void 0===l?0:l,f=a.event,d=a.onItemMessage;n.engine.addComposition(Xf(n));var p,v,y,g,x,b,T,_=null;if(r){var w,S;n.createTexturesFromData(r.textureOptions);for(var C,A=Ze(Object.keys(r.assets));!(C=A()).done;){var M=C.value,I=r.assets[M];E(I,m)&&n.videos.push(I)}n.postProcessingEnabled=null!=(S=null==(w=r.jsonScene.renderSettings)?void 0:w.postProcessingEnabled)&&S,n.engine.renderLevel=r.renderLevel,o&&(r.consumed=!0),_=r.jsonScene.compositions[0];for(var R,O=Ze(r.jsonScene.compositions);!(R=O()).done;){var P=R.value;P.id===r.jsonScene.compositionId&&(_=P)}mt(_)}return n.rootItem=new oa(n.engine),_&&(n.rootItem.setInstanceId(_.id),n.rootItem.instantiatePreComposition(_,!1)),n.rootItem.name="rootItem",n.rootItem.composition=Xf(n),n.rootComposition=null!=(p=n.rootItem.getComponent(Ys))?p:n.rootItem.addComponent(Ys),n.rootComposition.updateMode=Bs.Manual,n.rootComposition.play(),n.rootItem.on("animationevent",(function(t){n.emit("animationevent",t)})),n.renderOrder=c,n.id=null!=(v=null==_?void 0:_.id)?v:Ft(),n.startTime=null!=(y=null==_?void 0:_.startTime)?y:0,n.event=f,n.statistic={loadStart:null!=(g=null==r?void 0:r.startTime)?g:0,loadTime:null!=(x=null==r?void 0:r.totalTime)?x:0,compileTime:0,firstFrameTime:0},n.reusable=o,n.speed=h,n.name=null!=(b=null==_?void 0:_.name)?b:"New Composition",n.camera=new jf(n.name,gi({},null==_?void 0:_.camera,{aspect:n.width/n.height})),n.camera.engine=n.engine,n.url=null!=(T=null==r?void 0:r.url)?T:"",n.interactive=!0,d&&(n.onItemMessage=d),n.createRenderFrame(),Gt.initializeComposition(Xf(n),r),n}oe(e,t);var i=e.prototype;return i.getDuration=function(){return this.rootItem.duration},i.restart=function(){this.reset(),this.forwardTime(this.startTime)},i.setIndex=function(t){this.renderOrder=t},i.getIndex=function(){return this.renderOrder},i.setSpeed=function(t){this.speed=t},i.setVisible=function(t){this.rootItem.setVisible(t)},i.getSpeed=function(){return this.speed},i.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?(this.setTime(this.time-this.startTime),this.resume()):(this.setTime(0),this.resume())},i.pause=function(){this.paused=!0,this.emit("pause")},i.getPaused=function(){return this.paused},i.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var t=this.time;this.emit("play",{time:t})},i.gotoAndPlay=function(t){this.setTime(t),this.emit("goto",{time:t}),this.resume()},i.gotoAndStop=function(t){this.setTime(t),this.emit("goto",{time:t}),this.pause()},i.createRenderFrame=function(){this.renderFrame=new Xo({camera:this.camera,renderer:this.renderer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled})},i.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)},i.addItem=function(t){t.setParent(this.rootItem)},i.getComponent=function(t){return this.rootItem.getComponent(t)},i.forwardTime=function(t){var e=1e3*t-1e3*this.time;this.update(e)},i.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.setTime(0)},i.prepareRender=function(){},i.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.rootComposition.setChildrenRenderOrder(0),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()}},i.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===ce.destroy&&!this.reusable},i.updateCamera=function(){this.camera.updateMatrix()},i.updateCompositionTime=function(t){if(this.rootComposition.state===wu.Playing&&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 ce.restart:e%=i,this.restart();break;case ce.freeze:e=Math.min(i,e);case ce.forward:case ce.destroy:}this.rootComposition.tick(e+this.startTime-this.rootComposition.getTime()),this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},i.createTexturesFromData=function(t){for(var e,i=Ze(t);!(e=i()).done;){var r=e.value,n=this.engine.findObject({id:r.id});n.initialize(),this._textures.push(n)}},i.getItemByName=function(t){return this.rootItem.find(t)},i.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return Ea((t-i.z)/r,(e-i.w)/n,this.camera)},i.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},i.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],a=this.getHitTestRay(t,e);return this.rootItem.hitTest(a,t,e,n,[],i,r),n},i.addInteractiveItem=function(t,e){if(e===Jt.MESSAGE)return null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},i.removeInteractiveItem=function(t,e){e===Jt.MESSAGE&&(null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},i.destroyItem=function(t){},i.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()},i.dispose=function(){var t=this;if(!this.destroyed){this.destroyed=!0;for(var e,i=Ze(this.textures);!(e=i()).done;){e.value.dispose()}this._textures=[];for(var r,n=Ze(this.videos);!(r=n()).done;){var a=r.value;a.pause(),a.removeAttribute("src"),a.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),Gt.destroyComposition(this),this.update=function(){wt.error("Update disposed composition: "+t.name+".")},this.dispose=St,this.renderer.engine.removeComposition(this),this.engine.env!==$n&&this.renderer.clear({stencilAction:Ar.clear,clearStencil:0,depthAction:Ar.clear,clearDepth:1,colorAction:Ar.clear,clearColor:[0,0,0,0]})}},i.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},i.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.translate=function(t,e,i){this.rootItem.translate(t,e,i)},i.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},i.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},i.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},i.scale=function(t,e,i){this.rootItem.scale(t,e,i)},i.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},i.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},i.reloadTexture=function(){var t=this;return T((function(){return w(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]}}))}))()},xr(e,[{key:"width",get:function(){return this.engine.canvas.width}},{key:"height",get:function(){return this.engine.canvas.height}},{key:"renderer",get:function(){return this.engine.renderer}},{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootItem.getDescendants()}},{key:"time",get:function(){return this.rootComposition.getTime()}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),e}(ea),Jf=new Int32Array(2),$f=new Float32Array(Jf.buffer),td=new Float64Array(Jf.buffer),ed=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"}(Wf||(Wf={}));var id=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new v}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return Jf[0]=this.readInt32(t),$f[0]},e.readFloat64=function(t){return Jf[ed?0:1]=this.readInt32(t),Jf[ed?1:0]=this.readInt32(t+4),td[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){$f[0]=e,this.writeInt32(t,Jf[0])},e.writeFloat64=function(t,e){td[0]=e,this.writeInt32(t,Jf[ed?0:1]),this.writeInt32(t+4,Jf[ed?1:0])},e.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},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===Wf.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw 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},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),rd=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=id.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,a=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 o=2;o<r;o+=2)if(this.bb.readInt16(a+o)!=this.bb.readInt16(s+o))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 a=3;a>=0;a--)this.writeInt8(n.charCodeAt(a))}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=E(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=id.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),nd=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 ad(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}(),ad=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=nd.createDataVector(t,this.data);return nd.createFBEffectsObjectData(t,e,i)},t}(),sd=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 nd).__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 od(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}(),od=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=sd.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return sd.createFBEffectsPackageData(t,e)},t}(),ud=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 hd(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}(),hd=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 ud.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),ld=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 cd(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,a,s){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,s),t.endFBVertexChannel(e)},t}(),cd=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 ld.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),fd=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 ld).__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 dd(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}(),dd=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=fd.createChannelsVector(t,t.createObjectOffsetList(this.channels));return fd.createFBVertexData(t,this.vertexCount,e)},t}(),pd=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 fd).__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 ud).__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 md(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}(),md=function(){function t(t,e,i,r,n,a,s,o,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===a&&(a=[]),void 0===s&&(s=0),void 0===o&&(o=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=a,this.mode=s,this.buffer=o,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=pd.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,s=pd.createBinaryDataVector(t,this.binaryData),o=pd.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=pd.createInverseBindMatricesVector(t,this.inverseBindMatrices);return pd.startFBGeometryData(t),pd.addId(t,e),pd.addName(t,i),pd.addVertexData(t,r),pd.addIndexFormat(t,this.indexFormat),pd.addIndexOffset(t,this.indexOffset),pd.addSubMeshes(t,n),pd.addMode(t,this.mode),pd.addBuffer(t,a),pd.addBinaryData(t,s),pd.addBoneNames(t,o),pd.addRootBoneName(t,u),pd.addInverseBindMatrices(t,h),pd.endFBGeometryData(t)},t}(),vd=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 rd(1),i=new od,r=[],n=Ze(this.exportObjectDatas);!(t=n()).done;){var a=t.value,s=void 0;a.dataType===ze.Geometry&&(s=new ad("Geometry",this.geometryDataToBinary(a))),s&&r.push(s)}return i.exportObjects=r,sd.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new id(t),i=sd.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),s=n.dataType();if(a){var o=void 0;s===ze.Geometry&&(o=this.binaryToGeometryData(a)),o&&this.exportObjectDatas.push(o)}}}},e.geometryDataToBinary=function(t){var e=new rd(1),i=new md,r=t.indexFormat,n=t.indexOffset,a=t.mode,s=t.id,o=t.vertexData,u=t.boneNames,h=void 0===u?[]:u,l=t.rootBoneName,c=void 0===l?"":l,f=t.inverseBindMatrices,d=void 0===f?[]:f,p=t.binaryData,m=void 0===p?[]:p;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=s,i.boneNames=h,i.rootBoneName=c,i.inverseBindMatrices=d,i.binaryData=m;var v=new dd;v.vertexCount=o.vertexCount,v.channels=[];for(var y,g=Ze(o.channels);!(y=g()).done;){var x=y.value,b=x.semantic,T=x.offset,E=x.format,_=x.dimension,w=x.normalize,S=new cd(b,T,E,_,w);v.channels.push(S)}i.vertexData=v;for(var C,A=[],M=Ze(t.subMeshes);!(C=M()).done;){var I=C.value,R=I.offset,O=I.indexCount,P=I.vertexCount,N=new hd(R,O,P);A.push(N)}return i.subMeshes=A,sd.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new id(t),i=pd.getRootAsFBGeometryData(e),r={vertexCount:0,channels:[]},n=i.vertexData();if(n){r.vertexCount=n.vertexCount();for(var a=0;a<n.channelsLength();a++){var s=n.channels(a);if(s){var o,u={semantic:null!=(o=s.semantic())?o:"",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:ze.Geometry}},t}(),yd=60,gd=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=G(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=f.now();var i=g||function(t){return e.setTimeout(t,16.7)},r=function(){t.intervalId=i(r),t.paused||t.tick()};r()}},i.stop=function(){(y||e.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=f.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var e,i=Ze(this.tickers);!(e=i()).done;){var r=e.value;r(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)},xr(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}(),xd=function(t){function i(e,i){var r,n,a,s,o,u;return(r=t.call(this)||this).name="NewEngine",r.speed=1,r.displayScale=1,r.offscreenMode=!1,r.renderErrors=new Set,r.compositions=[],r.assetManagers=[],r.env="",r.ticker=null,r._disposed=!1,r.textures=[],r.materials=[],r.geometries=[],r.meshes=[],r.renderPasses=[],r.clearAction={stencilAction:Ar.clear,clearStencil:0,depthAction:Ar.clear,clearDepth:1,colorAction:Ar.clear,clearColor:[0,0,0,0]},r.canvas=e,r.env=null!=(n=null==i?void 0:i.env)?n:"",r.name=null!=(a=null==i?void 0:i.name)?a:r.name,r.pixelRatio=null!=(s=null==i?void 0:i.pixelRatio)?s:J(),r.jsonSceneData={},r.objectInstance={},r.whiteTexture=pn(Xf(r)),r.transparentTexture=mn(Xf(r)),(null==i?void 0:i.manualRender)||(r.ticker=new gd(null==i?void 0:i.fps),r.runRenderLoop(r.mainLoop.bind(Xf(r)))),r.eventSystem=new yu(Xf(r),null!=(o=null==i?void 0:i.notifyTouch)&&o),r.eventSystem.enabled=null!=(u=null==i?void 0:i.interactive)&&u,r.eventSystem.bindListeners(r.canvas),r.assetLoader=new Sc(Xf(r)),r.assetService=new Uf(Xf(r)),r.renderTargetPool=new qo(Xf(r)),r.renderingData={currentFrame:{}},r}oe(i,t);var r=i.prototype;return r.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},r.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},r.findEffectsObjectData=function(t){return this.jsonSceneData[t]},r.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},r.findObject=function(t){return Rt(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},r.removeInstance=function(t){delete this.objectInstance[t]},r.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=void 0===r?[]:r,a=i.items,s=void 0===a?[]:a,o=i.materials,u=void 0===o?[]:o,h=i.shaders,l=void 0===h?[]:h,c=i.geometries,f=void 0===c?[]:c,d=i.components,p=void 0===d?[]:d,m=i.animations,v=void 0===m?[]:m,y=i.bins,g=void 0===y?[]:y,x=i.miscs,b=void 0===x?[]:x,T=Ze(i.compositions);!(e=T()).done;){var E=e.value;this.addEffectsObjectData(E)}for(var _,w=Ze(s);!(_=w()).done;){var S=_.value;Pf(S.renderLevel,t.renderLevel)||(S.components=[],S.type=te.null),this.addEffectsObjectData(S)}for(var C,A=Ze(u);!(C=A()).done;){var M=C.value;this.addEffectsObjectData(M)}for(var I,R=Ze(l);!(I=R()).done;){var O=I.value;this.addEffectsObjectData(O)}for(var P,N=Ze(f);!(P=N()).done;){var L=P.value;this.addEffectsObjectData(L)}for(var F,V=Ze(p);!(F=V()).done;){var k=F.value;this.addEffectsObjectData(k)}for(var D,z=Ze(v);!(D=z()).done;){var B=D.value;this.addEffectsObjectData(B)}for(var U,G=Ze(b);!(U=G()).done;){var j=U.value;this.addEffectsObjectData(j)}for(var X=0;X<g.length;X++){var W=g[X],H=t.bins[X];if(W.dataType===ze.BinaryAsset)W.buffer=H,W.id&&this.addEffectsObjectData(W);else{var Y=new vd;Y.deserializeFromBinary(new Uint8Array(H));for(var Z,q=Ze(Y.exportObjectDatas);!(Z=q()).done;){var K=Z.value;this.addEffectsObjectData(K)}}}for(var Q,J=Ze(n);!(Q=J()).done;){var $=Q.value;this.addEffectsObjectData($)}},r.runRenderLoop=function(t){var e;null==(e=this.ticker)||e.add(t)},r.mainLoop=function(t){var e,i=this.renderErrors;if(i.size>0)return this.emit("rendererror",i.values().next().value),void(null==(e=this.ticker)||e.pause());t=Math.min(t,33)*this.speed;var r=this.compositions;r.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var n,a,s=!1,o=Ze(r);!(n=o()).done;){var u=n.value;u.textureOffloaded?(s=!0,wt.error("Composition "+u.name+" texture offloaded, skip render.")):u.update(t)}if(s)return this.emit("rendererror",new Error("Play when texture offloaded.")),void(null==(a=this.ticker)||a.pause());for(var h,l=Ze(r);!(h=l()).done;){h.value.sceneTicking.preRender.tick(0)}this.renderer.setFramebuffer(null),this.renderer.clear(this.clearAction);for(var c,f=Ze(r);!(c=f()).done;){var d=c.value;this.renderer.renderRenderFrame(d.renderFrame)}this.renderTargetPool.flush()},r.resize=function(){var t,e,i,r,n=this.canvas.parentElement;if(n){var a=this.getTargetSize(n);t=a[0],e=a[1],i=a[2],r=a[3]}else t=i=this.canvas.width,e=r=this.canvas.height;var s=t/e;if(t&&e){var o=c.documentElement.clientWidth;i>2*o&&wt.error("DPI overflowed, width "+i+" is more than 2x document width "+o+", see "+ta["DPI overflowed"]+".");var u=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>u||r>u)&&(wt.error("Container size overflowed "+i+"x"+r+", see "+ta["Container size overflowed"]+"."),s>1?(i=Math.round(u),r=Math.round(u/s)):(r=Math.round(u),i=Math.round(u*s))),this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",wt.info("Resize engine "+this.name+" ["+i+","+r+","+t+","+e+"]."),this.setSize(i,r)}},r.setSize=function(t,e){var i;this.getWidth()===t&&this.getHeight()===e||(this.canvas.width=t,this.canvas.height=e,this.viewport(0,0,t,e)),null==(i=this.compositions)||i.forEach((function(i){i.camera.aspect=t/e})),this.emit("resize",this)},r.getTargetSize=function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+ta["Container is not an HTMLElement"]+".");var i,r,n=this.displayAspect,a=null==e.getComputedStyle?void 0:e.getComputedStyle.call(e,t),s=0,o=0;(a?(s=parseInt(a.width,10),o=parseInt(a.height,10)):(s=t.clientWidth,o=t.clientHeight),n)?s/o>n?i=(r=o*this.displayScale)*n:r=(i=s*this.displayScale)/n:(i=s,r=o);var u=this.pixelRatio,h=i,l=r;if(i=Math.round(i*u),r=Math.round(r*u),i<1||r<1){if(!this.offscreenMode)throw new Error("Invalid container size "+i+"x"+r+", see "+ta["Invalid container size"]+".");i=r=h=l=1}return[h,l,i,r]},r.addTexture=function(t){this.disposed||P(this.textures,t)},r.removeTexture=function(t){this.disposed||N(this.textures,t)},r.addMaterial=function(t){this.disposed||P(this.materials,t)},r.removeMaterial=function(t){this.disposed||N(this.materials,t)},r.addGeometry=function(t){this.disposed||P(this.geometries,t)},r.removeGeometry=function(t){this.disposed||N(this.geometries,t)},r.addMesh=function(t){this.disposed||P(this.meshes,t)},r.removeMesh=function(t){this.disposed||N(this.meshes,t)},r.addRenderPass=function(t){this.disposed||P(this.renderPasses,t)},r.removeRenderPass=function(t){this.disposed||N(this.renderPasses,t)},r.addComposition=function(t){this.disposed||P(this.compositions,t)},r.removeComposition=function(t){this.disposed||N(this.compositions,t)},r.getWidth=function(){return 0},r.getHeight=function(){return 0},r.getShaderLibrary=function(){return null},r.bindSystemFramebuffer=function(){},r.viewport=function(t,e,i,r){},r.clear=function(t){},r.drawGeometry=function(t,e,i,r){},r.setSampleAlphaToCoverage=function(t){},r.setBlending=function(t){},r.setDepthTest=function(t){},r.setStencilTest=function(t){},r.setCulling=function(t){},r.setPolygonOffsetFill=function(t){},r.blendColor=function(t,e,i,r){},r.blendFuncSeparate=function(t,e,i,r){},r.blendEquationSeparate=function(t,e){},r.colorMask=function(t,e,i,r){},r.depthMask=function(t){},r.depthFunc=function(t){},r.depthRange=function(t,e){},r.polygonOffset=function(t,e){},r.cullFace=function(t){},r.frontFace=function(t){},r.stencilMaskSeparate=function(t,e){},r.stencilFuncSeparate=function(t,e,i,r){},r.stencilOpSeparate=function(t,e,i,r){},r.dispose=function(){var t,e,i;if(!this.disposed){this._disposed=!0;var r=[];this.renderPasses.length>0&&r.push("Pass "+this.renderPasses.length),this.meshes.length>0&&r.push("Mesh "+this.meshes.length),this.geometries.length>0&&r.push("Geom "+this.geometries.length),this.textures.length>0&&r.push("Tex "+this.textures.length),r.length>0&&wt.warn("Release GPU memory: "+r.join(", ")+"."),null==(t=this.ticker)||t.stop(),null==(e=this.eventSystem)||e.dispose(),null==(i=this.assetService)||i.dispose(),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.assetManagers.forEach((function(t){return t.dispose()})),this.compositions.forEach((function(t){return t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.compositions=[]}},xr(i,[{key:"disposed",get:function(){return this._disposed}}]),i}(ea),bd={format:Rr.RGBA,type:Rr.UNSIGNED_BYTE,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE},Td=Symbol("dispose"),Ed=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,a={sourceType:Mr.framebuffer,data:{width:i,height:r},name:n},s=[n];Object.getOwnPropertyNames(bd).forEach((function(e){var i,r=null!=(i=t[e])?i:bd[e];a[e]=r,s.push(e,r)}));var o=s.join(":"),u=this.textureCache[o];if(u)this.textureRef[o]++;else{var h=this.engine;mt(h),u=cn.create(h,a),this.textureCache[o]=u,this.textureRef[o]=1,u[Td]=u.dispose,u.dispose=function(){return e.removeTexture(o)}}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[Td](),i.dispose=i[Td]),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[Td](),i.dispose=i[Td]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),_d=function(){function t(){}return t.load=function(t,e,i){void 0===i&&(i={});var r=this;return T((function(){var n,a,s,o,u,h,l,c,d,p,m,v,y;return w(this,(function(g){switch(g.label){case 0:return o=f.now(),u=null==(a=e.gpuCapability)||null==(n=a.detail)?void 0:n.asyncShaderCompile,h=e.compositions.length,l=new Df(i),e.assetManagers.push(l),[4,l.loadScene(t,e.renderer)];case 1:return c=g.sent(),e.clearResources(),Gt.onAssetsLoadFinish(c,l.options,e),e.assetService.prepareAssets(c,c.assets),e.assetService.updateTextVariables(c,i.variables),(d=r.createComposition(c,e,i)).setIndex(h),p=f.now(),[4,new Promise((function(t){var i;null==(i=e.getShaderLibrary())||i.compileAllShaders((function(){return t(null)}))}))];case 2:return g.sent(),m=f.now()-p,null==(s=e.ticker)||s.start(),v=d.name,y=f.now()-o,d.statistic.compileTime=m,d.statistic.firstFrameTime=y,wt.info("First frame ["+v+"]: "+y.toFixed(4)+"ms."),wt.info("Shader "+(u?"async":"sync")+" compile ["+v+"]: "+m.toFixed(4)+"ms."),[2,d]}}))}))()},t.createComposition=function(t,e,i){void 0===i&&(i={});var r=new Qf(e,gi({},i,{event:e.eventSystem}),t);return e.env!==$n&&e.assetService.createShaderVariant(),r},t}(),wd=function(){function t(){}return t.instantiate=function(t,e){var i=t.scene,r=t.scene.jsonScene,n=t.options,a=e.engine;a.clearResources(),Gt.onAssetsLoadFinish(i,n,a),a.assetService.prepareAssets(i,i.assets),a.assetService.updateTextVariables(i,n.variables),e.createTexturesFromData(i.textureOptions);for(var s,o=Ze(Object.keys(i.assets));!(s=o()).done;){var u=s.value,h=i.assets[u];E(h,m)&&e.videos.push(h)}var l=r.compositionId,c=r.compositions.find((function(t){return t.id===l}));if(!c)throw new Error('Composition with id "'+l+'" not found in JSONScene.');var f,d=new oa(a);return d.instantiatePreComposition(c),d.getComponent(Ys).playOnStart=null==(f=n.autoplay)||f,d.getComponent(Ys).endBehavior=0,e.addItem(d),d},t}();Bt("camera",fu),Bt("text",Tc),Bt("sprite",Su),Bt("particle",cc),Bt("interact",xu);function Sd(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:""})}wt.info("Core version: 2.9.1.");var Cd,Ad,Md=function(){function t(t,e){this.engine=t,this.byteLength=0,this.destroyed=!1;var i=e.name,r=e.data,n=e.elementCount,a=e.target,s=void 0===a?Rr.ARRAY_BUFFER:a,o=e.type,u=void 0===o?Rr.FLOAT:o,h=e.usage,l=void 0===h?Rr.STATIC_DRAW:h,c=function(t){var e,i;return null!=(i=null==(e=Id[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 Sd(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,a=n+e.byteLength;i.bindBuffer(r,this.glBuffer),a>this.byteLength&&(this.byteLength=a,i.bufferData(r,a,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!!Nr(this.engine.gl)&&(this.engine.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},xr(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Id=((Cd={})[Rr.INT]=Int32Array,Cd[Rr.FLOAT]=Float32Array,Cd[Rr.SHORT]=Int16Array,Cd[Rr.BYTE]=Int8Array,Cd[Rr.UNSIGNED_BYTE]=Uint8Array,Cd[Rr.UNSIGNED_INT]=Uint32Array,Cd[Rr.UNSIGNED_SHORT]=Uint16Array,Cd);var Rd=((Ad={})[Uint8Array.BYTES_PER_ELEMENT]=Rr.UNSIGNED_BYTE,Ad[Uint16Array.BYTES_PER_ELEMENT]=Rr.UNSIGNED_SHORT,Ad[Uint32Array.BYTES_PER_ELEMENT]=Rr.UNSIGNED_INT,Ad),Od=1,Pd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}oe(e,t);var i=e.prototype;return i.getOptions=function(){return gi({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;mt(e),e.addGeometry(this),Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new Md(t.engine,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,a=i.target;this.bufferProps[r]={data:e,usage:n,target:a,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&null!=r.data){var n=e,a=e+i.length;if(r.data.length<a){var s=new i.constructor(a);s.set(r.data),r.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var o=this.dirtyFlags[t];void 0!==o.start&&(o.start=Math.min(o.start,n)),void 0!==o.end&&(o.end=Math.max(o.end,a-1))}r.data.set(i,n),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(E(t,Uint8Array)||E(t,Uint16Array)||E(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t,n=t+e.length;if(this.indices.length<n){var a=new e.constructor(n);a.set(this.indices),this.indices=a,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}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*bo[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t){var e=Rd[t.BYTES_PER_ELEMENT],i={data:t,target:Rr.ELEMENT_ARRAY_BUFFER,type:e,name:this.name+"##index"};return new Md(this.engine,i)},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var a,s,o=t.dirtyFlags[n];if("index"==n)a=t.indicesBuffer,s=r;else{var u=e[n].dataSource;a=t.buffers[u],s=i[u].data}if((o.dirty||o.discard)&&a&&s){if(o.discard)a.bufferData(s);else if(void 0!==o.start&&void 0!==o.end){var h=o.start*s.BYTES_PER_ELEMENT+s.byteOffset,l=o.end-o.start+1,c=new s.constructor(s.buffer,h,l);a.bufferSubData(o.start,c)}o.start=Number.POSITIVE_INFINITY,o.end=0,o.dirty=o.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(r){var n=t.attributesReleasable[r],a=e[r].dataSource;i[a]&&n&&(i[a].data=void 0)})),this.indicesReleasable}},i.processProps=function(t){var e=t,i=e.drawStart,r=void 0===i?0:i,n=e.drawCount,a=e.mode,s=e.indices,o=e.name,u=void 0===o?"effectsGeometry:"+Od++:o,h=e.bufferUsage,l=void 0===h?Rr.STATIC_DRAW:h;this.name=u;var c={},f=[],d={},p={},m={},v=l;this.drawStart=r,void 0!==n&&(this.drawCount=n),this.mode=isNaN(a)?Rr.TRIANGLES:a,Object.keys(e.attributes).forEach((function(t){var i=e.attributes[t],r=i.size,n=i.stride,a=i.offset,s=i.normalize,o=i.type,u=void 0===o?Rr.FLOAT:o,h=i.releasable,l=i.data;if(!u||"dataSource"in i||l||(l=Eo(u)),l){var y=E(l,Float32Array)?Rr.FLOAT:Rr.INT;c[t]={data:l,usage:v,target:Rr.ARRAY_BUFFER,name:t},d[t]={size:r,stride:n,offset:a,type:null!=u?u:y,normalize:!!s,dataSource:t},m[t]=null!=h&&h,p[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var g=i.dataSource;g&&(d[t]={size:r,stride:n,offset:a,type:u,dataSource:g,normalize:!!s})}f.push(t)})),p.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==s?void 0:s.data,this.indicesReleasable=!0===(null==s?void 0:s.releasable),this.bufferProps=c,this.attributes=d,this.attributesName=f,this.attributesReleasable=m,this.dirtyFlags=p,this.options=e,this.initialized=!1},i.fromData=function(e){var i,n=this;if(t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes,e.buffer?i=new Uint8Array(function(t){for(var e=r(t),i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);var a=i.buffer;return a}(e.buffer)):e.binaryData&&(i=e.binaryData),i){var a=e.vertexData.vertexCount;if(this.hasSemantic(e)){var s={mode:Rr.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach((function(t){var e,r=null!=(e=Nd[t.semantic])?e:t.semantic,o=n.createVertexTypedArray(t,i,a);s.attributes[r]={type:Fr(t.format),size:t.dimension,data:o,normalize:t.normalize}})),e.indexFormat!==Ge.None){var o=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset);s.indices={data:o},s.drawCount=o.length}else s.drawCount=a;this.processProps(s)}else{var u=e.vertexData.channels[0],h=e.vertexData.channels[1],l=e.vertexData.channels[2],c=this.createVertexTypedArray(u,i,a),f=this.createVertexTypedArray(h,i,a),d=this.createVertexTypedArray(l,i,a),p=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset),m={mode:Rr.TRIANGLES,attributes:{aPos:{type:Fr(u.format),size:3,data:c,normalize:u.normalize},aUV:{type:Fr(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:Fr(l.format),size:3,data:d,normalize:l.normalize}}};m.indices={data:p},m.drawCount=p.length,this.processProps(m)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},i.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)},i.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case Ue.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case Ue.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case Ue.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case Ue.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case Ue.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)}},i.createIndexTypedArray=function(t,e,i){var r=e.buffer,n=e.byteOffset+i,a=e.byteLength-i;switch(t){case Ge.UInt16:return new Uint16Array(r,n,a/Uint16Array.BYTES_PER_ELEMENT);case Ge.UInt32:return new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},xr(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(To),Nd={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 Ld,Fd,Vd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}oe(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.engine.gl.createRenderbuffer())},i.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer.engine,r=i.gl;i.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):wt.error("Invalid render buffer size: "+t+"x"+e+".")}}else wt.error("Can't set size for uninitialized render buffer.")},i.dispose=function(){this.renderer&&(this.renderer.engine.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Lt},e}(Zo),kd=((Ld={})[Rr.RGBA]=34842,Ld[Rr.RGB]=34843,Ld[Rr.ALPHA]=33325,Ld[Rr.RED]=33325,Ld[Rr.LUMINANCE_ALPHA]=33327,Ld[Rr.LUMINANCE]=33325,Ld),Dd=((Fd={})[Rr.RGBA]=34836,Fd[Rr.RGB]=34837,Fd[Rr.ALPHA]=33326,Fd[Rr.RED]=33326,Fd[Rr.LUMINANCE_ALPHA]=33328,Fd[Rr.LUMINANCE]=33326,Fd),zd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,i&&r.fromData(i),r}oe(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(),Sd(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 Mr.image:delete this.source.image,delete this.source.cube;break;case Mr.data:delete this.source.data;break;case Mr.compressed:case Mr.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=this.target,r=this.source,n=this.engine.gl,a=this.engine.gpuCapability.detail,s=r.sourceType,o=r.data,u=r.cube,h=r.image,l=r.video,c=r.mipmaps,f=r.mipmaps,d=t.data,p=t.cube,m=t.generateMipmap,v=void 0!==m&&m,y=t.mipmaps,g=r.format,x=r.type,b=r.internalFormat,T=0,E=0;this.bind(s===Mr.video),x===Rr.HALF_FLOAT?((x=a.halfFloatTexture)||wt.error("Half float texture is not support."),Nr(n)&&b===g&&(g===Rr.LUMINANCE&&(g=Rr.RED),b=kd[g]),a.halfFloatLinear||(r.minFilter=r.magFilter=n.NEAREST,wt.warn("Half float linear not support, change to NEAREST."))):x===n.FLOAT&&((x=a.floatTexture)||wt.error("Float texture is not support."),Nr(n)&&b===g&&(g===Rr.LUMINANCE&&(g=Rr.RED),b=Dd[g]),a.floatLinear||(r.minFilter=n.NEAREST,r.magFilter=n.NEAREST,wt.warn("Float linear not support, change to NEAREST."))),void 0===r.premultiplyAlpha&&(r.premultiplyAlpha=!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),void 0===r.flipY&&(r.flipY=!1),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,r.flipY);var _,w,S=function(t,e){Pt(t)&&Pt(e)||Nr(n)?n.generateMipmap(i):console.error("Mipmap generation failed. Texture width and height must be power of two in WebGL1.")};if(s===Mr.framebuffer)d&&(T=null!=(_=d.width)?_:0,E=null!=(w=d.height)?w:0,T&&E&&(this.width!==T||this.height!==E)&&n.texImage2D(i,0,b,T,E,0,g,x,null));else if(s===Mr.data){var C;if(i===n.TEXTURE_CUBE_MAP)p.forEach((function(t,i){var r=e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,g,x,t),a=r[0],s=r[1];T=Math.max(a,T),E=Math.max(s,E)}));else C=this.texImage2DData(n,i,0,b,g,x,o),T=C[0],E=C[1],v&&S(T,E)}else if(s===Mr.image||s===Mr.video){if(i===n.TEXTURE_CUBE_MAP)u.forEach((function(t,i){var r=e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,g,x,t),a=r[0],s=r[1];T=Math.max(a,T),E=Math.max(s,E)}));else if(i===n.TEXTURE_2D){var A,M=null!=h?h:l;A=this.texImage2D(n,i,0,b,g,x,M),T=A[0],E=A[1]}v&&S(T,E)}else if(s===Mr.mipmaps){var I;i===n.TEXTURE_2D?c.forEach((function(t,r){var a;(I="data"in t?e.texImage2DData(n,i,r,b,g,x,t):e.texImage2D(n,i,r,b,g,x,t),0===r)&&(T=(a=I)[0],E=a[1])})):i===n.TEXTURE_CUBE_MAP&&f.forEach((function(t,i){t.forEach((function(t,r){var a;(I="data"in t?e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,g,x,t):e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,g,x,t),0===i)&&(T=(a=I)[0],E=a[1])}))}))}else s===Mr.compressed&&y&&0!==y.length&&(T=y[0].width,E=y[0].height,y.forEach((function(t,e){n.compressedTexImage2D(i,e,b,t.width,t.height,0,t.data)})));this.width=T,this.height=E,this.setTextureFilters(n,i,r)},i.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=void 0===r?4:r,a=i.wrapS,s=void 0===a?t.CLAMP_TO_EDGE:a,o=i.wrapT,u=void 0===o?t.CLAMP_TO_EDGE:o,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var l=Nr(t)||Pt(this.width)&&Pt(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,a=r.sourceFrom,s=r.name,o=void 0===s?"":s;this.source=r,this.sourceType=n,this.sourceFrom=a,this.name=o},i.texImage2D=function(t,e,i,r,n,a,s){var o,u=this,h=this.source,l=h.sourceType,c=h.minFilter,f=h.magFilter,d=h.wrapS,p=h.wrapT,m=null!=(o=this.engine.gpuCapability.detail.maxTextureSize)?o:2048,v=s;if(l!==Mr.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,a,v);var g=[v.width,v.height];return l===Mr.video?[s.videoWidth,s.videoHeight]:g},i.texImage2DData=function(t,e,i,r,n,a,s){var o=s.data,u=s.width,h=s.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/o.BYTES_PER_ELEMENT):o;return t.texImage2D(e,i,r,u,h,0,n,a,l),[u,h]},i.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;if(Nr(this.engine.gl)&&t.width<n&&t.height<n)return t;var a=function(t,e,i,r){var n=t.width,a=t.height,s=Math.min(e,i||Ta(n)),o=Math.min(e,r||Ta(a));if(o!==a||s!==n){var u=fc.getCanvas(),h=u.getContext("2d");return u.width=s,u.height=o,null==h||h.drawImage(t,0,0,n,a,0,0,s,o),wt.warn("Image resize from "+n+"x"+a+" to "+s+"x"+o+"."),u}}(t,n,e,i);return a||t},i.reloadData=function(){var t=this;return T((function(){return w(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,xn().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},i.offloadData=function(){if(this.initialized&&xn().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 T((function(){return w(this,(function(e){return t.source.sourceType===Mr.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},i.updateSource=function(t){this.source=this.assembleOptions(gi({},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(){wt.error("This texture has been destroyed.")},this.initialize=Lt,void 0!==this.engine&&this.engine.removeTexture(this),t.prototype.dispose.call(this)},e}(cn);var Bd=1,Ud=function(t){function e(e,i){var r;(r=t.call(this)||this).attachmentTextures=[];var n,a=e.depthStencilAttachment,s=e.viewport,o=e.storeAction,u=e.name,h=void 0===u?"GLFramebuffer"+Bd++:u;return r.renderer=i,r.engine=i.engine,r.depthStencilStorageType=null!=(n=null==a?void 0:a.storageType)?n:oo.none,r.viewport=s,r.name=h,r.storeAction=o,r.updateProps(e),r}oe(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,e=this.viewport[2],i=this.viewport[3];this.attachmentTextures.length=0,this.colorTextures.forEach((function(r){var n={width:e,height:i,data:new Uint8Array(0)};r.initialize(),r.update({data:n}),P(t.attachmentTextures,r.textureBuffer)})),this.stencilTexture&&P(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&(this.depthTexture.update({data:{width:e,height:i,data:new Uint16Array(0)}}),P(this.attachmentTextures,this.depthTexture.textureBuffer))},i.updateProps=function(t){var e,i,r=this.renderer,n=this.engine.gpuCapability,a=null!=(i=t.depthStencilAttachment)?i:{storageType:oo.none},s=t.attachments.length>0,o=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var u=null==(e=t.depthStencilAttachment)?void 0:e.texture,h=n.detail.readableDepthStencilTextures,l=a.storageType,c=a.storage;if(this.colorTextures=t.attachments.slice(),!s&&l!==oo.none)throw new Error("Use depth stencil attachment without color attachments.");switch(s&&(this.fbo=this.engine.createGLFramebuffer(this.name)),l){case oo.depth_stencil_opaque:if(c){if(!E(c,Vd))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Vd({format:Rr.DEPTH_STENCIL,attachment:Rr.DEPTH_STENCIL_ATTACHMENT,storageType:l},r);o=!1;break;case oo.depth_16_opaque:if(c){if(!E(c,Vd))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Vd({attachment:Rr.DEPTH_ATTACHMENT,format:Rr.DEPTH_COMPONENT16,storageType:l},r);break;case oo.stencil_8_opaque:if(c){if(!E(c,Vd))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Vd({attachment:Rr.STENCIL_ATTACHMENT,format:Rr.STENCIL_INDEX8,storageType:l},r);break;case oo.depth_16_texture:if(!h)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=u?u:new zd(this.engine,{sourceType:Mr.framebuffer,format:Rr.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:Rr.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case oo.depth_24_stencil_8_texture:if(!h)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=u?u:new zd(this.engine,{sourceType:Mr.framebuffer,format:Rr.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),o=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,o),this.updateAttachmentTextures()},i.getStoreAttachments=function(t,e){var i=this.engine.gl,r=this.colorTextures.length;if(t&&Nr(i)&&r>0){var n=[];if(t.depthAction===uo.clear&&this.depthStorage&&P(n,e?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===uo.clear&&this.stencilStorage&&P(n,e?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===uo.clear)for(var a=0;a<r;a++)P(n,i["COLOR_ATTACHMENT"+a]);return n}},i.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.engine.gl;Nr(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.engine.bindSystemFramebuffer()},i.bind=function(){var t=this;if(this.fbo){var e=this.engine.gl,i=this.engine,r=this.viewport,n=r[0],a=r[1],s=r[2],o=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,a,s,o);var u=this.renderer.engine.whiteTexture,h=u.textureBuffer;Object.keys(i.textureUnitDict).forEach((function(e){var r=i.textureUnitDict[e];r&&r!==h&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),u.bind())}));for(var l=0;l<4;l++)i.activeTexture(e.TEXTURE0+l),u.bind();if(!this.ready){var c=this,f=c.depthStencilRenderbuffer,d=c.depthTexture,p=c.stencilTexture;if(i.activeTexture(e.TEXTURE0),f)f.setSize(s,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,f.attachment,e.RENDERBUFFER,f.buffer);else if(d){d.source.data={width:s,height:o},d.update({data:{width:s,height:o,data:new Uint16Array(0)}});var m=d&&p?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,m,e.TEXTURE_2D,d.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var v=e.checkFramebufferStatus(e.FRAMEBUFFER);if(v!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+v+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+". width="+s+", height="+o+".");this.ready=!0}}},i.resetColorTextures=function(t){var e=t,i=this.engine.gl,r=this.engine.gpuCapability,n=this.viewport,a=[];if(e){for(var s,o=Ze(e);!(s=o()).done;){s.value.initialize()}this.colorTextures=e.slice()}this.engine.activeTexture(i.TEXTURE0),this.colorTextures.forEach((function(t,e){var s={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:s}),r.framebufferTexture2D(i,i.FRAMEBUFFER,e,i.TEXTURE_2D,t.textureBuffer),a.push(!0)})),r.drawBuffers(i,a),this.updateAttachmentTextures()},i.resize=function(t,e,i,r){var n=this.viewport,a=n[0],s=n[1],o=n[2],u=n[3];a===t&&s===e&&o===i&&u===r||(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},i.dispose=function(t){if(this.renderer){var e;this.engine.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:po.force;if(n===po.force||n===po.keepExternal&&!this.externalStorage)null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose();for(var a,s=Ze(this.colorTextures);!(a=s()).done;){a.value.dispose()}null==(e=this.stencilTexture)||e.dispose(),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},xr(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==oo.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==oo.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(ho),Gd=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 Nr(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),Sd(e,t),e},e.bindVertexArray=function(t){var e;Nr(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;Nr(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),jd=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,a=this.engine.gl;return t.vaos[n]?i=t.vaos[n]:((i=new Gd(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(),a.enableVertexAttribArray(i.loc),a.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 a=t.getActiveAttrib(e,n);if(a){var s=a.name,o=a.type,u=a.size,h=t.getAttribLocation(e,s);i[s]={type:o,name:s,size:u,loc:h}}}return i},e.dispose=function(){this.engine&&this.engine.gl.deleteProgram(this.program)},t}(),Xd=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}oe(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),a=0;a<t.length;a++)this.uniformLocations[t[a]]=n[a];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.definition;t.dataType=ze.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))},i.bind=function(){this.program.bind()},i.isReady=function(){return!!this.program},e}(Ln),Wd=0,Hd=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 e=t.prototype;return e.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=Ze(Object.keys(this.cachedShaders));!(i=n()).done;){var a=i.value;this.cachedShaders[a].initialized||r.push(a)}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}},e.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 a=gi({},t,{vertex:Bo.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Tr.vertex,shader:t.vertex,macros:n}),fragment:Bo.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Tr.fragment,shader:t.fragment,macros:n})}),s=this.computeShaderCacheId(a);if(this.cachedShaders[s])return s;this.shaderAllDone=!1;var o=!1;return(a.shared||a.cacheId)&&(o=!0),this.cachedShaders[s]=new Xd(this.engine,gi({},a,{vertex:a.vertex,fragment:a.fragment,name:a.name||s,shared:o})),this.cachedShaders[s].id=s,s},e.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},e.compileShader=function(t,e){var i=this,r=t.source,n=r.shared,a=r.vertex,s=r.fragment,o=r.name,u=t.source.cacheId,h=!1;(n||u)&&(h=!0);var l=this.engine.gl,c={shared:h,status:In.compiling},d=this.createProgram(l,a,s,c),p=this.glAsyncCompileExt,m=f.now(),v=function(e){c.status=In.success,c.compileTime=f.now()-m,t.program=e,t.initialized=!0,void 0!==i.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),i.programMap[t.id]=e},y=function(){if(i.engine.disposed)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==e?void 0:e(c);if(t.initialized)return null==e?void 0:e(c);var r=(!e||!p||p&&1==l.getProgramParameter(c.program,p.COMPLETION_STATUS_KHR))&&d();if(r){if(c.status!==In.fail){Sd(r,o);var n=new jd(i.engine,r,t.id);if(l.validateProgram(r),l.getProgramParameter(r,l.VALIDATE_STATUS))v(n);else{var u=l.getProgramInfoLog(r);(null==u?void 0:u.includes("the same texture"))||(null==u?void 0:u.includes("Two textures of different types use the same sampler"))?v(n):(c.status=In.fail,c.error=u,console.error("compileProgramError: "+u,"\nvertex:\n",a,"\nfragment:\n",s),l.deleteProgram(r))}}null==e||e(c)}else e&&g(y)};t.compileResult=c,y()},e.computeShaderCacheId=function(t){var e=t.vertex,i=void 0===e?"":e,r=t.fragment,n=void 0===r?"":r,a=t.shared,s=t.cacheId;return a||s?s||"shared_"+Zd(i,n):"instanced_"+Wd++},e.createProgram=function(t,e,i,r){var n=t.createProgram(),a=this.createGLShader(t,t.VERTEX_SHADER,e),s=this.createGLShader(t,t.FRAGMENT_SHADER,i);return n&&a&&s?(t.attachShader(n,a),t.attachShader(n,s),t.linkProgram(n),r.program=n,r.status=In.compiling,function(){if(r.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var o=t.getProgramInfoLog(n);console.error("Failed to link program: "+o+".");var u=Yd(t,a,"vertex",e),h=Yd(t,s,"fragment",i);return r.status=In.fail,u&&(r.error=u.error,r.status=u.status),h&&(r.error=h.error,r.status=h.status),n}return n}):(r.status=In.fail,function(){return null})},e.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Zd(null!=i?i:""),a=r.get(n);if(a)return a;var s=t.createShader(e);return s&&(t.shaderSource(s,i),t.compileShader(s),r.set(n,s)),s},e.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},e.restore=function(){},e.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 Yd(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:In.fail}}}function Zd(){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 a=e[n],s=0;s<a.length;s++)r=Math.imul(31,r)+a.charCodeAt(s)|0;return r}var qd=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=[],mt(t),this.gl=Sr(t,e,i),this.contextLostListener=function(t){for(var e,i,n=Ze(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=Ze(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(){var t;(this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl)&&(null==(t=this.gl.getExtension("WEBGL_lose_context"))||t.loseContext());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}(),Kd=function(t){function i(i,r){var n;(n=t.call(this,i,r)||this).restoreCompositionsCache=[],r=gi({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0,glType:"webgl2"},r),n.context=new qd(i,r.glType,r),n.context.addLostHandler({lost:function(t){var e;null==(e=n.ticker)||e.pause(),n.restoreCompositionsCache=n.compositions.slice(),n.compositions.forEach((function(e){return e.lost(t)})),t.preventDefault(),wt.error("WebGL context lost. Event target: "+t.target+"."),n.emit("contextlost",{engine:Xf(n),e:t})}});var a=Xf(n);n.context.addRestoreHandler({restore:T((function(){var t,i;return w(this,(function(r){switch(r.label){case 0:if(!(i=a.context.gl))throw new Error("Can not restore automatically because losing gl context.");return a.reset(),a.shaderLibrary=new Hd(a),a.gpuCapability=new Qo(i),[4,Promise.all(a.restoreCompositionsCache.map(T((function(t){var e,i,r,n,s,o,u,h,l,c,f;return w(this,(function(d){switch(d.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.reusable,s=t.renderOrder,o=t.transform,u=t.videoState,[4,_d.load(i,a)];case 1:(h=d.sent()).speed=r,h.reusable=n,h.renderOrder=s,h.transform.setPosition(o.position.x,o.position.y,o.position.z),h.transform.setRotation(o.rotation.x,o.rotation.y,o.rotation.z),h.transform.setScale(o.scale.x,o.scale.y,o.scale.z),h.onItemMessage=t.onItemMessage,l=0,d.label=2;case 2:return l<u.length?u[l]?((c=h.textures[l].source.video).currentTime=null!=(f=u[l])?f:0,[4,c.play()]):[3,4]:[3,5];case 3:d.sent(),d.label=4;case 4:return l++,[3,2];case 5:return h.isEnded=!1,h.gotoAndPlay(e),[2,h]}}))}))))];case 1:return r.sent(),a.restoreCompositionsCache=[],null==(t=a.ticker)||t.resume(),et()&&a.canvas&&(a.canvas.style.display="none",e.setTimeout((function(){a.canvas.style.display=""}),0)),a.emit("contextrestored",a),[2]}}))}))});var s=n.context.gl;return mt(s),n.gl=s,n.reset(),n.gpuCapability=new Qo(s),n.shaderLibrary=new Hd(Xf(n)),n.renderer=new tu(Xf(n)),n.maxTextureCount=n.gl.TEXTURE0+n.gl.getParameter(n.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,n.resize(),n}oe(i,t);var r=i.prototype;return r.getWidth=function(){return this.gl.drawingBufferWidth},r.getHeight=function(){return this.gl.drawingBufferHeight},r.getShaderLibrary=function(){return this.shaderLibrary},r.createGLFramebuffer=function(t){var e=this.gl.createFramebuffer();if(!e)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return Sd(e,t,t),e},r.createVAO=function(t){return new Gd(this,t)},r.deleteGLTexture=function(t){t.textureBuffer&&!this.disposed&&(this.gl.deleteTexture(t.textureBuffer),t.textureBuffer=null)},r.deleteGPUBuffer=function(t){t&&!this.disposed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},r.deleteGLFramebuffer=function(t){t&&!this.disposed&&(this.gl.deleteFramebuffer(t.fbo),delete t.fbo)},r.deleteGLRenderbuffer=function(t){t&&!this.disposed&&(this.gl.deleteRenderbuffer(t.buffer),t.buffer=null)},r.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.renderer,n.currentFrame.globalUniforms)}catch(t){return console.error(t),void this.renderErrors.add(t)}var a=this.gl;if(a){var s=t,o=i.shaderVariant.program.setupAttributes(s),u=s.indicesBuffer,h=s.drawStart,l=s.drawCount,c=s.mode,f=s.subMeshes;if(f&&f.length){var d,p=f[r];if(l<0)return;if(h=p.offset,u)l=null!=(d=p.indexCount)?d:0;else l=p.vertexCount}u?a.drawElements(c,l,u.type,null!=h?h:0):a.drawArrays(c,h,l),null==o||o.unbind()}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")}},r.clear=function(t){var e=0;if(t.colorAction===Ar.clear){var i=t.clearColor;i&&this.clearColor(i[0],i[1],i[2],i[3]),this.colorMask(!0,!0,!0,!0),e=Rr.COLOR_BUFFER_BIT}if(t.stencilAction===Ar.clear&&(this.stencilMask(255),this.clearStencil(t.clearStencil||0),e|=Rr.STENCIL_BUFFER_BIT),t.depthAction===Ar.clear){var r=t.clearDepth;this.depthMask(!0),this.clearDepth(Number.isFinite(r)?r:1),e|=Rr.DEPTH_BUFFER_BIT}e&&this.gl.clear(e)},r.dispose=function(){var e;this.disposed||(t.prototype.dispose.call(this),this.renderer.dispose(),this.renderTargetPool.dispose(),null==(e=this.shaderLibrary)||e.dispose(),this.context.dispose(),this.reset())},r.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=Rr.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},r.setSampleAlphaToCoverage=function(t){t?this.enable(Rr.SAMPLE_ALPHA_TO_COVERAGE):this.disable(Rr.SAMPLE_ALPHA_TO_COVERAGE)},r.setBlending=function(t){t?this.enable(Rr.BLEND):this.disable(Rr.BLEND)},r.setDepthTest=function(t){t?this.enable(Rr.DEPTH_TEST):this.disable(Rr.DEPTH_TEST)},r.setStencilTest=function(t){t?this.enable(Rr.STENCIL_TEST):this.disable(Rr.STENCIL_TEST)},r.setCulling=function(t){t?this.enable(Rr.CULL_FACE):this.disable(Rr.CULL_FACE)},r.setPolygonOffsetFill=function(t){t?this.enable(Rr.POLYGON_OFFSET_FILL):this.disable(Rr.POLYGON_OFFSET_FILL)},r.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},r.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},r.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},r.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},r.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},r.useProgram=function(t){this.set1("useProgram",t)},r.clearDepth=function(t){this.set1("clearDepth",t)},r.depthFunc=function(t){this.set1("depthFunc",t)},r.depthMask=function(t){this.set1("depthMask",t)},r.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},r.depthRange=function(t,e){this.set2("depthRange",t,e)},r.clearStencil=function(t){this.set1("clearStencil",t)},r.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},r.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},r.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},r.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},r.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},r.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},r.cullFace=function(t){this.set1("cullFace",t)},r.frontFace=function(t){this.set1("frontFace",t)},r.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},r.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},r.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},r.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},r.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},r.blendEquation=function(t){this.set1("blendEquation",t)},r.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},r.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},r.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},r.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},r.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},r.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},r.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)},r.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)},r.set4=function(t,e,i,r,n){var a=this.glCapabilityCache[t];a||(a=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),a.x===e&&a.y===i&&a.z===r&&a.w===n||this.gl[t](a.x=e,a.y=i,a.z=r,a.w=n)},r.get=function(t){return this.glCapabilityCache[t]},r.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},r.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},r.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},r.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},r.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},r.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},r.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},r.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},r.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},r.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},r.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},r.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},r.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)}},r.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},r.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},r.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},r.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},i}(xd);function Qd(t,e){return!e||"object"!=((i=e)&&"undefined"!=typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)&&"function"!=typeof e?Xf(t):e;var i}var Jd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",$d="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",tp="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",ep="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var ip=new Map;function rp(t){return ip.has(t)}function np(t){return ip.get(t)}function ap(){return Array.from(ip.values())}var sp=!1,op=1,up=function(t){function e(e){var r;(r=t.call(this)||this).resumePending=!1,r.disposed=!1,r.lost=function(t){r.handleEmitEvent("webglcontextlost",t)};var n=Xf(r);r.restore=T((function(){return w(this,(function(t){return n.emit("webglcontextrestored"),[2]}))}));var a=e.container,s=e.canvas,o=e.fps,u=e.name,h=e.pixelRatio,l=e.manualRender,f=e.renderFramework,d=e.notifyTouch,p=e.onError,m=e.interactive,v=void 0!==m&&m,y=e.renderOptions,g=void 0===y?{}:y,x=e.env,b=void 0===x?"":x,E=g.willCaptureImage,_=g.premultipliedAlpha;if(r.onError=p,sp||"debug-disable"===f)return Qd(r);var S,C=(S=/iPhone OS (\d+)_(\d+)/.exec(i.userAgent))&&("13"===S[1]||"16"===S[1]&&"5"===S[2])?"webgl":"webgl2";f&&(C="webgl"===f?"webgl":"webgl2"),r.env=b,r.name=u||""+op++;var A=!1;try{if(Ir.length)throw new Error("Errors before player create: "+Ir.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});s?(r.canvas=s,A=!0):(!function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Jd+".")}(a),r.canvas=c.createElement("canvas"),a.appendChild(r.canvas)),r.container=r.canvas.parentElement,r.engine=xd.create(r.canvas,{name:u,glType:C,fps:o,env:b,preserveDrawingBuffer:E,premultipliedAlpha:_,manualRender:l,notifyTouch:d,interactive:v,pixelRatio:Number.isFinite(h)?h:J()}),r.engine.offscreenMode=!0,r.engine.on("rendererror",(function(t){r.handleEmitEvent("rendererror",t)})),r.engine.on("contextlost",(function(t){r.lost(t.e)}));var M=Xf(r);r.engine.on("contextrestored",T((function(){return w(this,(function(t){switch(t.label){case 0:return[4,M.restore()];case 1:return t.sent(),[2]}}))}))),r.engine.on("click",(function(t){var e=t.behavior||$t.NOTIFY;r.emit("click",gi({},t,{player:Xf(r),compositionId:t.composition.id,compositionName:t.composition.name})),e===$t.RESUME_PLAYER&&r.resume()})),r.engine.on("pointerdown",(function(t){r.emit("pointerdown",t)})),r.engine.on("pointerup",(function(t){r.emit("pointerup",t)})),r.engine.on("pointermove",(function(t){r.emit("pointermove",t)})),r.engine.runRenderLoop((function(t){r.autoPlaying&&r.emit("update",{player:Xf(r),playing:!0})})),ip.forEach((function(t){t.gpuCapability.type!==r.gpuCapability.type&&wt.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+r.gpuCapability.type+".\nsee "+ep+".")})),ip.set(r.canvas,Xf(r)),function(){for(var t,e=[],i=Ze(ip.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&wt.error("Current running player count: "+e.length+", see "+tp+".",e)}()}catch(t){var I;r.canvas&&!A&&r.canvas.remove(),null==(I=r.engine)||I.dispose(),r.disposed=!0,r.handleThrowError(t)}return r}oe(e,t);var r=e.prototype;return r.setSpeed=function(t){isNaN(t)||(this.engine.speed=t)},r.getSpeed=function(){return this.engine.speed},r.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},r.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},r.getAssetManager=function(){return this.assetManagers},r.loadScene=function(t,e){var i=this;return T((function(){var r,n,a,s,o,u,h,l,c,f;return w(this,(function(d){switch(d.label){case 0:for(mt(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),(n=null==(r=null==e?void 0:e.autoplay)||r)&&(i.autoPlaying=!0),a=[],s=[],At(t)?(o=a).push.apply(o,[].concat(t)):a.push(t),u=Ze(i.assetManagers);!(h=u()).done;)h.value.dispose();return i.engine.assetManagers=[],l=i.engine.compositions.length,[4,Promise.all(a.map(T((function(t,r){var a,o,u,h,c,f,d;return w(this,(function(p){switch(p.label){case 0:return a=l+r,o=i.assetService.assembleSceneLoadOptions(t,gi({autoplay:n},e)),u=o.source,h=o.options,f=null==(c=null==h?void 0:h.autoplay)||c,[4,_d.load(u,i.engine,h)];case 1:return(d=p.sent()).setIndex(a),d.onItemMessage=function(t){i.emit("message",t)},s[r]=f,[2,d]}}))}))))];case 1:for(c=d.sent(),f=0;f<c.length;f++)s[f]?c[f].play():c[f].pause();return c.some((function(t){return!t.getPaused()}))&&i.emit("play",{time:0}),[2,At(t)?c:c[0]]}}))}))()},r.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})},r.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.tick(0),this.emit("play",{time:t})},r.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.tick(0),this.emit("pause")},r.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()},r.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())},r.resume=function(){var t=this;return T((function(){var e;return w(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]}}))}))()},r.tick=function(t){this.engine.mainLoop(t)},r.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},r.resize=function(){this.engine.resize()},r.clearCanvas=function(){this.renderer.clear({stencilAction:Ar.clear,clearStencil:0,depthAction:Ar.clear,clearDepth:1,colorAction:Ar.clear,clearColor:[0,0,0,0]})},r.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()}))},r.dispose=function(){if(wt.info("Call player destroyed: "+this.name+"."),!this.disposed){ip.delete(this.canvas),this.pause(),this.engine.dispose(),E(this.canvas,p)&&(fc.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var t="Never use destroyed player: "+this.name+" again, see "+$d+".",e=function(){return function(t){throw new Error(t)}(t)},i=function(){return e=t,Promise.reject(e);var e};this.tick=e,this.resize=e,this.loadScene=i,this.play=i,this.gotoAndPlay=i,this.gotoAndStop=i,this.playSequence=e,this.destroyCurrentCompositions=e,this.resume=i,this.disposed=!0}},r.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},r.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},r.handleEmitEvent=function(t,e){this.onError?E(e,x)?this.onError(new Error(e.type,{cause:t}),e):E(e,Error)?this.onError(new Error(e.message,{cause:t}),e):this.onError(new Error("Unknown error.",{cause:t}),e):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,e))},xr(e,[{key:"skipPointerMovePicking",get:function(){return this.engine.eventSystem.skipPointerMovePicking},set:function(t){this.engine.eventSystem.skipPointerMovePicking=t}},{key:"ticker",get:function(){return this.engine.ticker}},{key:"renderer",get:function(){return this.engine.renderer}},{key:"gpuCapability",get:function(){return this.engine.gpuCapability}},{key:"compositions",get:function(){return this.engine.compositions}},{key:"assetManagers",get:function(){return this.engine.assetManagers}},{key:"assetService",get:function(){return this.engine.assetService}},{key:"event",get:function(){return this.engine.eventSystem}},{key:"displayAspect",get:function(){return this.engine.displayAspect},set:function(t){this.engine.displayAspect=t}},{key:"displayScale",get:function(){return this.engine.displayScale},set:function(t){this.engine.displayScale=t}},{key:"offscreenMode",get:function(){return this.engine.offscreenMode},set:function(t){this.engine.offscreenMode=t}},{key:"pixelRatio",get:function(){return this.engine.pixelRatio},set:function(t){this.engine.pixelRatio=t}},{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}}]),e}(ea);function hp(t){sp=!!t}_([function(t,e,i){var r=i.value;return i.value=T((function(){var e,i,n,a,s=arguments;return w(this,(function(o){switch(o.label){case 0:for(e=s.length,i=new Array(e),n=0;n<e;n++)i[n]=s[n];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.apply(this,i)];case 2:return[2,o.sent()];case 3:return a=o.sent(),t.handleThrowError.call(this,a),[3,4];case 4:return[2]}}))})),i}],up.prototype,"loadScene",null),cn.create=function(t,e){return new zd(t,e)},cn.createWithData=function(t,e,i){void 0===e&&(e=ht("#fff")),void 0===i&&(i={});var r=i.type,n=void 0===r?Rr.UNSIGNED_BYTE:r,a=i.format,s=void 0===a?Rr.RGBA:a,o=i.internalFormat,u=i.wrapS,h=void 0===u?Rr.MIRRORED_REPEAT:u,l=i.wrapT,c=void 0===l?Rr.MIRRORED_REPEAT:l,f=i.minFilter,d=void 0===f?Rr.NEAREST:f,p=i.magFilter,m=void 0===p?Rr.NEAREST:p,v=i.flipY,y=void 0!==v&&v,g=i.generateMipmap,x=void 0!==g&&g;return new zd(t,{data:e,type:n,sourceType:Mr.data,format:s,internalFormat:o||s,wrapS:h,wrapT:c,minFilter:d,magFilter:m,flipY:y,generateMipmap:x})},To.create=function(t,e){return new Pd(t,e)},wo.create=function(t,e){return new wo(t,e)},Zo.create=function(t){return new Vd(t)},ho.create=function(t,e){return new Ud(t,e)},xd.create=function(t,e){return new Kd(t,e)};var lp="2.9.1";wt.info("Player version: 2.9.1.");export{Fu as ActivationMixerPlayable,Vu as ActivationPlayable,Hl as ActivationPlayableAsset,nh as ActivationTrack,ki as AndNode,Vi as AndNodeData,Ei as Animatable,Nu as AnimationClip,Ti as AnimationClipNode,xi as AnimationClipNodeData,Ou as AnimationEvent,mi as AnimationGraphAsset,wr as Animator,Ni as ApplyAdditiveNode,Pi as ApplyAdditiveNodeData,Ec as Asset,Sc as AssetLoader,Df as AssetManager,Uf as AssetService,bo as BYTES_TYPE_MAP,_r as Behaviour,ps as BezierCurve,ts as BezierCurvePath,es as BezierCurveQuat,Ra as BezierDataMap,Ba as BezierEasing,Ma as BezierLengthData,Ia as BezierMap,Da as BezierPath,za as BezierQuat,_c as BinaryAsset,Fi as BlendNode,Li as BlendNodeData,pi as BoolValueNode,Wn as BoundingBoxInfo,so as COPY_FRAGMENT_SHADER,no as COPY_MESH_SHADER_ID,ao as COPY_VERTEX_SHADER,jf as Camera,uu as CameraController,fu as CameraVFXItemLoader,bs as ColorCurve,Ru as ColorPlayable,zu as ColorPropertyMixerPlayable,Yl as ColorPropertyPlayableAsset,mh as ColorPropertyTrack,br as Component,hc as ComponentTimePlayable,uc as ComponentTimePlayableAsset,ac as ComponentTimeTrack,Qf as Composition,Ys as CompositionComponent,Ho as CompressTextureCapabilityType,Wi as ConstBoolNode,Xi as ConstBoolNodeData,ji as ConstFloatNode,Gi as ConstFloatNodeData,Js as ConstraintTarget,qi as ControlParameterBoolNode,Zi as ControlParameterBoolNodeData,Yi as ControlParameterFloatNode,Hi as ControlParameterFloatNodeData,Qi as ControlParameterTriggerNode,Ki as ControlParameterTriggerNodeData,vc as DEFAULT_FONTS,yd as DEFAULT_FPS,Cc as Database,bt as Deferred,_t as DestroyOptions,Gr as Downloader,xo as DrawObjectPass,ro as EFFECTS_COPY_MESH_NAME,du as EVENT_TYPE_CLICK,vu as EVENT_TYPE_TOUCH_END,mu as EVENT_TYPE_TOUCH_MOVE,pu as EVENT_TYPE_TOUCH_START,qs as EffectComponent,oc as EffectComponentTimeTrack,ii as EffectsObject,vd as EffectsPackage,zs as Ellipse,xd as Engine,tr as EqualNodeData,ea as EventEmitter,yu as EventSystem,nu as Fake3DAnimationMode,au as Fake3DComponent,eo as FilterMode,ca as Float16ArrayWrapper,nr as FloatComparisonNode,rr as FloatComparisonNodeData,Bu as FloatPropertyMixerPlayable,Zl as FloatPropertyPlayableAsset,sh as FloatPropertyTrack,di as FloatValueNode,su as FrameComponent,ho as Framebuffer,Kd as GLEngine,Pd as GLGeometry,Rn as GLSLVersion,Qo as GPUCapability,To as Geometry,Yo as GlobalUniforms,Qa as GradientValue,yr as GraphInstance,hi as GraphNode,li as GraphNodeData,eu as Graphics,Hs as GraphicsPath,ar as GreaterNodeData,ta as HELP_LINK,Bn as HitTestType,Eu as InteractComponent,xu as InteractLoader,Tu as InteractMesh,ui as InvalidIndex,Yn as Item,$i as LayerBlendNode,Ji as LayerBlendNodeData,sr as LessNodeData,Ja as LineSegments,Ka as LinearValue,Er as MaskMode,Un as MaskProcessor,iu as MaskableGraphic,zn as Material,Tn as MaterialDataBlock,Vn as MaterialRenderType,kn as MaterialState,lh as MaterialTrack,wo as Mesh,Ii as NodeTransform,Ui as NotNode,Bi as NotNodeData,Pu as NotifyEvent,Wl as ObjectBindingTrack,zi as OrNode,Di as OrNodeData,$ as OrderType,$n as PLAYER_OPTIONS_ENV_EDITOR,ml as POST_PROCESS_SETTINGS,Cl as ParticleBehaviourPlayable,Al as ParticleBehaviourPlayableAsset,cc as ParticleLoader,Il as ParticleMesh,Uu as ParticleMixerPlayable,Nl as ParticleSystem,Pl as ParticleSystemRenderer,ch as ParticleTrack,Ed as PassTextureCache,$a as PathSegments,wu as PlayState,Cu as Playable,Mu as PlayableAsset,Au as PlayableOutput,up as Player,ae as Plugin,Gt as PluginSystem,Gn as PointerEventData,cu as PointerEventType,Us as PolyStar,Ns as Polygon,Ri as Pose,ci as PoseNode,$s as PositionConstraint,to as PostProcessVolume,Vf as Precomposition,wd as PrecompositionManager,ku as PropertyClipPlayable,ah as PropertyTrack,dl as RENDER_PREFER_LOOKUP_TEXTURE,fl as RUNTIME_ENV,Ya as RandomSetValue,Za as RandomValue,qa as RandomVectorValue,jn as RaycastResult,Xo as RenderFrame,go as RenderPass,oo as RenderPassAttachmentStorageType,po as RenderPassDestroyAttachmentType,co as RenderPassPriorityNormal,fo as RenderPassPriorityPostprocess,lo as RenderPassPriorityPrepare,mo as RenderTargetHandle,qo as RenderTargetPool,io as RenderTextureFormat,Zo as Renderbuffer,tu as Renderer,Hn as RendererComponent,rh as RuntimeClip,Qn as SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0,Jn as SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0,qn as SEMANTIC_PRE_COLOR_ATTACHMENT_0,Kn as SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0,Zn as SPRITE_VERTEX_STRIDE,Rf as Scene,_d as SceneLoader,wc as SerializationHelper,Fn as Shader,In as ShaderCompileResultStatus,Bo as ShaderFactory,Tr as ShaderType,Ln as ShaderVariant,ru as ShapeComponent,Ws as ShapePath,cr as SourceType,Gu as SpriteColorMixerPlayable,nc as SpriteColorPlayableAsset,oh as SpriteColorTrack,lc as SpriteComponent,sc as SpriteComponentTimeTrack,Su as SpriteLoader,Ds as StarType,hr as StateMachineNode,or as StateMachineNodeData,fr as StateNode,lr as StateNodeData,Ha as StaticValue,ju as SubCompositionClipPlayable,Xu as SubCompositionMixerPlayable,ql as SubCompositionPlayableAsset,uh as SubCompositionTrack,pl as TEMPLATE_USE_OFFSCREEN_CANVAS,hs as TangentMode,bc as TextComponent,mc as TextComponentBase,dc as TextLayout,Tc as TextLoader,pc as TextStyle,cn as Texture,gn as TextureFactory,Ar as TextureLoadAction,$o as TexturePaintScaleMode,Mr as TextureSourceType,uo as TextureStoreAction,gd as Ticker,tc as TimelineAsset,eh as TimelineClip,ec as TimelineInstance,ih as TrackAsset,Lu as TrackMixerPlayable,th as TrackType,sa as Transform,Wu as TransformMixerPlayable,Ju as TransformPlayable,$u as TransformPlayableAsset,hh as TransformTrack,mr as TransitionNode,dr as TransitionNodeData,ur as TransitionState,Bs as UpdateModes,oa as VFXItem,Wa as ValueGetter,fi as ValueNode,ds as Vector2Curve,Zu as Vector2PropertyMixerPlayable,Jl as Vector2PropertyPlayableAsset,ph as Vector2PropertyTrack,fs as Vector3Curve,Yu as Vector3PropertyMixerPlayable,dh as Vector3PropertyTrack,Ql as Vector3ropertyPlayableAsset,cs as Vector4Curve,Hu as Vector4PropertyMixerPlayable,Kl as Vector4PropertyPlayableAsset,fh as Vector4PropertyTrack,ls as WeightedMode,ft as addByOrder,P as addItem,L as addItemWithOrder,kt as applyMixins,mt as assertExist,vt as asserts,Vt as base64ToFile,ka as buildBezierData,Ua as buildEasingCurve,As as buildLine,va as calculateTranslation,tt as canUseBOM,fc as canvasPool,_s as closePointEps,Lo as colorGradingFrag,q as colorStopsFromGradient,Y as colorToArr,Lf as combineImageTemplate,Sr as createGLContext,ss as createKeyFrameMeta,Oh as createShape,xs as createValueGetter,ws as curveEps,wa as decimalEqual,sn as deserializeMipmapTexture,hp as disableAllPlayer,tl as earcut,$e as effectsClass,Qe as effectsClassStore,F as enlargeBuffer,Mc as ensureFixedNumber,ya as ensureVec3,Ca as extractMinAndMax,Fo as gaussianDownHFrag,Vo as gaussianDownVFrag,ko as gaussianUpFrag,mn as generateEmptyTexture,Eo as generateEmptyTypedArray,Ft as generateGUID,fn as generateHalfFloatTexture,pn as generateWhiteTexture,ap as getActivePlayers,Nf as getBackgroundImage,Je as getClass,Z as getColorFromGradientStops,yl as getConfig,Ga as getControlPoints,xn as getDefaultTextureFactory,sl as getGeometryByShape,al as getGeometryTriangles,as as getKeyFrameMetaByRawValue,ei as getMergedStore,si as getNodeDataClass,Rl as getParticleMeshShader,J as getPixelRatio,np as getPlayerByCanvas,Xt as getPluginUsageInfo,Dr as getPreMultiAlpha,Sf as getStandardComposition,wf as getStandardImage,If as getStandardItem,Ef as getStandardJSON,Wo as getTextureSize,Rr as glContext,Vr as glType2VertexFormatType,Cr as gpuTimer,ht as imageDataFromColor,lt as imageDataFromGradient,Ir as initErrors,Pr as initGLContext,So as integrate,K as interpolateColor,ot as isAlipayMiniApp,rt as isAndroid,At as isArray,Ot as isCanvas,rp as isCanvasUsedByPlayer,Mt as isFunction,et as isIOS,it as isIOSByUA,st as isMiniProgram,It as isObject,nt as isOpenHarmony,Rt as isPlainObject,Pt as isPowerOfTwo,gt as isSafeFontFamily,at as isSimulatorCellPhone,Ct as isString,En as isUniformStruct,_n as isUniformStructArray,yt as isValidFontFamily,Nr as isWebGL2,ut as isWechatMiniApp,Ao as itemFrag,Co as itemVert,Yr as loadAVIFOptional,Qr as loadBinary,$r as loadBlob,qr as loadImage,nn as loadMedia,en as loadVideo,Wr as loadWebPOptional,wt as logger,Nn as math,Ol as modifyMaxKeyframeShader,Ta as nearestPowerOfTwo,ai as nodeDataClass,St as noop,Fc as normalizeColor,Sa as numberToFix,vs as oldBezierKeyFramesToNew,Q as parsePercent,Mo as particleFrag,ba as particleOriginTranslateMap,Ml as particleUniformTypeMap,Io as particleVert,Pf as passRenderLevel,Dt as pluginLoaderMap,Nt as randomInRange,Bt as registerPlugin,N as removeItem,ol as rotateVec2,No as screenMeshVert,ti as serialize,zr as setBlendMode,gl as setConfig,bn as setDefaultTextureFactory,Ur as setMaskMode,Ea as setRayFromCamera,Br as setSideMode,ct as sortByOrder,He as spec,yn as textureLoaderRegistry,Do as thresholdFrag,Lt as throwDestroyedError,Ro as trailVert,fa as translatePoint,_a as trianglesFromRect,Ut as unregisterPlugin,kr as valIfUndefined,Oo as value,Po as valueDefine,ga as vecFill,xa as vecMulCombine,lp as version,Fr as vertexFormatType2GLType};
|
|
1
|
+
import{crypto as t,window as e,navigator as i,atob as r,Blob as n,WebGL2RenderingContext as a,WebGLRenderingContext as s,XMLHttpRequest as o,HTMLImageElement as u,URL as h,Image as l,document as c,performance as f,location as d,HTMLCanvasElement as p,HTMLVideoElement as m,TextDecoder as v,cancelAnimationFrame as y,requestAnimationFrame as g,Event as x}from"@galacean/appx-adapter/weapp";function b(t,e,i,r,n,a,s){try{var o=t[a](s),u=o.value}catch(t){return void i(t)}o.done?e(u):Promise.resolve(u).then(r,n)}function T(t){return function(){var e=this,i=arguments;return new Promise((function(r,n){var a=t.apply(e,i);function s(t){b(a,r,n,s,o,"next",t)}function o(t){b(a,r,n,s,o,"throw",t)}s(void 0)}))}}function E(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):E(t,e)}function _(t,e,i,r){var n,a=arguments.length,s=a<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 o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s}function w(t,e){var i,r,n,a={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=o(0),s.throw=o(1),s.return=o(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(o){return function(u){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}var S;"function"==typeof SuppressedError&&SuppressedError;var C=new Uint8Array(16);function A(){if(!S&&!(S=void 0!==t&&t.getRandomValues&&t.getRandomValues.bind(t)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return S(C)}for(var M=[],I=0;I<256;++I)M.push((I+256).toString(16).slice(1));var R={randomUUID:void 0!==t&&t.randomUUID&&t.randomUUID.bind(t)};function O(t,e,i){if(R.randomUUID&&!e&&!t)return R.randomUUID();var r=(t=t||{}).random||(t.rng||A)();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),M[t[e+0]]+M[t[e+1]]+M[t[e+2]]+M[t[e+3]]+"-"+M[t[e+4]]+M[t[e+5]]+"-"+M[t[e+6]]+M[t[e+7]]+"-"+M[t[e+8]]+M[t[e+9]]+"-"+M[t[e+10]]+M[t[e+11]]+M[t[e+12]]+M[t[e+13]]+M[t[e+14]]+M[t[e+15]]}(r)}function P(t,e){return t.includes(e)||t.push(e),t}function N(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function L(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}}function F(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),s=new t.constructor(a);return s.set(t),s}return t}var V=2*Math.PI,k=Math.PI/180,D=180/Math.PI,z=1e-6;function B(t,e){return Math.abs(t-e)<z||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var U=function(t,e,i){return(1-i)*t+i*e};function G(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,a=Math.min(r,n),s=Math.max(r,n);return Math.min(Math.max(t,a),s)}var j=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):E(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):E(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):E(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):E(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,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=z,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}();j.ONE=new j(1,1),j.ZERO=new j(0,0);var X=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):E(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):E(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):E(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):E(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,s=e.y,o=e.z;return this.x=r*o-n*s,this.y=n*a-i*o,this.z=i*s-r*a,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=z,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 j(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}();X.X=new X(1,0,0),X.Y=new X(0,1,0),X.Z=new X(0,0,1),X.ONE=new X(1,1,1),X.ZERO=new X(0,0,0);var W=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(a=t[e+3])?a:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):E(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):E(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):E(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):E(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,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=z,e=this,i=e.x,r=e.y,n=e.z,a=e.w;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t&&Math.abs(a)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new X(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}();W.ONE=new W(1,1,1,1),W.ZERO=new W(0,0,0,0);var H=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,s=n*(1-Math.abs(a%2-1)),o=0,u=0,h=0;a>=0&&a<=1?(o=n,u=s):a>=1&&a<=2?(o=s,u=n):a>=2&&a<=3?(u=n,h=s):a>=3&&a<=4?(u=s,h=n):a>=4&&a<=5?(o=s,h=n):a>=5&&a<=6&&(o=n,h=s);var l=i-n;return this.set(o+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):E(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):E(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):E(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):E(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new W(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,i=e.r,r=e.g,n=e.b,a=e.a,s=Math.max(i,r,n),o=Math.min(i,r,n),u=s-o,h=0,l=0;return 0!==s&&(l=u/s),s!=o&&(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,a)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),(new t).setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();function Y(t,e){var i=[0,0,0,0];if(Ct(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 E(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function Z(t,e,i){if(0===t.length)return[0,0,0,0];var r;if(e<=t[0].time)r=t[0].color.toArray();else if(e>=t[t.length-1].time)r=t[t.length-1].color.toArray();else{r=t[t.length-1].color.toArray();for(var n=1;n<=t.length-1;n++){var a=t[n-1],s=t[n];if(a.time<=e&&e<=s.time){r=K(a.color.toArray(),s.color.toArray(),(e-a.time)/(s.time-a.time));break}}}return i?r.map((function(t){return t/255})):r}function q(t){var e=[];return E(t,Array)?t.forEach((function(t){var i=t[0],r=t[1],n=t[2],a=t[3],s=t[4];e.push({time:Q(i),color:new H(r,n,a,s)})})):Object.keys(t).forEach((function(i){var r=t[i],n=(new H).setFromArray(Y(r));e.push({time:Q(i),color:n})})),e=e.sort((function(t,e){return t.time-e.time}))}function K(t,e,i,r){var n=[],a=1-i;if(r)for(var s=0;s<4;s++)n[s]=t[s]*a+e[s]*i;else{for(var o=0;o<3;o++)n[o]=Math.round(Math.sqrt(t[o]*t[o]*a+e[o]*e[o]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function Q(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function J(){return"object"==typeof e?Math.min(2,e.devicePixelRatio||1):1}H.BLACK=new H(0,0,0,1),H.BLUE=new H(0,0,1,1),H.CLEAR=new H(0,0,0,0),H.CYAN=new H(0,1,1,1),H.GRAY=new H(.5,.5,.5,1),H.GREEN=new H(0,1,0,1),H.MAGENTA=new H(1,0,1,1),H.RED=new H(1,0,0,1),H.WHITE=new H(1,1,1,1),H.YELLOW=new H(1,.92,.016,1);var $,tt=void 0!==e;function et(){return!!i.platform&&/iPad|iPhone|iPod/.test(i.platform)}function it(){var t=i.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0}function rt(){return/\b[Aa]ndroid\b/.test(i.userAgent)}function nt(){return/\bOpenHarmony\b/.test(i.userAgent)}function at(){return rt()||nt()||/\b(iPad|iPhone|iPod)\b/.test(i.userAgent)}function st(){return ot()||ut()}function ot(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function ut(){return"miniprogram"===e.__wxjs_environment}function ht(t){Ct(t)&&(t=Y(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 lt(t){var e=128,i={width:e,height:1,data:new Uint8Array(512)},r=i.data,n=q(t);if(n.length)for(var a=0;a<e;a++){var s=a/127;if(s<=n[0].time)r.set(n[0].color.toArray(),4*a);else if(s>=n[n.length-1].time)r.set(n[n.length-1].color.toArray(),4*a);else for(var o=0;o<n.length-1;o++){var u=n[o],h=n[o+1];if(u.time<=s&&h.time>s){var l=K(u.color.toArray(),h.color.toArray(),(s-u.time)/(h.time-u.time));r.set(l,4*a);break}}}return i}function ct(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++)dt(t,r,e);return t}return pt(t,e)}function ft(t,e,i){return void 0===i&&(i=2),t.includes(e)?t:(t.push(e),1===t.length||1!==i&&dt(t,t.length-1,i),t)}function dt(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 pt(t,e,i,r){if(void 0===i&&(i=0),void 0===r&&(r=t.length-1),i>=r)return t;for(var n,a=t[i],s=i,o=r;s<o;){if(2===e){for(;t[o].priority>a.priority&&o>=s;)o--;for(;t[s].priority<=a.priority&&s<o;)s++}else{for(;t[o].priority<a.priority&&o>=s;)o--;for(;t[s].priority>=a.priority&&s<o;)s++}var u;u=[t[o],t[s]],t[s]=u[0],t[o]=u[1]}return n=[t[s],t[i]],t[i]=n[0],t[s]=n[1],pt(t,e,i,s-1),pt(t,e,o+1,r),t}function mt(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function vt(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)}function yt(t){return gt(t)||!at()}function gt(t){return/^[^\d.][\w-]*$/.test(t)}!function(t){t[t.none=1]="none",t[t.ascending=2]="ascending",t[t.descending=3]="descending"}($||($={}));var xt,bt=function(){var t=this;this.promise=new Promise((function(e,i){t.resolve=e,t.reject=i}))},Tt="[Galacean Effects]";function Et(t){return["%c"+Tt,"color: #AA0100",""+t]}var _t,wt={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(Et(t),[i])),null==xt||xt("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(Et(t))),null==xt||xt("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(Et(t))),null==xt||xt("warn",t,i)},register:function(t){t&&Mt(t)&&(xt=t)}};function St(){}function Ct(t){return"string"==typeof t}!function(t){t[t.destroy=0]="destroy",t[t.keep=1]="keep",t[t.force=0]="force"}(_t||(_t={}));var At=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function Mt(t){return"[object Function]"===Object.prototype.toString.call(t)}function It(t){return"[object Object]"===Object.prototype.toString.call(t)}function Rt(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 Ot(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function Pt(t){return 0==(t&t-1)&&0!==t}function Nt(t,e){return t+Math.random()*(e-t)}function Lt(){throw new Error("Destroyed item cannot be used again.")}function Ft(){return O().replace(/-/g,"")}function Vt(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var a=t.split(",")[1]||t,s=r(a),o=[],u=0;u<s.length;u+=512){for(var h=s.slice(u,u+512),l=new Array(h.length),c=0;c<h.length;c++)l[c]=h.charCodeAt(c);var f=new Uint8Array(l);o.push(f)}var d=new n(o,{type:i});return new File([d],e,{type:i})}function kt(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 Dt={},zt=[];function Bt(t,e){Dt[t]&&wt.error("Duplicate registration for plugin "+t+"."),Dt[t]=e;var i=new e;i.name=t,zt.push(i),zt.sort((function(t,e){return t.order-e.order}))}function Ut(t){delete Dt[t];var e=zt.findIndex((function(e){return e.name===t}));-1!==e&&zt.splice(e,1)}var Gt=function(){function t(){}return t.getPlugins=function(){return zt},t.initializeComposition=function(t,e){zt.forEach((function(i){return i.onCompositionCreated(t,e)}))},t.destroyComposition=function(t){zt.forEach((function(e){return e.onCompositionDestroy(t)}))},t.onAssetsLoadStart=function(t,e){return T((function(){return w(this,(function(i){return[2,Promise.all(zt.map((function(i){return i.onAssetsLoadStart(t,e)})))]}))}))()},t.onAssetsLoadFinish=function(t,e,i){zt.forEach((function(r){return r.onAssetsLoadFinish(t,e,i)}))},t}(),jt={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",ffd:"@galacean/effects-plugin-ffd",ktx2:"@galacean/effects-plugin-ktx2",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 Xt(t){var e=jt[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 Wt,Ht,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee,ie,re,ne,ae=function(){function t(){this.order=100,this.name="Plugin"}var e=t.prototype;return e.onAssetsLoadStart=function(t,e){return T((function(){return w(this,(function(t){return[2]}))}))()},e.onAssetsLoadFinish=function(t,e,i){},e.onCompositionCreated=function(t,e){},e.onCompositionDestroy=function(t){},t}();function se(t,e){return se=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},se(t,e)}function oe(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&&se(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["3_6"]="3.6",t["3_7"]="3.7",t.LATEST="3.7"}(Wt||(Wt={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(Ht||(Ht={})),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"}(Yt||(Yt={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(Zt||(Zt={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(qt||(qt={})),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"}(Kt||(Kt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(Qt||(Qt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Jt||(Jt={})),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"}($t||($t={})),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"}(te||(te={})),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"}(ee||(ee={})),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"}(ie||(ie={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(re||(re={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(ne||(ne={}));var ue,he,le,ce,fe,de,pe,me,ve,ye,ge,xe,be,Te,Ee,_e,we,Se,Ce,Ae=1,Me=3,Ie=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(ue||(ue={})),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"}(he||(he={})),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"}(le||(le={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(ce||(ce={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(fe||(fe={})),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"}(de||(de={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(pe||(pe={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(me||(me={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(ve||(ve={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(ye||(ye={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(ge||(ge={})),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"}(xe||(xe={})),function(t){t[t.visible=0]="visible",t[t.display=1]="display",t[t.clip=2]="clip",t[t.ellipsis=3]="ellipsis"}(be||(be={})),function(t){t[t.autoWidth=0]="autoWidth",t[t.autoHeight=1]="autoHeight",t[t.fixed=2]="fixed"}(Te||(Te={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Ee||(Ee={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(_e||(_e={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(we||(we={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Se||(Se={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Ce||(Ce={}));var Re,Oe,Pe,Ne,Le,Fe,Ve,ke,De,ze,Be,Ue,Ge,je,Xe={WhiteTexture:"whitetexture00000000000000000000",EmptyTexture:"emptyTexture00000000000000000000",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"}(Re||(Re={})),function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}(Oe||(Oe={})),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"}(Pe||(Pe={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(Ne||(Ne={})),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"}(Fe||(Fe={})),function(t){t.video="video",t.image="image"}(Ve||(Ve={})),function(t){t.video="video",t.audio="audio"}(ke||(ke={})),function(t){t.L30="hev1.1.0.L30.B0",t.L60="hev1.1.0.L60.B0",t.L63="hev1.1.0.L63.B0",t.L90="hev1.1.0.L90.B0",t.L93="hev1.1.0.L93.B0",t.L120="hev1.1.0.L120.B0",t.L150="hev1.1.0.L150.B0",t.L180="hev1.1.0.L180.B0"}(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.FrameComponent="FrameComponent",t.Animator="Animator",t.TimelineClip="TimelineClip"}(ze||(ze={})),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"}(Be||(Be={})),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"}(Ue||(Ue={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(Ge||(Ge={})),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"}(je||(je={}));var We=Wt.LATEST,He=Object.freeze({__proto__:null,LATEST_VERSION:We,get RenderLevel(){return Ht},get BlendingMode(){return Yt},get SideMode(){return Zt},get ObscuredMode(){return qt},get ParticleEmitterShapeType(){return Kt},get PluginType(){return Qt},get InteractType(){return Jt},get InteractBehavior(){return $t},get ItemType(){return te},get RenderMode(){return ee},get ParticleOrigin(){return ie},get RenderType(){return re},get RenderFace(){return ne},get CameraClipMode(){return ue},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:Ae,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:Me,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:Ie,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return he},get BezierKeyframeType(){return le},get JSONSceneVersion(){return Wt},get EndBehavior(){return ce},get ParticleInteractionBehavior(){return fe},get ShapeArcMode(){return de},get LightType(){return pe},get ModelBoundingType(){return me},get CameraType(){return ve},get MaterialType(){return ye},get MaterialBlending(){return ge},get RenderMode3D(){return xe},get TextOverflow(){return be},get TextSizeMode(){return Te},get TextBaseline(){return Ee},get TextAlignment(){return _e},get TextVerticalAlign(){return we},get TextWeight(){return Se},get FontStyle(){return Ce},BuiltinObjectGUID:Xe,get FillType(){return Re},get TexturePaintScaleMode(){return Oe},get ShapePrimitiveType(){return Pe},get LineCap(){return Ne},get LineJoin(){return Le},get NodeDataType(){return Fe},get BackgroundType(){return Ve},get MultimediaType(){return ke},get HevcVideoCodec(){return De},get DataType(){return ze},get GeometryType(){return Be},get VertexFormatType(){return Ue},get IndexFormatType(){return Ge},get VertexBufferSemantic(){return je}});function Ye(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 Ze(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 Ye(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)?Ye(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.")}var qe=new Map,Ke=new Map,Qe={};function Je(t){return Qe[t]}function $e(t){return function(e,i){Qe[t]&&console.warn("Class "+t+" is already registered."),Qe[t]=e}}function ti(t,e){return function(t,e){return function(i,r){var n=function(t){var e=t.constructor;qe.get(e)||qe.set(e,{});return qe.get(e)}(i);n&&(n[r]||(n[r]={type:t,sourceName:e}))}}(t,e)}function ei(t){var e=t.constructor;if(Ke.get(e))return Ke.get(e);var i={};Ke.set(e,i);for(var r=t,n=e;n;){var a=qe.get(n);for(var s in a)i[s]=a[s];var o=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(o).constructor)===Object)break;r=o}return i}var ii=function(){function t(t){this.engine=t,this.guid=Ft(),this.definition={},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 E(e,t)&&"guid"in e},t}(),ri=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),ni={};function ai(t){return function(e,i){ni[t]&&console.warn("NodeData Class "+t+" is already registered."),ni[t]=e}}function si(t){return ni[t]}var oi,ui=-1,hi=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}(),li=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}(),ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.previousTime=0,e.currentTime=0,e}oe(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}(hi),fi=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.setValue=function(t){},e}(hi),di=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(fi),pi=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(fi),mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).nodeDatas=[],e.graphDataSet=new ri,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=ui,e}return oe(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,a=0;a<n;a++)this.parameterLookupMap.set(i.controlParameterIDs[a],a);this.nodeDatas=[];for(var s=0;s<r.length;s++)this.nodeDatas[s]=e.createNodeData(r[s].type),this.nodeDatas[s].load(r[s]);this.graphDataSet=new ri,this.graphDataSet.resources=[];for(var o,u=Ze(i.graphDataSet.resources);!(o=u()).done;){var h=o.value,l=this.engine.findObject(h);this.graphDataSet.resources.push(l)}},e.createNodeData=function(t){var e=si(t);if(e)return new e;throw new Error("Unknown node type: "+t+".")},e}(ii);mi=_([$e("AnimationGraphAsset")],mi),function(t){t[t.Active=0]="Active",t[t.Inactive=1]="Inactive"}(oi||(oi={}));var vi=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}(),yi=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 gi(){return gi=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},gi.apply(this,arguments)}var xi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Ti,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=gi({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(li);xi=_([ai(Fe.AnimationClipNodeData)],xi);var bi,Ti=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).animation=null,e.animatable=null,e}oe(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=G(this.currentTime,0,1),this.sampleEvents(t);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.sampleEvents=function(t){if(this.animatable&&0!==this.animatable.events.length)for(var e,i=this.previousTime*this.duration,r=this.currentTime*this.duration,n=Ze(this.animatable.events);!(e=n()).done;){var a=e.value,s=a.data.startTime;(this.previousTime<=this.currentTime?i<s&&s<=r:s>i||s<=r)&&(a.currentTime=r,a.deltaTime=t.deltaTime,t.activeEvents.push(a))}},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 Ei(e.skeleton,this.animation))},e}(ci);!function(t){t[t.Position=0]="Position",t[t.Scale=1]="Scale",t[t.Rotation=2]="Rotation",t[t.Euler=3]="Euler"}(bi||(bi={}));var Ei=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.events=[],this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=Ze(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var a,s=Ze(e.scaleCurves);!(a=s()).done;){var o=a.value;this.addTransformCurveInfo(o,1)}for(var u,h=Ze(e.rotationCurves);!(u=h()).done;){var l=u.value;this.addTransformCurveInfo(l,2)}for(var c,f=Ze(e.eulerCurves);!(c=f()).done;){var d=c.value;this.addTransformCurveInfo(d,3)}for(var p,m=Ze(e.floatCurves);!(p=m()).done;){var v=p.value;this.addFloatCurveInfo(v)}for(var y,g=Ze(e.colorCurves);!(y=g()).done;){var x=y.value;this.addColorCurveInfo(x)}for(var b,T=Ze(this.animationClip.events);!(b=T()).done;){var E=b.value;this.events.push({data:E,currentTime:0,deltaTime:0})}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=G(t,0,this.animationClip.duration),n=Ze(this.transformCurveInfos);!(i=n()).done;){var a=i.value,s=a.curve.keyFrames.getValue(r),o=e.parentSpaceTransforms[a.boneIndex];switch(a.type){case 0:o.position.copyFrom(s);break;case 1:o.scale.copyFrom(s);break;case 2:o.rotation.copyFrom(s);break;case 3:o.euler.copyFrom(s)}}for(var u,h=Ze(this.floatCurveInfos);!(u=h()).done;){var l=u.value,c=l.curve.keyFrames.getValue(r);e.floatPropertyValues[l.animatedObjectIndex]=c}for(var f,d=Ze(this.colorCurveInfos);!(f=d()).done;){var p=f.value,m=p.curve.keyFrames.getValue(r);e.colorPropertyValues[p.animatedObjectIndex]=m}},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}(),_i=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],a=e[1],s=e[5],o=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-o)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>s&&i>l){var d=2*Math.sqrt(1+i-s-l);this.w=(h-o)/d,this.x=.25*d,this.y=(r+a)/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+a)/p,this.y=.25*p,this.z=(o+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-s);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(o+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(G(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,a=t.w,s=e.x,o=e.y,u=e.z,h=e.w;return this.x=i*h+a*s+r*u-n*o,this.y=r*h+a*o+n*s-i*u,this.z=n*h+a*u+i*o-r*s,this.w=a*h-i*s-r*o-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this,r=i.x,n=i.y,a=i.z,s=i.w,o=s*t.w+r*t.x+n*t.y+a*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=s,this.x=r,this.y=n,this.z=a,this;var u=1-o*o;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*a+e*this.z,this.normalize(),this}var l=Math.sqrt(u),c=Math.atan2(l,o),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=a*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,a=i.z,s=i.w,o=t.x,u=t.y,h=t.z,l=s*o+n*h-a*u,c=s*u+a*o-r*h,f=s*h+r*u-n*o,d=-r*o-n*u-a*h,p=null!=e?e:t;return p.x=l*s+d*-r+c*-a-f*-n,p.y=c*s+d*-n+f*-r-l*-a,p.z=f*s+d*-a+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(X.ZERO,this,X.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}();_i.tempVec0=new X;var wi=new _i,Si=function(){},Ci=function(t){function e(){return t.apply(this,arguments)}oe(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}(Si),Ai=function(t){function e(){return t.apply(this,arguments)}oe(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=wi.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}(Si),Mi=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 a=0;a<t.parentSpaceTransforms.length;a++){var s=t.parentSpaceTransforms[a],o=e.parentSpaceTransforms[a],u=r.parentSpaceTransforms[a],h=s.position,l=o.position,c=u.position;n.blendVector3(h,l,i,c);var f=s.rotation,d=o.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=s.scale,v=o.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=s.euler,x=o.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var E=t.floatPropertyValues[T],_=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,_,i)}for(var w=0;w<t.colorPropertyValues.length;w++){var S=t.colorPropertyValues[w],C=e.colorPropertyValues[w],A=r.colorPropertyValues[w];n.blendColor(S,C,i,A)}},t}();Mi.normalBlendFunction=new Ci,Mi.additiveBlendFunction=new Ai;var Ii=function(){function t(t){this.position=new X,this.rotation=new _i,this.scale=new X,this.euler=new X,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}(),Ri=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=Ze(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push((new Ii).copyFrom(r))}for(var n,a=Ze(t.defaultFloatPropertyValues);!(n=a()).done;){var s=n.value;this.floatPropertyValues.push(s)}for(var o,u=Ze(t.defaultColorPropertyValues);!(o=u()).done;){var h=o.value;this.colorPropertyValues.push((new H).copyFrom(h))}}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}(),Oi=function(t){this.pose=new Ri(t)},Pi=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Ni,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}(li);Pi=_([ai(Fe.ApplyAdditiveNodeData)],Pi);var Ni=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}oe(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new Oi(e.skeleton),this.additiveNodeResult=new Oi(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){Mi.additiveBlend(t,e,i,r)},e}(ci),Li=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Fi,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}(li);Li=_([ai(Fe.BlendNodeData)],Li);var Fi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).source0=null,e.source1=null,e.inputParameterValueNode=null,e}oe(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new Oi(e.skeleton),this.source1Result=new Oi(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){Mi.localBlend(t,e,i,r)},e}(ci),Vi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(ki,t),r=Ze(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}(li);Vi=_([ai(Fe.AndNodeData)],Vi);var ki=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}oe(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=Ze(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=Ze(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=Ze(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(pi),Di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(zi,t),r=Ze(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}(li);Di=_([ai(Fe.OrNodeData)],Di);var zi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}oe(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=Ze(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=Ze(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=Ze(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}(pi),Bi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ui,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Ui,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(li);Bi=_([ai(Fe.NotNodeData)],Bi);var Ui=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.result=!1,e}oe(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}(pi),Gi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ji,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(li);Gi=_([ai(Fe.ConstFloatNodeData)],Gi);var ji=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}return oe(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(di),Xi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Wi,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(li);Xi=_([ai(Fe.ConstBoolNodeData)],Xi);var Wi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}return oe(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(pi),Hi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Yi,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(li);Hi=_([ai(Fe.ControlParameterFloatNodeData)],Hi);var Yi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}oe(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}(di),Zi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(qi,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(li);Zi=_([ai(Fe.ControlParameterBoolNodeData)],Zi);var qi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}oe(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}(pi),Ki=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Qi,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(li);Ki=_([ai(Fe.ControlParameterTriggerNodeData)],Ki);var Qi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}oe(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}(pi),Ji=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNodeIndex=ui,e.layerDatas=[],e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode($i,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=Ze(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:ui,e.layerDatas)for(var r,n=Ze(e.layerDatas);!(r=n()).done;){var a=r.value;this.layerDatas.push(gi({inputNodeIndex:ui,weightValueNodeIndex:ui},a))}},e}(li);Ji=_([ai(Fe.LayerBlendNodeData)],Ji);var $i=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseLayerNode=null,e.layers=[],e}oe(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new Oi(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var r,n=Ze(this.layers);!(r=n()).done;){var a,s,o=r.value;null==(a=o.inputNode)||a.initialize(e),null==(s=o.weightValueNode)||s.initialize(e)}},i.shutdownInternal=function(e){var i;null==(i=this.baseLayerNode)||i.shutdown(e);for(var r,n=Ze(this.layers);!(r=n()).done;){var a,s,o=r.value;null==(a=o.inputNode)||a.shutdown(e),null==(s=o.weightValueNode)||s.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=Ze(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 a=n.weightValueNode.getValue(t);Mi.localBlend(e.pose,this.layerNodeResult.pose,a,e.pose)}}return e},e}(ci),tr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ui,e.comparandValueNodeIndex=ui,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(ir,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}(li);tr=_([ai(Fe.EqualNodeData)],tr);var er,ir=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}oe(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}(pi),rr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=ui,e.comparandValueNodeIndex=ui,e}return oe(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(li);!function(t){t[t.GreaterThan=0]="GreaterThan",t[t.LessThan=1]="LessThan"}(er||(er={}));var nr=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}oe(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}(pi),ar=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.instantiate=function(t){var e=this.createNode(nr,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(rr);ar=_([ai(Fe.GreaterNodeData)],ar);var sr=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.instantiate=function(t){var e=this.createNode(nr,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(rr);sr=_([ai(Fe.LessNodeData)],sr);var or=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(hr,t),r=Ze(this.stateDatas);!(e=r()).done;){var n=e.value,a={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};i.states.push(a);for(var s,o=Ze(n.transitionDatas);!(s=o()).done;){var u=s.value,h={transitionNode:t.getNode(u.transitionNodeIndex),conditionNode:t.getNode(u.conditionNodeIndex),targetStateIndex:u.targetStateIndex};a.transitions.push(h)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex,this.machineName=e.machineName},e}(li);or=_([ai(Fe.StateMachineNodeData)],or);var ur,hr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).states=[],e.activeTransition=null,e.activeStateIndex=ui,e}oe(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===oi.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=ui,n=i.transitions.length,a=0;a<n;a++){var s=i.transitions[a];if(s.targetStateIndex===ui)throw new Error("Invalid target state index.");if(!this.states[s.targetStateIndex].stateNode.isTransitioning()){var o=!1;if(s.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>s.transitionNode.exitTime&&(o=!0)}else null!==s.conditionNode&&s.conditionNode.getValue(t)&&(o=!0);if(o){r=a;break}}}if(r!==ui){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=ui,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=Ze(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=Ze(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(ci);!function(t){t[t.None=0]="None",t[t.TransitioningIn=1]="TransitioningIn",t[t.TransitioningOut=2]="TransitioningOut"}(ur||(ur={}));var lr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNodeIndex=ui,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(fr,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}(li);lr=_([ai(Fe.StateNodeData)],lr);var cr,fr=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}oe(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}(ci);!function(t){t[t.State=0]="State",t[t.Transition=1]="Transition",t[t.CachedPose=2]="CachedPose"}(cr||(cr={}));var dr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=ui,e}oe(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(mr,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}(li);dr=_([ai(Fe.TransitionNodeData)],dr);var pr,mr=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}oe(e,t);var i=e.prototype;return i.evaluate=function(t,e){mt(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=G(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=oi.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult),a=e;if(this.registerPoseTasksAndUpdateRootMotion(i,n,a),this.blendedDuration=U(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(),a},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 Oi(e.skeleton),this.targetNodeResult=new Oi(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},i.shutdownInternal=function(e){this.targetNode.setTransitioningState(ur.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(ur.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=U(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=G(this.blendWeight,0,1))},i.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;Mi.localBlend(t.pose,e.pose,r,i.pose)},e}(ci);!function(t){t[t.Float=0]="Float",t[t.Color=1]="Color"}(pr||(pr={}));var vr=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=Ze(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var a,s=Ze(e.rotation);!(a=s()).done;){var o=a.value;this.addReferenceTransform(o)}for(var u,h=Ze(e.scale);!(u=h()).done;){var l=u.value;this.addReferenceTransform(l)}for(var c,f=Ze(e.euler);!(c=f()).done;){var d=c.value;this.addReferenceTransform(d),this.useEuler=!0}for(var p=0;p<e.floats.length;p++){var m=e.floats[p];this.addRecordedProperty(m.path,m.className,m.property,0)}for(var v=0;v<e.colors.length;v++){var y=e.colors[v];this.addRecordedProperty(y.path,y.className,y.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 Ii(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 a=this.findTarget(t);if(a){var s;(s="VFXItem"===e?a:a.getComponent(Je(e)))||console.error("The "+e+" Component was not found.");for(var o=i.split("."),u=o[o.length-1],h=s,l=0;l<o.length-1;l++){var c=h[o[l]];void 0===c&&console.error("The "+o[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 H).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=Ze(i);!(e=n()).done;){var a=e.value,s=r.find(a);if(!s)return null;r=s}return r},t}(),yr=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.activeEvents=[],this.context=new vi;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=Ze(t.graphDataSet.resources);!(i=n()).done;){var a=i.value;if(a){for(var s,o=Ze(a.positionCurves);!(s=o()).done;){var u=s.value;r.position.push(u.path)}for(var h,l=Ze(a.rotationCurves);!(h=l()).done;){var c=h.value;r.rotation.push(c.path)}for(var f,d=Ze(a.scaleCurves);!(f=d()).done;){var p=f.value;r.scale.push(p.path)}for(var m,v=Ze(a.eulerCurves);!(m=v()).done;){var y=m.value;r.euler.push(y.path)}for(var g,x=Ze(a.floatCurves);!(g=x()).done;){var b=g.value;r.floats.push(b)}for(var T,E=Ze(a.colorCurves);!(T=E()).done;){var _=T.value;r.colors.push(_)}}}this.skeleton=new vr(e,r),this.result=new Oi(this.skeleton),this.context.skeleton=this.skeleton,this.context.activeEvents=this.activeEvents;var w=new yi;w.nodes=this.nodes,w.nodeDatas=t.nodeDatas,w.dataSet=t.graphDataSet;for(var S=0;S<t.nodeDatas.length;S++)w.nodes[S]||t.nodeDatas[S].instantiate(w);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.activeEvents.length=0,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];E(i,Qi)&&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=Ze(this.nodes);!(e=r()).done;){var n=e.value;E(n,hr)&&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."),ui)},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!==ui&&this.nodes[i].setValue(e)},t}();function gr(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 xr(t,e,i){return e&&gr(t.prototype,e),i&&gr(t,i),t}var br=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}oe(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.onPreRender=function(){},i.onDestroy=function(){},i.onApplyAnimationProperties=function(){},i.onParentChanged=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&&N(this.item.components,this),t.prototype.dispose.call(this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},xr(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}(ii);_([ti()],br.prototype,"item",void 0),_([ti()],br.prototype,"_enabled",void 0);var Tr,Er,_r=function(t){function e(){return t.apply(this,arguments)}oe(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}(br),wr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).graphInstance=null,e.graphAsset=null,e}oe(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 yr(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,a=e.pose.parentSpaceTransforms[r].rotation,s=e.pose.parentSpaceTransforms[r].scale,o=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(s.x,s.y,s.z),this.graphInstance.skeleton.useEuler?i[r].setRotation(o.x,o.y,o.z):i[r].setQuaternion(a.x,a.y,a.z,a.w)}for(var u=this.graphInstance.skeleton.floatAnimatedObjects,h=0;h<u.length;h++){var l=u[h],c=l.propertyName;l.directTarget[c]=e.pose.floatPropertyValues[h],E(l.target,br)&&l.target.onApplyAnimationProperties()}for(var f=this.graphInstance.skeleton.colorAnimatedObjects,d=0;d<f.length;d++){var p=f[d],m=p.propertyName;p.directTarget[m]=e.pose.colorPropertyValues[d],E(p.target,br)&&p.target.onApplyAnimationProperties()}for(var v,y=Ze(this.graphInstance.activeEvents);!(v=y()).done;){var g=v.value;g.data.event.onEvent(this.item,g)}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(br);function Sr(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 Cr(t){var i=t.getExtension("EXT_disjoint_timer_query_webgl2");if(i){var r=t.createQuery(),n=T((function(){return w(this,(function(a){return[2,new Promise((function(a,s){if(r){var o=t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(i.GPU_DISJOINT_EXT);if(o&&!u){var h=t.getQueryParameter(r,t.QUERY_RESULT);a(h/1e3/1e3)}(o||u)&&(t.deleteQuery(r),r=null),null!==o&&r&&e.setTimeout((function(){n().then(a).catch}),1)}}))]}))}));if(!r)return;return{begin:function(){r&&t.beginQuery(i.TIME_ELAPSED_EXT,r)},end:function(){t.endQuery(i.TIME_ELAPSED_EXT)},getTime:n}}}wr=_([$e("Animator")],wr),function(t){t[t.vertex=0]="vertex",t[t.fragment=1]="fragment"}(Tr||(Tr={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Er||(Er={}));var Ar,Mr,Ir=[],Rr={},Or="WebGL Constants not in global, please check your environment";function Pr(){"function"==typeof a?Lr(a):void 0!==s?(Lr(s),Lr(s.prototype)):tt?Ir.push(et()?"iOS16 lockdown mode, WebGL Constants not in global":Or):Ir.push(Or),Ir.length||"HALF_FLOAT"in Rr||(Rr.HALF_FLOAT=5131)}function Nr(t){return void 0!==a&&"WebGL2RenderingContext"===t.constructor.name}function Lr(t){for(var e in t)/^[A-Z_]/.test(e)&&(Rr[e]=t[e])}function Fr(t){switch(t){case Ue.Float32:return s.FLOAT;case Ue.Int16:return s.SHORT;case Ue.Int8:return s.BYTE;case Ue.UInt16:return s.UNSIGNED_SHORT;case Ue.UInt8:return s.UNSIGNED_BYTE;default:return s.FLOAT}}function Vr(t){switch(t){case s.FLOAT:return Ue.Float32;case s.SHORT:return Ue.Int16;case s.BYTE:return Ue.Int8;case s.UNSIGNED_SHORT:return Ue.UInt16;case s.UNSIGNED_BYTE:return Ue.UInt8;default:return Ue.Float32}}function kr(t,e){return null==t?e:t}function Dr(t){switch(t){case Yt.ALPHA:case Yt.ADD:case Yt.SUBTRACTION:case Yt.STRONG_LIGHT:case Yt.WEAK_LIGHT:return 1;case Yt.SUPERPOSITION:return 2;case Yt.BRIGHTNESS:return 3;case Yt.MULTIPLY:return 0;default:return 1}}function zr(t,e){switch(e){case void 0:case Yt.ALPHA:t.blendFunction=[Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA,Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA];break;case Yt.ADD:t.blendFunction=[Rr.ONE,Rr.ONE,Rr.ONE,Rr.ONE];break;case Yt.SUBTRACTION:t.blendFunction=[Rr.ONE,Rr.ONE,Rr.ZERO,Rr.ONE],t.blendEquation=[Rr.FUNC_REVERSE_SUBTRACT,Rr.FUNC_REVERSE_SUBTRACT];break;case Yt.SUPERPOSITION:t.blendFunction=[Rr.ONE,Rr.ONE,Rr.ONE,Rr.ONE];break;case Yt.MULTIPLY:t.blendFunction=[Rr.DST_COLOR,Rr.ONE_MINUS_SRC_ALPHA,Rr.DST_COLOR,Rr.ONE_MINUS_SRC_ALPHA];break;case Yt.BRIGHTNESS:t.blendFunction=[Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA,Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA];break;case Yt.STRONG_LIGHT:t.blendFunction=[Rr.DST_COLOR,Rr.DST_ALPHA,Rr.ZERO,Rr.ONE];break;case Yt.WEAK_LIGHT:t.blendFunction=[Rr.DST_COLOR,Rr.ZERO,Rr.ZERO,Rr.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Br(t,e){e===Zt.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=Rr.CW,t.cullFace=e===Zt.BACK?Rr.BACK:Rr.FRONT)}function Ur(t,e){switch(e){case void 0:t.stencilTest=!1;break;case Er.MASK:t.stencilTest=!0,t.stencilFunc=[Rr.ALWAYS,Rr.ALWAYS],t.stencilOpZPass=[Rr.REPLACE,Rr.REPLACE];break;case Er.OBSCURED:t.stencilTest=!0,t.stencilFunc=[Rr.EQUAL,Rr.EQUAL];break;case Er.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[Rr.NOTEQUAL,Rr.NOTEQUAL];break;case Er.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}Ir.length||Pr(),function(t){t[t.whatever=0]="whatever",t[t.clear=2]="clear"}(Ar||(Ar={})),function(t){t[t.none=0]="none",t[t.data=1]="data",t[t.image=2]="image",t[t.compressed=3]="compressed",t[t.video=4]="video",t[t.canvas=5]="canvas",t[t.framebuffer=6]="framebuffer",t[t.mipmaps=7]="mipmaps"}(Mr||(Mr={}));var Gr=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.downloadText=function(t,e,i){this.download(t,"text",e,i)},e.download=function(e,i,r,n){var a=this;if(void 0===i&&(i="json"),!this.start(e,r,n)){var s=new o,u=function(){a.finish(e,s.status,s.response)};s.responseType=i,s.addEventListener("load",(function(){200==s.status||0==s.status&&t.trustXHRStatusZero?a.finish(e,200,s.response):u()})),s.addEventListener("error",u),s.open("GET",e,!0),s.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(e,i,r){var n=this.callbacks[e];delete this.callbacks[e];for(var a=200==i||0==i&&t.trustXHRStatusZero?[r]:[i,r],s=a.length-1,o=n.length;s<o;s+=2)n[s].apply(null,a)},t}();Gr.trustXHRStatusZero=!1;var jr=!1,Xr=!1;function Wr(t,e){return Hr.apply(this,arguments)}function Hr(){return(Hr=T((function(t,e){return w(this,(function(i){switch(i.label){case 0:return!jr&&e?[3,2]:[4,qr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,qr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),jr=!0,[4,qr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Yr(t,e){return Zr.apply(this,arguments)}function Zr(){return(Zr=T((function(t,e){return w(this,(function(i){switch(i.label){case 0:return!Xr&&e?[3,2]:[4,qr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,qr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Xr=!0,[4,qr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function qr(t){return Kr.apply(this,arguments)}function Kr(){return(Kr=T((function(t){var e,i;return w(this,(function(r){if(e="",E(t,u)){if(t.complete)return[2,t];e=t.src}else E(t,n)?(e=h.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,r){var n=new l;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&h.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&h.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e}))]}))}))).apply(this,arguments)}function Qr(t){return Jr.apply(this,arguments)}function Jr(){return(Jr=T((function(t){return w(this,(function(e){return[2,new Promise((function(e,i){(new Gr).downloadBinary(t,e,(function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function $r(t){return tn.apply(this,arguments)}function tn(){return(tn=T((function(t){return w(this,(function(e){return[2,new Promise((function(e,i){(new Gr).downloadBlob(t,e,(function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function en(t){return rn.apply(this,arguments)}function rn(){return(rn=T((function(t){var e;return w(this,(function(i){return e=c.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,e.autoplay=!1,rt()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,i){var r=!1,n=function(){r||(r=!0,s(),t(e))},a=function(){r||(r=!0,s(),i("Load video fail."))},s=function(){e.removeEventListener("loadeddata",n),e.removeEventListener("canplay",n),e.removeEventListener("error",a)};e.addEventListener("loadeddata",n),e.addEventListener("canplay",n),e.addEventListener("error",a),e.play().catch((function(t){console.warn("Autoplay blocked:",t)}))}))]}))}))).apply(this,arguments)}function nn(t,e){return an.apply(this,arguments)}function an(){return(an=T((function(t,e){return w(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 sn(t,e,i){return on.apply(this,arguments)}function on(){return(on=T((function(t,e,i,r){var n,a,s,o,u,h,l,c,f;return w(this,(function(d){switch(d.label){case 0:return void 0===r&&(r=[]),34067!==t.target?[3,2]:(n=t.mipmaps,a=t.target,s=n.map((function(t){return Promise.all(t.map((function(t){return t.id?i[t.id]:un(t,e)})))})),[4,Promise.all(s)]);case 1:return o=d.sent(),[2,gi({keepImageSource:!1},t,{mipmaps:o,sourceFrom:{target:a,type:Mr.mipmaps}})];case 2:return u=t.mipmaps,h=t.target,l=u.map((function(t){return un(t,e)})),[4,Promise.all(l)];case 3:return c=d.sent(),f=r[u[0][1][0]].url,[2,gi({keepImageSource:!1},t,{mipmaps:c,sourceType:Mr.mipmaps,sourceFrom:{target:h,bin:f,type:Mr.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function un(t,e){return hn.apply(this,arguments)}function hn(){return hn=T((function(t,e){var i,r,a,s,o;return w(this,(function(u){if(i=t[1],r=i[0],a=i[1],s=i[2],!(o=e[r]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,qr(new n([new Uint8Array(o,a,s)]))]}))})),hn.apply(this,arguments)}var ln=1,cn=function(t){function e(e){var i;return(i=t.call(this,e)||this).destroyed=!1,i.id="Tex"+ln++,i}oe(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?Rr.TEXTURE_2D:e,r=t.format,n=void 0===r?Rr.RGBA:r;return t.sourceType||(t.sourceType="image"in t?Mr.image:"data"in t?Mr.data:"video"in t?Mr.video:0),gi({minFilter:Rr.NEAREST,magFilter:Rr.NEAREST,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE,target:i,format:Rr.RGBA,internalFormat:n,type:Rr.UNSIGNED_BYTE},t)},e.fromImage=function(t,i,r){return T((function(){var n,a;return w(this,(function(s){switch(s.label){case 0:return[4,qr(t)];case 1:return n=s.sent(),(a=e.create(i,gi({sourceType:Mr.image,image:n,target:Rr.TEXTURE_2D,id:Ft(),flipY:!0},r))).initialize(),[2,a]}}))}))()},e.fromVideo=function(t,i,r){return T((function(){var n,a;return w(this,(function(s){switch(s.label){case 0:return[4,en(t)];case 1:return n=s.sent(),(a=e.create(i,gi({sourceType:Mr.video,video:n,id:Ft(),flipY:!0},r))).initialize(),[2,a]}}))}))()},xr(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(ii);function fn(t,e,i,r){var n,a,s=e.length/i/r;return a=n=4===s||0===s?Rr.RGBA:3===s?Rr.RGB:2===s?Rr.LUMINANCE_ALPHA:Rr.LUMINANCE,cn.createWithData(t,{data:e,width:i,height:r},{type:Rr.HALF_FLOAT,format:n,internalFormat:a,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE})}var dn={type:Rr.UNSIGNED_BYTE,format:Rr.RGBA,internalFormat:Rr.RGBA,wrapS:Rr.MIRRORED_REPEAT,wrapT:Rr.MIRRORED_REPEAT,minFilter:Rr.NEAREST,magFilter:Rr.NEAREST};function pn(t){return cn.create(t,gi({id:Xe.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:Mr.data},dn))}function mn(t){return cn.create(t,gi({id:Xe.EmptyTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:Mr.data},dn))}var vn,yn=new(function(){function t(){this.loaders=new Map,this.instances=new Map}var e=t.prototype;return e.register=function(t,e){this.loaders.has(t)?console.warn('TextureLoader for type "'+t+'" is already registered, skipping.'):this.loaders.set(t,e)},e.unregister=function(t){var e=this.instances.get(t);e&&(e.dispose(),this.instances.delete(t)),this.loaders.delete(t)},e.getLoader=function(t){if(this.instances.has(t))return this.instances.get(t);var e=this.loaders.get(t);if(!e)return console.error('TextureLoader for type "'+t+'" is not registered.'),null;var i=e();return this.instances.set(t,i),i},e.has=function(t){return this.loaders.has(t)},e.getRegisteredTypes=function(){return Array.from(this.loaders.keys())},e.dispose=function(){this.instances.forEach((function(t){return t.dispose()})),this.instances.clear(),this.loaders.clear()},t}()),gn=function(){function t(){this.reloadPending={}}var e=t.prototype;return e.reload=function(t){var e=this;return T((function(){var i,r;return w(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]}}))}))()},e.canOffloadTexture=function(t){if(t){var e=t.type;if(e===Mr.compressed||e===Mr.image){var i=t.target,r=t.map,n=t.url;return i===Rr.TEXTURE_CUBE_MAP?"object"==typeof r&&!!r:Ct(n)&&n.length>0}if(e===Mr.mipmaps){var a=t.bin,s=t.mipmaps,o=t.target,u=t.maps,h=t.urls;return a?s.length>0:o===Rr.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return Ct(t)&&t.length>0}))}}return!1},e.loadSource=function(t,e){var i=this;return T((function(){var r,n,a,s,o,u,h,l,c,f,d,p,m,v,y,g,x,b,T,E,_,S;return w(this,(function(w){switch(w.label){case 0:return r=t.type,n=t.target,a=t.map,s=t.url,o=t.bin,u=t.mipmaps,h=t.urls,l=t.maps,n!==Rr.TEXTURE_CUBE_MAP||r===Mr.mipmaps?[3,2]:[4,i.loadCubeMap(a)];case 1:return c=w.sent(),[2,gi({},e,{cube:c,target:Rr.TEXTURE_CUBE_MAP,sourceType:Mr.image,sourceFrom:{type:Mr.image,map:gi({},a),target:Rr.TEXTURE_CUBE_MAP}})];case 2:return r!==Mr.image?[3,4]:[4,qr(s)];case 3:return f=w.sent(),[2,gi({},e,{image:f,sourceType:Mr.image,sourceFrom:{type:r,url:s,target:Rr.TEXTURE_2D}})];case 4:return r!==Mr.video?[3,6]:[4,en(s)];case 5:return d=w.sent(),[2,gi({},e,{video:d,sourceType:Mr.video})];case 6:return r!==Mr.compressed?[3,14]:[4,Qr(s)];case 7:if(p=w.sent(),!(m=yn.getLoader("ktx2")))return[3,12];w.label=8;case 8:return w.trys.push([8,10,,11]),[4,m.loadFromBuffer(p)];case 9:return(v=w.sent()).sourceType===Mr.compressed?[2,gi({sourceType:v.sourceType,type:v.type,target:v.target,internalFormat:v.internalFormat,format:v.format,mipmaps:v.mipmaps,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR,sourceFrom:t},e)]:[3,11];case 10:throw y=w.sent(),new Error("Failed to parse KTX2 from "+(null!=(g=null==t?void 0:t.url)?g:"buffer")+": "+(y.message||y));case 11:return[3,13];case 12:throw new Error("KTX2 loader not found. Please register it first.");case 13:return[3,23];case 14:return r!==Mr.mipmaps?[3,23]:o?[4,Qr(o)]:[3,19];case 15:return x=w.sent(),b=null!=n?n:Rr.TEXTURE_2D,T=b===Rr.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==Rr.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(u.map((function(t){return i.loadMipmapImages(t,x)})))];case 16:return E=w.sent(),[3,18];case 17:E=i.loadMipmapImages(u,x),w.label=18;case 18:return[2,gi({},e,{mipmaps:E,target:b,sourceType:Mr.mipmaps,sourceFrom:{bin:o,mipmaps:T,target:b,type:Mr.mipmaps}})];case 19:return n!==Rr.TEXTURE_2D&&n?[3,21]:[4,Promise.all(h.map((function(t){return qr(t)})))];case 20:return _=w.sent(),[2,gi({},e,{mipmaps:_,target:Rr.TEXTURE_2D,sourceType:Mr.mipmaps,sourceFrom:{type:r,urls:h.slice(),target:Rr.TEXTURE_2D}})];case 21:return n!==Rr.TEXTURE_CUBE_MAP?[3,23]:[4,Promise.all(l.map((function(t){return i.loadCubeMap(t)})))];case 22:return S=w.sent(),[2,gi({},e,{mipmaps:S,target:Rr.TEXTURE_CUBE_MAP,sourceType:Mr.mipmaps,sourceFrom:{type:r,maps:l.map((function(t){return gi({},t)})),target:Rr.TEXTURE_CUBE_MAP}})];case 23:throw new Error("Invalid resource type: "+r+".")}}))}))()},e.loadMipmapImages=function(t,e){return T((function(){return w(this,(function(i){return[2,Promise.all(t.map((function(t){return qr(new n([new Uint8Array(e,t[0],t[1])]))})))]}))}))()},e.loadCubeMap=function(t){return T((function(){return w(this,(function(e){return[2,Promise.all(t.map((function(t){return qr(t)})))]}))}))()},t}();function xn(){return vn||(vn=new gn),vn}function bn(t){vn=t}var Tn=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 En(t){return"object"==typeof t&&t&&void 0===t.length&&E(t,cn)}function _n(t){return t&&void 0!==t.length&&En(t[0])}var wn,Sn=function(){function t(t,e,i,r,n,a,s,o,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===a&&(a=1),void 0===s&&(s=0),void 0===o&&(o=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,a,s,o,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,s,o,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]=a,v[6]=s,v[7]=o,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,a,s,o,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]=a,v[9]=s,v[13]=o,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),a=Math.sin(i),s=1-n,o=r.x,u=r.y,h=r.z,l=s*o,c=s*u;return this.set(l*o+n,l*u+a*h,l*h-a*u,0,l*u-a*h,c*u+n,c*h+a*o,0,l*h+a*u,c*h-a*o,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(X.ZERO,t,X.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,s=t.tempVec2;s.subtractVectors(e,i),s.normalize(),n.crossVectors(r,s),n.normalize(),a.crossVectors(s,n);var o=this.elements;return o[0]=n.x,o[1]=a.x,o[2]=s.x,o[3]=0,o[4]=n.y,o[5]=a.y,o[6]=s.y,o[7]=0,o[8]=n.z,o[9]=a.z,o[10]=s.z,o[11]=0,o[12]=-n.dot(e),o[13]=-a.dot(e),o[14]=-s.dot(e),o[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"==typeof t){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,a=i[0],s=i[4],o=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],_=r[8],w=r[12],S=r[1],C=r[5],A=r[9],M=r[13],I=r[2],R=r[6],O=r[10],P=r[14],N=r[3],L=r[7],F=r[11],V=r[15];return n[0]=a*T+s*S+o*I+u*N,n[4]=a*E+s*C+o*R+u*L,n[8]=a*_+s*A+o*O+u*F,n[12]=a*w+s*M+o*P+u*V,n[1]=h*T+l*S+c*I+f*N,n[5]=h*E+l*C+c*R+f*L,n[9]=h*_+l*A+c*O+f*F,n[13]=h*w+l*M+c*P+f*V,n[2]=d*T+p*S+m*I+v*N,n[6]=d*E+p*C+m*R+v*L,n[10]=d*_+p*A+m*O+v*F,n[14]=d*w+p*M+m*P+v*V,n[3]=y*T+g*S+x*I+b*N,n[7]=y*E+g*C+x*R+b*L,n[11]=y*_+g*A+x*O+b*F,n[15]=y*w+g*M+x*P+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],a=t[1],s=t[5],o=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*o*l-r*u*l-n*s*c+i*u*c+r*s*f-i*o*f)+t[7]*(+e*o*f-e*u*c+n*a*c-r*a*f+r*u*h-n*o*h)+t[11]*(+e*u*l-e*s*f-n*a*l+i*a*f+n*s*h-i*u*h)+t[15]*(-r*s*h-e*o*l+e*s*c+r*a*l-i*a*c+i*o*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],s=t[5],o=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*o*f-s*m*f-l*o*v+s*c*v,g=d*c*u-h*m*u-d*o*f+a*m*f+h*o*v-a*c*v,x=h*p*u-d*l*u+d*s*f-a*p*f-h*s*v+a*l*v,b=d*l*o-h*p*o-d*s*c+a*p*c+h*s*m-a*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*o*n+p*r*u-i*m*u-s*r*v+i*o*v)*E,t[3]=(l*o*n-s*c*n-l*r*u+i*c*u+s*r*f-i*o*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*o*n-a*m*n-d*r*u+e*m*u+a*r*v-e*o*v)*E,t[7]=(a*c*n-h*o*n+h*r*u-e*c*u-a*r*f+e*o*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]=(a*p*n-d*s*n+d*i*u-e*p*u-a*i*v+e*s*v)*E,t[11]=(h*s*n-a*l*n-h*i*u+e*l*u+a*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-a*p*r-d*i*o+e*p*o+a*i*m-e*s*m)*E,t[15]=(a*l*r-h*s*r+h*i*o-e*l*o-a*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=X.ZERO);var n=this.elements,a=e.x,s=e.y,o=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=a+a,d=s+s,p=o+o,m=a*f,v=a*d,y=a*p,g=s*d,x=s*p,b=o*p,T=u*f,E=u*d,_=u*p,w=i.x,S=i.y,C=i.z;return n[0]=(1-(g+b))*w,n[1]=(v+_)*w,n[2]=(y-E)*w,n[3]=0,n[4]=(v-_)*S,n[5]=(1-(m+b))*S,n[6]=(x+T)*S,n[7]=0,n[8]=(y+E)*C,n[9]=(x-T)*C,n[10]=(1-(m+g))*C,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,a=this.elements,s=n.set(a[0],a[1],a[2]).length(),o=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();this.determinant()<0&&(s=-s),e.x=a[12],e.y=a[13],e.z=a[14];var h=t.tempMat0;h.copyFrom(this);var l=1/s,c=1/o,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=o,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new X,e=new _i,i=new X;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var s=1/(e-t),o=1/(i-r),u=1/(a-n),h=-(e+t)*s,l=-(i+r)*o,c=-(a+n)*u;s*=2,o*=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]=o,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 a=1/Math.tan(.5*t),s=1/(i-r),o=this.elements;return o[0]=n?a:a/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n?a*e:a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(r+i)*s,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*r*i*s,o[15]=0,null!==r&&r!==1/0||(o[10]=-1,o[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;s.x=a[0]*i+a[4]*r+a[8]*n+a[12],s.y=a[1]*i+a[5]*r+a[9]*n+a[13],s.z=a[2]*i+a[6]*r+a[10]*n+a[14];var o=a[3]*i+a[7]*r+a[11]*n+a[15];return s.multiply(1/o)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n+a[12],s.y=a[1]*i+a[5]*r+a[9]*n+a[13],s.z=a[2]*i+a[6]*r+a[10]*n+a[14],s},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n,s.y=a[1]*i+a[5]*r+a[9]*n,s.z=a[2]*i+a[6]*r+a[10]*n,s.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,s=this.elements,o=null!=e?e:t;return o.x=s[0]*i+s[4]*r+s[8]*n+s[12]*a,o.y=s[1]*i+s[5]*r+s[9]*n+s[13]*a,o.z=s[2]*i+s[6]*r+s[10]*n+s[14]*a,o.w=s[3]*i+s[7]*r+s[11]*n+s[15]*a,o},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!B(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return(new t).lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,a){return(new t).perspective(e,i,r,n,a)},t.fromColumnVectors=function(e,i,r,n){return(new t).setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromScale=function(e,i,r){return(new t).setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return(new t).setFromTranslation(e,i,r)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return(new t).setFromRotationAxis(e,i)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,i,r){return(new t).setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return(new t).setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,a,s,o,u,h,l,c,f,d,p,m,v){return new t(e,a,h,d,i,s,l,p,r,o,c,m,n,u,f,v)},t}();Sn.IDENTITY=new Sn(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),Sn.ZERO=new Sn(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Sn.tempVec0=new X,Sn.tempVec1=new X,Sn.tempVec2=new X,Sn.tempMat0=new Sn,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"}(wn||(wn={}));var Cn=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],a=i[8],s=i[1],o=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case wn.XYZ:this.y=Math.asin(G(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,o),this.z=0);break;case wn.YXZ:this.x=Math.asin(-G(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(a,c),this.z=Math.atan2(s,o)):(this.y=Math.atan2(-h,r),this.z=0);break;case wn.ZXY:this.x=Math.asin(G(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,o)):(this.y=0,this.z=Math.atan2(s,r));break;case wn.ZYX:this.y=Math.asin(-G(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,o));break;case wn.YZX:this.z=Math.asin(G(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,o),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case wn.XZY:this.z=Math.asin(-G(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(l,o),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=D,this.y*=D,this.z*=D,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,a,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!=(a=t[e+2])?a: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 _i;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,a=e.order,s=Math.cos(i*k*.5),o=Math.cos(r*k*.5),u=Math.cos(n*k*.5),h=Math.sin(i*k*.5),l=Math.sin(r*k*.5),c=Math.sin(n*k*.5);switch(a){case wn.XYZ:t.set(h*o*u+s*l*c,s*l*u-h*o*c,s*o*c+h*l*u,s*o*u-h*l*c);break;case wn.YXZ:t.set(h*o*u+s*l*c,s*l*u-h*o*c,s*o*c-h*l*u,s*o*u+h*l*c);break;case wn.ZXY:t.set(h*o*u-s*l*c,s*l*u+h*o*c,s*o*c+h*l*u,s*o*u-h*l*c);break;case wn.ZYX:t.set(h*o*u-s*l*c,s*l*u+h*o*c,s*o*c-h*l*u,s*o*u+h*l*c);break;case wn.YZX:t.set(h*o*u+s*l*c,s*l*u+h*o*c,s*o*c-h*l*u,s*o*u-h*l*c);break;case wn.XZY:t.set(h*o*u-s*l*c,s*l*u-h*o*c,s*o*c+h*l*u,s*o*u+h*l*c);break;default:console.error("unknown euler order: "+a)}return t},e.toMatrix4=function(t){var e=t.elements,i=this,r=i.x,n=i.y,a=i.z,s=i.order,o=Math.cos(r*k),u=Math.sin(r*k),h=Math.cos(n*k),l=Math.sin(n*k),c=Math.cos(a*k),f=Math.sin(a*k);if(s===wn.XYZ){var d=o*c,p=o*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]=o*h}else if(s===wn.YXZ){var y=h*c,g=h*f,x=l*c,b=l*f;e[0]=y+b*u,e[4]=x*u-g,e[8]=o*l,e[1]=o*f,e[5]=o*c,e[9]=-u,e[2]=g*u-x,e[6]=b+y*u,e[10]=o*h}else if(s===wn.ZXY){var T=h*c,E=h*f,_=l*c,w=l*f;e[0]=T-w*u,e[4]=-o*f,e[8]=_+E*u,e[1]=E+_*u,e[5]=o*c,e[9]=w-T*u,e[2]=-o*l,e[6]=u,e[10]=o*h}else if(s===wn.ZYX){var S=o*c,C=o*f,A=u*c,M=u*f;e[0]=h*c,e[4]=A*l-C,e[8]=S*l+M,e[1]=h*f,e[5]=M*l+S,e[9]=C*l-A,e[2]=-l,e[6]=u*h,e[10]=o*h}else if(s===wn.YZX){var I=o*h,R=o*l,O=u*h,P=u*l;e[0]=h*c,e[4]=P-I*f,e[8]=O*f+R,e[1]=f,e[5]=o*c,e[9]=-u*c,e[2]=-l*c,e[6]=R*f+O,e[10]=I-P*f}else if(s===wn.XZY){var N=o*h,L=o*l,F=u*h,V=u*l;e[0]=h*c,e[4]=-f,e[8]=l*c,e[1]=N*f+V,e[5]=o*c,e[9]=L*f-F,e[2]=F*f-L,e[6]=u*c,e[10]=V*f+N}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}();Cn.DEFAULT_ORDER=wn.ZYX,Cn.tempQuat0=new _i,Cn.tempMat0=new Sn;var An=function(){function t(t,e,i,r,n,a,s,o,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,s,o,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,s,o,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=s,h[1]=e,h[4]=n,h[7]=o,h[2]=i,h[5]=a,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,s,o,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=a,h[2]=s,h[5]=o,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,a=e+e,s=i+i,o=r+r,u=e*a,h=e*s,l=e*o,c=i*s,f=i*o,d=r*o,p=n*a,m=n*s,v=n*o,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],a=r[3],s=r[6],o=r[1],u=r[4],h=r[7];return r[0]=e*n+i*o,r[3]=e*a+i*u,r[6]=e*s+i*h,r[1]=-i*n+e*o,r[4]=-i*a+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,a=i[0],s=i[3],o=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]=a*p+s*y+o*b,n[3]=a*m+s*g+o*T,n[6]=a*v+s*x+o*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],a=t[4],s=t[7],o=t[2],u=t[5],h=t[8];return e*(a*h-u*s)+n*(u*r-i*h)+o*(i*s-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],s=t[7],o=t[2],u=t[5],h=t[8],l=h*a-u*s,c=u*r-h*i,f=s*i-a*r,d=e*l+n*c+o*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(o*s-h*n)*p,t[2]=(u*n-o*a)*p,t[3]=c*p,t[4]=(h*e-o*r)*p,t[5]=(o*i-u*e)*p,t[6]=f*p,t[7]=(n*r-s*e)*p,t[8]=(a*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[3]*r+a[6]*n,s.y=a[1]*i+a[4]*r+a[7]*n,s.z=a[2]*i+a[5]*r+a[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(!B(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return(new t).setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,a,s,o,u,h){return new t(e,n,o,i,a,u,r,s,h)},t}(),Mn=function(){function t(t,e){void 0===t&&(t=X.ZERO),void 0===e&&(e=X.X),this.origin=new X,this.direction=new X,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 X;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,s,o,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,_=b.z,w=1/d,S=1/p,C=1/m;if(w>=0?(i=(y-h)*w,r=(T-h)*w):(i=(T-h)*w,r=(y-h)*w),S>=0?(n=(g-l)*S,a=(E-l)*S):(n=(E-l)*S,a=(g-l)*S),!(i>a||n>r||((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),C>=0?(s=(x-c)*C,o=(_-c)*C):(s=(_-c)*C,o=(x-c)*C),i>o||s>r||((s>i||i!=i)&&(i=s),(o<r||r!=r)&&(r=o),r<0))))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new X).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),s=n.dot(n)-a*a,o=e.radius*e.radius;if(!(s>o)){var u=Math.sqrt(o-s),h=a-u,l=a+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,s=e.p1,o=e.p2,u=t.tempVec0.subtractVectors(s,a),h=t.tempVec1.subtractVectors(o,a),l=t.tempVec2.subtractVectors(this.origin,a),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}();Mn.tempVec0=new X,Mn.tempVec1=new X,Mn.tempVec2=new X,Mn.tempVec3=new X;var In,Rn,On=function(){function t(t,e){void 0===t&&(t=new X(1/0,1/0,1/0)),void 0===e&&(e=new X(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,a=-1/0,s=-1/0,o=0,u=t.length;o<u;o+=3){var h=t[o],l=t[o+1],c=t[o+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>a&&(a=l),c>s&&(s=c)}return this.min.set(e,i,r),this.max.set(n,a,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 X),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 X),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,a=0,s=n.length;a<s;a++)this.expandByObject(n[a]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new X),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 X;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 X),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 X),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 X),this.isEmpty())return[];var i=[];return i[0]=new X(this.min.x,this.min.y,this.min.z),i[1]=new X(this.min.x,this.min.y,this.max.z),i[2]=new X(this.min.x,this.max.y,this.min.z),i[3]=new X(this.min.x,this.max.y,this.max.z),i[4]=new X(this.max.x,this.min.y,this.min.z),i[5]=new X(this.max.x,this.min.y,this.max.z),i[6]=new X(this.max.x,this.max.y,this.min.z),i[7]=new X(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 X;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}(),Pn=function(){function t(t,e){void 0===t&&(t=X.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var a=(new On).setFromPoints(t);a.getCenter(i),this.radius=a.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new X),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 On),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],a=Math.sqrt(Math.max(i,r,n));return this.center.applyMatrix(t),this.radius=this.radius*a,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new X).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 X,i=new X;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 X).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 wn},Euler:Cn,Quaternion:_i,Vector2:j,Vector3:X,Vector4:W,Matrix3:An,Matrix4:Sn,Ray:Mn,PI2:V,DEG2RAD:k,RAD2DEG:D,NumberEpsilon:z,isZero:function(t){return isNaN(t)||Math.abs(t)<z},isEqual:B,damp:function(t,e,i,r){return U(t,e,1-Math.exp(-i*r))},lerp:U,degToRad:function(t){return t*k},radToDeg:function(t){return t*D},clamp:G,Color:H,Box3:On,Sphere:Pn});!function(t){t[t.noShader=0]="noShader",t[t.success=1]="success",t[t.fail=2]="fail",t[t.compiling=3]="compiling"}(In||(In={})),function(t){t.GLSL1="100",t.GLSL3="300 es"}(Rn||(Rn={}));var Ln=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return oe(e,t),e.prototype.initialize=function(){},e}(ii),Fn=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=Ze(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(ii);Fn=_([$e(ze.Shader)],Fn);var Vn,kn=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=[Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA,Rr.ONE,Rr.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[Rr.FUNC_ADD,Rr.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=Rr.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=[Rr.ALWAYS,Rr.ALWAYS],this.stencilOpFail=[Rr.KEEP,Rr.KEEP],this.stencilOpZFail=[Rr.KEEP,Rr.KEEP],this.stencilOpZPass=[Rr.KEEP,Rr.KEEP],this.culling=!1,this.frontFace=Rr.CCW,this.cullFace=Rr.FRONT},e.apply=function(t){if(t.setSampleAlphaToCoverage(this.sampleAlphaToCoverage),t.setBlending(this.blending),t.setDepthTest(this.depthTest),t.setStencilTest(this.stencilTest),t.setCulling(this.culling),t.setPolygonOffsetFill(this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(Rr.BACK,this.stencilMask[1]),t.stencilMaskSeparate(Rr.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(Rr.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(Rr.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(Rr.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(Rr.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}();!function(t){t[t.normal=0]="normal",t[t.transformFeedback=1]="transformFeedback"}(Vn||(Vn={}));var Dn=1,zn=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,r.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.materialState=new kn,i){var n=i.name,a=void 0===n?"Material"+Dn++:n,s=i.renderType,o=void 0===s?0:s,u=i.shader;r.name=a,r.renderType=o,r.shaderSource=u,r.props=i,r._shader=new Fn(e),r._shader.shaderData=gi({},i.shader,{id:Ft(),dataType:ze.Shader})}else r.name="Material"+Dn++,r.renderType=0;return r}oe(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];Mt(i.initialize)?i.initialize():wt.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.materialState.apply(t)},i.use=function(t,e){var i,r=t.engine,n=this.shaderVariant;if(n.bind(),this.setupStates(r),e){for(var a,s=Ze(e.uniforms);!(a=s()).done;)i=a.value,this.checkUniform(i);for(var o,u=Ze(e.samplers);!(o=u()).done;)i=o.value,this.samplers.includes(i)||(this.samplers.push(i),this.uniformDirty=!0)}if(this.uniformDirty&&(n.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(i in e.floats)n.setFloat(i,e.floats[i]);for(i in e.ints)n.setInt(i,e.ints[i]);for(i in e.vector4s)n.setVector4(i,e.vector4s[i]);for(i in e.vector3s)n.setVector3(i,e.vector3s[i]);for(i in e.matrices)n.setMatrix(i,e.matrices[i])}for(i in this.textures)this.textures[i].initialize();for(i in this.floats)n.setFloat(i,this.floats[i]);for(i in this.ints)n.setInt(i,this.ints[i]);for(i in this.floatArrays)n.setFloats(i,this.floatArrays[i]);for(i in this.textures)n.setTexture(i,this.textures[i]);for(i in this.vector2s)n.setVector2(i,this.vector2s[i]);for(i in this.vector3s)n.setVector3(i,this.vector3s[i]);for(i in this.vector4s)n.setVector4(i,this.vector4s[i]);for(i in this.colors)n.setColor(i,this.colors[i]);for(i in this.quaternions)n.setQuaternion(i,this.quaternions[i]);for(i in this.matrices)n.setMatrix(i,this.matrices[i]);for(i in this.matrice3s)n.setMatrix3(i,this.matrice3s[i]);for(i in this.vector4Arrays)n.setVector4Array(i,this.vector4Arrays[i]);for(i in this.matrixArrays)n.setMatrixArray(i,this.matrixArrays[i])},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=Ze(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=Ze(e);!(i=r()).done;)for(var n=i.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},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;mt(r);var n=e.create(r,i);return n.materialState=Object.assign(new kn,n.materialState),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.cloneUniforms=function(t){var e;for(e in t.floats)this.setFloat(e,t.floats[e]);for(e in t.ints)this.setInt(e,t.ints[e]);for(e in t.floatArrays)this.setFloats(e,t.floatArrays[e]);for(e in t.textures)this.setTexture(e,t.textures[e]);for(e in t.vector2s)this.setVector2(e,t.vector2s[e]);for(e in t.vector3s)this.setVector3(e,t.vector3s[e]);for(e in t.vector4s)this.setVector4(e,t.vector4s[e]);for(e in t.colors)this.setColor(e,t.colors[e]);for(e in t.quaternions)this.setQuaternion(e,t.quaternions[e]);for(e in t.matrices)this.setMatrix(e,t.matrices[e]);for(e in t.vector4Arrays){for(var i=[],r=0;r<t.vector4Arrays[e].length;r+=4)i.push(new W(t.vector4Arrays[e][r],t.vector4Arrays[e][r+1],t.vector4Arrays[e][r+2],t.vector4Arrays[e][r+3]));this.setVector4Array(e,i)}for(e in t.matrixArrays){for(var n=[],a=0;a<t.matrixArrays[e].length;a+=16){for(var s=Sn.fromIdentity(),o=0;o<16;o++)s.elements[o]=t.matrixArrays[e][a+o];n.push(s)}this.setMatrixArray(e,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=gi({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===re.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,a=e.stringTags.RenderFace;for(r in a===ne.Front?(this.culling=!0,this.cullFace=Rr.BACK):a===ne.Back?(this.culling=!0,this.cullFace=Rr.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 W(s.x,s.y,s.z,s.w))}for(r in i.colors){var o=i.colors[r];this.setColor(r,new H(o.r,o.g,o.b,o.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 W(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.definition;for(var e in this._shader&&(t.shader=this._shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=ze.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 a in this.textures){t.textures[a]||(t.textures[a]={texture:this.textures[a]});var s=t.textures[a],o=this.getVector4(a+"_ST");o&&(s.scale={x:o.x,y:o.y},s.offset={x:o.z,y:o.w},delete t.vector4s[a+"_ST"])}return t},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=Lt,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this),t.prototype.dispose.call(this))},xr(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",get:function(){return this.materialState.blending},set:function(t){void 0!==t&&this.materialState.setBlending(t)}},{key:"blendColor",get:function(){return this.materialState.blendColor},set:function(t){t&&this.materialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.materialState.blendFunctionParameters},set:function(t){t&&this.materialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.materialState.blendEquationParameters},set:function(t){t&&this.materialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.materialState.depthTest},set:function(t){void 0!==t&&this.materialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.materialState.depthMask},set:function(t){void 0!==t&&this.materialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.materialState.depthRange},set:function(t){t&&this.materialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.materialState.depthFunc},set:function(t){void 0!==t&&this.materialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.materialState.polygonOffsetFill},set:function(t){void 0!==t&&this.materialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.materialState.polygonOffset},set:function(t){t&&this.materialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.materialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.materialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.materialState.colorMask[0]},set:function(t){this.materialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.materialState.stencilTest},set:function(t){void 0!==t&&this.materialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.materialState.stencilMask},set:function(t){t&&this.materialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.materialState.stencilRef},set:function(t){t&&this.materialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.materialState.stencilFunc},set:function(t){t&&this.materialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.materialState.stencilOpFail},set:function(t){t&&this.materialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.materialState.stencilOpZFail},set:function(t){t&&this.materialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.materialState.stencilOpZPass},set:function(t){t&&this.materialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.materialState.culling},set:function(t){void 0!==t&&this.materialState.setCulling(t)}},{key:"frontFace",get:function(){return this.materialState.frontFace},set:function(t){void 0!==t&&this.materialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.materialState.cullFace},set:function(t){void 0!==t&&this.materialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(ii);zn.create=function(t,e){return new zn(t,e)};var Bn,Un=function(){function t(){this.alphaMaskEnabled=!1,this.isMask=!1,this.inverted=!1,this.maskMode=Er.NONE,this.maskReferences=[],this.expectedStencilValue=0,this.prevStencilFunc=[0,0],this.prevStencilOpZPass=[0,0],this.prevStencilRef=[0,0],this.prevStencilMask=[0,0],this.stencilClearAction={stencilAction:Ar.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.setMaskOptions=function(t,e){var i=e.isMask,r=void 0!==i&&i,n=e.inverted,a=void 0!==n&&n,s=e.reference,o=e.alphaMaskEnabled,u=void 0!==o&&o;if(this.alphaMaskEnabled=u,this.isMask=r,this.inverted=a,this.maskReferences=[],r)this.maskMode=Er.MASK;else{this.maskMode=a?Er.REVERSE_OBSCURED:Er.OBSCURED;var h=t.findObject(s);h&&this.maskReferences.push({maskable:h,inverted:a})}},e.addMaskReference=function(t,e){if(void 0===e&&(e=!1),!this.maskReferences.some((function(e){return e.maskable===t}))){if(this.maskReferences.length>=255)return void console.warn("Maximum of 255 mask references exceeded. Additional masks will be ignored.");this.maskReferences.push({maskable:t,inverted:e})}},e.removeMaskReference=function(t){var e=this.maskReferences.findIndex((function(e){return e.maskable===t}));-1!==e&&this.maskReferences.splice(e,1)},e.clearMaskReferences=function(){this.maskReferences=[]},e.drawStencilMask=function(t,e){for(var i,r=e.frameClipMasks,n=Ze(r);!(i=n()).done;){var a=i.value;this.addMaskReference(a,!1)}if(this.maskReferences.length>0){t.clear(this.stencilClearAction);for(var s,o=[],u=[],h=Ze(this.maskReferences);!(s=h()).done;){var l=s.value;l.inverted?u.push(l):o.push(l)}for(var c=0;c<o.length;c++)o[c].maskable.drawStencilMask(c);for(var f,d=o.length,p=Ze(u);!(f=p()).done;){f.value.maskable.drawStencilMask(d)}this.expectedStencilValue=d}for(var m,v=Ze(e.materials);!(m=v()).done;){var y=m.value;this.setupMaskedMaterial(y)}for(var g,x=Ze(r);!(g=x()).done;){var b=g.value;this.removeMaskReference(b)}},e.drawGeometryMask=function(t,e,i,r,n,a){void 0===a&&(a=0);var s=r.colorMask,o=r.stencilTest;this.copyStencilArrayValue(this.prevStencilFunc,r.stencilFunc),this.copyStencilArrayValue(this.prevStencilOpZPass,r.stencilOpZPass),this.copyStencilArrayValue(this.prevStencilRef,r.stencilRef),this.copyStencilArrayValue(this.prevStencilMask,r.stencilMask),this.setupMaskMaterial(r,n),t.drawGeometry(e,i,r,a),r.colorMask=s,r.stencilTest=o,r.stencilFunc=this.prevStencilFunc,r.stencilOpZPass=this.prevStencilOpZPass,r.stencilRef=this.prevStencilRef,r.stencilMask=this.prevStencilMask},e.setupMaskMaterial=function(t,e){t.stencilTest=!0,t.stencilFunc=[Rr.EQUAL,Rr.EQUAL],t.stencilRef=[e,e],t.stencilMask=[255,255],t.stencilOpZPass=[Rr.INCR,Rr.INCR],t.colorMask=!1},e.setupMaskedMaterial=function(t){this.maskReferences.length>0?(t.stencilTest=!0,t.stencilRef=[this.expectedStencilValue,this.expectedStencilValue],t.stencilMask=[255,255],t.stencilFunc=[Rr.EQUAL,Rr.EQUAL],t.stencilOpZPass=[Rr.KEEP,Rr.KEEP]):t.stencilTest=!1},e.copyStencilArrayValue=function(t,e){e&&(t[0]=e[0],t[1]=e[1])},xr(t,[{key:"maskable",get:function(){return this.maskReferences.length>0?this.maskReferences[0].maskable:null},set:function(t){this.maskReferences=[],t&&this.maskReferences.push({maskable:t,inverted:this.maskMode===Er.REVERSE_OBSCURED})}}]),t}();!function(t){t[t.triangle=1]="triangle",t[t.box=2]="box",t[t.sphere=3]="sphere",t[t.custom=4]="custom"}(Bn||(Bn={}));var Gn=function(){this.position=new j,this.delta=new j,this.pointerCurrentRaycast=new jn},jn=function(){this.point=null,this.item=null},Xn=function(){function t(t,e,i){this.vectors=[],this.vectorsWorld=[],this.directions=[];for(var r=0;r<8;r++)this.vectors.push(new X),this.vectorsWorld.push(new X);for(var n=0;n<3;n++)this.directions.push(new X);this.minimum=new X,this.maximum=new X,this.minimumWorld=new X,this.maximumWorld=new X,this.center=new X,this.centerWorld=new X,this.extendSize=new X,this.extendSizeWorld=new X,this.worldMatrix=i||Sn.fromIdentity(),this.reConstruct(t,e,i)}var e=t.prototype;return e.reConstruct=function(e,i,r){var n=e.x,a=e.y,s=e.z,o=i.x,u=i.y,h=i.z;this.minimum.set(n,a,s),this.maximum.set(o,u,h),this.vectors[0].set(n,a,s),this.vectors[1].set(o,u,h),this.vectors[2].set(o,a,s),this.vectors[3].set(n,u,s),this.vectors[4].set(n,a,h),this.vectors[5].set(o,u,s),this.vectors[6].set(n,u,h),this.vectors[7].set(o,a,h);var l=t.tempVector0,c=t.tempVector1;l.copyFrom(i).add(e),this.center.copyFrom(l).scale(.5),c.copyFrom(i).subtract(e),this.extendSize.copyFrom(c).scale(.5),this.worldMatrix=r||Sn.fromIdentity(),this.update(this.worldMatrix)},e.update=function(e){var i=this.minimumWorld,r=this.maximumWorld,n=this.vectorsWorld,a=this.vectors;if(e.isIdentity()){i.copyFrom(this.minimum),r.copyFrom(this.maximum);for(var s=0;s<8;s++)n[s].copyFrom(a[s]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{i.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(var o=0;o<8;o++){e.transformPoint(a[o],n[o]);var u=n[o];i.x=Math.min(i.x,u.x),i.y=Math.min(i.y,u.y),i.z=Math.min(i.z,u.z),r.x=Math.max(r.x,u.x),r.y=Math.max(r.y,u.y),r.z=Math.max(r.z,u.z)}var h=t.tempVector0,l=t.tempVector1;h.copyFrom(r).subtract(i),this.extendSizeWorld.copyFrom(h).scale(.5),l.copyFrom(r).add(i),this.centerWorld.copyFrom(l).scale(.5)}var c=e.elements;this.directions[0].set(c[0],c[1],c[2]),this.directions[1].set(c[4],c[5],c[6]),this.directions[2].set(c[8],c[9],c[10]),this.worldMatrix=e},e.scale=function(e){var i=t.tempVector0;i.copyFrom(this.maximum).subtract(this.minimum);var r=i.length();i.scale(1/r);var n=r*e;i.scale(.5*n);var a=t.tempVector1,s=t.tempVector2;return a.copyFrom(this.center).subtract(i),s.copyFrom(this.center).add(i),this.reConstruct(a,s,this.worldMatrix),this},e.getWorldMatrix=function(){return this.worldMatrix},e.intersectsPoint=function(t){var e=this.minimumWorld,i=this.maximumWorld,r=-1e-6;return!(i.x-t.x<r||r>t.x-e.x)&&(!(i.y-t.y<r||r>t.y-e.y)&&!(i.z-t.z<r||r>t.z-e.z))},e.intersectsBox=function(t){return this.intersectsMinMax(t.minimumWorld,t.maximumWorld)},e.intersectsMinMax=function(t,e){var i=this.minimumWorld,r=this.maximumWorld;return!(r.x<t.x||i.x>e.x)&&(!(r.y<t.y||i.y>e.y)&&!(r.z<t.z||i.z>e.z))},t.intersects=function(t,e){return t.intersectsMinMax(e.minimumWorld,e.maximumWorld)},t}();Xn.tempVector0=new X,Xn.tempVector1=new X,Xn.tempVector2=new X;var Wn=function(){function t(){this.boundingBox=new Xn(new X,new X),this.triangles=[],this.worldMatrix=new Sn,this.assemblyTriangles=function(t,e,i,r,n){for(var a=i;a<r;a+=3){var s=3*e[a],o=3*e[a+1],u=3*e[a+2],h={x:t[s],y:t[s+1],z:t[s+2]},l={x:t[o],y:t[o+1],z:t[o+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.reConstruct=function(t,e,i){this.boundingBox.reConstruct(t,e,i)},e.getRawBoundingBoxTriangle=function(){return this.applyWorldMatrix(this.boundingBoxTriangle.area),this.boundingBoxTriangle},e.getBoundingBoxTriangle=function(t){for(var e,i=-Number.MAX_VALUE,r=-Number.MAX_VALUE,n=Number.MAX_VALUE,a=Number.MAX_VALUE,s=Ze(this.boundingBoxTriangle.area);!(e=s()).done;){var o=e.value;i=Math.max(o.p0.x,o.p1.x,o.p2.x,i),r=Math.max(o.p0.y,o.p1.y,o.p2.y,r),n=Math.min(o.p0.x,o.p1.x,o.p2.x,n),a=Math.min(o.p0.y,o.p1.y,o.p2.y,a)}var u=[],h=new X(n,r,0),l=new X(i,r,0),c=new X(i,a,0),f=new X(n,a,0);return u.push({p0:h,p1:l,p2:c}),u.push({p0:h,p1:c,p2:f}),this.applyWorldMatrix(u),{type:Bn.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var i,r=[],n=Ze(this.triangles);!(i=n()).done;){var a=i.value;r.push({p0:a.p0,p1:a.p1,p2:a.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxTriangle={type:Bn.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,a=Ze(t.subMeshes);!(n=a()).done;){var s=n.value;if(void 0!==s.indexCount){var o=e.BYTES_PER_ELEMENT,u=s.offset/o,h=u+s.indexCount;this.assemblyTriangles(i,e,u,h,r)}}return r},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new X),t.p1=e.worldMatrix.transformPoint(t.p1,new X),t.p2=e.worldMatrix.transformPoint(t.p2,new X)})),t},t}(),Hn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e.frameClipMasks=[],e.maskManager=new Un,e._priority=0,e.boundingBoxInfo=new Wn,e}oe(e,t);var i=e.prototype;return 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)},i.onParentChanged=function(){this.frameClipMasks=[]},i.getBoundingBoxInfo=function(){return this.boundingBoxInfo},i.render=function(t){},xr(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}(br);_([ti()],Hn.prototype,"materials",void 0),_([ti()],Hn.prototype,"_priority",void 0);var Yn,Zn=6,qn="PRE_COLOR_0",Kn="PRE_COLOR_SIZE_0",Qn="PRE_MAIN_COLOR_0",Jn="PRE_MAIN_COLOR_SIZE_0",$n="editor",ta={"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","Container size overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY","Container is not an HTMLElement":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Invalid container size":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW","DPI overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT"},ea=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 a;null==(a=e.listeners[t])||a.forEach((function(i){var n=i.listener,a=i.options;n.apply(void 0,[].concat(r)),(null==a?void 0:a.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})))||[]}},ia=new _i,ra=new X,na=new X,aa=1,sa=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new X(0,0,0),this.quat=new _i(0,0,0,1),this.rotation=new Cn(0,0,0),this.scale=new X(1,1,1),this.anchor=new X(0,0,0),this.size=new j(1,1),this.children=[],this.worldMatrix=Sn.fromIdentity(),this.localMatrix=Sn.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new X(0,0,0),quat:new _i(0,0,0,1),scale:new X(1,1,1)},this.name="transform_"+aa++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){this.position.x===t&&this.position.y===e&&this.position.z===i||(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){0===t&&0===e&&0===i||(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===i||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){this.quat.x===t&&this.quat.y===e&&this.quat.z===i&&this.quat.w===r||(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){this.scale.x===t&&this.scale.y===e&&this.scale.z===i||(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,a=t.size,s=t.quat,o=t.name,u=t.anchor;if(o&&(this.name=o),i&&(E(i,X)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),s)E(s,_i)?this.setQuaternion(s.x,s.y,s.z,s.w):this.setQuaternion(s[0],s[1],s[2],s[3]);else if(r){var h=e?-1:1;E(r,Cn)?this.setRotation(r.x*h,r.y*h,r.z*h):this.setRotation(r[0]*h,r[1]*h,r[2]*h)}n&&(E(n,X)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(E(u,j)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){P(this.children,t)},e.removeChild=function(t){N(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Cn)},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.setWorldPosition=function(t,e,i){var r=this.getParentMatrix();r?(ra.set(0,0,0),ia.set(0,0,0,1),na.set(1,1,1),r.decompose(ra,ia,na),ra.set(t-ra.x,e-ra.y,i-ra.z),ia.invert(),ra.applyQuaternion(ia),ra.x=0!==na.x?ra.x/na.x:0,ra.y=0!==na.y?ra.y/na.y:0,ra.z=0!==na.z?ra.z/na.z:0,this.setPosition(ra.x,ra.y,ra.z)):this.setPosition(t,e,i)},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Cn)},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 X).copyFrom(t.position),t.quat?e.quat=new _i(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new Cn(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=(new X).copyFrom(t.scale),t.size&&(e.size=(new j).copyFrom(t.size)),t.anchor&&(e.anchor=(new j).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=ia.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},xr(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}(),oa=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).children=[],r.transform=new sa,r.time=-1,r.duration=0,r.endBehavior=ce.forward,r.type=te.base,r.components=[],r.isDuringPlay=!1,r.isManuallySetRenderOrder=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new ea,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=e,i&&r.fromData(i),r}oe(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=Ze(this.components);!(i=r()).done;){var n=i.value;if(E(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,i=[],r=Ze(this.components);!(e=r()).done;){var n=e.value;E(n,t)&&i.push(n)}return i},i.getDescendants=function(t,e){var i=[];return this.getDescendantsInternal(i,t,e),i},i.setParent=function(t){(t!==this||t)&&(this.parent&&N(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.onParentChanged(),!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=Ze(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 sa({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 Cn(t,e,i),n=_i.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,i){this.transform.scaleBy(t,e,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.setWorldPosition=function(t,e,i){this.transform.setWorldPosition(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,a=r.y,s=this.composition.engine.canvas.getBoundingClientRect(),o=s.width,u=s.height;this.transform.setPosition((2*t/o-1)*n,(1-2*e/u)*a,i)}},i.translateByPixel=function(t,e){if(this.composition){var i=this.composition.engine.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,s=this.composition.camera.getInverseVPRatio(a),o=s.x,u=s.y;this.transform.translate(2*t*o/r,-2*e*u/n,0)}},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.hitTest=function(t,i,r,n,a,s,o){var u;if(!this.isActive)return!1;var h=!1,l=null==o?void 0:o.maxCount,c=this.getHitTestParams(s);if(c){var f=c.clipMasks,d=!0;if(f.length>0&&!function(t,e){for(var i,r=Ze(e);!(i=r()).done;){var n=i.value.item;if(n.isActive&&n.transform.getValid()){var a=n.transform,s=a.getWorldMatrix(),o=a.size.x,u=a.size.y,h=new X(-.5*o,.5*u,0).applyMatrix(s),l=new X(-.5*o,-.5*u,0).applyMatrix(s),c=new X(.5*o,.5*u,0).applyMatrix(s),f={p0:h,p1:l,p2:c},d={p0:c,p1:l,p2:new X(.5*o,-.5*u,0).applyMatrix(s)};if(!t.intersectTriangle(f)&&!t.intersectTriangle(d))return!1}}return!0}(t,f)&&(d=!1),d){var p=!1,m=new X;if(c.type===Bn.triangle){for(var v=c.triangles,y=c.backfaceCulling,g=0;g<v.length;g++)if(t.intersectTriangle(v[g],m,y)){p=!0,a.push(m);break}}else if(c.type===Bn.box){var x=c.center,b=c.size,T=x.clone().addScaledVector(b,.5),E=x.clone().addScaledVector(b,-.5);t.intersectBox({min:T,max:E},m)&&(p=!0,a.push(m))}else if(c.type===Bn.sphere){var _=c.center,w=c.radius;t.intersectSphere({center:_,radius:w},m)&&(p=!0,a.push(m))}else if(c.type===Bn.custom){var S=c.collect(t,new j(i,r));S&&S.length>0&&(S.forEach((function(t){a.push(t)})),p=!0)}if(p){var C,A={id:this.getInstanceId(),name:this.name,position:a[a.length-1],parentId:this.parentId,hitPositions:a,behavior:c.behavior,item:this,composition:this.composition};if(n.push(A),h=!0,null==o||null==(C=o.stop)?void 0:C.call(o,A))return!0}}}for(var M,I=Ze(this.children);!(M=I()).done;){var R,O=M.value;if(void 0!==l&&n.length>=l)break;(null==o||null==(R=o.skip)?void 0:R.call(o,O))||O.hitTest(t,i,r,n,a,s,o)&&(h=!0)}return e.isComposition(this)&&h&&this!==(null==(u=this.composition)?void 0:u.rootItem)&&n.push({id:this.getInstanceId(),name:this.name,position:a[a.length-1],parentId:this.parentId,hitPositions:a,behavior:$t.NONE,item:this,composition:this.composition}),h},i.getCurrentPosition=function(){var t=new X;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,a=i[r];if(r++,a.name===t)return a;(n=i).push.apply(n,[].concat(a.children))}},i.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.refreshGUIDRecursive();var e=this.engine.findObject({id:this.definition.id});return e.refreshGUIDRecursive(),this.refreshGUIDRecursive(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=Ze(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},i.awake=function(){for(var t,e=Ze(this.components);!(t=e()).done;){var i=t.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var r,n=Ze(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=Ze(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=Ze(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},i.onDisable=function(){this.isEnabled=!1;for(var t,e=Ze(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},i.onParentChanged=function(){for(var t,e=Ze(this.components);!(t=e()).done;){t.value.onParentChanged()}for(var i,r=Ze(this.children);!(i=r()).done;){i.value.onParentChanged()}},i.setRendererComponentOrder=function(t){for(var e,i=Ze(this.components);!(e=i()).done;){var r=e.value;E(r,Hn)&&(r.priority=t)}},i.fromData=function(i){t.prototype.fromData.call(this,i);var r,n=i.id,a=i.name,s=i.parentId,o=i.endBehavior,u=i.transform,h=i.duration,l=void 0===h?0:h,c=i.visible,f=void 0===c||c;if(this.type=i.type,this.props=i,this.id=n.toString(),this.parentId=s,this.components.length=0,e.isComposition(this)){var d=this.definition.content.options.refId,p=this.engine.findEffectsObjectData(d);if(!p)throw new Error("Referenced precomposition with Id: "+d+" does not exist.");this.instantiatePreComposition(p)}if(this.name=a,this.duration=l,this.endBehavior=o,u&&this.transform.fromData(u),this.transform.name=this.name,this.transform.engine=this.engine,i.content||(i.content={options:{}}),l<0)throw new Error("Item duration can't be less than 0, see "+ta["Item duration can't be less than 0"]+".");if(i.components)for(var m,v=Ze(i.components);!(m=v()).done;){var y=m.value,g=this.engine.findObject(y);this.components.push(g)}for(var x,b=Ze(null!=(r=i.children)?r:[]);!(x=b()).done;){var T=x.value;this.engine.findObject(T).setParent(this)}this.setVisible(f)},i.toData=function(){var t,e;(this.definition.id=this.guid,this.definition.transform=this.transform.toData(),this.definition.dataType=ze.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.definition.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.definition.components){this.definition.components=[];for(var i,r=Ze(this.components);!(i=r()).done;){var n=i.value;E(n,qs)&&this.definition.components.push(n)}}this.definition.content={}},i.dispose=function(){if(this.composition){this.composition.destroyItem(this);for(var e,i=Ze(this.components.slice());!(e=i()).done;){e.value.dispose()}this.components=[],this._composition=null,this.transform.setValid(!1)}this.resetChildrenParent(),t.prototype.dispose.call(this)},i.resetChildrenParent=function(){for(var t,e=Ze(this.children);!(t=e()).done;){var i=t.value;this.parent&&i.setParent(this.parent)}var r;this.parent&&N(null==(r=this.parent)?void 0:r.children,this)},i.instantiatePreComposition=function(t,e){void 0===e&&(e=!0),this.name=t.name,this.duration=t.duration,this.endBehavior=t.endBehavior;var i,r=this.getInstanceId();this.setInstanceId(t.id);for(var n,a=Ze(t.components);!(n=a()).done;){var s=n.value,o=this.engine.findObject(s);o.item=this,this.components.push(o)}for(var u,h=Ze(null!=(i=t.children)?i:[]);!(u=h()).done;){var l=u.value;this.engine.findObject(l).setParent(this)}if(e){for(var c,f=Ze(this.components);!(c=f()).done;){c.value.setInstanceId(Ft())}for(var d,p=Ze(this.children);!(d=p()).done;){d.value.refreshGUIDRecursive()}}this.setInstanceId(r)},i.refreshGUIDRecursive=function(t){var e,i=null!=(e=null==t?void 0:t.get(this))?e:Ft();this.setInstanceId(i);for(var r,n=Ze(this.components);!(r=n()).done;){var a,s=r.value,o=null!=(a=null==t?void 0:t.get(s))?a:Ft();s.setInstanceId(o)}for(var u,h=Ze(this.children);!(u=h()).done;){u.value.refreshGUIDRecursive(t)}},i.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=Ze(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=Ze(this.children);!(n=a()).done;){n.value.gatherPreviousObjectID(t)}},i.getDescendantsInternal=function(t,e,i){if(void 0===e&&(e=!1),this.children)for(var r=0;r<this.children.length;r++){var n=this.children[r];i&&!i(n)||t.push(n),e||n.getDescendantsInternal(t,!1,i)}},e.isComposition=function(t){return t.type===te.composition},e.isSprite=function(t){return t.type===te.sprite},e.isParticle=function(t){return t.type===te.particle},e.isNull=function(t){return t.type===te.null},e.isTree=function(t){return t.type===te.tree},e.isCamera=function(t){return t.type===te.camera},e.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},xr(e,[{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=Ze(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){this.listIndex=t,this.isManuallySetRenderOrder=!0,this.setRendererComponentOrder(t)}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),e}(ii);oa=_([$e(ze.VFXItemData)],oa),function(t){t.is=function(t,e){return t.type===e},t.isComposition=function(t){return t.type===te.composition},t.isParticle=function(t){return t.type===te.particle},t.isNull=function(t){return t.type===te.null}}(Yn||(Yn={}));var ua,ha,la=(ua=new Float32Array(1),ha=new Int32Array(ua.buffer),function(t){ua[0]=t;var e=ha[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)}),ca=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]=la(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=la(t[i])},t}();function fa(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}var da,pa=new Cn,ma=new Sn;function va(t,e,i,r,n,a,s){var o=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;o.copyFrom(a),o.addScaledVector(s,h),o.addScaledVector(i,c);var f=e.linearVelOverLifetime||{},d=e.orbitalVelOverLifetime||{};if(d.enabled){var p=new X;d.center&&p.setFromArray(d.center);var m=o.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}));pa.setFromArray(y).negate(),ma.setFromEuler(pa);var g=ma.transformPoint(m);o.addVectors(p,g)}if(f.enabled){var x=f.asMovement,b=f.x,T=f.y,E=f.z;if(b){var _=x?b.getValue(u):b.getIntegrateValue(0,r,n);o.x=o.x+_}if(T){var w=x?T.getValue(u):T.getIntegrateValue(0,r,n);o.y=o.y+w}if(E){var S=x?E.getValue(u):E.getIntegrateValue(0,r,n);o.z=o.z+S}}return o}function ya(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function ga(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function xa(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var s=0;s<i.length;s++)t[s]=i[s];return t}var ba=((da={})[ie.PARTICLE_ORIGIN_CENTER]=[0,0],da[ie.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],da[ie.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],da[ie.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],da[ie.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],da[ie.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],da[ie.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],da[ie.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],da[ie.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],da);function Ta(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function Ea(t,e,i){var r=i.position,n=new X(t,e,0),a=new X;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new Mn(r,a)}function _a(t,e,i){var r=t.x,n=t.y,a=t.z,s=new X(r-e,n+i,a),o=new X(r-e,n-i,a),u=new X(r+e,n-i,a),h=new X(r+e,n+i,a);return[{p0:s,p1:o,p2:u},{p0:s.clone(),p1:u.clone(),p2:h}]}function wa(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function Sa(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}function Ca(t,e,i,r,n){void 0===r&&(r=null);var a=new X(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new X(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);n||(n=3);for(var o=e,u=e*n;o<e+i;o++,u+=n){var h=t[u],l=t[u+1],c=t[u+2];a.x=Math.min(a.x,h),a.y=Math.min(a.y,l),a.z=Math.min(a.z,c),s.x=Math.max(s.x,h),s.y=Math.max(s.y,l),s.z=Math.max(s.z,c)}return r&&(a.x-=a.x*r.x+r.y,a.y-=a.y*r.x+r.y,a.z-=a.z*r.x+r.y,s.x+=s.x*r.x+r.y,s.y+=s.y*r.x+r.y,s.z+=s.z*r.x+r.y),{minimum:a,maximum:s}}var Aa={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,a=e[r],s=e[n];return new j(a,s)},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===le.LINE||i===le.EASE_OUT?0:i===le.EASE_IN||i===le.EASE||i===le.HOLD&&r===le.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!==le.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==le.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[le.EASE,le.EASE_IN,le.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[le.EASE,le.EASE_OUT,le.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===le.HOLD&&[le.HOLD,le.LINE_OUT,le.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===le.HOLD&&[le.HOLD,le.LINE,le.EASE_IN].includes(i)}},Ma=function(t,e){this.points=t,this.totalLength=e},Ia={},Ra={},Oa=.1;function Pa(t,e){return 1-3*e+3*t}function Na(t,e){return 3*e-6*t}function La(t){return 3*t}function Fa(t,e,i){return((Pa(e,i)*t+Na(e,i))*t+La(e))*t}function Va(t,e,i){return 3*Pa(e,i)*t*t+2*Na(e,i)*t+La(e)}function ka(t,e,i,r){var n=Sa(e.x-t.x,3)+"_"+Sa(e.y-t.y,3)+"_"+Sa(e.z-t.z,3)+"&"+(Sa(i.x-t.x,3)+"_"+Sa(i.y-t.y,3)+"_"+Sa(i.z-t.z,3))+"&"+(Sa(r.x-t.x,3)+"_"+Sa(r.y-t.y,3)+"_"+Sa(r.z-t.z,3));if(Ra[n])return{data:Ra[n],interval:t};for(var a=[],s=null,o=0,u=0,h=0;h<300;h+=1){var l=new X,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,o+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new Ma(a,o);return Ra[n]=f,{data:f,interval:new X(t.x,t.y,t.z)}}var Da=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=ka(t,e,i,r),a=n.data,s=n.interval;this.lengthData=a,this.interval=s,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(wa(1-t,0))return e.points[299].point.clone().add(this.interval);if(wa(e.totalLength,0))return this.p1.clone();var i=new X,r=Sa(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(wa(n,r))return e.points[a].point.clone().add(this.interval);var s=!0,o=1;for(r<n&&(o=-1);s;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}o>0&&a<299?(a+=o,n+=Sa(e.points[a].partialLength,5)):o<0&&a>0?(n-=Sa(e.points[a].partialLength,5),a+=o):s=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),za=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new _i,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):wa(1-t,0)?this.temp.copyFrom(this.p2):(ja.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),Ba=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new j,this.control2=new j,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(),Fa(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 a=1-n,s=a*a,o=n*n;return t*(s*a)+e*s*n*3+i*a*o*3+r*(o*n)},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=Fa(t*Oa,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+=Oa;var n=i+(t-e[--r])/(e[r+1]-e[r])*Oa,a=Va(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=Va(e,i,r);if(0===a)return e;e-=(Fa(e,i,r)-t)/a}return e}(t,n,this.control1.x,this.control2.x):0===a?n:function(t,e,i,r,n){var a,s,o=0;do{(a=Fa(s=e+(i-e)/2,r,n)-t)>0?i=s:e=s}while(Math.abs(a)>1e-7&&++o<10);return s}(t,i,i+Oa,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 Ua(t,e){var i=Ga(t,e,!0),r=i.p0,n=i.p1,a=i.p2,s=i.p3;mt(a),mt(s);var o,u,h=s.x-r.x,l=s.y-r.y,c=Sa((n.x-r.x)/h,5),f=Sa((a.x-r.x)/h,5);wa(l,0)?o=u=NaN:(o=Sa((n.y-r.y)/l,5),u=Sa((a.y-r.y)/l,5)),c<0&&(c=0),f<0&&(f=0),c>1&&(c=1),f>1&&(f=1);var d,p=("bez_"+c+"_"+o+"_"+f+"_"+u).replace(/\./g,"p");return Ia[p]?d=Ia[p]:(d=wa(l,0)?new Ba:new Ba(c,o,f,u),Ia[p]=d),{points:[r,n,a,s],timeInterval:h,valueInterval:l,curve:d}}function Ga(t,e,i){var r=t[1],n=Aa.isHoldOutKeyframe(t),a=Aa.isHoldInKeyframe(e),s=!a&&Aa.isRightSideEase(t),o=!n&&Aa.isLeftSideEase(e);if(s&&!o&&!a){var u=new j(r[r.length-4],r[r.length-3]),h=new j(r[r.length-2],r[r.length-1]),l=Aa.getPointInCurve(e),c=new j(l.x,l.y);return{type:"ease",p0:u,p1:h,p2:new j(c.x-(c.x-u.x)/10,c.y),p3:c}}if(!s&&o&&!n){var f=e[1],d=Aa.getPointInCurve(t),p=new j(d.x,d.y),m=new j(f[0],f[1]),v=new j(f[2],f[3]);return{type:"ease",p0:p,p1:new j(p.x+(v.x-p.x)/10,p.y),p2:m,p3:v}}if(s&&o){var y=e[1];return{type:"ease",p0:new j(r[r.length-4],r[r.length-3]),p1:new j(r[r.length-2],r[r.length-1]),p2:new j(y[0],y[1]),p3:new j(y[2],y[3])}}var g=Aa.getPointInCurve(t),x=Aa.getPointInCurve(e);return n?x.y=g.y:a&&(g.y=x.y),i?{type:"line",p0:g,p1:new j((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new j((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}:{type:"line",p0:g,p1:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var ja=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,s=e.z,o=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r)return t.x=n,t.y=a,t.z=s,void(t.w=o);if(1===r)return t.x=u,t.y=h,t.z=l,void(t.w=c);if(o!==c||n!==u||a!==h||s!==l){var f=1-r,d=n*u+a*h+s*l+o*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,a=a*f+h*g,s=s*f+l*g,o=o*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+s*s+o*o);n*=x,a*=x,s*=x,o*=x}}t.x=n,t.y=a,t.z=s,t.w=o},t}(),Xa="not_implement",Wa=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(Xa)},e.getIntegrateValue=function(t,e,i){throw new Error(Xa)},e.getIntegrateByTime=function(t,e){throw new Error(Xa)},e.getValue=function(t){throw new Error(Xa)},e.getMaxTime=function(){throw new Error(Xa)},e.toUniform=function(t){throw new Error(Xa)},e.map=function(t){throw new Error(Xa)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(Xa)},t.getAllData=function(t,e){for(var i=new(e?ca:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var s=a[r].toData();i.set(s,n),n+=s.length}return e?i.data:i},t}(),Ha=function(t){function e(){return t.apply(this,arguments)}oe(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}(Wa),Ya=function(t){function e(){return t.apply(this,arguments)}oe(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}(Wa),Za=function(t){function e(){return t.apply(this,arguments)}oe(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}(Wa),qa=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(Wa),Ka=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return rs(e,0,this.xCoord,this.min,this.max)-rs(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}(Wa),Qa=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=q(t)},i.getStops=function(){return this.stops},i.getValue=function(t){var e=this.stops;if(0===e.length)return[0,0,0,0];if(t<=e[0].time)return e[0].color.toArray();var i=e.length-1;if(t>=e[i].time)return e[i].color.toArray();for(var r=0;r<i;r++){var n=e[r],a=e[r+1];if(n.time<=t&&a.time>t){var s=(t-n.time)/(a.time-n.time);return K(n.color.toArray(),a.color.toArray(),s,!0)}}return e[i].color.toArray()},e}(Wa),Ja=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1],s=n[0],o=a[0];if(t>=s&&t<=o){var u=(t-s)/(o-s),h=n[1];return h+u*(a[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,a=e?rs:is,s=0;s<n;s++){var o=i[s],u=i[s+1],h=o[0],l=u[0];if(t>h&&t<=l)return r+a(t,h,l,o[1],u[1]);r+=a(l,h,l,o[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=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}(Wa),$a=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],a=e[r+1];if(n[0]<=t&&a[0]>=t){var s=a[1]-n[1],o=void 0;if(0===s)o=(t-n[0])/(a[0]-n[0]);else o=(ns(t,n,a)-n[1])/s;return this.calculateVec(r,o)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(Wa),ts=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var a=e[n],s=e[n+1],o=new X(i[n][0],i[n][1],i[n][2]),u=new X(i[n+1][0],i[n+1][1],i[n+1][2]),h=new X(r[2*n][0],r[2*n][1],r[2*n][2]),l=new X(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=Ua(a,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Da(o,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=Sa(t,5),i=0,r=new X,n=this.keyTimeData;if(!n.length)return r;var a=this.curveSegments[n[0]].timeStart,s=this.curveSegments[n[n.length-1]].timeEnd;if(e<=a)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 o=0;o<n.length;o++){var u=this.curveSegments[n[o]].timeStart,h=this.curveSegments[n[o]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[o]].pathCurve;i=this.getPercValue(n[o],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=Sa((e-r.x)/n,4);return G(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Wa),es=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var a=e[n],s=e[n+1],o=_i.fromArray(i[n]),u=_i.fromArray(i[n+1]),h=_i.fromArray(r[2*n]),l=_i.fromArray(r[2*n+1]),c=Ua(a,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new za(o,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=Sa(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<r.length;s++){var o=r[s].split("&"),u=o[0],h=o[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,a=Sa((e-r.x)/n,4);return G(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Wa);function is(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function rs(t,e,i,r,n){var a=t*t,s=e*e;return(2*(a*t)*(r-n)+3*a*(e*n-i*r)-s*e*(2*r+n)+3*s*i*r)/(6*(e-i))}function ns(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,s=(t-e[0])/r,o=s*s,u=o*s,h=u-2*o+s,l=u-o,c=-2*u+3*o;return(2*u-3*o+1)*e[1]+h*n+l*a+c*i[1]}function as(t,e){if(e){var i=e[0],r=e[1];if(i===he.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===he.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var s=Math.ceil(a/2);t.lineSegCount+=s,t.curves.push(r),t.index+=s,t.max=Math.max(t.max,s)}else if(i===he.BEZIER_CURVE){var o=r.length-1;t.index+=2*o,t.curves.push(r),t.max=Math.max(t.max,2*o),t.curveCount+=2*o}}}function ss(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function os(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(os=function(){return!!t})()}function us(t,e,i){return us=os()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&se(n,i.prototype),n},us.apply(null,arguments)}var hs,ls,cs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new W,e}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=xs(t[0]),this.yCurve=xs(t[1]),this.zCurve=xs(t[2]),this.wCurve=xs(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}(Wa),fs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new X,e}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=xs(t[0]),this.yCurve=xs(t[1]),this.zCurve=xs(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}(Wa),ds=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new j,e}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=xs(t[0]),this.yCurve=xs(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}(Wa);!function(t){t[t.Cubic=0]="Cubic",t[t.Linear=1]="Linear",t[t.Constant=2]="Constant"}(hs||(hs={})),function(t){t[t.None=0]="None",t[t.In=1]="In",t[t.Out=2]="Out",t[t.Both=3]="Both"}(ls||(ls={}));var ps=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=vs(t);var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=ms(e[i],e[i+1]),n=r.points,a=r.curve,s=r.timeInterval,o=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:o,curve:a,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,a=this.keyFrames[r+1].time;if(t>=n&&t<a){var s=this.curveInfos[r],o=s.points[0],u=s.timeInterval,h=s.valueInterval,l=(t-o.x)/u,c=0;c=1===this.keyFrames[r].tangentMode?l:s.curve.getValue(l),e=o.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,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var s=0;s<a.length;s++){var o=this.curveMap[a[s]].timeStart,u=this.curveMap[a[s]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[s],Number(u))),r>=Number(o)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[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,a=i.valueInterval,s=0,o=(e-r.x)/20,u=0;u<=20;u++){var h=u*o/n,l=r.y+a*i.curve.getValue(h);s+=0===u||20===u?l:u%2==1?4*l:2*l}return s*=o/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}(Wa);function ms(t,e){var i=new j(t.time,t.value),r=new j,n=new j,a=new j,s=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,o=2===t.tangentMode,u=(s?t.outWeight:1)*(e.time-t.time)/3;r.x=t.time+u,r.y=t.value+u*(o?0:t.outSlope);var h=(s?e.inWeight:1)*(e.time-t.time)/3;n.x=e.time-h,n.y=e.value-h*(o?0:e.inSlope),a.x=e.time,a.y=o?t.value:e.value,mt(n),mt(a);var l,c,f=a.x-i.x,d=a.y-i.y,p=Sa((r.x-i.x)/f,5),m=Sa((n.x-i.x)/f,5);wa(d,0)?l=c=NaN:(l=Sa((r.y-i.y)/d,5),c=Sa((n.y-i.y)/d,5)),p<0&&(console.error("Invalid bezier points, x1 < 0",i,r,n,a),p=0),m<0&&(console.error("Invalid bezier points, x2 < 0",i,r,n,a),m=0),p>1&&(console.error("Invalid bezier points, x1 >= 1",i,r,n,a),p=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",i,r,n,a),m=1);var v,y=("bez_"+p+"_"+l+"_"+m+"_"+c).replace(/\./g,"p");return Ia[y]?v=Ia[y]:(v=wa(d,0)?new Ba:s?new Ba(p,l,m,c):new Ba(l,c),Ia[y]=v),{points:[i,r,n,a],timeInterval:f,valueInterval:d,curve:v}}function vs(t){for(var e=t,i=[],r=[],n={x:0,y:0},a=0;a<e.length;a++){var s=e[a],o=Ga(s,a+1<e.length?e[a+1]:e[a],!0),u=o.p0,h=o.p1,l=o.p2,c=o.p3,f=o.type;mt(l),mt(c);var d={leftControl:n,value:u,rightControl:h,tangentMode:"line"===f?1:0};s[0]===le.HOLD&&(d.tangentMode=2),r.push(d),n=l}for(var p=function(t,e){return(e.y-t.y)/(e.x-t.x+z)},m=0;m<r.length;m++){var v=r[m].leftControl,y=r[m].value,g=r[m].rightControl,x=0,b=0;m>0&&(x=p(v,y)),m<r.length-1&&(b=p(y,g));var T={time:y.x,value:y.y,inSlope:x,outSlope:b,inWeight:0,outWeight:0,tangentMode:r[m].tangentMode,weightedMode:3};i.push(T),m>0&&(T.inWeight=(y.x-v.x)/((y.x-r[m-1].value.x)/3)),m+1<r.length&&(T.outWeight=(g.x-y.x)/((r[m+1].value.x-y.x)/3))}return i}var ys,gs=((ys={})[he.RANDOM]=function(t){return E(t[0],Array)?new qa(t):new Za(t)},ys[he.CONSTANT]=function(t){return new Ha(t)},ys[he.CONSTANT_VEC2]=function(t){return new Ha(t)},ys[he.CONSTANT_VEC3]=function(t){return new Ha(t)},ys[he.CONSTANT_VEC4]=function(t){return new Ha(t)},ys[he.RGBA_COLOR]=function(t){return new Ha(t)},ys[he.COLORS]=function(t){return new Ya(t.map((function(t){return Y(t,!1)})))},ys[he.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Ka([t[0][1],t[1][1]]):new Ja(t)},ys[he.GRADIENT_COLOR]=function(t){return new Qa(t)},ys[he.LINEAR_PATH]=function(t){return new $a(t)},ys[he.BEZIER_CURVE]=function(t){return 1===t.length?new Ha(t[0][1][1]):new ps(t)},ys[he.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new Ha(us(X,[].concat(t[1][0]))):new ts(t)},ys[he.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new Ha(us(_i,[].concat(t[1][0]))):new es(t)},ys[he.COLOR_CURVE]=function(t){return new bs(t)},ys[he.VECTOR4_CURVE]=function(t){return new cs(t)},ys[he.VECTOR2_CURVE]=function(t){return new ds(t)},ys[27]=function(t){return new fs(t)},ys);function xs(t){if(!t||!isNaN(+t))return new Ha(t||0);if(E(t,Wa))return t;if(Mt(gs[t[0]]))return gs[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+ta["ValueType: 21/22 is not supported"]+".")}var bs=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new H,e}oe(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=xs(t[0]),this.gCurve=xs(t[1]),this.bCurve=xs(t[2]),this.aCurve=xs(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}(Wa),Ts=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},xr(t,null,[{key:"shared",get:function(){return Es.x=0,Es.y=0,Es}}]),t}(),Es=new Ts,_s=1e-4,ws=1e-4;function Ss(t,e,i,r,n,a,s,o){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*a+u,d=e+r*a+h;return o.push(l,c),o.push(f,d),2}function Cs(t,e,i,r,n,a,s,o){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,a-e);o&&l<c?l+=2*Math.PI:!o&&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,o){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,a)}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,a),s.push(t,e)}return 2*v}function As(t,e,i,r,n,a,s,o,u){var h=_s;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],a=t[e-1];r<e;r+=2){var s=t[r],o=t[r+1];i+=(s-n)*(o+a),n=s,a=o}return i<0?-1:1}(t);i&&(f*=-1),c=(c-.5)*f+.5}var d=new Ts(t[0],t[1]),p=new Ts(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,E=x.length/2,_=l.width/2,w=_*_,S=l.miterLimit*l.miterLimit,C=t[0],A=t[1],M=t[2],I=t[3],R=0,O=0,P=-(A-I),N=C-M,L=0,F=0,V=Math.sqrt(P*P+N*N)+z;P/=V,N/=V,P*=_,N*=_;var k=2*(1-c),D=2*c;m||(l.cap===Ne.Round?T+=Cs(C-P*(k-D)*.5,A-N*(k-D)*.5,C-P*k,A-N*k,C+P*D,A+N*D,x,!0)+2:l.cap===Ne.Square&&(T+=Ss(C,A,P,N,k,D,!0,x))),x.push(C-P*k,A-N*k),x.push(C+P*D,A+N*D);for(var B=1;B<b-1;++B){C=t[2*(B-1)],A=t[2*(B-1)+1],M=t[2*B],I=t[2*B+1],R=t[2*(B+1)],O=t[2*(B+1)+1],P=-(A-I),N=C-M,P/=V=Math.sqrt(P*P+N*N)+z,N/=V,P*=_,N*=_,L=-(I-O),F=M-R,L/=V=Math.sqrt(L*L+F*F)+z,F/=V,L*=_,F*=_;var U=M-C,G=A-I,j=M-R,X=O-I,W=U*j+G*X,H=G*j-X*U,Y=H<0;if(Math.abs(H)<.001*Math.abs(W))x.push(M-P*k,I-N*k),x.push(M+P*D,I+N*D),W>=0&&(l.join===Le.Round?T+=Cs(M,I,M-P*k,I-N*k,M-L*k,I-F*k,x,!1)+4:T+=2,x.push(M-L*D,I-F*D),x.push(M+L*k,I+F*k));else{var Z=(-P+C)*(-N+I)-(-P+M)*(-N+A),q=(-L+R)*(-F+I)-(-L+M)*(-F+O),K=(U*q-j*Z)/H,Q=(X*Z-G*q)/H,J=(K-M)*(K-M)+(Q-I)*(Q-I),$=M+(K-M)*k,tt=I+(Q-I)*k,et=M-(K-M)*D,it=I-(Q-I)*D,rt=Y?k:D;J<=Math.min(U*U+G*G,j*j+X*X)+rt*rt*w?l.join===Le.Bevel||J/w>S?(Y?(x.push($,tt),x.push(M+P*D,I+N*D),x.push($,tt),x.push(M+L*D,I+F*D)):(x.push(M-P*k,I-N*k),x.push(et,it),x.push(M-L*k,I-F*k),x.push(et,it)),T+=2):l.join===Le.Round?Y?(x.push($,tt),x.push(M+P*D,I+N*D),T+=Cs(M,I,M+P*D,I+N*D,M+L*D,I+F*D,x,!0)+4,x.push($,tt),x.push(M+L*D,I+F*D)):(x.push(M-P*k,I-N*k),x.push(et,it),T+=Cs(M,I,M-P*k,I-N*k,M-L*k,I-F*k,x,!1)+4,x.push(M-L*k,I-F*k),x.push(et,it)):(x.push($,tt),x.push(et,it)):(x.push(M-P*k,I-N*k),x.push(M+P*D,I+N*D),l.join===Le.Round?T+=Y?Cs(M,I,M+P*D,I+N*D,M+L*D,I+F*D,x,!0)+2:Cs(M,I,M-P*k,I-N*k,M-L*k,I-F*k,x,!1)+2:l.join===Le.Miter&&J/w<=S&&(Y?(x.push(et,it),x.push(et,it)):(x.push($,tt),x.push($,tt)),T+=2),x.push(M-L*k,I-F*k),x.push(M+L*D,I+F*D),T+=2)}}C=t[2*(b-2)],A=t[2*(b-2)+1],M=t[2*(b-1)],P=-(A-(I=t[2*(b-1)+1])),N=C-M,P/=V=Math.sqrt(P*P+N*N)+z,N/=V,P*=_,N*=_,x.push(M-P*k,I-N*k),x.push(M+P*D,I+N*D),m||(l.cap===Ne.Round?T+=Cs(M-P*(k-D)*.5,I-N*(k-D)*.5,M-P*k,I-N*k,M+P*D,I+N*D,x,!1)+2:l.cap===Ne.Square&&(T+=Ss(M,I,P,N,k,D,!1,x)));for(var nt=E;nt<T+E-2;++nt)C=x[2*nt],A=x[2*nt+1],M=x[2*(nt+1)],I=x[2*(nt+1)+1],R=x[2*(nt+2)],O=x[2*(nt+2)+1],Math.abs(C*(I-O)+M*(O-A)+R*(A-I))<1e-8||o.push(nt,nt+1,nt+2)}}var Ms=function(){},Is="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Rs={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 a(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 o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function 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,_(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,_(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),_(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,_(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 _(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 w(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 S=4e150;function C(t,e){t.f+=e.f,t.b.f+=e.b.f}function A(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>=a(i.b.a,e.a,i.a):0<=a(e.b.a,i.a,e.a):0>=a(i.b.a,t,i.a):i.b.a===t?0<=a(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 I(t,e){p(t.a),t.c=!1,t.a=e,e.i=t}function R(t){var e=t.a.a;do{t=dt(t)}while(t.a.a===e);return t.c&&(I(t,e=v(ft(t).a.b,t.a.e)),t=dt(t)),t}function O(t,e,i){var r=new ct;return r.a=i,r.e=W(t.f,e.e,r),i.i=r}function P(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 L(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}I(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 F(t,e,i,r,n,a){var s=!0;do{O(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=P(t,r.f),e.b=!0,!s&&z(t,e)&&(C(i,n),M(e),p(n)),s=!1,e=r,n=i;e.b=!0,a&&U(t,e)}function V(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=i[0])}function k(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 D(t,e,i,r,n){var a=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),o=n+1;r[n]=.5*s/(a+s),r[o]=.5*a/(a+s),t.g[0]+=r[n]*e.g[0]+r[o]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[o]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[o]*i.g[2]}function z(t,e){var n=ft(e),s=e.a,o=n.a;if(r(s.a,o.a)){if(0<a(o.b.a,s.a,o.a))return!1;if(i(s.a,o.a)){if(s.a!==o.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;k(t,$(o),s)}}else m(o.b),d(s,$(o)),e.b=n.b=!0}else{if(0>a(s.b.a,o.a,s.a))return!1;dt(e).b=e.b=!0,m(s.b),d($(o),s)}return!0}function B(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(a(y,t.a,p),a(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<a(g,p,v))return!1}else if(0>a(y,v,p))return!1;var b,T,E=y,_=p,w=g,S=v;if(r(E,_)||(b=E,E=_,_=b),r(w,S)||(b=w,w=S,S=b),r(E,w)||(b=E,E=w,w=b,b=_,_=S,S=b),r(w,_)?r(_,S)?(0>(b=n(E,w,_))+(T=n(w,_,S))&&(b=-b,T=-T),x.b=c(b,w.b,T,_.b)):(0>(b=a(E,w,_))+(T=-a(E,S,_))&&(b=-b,T=-T),x.b=c(b,w.b,T,S.b)):x.b=(w.b+_.b)/2,s(E,_)||(b=E,E=_,_=b),s(w,S)||(b=w,w=S,S=b),s(E,w)||(b=E,E=w,w=b,b=_,_=S,S=b),s(w,_)?s(_,S)?(0>(b=o(E,w,_))+(T=o(w,_,S))&&(b=-b,T=-T),x.a=c(b,w.a,T,_.a)):(0>(b=u(E,w,_))+(T=-u(E,S,_))&&(b=-b,T=-T),x.a=c(b,w.a,T,S.a)):x.a=(w.a+_.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<=a(y,t.a,x)||!i(g,t.a)&&0>=a(g,t.a,x)){if(g===t.a)return m(l.b),d(f.b,l),l=ft(e=R(e)).a,L(t,ft(e),h),F(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),F(t,e,(f=L(t,h,null)).c,l.b.c,p,!0),!0}return 0<=a(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>=a(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,D(l,p,y,f,0),D(l,v,g,f,2),V(t,l,x,f,!0),dt(e).b=e.b=h.b=!0,!1}function U(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,o=i.a;if(n=s.b.a!==o.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>a(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<a(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(o),o=(i=ft(e)).a):e.c&&(M(e),p(s),s=(e=dt(i)).a)),s.a!==o.a)if(s.b.a===o.b.a||e.c||i.c||s.b.a!==t.a&&o.b.a!==t.a)z(t,e);else if(B(t,e))break;s.a===o.a&&s.b.a===o.b.a&&(C(o,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 o=(c=n.f).a;do{o=o.a}while(null!==o.b&&!c.c(c.b,h,o.b));var u=ft(c=o.b),h=c.a;o=u.a;if(0===a(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(o.b.a,h.b.a)?c:u;u=void 0;c.d||l.c?(u=l===c?v(s.c.b,h.e):v(o.b.c.b,s.c).b,l.c?I(l,u):(h=n,(c=O(n,c,u)).f=dt(c).f+c.a.f,c.d=P(h,c.f)),G(n,s)):F(n,c,s.c,s.c,null,!0)}return}if(c=(h=ft(n=R(n.i))).a,(h=L(t,h,null)).c===c){h=(c=h).c,o=ft(n),u=n.a,l=o.a;var c,f=!1;u.b.a!==l.b.a&&B(t,n),i(u.a,t.a)&&(d($(h),u),h=ft(n=R(n)).a,L(t,ft(n),o),f=!0),i(l.a,t.a)&&(d(c,$(l)),c=L(t,o,null),f=!0),f?F(t,n,c.c,h,h,!0):(s=r(l.a,u.a)?$(l):u,F(t,n,s=v(c.c.b,s),s.c,s.c,!1),s.b.i.c=!0,U(t,n))}else F(t,n,h.c,c,c,!0)}function j(t,e){var i=new ct,r=f(t.b);r.a.b=S,r.a.a=e,r.b.a.b=-S,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=W(r=t.f,r.a,i),i.e=r}function X(t){this.a=new H,this.b=t,this.c=A}function W(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i));return t=new H(i,e.a,e),e.a.c=t,e.a=t}function H(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 at}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(ot(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 at(){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 ot(t){return t.e[t.d[1]]}function ut(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),a}function ht(t,e){for(var i=t.d,n=t.e,a=t.c,s=e,o=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[o],n[h])){i[s]=o,a[o]=s;break}i[s]=h,a[h]=s,s=u}}function lt(t,e){for(var i=t.d,n=t.e,a=t.c,s=e,o=i[s];;){var u=s>>1,h=i[u];if(0===u||r(n[h],n[o])){i[s]=o,a[o]=s;break}i[s]=h,a[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 a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}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],o=this.j[2]];if(0===c&&0===n&&0===o){for(var n=[-2e150,-2e150,-2e150],s=[2e150,2e150,2e150],o=[],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,o[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],o=o[c],u=[0,0,0],s=[s.g[0]-o.g[0],s.g[1]-o.g[1],s.g[2]-o.g[2]],f=[0,0,0],c=t.e;c!==t;c=c.e)f[0]=c.g[0]-o.g[0],f[1]=c.g[1]-o.g[1],f[2]=c.g[2]-o.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[w(s)]=1)}t=!0}for(u=w(e),c=this.b.c,n=(u+1)%3,o=(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[o];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&&(k(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,-S),j(this,S);null!==(e=nt(this.e));){for(;;){t:if(c=this.e,0===c.a)t=ot(c.b);else if(t=c.c[c.d[c.a-1]],0!==c.b.a&&(c=ot(c.b),r(c,t))){t=c;break t}if(null===t||!i(t,e))break;t=nt(this.e),k(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&&(C(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,o=void 0;c.e!==n;)if(r(c.b.a,n.a)){for(;n.e!==c&&(h(n.e)||0>=a(n.a,n.b.a,n.e.b.a));)n=(o=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==c&&(l(c.c.b)||0<=a(c.b.a,c.a,c.c.b.a));)c=(o=v(c,c.c.b)).b;c=c.e}for(;n.e.e!==c;)n=(o=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,o=e.a.d;o!==e.a;o=o.d)if(o.c){c||(this.h&&this.h(4,this.c),c=!0),u=o.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!==o.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){o=(n=c.a).e,u=void 0;do{o=(u=o).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},Is.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=Is.libtess}(Rs);var Os=function(){var t=new Rs.exports.GluTesselator;return t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==Rs.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,i){return[t[0],t[1],t[2]]})),t.gluTessCallback(Rs.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function Ps(t){Os.gluTessNormal(0,0,1);var e=[];Os.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){Os.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];Os.gluTessVertex(a,a)}Os.gluTessEndContour()}return Os.gluTessEndPolygon(),e}var Ns=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 a=Array.isArray(i[0])?i[0]:i;if("number"!=typeof a[0]){for(var s=[],o=0,u=a.length;o<u;o++)s.push(a[o].x,a[o].y);a=s}return n.points=a,n.closePath=!0,n}oe(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,a=r-1;n<r;a=n++){var s=this.points[2*n],o=this.points[2*n+1],u=this.points[2*a],h=this.points[2*a+1];o>e!=h>e&&t<(e-o)/(h-o)*(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,e){for(var i=0;i<this.points.length;i++)t[i]=this.points[i]},i.triangulate=function(t,e,i,r,n){var a=Ps([t]),s=e.length/2;0===a.length&&this.getLineEndPointsTriangle(t,a);for(var o=0;o<a.length;o++)e[2*i+o]=a[o];for(var u=a.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],a=t[1],s=t[0],o=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,a=l),h>s&&(s=h,o=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<a&&(n=f,a=d),d>o&&(s=f,o=d)}e.push(n,a,s,o,s,o)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},xr(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(Ms),Ls=8,Fs=1.1920929e-7;function Vs(t,e,i,r,n,a,s,o,u,h,l){var c=null!=l?l:1,f=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/c;return function(t,e,i,r,n,a,s,o,u,h){ks(t,e,i,r,n,a,s,o,u,h,0),u.push(s,o)}(e,i,r,n,a,s,o,u,t,f*=f),t}function ks(t,e,i,r,n,a,s,o,u,h,l){if(!(l>Ls)){var c=(t+i)/2,f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+s)/2,v=(a+o)/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-t,w=o-e,S=Math.abs((i-s)*w-(r-o)*_),C=Math.abs((n-s)*w-(a-o)*_);if(S>Fs&&C>Fs){if((S+C)*(S+C)<=h*(_*_+w*w))return void u.push(T,E)}else if(S>Fs){if(S*S<=h*(_*_+w*w))return void u.push(T,E)}else if(C>Fs){if(C*C<=h*(_*_+w*w))return void u.push(T,E)}else if((_=T-(t+s)/2)*_+(w=E-(e+o)/2)*w<=h)return void u.push(T,E)}ks(t,e,c,f,y,g,T,E,u,h,l+1),ks(T,E,x,b,m,v,s,o,u,h,l+1)}}var Ds,zs=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}oe(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 a=i/2,s=r-a,o=n-a,u=r+a,h=n+a,l=t-this.x,c=e-this.y;return l*l/(s*s)+c*c/(o*o)>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,e){var i=this.x,r=this.y,n=this.halfWidth,a=this.halfHeight;if(!(n>=0&&a>=0))return t;var s=null!=e?e:1,o=Math.ceil(Math.sqrt(s*(n+a))),u=8*o+0+0;if(0===u)return t;if(0===o)return t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,t[5]=t[7]=r-0,t;var h=0,l=4*o+0+2,c=l,f=u,d=0+n,p=0,m=i+d,v=i-d,y=r+p;t[h++]=m,t[h++]=y,t[--l]=y,t[--l]=v;for(var g=1;g<o;g++){var x=Math.PI/2*(g/o),b=0+Math.cos(x)*n,T=0+Math.sin(x)*a,E=i+b,_=i-b,w=r+T,S=r-T;t[h++]=E,t[h++]=w,t[--l]=w,t[--l]=_,t[c++]=_,t[c++]=S,t[--f]=S,t[--f]=E}m=i+(d=0),v=i-d,y=r+(p=0+a);var C=r-p;return t[h++]=m,t[h++]=y,t[--f]=C,t[--f]=m,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,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}(Ms);!function(t){t[t.Star=0]="Star",t[t.Polygon=1]="Polygon"}(Ds||(Ds={}));var Bs,Us=function(t){function e(e,i,r,n,a,s){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=0),(o=t.call(this)||this).pointCount=e,o.outerRadius=i,o.innerRadius=r,o.outerRoundness=n,o.innerRoundness=a,o.starType=s,o.v=[],o.in=[],o.out=[],o}oe(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,e){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var i=null!=e?e:1,r=0;r<this.v.length-2;r+=2)Vs(t,this.v[r],this.v[r+1],this.out[r],this.out[r+1],this.in[r+2],this.in[r+3],this.v[r+2],this.v[r+3],void 0,i);var n=this.v.length-1;Vs(t,this.v[n-1],this.v[n],this.out[n-1],this.out[n],this.in[0],this.in[1],this.v[0],this.v[1],void 0,i)},i.triangulate=function(t,e,i,r,n){for(var a=Ps([t]),s=e.length/2,o=0;o<a.length;o++)e[2*i+o]=a[o];for(var u=a.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),a=2*Math.PI/n,s=!0,o=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*o/(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?o: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*a}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,a=2*Math.PI*r/(4*e),s=.5*-Math.PI;for(t=0;t<e;t++){var o=r*Math.cos(s),u=r*Math.sin(s),h=0===o&&0===u?0:u/Math.sqrt(o*o+u*u),l=0===o&&0===u?0:-o/Math.sqrt(o*o+u*u),c=2*t;this.v[c]=o,this.v[c+1]=u,this.in[c]=o+h*a*n*1,this.in[c+1]=u+l*a*n*1,this.out[c]=o-h*a*n*1,this.out[c+1]=u-l*a*n*1,s+=1*i}},e}(Ms),Gs=function(t){function e(e,i,r,n,a){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=20),(s=t.call(this)||this).x=e,s.y=i,s.width=r,s.height=n,s.roundness=a,s}oe(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,e){var i,r=this.width/2,n=this.height/2,a=this.x+r,s=this.y+n,o=i=Math.max(0,Math.min(this.roundness/100,1)*Math.min(r,n)),u=r-o,h=n-i;if(o>=0&&i>=0&&u>=0&&h>=0){var l=null!=e?e:1,c=Math.ceil(Math.sqrt(l*(o+i))),f=8*c+(u?4:0)+(h?4:0);if(0!==f){if(0===c)return t[0]=t[6]=a+u,t[1]=t[3]=s+h,t[2]=t[4]=a-u,void(t[5]=t[7]=s-h);var d=0,p=4*c+(u?2:0)+2,m=p,v=f,y=u+o,g=h,x=a+y,b=a-y,T=s+g;if(t[d++]=x,t[d++]=T,t[--p]=T,t[--p]=b,h){var E=s-g;t[m++]=b,t[m++]=E,t[--v]=E,t[--v]=x}for(var _=1;_<c;_++){var w=Math.PI/2*(_/c),S=u+Math.cos(w)*o,C=h+Math.sin(w)*i,A=a+S,M=a-S,I=s+C,R=s-C;t[d++]=A,t[d++]=I,t[--p]=I,t[--p]=M,t[m++]=M,t[m++]=R,t[--v]=R,t[--v]=A}x=a+(y=u),b=a-y,T=s+(g=h+i);var O=s-g;t[d++]=x,t[d++]=T,t[--v]=O,t[--v]=x,u&&(t[d++]=b,t[d++]=T,t[--v]=O,t[--v]=b)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,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}(Ms),js=function(t){function e(e,i,r,n,a,s){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=0),(o=t.call(this)||this).x=e,o.y=i,o.x2=r,o.y2=n,o.x3=a,o.y3=s,o}oe(e,t);var i=e.prototype;return i.contains=function(t,e){var i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),r=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(i<0!=r<0&&0!==i&&0!==r)return!1;var n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return 0===n||n<0==i+r<=0},i.clone=function(){return new e(this.x,this.y,this.x2,this.y2,this.x3,this.y3)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getBounds=function(t){t=t||new Gs;var e=Math.min(this.x,this.x2,this.x3),i=Math.max(this.x,this.x2,this.x3),r=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=r,t.width=i-e,t.height=n-r,t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t,e){t[0]=this.x,t[1]=this.y,t[2]=this.x2,t[3]=this.y2,t[4]=this.x3,t[5]=this.y3},i.triangulate=function(t,e,i,r,n){var a=0;e[(i*=2)+a]=t[0],e[i+a+1]=t[1],e[i+(a+=2)]=t[2],e[i+a+1]=t[3],e[i+(a+=2)]=t[4],e[i+a+1]=t[5];var s=i/2;r[n++]=s,r[n++]=s+1,r[n++]=s+2},e}(Ms),Xs=function(t){function e(e,i,r){var n;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),(n=t.call(this)||this).x=e,n.y=i,n.radius=r,n}oe(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.radius)},i.contains=function(t,e){if(this.radius<=0)return!1;var i=this.radius*this.radius,r=this.x-t,n=this.y-e;return(r*=r)+(n*=n)<=i},i.strokeContains=function(t,e,i,r){if(void 0===r&&(r=.5),0===this.radius)return!1;var n=this.x-t,a=this.y-e,s=this.radius,o=(1-r)*i,u=Math.sqrt(n*n+a*a);return u<=s+o&&u>s-(i-o)},i.getBounds=function(t){return t||(t=new Gs),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=2*this.radius,t.height=2*this.radius,t},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t,e){var i=this.x,r=this.y,n=this.radius,a=this.radius;if(!(n<=0)){var s=null!=e?e:1,o=Math.ceil(Math.sqrt(s*(n+a))),u=8*o+0+0;if(0!==u){if(0===o)return t[0]=t[6]=i+0,t[1]=t[3]=r+0,t[2]=t[4]=i-0,void(t[5]=t[7]=r-0);var h=0,l=4*o+0+2,c=l,f=u,d=0+n,p=0,m=i+d,v=i-d,y=r+p;t[h++]=m,t[h++]=y,t[--l]=y,t[--l]=v;for(var g=1;g<o;g++){var x=Math.PI/2*(g/o),b=0+Math.cos(x)*n,T=0+Math.sin(x)*a,E=i+b,_=i-b,w=r+T,S=r-T;t[h++]=E,t[h++]=w,t[--l]=w,t[--l]=_,t[c++]=_,t[c++]=S,t[--f]=S,t[--f]=E}m=i+(d=0),v=i-d,y=r+(p=0+a);var C=r-p;t[h++]=m,t[h++]=y,t[--f]=C,t[--f]=m}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,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}(Ms),Ws=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=Ze(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],n[7]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"lineTo":this.lineTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);break;case"circle":this.circle(n[0],n[1],n[2],n[3]);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"triangle":this.triangle(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,s,o){this.ensurePoly();var u=this.currentPoly;return Vs(u.points,u.lastX,u.lastY,t,e,i,r,n,a,s,o),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.lineTo=function(t,e){this.ensurePoly();var i=this.currentPoly.points,r=i[i.length-2],n=i[i.length-1];return r===t&&n===e||i.push(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new zs(t,e,i,r),n),this},e.circle=function(t,e,i,r){return this.drawShape(new Xs(t,e,i),r),this},e.polyStar=function(t,e,i,r,n,a,s){return this.drawShape(new Us(t,e,i,r,n,a),s),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new Gs(t,e,i,r,n),a),this},e.triangle=function(t,e,i,r,n,a,s){return this.drawShape(new js(t,e,i,r,n,a),s),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 Ns).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 Ns,this.currentPoly.points.push(0,0))},t}(),Hs=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,s,o){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,s,o]}),this.dirty=!0,this},e.lineTo=function(t,e){return this.instructions.push({action:"lineTo",data:[t,e]}),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.circle=function(t,e,i,r){return this.instructions.push({action:"circle",data:[t,e,i,r]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,a){return this.instructions.push({action:"rect",data:[t,e,i,r,n,a]}),this.dirty=!0,this},e.triangle=function(t,e,i,r,n,a,s){return this.instructions.push({action:"triangle",data:[t,e,i,r,n,a,s]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,a,s){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,a,s]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},xr(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new Ws(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();!function(t){t[t.EveryUpdate=0]="EveryUpdate",t[t.Manual=1]="Manual"}(Bs||(Bs={}));var Ys=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).items=[],e.state=wu.Stopped,e.updateMode=0,e.playOnStart=!1,e.endBehavior=ce.forward,e.time=0,e.lastTime=0,e.sceneBindings=[],e.timelineAsset=null,e._timelineInstance=null,e.nestedCompositions=[],e}oe(e,t);var i=e.prototype;return i.onStart=function(){this.playOnStart&&this.play()},i.pause=function(){this.state=wu.Paused;for(var t,e=Ze(this.nestedCompositions);!(t=e()).done;){t.value.pause()}},i.play=function(){this.state=wu.Playing;for(var t,e=Ze(this.nestedCompositions);!(t=e()).done;){t.value.play()}},i.stop=function(){this.state=wu.Stopped,this.time=0,this.lastTime=0;for(var t,e=Ze(this.nestedCompositions);!(t=e()).done;){t.value.stop()}},i.getTime=function(){return this.time},i.setTime=function(t){this.time=t},i.onUpdate=function(t){this.state===wu.Playing&&0===this.updateMode&&this.tick(t/1e3)},i.tick=function(t){if(this.timelineInstance){var e=this.time;if(wa(this.lastTime,this.time)&&(e+=t),e>this.item.duration)switch(this.endBehavior){case ce.forward:break;case ce.freeze:e=this.item.duration;break;case ce.restart:e%=this.item.duration;break;case ce.destroy:return void this.item.dispose()}this.timelineInstance.evaluate(e,t),this.lastTime=this.time=e}},i.onEnable=function(){this.item.getDescendants(!1,(function(t){return t.setActive(!0),!1}))},i.onDisable=function(){this.item.getDescendants(!1,(function(t){return t.setActive(!1),!1}))},i.onDestroy=function(){this.item.getDescendants().forEach((function(t){return t.dispose()}))},i.setChildrenRenderOrder=function(t){if(!this.timelineInstance)return t;var i=[];this.collectChildren(this.item,i);for(var r,n=new Set,a=Ze(this.timelineInstance.masterTrackInstances);!(r=a()).done;){var s=r.value;E(s.boundObject,oa)&&n.add(s.boundObject)}for(var o=[],u=0;u<i.length;u++)n.has(i[u])&&o.push(u);for(var h,l=[],c=Ze(this.timelineInstance.masterTrackInstances);!(h=c()).done;){var f=h.value;E(f.boundObject,oa)&&l.push(f.boundObject)}for(var d=0;d<o.length&&d<l.length;d++)i[o[d]]=l[d];for(var p,m=Ze(i);!(p=m()).done;){var v=p.value,y=t++;v.isManuallySetRenderOrder||v.setRendererComponentOrder(y);var g=v.getComponent(e);g&&(t=g.setChildrenRenderOrder(t))}return t},i.collectChildren=function(t,e){for(var i,r=Ze(t.children);!(i=r()).done;){var n=i.value;e.push(n),oa.isComposition(n)||this.collectChildren(n,e)}},i.fromData=function(e){t.prototype.fromData.call(this,e),this._timelineInstance=null},xr(e,[{key:"timelineInstance",get:function(){if(!this._timelineInstance&&this.timelineAsset){this._timelineInstance=new ec(this.timelineAsset,this.sceneBindings),this.nestedCompositions=[];for(var t,i=Ze(this._timelineInstance.masterTrackInstances);!(t=i()).done;){var r=t.value.boundObject;if(E(r,oa)&&oa.isComposition(r)){var n=r.getComponent(e);n.updateMode=1,this.nestedCompositions.push(n)}}}return this._timelineInstance}}]),e}(br);_([ti()],Ys.prototype,"items",void 0),_([ti()],Ys.prototype,"sceneBindings",void 0),_([ti()],Ys.prototype,"timelineAsset",void 0),Ys=_([$e("CompositionComponent")],Ys);var Zs=function(t){function e(e){var i;return(i=t.call(this,e)||this).getHitTestParams=function(t){var e=i.transform.getWorldMatrix();i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area,clipMasks:i.frameClipMasks}},i}oe(e,t);var i=e.prototype;return i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e=0;e<this.materials.length;e++){var i=this.materials[e];t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),i,e)}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++){var i=this.materials[e];this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),i,t,e)}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData("aPos");if(t){var e=Ca(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.mask;i&&this.maskManager.setMaskOptions(this.engine,i)},e}(Hn);_([ti()],Zs.prototype,"geometry",void 0);var qs=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}oe(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 W;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}(Zs);qs=_([$e(ze.EffectComponent)],qs);var Ks=new X(0,0,0),Qs=new X(0,0,0),Js=function(){this.target=null,this.weight=1},$s=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).positionAtRest=new X(0,0,0),e.positionOffset=new X(0,0,0),e.weight=1,e.constrainX=!0,e.constrainY=!0,e.constrainZ=!0,e.targets=[],e}oe(e,t);var i=e.prototype;return i.onStart=function(){var t=this.item.transform.getWorldPosition();this.positionAtRest.copyFrom(t)},i.onUpdate=function(t){if(0!==this.targets.length){Ks.set(0,0,0);for(var e,i=0,r=Ze(this.targets);!(e=r()).done;){var n=e.value;if(n.target){var a=n.target.transform.getWorldPosition(),s=n.weight;Ks.x+=a.x*s,Ks.y+=a.y*s,Ks.z+=a.z*s,i+=s}}i>0&&(Ks.x/=i,Ks.y/=i,Ks.z/=i),Ks.x+=this.positionOffset.x,Ks.y+=this.positionOffset.y,Ks.z+=this.positionOffset.z,Qs.set(this.lerp(this.positionAtRest.x,Ks.x,this.weight),this.lerp(this.positionAtRest.y,Ks.y,this.weight),this.lerp(this.positionAtRest.z,Ks.z,this.weight)),Ks.copyFrom(this.item.transform.getWorldPosition());var o=this.constrainX?Qs.x:Ks.x,u=this.constrainY?Qs.y:Ks.y,h=this.constrainZ?Qs.z:Ks.z;this.item.transform.setWorldPosition(o,u,h)}},i.addTarget=function(t,e){void 0===e&&(e=1);var i=new Js;i.target=t,i.weight=Math.max(0,Math.min(1,e)),this.targets.push(i)},i.removeTarget=function(t){var e=this.targets.findIndex((function(e){return e.target===t}));-1!==e&&this.targets.splice(e,1)},i.clearTargets=function(){this.targets=[]},i.setPositionOffset=function(t,e,i){this.positionOffset.set(t,e,i)},i.setWeight=function(t){this.weight=Math.max(0,Math.min(1,t))},i.lerp=function(t,e,i){return t+(e-t)*i},i.fromData=function(e){t.prototype.fromData.call(this,e),this.positionAtRest.copyFrom(e.positionAtRest),this.positionOffset.copyFrom(e.positionOffset),this.weight=e.weight,this.constrainX=e.constrainX,this.constrainY=e.constrainY,this.constrainZ=e.constrainZ,this.targets=[];for(var i,r=Ze(e.targets);!(i=r()).done;){var n=i.value,a=new Js;a.target=this.engine.findObject(n.target),a.weight=n.weight,this.targets.push(a)}},e}(br);$s=_([$e("PositionConstraint")],$s);var to=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 oe(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(br);_([ti()],to.prototype,"bloom",void 0),_([ti()],to.prototype,"vignette",void 0),_([ti()],to.prototype,"tonemapping",void 0),_([ti()],to.prototype,"colorAdjustments",void 0),to=_([$e(ze.PostProcessVolume)],to);var eo,io,ro="effects-internal-copy",no="effects-internal-copy-mesh",ao="\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}",so="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(t){t[t.Nearest=0]="Nearest",t[t.Linear=1]="Linear"}(eo||(eo={})),function(t){t[t.RGBA32=0]="RGBA32",t[t.RGBAHalf=1]="RGBAHalf"}(io||(io={}));var oo,uo,ho=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){},xr(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),lo=0,co=1e3,fo=3e3;!function(t){t[t.none=0]="none",t[t.color=1]="color",t[t.stencil_8_opaque=2]="stencil_8_opaque",t[t.depth_16_opaque=3]="depth_16_opaque",t[t.depth_stencil_opaque=4]="depth_stencil_opaque",t[t.depth_16_texture=5]="depth_16_texture",t[t.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture"}(oo||(oo={})),function(t){t[t.store=0]="store",t[t.clear=2]="clear"}(uo||(uo={}));var po,mo=function(){function t(t,e){if(this.destroyed=!1,e){var i=e.texture,r=e.size;if(E(i,cn))this.texture=i,this.externalTexture=!0;else if(i){var n=i.wrapT,a=i.wrapS,s=i.minFilter,o=i.magFilter,u=i.internalFormat,h=i.format,l=void 0===h?Rr.RGBA:h,c=i.type,f=void 0===c?Rr.UNSIGNED_BYTE:c;this.externalTexture=!1,this.textureOptions={size:r,format:l,type:f,internalFormat:u||l,wrapT:n,wrapS:a,minFilter:s,magFilter:o,name:e.name},this.texture=cn.create(t,gi({},this.textureOptions,{sourceType:Mr.framebuffer,data:{width:r[0],height:r[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},xr(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}();!function(t){t[t.force=0]="force",t[t.keep=1]="keep",t[t.keepExternal=2]="keepExternal",t[t.destroy=0]="destroy"}(po||(po={}));var vo,yo=1,go=function(){function t(t){this.priority=0,this.name="RenderPass"+yo++,this.meshes=[],this.disposed=!1,this.framebuffer=null,this.renderer=t}var e=t.prototype;return e.addMesh=function(t){ft(this.meshes,t)},e.removeMesh=function(t){N(this.meshes,t)},e.configure=function(t){},e.execute=function(t){},e.onCameraCleanup=function(t){},e.getViewport=function(){var t,e=null==(t=this.framebuffer)?void 0:t.viewport;if(e)return e;var i=this.renderer;return i?[0,0,i.getWidth(),i.getHeight()]:[0,0,0,0]},e.dispose=function(t){if(!this.disposed){var e=(null==t?void 0:t.meshes)||void 0;e!==_t.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0,this.disposed=!0}},xr(t,[{key:"isDisposed",get:function(){return this.disposed}},{key:"viewport",get:function(){return this.getViewport()}}]),t}(),xo=function(t){function e(e){var i;return(i=t.call(this,e)||this).useRenderTarget=!1,i.priority=1e3,i.name="DrawObjectPass",i}oe(e,t);var i=e.prototype;return i.setup=function(t){this.useRenderTarget=t},i.configure=function(t){this.useRenderTarget&&(this.framebuffer=t.getTemporaryRT("DrawObjectPass",t.getWidth(),t.getHeight(),16,eo.Linear,io.RGBAHalf),t.setFramebuffer(this.framebuffer))},i.execute=function(t){this.useRenderTarget&&t.clear({colorAction:Ar.clear,depthAction:Ar.clear,stencilAction:Ar.clear}),this.meshes.sort((function(t,e){return t.priority-e.priority})),t.renderMeshes(this.meshes)},i.onCameraCleanup=function(t){this.useRenderTarget&&this.framebuffer&&t.releaseTemporaryRT(this.framebuffer)},e}(go),bo=((vo={})[Rr.FLOAT]=Float32Array.BYTES_PER_ELEMENT,vo[Rr.INT]=Int32Array.BYTES_PER_ELEMENT,vo[Rr.SHORT]=Int16Array.BYTES_PER_ELEMENT,vo[Rr.BYTE]=Int8Array.BYTES_PER_ELEMENT,vo),To=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}oe(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(ii);function Eo(t){return t===Rr.INT?new Int32Array(0):t===Rr.SHORT?new Int16Array(0):new Float32Array(0)}var _o=1,wo=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,a=i.geometry,s=i.name,o=void 0===s?"<unnamed>":s,u=i.priority,h=void 0===u?0:u,l=i.worldMatrix,c=void 0===l?Sn.fromIdentity():l;r.id="Mesh"+_o++,r.name=o,r.geometry=a,r.material=n,r.priority=h,r.worldMatrix=c}else r.id="Mesh"+_o++,r.name="<unnamed>",r.worldMatrix=Sn.fromIdentity(),r._priority=0;return r}oe(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!==_t.keep&&this.material.dispose(),this.material=t},i.restore=function(){},i.dispose=function(e){this.destroyed||((null==e?void 0:e.geometries)!==_t.keep&&this.geometry.dispose(),(null==e?void 0:e.material)!==_t.keep&&this.material.dispose(),this.destroyed=!0,void 0!==this.engine&&this.engine.removeMesh(this),t.prototype.dispose.call(this))},xr(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Hn),So="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.;}",Co="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);}}",Ao="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;}",Mo="#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",Io="#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;}}",Ro="#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;}",Oo="#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.;}",Po="#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",No="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",Lo="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);}",Fo="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);}",Vo="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);}",ko="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);}",Do="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);}",zo={},Bo=function(){function t(){}return t.registerInclude=function(t,e){zo[t]&&wt.warn('The "'+t+'" shader include already exist.'),zo[t]=e},t.unRegisterInclude=function(t){delete zo[t]},t.unRegisterAllIncludes=function(){Object.keys(zo).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var i=e.level,r=e.shaderType,n=e.shader,a=e.macros,s=e.removeVersion,o=t.genMacroString(i,a),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===Tr.fragment)),s?o+h:u+o+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=zo[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 a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[1])}return i.forEach((function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},t}(),Uo=function(t){function e(e,i){var r;void 0===i&&(i=4),(r=t.call(this,e)||this).tempRTs=[],r.iterationCount=i;var n=r.renderer.engine;return r.thresholdMaterial=zn.create(n,{shader:{vertex:No,fragment:Do,glslVersion:Rn.GLSL1}}),r.thresholdMaterial.blending=!1,r.thresholdMaterial.depthTest=!1,r.thresholdMaterial.culling=!1,r.downSampleHMaterial=zn.create(n,{shader:{vertex:No,fragment:Fo,glslVersion:Rn.GLSL1}}),r.downSampleHMaterial.blending=!1,r.downSampleHMaterial.depthTest=!1,r.downSampleHMaterial.culling=!1,r.downSampleVMaterial=zn.create(n,{shader:{vertex:No,fragment:Vo,glslVersion:Rn.GLSL1}}),r.downSampleVMaterial.blending=!1,r.downSampleVMaterial.depthTest=!1,r.downSampleVMaterial.culling=!1,r.upSampleMaterial=zn.create(n,{shader:{vertex:No,fragment:ko,glslVersion:Rn.GLSL1}}),r.upSampleMaterial.blending=!1,r.upSampleMaterial.depthTest=!1,r.upSampleMaterial.culling=!1,r.priority=5e3,r.name="BloomPass",r}oe(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture},i.execute=function(t){var e,i,r,n=t.getWidth(),a=t.getHeight(),s=null!=(r=null==(i=t.renderingData.currentFrame.globalVolume)||null==(e=i.bloom)?void 0:e.threshold)?r:1;this.thresholdRT=t.getTemporaryRT("_BloomThreshold",n,a,0,eo.Linear,io.RGBAHalf),this.thresholdMaterial.setFloat("_Threshold",s),t.blit(this.mainTexture,this.thresholdRT,this.thresholdMaterial);for(var o=this.thresholdRT.getColorTextures()[0],u=0;u<this.iterationCount;u++){var h=Math.floor(n/Math.pow(2,u+1)),l=Math.floor(a/Math.pow(2,u+1)),c=t.getTemporaryRT("_BloomDownH"+u,h,l,0,eo.Linear,io.RGBAHalf);this.downSampleHMaterial.setVector2("_TextureSize",Wo(o)),t.blit(o,c,this.downSampleHMaterial);var f=t.getTemporaryRT("_BloomDownV"+u,h,l,0,eo.Linear,io.RGBAHalf);this.downSampleVMaterial.setVector2("_TextureSize",Wo(c.getColorTextures()[0])),t.blit(c.getColorTextures()[0],f,this.downSampleVMaterial),t.releaseTemporaryRT(c),this.tempRTs.push(f),o=f.getColorTextures()[0]}t.releaseTemporaryRT(this.thresholdRT);for(var d=this.iterationCount-1;d>0;d--){var p=Math.floor(n/Math.pow(2,d-1)),m=Math.floor(a/Math.pow(2,d-1)),v=t.getTemporaryRT("_BloomUp"+d,p,m,0,eo.Linear,io.RGBAHalf),y=this.tempRTs[d-1].getColorTextures()[0];this.upSampleMaterial.setTexture("_GaussianDownTex",y),this.upSampleMaterial.setVector2("_GaussianDownTextureSize",Wo(y)),t.blit(o,v,this.upSampleMaterial),o=v.getColorTextures()[0],this.tempRTs.push(v)}t.setFramebuffer(this.tempRTs[this.tempRTs.length-1])},i.onCameraCleanup=function(t){for(var e=0;e<this.tempRTs.length;e++)t.releaseTemporaryRT(this.tempRTs[e]);this.tempRTs=[]},i.dispose=function(e){this.thresholdMaterial.dispose(),this.downSampleHMaterial.dispose(),this.downSampleVMaterial.dispose(),this.upSampleMaterial.dispose(),t.prototype.dispose.call(this,e)},e}(go),Go=function(t){function e(e,i){var r,n="PostProcess",a=(r=t.call(this,e)||this).renderer.engine;r.sceneTextureHandle=i||new mo(a);var s=To.create(a,{name:n,mode:Rr.TRIANGLE_STRIP,attributes:{aPos:{type:Rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=zn.create(a,{name:n,shader:{vertex:No,fragment:Lo,glslVersion:Rn.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,r.screenMesh=wo.create(a,{name:n,geometry:s,material:o,priority:0}),r.priority=5e3,r.name="ToneMappingPass",r}oe(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:Ar.clear,depthAction:Ar.clear,stencilAction:Ar.clear});var e=t.renderingData.currentFrame.globalVolume,i=gi({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),r=gi({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=gi({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),a=gi({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 j(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new X(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(a.active)),t.renderMeshes([this.screenMesh])},e}(go),jo=1,Xo=function(){function t(t){this.disposed=!1,this.postProcessingEnabled=!1,this.enableHDR=!0;var e=t.camera,i=t.renderer,r=t.editorTransform,n=void 0===r?[1,1,0,0]:r,a=t.globalVolume,s=t.postProcessingEnabled,o=void 0!==s&&s,u=i.engine;if(a&&(this.globalVolume=a),this.postProcessingEnabled=o,this.globalUniforms=new Yo,this.renderer=i,o&&this.enableHDR&&!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");this.drawObjectPass=new xo(i);var h=[this.drawObjectPass];if(this.setRenderPasses(h),o){var l=new mo(u),c=new Uo(i,7);c.sceneTextureHandle=l,this.addRenderPass(c);var f=new Go(i,l);this.addRenderPass(f)}this.name="RenderFrame"+jo++,this.camera=e,this.editorTransform=W.fromArray(n)}var e=t.prototype;return e.setup=function(){this.drawObjectPass.setup(this.postProcessingEnabled)},e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){var e=(null==t?void 0:t.passes)?t.passes:void 0;e!==_t.keep&&this.renderPasses.forEach((function(t){t.dispose(e)})),this.renderPasses.length=0,this.disposed=!0},e.setRenderPasses=function(t){this.renderPasses=t.slice()},e.addRenderPass=function(t){this.renderPasses.push(t)},e.removeRenderPass=function(t){N(this.renderPasses,t)},xr(t,[{key:"isDisposed",get:function(){return this.disposed}}]),t}();function Wo(t){return t?new j(t.getWidth(),t.getHeight()):new j}var Ho,Yo=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Zo=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 xr(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),qo=function(){function t(t){this.engine=t,this.temporaryRTs=[],this.currentFrame=0,this.maxUnusedFrames=4}var e=t.prototype;return e.flush=function(t,e){void 0===t&&(t=!1),void 0===e&&(e=-1),this.currentFrame++;for(var i=e>=0?e:this.maxUnusedFrames,r=0;r<this.temporaryRTs.length;r++){var n=this.temporaryRTs[r];!n.isOccupied&&(t||this.currentFrame-n.lastFrameReleased>i)&&(n.RT.dispose(),this.temporaryRTs.splice(r--,1))}},e.get=function(t,e,i,r,n,a){void 0===r&&(r=0),void 0===n&&(n=eo.Linear),void 0===a&&(a=io.RGBA32);for(var s,o,u,h=e+"_"+i+"_"+r+"_"+n+"_"+a,l=Ze(this.temporaryRTs);!(s=l()).done;){var c=s.value;if(!c.isOccupied&&c.descriptionHash===h)return c.isOccupied=!0,c.RT.name=t,c.RT}var f=oo.none;n===eo.Linear?o=Rr.LINEAR:n===eo.Nearest&&(o=Rr.NEAREST),a===io.RGBA32?u=Rr.UNSIGNED_BYTE:a===io.RGBAHalf&&(u=Rr.HALF_FLOAT),0===r?f=oo.none:16===r?f=oo.depth_stencil_opaque:24===r&&(f=oo.depth_24_stencil_8_texture);var d=cn.create(this.engine,{sourceType:Mr.framebuffer,minFilter:o,magFilter:o,internalFormat:Rr.RGBA,format:Rr.RGBA,type:u}),p={RT:ho.create({name:t,storeAction:{},viewport:[0,0,e,i],attachments:[d],depthStencilAttachment:{storageType:f}},this.engine.renderer),lastFrameReleased:0,descriptionHash:h,isOccupied:!0};return this.temporaryRTs.push(p),p.RT},e.release=function(t){for(var e,i=Ze(this.temporaryRTs);!(e=i()).done;){var r=e.value;if(r.RT===t){r.isOccupied=!1,r.lastFrameReleased=this.currentFrame;break}}},e.dispose=function(){for(var t,e=Ze(this.temporaryRTs);!(t=e()).done;){t.value.RT.dispose()}},t}(),Ko="function"==typeof a,Qo=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.isCompressedFormatSupported=function(t){return!!this.compressTextureCapabilityList.get(t)},e.setupCapability=function(t){var e,i=Ko&&E(t,a)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),s=t.getExtension("WEBGL_depth_texture"),o=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),s&&(this.UNSIGNED_INT_24_8=s.UNSIGNED_INT_24_8_WEBGL),r&&!o&&(o=Jo(t,t.HALF_FLOAT)),r&&!u&&(u=Jo(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=r||t.getExtension("OES_texture_float")?t.FLOAT:0,l=r?a.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0;this.compressTextureCapabilityList=new Map([["WEBGL_compressed_texture_astc",!!t.getExtension("WEBGL_compressed_texture_astc")],["WEBKIT_WEBGL_compressed_texture_astc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_astc")],["WEBGL_compressed_texture_etc",!!t.getExtension("WEBGL_compressed_texture_etc")],["WEBKIT_WEBGL_compressed_texture_etc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_etc")],["WEBGL_compressed_texture_etc1",!!t.getExtension("WEBGL_compressed_texture_etc1")],["WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBGL_compressed_texture_pvrtc")||!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["WEBKIT_WEBGL_compressed_texture_pvrtc",!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")],["EXT_sRGB",!!t.getExtension("EXT_sRGB")]]);var c,f,d={floatTexture:h,halfFloatTexture:l,maxSample:r?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),halfFloatLinear:o,floatLinear:u,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),ktx2Support:(c=this.compressTextureCapabilityList,f=c.get("WEBGL_compressed_texture_astc")||c.get("WEBKIT_WEBGL_compressed_texture_astc"),!!f),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!s,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=d,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw new Error("Draw multiple color buffers not available.");var s=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];s?t.framebufferTexture2D(e,s,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.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.")},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},xr(t,[{key:"isWebGL2",get:function(){return 2===this.level}}]),t}();function Jo(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(t){t.astc="WEBGL_compressed_texture_astc",t.astc_webkit="WEBKIT_WEBGL_compressed_texture_astc",t.etc="WEBGL_compressed_texture_etc",t.etc_webkit="WEBKIT_WEBGL_compressed_texture_etc",t.etc1="WEBGL_compressed_texture_etc1",t.pvrtc="WEBGL_compressed_texture_pvrtc",t.pvrtc_webkit="WEBKIT_WEBGL_compressed_texture_pvrtc",t.sRGB="EXT_sRGB"}(Ho||(Ho={}));var $o,tu=function(){function t(t){this.engine=t,this.currentFramebuffer=null,this.disposed=!1,this.blitGeometry=null,this.blitMaterial=null}var e=t.prototype;return e.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},e.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},e.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},e.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},e.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},e.getFramebuffer=function(){return this.currentFramebuffer},e.setFramebuffer=function(t){t?(this.currentFramebuffer=t,this.currentFramebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.currentFramebuffer=null,this.engine.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},e.setViewport=function(t,e,i,r){this.engine.viewport(t,e,i,r)},e.clear=function(t){this.engine.clear(t)},e.getWidth=function(){return this.engine.getWidth()},e.getHeight=function(){return this.engine.getHeight()},e.getShaderLibrary=function(){return this.engine.getShaderLibrary()},e.renderRenderFrame=function(t){var e,i=t,r=i.renderPasses;if(this.disposed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=i.renderer.engine.getShaderLibrary())||e.compileAllShaders(),i.setup(),this.setFramebuffer(null);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),ct(r);for(var a,s=Ze(r);!(a=s()).done;){var o=a.value;this.renderRenderPass(o)}for(var u,h=Ze(r);!(u=h()).done;){u.value.onCameraCleanup(this)}}},e.renderRenderPass=function(t){this.renderingData.currentPass=t,t.configure(this),t.execute(this)},e.renderMeshes=function(t){for(var e,i=Ze(t);!(e=i()).done;){e.value.render(this)}},e.drawGeometry=function(t,e,i,r){void 0===r&&(r=0),this.engine.drawGeometry(t,e,i,r)},e.getTemporaryRT=function(t,e,i,r,n,a){return this.engine.renderTargetPool.get(t,e,i,r,n,a)},e.releaseTemporaryRT=function(t){this.engine.renderTargetPool.release(t)},e.blit=function(t,e,i){this.blitGeometry||(this.blitGeometry=To.create(this.engine,{mode:Rr.TRIANGLE_STRIP,attributes:{aPos:{type:Rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4})),this.blitMaterial||(this.blitMaterial=zn.create(this.engine,{shader:{vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos, 0.0, 1.0);\n vTex = (aPos + vec2(1.0)) / 2.0;\n}",fragment:"\nprecision mediump float;\nvarying vec2 vTex;\nuniform sampler2D _MainTex;\nvoid main(){\n gl_FragColor = texture2D(_MainTex, vTex);\n}"}}),this.blitMaterial.blending=!1,this.blitMaterial.depthTest=!1,this.blitMaterial.culling=!1);var r=i||this.blitMaterial;r.setTexture("_MainTex",t);var n=this.currentFramebuffer;if(e){var a=e.viewport,s=a[0],o=a[1],u=a[2],h=a[3];this.setFramebuffer(e),this.setViewport(s,o,u,h)}else this.setFramebuffer(null),this.setViewport(0,0,this.getWidth(),this.getHeight());this.drawGeometry(this.blitGeometry,Sn.IDENTITY,r),this.setFramebuffer(n)},e.dispose=function(){var t,e;this.disposed||(null==(t=this.blitGeometry)||t.dispose(),this.blitGeometry=null,null==(e=this.blitMaterial)||e.dispose(),this.blitMaterial=null,this.disposed=!0)},e.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},t.create=function(e){return new t(e)},xr(t,[{key:"renderingData",get:function(){return this.engine.renderingData}}]),t}(),eu=function(){function t(t){this.engine=t,this.graphicsPath=new Hs,this.vertices=[],this.colors=[],this.indices=[],this.lineStyle={width:1,alignment:.5,cap:Ne.Butt,join:Le.Miter,miterLimit:10},this.transformStack=[],this.currentTransform=An.fromIdentity(),this.geometry=To.create(this.engine,{attributes:{aPos:{type:Rr.FLOAT,size:2,data:new Float32Array([-.5,.5,-.5,-.5,.5,.5,.5,-.5])},aColor:{type:Rr.FLOAT,size:4,data:new Float32Array([1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])},aUV:{size:2,offset:0,releasable:!0,type:Rr.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:Rr.TRIANGLES,drawCount:6}),this.material=zn.create(this.engine,{shader:{vertex:"attribute vec2 aPos;\n attribute vec4 aColor;\n varying vec4 vColor;\n\n uniform mat4 effects_MatrixVP;\n void main() {\n vColor = aColor;\n gl_Position = effects_MatrixVP * vec4(aPos, 0.0, 1.0);\n }",fragment:"precision mediump float;\n varying vec4 vColor;\n void main() {\n vec4 color = vColor;\n color.rgb *= color.a;\n gl_FragColor = color;\n }"}}),this.material.depthTest=!1,this.material.depthMask=!1,this.material.blending=!0}var e=t.prototype;return e.begin=function(){this.indices.length=0,this.vertices.length=0,this.colors.length=0,this.transformStack=[],this.currentTransform=An.fromIdentity();var t=this.engine.canvas.getBoundingClientRect(),e=t.width,i=t.height,r=new Sn(2/e,0,0,0,0,2/i,0,0,0,0,-1,0,-1,-1,0,1);this.material.setMatrix("effects_MatrixVP",r)},e.pushTransform=function(t){this.transformStack.push(this.currentTransform.clone()),this.currentTransform=this.currentTransform.premultiply(t)},e.popTransform=function(){var t=this.transformStack.pop();t?this.currentTransform=t:console.warn("Render2D: 变换栈为空,无法弹出")},e.end=function(){if(0!==this.currentVertexCount&&0!==this.currentIndexCount){var t=new Float32Array(this.vertices),e=new Float32Array(this.colors),i=new Uint16Array(this.indices);this.geometry.setAttributeData("aPos",t),this.geometry.setAttributeData("aColor",e),this.geometry.setIndexData(i),this.geometry.setDrawCount(this.currentIndexCount),this.engine.renderer.drawGeometry(this.geometry,Sn.IDENTITY,this.material)}},e.drawLines=function(t,e,i){if(void 0===e&&(e=H.WHITE),void 0===i&&(i=1),!t||t.length<4||t.length%2!=0)console.warn("drawLines: 至少需要2个点(4个数值), 且数组长度必须为偶数");else{var r=t.length/2,n=t[0]===t[t.length-2]&&t[1]===t[t.length-1],a=n?r-1:r;this.graphicsPath.clear(),this.graphicsPath.moveTo(t[0],t[1]);for(var s=1;s<a;s++)this.graphicsPath.lineTo(t[2*s],t[2*s+1]);this.buildShapeLine(this.graphicsPath.shapePath,e,i,n)}},e.drawLine=function(t,e,i,r,n,a){void 0===n&&(n=H.WHITE),void 0===a&&(a=1),this.graphicsPath.clear(),this.graphicsPath.moveTo(t,e),this.graphicsPath.lineTo(i,r),this.buildShapeLine(this.graphicsPath.shapePath,n,a,closed)},e.drawBezier=function(t,e,i,r,n,a,s,o,u,h){void 0===u&&(u=H.WHITE),void 0===h&&(h=1),this.graphicsPath.clear(),this.graphicsPath.moveTo(t,e),this.graphicsPath.bezierCurveTo(i,r,n,a,s,o),this.buildShapeLine(this.graphicsPath.shapePath,u,h,!1)},e.drawTriangle=function(t,e,i,r,n,a,s,o){void 0===s&&(s=H.WHITE),void 0===o&&(o=1),this.graphicsPath.clear(),this.graphicsPath.triangle(t,e,i,r,n,a),this.buildShapeLine(this.graphicsPath.shapePath,s,o,!0)},e.drawRectangle=function(t,e,i,r,n,a){void 0===n&&(n=H.WHITE),void 0===a&&(a=1),this.graphicsPath.clear(),this.graphicsPath.rect(t,e,i,r,0),this.buildShapeLine(this.graphicsPath.shapePath,n,a,!0)},e.drawCircle=function(t,e,i,r,n){void 0===r&&(r=H.WHITE),void 0===n&&(n=1),this.graphicsPath.clear(),this.graphicsPath.circle(t,e,i),this.buildShapeLine(this.graphicsPath.shapePath,r,n,!0)},e.fillTriangle=function(t,e,i,r,n,a,s){void 0===s&&(s=H.WHITE),this.graphicsPath.clear(),this.graphicsPath.triangle(t,e,i,r,n,a),this.buildShape(this.graphicsPath.shapePath,s)},e.fillRectangle=function(t,e,i,r,n){void 0===n&&(n=H.WHITE),this.graphicsPath.clear(),this.graphicsPath.rect(t,e,i,r,0),this.buildShape(this.graphicsPath.shapePath,n)},e.fillCircle=function(t,e,i,r){void 0===r&&(r=H.WHITE),this.graphicsPath.clear(),this.graphicsPath.circle(t,e,i),this.buildShape(this.graphicsPath.shapePath,r)},e.dispose=function(){this.geometry.dispose(),this.material.dispose()},e.buildShape=function(t,e){for(var i,r=Ze(t.shapePrimitives);!(i=r()).done;){var n=i.value.shape,a=[],s=this.indices.length,o=this.vertices.length/2;n.build(a),n.triangulate(a,this.vertices,o,this.indices,s),this.applyTransformAndColor(o,this.vertices.length/2-o,e)}},e.buildShapeLine=function(t,e,i,r){void 0===r&&(r=!1);for(var n,a=Ze(t.shapePrimitives);!(n=a()).done;){var s=n.value.shape,o=[];this.indices.length;var u=this.vertices.length/2;s.build(o),this.lineStyle.width=i,As(o,this.lineStyle,!1,r,this.vertices,0,0,this.indices),this.applyTransformAndColor(u,this.vertices.length/2-u,e)}},e.applyTransformAndColor=function(t,e,i){for(var r=0;r<e;r++){var n=2*(t+r),a=4*(t+r);this.applyTransform(this.vertices[n],this.vertices[n+1],this.vertices,n),this.colors[a]=i.r,this.colors[a+1]=i.g,this.colors[a+2]=i.b,this.colors[a+3]=i.a}},e.applyTransform=function(t,e,i,r){void 0===r&&(r=0);var n=this.currentTransform.elements;i[r]=n[0]*t+n[3]*e+n[6],i[r+1]=n[1]*t+n[4]*e+n[7]},xr(t,[{key:"currentVertexCount",get:function(){return this.vertices.length/2}},{key:"currentIndexCount",get:function(){return this.indices.length}}]),t}(),iu=function(t){function e(e){var i;(i=t.call(this,e)||this).visible=!0,i._color=new H(1,1,1,1),i.getHitTestParams=function(t){var e=Sn.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.boundingBoxInfo.setGeometry(i.geometry,e);var n,a=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(a)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===Zt.FRONT,clipMasks:i.frameClipMasks}}},i.renderer={renderMode:ee.MESH,blending:Yt.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:Zt.DOUBLE,mask:0},i.defaultGeometry=To.create(i.engine,{attributes:{aPos:{type:Rr.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:Rr.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:Rr.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var r=zn.create(i.engine,{shader:{fragment:Ao,vertex:Co,shared:!0}});return i.material=r,i.material.setColor("_Color",new H(1,1,1,1)),i.configureMaterial(i.renderer),i}oe(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){E(t,H)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return T((function(){var i;return w(this,(function(r){switch(r.label){case 0:return"string"!=typeof t?[3,2]:[4,cn.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.onUpdate=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!==ee.BILLBOARD&&this.renderer.renderMode!==ee.VERTICAL_BILLBOARD&&this.renderer.renderMode!==ee.HORIZONTAL_BILLBOARD||i.setVector3("_Scale",this.transform.scale)}},i.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t,this),this.draw(t))},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e=0;e<this.materials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.materials[e],t,e)},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle(this.transform.size)},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData("aPos");if(t){var e=Ca(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.texture,a=this.maskManager.maskMode,s=this.material;s.blending=!0,s.depthTest=!0,s.depthMask=i,zr(s,r),Br(s,e),s.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',s.setVector4("_TexOffset",new W(0,0,1,1)),s.setTexture("_MainTex",n);var o=Dr(r),u=new W;return u.x=t.occlusion?+t.transparentOcclusion:1,u.y=o,u.z=t.renderMode,u.w=a,s.setVector4("_TexParams",u),0===u.x||this.maskManager.alphaMaskEnabled?s.enableMacro("ALPHA_CLIP"):s.disableMacro("ALPHA_CLIP"),s},i.draw=function(t){for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.materials[e],e)},i.fromData=function(e){var i;t.prototype.fromData.call(this,e);var r,n,a,s=null!=(i=e.renderer)?i:{},o=e.mask;o&&this.maskManager.setMaskOptions(this.engine,o),this.renderer={renderMode:null!=(r=s.renderMode)?r:ee.MESH,blending:null!=(n=s.blending)?n:Yt.ALPHA,texture:s.texture?this.engine.findObject(s.texture):this.engine.whiteTexture,occlusion:!!s.occlusion,transparentOcclusion:!!s.transparentOcclusion||this.maskManager.maskMode===Er.MASK,side:null!=(a=s.side)?a:Zt.DOUBLE,mask:this.maskManager.getRefValue()},this.configureMaterial(this.renderer)},xr(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(Hn);!function(t){t[t.Fill=0]="Fill",t[t.Fit=1]="Fit",t[t.Crop=2]="Crop",t[t.Tile=3]="Tile"}($o||($o={}));var ru=function(t){function e(e){var i;(i=t.call(this,e)||this).shapeDirty=!0,i.materialDirty=!0,i.graphicsPath=new Hs,i.fills=[],i.strokeAttributes={width:1,alignment:.5,cap:Ne.Butt,join:Le.Miter,miterLimit:10},i.strokeWidth=1,i.strokeCap=Ne.Butt,i.strokeJoin=Le.Miter,i.strokes=[],i.fillMaterials=[],i.strokeMaterials=[],i.getHitTestParams=function(t){var e=Sn.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix());if(t){i.boundingBoxInfo.setGeometry(i.geometry,e);var r=i.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{behavior:0,type:r.type,triangles:r.area,backfaceCulling:i.rendererOptions.side===Zt.FRONT,clipMasks:i.frameClipMasks}}},i.rendererOptions={renderMode:ee.MESH,blending:Yt.ALPHA,texture:i.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:Zt.DOUBLE,mask:0};var r={type:Re.Solid,color:new H(1,1,1,1)};i.strokes.push(r);var n={type:Re.Solid,color:new H(1,1,1,1)};return i.fills.push(n),i.shapeAttributes={type:Pe.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i.geometry=To.create(i.engine,{attributes:{aPos:{type:Rr.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:Rr.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:Rr.TRIANGLES,drawCount:6}),i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),i}oe(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){if(this.shapeDirty){var e=this.computeScreenScale();this.buildPath(this.shapeAttributes,e),this.buildGeometryFromPath(this.graphicsPath.shapePath,e),this.shapeDirty=!1}this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.draw(t)},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=0;e<this.fillMaterials.length;e++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[e],t,0);for(var i=0;i<this.strokeMaterials.length;i++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[i],t,1)}},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.boundingBoxInfo.setGeometry(this.geometry,t),this.boundingBoxInfo.getBoundingBoxTriangle()},i.getBoundingBoxInfo=function(){var t=this.geometry.getAttributeData("aPos");if(t){var e=Ca(t,0,t.length/3);e.minimum.x*=this.transform.size.x,e.minimum.y*=this.transform.size.y,e.maximum.x*=this.transform.size.x,e.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(e.minimum,e.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},i.buildGeometryFromPath=function(t,e){var i=t.shapePrimitives,r=[],n=[];if(this.fills.length>0)for(var a,s=Ze(i);!(a=s()).done;){var o=a.value.shape,u=[],h=n.length,l=r.length/2;o.build(u,e),o.triangulate(u,r,l,n,h)}var c=n.length;if(this.strokes.length>0)for(var f,d=Ze(i);!(f=d()).done;){var p=f.value.shape,m=[],v=this.strokeAttributes;v.cap=this.strokeCap,v.join=this.strokeJoin,v.width=this.strokeWidth;var y=!0;this.shapeAttributes.type===Pe.Custom&&(y=p.closePath),p.build(m,e),As(m,v,!1,y,r,0,0,n)}var g=n.length-c,x=r.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<n.length)&&(E=new Uint16Array(n.length));for(var _=Number.MAX_VALUE,w=Number.MAX_VALUE,S=Number.MIN_VALUE,C=Number.MIN_VALUE,A=0;A<x;A++){var M=3*A,I=2*A,R=r[I],O=r[I+1];b[M]=R,b[M+1]=O,b[M+2]=0,_=Math.min(_,R),w=Math.min(w,O),S=Math.max(S,R),C=Math.max(C,O)}for(var P=S-_,N=C-w,L=0;L<x;L++){var F=3*L,V=2*L;T[V]=(b[F]-_)/P,T[V+1]=(b[F+1]-w)/N}E.set(n),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(n.length);var k=this.geometry.subMeshes[0],D=this.geometry.subMeshes[1];k.indexCount=c,D.offset=2*c,D.indexCount=g},i.computeScreenScale=function(){var t=this.item.composition;if(!t)return 1;var i=t.camera;if(!i)return 1;var r=i.getModelViewProjection(e.tempMVP,this.transform.getWorldMatrix()).elements,n=Math.abs(r[15])||1,a=Math.sqrt(r[0]*r[0]+r[1]*r[1])/n,s=Math.sqrt(r[4]*r[4]+r[5]*r[5])/n,o=Math.max(a,s),u=this.engine.canvas.getBoundingClientRect(),h=o*(Math.max(u.width,u.height)/2)*this.engine.pixelRatio;return Math.max(1,Math.min(2e3,h))},i.buildPath=function(t,e){void 0===e&&(e=1),this.graphicsPath.clear();var i=e;switch(t.type){case Pe.Custom:for(var r,n=this.shapeAttributes,a=n.points,s=n.easingIns,o=n.easingOuts,u=Ze(n.shapes);!(r=u()).done;){var h=r.value,l=h.indexes,c=a[l[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var f=1;f<l.length;f++){var d=l[f],p=l[f-1],m=a[d.point],v=a[p.point],y=o[p.easingOut],g=s[d.easingIn];this.graphicsPath.bezierCurveTo(y.x+v.x,y.y+v.y,g.x+m.x,g.y+m.y,m.x,m.y,void 0,i)}if(h.close){var x=l[0],b=l[l.length-1],T=a[x.point],E=a[b.point],_=o[b.easingOut],w=s[x.easingIn];this.graphicsPath.bezierCurveTo(_.x+E.x,_.y+E.y,w.x+T.x,w.y+T.y,T.x,T.y,void 0,i),this.graphicsPath.closePath()}}break;case Pe.Ellipse:var S=t;this.graphicsPath.ellipse(0,0,S.xRadius,S.yRadius);break;case Pe.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case Pe.Star:var A=t;this.graphicsPath.polyStar(A.pointCount,A.outerRadius,A.innerRadius,A.outerRoundness,A.innerRoundness,Ds.Star);break;case Pe.Polygon:var M=t;this.graphicsPath.polyStar(M.pointCount,M.radius,M.radius,M.roundness,M.roundness,Ds.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===Re.Solid)t.color=e.color;else if(e.type===Re.GradientLinear||e.type===Re.GradientAngular||e.type===Re.GradientRadial)this.updateGradientMaterial(t,e.gradientStops,e.startPoint,e.endPoint);else if(e.type===Re.Texture){t.setInt("_ImageScaleMode",e.scaleMode),t.setVector2("_ImageSize",new j(e.texture.getWidth(),e.texture.getHeight()));var i=this.getBoundingBox(),r=i.area[0].p1,n=i.area[1].p2;t.setVector2("_DestSize",new j(r.x-n.x,r.y-n.y)),t.setFloat("_ImageOpacity",e.opacity),t.setFloat("_ImageScalingFactor",e.scalingFactor),t.setTexture("_ImageTex",e.texture);var a=e.textureTransform;t.setMatrix3("_TextureTransform",(new An).scale(a.scale.x,a.scale.y).rotate(a.rotation).translate(a.offset.x,a.offset.y).invert())}},i.updateGradientMaterial=function(t,e,i,r){for(var n,a=[],s=[],o=Ze(e.stops);!(n=o()).done;){var u=n.value,h=u.color;a.push(new W(h.r,h.g,h.b,h.a)),s.push(u.time)}t.setVector4Array("_Colors",a),t.setFloats("_Stops",s),t.setInt("_StopsCount",s.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;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);}}if(_StopsCount>0){finalColor=_Colors[0];for(int i=1;i<_MAX_STOPS;i++){if(i>=_StopsCount)break;float localT=smoothstep(_Stops[i-1],_Stops[i],t);finalColor=mix(finalColor,_Colors[i],localT);}}}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:Rn.GLSL1}},i=zn.create(this.engine,e),r=t,n=r.side,a=r.occlusion,s=r.blending,o=r.texture,u=this.maskManager.maskMode;i.blending=!0,i.depthTest=!0,i.depthMask=a,zr(i,s),Br(i,n),i.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',i.setVector4("_TexOffset",new W(0,0,1,1)),i.setTexture("_ImageTex",o);var h=Dr(s),l=new W;return l.x=r.occlusion?+r.transparentOcclusion:1,l.y=h,l.z=r.renderMode,l.w=u,i.setVector4("_TexParams",l),0===l.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(this.engine,e.mask);var r,n,a,s,o,u=null!=(i=e.renderer)?i:{};this.rendererOptions={renderMode:ee.MESH,blending:null!=(r=u.blending)?r:Yt.ALPHA,texture:u.texture?this.engine.findObject(u.texture):this.engine.whiteTexture,occlusion:!!u.occlusion,transparentOcclusion:!!u.transparentOcclusion||this.maskManager.maskMode===Er.MASK,side:null!=(n=u.side)?n:Zt.DOUBLE,mask:this.maskManager.getRefValue()},this.strokeCap=null!=(a=e.strokeCap)?a:Ne.Butt,this.strokeWidth=null!=(s=e.strokeWidth)?s:1,this.strokeJoin=null!=(o=e.strokeJoin)?o:Le.Miter,this.fills.length=0,this.fillMaterials.length=0;for(var h,l=Ze(e.fills);!(h=l()).done;){var c=h.value;this.fills.push(this.createPaint(c)),this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}this.strokes.length=0,this.strokeMaterials.length=0;for(var f,d=Ze(e.strokes);!(f=d()).done;){var p=f.value;this.strokes.push(this.createPaint(p)),this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}switch(this.materials=[].concat(this.fillMaterials,this.strokeMaterials),e.type){case Pe.Custom:for(var m,v=e,y={type:Pe.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},g=Ze(v.points);!(m=g()).done;){var x=m.value;y.points.push(new j(x.x,x.y))}for(var b,T=Ze(v.easingIns);!(b=T()).done;){var E=b.value;y.easingIns.push(new j(E.x,E.y))}for(var _,w=Ze(v.easingOuts);!(_=w()).done;){var S=_.value;y.easingOuts.push(new j(S.x,S.y))}y.shapes=v.shapes,this.shapeAttributes=y;break;case Pe.Ellipse:var C=e,A={type:Pe.Ellipse,xRadius:C.xRadius,yRadius:C.yRadius};this.shapeAttributes=A;break;case Pe.Rectangle:var M=e,I={type:Pe.Rectangle,width:M.width,height:M.height,roundness:M.roundness};this.shapeAttributes=I;break;case Pe.Star:var R=e,O={type:Pe.Star,pointCount:R.pointCount,innerRadius:R.innerRadius,outerRadius:R.outerRadius,innerRoundness:R.innerRoundness,outerRoundness:R.outerRoundness};this.shapeAttributes=O;break;case Pe.Polygon:var P=e,N={type:Pe.Polygon,pointCount:P.pointCount,radius:P.radius,roundness:P.roundness};this.shapeAttributes=N}},i.createPaint=function(t){var e;switch(t.type){case Re.Solid:e={type:t.type,color:(new H).copyFrom(t.color)};break;case Re.GradientLinear:case Re.GradientAngular:case Re.GradientRadial:e={type:t.type,gradientStops:xs(t.gradientStops),startPoint:(new j).copyFrom(t.startPoint),endPoint:(new j).copyFrom(t.endPoint)};break;case Re.Texture:var i,r,n,a=gi({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 j).copyFrom(a.offset),rotation:a.rotation,scale:(new j).copyFrom(a.scale)}}}return e},i.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},xr(e,[{key:"shape",get:function(){return this.shapeAttributes}}]),e}(Hn);ru.tempMVP=Sn.fromIdentity(),ru=_([$e("ShapeComponent")],ru);var nu,au=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}oe(e,t);var i=e.prototype;return i.onStart=function(){this.effectComponent=this.item.getComponent(qs)},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 a=t;this.loop&&(a>.5&&(a=1-a),a*=2),e=this.startPositionX*(1-a)+a*this.endPositionX,i=this.startPositionY*(1-a)+a*this.endPositionY,r=this.startPositionZ*(1-a)+a*this.endPositionZ}var s=this.effectComponent.material;s.setFloat("_PosX",e*this.amountOfMotion),s.setFloat("_PosY",i*this.amountOfMotion),s.setFloat("_PosZ",r*this.amountOfMotion)}},e}(br);_([ti()],au.prototype,"loop",void 0),_([ti()],au.prototype,"amountOfMotion",void 0),_([ti()],au.prototype,"animationLength",void 0),_([ti()],au.prototype,"mode",void 0),_([ti()],au.prototype,"startPositionX",void 0),_([ti()],au.prototype,"startPositionY",void 0),_([ti()],au.prototype,"startPositionZ",void 0),_([ti()],au.prototype,"endPositionX",void 0),_([ti()],au.prototype,"endPositionY",void 0),_([ti()],au.prototype,"endPositionZ",void 0),_([ti()],au.prototype,"amplitudeX",void 0),_([ti()],au.prototype,"amplitudeY",void 0),_([ti()],au.prototype,"amplitudeZ",void 0),_([ti()],au.prototype,"phaseX",void 0),_([ti()],au.prototype,"phaseY",void 0),_([ti()],au.prototype,"phaseZ",void 0),au=_([$e("Fake3DComponent")],au),function(t){t[t.Circular=0]="Circular",t[t.Linear=1]="Linear"}(nu||(nu={}));var su=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).color=new H(1,1,1,1),e.worldMatrix=new Sn,e.getHitTestParams=function(t){var i=Sn.fromScale(e.transform.size.x,e.transform.size.y,1).premultiply(e.transform.getWorldMatrix());if(t){e.boundingBoxInfo.setGeometry(e.clipGeometry,i);var r=e.boundingBoxInfo.getRawBoundingBoxTriangle();if(r)return{type:r.type,triangles:r.area,clipMasks:e.frameClipMasks}}},e}oe(e,t);var i=e.prototype;return i.onAwake=function(){this.clipGeometry=To.create(this.engine,{attributes:{aPos:{type:Rr.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:Rr.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:Rr.TRIANGLES,drawCount:6});var t=zn.create(this.engine,{shader:{fragment:"\n precision mediump float;\n\n uniform vec4 _Color;\n\n void main() {\n gl_FragColor = _Color;\n }\n ",vertex:"\n precision highp float;\n attribute vec3 aPos;\n uniform mat4 effects_ObjectToWorld;\n uniform mat4 effects_MatrixVP;\n void main() {\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * vec4(aPos, 1.0);\n }\n ",shared:!0}});t.depthTest=!0,t.depthMask=!1,t.setColor("_Color",this.color),this.material=t},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onPreRender=function(){this.setClipRectangle(),this.material.setColor("_Color",this.color)},i.render=function(t){this.maskManager.drawStencilMask(t,this),this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),ou(this.worldMatrix,this.transform.size.x,this.transform.size.y),t.drawGeometry(this.clipGeometry,this.worldMatrix,this.material)},i.onDestroy=function(){this.clipGeometry.dispose(),this.material.dispose()},i.drawStencilMask=function(t){this.isActiveAndEnabled&&(this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),ou(this.worldMatrix,this.transform.size.x,this.transform.size.y),this.maskManager.drawGeometryMask(this.engine.renderer,this.clipGeometry,this.worldMatrix,this.material,t))},i.fromData=function(e){t.prototype.fromData.call(this,e),e.color&&this.color.copyFrom(e.color)},i.setClipRectangle=function(){this.setClipRectangleRecursive(this.item)},i.setClipRectangleRecursive=function(t){for(var e,i=Ze(t.children);!(e=i()).done;){var r=e.value,n=r.getComponent(Hn);n&&P(n.frameClipMasks,this),this.setClipRectangleRecursive(r)}},e}(Hn);function ou(t,e,i){var r=t.elements;r[0]*=e,r[1]*=e,r[2]*=e,r[3]*=e,r[4]*=i,r[5]*=i,r[6]*=i,r[7]*=i}su=_([$e("FrameComponent")],su);var uu=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}oe(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}(br);function hu(t){return hu=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},hu(t)}function lu(t){var e="function"==typeof Map?new Map:void 0;return lu=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return us(t,arguments,hu(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),se(r,t)},lu(t)}uu=_([$e(ze.CameraController)],uu);var cu,fu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(lu(ae)),du="click",pu="touchstart",mu="touchmove",vu="touchend";!function(t){t[t.PointerDown=0]="PointerDown",t[t.PointerUp=1]="PointerUp",t[t.PointerMove=2]="PointerMove"}(cu||(cu={}));var yu=function(){function t(t,e){void 0===e&&(e=!1),this.engine=t,this.allowPropagation=e,this.enabled=!0,this.skipPointerMovePicking=!0,this.handlers={},this.nativeHandlers={},this.target=null}var e=t.prototype;return e.bindListeners=function(t){var e,i,r,n,a,s=this;this.target=t,a=function(t){return t};var o,u="mousedown",h="mousemove",l="mouseup",c="mouseleave",d=function(t,e,i,r,a){void 0===r&&(r=0),void 0===a&&(a=0);var o=0,u=0,h=f.now();if(!s.target)return wt.warn("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:r,dy:a,ts:h,width:0,height:0,origin:t};var l=s.target,c=l.width,d=l.height;if(n){var p=h-n.ts;o=(r-n.dx)/p||0,u=(a-n.dy)/p||0,n={dx:r,dy:a,ts:h}}return{x:e,y:i,vx:o,vy:u,dx:r,dy:a,ts:h,width:c,height:d,origin:t}};at()&&(a=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},u="touchstart",h="touchmove",l="touchend",c="touchcancel"),this.nativeHandlers=((o={})[u]=function(t){if(s.enabled){var o=a(t),u=gu(o);e=u.x,i=u.y,n=r={clientX:o.clientX,clientY:o.clientY,ts:f.now(),x:e,y:i},s.dispatchEvent(pu,d(t,e,i))}},o[h]=function(t){if(r&&s.enabled){var n=gu(a(t));e=n.x,i=n.y,s.dispatchEvent(mu,d(t,e,i,e-r.x,i-r.y))}},o[l]=function(t){if(r&&s.enabled){!s.allowPropagation&&t.cancelable&&(t.preventDefault(),t.stopPropagation());var n=a(t),o=gu(n),u=Math.abs(r.clientX-n.clientX)+Math.abs(r.clientY-n.clientY);e=o.x,i=o.y,u<4&&s.dispatchEvent(du,d(t,e,i)),s.dispatchEvent(vu,d(t,e,i,e-r.x,i-r.y))}r=0},o),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])})),this.addEventListener(du,this.onClick.bind(this)),this.addEventListener(pu,this.onPointerDown.bind(this)),this.addEventListener(vu,this.onPointerUp.bind(this)),this.addEventListener(mu,this.onPointerMove.bind(this))},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach((function(t){return t(e)}))},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),P(i,e),function(){N(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&N(i,e)},e.onClick=function(t){for(var e,i=t.x,r=t.y,n=[],a=Ze(this.engine.compositions);!(e=a()).done;){var s,o=e.value;(s=n).push.apply(s,[].concat(o.hitTest(i,r)))}for(var u,h=Ze(n);!(u=h()).done;){var l=u.value,c=l.item.composition;if(c){var f=gi({},l,{compositionId:c.id,compositionName:c.name});l.item.emit("click",l),c.emit("click",f),this.engine.emit("click",f)}}},e.onPointerDown=function(t){this.handlePointerEvent(t,0)},e.onPointerUp=function(t){this.handlePointerEvent(t,1)},e.onPointerMove=function(t){this.handlePointerEvent(t,2)},e.handlePointerEvent=function(t,e){var i=null,r=t.x,n=t.y,a=t.width,s=t.height;if(2!==e||!this.skipPointerMovePicking)for(var o,u=Ze(this.engine.compositions);!(o=u()).done;){var h=o.value.hitTest(r,n);h.length>0&&(i=h[h.length-1])}var l=new Gn;l.position.x=(r+1)/2*a,l.position.y=(n+1)/2*s,l.delta.x=t.vx*a,l.delta.y=t.vy*s;var c=l.pointerCurrentRaycast;i&&(c.point=i.position,c.item=i.item);var f="pointerdown";switch(e){case 0:f="pointerdown";break;case 1:f="pointerup";break;case 2:f="pointermove"}if(i){var d=i.item,p=d.composition;d.emit(f,l),p.emit(f,l),this.engine.emit(f,l)}},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={})},t}();function gu(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,s=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-s)/n.height*2}}var xu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(lu(ae)),bu=1,Tu=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 X,n=new _i,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},e.createMaterial=function(){var t=[["ENV_EDITOR",this.engine.env===$n]],e=xs(this.color).getValue(0),i={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:Rn.GLSL1,macros:t}},r=zn.create(this.engine,i);return r.blending=!0,r.depthTest=!1,r.setVector4("uPos",new W(0,0,0,0)),r.setVector2("uSize",new j(1,1)),r.setVector4("uColor",new W(e[0]/255,e[1]/255,e[2]/255,e[3])),r.setQuaternion("uQuat",new _i(0,0,0,0)),r},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return To.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:Rr.LINES,maxVertex:4})},e.createMesh=function(t,e){return wo.create(this.engine,{name:"Interact_preview"+bu++,priority:0,worldMatrix:Sn.fromIdentity(),geometry:t,material:e})},t}(),Eu=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,clipMasks:e.frameClipMasks}:void 0}},e}oe(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.env,e=this.interactData.options,i=e.type,r=e.showPreview;i===Jt.CLICK&&(this.clickable=!0,r&&t===$n&&(this.previewContent=new Tu(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.env;if(e===Jt.CLICK)this.clickable=!0;else if(e===Jt.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==$n||n){var a,s=(null!=(a=this.item.composition)?a:{}).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,a=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,a.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,_u(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,a=n.position,s=n.fov,o=e.dy,u=e.dx*e.width/e.height,h=a[2],l=Math.tan(s*Math.PI/180/2)*Math.abs(h),c=o*l,f=u*l,d=this.dragRange,p=d.dxRange,m=d.dyRange,v=a[0]-this.dragRatio[0]*f,y=a[1]-this.dragRatio[1]*c,g=p[0],x=p[1],b=m[0],T=m[1];if(v=G(v,g,x),y=G(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 X(v,y,h)}},i.beginDragTarget=function(t,i){var r=this;if("camera"===t.target){var n,a={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;!_u(e,3)&&e&&(e.vx*=r.speed,e.vy*=r.speed,r.dragEvent=gi({},n)),n=null}}};Object.keys(a).forEach((function(t){i.addEventListener(t,a[t])})),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(a).forEach((function(t){i.removeEventListener(t,a[t])}))}}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=_a(X.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:Bn.triangle,area:e}},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===Jt.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,a=0;if("number"==typeof e)i=e,r=e,n=e,a=e;else if(At(e)){var s,o,u,h,l;i=void 0===(o=(s=e)[0])?0:o,r=void 0===(u=s[1])?0:u,n=void 0===(h=s[2])?0:h,a=void 0===(l=s[3])?0:l}if(t.x<a-1||t.x>1-r||t.y<i-1||t.y>1-n)return!0}return!1},xr(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(Hn);function _u(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}Eu=_([$e(ze.InteractComponent)],Eu);var wu,Su=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return oe(e,t),e}(lu(ae)),Cu=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}(),Au=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}(),Mu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(ii);!function(t){t[t.Playing=0]="Playing",t[t.Paused=1]="Paused",t[t.Stopped=2]="Stopped"}(wu||(wu={}));var Iu=[1,1,1,1],Ru=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}oe(e,t);var i=e.prototype;return i.processFrame=function(t){var e=t.output.getUserData();if(E(e,oa)){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 a,s,o,u=ga(Iu,1),h=this.time/this.getDuration(),l=this.opacityOverLifetime,c=this.colorOverLifetime;if(c&&(u=Z(c,h,!0),a=!0),l&&(u[3]*=l.getValue(h),a=!0),a)xa(this.renderColor,u,this.startColor),null==(o=this.activeMaterial)||null==(s=o.getColor("_Color"))||s.setFromArray(this.renderColor)}},i.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;i&&(this.opacityOverLifetime=xs(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===he.GRADIENT_COLOR&&(this.colorOverLifetime=q(i.color[1])));return this},i.getActiveComponent=function(t){return t.getComponent(iu)},e}(Cu),Ou=function(){function t(){}return t.prototype.onEvent=function(t,e){},t}(),Pu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.onEvent=function(t,e){t.emit("animationevent",e)},e}(lu(Ou)),Nu=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.events=[],e}oe(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=G(e,0,this.duration),n=Ze(this.positionCurves);!(i=n()).done;){var a=i.value,s=a.keyFrames.getValue(r),o=this.findTarget(t,a.path);null==o||o.transform.setPosition(s.x,s.y,s.z)}for(var u,h=Ze(this.rotationCurves);!(u=h()).done;){var l=u.value,c=l.keyFrames.getValue(r),f=this.findTarget(t,l.path);null==f||f.transform.setQuaternion(c.x,c.y,c.z,c.w)}for(var d,p=Ze(this.eulerCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(r),y=this.findTarget(t,m.path);null==y||y.transform.setRotation(v.x,v.y,v.z)}for(var g,x=Ze(this.scaleCurves);!(g=x()).done;){var b=g.value,T=b.keyFrames.getValue(r),E=this.findTarget(t,b.path);null==E||E.transform.setScale(T.x,T.y,T.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=Ze(t.positionCurves);!(i=r()).done;){var n=i.value,a={path:n.path,keyFrames:xs(n.keyFrames)};e=Math.max(e,a.keyFrames.getMaxTime()),this.positionCurves.push(a)}if(t.rotationCurves)for(var s,o=Ze(t.rotationCurves);!(s=o()).done;){var u=s.value,h={path:u.path,keyFrames:xs(u.keyFrames)};e=Math.max(e,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}if(t.eulerCurves)for(var l,c=Ze(t.eulerCurves);!(l=c()).done;){var f=l.value,d={path:f.path,keyFrames:xs(f.keyFrames)};e=Math.max(e,d.keyFrames.getMaxTime()),this.eulerCurves.push(d)}if(t.scaleCurves)for(var p,m=Ze(t.scaleCurves);!(p=m()).done;){var v=p.value,y={path:v.path,keyFrames:xs(v.keyFrames)};e=Math.max(e,y.keyFrames.getMaxTime()),this.scaleCurves.push(y)}if(t.floatCurves)for(var g,x=Ze(t.floatCurves);!(g=x()).done;){var b=g.value,T={path:b.path,keyFrames:xs(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,T.keyFrames.getMaxTime()),this.floatCurves.push(T)}if(t.colorCurves)for(var E,_=Ze(t.colorCurves);!(E=_()).done;){var w=E.value,S={path:w.path,keyFrames:xs(w.keyFrames),property:w.property,className:w.className};e=Math.max(e,S.keyFrames.getMaxTime()),this.colorCurves.push(S)}if(void 0!==t.duration?this.duration=t.duration:this.duration=e,t.events)for(var C,A=Ze(t.events);!(C=A()).done;){var M,I=C.value,R={name:I.name,startTime:I.startTime,duration:null!=(M=I.duration)?M:0,event:new Pu};this.events.push(R)}},i.findTarget=function(t,e){for(var i,r=t,n=Ze(e.split("."));!(i=n()).done;){for(var a,s=i.value,o=!1,u=Ze(r.children);!(a=u()).done;){var h=a.value;if(h.name===s){r=h,o=!0;break}}if(!o)return}return r},e}(ii);Nu=_([$e(ze.AnimationClip)],Nu);var Lu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}oe(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=Ze(this.clipPlayables);!(e=i()).done;){e.value.processFrame(t)}this.evaluate(t)},i.setClipWeight=function(t,e){if(E(t,Cu)){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}(Cu),Fu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(E(e,oa)){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}(Lu),Vu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();E(e,oa)&&(e.time=this.time)},e}(Cu),ku=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(Cu),Du=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyPath="",e.propertyName="",e}oe(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 a=this.getClipPlayable(r);if(!E(a,ku)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var s=a.value;this.addWeightedValue(s,n),i=!0}}i&&(this.directTarget[this.propertyName]=this.propertyValue,E(e,br)&&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}(Lu),zu=function(t){function e(){return t.apply(this,arguments)}oe(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}(Du),Bu=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(Du),Uu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){},e}(Lu),Gu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){},e}(Lu),ju=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();E(e,Ys)&&e.tick(this.getTime()-e.getTime())},e}(Cu),Xu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(E(e,Ys)){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}(Lu),Wu=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.evaluate=function(t){},e}(Lu),Hu=function(t){function e(){return t.apply(this,arguments)}oe(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}(Du),Yu=function(t){function e(){return t.apply(this,arguments)}oe(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}(Du),Zu=function(t){function e(){return t.apply(this,arguments)}oe(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}(Du),qu=new Cn,Ku=new X(1,1,1),Qu=new X,Ju=function(t){function e(){return t.apply(this,arguments)}oe(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 X(e.x,e.y,e.x)};var i,r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=xs(r.path));var s=r.linearX||r.linearY||r.linearZ;s&&(this.linearVelOverLifetime={x:r.linearX&&xs(r.linearX),y:r.linearY&&xs(r.linearY),z:r.linearZ&&xs(r.linearZ),asMovement:r.asMovement,enabled:!!s});var o=r.orbitalX||r.orbitalY||r.orbitalZ;o&&(this.orbitalVelOverLifetime={x:r.orbitalX&&xs(r.orbitalX),y:r.orbitalY&&xs(r.orbitalY),z:r.orbitalZ&&xs(r.orbitalZ),center:ya(r.orbCenter),asRotation:r.asRotation,enabled:!!o}),this.speedOverLifetime=r.speedOverLifetime&&xs(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=xs(a.x||1),this.sizeYOverLifetime=xs(a.y||1),this.sizeZOverLifetime=xs(a.z||1)):this.sizeXOverLifetime=xs(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:xs(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=xs(n.x||0),u.y=xs(n.y||0)}this.gravity=X.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=xs(null!=(i=null==r?void 0:r.gravityOverLifetime)?i:0),this.direction=(null==r?void 0:r.direction)?X.fromArray(r.direction).normalize():new X,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();E(e,oa)&&(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,this.sizeXOverLifetime){Ku.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(Ku.y=this.sizeYOverLifetime.getValue(r),Ku.z=this.sizeZOverLifetime.getValue(r)):Ku.z=Ku.y=Ku.x;var n=this.originalTransform.scale;e.transform.setScale(Ku.x*n.x,Ku.y*n.y,Ku.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},s=a(this.rotationOverLifetime.z),o=this.rotationOverLifetime.separateAxes;qu.x=o?a(this.rotationOverLifetime.x):0,qu.y=o?a(this.rotationOverLifetime.y):0,qu.z=s;var u=qu.addEulers(this.originalTransform.rotation,qu);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Qu;va(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}(Cu),$u=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new Ju;return t.data=this.transformAnimationData,t},i.fromData=function(t){this.transformAnimationData=t},e}(Mu);$u=_([$e(ze.TransformPlayableAsset)],$u);var th,eh=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===ce.restart?e%=i:this.endBehavior===ce.freeze&&(e=Math.min(i,e))),e},t}(),ih=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}oe(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){return t},i.createTrackMixer=function(){return new Lu},i.createOutput=function(){return new Au},i.createPlayableGraph=function(t){return this.createMixerPlayableGraph(t)},i.createMixerPlayableGraph=function(t){for(var e,i=[],r=Ze(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=Ze(t);!(i=n()).done;){var a=i.value,s=this.createClipPlayable(a);s.setDuration(a.duration);var o=new rh(a,s,r);e.push(o),r.clipPlayables.push(s),r.setClipWeight(s,0)}return r},i.createPlayable=function(){return new Cu},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 eh;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=Ze(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=Ze(this.children);!(i=r()).done;){i.value.parent=this}},e}(Mu);_([ti(eh)],ih.prototype,"clips",void 0),_([ti()],ih.prototype,"children",void 0),ih=_([$e(ze.TrackAsset)],ih),function(t){t[t.MasterTrack=0]="MasterTrack",t[t.ObjectTrack=1]="ObjectTrack"}(th||(th={}));var rh=function(){function t(t,e,i){this.clip=t,this.playable=e,this.parentMixer=i}return t.prototype.evaluateAt=function(t){var e=this.clip,i=1,r=!1,n=!1;t>=e.start+e.duration&&e.endBehavior===ce.destroy?(i=0,r=!0):t-this.clip.start>=0?(i=1,n=!0):t<e.start&&(i=0),n&&this.playable.getPlayState()!==wu.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,i);var a=e.toLocalTime(t);this.playable.setTime(a),r&&this.playable.getPlayState()===wu.Playing&&this.playable.pause()},xr(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}(),nh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Fu},e}(ih);nh=_([$e(ze.ActivationTrack)],nh);var ah=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}return oe(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(ih);_([ti()],ah.prototype,"path",void 0);var sh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new Bu;return t.propertyPath=this.path,t},e}(ah);sh=_([$e(ze.FloatPropertyTrack)],sh);var oh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Gu},e}(ih);oh=_([$e(ze.SpriteColorTrack)],oh);var uh=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.updateAnimatedObject=function(t){if(!E(t,oa))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");return t.getComponent(Ys)},i.createTrackMixer=function(){return new Xu},e}(ih);uh=_([$e(ze.SubCompositionTrack)],uh);var hh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Wu},e}(ih);hh=_([$e(ze.TransformTrack)],hh);var lh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.updateAnimatedObject=function(t){if(!E(t,Hn))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}(ih);_([ti()],lh.prototype,"index",void 0),lh=_([$e("MaterialTrack")],lh);var ch=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Uu},e}(ih),fh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new Hu;return t.propertyPath=this.path,t},e}(ah);fh=_([$e(ze.Vector4PropertyTrack)],fh);var dh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new Yu;return t.propertyPath=this.path,t},e}(ah);dh=_([$e(ze.Vector3PropertyTrack)],dh);var ph=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new Zu;return t.propertyPath=this.path,t},e}(ah);ph=_([$e(ze.Vector2PropertyTrack)],ph);var mh=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){var t=new zu;return t.propertyPath=this.path,t},e}(ah);mh=_([$e(ze.ColorPropertyTrack)],mh);var vh=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=yh(this.arc,this.arcMode,t)*k,i=Math.cos(e)*this.radius,r=Math.sin(e)*this.radius,n=new X(i,r,0),a=Math.tan(this.angle*k),s=n.clone().multiply(a);return s.z+=1,{position:n.multiply(Nt(0,1)),direction:s.normalize()}},t}();function yh(t,e,i){if(e===de.RANDOM)t=Nt(0,t);else if(e===de.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===de.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===de.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var gh,xh=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=yh(this.arc,this.arcMode,t)*k,i=new X(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),bh=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=Nt(-this._d,this._d),i=Nt(-this._h,this._h);return{direction:new X(0,0,1),position:new X(e,i,0)}},t}(),Th=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=yh(this.arc,this.arcMode,t)*k,i=new X(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),s=Math.tan(e),o=new X;return e<a?o.set(r,r*s,0):e>=a&&e<Math.PI-a?o.set(n/s,n,0):e<Math.PI+a?o.set(-r,-r*s,0):e<2*Math.PI-a?o.set(-n/s,-n,0):o.set(r,r*s,0),{direction:i,position:o}},t}(),Eh=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===de.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):Nt(0,1);return{direction:new X(0,1,0),position:new X(this._d*(e-.5),0,0)}},t}(),_h=new Sn,wh=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=Nt(0,2*Math.PI),n=yh(this.arc,this.arcMode,t)*k,a=_h.setFromRotationZ(n),s=new X(Math.cos(r),Math.sin(r),0),o=new X(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(s),position:a.transformPoint(o)}},t}(),Sh=new Sn,Ch=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 Nt(-90,90)},e.generate=function(t){var e=yh(this.arc,this.arcMode,t)*k,i=this.getHorizontalAngle()*k,r=this.radius,n=new X(Math.cos(i),0,Math.sin(i)),a=Sh.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),Ah=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.getHorizontalAngle=function(){return Nt(0,90)},e}(Ch),Mh=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=G(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=e.length/2-1,r=Math.floor(yh(i,this.arcMode,t)),n=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,a=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,s=new X(n,a,0);return{position:new X(n*this.width,a*this.height,0),direction:s.normalize()}},t}(),Ih=function(){function t(){}return t.prototype.generate=function(){return{position:new X,direction:new X}},t}(),Rh=((gh={})[Kt.NONE]=Ih,gh[Kt.CONE]=vh,gh[Kt.SPHERE]=Ch,gh[Kt.HEMISPHERE]=Ah,gh[Kt.CIRCLE]=xh,gh[Kt.DONUT]=wh,gh[Kt.RECTANGLE]=bh,gh[Kt.EDGE]=Eh,gh[Kt.RECTANGLE_EDGE]=Th,gh[Kt.TEXTURE]=Mh,gh);function Oh(t){if(!t)return new Ih;var e=gi({radius:1,arc:360,angle:0,arcMode:de.RANDOM},t),i=t.type,r=Rh[i];if(!r)throw new Error("Invalid shape: "+i+".");var n=new r(e);if(i!==Kt.NONE){var a=t.alignSpeedDirection,s=t.upDirection,o=void 0===s?[0,0,1]:s;n.alignSpeedDirection=a,n.upDirection=X.fromArray(o).normalize()}return n}function Ph(t,e,i,r,n){var a,s;if(n===function(t,e,i,r){for(var n=0,a=e,s=i-r;a<i;a+=r)n+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)s=Kh(a,t[a],t[a+1],s);else for(a=i-r;a>=e;a-=r)s=Kh(a,t[a],t[a+1],s);return s&&Xh(s,s.next)&&(Qh(s),s=s.next),s}function Nh(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Xh(r,r.next)&&0!==jh(r.prev,r,r.next))r=r.next;else{if(Qh(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function Lh(t){var e=t.prev,i=t,r=t.next;if(jh(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Uh(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&jh(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function Fh(t,e,i,r){var n=t.prev,a=t,s=t.next;if(jh(n,a,s)>=0)return!1;for(var o=n.x<a.x?n.x<s.x?n.x:s.x:a.x<s.x?a.x:s.x,u=n.y<a.y?n.y<s.y?n.y:s.y:a.y<s.y?a.y:s.y,h=n.x>a.x?n.x>s.x?n.x:s.x:a.x>s.x?a.x:s.x,l=n.y>a.y?n.y>s.y?n.y:s.y:a.y>s.y?a.y:s.y,c=zh(o,u,e,i,r),f=zh(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&&Uh(n.x,n.y,a.x,a.y,s.x,s.y,d.x,d.y)&&jh(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==t.prev&&p!==t.next&&Uh(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&jh(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&Uh(n.x,n.y,a.x,a.y,s.x,s.y,d.x,d.y)&&jh(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&Uh(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&jh(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Vh(t,e){return t.x-e.x}function kh(t,e){if(e=function(t,e){var i,r=e,n=t.x,a=t.y,s=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var o=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=n&&o>s){if(s=o,o===n){if(a===r.y)return r;if(a===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&&Uh(a<c?n:s,a,l,c,a<c?s:n,a,r.x,r.y)&&(u=Math.abs(a-r.y)/(n-r.x),Zh(r,t)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&Dh(i,r)))&&(i=r,f=u)),r=r.next}while(r!==h);return i}(t,e),e){var i=qh(e,t);Nh(e,e.next),Nh(i,i.next)}}function Dh(t,e){return jh(t.prev,t,e.prev)<0&&jh(e.next,t,t.next)<0}function zh(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 Bh(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 Uh(t,e,i,r,n,a,s,o){return(n-s)*(e-o)-(t-s)*(a-o)>=0&&(t-s)*(r-o)-(i-s)*(e-o)>=0&&(i-s)*(a-o)-(n-s)*(r-o)>=0}function Gh(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&&Wh(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Zh(t,e)&&Zh(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(jh(t.prev,t,e.prev)||jh(t,e.prev,e))||Xh(t,e)&&jh(t.prev,t,t.next)>0&&jh(e.prev,e,e.next)>0)}function jh(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Xh(t,e){return t.x===e.x&&t.y===e.y}function Wh(t,e,i,r){var n=Yh(jh(t,e,i)),a=Yh(jh(t,e,r)),s=Yh(jh(i,r,t)),o=Yh(jh(i,r,e));return n!==a&&s!==o||(!(0!==n||!Hh(t,i,e))||(!(0!==a||!Hh(t,r,e))||(!(0!==s||!Hh(i,t,r))||!(0!==o||!Hh(i,e,r)))))}function Hh(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 Yh(t){return t>0?1:t<0?-1:0}function Zh(t,e){return jh(t.prev,t,t.next)<0?jh(t,e,t.next)>=0&&jh(t,t.prev,e)>=0:jh(t,e,t.prev)<0||jh(t,t.next,e)<0}function qh(t,e){var i=new Jh(t.i,t.x,t.y),r=new Jh(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function Kh(t,e,i,r){var n=new Jh(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 Qh(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 Jh(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 $h=0;function tl(t,e,i,r){i=i||2,$h=r||0;var n,a,s,o,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=Ph(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,a,s,o=[];for(n=0,a=e.length;n<a;n++)(s=Ph(t,e[n]*r,n<a-1?e[n+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),o.push(Bh(s));for(o.sort(Vh),n=0;n<o.length;n++)kh(o[n],i),i=Nh(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=s=t[0],a=o=t[1];for(var m=i;m<f;m+=i)(u=t[m])<n&&(n=u),(h=t[m+1])<a&&(a=h),u>s&&(s=u),h>o&&(o=h);l=0!==(l=Math.max(s-n,o-a))?1/l:0}return el(d,p,i,n,a,l),p}function el(t,e,i,r,n,a,s){if(t){!s&&a&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=zh(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,s,o,u,h=1;do{for(i=t,t=null,a=null,s=0;i;){for(s++,r=i,o=0,e=0;e<h&&(o++,r=r.nextZ);e++);for(u=h;o>0||u>0&&r;)0!==o&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,o--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(s>1)}(n)}(t,r,n,a);for(var o,u,h=t;t.prev!==t.next;)if(o=t.prev,u=t.next,a?Fh(t,r,n,a):Lh(t))e.push(o.i/i+$h),e.push(t.i/i+$h),e.push(u.i/i+$h),Qh(t),t=u.next,h=u.next;else if((t=u)===h){s?1===s?el(t=il(Nh(t),e,i),e,i,r,n,a,2):2===s&&rl(t,e,i,r,n,a):el(Nh(t),e,i,r,n,a,1);break}}}function il(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!Xh(n,a)&&Wh(n,r,r.next,a)&&Zh(n,a)&&Zh(a,n)&&(e.push(n.i/i+$h),e.push(r.i/i+$h),e.push(a.i/i+$h),Qh(r),Qh(r.next),r=t=a),r=r.next}while(r!==t);return Nh(r)}function rl(t,e,i,r,n,a){var s=t;do{for(var o=s.next.next;o!==s.prev;){if(s.i!==o.i&&Gh(s,o)){var u=qh(s,o);return s=Nh(s,s.next),u=Nh(u,u.next),el(s,e,i,r,n,a),void el(u,e,i,r,n,a)}o=o.next}s=s.next}while(s!==t)}var nl=2;function al(t,e){for(var i=t.s,r=t.p,n=i[1],a=r[1],s=0,o=0;o<n.length;o++){s+=n[o].length-1}var u,h=new Float32Array(s*Zn),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=a[b],_=a[b+1]||a[0],w=T,S=[0,0],C=0;C<w.length-1;C++){ul(S,w[C],E,_,E[4],E[5],_[2],_[3]),M(S[0],S[1])}var A=tl(Array.from(h),null,Zn,c);return{aPoint:h,index:new Uint16Array(A)};function M(t,e){h[d++]=t/2,h[d++]=e/2,f?(g[0]=t,g[1]=e,ol(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+=nl}}function sl(t,e){for(var i=[],r=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[he.SHAPE_POINTS,t.p],s:[he.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[he.SHAPE_POINTS,t.g.p],s:[he.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,a=0,s=0,o=0;o<r.length;o++){var u=al(r[o],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,i.push(u),a+=u.aPoint.length,s+=u.index.length}if(1===i.length)return i[0];for(var h=new Float32Array(a),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 ol(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],s=e[1];return t[0]=r*a+n*s,t[1]=-n*a+r*s,t}function ul(t,e,i,r,n,a,s,o){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*a+c*o+f*r[1],t}var hl=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=E(r,Wa)?r:xs(r),this.cycles=+n||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),ll=function(t){this.content=t},cl=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 ll(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 ll(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,a=t.next;n.next=a,a&&(a.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do{t.call(e||this,i.content,r++)}while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do{t.call(e||this,i.content,r--)}while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),fl="runtime_env",dl="lookup_texture",pl="offscreen_canvas",ml="post_process_settings",vl={};function yl(t){return vl[t]}function gl(t,e){return vl[t]=e}var xl=new X,bl=new X,Tl=function(){function t(t,e){this.pointStart=[];var i=e.colorOverLifetime,r=e.colorOverTrail,n=e.maxTrailCount,a=e.opacityOverLifetime,s=void 0===a?xs(1):a,o=e.widthOverTrail,u=e.name,h=e.occlusion,l=e.blending,c=e.texture,f=e.transparentOcclusion,d=e.minimumVertexDistance,p=e.lifetime,m=e.matrix,v=t.gpuCapability,y=v.detail,g=v.level,x=Math.max(e.pointCountPerTrail,2),b={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},T=y.maxVertexTextures>0,_=(null!=t?t:{}).env,w={},S=[["ENABLE_VERTEX_TEXTURE",T],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",_===$n]],C=n>64,A=0;i&&(S.push(["COLOR_OVER_LIFETIME",!0]),A|=1,w.uColorOverLifetime=cn.createWithData(t,lt(i))),r&&(S.push(["COLOR_OVER_TRAIL",!0]),A|=4,w.uColorOverTrail=cn.createWithData(t,lt(r))),C?(S.push(["ATTR_TRAIL_START",1]),A|=8):w.uTrailStart=new Float32Array(n),w.uOpacityOverLifetimeValue=s.toUniform(b);var M=o.toUniform(b);S.push(["VERT_CURVE_VALUE_COUNT",b.index],["VERT_MAX_KEY_FRAME_COUNT",b.max]),w.uVCurveValues=Wa.getAllData(b);var I={shader:{vertex:Ro,fragment:Mo,macros:S,glslVersion:1===g?Rn.GLSL1:Rn.GLSL3,shared:!0,name:"trail#"+u,cacheId:"-t:+"+A+"+"+b.index+"+"+b.max}},R=x*n*2,O=(x-1)*n,P=Float32Array.BYTES_PER_ELEMENT,N=12*P,L={attributes:{aColor:{size:4,stride:N,data:new Float32Array(12*R)},aSeed:{size:1,stride:N,offset:4*P,dataSource:"aColor"},aInfo:{size:3,stride:N,offset:5*P,dataSource:"aColor"},aPos:{size:4,stride:N,offset:8*P,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(R)},aDir:{size:3,data:new Float32Array(3*R)}},indices:{data:new Uint16Array(6*R)},drawCount:6*O,name:"trail#"+u,bufferUsage:Rr.DYNAMIC_DRAW};if(C)L.attributes.aTrailStart={size:1,data:new Float32Array(R)};else{var F=new Float32Array(R);L.attributes.aTrailStartIndex={size:1,data:F};for(var V=0;V<n;V++)for(var k=2*x,D=V*k,z=0;z<k;z++)F[D+z]=V}var B=Dr(l),U=zn.create(t,I);U.blending=!0,U.depthMask=h,U.depthTest=!0,zr(U,l);var G=this.mesh=wo.create(t,{name:"MTrail_"+u,material:U,geometry:To.create(t,L)}),X=null!=c?c:cn.createWithData(t);Object.keys(w).map((function(t){var e=w[t];if(E(e,cn))U.setTexture(t,e);else if("uTrailStart"===t)U.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new W(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}U.setVector4Array(t,i)}else U.setVector4(t,W.fromArray(e))})),U.setFloat("uTime",0),U.setVector4("uWidthOverTrail",W.fromArray(M)),U.setVector2("uTexOffset",new j(0,0)),U.setVector4("uTextureMap",new W(0,0,1,1)),U.setVector4("uParams",new W(0,x-1,0,0)),U.setTexture("uMaskTex",X),U.setVector4("uColorParams",new W(c?1:0,+B,0,+(h&&!f))),this.maxTrailCount=n,this.pointCountPerTrail=x,this.checkVertexDistance=d>0,this.minimumVertexDistance=Math.pow(d||.001,2),this.useAttributeTrailStart=C,this.lifetime=p,m&&(this.mesh.worldMatrix=m),this.geometry=G.firstGeometry(),this.trailCursors=new Uint16Array(n)}var e=t.prototype;return e.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,a=this.geometry,s=n-1,o=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,xl);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+o,f=Sl(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),a.setAttributeSubData("aDir",v,y),a.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,a.setAttributeSubData("aColor",24*c,x),u>=0){var T=this.getTrailPosition(t,h,bl),E=new Float32Array(Sl(T,l,e)),_=6*(t*n+u);a.setAttributeSubData("aDir",_,E),a.setAttributeSubData("aDir",_+3,E);var w=t*n*2,S=new Uint16Array([2*u+w,2*u+1+w,2*o+w,2*o+w,2*u+1+w,2*o+1+w]),C=6*(t*s+(r-1)%s);a.setIndexSubData(C,S)}r=++this.trailCursors[t];var A=this.mesh.material,M=A.getVector4("uParams"),I=p[2];if(this.useAttributeTrailStart){for(var R=2*n,O=new Float32Array(R),P=0;P<R;P++)O[P]=I;a.setAttributeSubData("aTrailStart",t*O.length,O)}else{var N=A.getFloats("uTrailStart");null!=N&&(N[t]=I,A.setFloats("uTrailStart",N))}M&&(M.y=Math.max(M.y,r-1)-Math.max(0,r-n),A.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,a=this.geometry.getAttributeData("aColor");return mt(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();mt(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");mt(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();mt(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){},xr(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}(),El=new X,_l=new X,wl=new X;function Sl(t,e,i){var r=El;return t||i?(t?i?(_l.subtractVectors(e,t).normalize(),_l.subtractVectors(i,e),wl.copyFrom(_l).normalize(),r.addVectors(_l,wl)):r.subtractVectors(e,t):r.subtractVectors(i,e),r.normalize().toArray()):[0,0,0]}var Cl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).particleSystem=null,e}oe(e,t);var i=e.prototype;return i.getParticleSystem=function(t){if(this.particleSystem)return this.particleSystem;var e=t.output.getUserData();return E(e,oa)?(this.particleSystem=e.getComponent(Nl),this.particleSystem):null},i.processFrame=function(t){var e=this.getParticleSystem(t);if(e){this.time>=0&&this.time<e.time&&e.reset();for(;e.time+.016<this.time;)e.simulate(.016);e.simulate(this.time-e.time)}},e}(Cu),Al=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){return new Cl},e}(Mu),Ml={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"},Il=function(){function t(t,e){this.particleCount=0,this.cachedRotationVector3=new X,this.cachedRotationMatrix=new An,this.cachedLinearMove=new X,this.tempMatrix3=new An,this.VERT_MAX_KEY_FRAME_COUNT=0;var i,r,n=(null!=t?t:{}).env,a=e.speedOverLifetime,s=e.colorOverLifetime,o=e.linearVelOverLifetime,u=e.orbitalVelOverLifetime,h=e.sizeOverLifetime,l=e.rotationOverLifetime,c=e.sprite,f=e.gravityModifier,d=e.maxCount,p=e.textureFlip,m=e.useSprite,v=e.name,y=e.gravity,g=e.forceTarget,x=e.side,b=e.occlusion,T=e.anchor,_=e.blending,w=e.transparentOcclusion,S=e.renderMode,C=void 0===S?0:S,A=e.diffuse,M=void 0===A?cn.createWithData(t):A,I=t.gpuCapability.detail,R=I.halfFloatTexture,O=I.maxVertexUniforms,P=[["RENDER_MODE",+C],["ENV_EDITOR",n===$n]],N=t.gpuCapability.level,L={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},F={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},V=O>0,k={},D=0,z=0;(this.useSprite=m,V&&P.push(["ENABLE_VERTEX_TEXTURE",!0]),a&&(P.push(["SPEED_OVER_LIFETIME",!0]),z|=2,k.uSpeedLifetimeValue=a.toUniform(L)),(null==c?void 0:c.animate)&&(P.push(["USE_SPRITE",!0]),z|=4,k.uFSprite=k.uSprite=new Float32Array([c.col,c.row,c.total,c.blend?1:0]),this.useSprite=!0),(null==s?void 0:s.color)&&(P.push(["COLOR_OVER_LIFETIME",!0]),z|=16,k.uColorOverLifetime=E(s.color,cn)?s.color:cn.createWithData(t,lt(s.color))),(null==s?void 0:s.opacity)?k.uOpacityOverLifetimeValue=s.opacity.toUniform(L):k.uOpacityOverLifetimeValue=xs(1).toUniform(L),["x","y","z"].forEach((function(t,e){var r=0,n=0;(null==o?void 0:o[t])&&(k["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=o[t].toUniform(L),r=1,z|=1<<7+e,o.enabled=!0),P.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==u?void 0:u[t])&&(k["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=u[t].toUniform(L),n=1,z|=1<<10+e,i=!0,u.enabled=!0),P.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==o?void 0:o.asMovement)&&(P.push(["AS_LINEAR_MOVEMENT",!0]),z|=32),i&&((null==u?void 0:u.asRotation)&&(P.push(["AS_ORBITAL_MOVEMENT",!0]),z|=64),k.uOrbCenter=new Float32Array((null==u?void 0:u.center)||[0,0,0])),k.uSizeByLifetimeValue=null==h?void 0:h.x.toUniform(L),null==h?void 0:h.separateAxes)&&(P.push(["SIZE_Y_BY_LIFE",1]),z|=16384,k.uSizeYByLifetimeValue=null==h||null==(r=h.y)?void 0:r.toUniform(L));if((null==l?void 0:l.z)&&(k.uRZByLifeTimeValue=l.z.toUniform(L),z|=32768,P.push(["ROT_Z_LIFETIME",1])),(null==l?void 0:l.x)&&(k.uRXByLifeTimeValue=l.x.toUniform(L),z|=65536,P.push(["ROT_X_LIFETIME",1])),(null==l?void 0:l.y)&&(k.uRYByLifeTimeValue=l.y.toUniform(L),z|=1<<17,P.push(["ROT_Y_LIFETIME",1])),(null==l?void 0:l.asRotation)&&(P.push(["ROT_LIFETIME_AS_MOVEMENT",1]),z|=1<<18),k.uGravityModifierValue=f.toUniform(L),g&&(P.push(["FINAL_TARGET",!0]),z|=1<<19,k.uFinalTarget=new Float32Array(g.target||[0,0,0]),k.uForceCurve=g.curve.toUniform(L)),R&&F.max?(z|=1<<20,k.uFCurveValueTexture=fn(t,Wa.getAllData(F,!0),F.index,1)):k.uFCurveValues=Wa.getAllData(F),L.max+L.curves.length-32>O&&R&&V){var B=fn(t,Wa.getAllData(L,!0),L.index,1);k.uVCurveValueTexture=B,D=1}else k.uVCurveValues=Wa.getAllData(L);var U=["-p:",C,z,L.index,L.max,F.index,F.max].join("+");P.push(["VERT_CURVE_VALUE_COUNT",L.index],["FRAG_CURVE_VALUE_COUNT",F.index],["VERT_MAX_KEY_FRAME_COUNT",L.max],["FRAG_MAX_KEY_FRAME_COUNT",F.max]),this.VERT_MAX_KEY_FRAME_COUNT=L.max;var G={shader:{fragment:Mo,vertex:"#define LOOKUP_TEXTURE_CURVE "+D+"\n"+Io,glslVersion:1===N?Rn.GLSL1:Rn.GLSL3,shared:!0,cacheId:U,macros:P,name:"particle#"+v}},H=Dr(_);k.uTexOffset=new Float32Array(M?[1/M.getWidth(),1/M.getHeight()]:[0,0]),k.uMaskTex=M,k.uColorParams=new Float32Array([M?1:0,+H,0,+(!!b&&!w)]),k.uParams=[0,0,0,0],k.uAcceleration=[(null==y?void 0:y[0])||0,(null==y?void 0:y[1])||0,(null==y?void 0:y[2])||0,0];var Y=zn.create(t,G);Y.blending=!0,Y.depthTest=!0,Y.depthMask=!!b,zr(Y,_),Br(Y,x),Object.keys(k).map((function(t){var e=k[t];if(E(e,cn))Y.setTexture(t,e);else{var i=[];switch(Ml[t]){case"vec4":Y.setVector4(t,W.fromArray(e));break;case"vec3":Y.setVector3(t,X.fromArray(e));break;case"vec2":Y.setVector2(t,j.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new W(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}Y.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),Y.setVector3("emissionColor",new X(0,0,0)),Y.setFloat("emissionIntensity",0);var Z=To.create(t,function(t,e,i){var r=Float32Array.BYTES_PER_ELEMENT,n=12*r,a={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&&(a.aSprite={size:3,stride:3*r,data:new Float32Array(0)});return{attributes:a,indices:{data:new Uint16Array(0)},name:i,maxVertex:t}}(4*d,this.useSprite,"particle#"+v)),q=wo.create(t,{name:"MParticle_"+v,material:Y,geometry:Z});this.anchor=T,this.mesh=q,this.geometry=q.firstGeometry(),this.forceTarget=g,this.sizeOverLifetime=h,this.speedOverLifetime=a,this.linearVelOverLifetime=o,this.orbitalVelOverLifetime=u,this.orbitalVelOverLifetime=u,this.gravityModifier=f,this.rotationOverLifetime=l,this.maxCount=d,this.textureOffsets=p?[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 mt(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],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.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,a=this.geometry,s=r>this.maxParticleBufferCount,o=1;this.particleCount>300?o=(this.particleCount+100)/this.particleCount:this.particleCount>100?o=1.4:this.particleCount>0&&(o=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 X,c=new _i,f=new X(1,1,1);e.transform.assignWorldTRS(l,c,f);var d,p=sa.getRotation(c,new Cn),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();h&&(d=e.sprite);for(var w=0;w<4;w++){var S=2*w,C=3*w,A=4*w,M=12*w,I=8*w;u.aPos.set(m,M),b.fill(u.aPos,M+3),u.aRot.set(v,I),u.aRot[I+3]=_,u.aRot.set(T,I+4),h&&u.aSprite.set(d,C);var R=e.uv||x;if(R){var O=h?1-y[S+1]:y[S+1];g[0]=R[0]+y[S]*R[2],g[1]=R[1]+O*R[3]}u.aOffset.set(g,A);for(var P=w+w,N=(E[P]-this.anchor.x)*f.x,L=(E[P+1]-this.anchor.y)*f.y,V=0;V<3;V++)u.aPos[M+6+V]=e.dirX.getElement(V)*N,u.aPos[M+9+V]=e.dirY.getElement(V)*L}var k=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(s){var D=F(a.getIndexData(),6*r,6*i,o);D.set(k,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,k);Object.keys(u).forEach((function(e){var r=u[e],h=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=a.getAttributeData(e);mt(l);var c=F(l,n*h,4*i*h,o);c.set(r,r.length*t),a.setAttributeData(e,c)}else a.setAttributeSubData(e,r.length*t,r)})),this.particleCount=Math.max(r,this.particleCount),a.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var s=0,o=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],o=n[f+1],u=n[f+2];var d=i-a[4*c+2],p=a[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,o=o*x+y,u=u*x+g}else s+=v,o+=y,u+=g}var b=3*c;if(a[4*c+2]<i){var T=s*(e/1e3),E=o*(e/1e3),_=u*(e/1e3);r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},e.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),a=this.geometry.getAttributeData("aSeed"),s=this.time,o=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var h=G((s-r[4*u+2])/r[4*u+3],0,1),l=8*u,c=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),f=a[8*u+3],d=c;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(E(this.rotationOverLifetime.x,Za)?d.x+=this.rotationOverLifetime.x.getValue(h,f):d.x+=this.rotationOverLifetime.x.getValue(h)),this.rotationOverLifetime.y&&(E(this.rotationOverLifetime.y,Za)?d.y+=this.rotationOverLifetime.y.getValue(h,f):d.y+=this.rotationOverLifetime.y.getValue(h)),this.rotationOverLifetime.z&&(E(this.rotationOverLifetime.z,Za)?d.z+=this.rotationOverLifetime.z.getValue(h,f):d.z+=this.rotationOverLifetime.z.getValue(h))):o.setZero(),0===d.dot(d)&&o.identity();var p=Math.PI/180,m=d.x*p,v=d.y*p,y=d.z*p,g=Math.sin(m),x=Math.sin(v),b=Math.sin(y),T=Math.cos(m),_=Math.cos(v),w=Math.cos(y);o.set(w,-b,0,b,w,0,0,0,1),o.multiply(this.tempMatrix3.set(_,0,x,0,1,0,-x,0,_)),o.multiply(this.tempMatrix3.set(1,0,0,0,T,-g,0,g,T));var S=9*u,C=o.elements;i.set(C,S),u+4<=t&&(i.set(C,S+9),i.set(C,S+18),i.set(C,S+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"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var s=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var o=0;o<t;o+=4){var u=a-r[4*o+2],h=r[4*o+3],l=u/h,c=n[8*o+3];s.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(E(this.linearVelOverLifetime.x,Za)?s.x=this.linearVelOverLifetime.x.getValue(l,c):s.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(E(this.linearVelOverLifetime.y,Za)?s.y=this.linearVelOverLifetime.y.getValue(l,c):s.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(E(this.linearVelOverLifetime.z,Za)?s.z=this.linearVelOverLifetime.z.getValue(l,c):s.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(E(this.linearVelOverLifetime.x,Za)?s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,c):s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.y&&(E(this.linearVelOverLifetime.y,Za)?s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,c):s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.z&&(E(this.linearVelOverLifetime.z,Za)?s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,c):s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,h)));var f=3*o;i[f]=s.x,i[f+1]=s.y,i[f+2]=s.z,i[f+3]=s.x,i[f+4]=s.y,i[f+5]=s.z,i[f+6]=s.x,i[f+7]=s.y,i[f+8]=s.z,i[f+9]=s.x,i[f+10]=s.y,i[f+11]=s.z}this.geometry.setAttributeData("aLinearMove",i)},e.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},t}();function Rl(t,e,i){var r;void 0===i&&(i="");var n,a=t.content,s=+((null==(r=a.renderer)?void 0:r.renderMode)||0),o=[["RENDER_MODE",s],["ENV_EDITOR",i===$n]],u=e.detail,h={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},c=u.maxVertexUniforms>0,f=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,d=0,p=0;c&&o.push(["ENABLE_VERTEX_TEXTURE",!0]),f&&(o.push(["SPEED_OVER_LIFETIME",!0]),p|=2,as(h,f));var m=a.textureSheetAnimation;m&&m.animate&&(o.push(["USE_SPRITE",!0]),p|=4);var v=a.colorOverLifetime;v&&v.color&&(o.push(["COLOR_OVER_LIFETIME",!0]),p|=16);var y=v&&v.opacity;y&&as(h,y);var g,x=a.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==x?void 0:x[r])&&(as(h,x[r]),i=1,p|=1<<7+e),o.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==x?void 0:x[n])&&(as(h,x[n]),a=1,p|=1<<10+e,g=!0),o.push(["ORB_VEL_"+t.toUpperCase(),a])})),(null==x?void 0:x.asMovement)&&(o.push(["AS_LINEAR_MOVEMENT",!0]),p|=32),g&&(null==x?void 0:x.asRotation)&&(o.push(["AS_ORBITAL_MOVEMENT",!0]),p|=64),a.sizeOverLifetime){var b=a.sizeOverLifetime;b.separateAxes?(as(h,b.x),o.push(["SIZE_Y_BY_LIFE",1]),p|=16384,as(h,b.y)):as(h,b.size)}if(a.rotationOverLifetime){var T=a.rotationOverLifetime;T.z&&(as(h,null==T?void 0:T.z),p|=32768,o.push(["ROT_Z_LIFETIME",1])),T.separateAxes&&(T.x&&(as(h,T.x),p|=65536,o.push(["ROT_X_LIFETIME",1])),T.y&&(as(h,T.y),p|=1<<17,o.push(["ROT_Y_LIFETIME",1]))),(null==T?void 0:T.asRotation)&&(o.push(["ROT_LIFETIME_AS_MOVEMENT",1]),p|=1<<18)}as(h,null==x?void 0:x.gravityOverLifetime),(null==x?void 0:x.forceTarget)&&(o.push(["FINAL_TARGET",!0]),p|=1<<19,as(h,x.forceCurve));var E=u.halfFloatTexture;E&&l.max&&(p|=1<<20);var _=u.maxVertexUniforms,w=h.max+h.curves.length-32>_;yl(dl)&&(w=!0),w&&E&&c&&(d=1);var S=["-p:",s,p,h.index,h.max,l.index,l.max].join("+"),C={fragment:Mo,vertex:"#define LOOKUP_TEXTURE_CURVE "+d+"\n"+Io,shared:!0,cacheId:S,macros:o,name:"particle#"+t.name};return o.push(["VERT_CURVE_VALUE_COUNT",h.index],["FRAG_CURVE_VALUE_COUNT",l.index],["VERT_MAX_KEY_FRAME_COUNT",h.max],["FRAG_MAX_KEY_FRAME_COUNT",l.max]),{shader:C,vertex:h.index,fragment:l.index}}function Ol(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var a=0;a<t.macros.length;a++){var s=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===s[0])s[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===s[0]){s[1]=i;break}}}var Pl=function(t){function e(e){var i;return(i=t.call(this,e)||this).name="ParticleSystemRenderer",i}oe(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new W;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t,this);for(var e,i=Ze(this.meshes);!(e=i()).done;){e.value.render(t)}},i.setup=function(t,e){void 0===e&&(e=null),this.meshes=[],this.materials=[],this.particleMesh=new Il(this.engine,t),e&&(this.trailMesh=new Tl(this.engine,e)),this.meshes.push(this.particleMesh.mesh),this.materials.push(this.particleMesh.mesh.material),this.trailMesh&&(this.meshes.push(this.trailMesh.mesh),this.materials.push(this.trailMesh.mesh.material))},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}(Hn),Nl=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).particleMeshProps=null,r.trailMeshProps=null,r.getHitTestParams=function(t){var e=r.interaction;if(t||e)return{type:Bn.custom,clipMasks:r.renderer.frameClipMasks,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)===fe.removeParticle,ray:t})}}},r.maskManager=new Un,i&&r.fromData(i),r}oe(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]===he.CONSTANT_VEC3?e.add(r[1]):t=xs(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},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 a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},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 a=r.first;r.removeNode(a),i=n[1]=a.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},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 cl((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1},i.onStart=function(){var t=this;this.particleMeshProps&&(this.renderer=this.item.addComponent(Pl),this.renderer.setup(this.particleMeshProps,this.trailMeshProps),this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes,this.startEmit(),this.initEmitterTransform(),this.item.on("click",(function(){var e;if((null==(e=t.interaction)?void 0:e.behavior)===fe.removeParticle){var i=t.clickedPoint.content[1];t.renderer.removeParticlePoint(i),t.clearPointTrail(i),t.clickedPoint.content=[0]}})))},i.onUpdate=function(t){this.frozen||this.update(t)},i.simulate=function(t){this.update(1e3*t),this.frozen=!0},i.update=function(t){var e=this;if(this.started){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var s=this.particleLink,o=(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],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,o,a,n)})))};if(!this.ended){var c=this.item.duration,f=this.lifetime;if(u<c){var d=1/a.rateOverTime.getValue(f),p=Math.floor((u-this.lastEmitTime)/d),m=p,v=d/p,y=i,g=r.maxCount;this.updateEmitterTransform(u);for(var x=function(){var t=s.first;return e.emissionStopped||s.length===g&&t&&t.content[0]-n>u},b=0;b<m&&b<g&&!x();b++){var T=this.createPoint(f);T.delay+=y+b*v,this.addParticle(T,g),this.lastEmitTime=u}for(var E=a.bursts,_=(null==E?void 0:E.length)-1,w=0;_>=0&&w<g&&!x();_--){var S=E[_],C=!S.disabled&&S.getGeneratorOptions(u,f);if(C){var A=a.burstOffsets[_],M=A&&A[C.cycleIndex]||[0,0,0];S.once&&this.removeBurst(_);for(var I=0;I<C.count&&w<g;I++){var R;if(x())break;var O=this.initPoint(this.shape.generate({total:C.total,index:C.index,burstIndex:I,burstCount:C.count}));O.delay+=y,w++,(R=O.transform).translate.apply(R,[].concat(M)),this.addParticle(O,g)}}}}else if(this.options.looping)l(),this.loopStartTime=i-c,this.lastEmitTime-=c,this.time-=c,a.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=c,t[2]-=c,t[3]&&(t[3].delay-=c)})),this.renderer.minusTimeForLoop(c);else{this.ended=!0,this.item.endBehavior===ce.freeze&&(this.frozen=!0)}}l()}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled)for(var e,i=Ze(this.renderer.meshes);!(e=i()).done;){var r=e.value;this.maskManager.drawGeometryMask(this.engine.renderer,r.geometry,r.worldMatrix,r.material,t)}},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 a=t.last,s=!1;!s;){var o=a.content[0],u=a.content[3];if(o>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),a.pre?a=a.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=[],a=new X,s=!1;if(r&&r.content)do{var o=r.content,u=o[0];o[2];var h=o[3];if(u>this.timePassed){var l=this.getPointPosition(h),c=t.ray,f=!1;c&&(f=!!c.intersectSphere({center:l,radius:t.radius},a)),f&&(this.clickedPoint=r,n.push(l),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 a=this.trails,s=this.getPointPosition(i),o=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(l*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){s.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&s.subtract(c)}n.addTrailPoint(t,s,{color:o,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,a=t.gravity,s=void 0===a?[]:a,o=this.options.forceTarget,u=this.time-n,h=new X,l=X.fromArray(s);e.assignWorldTRS(h);var c=va(new X,this.options,l,u,r,h,i);if(o){var f=o.target||[0,0,0],d=o.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),a=e.particleFollowParent?Sn.IDENTITY:this.transform.getWorldMatrix(),s=t.position,o=a.transformPoint(s,new X),u=new sa({position:o,valid:!0}),h=t.direction;if(h=a.transformNormal(h,Ll).normalize(),e.startTurbulence&&e.turbulence){for(var l=0;l<3;l++)zl.setElement(l,e.turbulence[l].getValue(i));Bl.setFromVector3(zl.negate()),Gl.setFromEuler(Bl).transformNormal(h).normalize()}var c,f=kl,d=Dl;r.alignSpeedDirection?(d.copyFrom(h),this.upDirectionWorld||(r.upDirection?this.upDirectionWorld=r.upDirection.clone():this.upDirectionWorld=X.Z.clone(),a.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=Ul)[0]=p.animationDelay.getValue(i),c[1]=p.animationDuration.getValue(i),c[2]=p.cycles.getValue(i));var m=Vl;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=Fl;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 X;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:Xl(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&&E(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:Bn.sphere,area:t}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e;this.props=i;var r,n,a,s,o,u=i.options,h=i.positionOverLifetime,l=void 0===h?{}:h,c=i.shape,f=null==l?void 0:l.gravityOverLifetime,d=ya(null==l?void 0:l.gravity),p=i.textureSheetAnimation,m=p?{animationDelay:xs(p.animationDelay||0),animationDuration:xs(p.animationDuration||1),cycles:xs(p.cycles||1),animate:p.animate,col:p.col,row:p.row,total:p.total||p.col*p.row}:void 0,v=!!(c&&c.turbulenceX||(null==c?void 0:c.turbulenceY)||(null==c?void 0:c.turbulenceZ));v&&(r=[xs(null!=(n=c.turbulenceX)?n:0),xs(null!=(a=c.turbulenceY)?a:0),xs(null!=(s=c.turbulenceZ)?s:0)]);this.name="ParticleSystem",this.shape=Oh(c),this.emission={rateOverTime:xs(i.emission.rateOverTime),burstOffsets:jl(null!=(o=i.emission.burstOffsets)?o:[]),bursts:(i.emission.bursts||[]).map((function(t){return new hl(t)}))},this.textureSheetAnimation=m;var y,g,x=i.renderer||{},b=i.rotationOverLifetime;b&&((y={}).asRotation=!!b.asRotation,y.z=b.z?xs(b.z):xs(0),b.separateAxes&&(y.x=b.x&&xs(b.x),y.y=b.y&&xs(b.y))),(null==l?void 0:l.forceTarget)&&(g={target:l.target||[0,0,0],curve:xs(l.forceCurve||[he.LINE,[[0,0],[1,1]]])});var T={x:l.linearX&&xs(l.linearX||0),y:l.linearY&&xs(l.linearY||0),z:l.linearZ&&xs(l.linearZ||0),asMovement:l.asMovement},_={x:l.orbitalX&&xs(l.orbitalX),y:l.orbitalY&&xs(l.orbitalY),z:l.orbitalZ&&xs(l.orbitalZ),center:l.orbCenter,asRotation:l.asRotation},w=i.sizeOverLifetime||{},S=i.colorOverLifetime,C=(null==w?void 0:w.separateAxes)?{separateAxes:!0,x:xs(w.x),y:xs(w.y)}:{separateAxes:!1,x:xs(("size"in w?w.size:w.x)||1)};x.anchor=x.anchor||[0,0];var A,M,I=j.fromArray(x.anchor);this.options={particleFollowParent:!!u.particleFollowParent,startLifetime:xs(u.startLifetime),startDelay:xs(u.startDelay||0),startSpeed:xs(l.startSpeed||0),startColor:xs(u.startColor),looping:null!=(A=u.looping)&&A,maxCount:null!=(M=u.maxCount)?M:0,gravityModifier:xs(f||0),gravity:d,start3DSize:!!u.start3DSize,startTurbulence:v,turbulence:r,speedOverLifetime:l.speedOverLifetime&&xs(l.speedOverLifetime),linearVelOverLifetime:T,orbitalVelOverLifetime:_,forceTarget:g},u.startRotationZ&&(this.options.startRotation=xs(u.startRotationZ||0)),(u.startRotationX||u.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=xs(u.startRotationX||0),this.options.startRotationY=xs(u.startRotationY||0),this.options.startRotationZ=xs(u.startRotationZ||0)),u.start3DSize?(this.options.startSizeX=xs(u.startSizeX),this.options.startSizeY=xs(u.startSizeY)):(this.options.startSize=xs(u.startSize),this.options.sizeAspect=xs(u.sizeAspect||1)),i.mask&&this.maskManager.setMaskOptions(this.engine,i.mask);var R={name:this.name,matrix:Sn.IDENTITY,shaderCachePrefix:"",renderMode:x.renderMode||ee.BILLBOARD,side:x.side||Zt.DOUBLE,gravity:d,blending:x.blending||Yt.ALPHA,rotationOverLifetime:y,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:m,occlusion:!!x.occlusion,transparentOcclusion:!!x.transparentOcclusion,maxCount:u.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:g,diffuse:x.texture?this.engine.findObject(x.texture):void 0,sizeOverLifetime:C,anchor:I};if(S){var O=S.color,P=S.opacity;R.colorOverLifetime={},P&&(R.colorOverLifetime.opacity=xs(S.opacity)),O&&(O[0]===he.GRADIENT_COLOR?R.colorOverLifetime.color=S.color[1]:O[0]===he.RGBA_COLOR?R.colorOverLifetime.color=cn.createWithData(this.engine,{data:new Uint8Array(O[1]),width:1,height:1}):E(O,cn)&&(R.colorOverLifetime.color=O))}var N,L=[],F=[0,0,1,1];if(i.splits){var V=i.splits[0];F=(N=V[4])?[V[0],V[1],V[3],V[2]]:[V[0],V[1],V[2],V[3]]}if(m&&!m.animate)for(var k=N?m.row:m.col,D=N?m.col:m.row,z=m.total||k*D,B=0,U=0;U<k;U++)for(var G=0;G<D&&B<z;G++,B++)L.push([U*F[2]/k+F[0],G*F[3]/D+F[1],F[2]/k,F[3]/D]);else L.push(F);this.uvs=L,R.textureFlip=N;var X,W=i.trails;W&&(this.trails={lifetime:xs(W.lifetime),dieWithParticles:!1!==W.dieWithParticles,sizeAffectsWidth:!!W.sizeAffectsWidth,sizeAffectsLifetime:!!W.sizeAffectsLifetime,inheritParticleColor:!!W.inheritParticleColor,parentAffectsPosition:!!W.parentAffectsPosition},X={name:"Trail",matrix:Sn.IDENTITY,minimumVertexDistance:W.minimumVertexDistance||.02,maxTrailCount:u.maxCount,pointCountPerTrail:Math.round(W.maxPointPerTrail)||32,blending:W.blending,texture:W.texture?this.engine.findObject(W.texture):void 0,opacityOverLifetime:xs(W.opacityOverLifetime||1),widthOverTrail:xs(W.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!W.occlusion,transparentOcclusion:!!W.transparentOcclusion,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},W.colorOverLifetime&&W.colorOverLifetime[0]===he.GRADIENT_COLOR&&(X.colorOverLifetime=W.colorOverLifetime[1]),W.colorOverTrail&&W.colorOverTrail[0]===he.GRADIENT_COLOR&&(X.colorOverTrail=W.colorOverTrail[1])),this.particleMeshProps=R,X&&(this.trailMeshProps=X);var H,Y=i.interaction;Y&&(this.interaction={multiple:Y.multiple,radius:null!=(H=Y.radius)?H:.4,behavior:Y.behavior});this.item.getHitTestParams=this.getHitTestParams},xr(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}(br);Nl=_([$e(ze.ParticleSystem)],Nl);var Ll=new X,Fl=new j,Vl=new Cn,kl=new X,Dl=new X,zl=new X,Bl=new Cn,Ul=[0,0,0],Gl=new Sn;function jl(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var i=E(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 Xl(t,e){var i=Math.floor(Math.random()*t.length),r=t[i];return e||t.splice(i,1),r}var Wl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.create=function(t,e){var i=e[this.getInstanceId()];if(E(i,oa))for(var r,n=Ze(this.getChildTracks());!(r=n()).done;){var a=r.value;if(E(a,nh)){if(i.getComponent(Nl))for(var s,o=t.createTrack(ch,this,"ParticleTrack"),u=Ze(a.getClips());!(s=u()).done;){var h=s.value,l=o.createClip(Al);l.start=h.start,l.duration=h.duration,l.endBehavior=h.endBehavior}if(i.getComponent(lc))for(var c,f=t.createTrack(sc,this,"SpriteComponentTimeTrack"),d=Ze(a.getClips());!(c=d()).done;){var p=c.value,m=f.createClip(uc);m.start=p.start,m.duration=p.duration,m.endBehavior=p.endBehavior}if(i.getComponent(qs))for(var v,y=t.createTrack(oc,this,"EffectComponentTimeTrack"),g=Ze(a.getClips());!(v=g()).done;){var x=v.value,b=y.createClip(uc);b.start=x.start,b.duration=x.duration,b.endBehavior=x.endBehavior}break}}},e}(ih);Wl=_([$e(ze.ObjectBindingTrack)],Wl);var Hl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){return new Vu},e}(Mu);Hl=_([$e(ze.ActivationPlayableAsset)],Hl);var Yl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Yl.prototype,"curveData",void 0),Yl=_([$e(ze.ColorPropertyPlayableAsset)],Yl);var Zl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Zl.prototype,"curveData",void 0),Zl=_([$e(ze.FloatPropertyPlayableAsset)],Zl);var ql=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){return new ju},e}(Mu);ql=_([$e(ze.SubCompositionPlayableAsset)],ql);var Kl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Kl.prototype,"curveData",void 0),Kl=_([$e(ze.Vector4PropertyPlayableAsset)],Kl);var Ql=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Ql.prototype,"curveData",void 0),Ql=_([$e(ze.Vector3PropertyPlayableAsset)],Ql);var Jl=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){var t=new ku;return t.curve=xs(this.curveData),t.value=t.curve.getValue(0),t},e}(Mu);_([ti()],Jl.prototype,"curveData",void 0),Jl=_([$e(ze.Vector2PropertyPlayableAsset)],Jl);var $l=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}(),tc=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}oe(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=Ze(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,s=Ze(t.getChildTracks());!(a=s()).done;){var o=a.value;this.addSubTracksRecursive(o,e)}},xr(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=Ze(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(ii);_([ti()],tc.prototype,"tracks",void 0),tc=_([$e(ze.TimelineAsset)],tc);var ec=function(){function t(t,e){this.masterTrackInstances=[],this.clips=[];for(var i,r={},n=Ze(e);!(i=n()).done;){var a=i.value;r[a.key.getInstanceId()]=a.value}for(var s,o=Ze(t.tracks);!(s=o()).done;){var u=s.value;E(u,Wl)&&u.create(t,r)}this.compileTracks(t.flattenedTracks,e)}var e=t.prototype;return e.evaluate=function(t,e){for(var i,r=Ze(this.clips);!(i=r()).done;){i.value.evaluateAt(t)}for(var n,a=Ze(this.masterTrackInstances);!(n=a()).done;){var s=n.value;this.tickTrack(s,e)}},e.compileTracks=function(t,e){for(var i,r=t,n={},a=Ze(r);!(i=a()).done;){var s=i.value,o=s.createPlayableGraph(this.clips),u=s.createOutput(),h=new $l(s,o,u);n[s.getInstanceId()]=h,s.parent||this.masterTrackInstances.push(h)}for(var l,c=Ze(r);!(l=c()).done;)for(var f,d=l.value,p=n[d.getInstanceId()],m=Ze(d.getChildTracks());!(f=m()).done;){var v=n[f.value.getInstanceId()];p.addChild(v)}for(var y,g=Ze(e);!(y=g()).done;){var x=y.value;n[x.key.getInstanceId()].boundObject=x.value}for(var b,T=Ze(this.masterTrackInstances);!(b=T()).done;){var E=b.value;this.updateTrackAnimatedObject(E)}},e.tickTrack=function(t,e){var i=t.output.context;i.deltaTime=e,t.output.setUserData(t.boundObject);for(var r,n=Ze(t.mixer.clipPlayables);!(r=n()).done;){var a=r.value;a.getPlayState()===wu.Playing&&a.processFrame(i)}t.mixer.evaluate(i);for(var s,o=Ze(t.children);!(s=o()).done;){var u=s.value;this.tickTrack(u,e)}},e.updateTrackAnimatedObject=function(t){for(var e,i=Ze(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}(),ic=[[0,0,1,1,0]],rc=0,nc=function(t){function e(){return t.apply(this,arguments)}oe(e,t);var i=e.prototype;return i.createPlayable=function(){var t=new Ru;return t.create(this.data),t},i.fromData=function(t){this.data=t},e}(Mu);nc=_([$e(ze.SpriteColorPlayableAsset)],nc);var ac=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createTrackMixer=function(){return new Lu},e}(ih),sc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(lc)},e}(ac),oc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.updateAnimatedObject=function(t){return t.getComponent(qs)},e}(ac),uc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.createPlayable=function(){return new hc},e}(Mu),hc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(Cu),lc=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).time=0,r.duration=1,r.splits=ic,r.name="MSprite"+rc++,i&&r.fromData(i),r}oe(e,t);var i=e.prototype;return i.onUpdate=function(e){var i=this;t.prototype.onUpdate.call(this,e);var r,n=this.time,a=this.duration,s=this.textureSheetAnimation,o=null==(r=null==s?void 0:s.loop)||r;n>a&&o&&(n%=a);var u=Math.min(Math.max(n/a,0),1),h=this.renderer.texture.source.video;if(h&&(0===n?h.pause():h.play().catch((function(t){i.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),s){var l,c,f,d,p,m=s.total||s.row*s.col,v=0,y=0,g=1,x=1;if(this.splits){var b=this.splits[0];c=b[4],v=b[0],y=b[1],c?(g=b[3],x=b[2]):(g=b[2],x=b[3])}if(c?(f=1/s.row*g,d=1/s.col*x):(f=1/s.col*g,d=1/s.row*x),s.animate){var T=Math.round(u*(m-1)),E=Math.floor(T/s.col),_=T-E*s.col;p=c?[f*E,d*(s.col-_)]:[f*_,d*(1+E)]}else p=[0,d];null==(l=this.material.getVector4("_TexOffset"))||l.setFromArray([v+p[0],x+y-p[1],f,d])}this.time=n+e/1e3},i.onDisable=function(){t.prototype.onDisable.call(this),this.time=0},i.onDestroy=function(){var t=this.renderer.texture.source;t.sourceType===Mr.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]),a=n?e[3]:e[2],s=n?e[2]:e[3],o=n?-Math.PI/2:0,u=t.getAttributeData("aUV"),h=t.getAttributeData("aPos"),l=t.getIndexData(),c=[0,0];if(u&&h&&l){for(var f=u.length/2,d=0;d<f;d++){var p=3*d,m=2*d,v=h[p],y=h[p+1];c[0]=v,c[1]=y,ol(c,c,o),u[m]=(c[0]+.5)*a+i,u[m+1]=(c[1]+.5)*s+r}this.geometry.setAttributeData("aPos",h.slice()),this.geometry.setAttributeData("aUV",u.slice()),this.geometry.setIndexData(l.slice()),this.geometry.setDrawCount(l.length)}this.geometry.subMeshes.length=0;for(var g,x=Ze(t.subMeshes);!(g=x()).done;){var b=g.value;this.geometry.subMeshes.push({offset:b.offset,indexCount:b.indexCount,vertexCount:b.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=[],a=[],s=[],o=0;o<2;o++)for(var u=0;u<2;u++){var h=4*(2*u+o),l=e?[0,0,1,1,t[0][4]]:t[2*u+o],c=l[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],f=((o+o+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),a.push(h,1+h,2+h,2+h,1+h,3+h)}i.setAttributeData("aPos",new Float32Array(s)),i.setIndexData(new Uint16Array(a)),i.setAttributeData("aUV",new Float32Array(n)),i.setDrawCount(a.length)},i.fromData=function(e){var i;t.prototype.fromData.call(this,e);var r=null!=(i=e.splits)?i:ic,n=e.textureSheetAnimation;this.splits=r,this.textureSheetAnimation=n;var a=e.geometry?this.engine.findObject(e.geometry):this.defaultGeometry;1===r.length?this.updateGeometry(a):this.updateGeometryFromMultiSplit(),this.interaction=e.interaction;var s,o=e.options.startColor||[1,1,1,1];this.material.setColor("_Color",(new H).setFromArray(o)),this.duration=null!=(s=e.duration)?s:this.item.duration},e}(iu);lc=_([$e(ze.SpriteComponent)],lc);var cc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(lu(ae)),fc=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 mt(t),t}if(yl(pl))return e._createOffscreenCanvas(10,10);var i=c.createElement("canvas");return i.getContext("2d",{willReadFrequently:!0}),i},i.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?P(this.elements,t):t.remove()},t}()),dc=function(){function t(t){this.width=0,this.height=0,this.autoResize=Te.fixed,this.keepWordIntact=!0,this.update(t)}var e=t.prototype;return e.update=function(t){var e=t.textHeight,i=void 0===e?100:e,r=t.textWidth,n=void 0===r?100:r,a=t.textOverflow,s=void 0===a?be.clip:a,o=t.textVerticalAlign,u=void 0===o?we.top:o,h=t.textAlign,l=void 0===h?_e.left:h,c=t.letterSpace,f=void 0===c?0:c,d=t.fontSize,p=t.lineHeight,m=void 0===p?d:p,v=t.autoResize,y=void 0===v?Te.fixed:v,g=t.keepWordIntact,x=void 0===g||g;this.letterSpace=f,this.overflow=s,this.textVerticalAlign=u,this.textAlign=l,this.width=n,this.height=i,this.autoResize=y,this.keepWordIntact=x,this.lineHeight=m},e.getOffsetY=function(t,e,i,r,n){var a=(i-r)/3,s=r,o=void 0!==n?n:i*(e-1),u=0;switch(this.textVerticalAlign){case we.top:u=s+a;break;case we.middle:u=(this.height-o+s)/2;break;case we.bottom:u=this.height-o-a}return u},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case _e.left:i=0;break;case _e.middle:i=(this.width-e)/2;break;case _e.right:i=this.width-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),pc=function(){function t(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0,this.update(t)}return t.prototype.update=function(t){var e,i,r,n,a,s,o,u=t.textColor,h=void 0===u?[1,1,1,1]:u,l=t.fontSize,c=void 0===l?40:l,f=t.outline,d=t.shadow,p=t.fontWeight,m=void 0===p?"normal":p,v=t.fontStyle,y=void 0===v?"normal":v,g=t.fontFamily,x=void 0===g?"sans-serif":g;(this.textColor=[].concat(h),this.textWeight=m,this.fontStyle=y,this.fontFamily=x,this.fontSize=c,this.isOutlined=!1,this.outlineColor=[1,1,1,1],this.outlineWidth=0,f&&(null!=(e=f.outlineWidth)?e:0)>0)&&(this.isOutlined=!0,this.outlineColor=[].concat(null!=(i=f.outlineColor)?i:[1,1,1,1]),this.outlineWidth=null!=(r=f.outlineWidth)?r:0);(this.hasShadow=!1,this.shadowBlur=2,this.shadowColor=[0,0,0,1],this.shadowOffsetX=0,this.shadowOffsetY=0,d)&&(this.hasShadow=!0,this.shadowBlur=null!=(n=d.shadowBlur)?n:2,this.shadowColor=[].concat(null!=(a=d.shadowColor)?a:[0,0,0,1]),this.shadowOffsetX=null!=(s=d.shadowOffsetX)?s:0,this.shadowOffsetY=null!=(o=d.shadowOffsetY)?o:0);this.fontOffset=0,this.fontStyle!==Ce.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},t}(),mc=function(){function t(){this.isDirty=!0,this.maxLineWidth=0,this.ALPHA_FIX_VALUE=1/255}var e=t.prototype;return e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextVerticalAlign=function(t){this.textLayout.textVerticalAlign!==t&&(this.textLayout.textVerticalAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){console.warn("setTextBaseline 已废弃,请改用 setTextVerticalAlign。本次调用将转调用 setTextVerticalAlign。"),this.setTextVerticalAlign(t)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){yt(t)?this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("Risky font family, ignored:",t)},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.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontFamily,n=e.textWeight,a=e.fontStyle,s=(t||i).toString()+"px ";return["serif","sans-serif","monospace","courier"].includes(r)?s+=r:s+='"'+r+'"',n!==Se.normal&&(s=n+" "+s),a!==Ce.normal&&(s=a+" "+s),s},e.setupOutline=function(t){void 0===t&&(t=1);var e=this.context,i=this.textStyle,r=i.outlineColor,n=i.outlineWidth,a=r[0],s=r[1],o=r[2],u=r[3];e&&(e.strokeStyle="rgba("+255*a+", "+255*s+", "+255*o+", "+u+")",e.lineWidth=2*n/t)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.shadowColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,s=e.fontScale,o=i[0],u=i[1],h=i[2],l=i[3];t&&(t.shadowColor="rgba("+255*o+", "+255*u+", "+255*h+", "+l+")",t.shadowBlur=r*s,t.shadowOffsetX=n*s,t.shadowOffsetY=-a*s)},e.disposeTextTexture=function(){var t=this.renderer.texture;t&&t!==this.engine.whiteTexture&&t.dispose()},e.renderToTexture=function(t,e,i,r,n){if(void 0===n&&(n={}),this.context&&this.canvas){var a=this.context;a.save(),this.canvas.width=t,this.canvas.height=e,a.setTransform(1,0,0,1,0,0),i||(a.translate(0,e),a.scale(1,-1)),a.clearRect(0,0,t,e),a.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",r(a),a.restore();var s=a.getImageData(0,0,t,e),o=cn.createWithData(this.engine,{data:new Uint8Array(s.data),width:s.width,height:s.height},{flipY:i,magFilter:Rr.LINEAR,minFilter:Rr.LINEAR,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE});!1!==n.disposeOld&&this.disposeTextTexture(),this.renderer.texture=o,this.material.setTexture("_MainTex",o)}},e.initTextBase=function(t){this.engine=t,this.canvas=fc.getCanvas(),fc.saveCanvas(this.canvas),this.context=this.canvas.getContext("2d",{willReadFrequently:!0})},t}(),vc=["serif","sans-serif","monospace","courier"],yc=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,gc=function(t){return" "===t||"\t"===t||" "===t},xc=0,bc=function(t){function e(e){var i;(i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.effectScaleX=1,i.effectScaleY=1,i.maxLineWidth=0,i.name="MText"+xc++,i.canvas=fc.getCanvas(),fc.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0});var r=i.getDefaultProps().options;return i.updateWithOptions(r),i}oe(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture();for(var i,r=Ze(this.materials);!(i=r()).done;){var n=i.value,a=this.transform.size.x,s=this.transform.size.y,o=this.getTextureExpandScale();a*=o[0],s*=o[1],n.setVector2("_Size",new j(a,s))}},i.render=function(t){this.maskManager.drawStencilMask(t,this),t.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.material)},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.resetState(),this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new H(1,1,1,1))},i.resetState=function(){this.disposeTextTexture(),this.isDirty=!0,this.lineCount=0,this.maxLineWidth=0},i.updateWithOptions=function(t){this.textStyle?this.textStyle.update(t):this.textStyle=new pc(t),this.textLayout?this.textLayout.update(t):this.textLayout=new dc(t),this.text=t.text.toString()},i.getLineCount=function(t){var e=this.context,i=this.textLayout,r=i.letterSpace,n=i.overflow;this.maxLineWidth=0;var a=this.textLayout.width+this.textStyle.fontOffset,s=1,o=0,u=0;if(e&&(e.font=this.getFontDesc(this.textStyle.fontSize)),n===be.display){for(var h=0;h<t.length;h++){var l,c,f=t[h],d=null!=(c=null==e||null==(l=e.measureText(f))?void 0:l.width)?c:0;"\n"===f?(s++,o=0,u=0):(u>0&&(o+=r),o+=d,u++,this.maxLineWidth=Math.max(this.maxLineWidth,o))}return s}if(this.textLayout.keepWordIntact)for(var p=0,m=0,v=0;v<t.length;v++){var y,g,x=t[v],b=null!=(g=null==e||null==(y=e.measureText(x))?void 0:y.width)?g:0;if("\n"!==x)o+(u>0?r:0)+b>a&&u>0&&(s++,m>1?(this.maxLineWidth=Math.max(this.maxLineWidth,p),o-=p,u-=m):(this.maxLineWidth=Math.max(this.maxLineWidth,o),o=0,u=0),p=0,m=0),u>0&&(o+=r),o+=b,u++,gc(x)&&(p=o,m=u);else s++,this.maxLineWidth=Math.max(this.maxLineWidth,o),o=0,u=0,p=0,m=0}else for(var T=0;T<t.length;T++){var E,_,w=t[T],S=null!=(_=null==e||null==(E=e.measureText(w))?void 0:E.width)?_:0;u>0&&(o+=r),(o+S>a&&T>0||"\n"===w)&&(s++,this.maxLineWidth=Math.max(this.maxLineWidth,o),o=0,u=0),"\n"!==w&&(o+=S,u++)}return this.maxLineWidth=Math.max(this.maxLineWidth,o),s},i.setLineHeight=function(t){var e=this.textStyle.fontSize,i=Math.max(e,t);this.textLayout.lineHeight!==i&&(this.textLayout.lineHeight=i,this.isDirty=!0)},i.updateTexture=function(t){var e=this;if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var i=this.textStyle,r=this.textLayout,n=i.fontScale;r.autoResize===Te.autoWidth?(r.width=this.getTextWidth(),this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):r.autoResize===Te.autoHeight?(this.lineCount=this.getLineCount(this.text),r.height=r.lineHeight*this.lineCount):this.lineCount=this.getLineCount(this.text);var a=r.width+i.fontOffset,s=r.height,o=i.fontSize,u=r.lineHeight;i.fontDesc=this.getFontDesc(o);var h=Array.from(this.text||""),l=this.getEffectPadding(),c=l.padL,f=l.padR,d=l.padT,p=l.padB,m=0!=(c|f|d|p),v=this.engine.gpuCapability.detail.maxTextureSize/2,y=m?a+c+f:a,g=m?s+d+p:s,x=Math.max(y,g,1);n=Math.min(n,v/x);var b=Math.ceil(y*n),T=Math.ceil(g*n),E=m?c:0,_=m?t?d:p:0;this.effectScaleX=a>0?b/(a*n):1,this.effectScaleY=s>0?T/(s*n):1;var w=.0123044998279225;this.transform.setSize(a*w,s*w),this.renderToTexture(b,T,t,(function(t){t.scale(n,n),e.maxLineWidth>a&&r.overflow===be.display?t.font=e.getFontDesc(o*a/e.maxLineWidth):t.font=i.fontDesc;var s=i.textColor,l=s[0],c=s[1],f=s[2],d=s[3];t.fillStyle="rgba("+255*l+", "+255*c+", "+255*f+", "+d+")";var p=[],m=0,v=r.getOffsetY(i,e.lineCount,u,o),y=[],g=[];if(r.keepWordIntact)for(var x=-1,b=0;b<h.length;b++){var T=h[b],w=t.measureText(T);if("\n"!==T){if(m+(y.length>0?r.letterSpace:0)+w.width>a&&y.length>0)if(x>0){var S=y.slice(0,x),C=g.slice(0,x),A=S.length>0?C[C.length-1]+t.measureText(S[S.length-1]).width:0;p.push({y:v,width:A,chars:S,charOffsetX:C}),v+=u,y=y.slice(x+1),m=0,g=[];for(var M=0;M<y.length;M++)M>0&&(m+=r.letterSpace),g.push(m),m+=t.measureText(y[M]).width;x=-1}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1;y.length>0&&(m+=r.letterSpace),g.push(m),y.push(T),m+=w.width,gc(T)&&(x=y.length-1)}else p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[],x=-1}else for(var I=0;I<h.length;I++){var R=h[I],O=t.measureText(R);y.length>0&&(m+=r.letterSpace),(m+O.width>a&&I>0||"\n"===R)&&(p.push({y:v,width:m,chars:y,charOffsetX:g}),m=0,v+=u,y=[],g=[]),"\n"!==R&&(y.push(R),g.push(m),m+=O.width)}y.length>0&&p.push({y:v,width:m,chars:y,charOffsetX:g});var P=i.isOutlined&&i.outlineWidth>0;P&&(i.hasShadow&&e.setupShadow(),e.setupOutline(n),p.forEach((function(e){var n=_+e.y,a=e.chars.join("");if(a.length>0&&yc.test(a)){var s=t.measureText(a).width,o=r.getOffsetX(i,s);t.save(),t.direction="rtl",t.strokeText(a,E+o+s,n),t.restore()}else for(var u=r.getOffsetX(i,e.width),h=0;h<e.chars.length;h++){var l=e.chars[h],c=E+u+e.charOffsetX[h];t.strokeText(l,c,n)}})),i.hasShadow&&(t.shadowColor="transparent")),!P&&i.hasShadow&&e.setupShadow(),p.forEach((function(e){var n=_+e.y,a=e.chars.join("");if(a.length>0&&yc.test(a)){var s=t.measureText(a).width,o=r.getOffsetX(i,s);t.save(),t.direction="rtl",t.fillText(a,E+o+s,n),t.restore()}else for(var u=r.getOffsetX(i,e.width),h=0;h<e.chars.length;h++){var l=e.chars[h],c=E+u+e.charOffsetX[h];t.fillText(l,c,n)}})),i.hasShadow&&(t.shadowColor="transparent")})),this.isDirty=!1}},i.renderText=function(t){this.updateTexture()},i.getTextureExpandScale=function(){return[this.effectScaleX,this.effectScaleY]},i.getEffectPadding=function(){var t=this.textStyle,e=(t.isOutlined&&t.outlineWidth>0?Math.ceil(2*t.outlineWidth):0)+(t.hasShadow&&(t.shadowBlur>0||0!==t.shadowOffsetX||0!==t.shadowOffsetY)?Math.ceil(Math.abs(t.shadowOffsetX)+Math.abs(t.shadowOffsetY)+t.shadowBlur):0);return{padL:e,padR:e,padT:e,padB:e}},i.setAutoResize=function(t){this.textLayout.autoResize!==t&&(this.textLayout.autoResize=t,this.isDirty=!0)},i.setTextWidth=function(t){var e=Math.max(0,Number(t)||0),i=this.textLayout;i.width!==e&&(i.autoResize===Te.autoWidth&&(i.autoResize=Te.autoHeight),i.width=e,this.isDirty=!0)},i.setTextHeight=function(t){var e=Math.max(0,Number(t)||0);if(0!==e){var i=this.textLayout;i.height!==e&&(i.height=e,this.isDirty=!0)}},i.setFontSize=function(t){var e=Math.max(1,Number(t)||1);this.textStyle.fontSize!==e&&(this.textStyle.fontSize=e,this.isDirty=!0)},i.setOutlineWidth=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.outlineWidth!==e&&(this.textStyle.outlineWidth=e,this.isDirty=!0)},i.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},i.setShadowBlur=function(t){var e=Math.max(0,Number(t)||0);this.textStyle.shadowBlur!==e&&(this.textStyle.shadowBlur=e,this.isDirty=!0)},i.setShadowColor=function(t){var e=null!=t?t:[0,0,0,1];this.textStyle.shadowColor!==e&&(this.textStyle.shadowColor=e,this.isDirty=!0)},i.setShadowOffsetX=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetX!==e&&(this.textStyle.shadowOffsetX=e,this.isDirty=!0)},i.setShadowOffsetY=function(t){var e=Number(t)||0;this.textStyle.shadowOffsetY!==e&&(this.textStyle.shadowOffsetY=e,this.isDirty=!0)},i.getTextWidth=function(){var t,e,i,r=this.context;if(!r)return null!=(e=null==(t=this.textLayout)?void 0:t.width)?e:0;var n=(null!=(i=this.text)?i:"").toString(),a=this.textLayout,s=this.textStyle;r.font=this.getFontDesc(s.fontSize);for(var o=0,u=0,h=0;h<n.length;h++){var l=n[h];"\n"!==l?(u+=a.letterSpace||0,u+=r.measureText(l).width):(o=Math.max(o,u),u=0)}o=Math.max(o,u);var c=Math.ceil(o-(s.fontOffset||0)-1e-4)+2;return Math.max(0,c)},i.getDefaultProps=function(){return{id:"default-id-"+Math.random().toString(36).substr(2,9),item:{id:"default-item-"+Math.random().toString(36).substr(2,9)},dataType:ze.TextComponent,options:{text:"默认文本",fontFamily:"AlibabaSans-BoldItalic",fontSize:40,textColor:[1,1,1,1],fontWeight:Se.normal,letterSpace:0,textAlign:_e.middle,fontStyle:Ce.normal,textWidth:200,textHeight:42,lineHeight:40.148},renderer:{renderMode:1,anchor:[.5,.5]}}},e}(iu);kt(bc=_([$e(ze.TextComponent)],bc),[mc]);var Tc=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(lu(ae)),Ec=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(ii),_c=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e}(ii);_([ti()],_c.prototype,"buffer",void 0),_c=_([$e(ze.BinaryAsset)],_c);var wc=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=ei(e);if(r)for(var n,a=Ze(Object.keys(r));!(n=a()).done;){var s=n.value,o=e[s];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(o)?i[s]=o:At(o)?(i[s]||(i[s]=[]),t.serializeArrayProperty(o,i[s],0)):ii.is(o)?i[s]={id:o.getInstanceId()}:It(o)&&(i[s]||(i[s]={}),t.serializeObjectProperty(o,i[s],0))}for(var u,h=Ze(Object.keys(e.definition));!(u=h()).done;){var l=u.value,c=e.definition[l];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(c)?i[l]=c:At(c)?(i[l]||(i[l]=[]),t.serializeArrayProperty(c,i[l],0)):ii.is(c)?i[l]={id:c.getInstanceId()}:It(c)&&(i[l]||(i[l]={}),t.serializeObjectProperty(c,i[l],0))}return i},t.deserialize=function(e,i){i.definition=e;var r=ei(i),n=i.engine;if(r)for(var a,s=Ze(Object.keys(r));!(a=s()).done;){var o=a.value,u=e[o];if(void 0!==u){var h=r[o].type;i[o]=t.deserializeProperty(u,n,0,h)}}i.fromData(i.definition)},t.checkTypedArray=function(t){return E(t,Int8Array)||E(t,Uint8Array)||E(t,Uint8ClampedArray)||E(t,Int16Array)||E(t,Uint16Array)||E(t,Int32Array)||E(t,Uint32Array)||E(t,Float32Array)||E(t,Float64Array)||E(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(It(t)&&1===Object.keys(t).length&&"id"in t&&Ct(t.id))},t.checkGLTFNode=function(t){return It(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return Ot(t)||E(t,u)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),!(r>14)){if(At(e)){for(var s,o=[],u=Ze(e);!(s=u()).done;){var h=s.value;o.push(t.deserializeProperty(h,i,r+1,n,a))}return o}if(t.checkDataPath(e)){var l=i.findObject(e);return a?l:e}if(Rt(e)){var c;c=n?new n:{};for(var f,d=Ze(Object.keys(e));!(f=d()).done;){var p=f.value;c[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return c}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,a=Ze(Object.keys(e));!(n=a()).done;){var s=n.value,o=e[s];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[s]=o:At(o)?(i[s]||(i[s]=[]),t.serializeArrayProperty(o,i[s],r+1)):ii.is(o)?i[s]={id:o.getInstanceId()}:It(o)&&(i[s]||(i[s]={}),t.serializeObjectProperty(o,i[s],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 a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:At(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):ii.is(a)?i[n]={id:a.getInstanceId()}:It(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}}},t}(),Sc=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(r){switch(r.dataType){case ze.Material:e=zn.create(this.engine);break;case ze.Geometry:e=To.create(this.engine);break;case ze.Texture:e=cn.create(this.engine);break;default:var n=Je(r.dataType);n&&(e=new n(this.engine))}if(e)return e.setInstanceId(r.id),this.engine.addInstance(e),wc.deserialize(r,e),e;console.warn("Constructor for DataType: "+r.dataType+" not found.")}else console.warn("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),Cc=function(){function t(){}return t.prototype.loadGUID=function(t){return T((function(){return w(this,(function(t){return[2,void 0]}))}))()},t}();function Ac(t,e){if(!t.includes(e))return t.push(e),!0}function Mc(t){if(Number.isFinite(t))return[he.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===he.CONSTANT)return[he.CONSTANT,t[1]];if("lines"===e)return[he.LINE,t[1]];if(e===he.LINE){var r=i.map((function(t){return[le.LINE,t]}));return[he.BEZIER_CURVE,r]}return"curve"===e||e===he.CURVE?[he.BEZIER_CURVE,qc(i)]:t}}function Ic(t,e){return Array.isArray(t)&&"random"===t[0]?[he.CONSTANT,t[1][e]]:Mc(t)}function Rc(t){return t&&"color"===t[0]?Lc(t[1],!0):[1,1,1,1]}function Oc(t,e){if(t)return"colors"===t[0]?[he.COLORS,t[1].map((function(t){return Lc(t,e)}))]:"gradient"===t[0]?Nc(t[1],e):"color"===t[0]?[he.RGBA_COLOR,Lc(t[1],e)]:t}function Pc(t){return t&&"random"===t[0]?[he.RANDOM,t[1]]:Mc(t)}function Nc(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),a=Lc(t[r],e);i.push([n,a[0],a[1],a[2],a[3]])})),i=i.sort((function(t,e){return t[0]-e[0]})),[he.GRADIENT_COLOR,i]}}function Lc(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 E(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=Fc(i)),i}function Fc(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Vc(t,e){return Array.isArray(t)?t[0]===he.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Nc(t[1],e):Nc(t,e)}function kc(t){if(t){if(3===t.length)return[he.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===he.BEZIER_PATH||e===he.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],s=qc(r);if(!a){a=[];for(var o=0;o<n.length;o++){var u=n[o].slice();0===o?a.push(u):o<n.length-1?(a.push(u),a.push(u)):a.push(u)}}return[he.BEZIER_CURVE_PATH,[s,n,a]]}return t}}function Dc(t){for(var e,i=Ze(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function zc(t){for(var e,i=Ze(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var Bc,Uc=Math.cos,Gc=Math.sin,jc=Math.PI/180,Xc=180/Math.PI;function Wc(t,e){return t?[t[0]-.5,.5-t[1]]:e?Yc[e]:[0,0]}var Hc,Yc=((Bc={})[ie.PARTICLE_ORIGIN_CENTER]=[0,0],Bc[ie.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Bc[ie.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Bc[ie.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Bc[ie.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Bc[ie.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Bc[ie.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Bc[ie.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Bc[ie.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Bc);function Zc(t,e,i,r){var n=i[0],a=i[1],s=r[0],o=s-n;return[[n+(s-n)/3,a+(t*=o)/3],[s-(s-n)/3,r[1]-(e*=o)/3]]}function qc(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],a=0;a<t.length-1;a++){var s=t[a][3]*(e-i),o=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],h=[t[a+1][0],t[a+1][1]];if(u[0]!=h[0]){var l=Zc(s,o,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?[le.EASE_OUT,t]:e===n.length-1?[le.EASE_IN,t]:[le.EASE,t]}))}var Kc=new Map,Qc=new Map;function Jc(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===te.null&&t.endBehavior===ce.destroy&&(t.endBehavior=ce.freeze)}))})),t.version=Wt["2_1"],t}function $c(t){for(var e,i,r,n=function(){var t=u.value;t.endBehavior!==Me&&t.endBehavior!==Ae||(t.endBehavior=ce.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===te.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,i=Ze(t.items);!(e=i()).done;){var r=e.value;h[r.id]=Ft(),r.oldId=r.id,r.id=h[r.id],l[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=h[r]+"^"+n}else e.parentId=h[e.parentId];a.items.push(e),t.items[i]={id:e.id}}));var n=gi({},t,{timelineAsset:{id:""},sceneBindings:[]});a.compositions.push(n),function(t,e,i){for(var r,n=[],a=[],s=[],o={tracks:[],id:Ft(),dataType:"TimelineAsset"},u=Ze(t.items);!(r=u()).done;){var h=e[r.value.id],l=[],c={id:Ft(),dataType:"ActivationPlayableAsset"};s.push(c);var f={id:Ft(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:c.id}}]};if(l.push({id:f.id}),a.push(f),h.type!==te.particle){var d={id:Ft(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};s.push(d);var p={id:Ft(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};l.push({id:p.id}),a.push(p)}if(h.type===te.sprite||h.type===te.text){var m={id:Ft(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};s.push(m);var v={id:Ft(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};l.push({id:v.id}),a.push(v)}if(h.type===te.composition){var y={id:Ft(),dataType:"SubCompositionPlayableAsset"};s.push(y);var g={id:Ft(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};l.push({id:g.id}),a.push(g)}var x={id:Ft(),dataType:"ObjectBindingTrack",children:l,clips:[]};a.push(x),o.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],E=Ze(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:o.id},t.sceneBindings=n,i.miscs.push(o);for(var w,S=Ze(a);!(w=S()).done;){var C=w.value;i.miscs.push(C)}for(var A,M=Ze(s);!(A=M()).done;){var I=A.value;i.miscs.push(I)}}(n,l,a)},a=gi({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),s=Ze(a.images);!(i=s()).done;){i.value.id=Ft()}if(null!=(e=a).textures||(e.textures=[]),a.textures.forEach((function(t){var e;t.id=Ft(),t.dataType=ze.Texture,t.source={id:null==(e=a.images[t.source])?void 0:e.id}})),a.textures.length<a.images.length)for(var o=a.textures.length;o<a.images.length;o++)a.textures.push({id:Ft(),dataType:ze.Texture,source:{id:a.images[o].id},flipY:!0});t.bins&&(r=t.bins,a.bins=r.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:Ft()}})));for(var u,h={},l={},c=Ze(t.compositions);!(u=c()).done;)n();for(var f,d=Ze(a.items);!(f=d()).done;){var p=f.value;if(p.content){if(p.content.renderer&&void 0!==p.content.renderer.texture){var m=p.content.renderer.texture;p.content.renderer.texture={id:a.textures[m].id}}if(p.content.trails&&void 0!==p.content.trails.texture){var v=p.content.trails.texture;p.content.trails.texture={id:a.textures[v].id}}}if(p.transform){var y,g,x,b=[].concat(null!=(y=p.transform.position)?y:[0,0,0]),T=[].concat(null!=(g=p.transform.rotation)?g:[0,0,0]),E=[].concat(null!=(x=p.transform.scale)?x:[1,1,1]);if(Object.assign(p,{transform:{position:{x:b[0],y:b[1],z:b[2]},eulerHint:{x:T[0],y:T[1],z:T[2]},scale:{x:E[0],y:E[1],z:E[0]}}}),p.type===te.sprite&&(p.transform.size={x:E[0],y:E[1]},p.transform.scale={x:1,y:1,z:1}),p.type===te.sprite){var _=p.content;_.renderer||(_.renderer={});var w,S,C,A,M=_.renderer,I=Wc(M.anchor,M.particleOrigin),R=p.transform.size;if(!M.anchor&&void 0!==M.particleOrigin)p.transform.position.x+=-I[0]*(null!=(w=null==R?void 0:R.x)?w:1),p.transform.position.y+=-I[1]*(null!=(S=null==R?void 0:R.y)?S:1);p.transform.anchor={x:I[0]*(null!=(C=null==R?void 0:R.x)?C:1),y:I[1]*(null!=(A=null==R?void 0:R.y)?A:1)}}}if(p.type===te.particle){var O=p.content;O.renderer||(O.renderer={});var P=O.renderer;O.renderer.anchor=Wc(P.anchor,P.particleOrigin)}if(p.type===te.camera&&p.content.positionOverLifetime&&0!==Object.keys(p.content.positionOverLifetime).length&&(p.content.positionOverLifetime.asMovement=!0),void 0!==p.pn){var N=p.pn,L=t.plugins,F=void 0===L?[]:L;void 0!==N&&Number.isInteger(N)&&(p.pluginName=F[N])}switch("editor-gizmo"===p.pluginName&&(p.type="editor-gizmo"),"orientation-transformer"===p.pluginName&&(p.type="orientation-transformer"),p.content.options.target&&"editor-gizmo"===p.pluginName&&(p.content.options.target=h[p.content.options.target]),p.type===te.spine&&t.spines&&0!==t.spines.length&&df(t.spines[p.content.options.spine],p.content,a),p.type!==te.sprite&&p.type!==te.particle&&p.type!==te.mesh&&p.type!==te.skybox&&p.type!==te.light&&"camera"!==p.type&&p.type!==te.tree&&p.type!==te.interact&&p.type!==te.camera&&p.type!==te.text&&p.type!==te.spine&&"editor-gizmo"!==p.type&&"orientation-transformer"!==p.type||(p.components=[],a.components.push(p.content),p.content.id=Ft(),p.content.item={id:p.id},p.dataType=ze.VFXItemData,p.components.push({id:p.content.id})),p.type!==te.null&&p.type!==te.composition||(p.components=[],p.dataType=ze.VFXItemData),p.type){case te.sprite:p.content.dataType=ze.SpriteComponent;break;case te.particle:p.content.dataType=ze.ParticleSystem;break;case te.mesh:p.content.dataType=ze.MeshComponent;break;case te.skybox:p.content.dataType=ze.SkyboxComponent;break;case te.light:p.content.dataType=ze.LightComponent;break;case"camera":p.content.dataType=ze.CameraComponent;break;case"editor-gizmo":p.content.dataType="GizmoComponent";break;case"orientation-transformer":p.content.dataType="OrientationComponent";break;case te.tree:p.content.dataType=ze.TreeComponent;break;case te.interact:p.content.dataType=ze.InteractComponent;break;case te.camera:p.content.dataType=ze.CameraController;break;case te.text:p.content.dataType=ze.TextComponent;break;case te.spine:p.content.dataType=ze.SpineComponent}}return a.version=Wt["3_0"],a}function tf(t){for(var e,i=Ze(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===ze.ShapeComponent){var n=r;if(n.type===Pe.Custom){var a,s=n;(null==(a=s.shapes)?void 0:a.length)>0&&s.shapes[0].fill&&(s.fill=s.shapes[0].fill);for(var o,u=new Array(s.easingIns.length),h=new Array(s.easingOuts.length).fill(!1),l=Ze(s.shapes);!(o=l()).done;)for(var c,f=Ze(o.value.indexes);!(c=f()).done;){var d=c.value,p=s.points[d.point],m=s.easingIns[d.easingIn],v=s.easingOuts[d.easingOut];u[d.easingIn]||(m.x-=p.x,m.y-=p.y,u[d.easingIn]=!0),h[d.easingOut]||(v.x-=p.x,v.y-=p.y,h[d.easingOut]=!0)}}}}return t.version=Wt["3_2"],t}function ef(t){Kc.clear(),Qc.clear();for(var e,i=t.compositions,r=t.items,n=Ze(t.components);!(e=n()).done;){var a=e.value;Kc.set(a.id,a)}for(var s,o=Ze(r);!(s=o()).done;){var u=s.value;Qc.set(u.id,u)}for(var h,l=Ze(i);!(h=l()).done;){lf(h.value)}return t.version=Wt["3_3"],t}function rf(t){var e;null==(e=t.plugins)||e.forEach((function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")}));for(var i,r=Ze(t.items);!(i=r()).done;){var n=i.value;if(n.type===te.sprite){var a=Kc.get(n.components[0].id);if(a){var s,o=a.renderer.shape,u=void 0;if(Number.isInteger(o))u=null==(s=t.shapes)?void 0:s[o];else u=o;a.renderer.shape=u}}}for(var h,l=t.compositionId,c={},f=Ze(t.compositions);!(h=f()).done;){var d=h.value,p=Ft();c[d.id]=p,d.id===l&&(t.compositionId=p),d.id=p;var m={id:Ft(),dataType:"CompositionComponent",items:d.items,timelineAsset:d.timelineAsset,sceneBindings:d.sceneBindings,item:{id:d.id}};d.timelineAsset=void 0,d.sceneBindings=void 0,d.components=[{id:m.id}],t.components.push(m)}for(var v,y=Ze(t.items);!(v=y()).done;){var g=v.value;if(g.content){var x=g.content.options;x&&void 0!==x.refId&&(x.refId=c[x.refId])}}return t.version=Wt["3_4"],t}function nf(t){for(var e,i={},r=Ze(t.components);!(e=r()).done;){var n=e.value;i[n.id]=n}for(var a,s=Ze(t.compositions);!(a=s()).done;)for(var o,u=a.value,h=Ze(u.components);!(o=h()).done;){i[o.value.id].item.id=u.id}for(var l,c=Ze(t.components);!(l=c()).done;){var f=l.value;if(f.dataType===ze.SpriteComponent){var d=f,p=d.renderer.shape;if(!(null==p||"aPoint"in p&&"index"in p)){var m=hf(p);d.geometry={id:m.id},t.geometries.push(m)}}if(f.dataType===ze.ShapeComponent){var v=f;if(v.fills=[],v.fill){var y={type:Re.Solid,color:v.fill.color};v.fills.push(y)}if(delete v.fill,v.strokes=[],v.stroke){var g={type:Re.Solid,color:v.stroke.color};v.strokes.push(g),v.strokeWidth=v.stroke.width,v.strokeCap=v.stroke.cap,v.strokeJoin=v.stroke.join,delete v.stroke}}}return t.version=Wt["3_5"],t}function af(t){if(t.components)for(var e,i=Ze(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===ze.RichTextComponent){var n=r;n.options&&void 0===n.options.useLegacyRichText&&(void 0===n.options.lineGap?n.options.useLegacyRichText=!0:n.options.useLegacyRichText=!1)}(r.dataType===ze.TextComponent||r.dataType===ze.RichTextComponent&&r.options)&&of(r.options),r.dataType===ze.TextComponent&&uf(r.options)}return t.version=Wt["3_6"],t}function sf(t){for(var e,i,r=function(){var e=i.value;if(e.type===te.text&&e.transform){for(var r,a,s,o=t.components.find((function(t){return e.components[0].id===t.id})),u=e.transform.scale.x/(null!=(a=null==(r=o.options)?void 0:r.textWidth)?a:1)/.0123,h=e.transform.scale.x,l=e.transform.scale.y,c=e.transform.scale.z,f=Ze(t.items);!(s=f()).done;){var d=s.value;d.parentId===e.id&&d.transform&&(d.transform.scale.x*=h/u,d.transform.scale.y*=l/u,d.transform.scale.z*=c/u)}e.transform.scale.x=u,e.transform.scale.y=u,e.transform.scale.z=u,n.push({item:e,scaleFactor:u,oldScaleX:h,oldScaleY:l,oldScaleZ:c})}},n=[],a=Ze(t.items);!(i=a()).done;)r();n.length>0&&(null==(e=t.animations)?void 0:e.length)&&function(t,e){for(var i,r=new Map,n=new Map,a=Ze(t.items);!(i=a()).done;){var s=i.value;if(r.set(s.id,s),s.parentId){var o=n.get(s.parentId);o||(o=[],n.set(s.parentId,o)),o.push(s)}}for(var u,h=new Map,l=new Map,c=Ze(e);!(u=c()).done;){var f=u.value;h.set(f.item.id,f);var d=n.get(f.item.id);if(d)for(var p,m=Ze(d);!(p=m()).done;){var v=p.value;l.set(v.id,f)}}for(var y,g=new Map,x=Ze(t.components);!(y=x()).done;){var b=y.value;g.set(b.id,b)}for(var T,E=new Map,_=Ze(t.animations);!(T=_()).done;){var w=T.value;E.set(w.id,w)}for(var S,C=Ze(t.compositions);!(S=C()).done;){for(var A,M,I,R=S.value,O=void 0,P=void 0,N=Ze(R.components);!(I=N()).done;){var L=I.value,F=g.get(L.id);if((null==F?void 0:F.dataType)===ze.Animator?O=F:(null==F?void 0:F.dataType)===ze.CompositionComponent&&(P=F),O&&P)break}if(O){var V=void 0;if(P){var k=P.items;if(k){V=[];for(var D,z=Ze(k);!(D=z()).done;){var B=D.value,U=r.get(B.id);U&&!U.parentId&&V.push(U)}}}if((!V||0===V.length)&&R.children){V=[];for(var G,j=Ze(R.children);!(G=j()).done;){var X=G.value,W=r.get(X.id);W&&V.push(W)}}if(V&&0!==V.length){var H=O,Y=E.get(null==(A=H.graphAsset)?void 0:A.id);if(null==Y||null==(M=Y.graphDataSet)?void 0:M.resources)for(var Z,q=Ze(Y.graphDataSet.resources);!(Z=q()).done;){var K=Z.value,Q=E.get(K.id);if(null==Q?void 0:Q.scaleCurves)for(var J,$=Ze(Q.scaleCurves);!(J=$()).done;){var tt=J.value,et=pf(V,tt.path,n);if(et){var it=h.get(et.id);if(it)mf(tt.keyFrames,it.scaleFactor/it.oldScaleX,it.scaleFactor/it.oldScaleY,it.scaleFactor/it.oldScaleZ);else{var rt=l.get(et.id);rt&&mf(tt.keyFrames,rt.oldScaleX/rt.scaleFactor,rt.oldScaleY/rt.scaleFactor,rt.oldScaleZ/rt.scaleFactor)}}}}}}}}(t,n);for(var s,o=new Map,u=new Map,h=new Map,l=Ze(t.components);!(s=l()).done;){var c=s.value;h.set(c.id,c)}for(var f,d=Ze(t.items);!(f=d()).done;){var p=f.value;p.children=[],o.set(p.id,p)}for(var m,v=Ze(t.compositions);!(m=v()).done;){var y=m.value;y.children=[];for(var g,x=Ze(y.components);!(g=x()).done;){var b=g.value,T=h.get(b.id);if(T.dataType===ze.CompositionComponent){for(var E,_=T,w=Ze(_.items);!(E=w()).done;){var S=E.value,C=o.get(S.id);void 0===C.parentId&&y.children.push({id:C.id})}delete _.items}}u.set(y.id,y)}for(var A,M=Ze(t.items);!(A=M()).done;){var I=A.value;if(I.parentId){var R=o.get(I.parentId);R&&R.children.push({id:I.id})}}return t.version=Wt["3_7"],t}function of(t){t&&void 0===t.TextVerticalAlign&&void 0===t.TextVerticalAlign&&(t.TextVerticalAlign=t.textBaseline)}function uf(t){if(t&&t.textColor){var e,i=t.textColor;t.textColor=[i[0]/255,i[1]/255,i[2]/255,null!=(e=i[3])?e:1]}}function hf(t,e){void 0===e&&(e="形状");for(var i=sl(t),r=i.index,n=void 0===r?[]:r,a=i.aPoint,s=void 0===a?[]:a,o=new Float32Array(s),u=[],h=[],l=0;l<o.length;l+=6)h.push(s[l+2],s[l+3]),u.push(o[l],o[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:Be.TRIANGLES,vertexData:{vertexCount:c,channels:[]},name:e,indexFormat:Ge.UInt16,indexOffset:p,buffer:"",id:Ft(),dataType:ze.Geometry,subMeshes:[]};v.vertexData.channels.push({semantic:je.Position,offset:0,format:Ue.Float32,dimension:3}),v.vertexData.channels.push({semantic:je.Uv,offset:d,format:Ue.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 lf(t){for(var e,i=Ze(t.items);!(e=i()).done;){var r=e.value,n=Qc.get(r.id);if(!n)return;if(n.type===te.sprite||n.type===te.particle||n.type===te.spine||n.type===te.text||n.type===te.richtext||n.type===te.video||n.type===te.shape){var a=Kc.get(n.components[0].id);a&&cf(a)}}}function cf(t){var e=t.renderer,i=null==e?void 0:e.maskMode;i&&i!==Er.NONE&&(i===Er.MASK?(t.mask={isMask:!0},Hc=t.id):i!==qt.OBSCURED&&i!==qt.REVERSE_OBSCURED||(t.mask={inverted:i===qt.REVERSE_OBSCURED,reference:{id:Hc}}))}function ff(t){if(t)for(var e,i=Ze(Object.keys(t));!(e=i()).done;){var r=e.value,n=t[r],a=Array.isArray(n);a&&2===n.length&&Array.isArray(n[1])?t[r]="path"===r?kc(n):Mc(n):a||"object"!=typeof n||ff(n)}}function df(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 pf(t,e,i){var r=function(t){var e;a=null==(e=i.get(a.id))?void 0:e.find((function(e){return e.name===n[t]}))};if(e){for(var n=e.split("/"),a=t.find((function(t){return t.name===n[0]})),s=1;s<n.length&&a;s++)r(s);return a}}function mf(t,e,i,r){if(Array.isArray(t)&&t[0]===he.VECTOR3_CURVE){var n=t[1];Array.isArray(n)&&3===n.length&&(vf(n[0],e),vf(n[1],i),vf(n[2],r))}}function vf(t,e){if(Array.isArray(t)&&t[0]===he.BEZIER_CURVE&&Array.isArray(t[1]))for(var i,r=Ze(t[1]);!(i=r()).done;){var n=i.value;if(Array.isArray(n)&&!(n.length<2)&&Array.isArray(n[1]))for(var a=n[1],s=1;s<a.length;s+=2)a[s]*=e}}function yf(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:kc(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:Mc(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:Mc(n.linearX),linearY:Mc(n.linearY),linearZ:Mc(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Mc(n.orbitalX),orbitalY:Mc(n.orbitalY),orbitalZ:Mc(n.orbitalZ),speedOverLifetime:Mc(n.speedOverLifetime)};zc(a);var s={options:{startColor:Rc(r.startColor)},positionOverLifetime:a};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var o=t.rotationOverLifetime;if(o){var u=s.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=Mc(o.x),u.y=Mc(o.y),u.z=Mc(o.z)):u.z=Mc(o.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=s.colorOverLifetime={opacity:Mc(h.opacity)};h.color&&(l.color=Vc(h.color))}var c=t.sizeOverLifetime;return c&&(s.sizeOverLifetime={separateAxes:c.separateAxes,size:Mc(c.size),x:Mc(c.x),y:Mc(c.y),z:Mc(c.z)}),s}var gf="2.9.2",xf=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,bf=/^(\d+)\.(\d+)$/,Tf=!1;function Ef(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,a,s=null!=(n=xf.exec(r))?n:[],o=null!=(a=xf.exec(gf))?a:[],u=s[1],h=s[2],l=o[1],c=o[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: "+gf+"). 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!==te.mesh&&t.type!==te.light||(t.endBehavior=1===t.endBehavior?ce.destroy:t.endBehavior)}))}))}(t),xf.test(t.version))return Tf="0"===(null==(i=/^(\d+)/.exec(t.version))?void 0:i[0]),sf(af(nf(rf(ef(tf($c(Jc(function(t){var e;_f=Wt["1_0"];var i=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(_f=Wt["1_3"]);var r,n=(t.requires||[]).slice(),a=t.images.map((function(e,i){return wf(e,i,t.imageTags||[])})),s=t.textures||a.map((function(t,e){return{source:e,flipY:!0}})),o={plugins:i,shapes:t.shapes||[],type:"ge",version:_f,playerVersion:null!=(r=t.playerVersion)?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return Sf(t,{plugins:i,requires:n})})),images:a,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:s,bins:(t.bins||[]).slice()};t._textures&&(o._textures=t._textures);return o}(t)))))))));Tf=!1;var r=bf.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]);if(n)return(n<2||2===n&&a<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,i=Ze(t.items);!(e=i()).done;)ff(e.value.content)})),t}(t)),n<3&&(t=$c(Jc(t))),r=bf.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]),n<4&&(a<2&&(t=tf(t)),a<3&&(t=ef(t)),a<4&&(t=rf(t)),a<5&&(t=nf(t)),a<6&&(t=af(t)),a<7&&(t=sf(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var _f=Wt["1_0"];function wf(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 Sf(t,e){var i;void 0===e&&(e={});var r={id:t.id+"",camera:gi({clipMode:Ie},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return If(t,e)})),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var Cf,Af=[0,0,0,1],Mf=.5;function If(t,e){var i;void 0===e&&(e={});var r,n,a,s,o,u,h=te.base,l=t.endBehavior,c=NaN;if(t.content?(h=t.type||te.plugin,u=t.pn,o=t.pluginName,a=t.content,n=t.content,isNaN(u)&&!o&&(o=a.options.type),t.duration&&(c=t.duration),r=t.transform||y(n.transform)):t.particle?(h=te.particle,r=y((n=t.particle).transform,Tf,!0),a=function(t){var e=t.options,i=t.transform,r={type:Kt.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=gi({},t.shape,{type:Kt[a]}),t.shape.upDirection){var s=t.shape.upDirection,o=s[0],u=s[1],h=s[2];0===o&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=Pc(e.turbulenceX),r.turbulenceY=Pc(e.turbulenceY),r.turbulenceZ=Pc(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return Dc(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return Dc(t)}))),l.rateOverTime&&(l.rateOverTime=Pc(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:Pc(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Pc(e.startSize),startSizeX:Pc(e.startSizeX),startSizeY:Pc(e.startSizeY),sizeAspect:Pc(e.sizeAspect),maxCount:e.maxCount,startDelay:Pc(e.startDelay),startColor:Oc(e.startColor,!0),startRotationZ:Pc(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=Pc(e.startRotationX),c.options.startRotationY=Pc(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:kc(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:Pc(f.x),y:Pc(f.y)}:c.sizeOverLifetime={size:Pc(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?Mc(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Mc(e.gravityModifier),startSpeed:Pc(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:Pc(d.linearX),linearY:Pc(d.linearY),linearZ:Pc(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Pc(d.orbitalX),orbitalY:Pc(d.orbitalY),orbitalZ:Pc(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Mc(d.forceCurve)},zc(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Pc(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=Mc(m.y),c.rotationOverLifetime.x=Mc(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:Mc(v.opacity)};v.color&&(y.color=Vc(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Mc(g.cycles),animationDelay:Ic(g.animationDelay,0),animationDuration:Ic(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:Pc(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Mc(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Vc(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Vc(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:Pc(x.opacityOverLifetime)}),c.trails&&zc(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(n)):t.sprite?(h=te.sprite,a=function(t,e){var i=yf(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=te.null,a=yf(n=t.cal,r=y(n.transform,!1,!0))):t.ui?(h=te.interact,r=y((n=t.ui).transform),a=function(t){var e,i=t.options;switch(i.type){case"click":e={type:Jt.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&Rc(i.previewColor),behavior:i.behavior||$t.NOTIFY};break;case"drag":e={type:Jt.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:Jt.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=te.camera,r=y(n.transform),a=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 a,s={path:kc(null==(a=t.transform)?void 0:a.path),linearX:Mc(null==n?void 0:n.translateX),linearY:Mc(null==n?void 0:n.translateY),linearZ:Mc(null==n?void 0:n.translateZ)};zc(s),r.positionOverLifetime=s}var o=t.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:Mc(null==o?void 0:o.rotateX),y:Mc(null==o?void 0:o.rotateY),z:o.separateAxes?Mc(null==o?void 0:o.rotateZ):Mc(o.rotation)};zc(u),r.rotationOverLifetime=u}return r}(n))),null==(i=a.renderer)?void 0:i.anchor){var f=new Float32Array(a.renderer.anchor);f[0]==Mf&&f[1]==Mf?delete a.renderer.anchor:e.requires&&Ac(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]?ce.restart:ce.destroy:ce.restart;else l=l||(null==n||null==(p=n.options)?void 0:p.endBehavior)||ce.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:a};return o?e.plugins?(Ac(e.plugins,o),v.pn=e.plugins.indexOf(o)):v.pluginName=o: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 a=(s=Af,o=r.rotation[0],u=r.rotation[1],h=r.rotation[2],l=Uc(o*jc/2),c=Uc(u*jc/2),f=Uc(h*jc/2),d=Gc(o*jc/2),p=Gc(u*jc/2),m=Gc(h*jc/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,a=e[0],s=e[1],o=e[2],u=e[3],h=a+a,l=s+s,c=o+o,f=a*h,d=s*h,p=s*l,m=o*c,v=u*c,y=1-p-m,g=d-v,x=d+v,b=1-f-m,T=o*h-u*l,E=o*l+u*h,_=1-f-p;return t[1]=Math.asin((r=-1,(i=-T)>(n=1)?n:i<r?r:i))*Xc,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Xc,t[2]=Math.atan2(x,y)*Xc):(t[0]=0,t[2]=Math.atan2(-g,b)*Xc),t}([],a)}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,o,u,h,l,c,f,d,p,m;return{}}}var Rf,Of=((Cf={})[Ht.S]=[Ht.S,Ht.BPlus,Ht.APlus],Cf[Ht.A]=[Ht.A,Ht.BPlus,Ht.APlus],Cf[Ht.B]=[Ht.B,Ht.BPlus],Cf);function Pf(t,e){if(!t||!e)return!0;var i=Of[e];return!!i&&i.includes(t)}function Nf(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,s=n.url;return a&&(e&&e[a]?i=e[a]:s&&(i=s)),i}function Lf(t,e,i){return Ff.apply(this,arguments)}function Ff(){return(Ff=T((function(t,e,i){var r,n;return w(this,(function(a){switch(a.label){case 0:return"string"!=typeof t?[3,2]:[4,qr(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw new Error("Image not provided.");if(!e)return[2,r];if(n=Nf(e,i)){if(Ct(n)&&n!==r.src)return[2,qr(n)];if(E(n,u))return[2,n]}return[2,r]}}))}))).apply(this,arguments)}!function(t){t.isJSONObject=function(t){return It(t)&&"jsonScene"in t},t.isURL=function(t){return It(t)&&"url"in t},t.isWithOptions=function(t){return It(t)&&"options"in t}}(Rf||(Rf={}));var Vf=function(t,e){void 0===e&&(e={}),this.scene=t,this.options=e},kf=1,Df=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Gr),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=kf++,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){var r=this;return T((function(){var n,a,s,o,u,l,c,p,m,v,y,g,x;return w(this,(function(b){return a=Ct(t)?t:r.id,s=f.now(),o=[],u=null==i?void 0:i.engine.gpuCapability,c=null!=(l=null==u?void 0:u.detail.ktx2Support)&&l,p={},v=!1,y=new Promise((function(t,i){m=e.setTimeout((function(){v=!0,r.removeTimer(m);var t=f.now()-s;i(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+o.join(" ")+", url: "+a+"."))}),1e3*r.timeout),r.timers.push(m)})),g=T((function(t,e){var i,r,n,a;return w(this,(function(s){switch(s.label){case 0:if(v)return[3,4];i=f.now(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e()];case 2:return r=s.sent(),n=f.now()-i,o.push("["+t+": "+n.toFixed(2)+"]"),p[t]=n,[2,r];case 3:throw a=s.sent(),new Error("Load error in "+t+", "+a+".");case 4:throw new Error("Load canceled.")}}))})),x=T((function(){var i,u,l,v,y,x,b,T,E,_,S,C,A,M,I;return w(this,(function(w){switch(w.label){case 0:return Ct(t)?(u=new h(t,d.href).href,r.baseUrl=u,[4,g("loadJSON",(function(){return r.loadJSON(u)}))]):[3,2];case 1:return Ct(n=w.sent())&&(n=JSON.parse(n)),[3,3];case 2:n=t,r.baseUrl=d.href,w.label=3;case 3:return Rf.isJSONObject(n)?(i=gi({},n),[3,9]):[3,4];case 4:return[4,g("processJSON",(function(){return r.processJSON(n)}))];case 5:return x=w.sent().jsonScene,i={timeInfos:p,url:t,storage:{},jsonScene:x,bins:[],textureOptions:[],images:[],assets:r.assets},[4,g("plugin:onAssetsLoadStart",(function(){return r.onPluginSceneLoadStart(i)}))];case 6:return w.sent(),b=x.bins,T=void 0===b?[]:b,E=x.images,_=x.fonts,[4,Promise.all([g("processBins",(function(){return r.processBins(T)})),g("processImages",(function(){return r.processImages(E,c)})),g("processFontURL",(function(){return r.processFontURL(_)}))])];case 7:return S=w.sent(),C=S[0],A=S[1],[4,g("processTextures",(function(){return r.processTextures(A,C,x)}))];case 8:M=w.sent(),(l=i.bins).push.apply(l,[].concat(C)),(v=i.textureOptions).push.apply(v,[].concat(M)),(y=i.images).push.apply(y,[].concat(A)),i.renderLevel=r.options.renderLevel,w.label=9;case 9:return I=f.now()-s,wt.info("Load asset: totalTime: "+I.toFixed(4)+"ms "+o.join(" ")+", url: "+a+"."),e.clearTimeout(m),r.removeTimer(m),i.totalTime=I,i.startTime=s,i.timeInfos=p,[2,i]}}))})),[2,Promise.race([y,x()])]}))}))()},i.getAssets=function(){return this.assets},i.processJSON=function(t){return T((function(){var e,i,r,n,a;return w(this,(function(s){for(e=Ef(t),i=e.plugins,r=Ze(void 0===i?[]:i);!(n=r()).done;)if(a=n.value,!Dt[a])throw new Error("The plugin '"+a+"' not found."+Xt(a));return[2,{jsonScene:e}]}))}))()},i.processBins=function(t){var e=this;return T((function(){var i,r,n;return w(this,(function(a){return i=e.options.renderLevel,r=e.baseUrl,n=t.map((function(n){if(E(n,ArrayBuffer))return n;if(Pf(n.renderLevel,i))return e.loadBins(new h(n.url,r).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(n)]}))}))()},i.processFontURL=function(e){var i=this;return T((function(){return w(this,(function(r){return[2,t.loadFontFamily(e,i.baseUrl)]}))}))()},i.processImages=function(t,e){void 0===e&&(e=!1);var i=this;return T((function(){var r,n,a,s,o,l,c,f;return w(this,(function(d){switch(d.label){case 0:return r=i.options,n=r.useCompressedTexture,a=r.variables,s=r.disableWebP,o=r.disableAVIF,l=i.baseUrl,c=t.map(T((function(t,r){var c,f,d,v,y,g,x,b,T,_,S,C,A,M,I,R,O,P,N,L;return w(this,(function(r){switch(r.label){case 0:if(c=t.url,f=t.webp,d=t.avif,v=t.ktx2,y=new h(c,l).href,g=!s&&f?new h(f,l).href:void 0,x=!o&&d?new h(d,l).href:void 0,b=v&&n&&e?new h(v,l).href:void 0,T=t.id,!("template"in t))return[3,8];if(_=t.template,!(S=_.background))return[3,7];C=Nf(_,a),A=S.type===Ve.video,M=S&&A?en:qr,r.label=1;case 1:return r.trys.push([1,6,,7]),[4,nn(C,M)];case 2:return E(I=r.sent(),m)?(i.sourceFrom[T]={url:I.src,type:Mr.video},[2,I]):[3,3];case 3:return S&&Array.isArray(C)&&a&&(a[S.name]=I.src),i.sourceFrom[T]={url:I.src,type:Mr.image},[4,Lf(I,_,a)];case 4:return[2,r.sent()];case 5:return[3,7];case 6:throw R=r.sent(),new Error("Failed to load. Check the template or if the URL is "+(A?"video":"image")+" type, URL: "+C+", Error: "+(R.message||R)+".");case 7:return[3,9];case 8:if("ktx2"in t&&b)return i.sourceFrom[T]={url:b,type:Mr.compressed},[2,i.loadBins(b)];if(E(t,u)||E(t,p)||E(t,m)||E(t,cn))return[2,t];r.label=9;case 9:return x?[4,Yr(y,x)]:[3,11];case 10:return L=r.sent(),[3,13];case 11:return[4,Wr(y,g)];case 12:L=r.sent(),r.label=13;case 13:return P=(O=L).url,N=O.image,i.sourceFrom[T]={url:P,type:Mr.image},[2,N]}}))}))),[4,Promise.all(c)];case 1:return f=d.sent(),i.assignImagesToAssets(t,f),[2,f]}}))}))()},i.onPluginSceneLoadStart=function(t){var e=this;return T((function(){return w(this,(function(i){switch(i.label){case 0:return[4,Gt.onAssetsLoadStart(t,e.options)];case 1:return i.sent(),[2]}}))}))()},i.processTextures=function(t,e,i){var r=this;return T((function(){var n,a,s;return w(this,(function(o){return a=null!=(n=i.textures)?n:t.map((function(t,e){return{source:e}})),s=a.map(T((function(t,n){var a,s,o,u,h,l;return w(this,(function(c){switch(c.label){case 0:if(E(t,cn))return[2,t];if(!("mipmaps"in t))return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,sn(t,e,r.assets,i.bins)];case 2:return[2,c.sent()];case 3:throw a=c.sent(),new Error("Load texture "+n+" fails, error message: "+a+".");case 4:return s=t.source,o=t.id,h="",It(s)?(u=r.assets[s.id],h=s.id,[3,7]):[3,5];case 5:return"string"!=typeof s?[3,7]:[4,qr(Vt(s))];case 6:u=c.sent(),c.label=7;case 7:return u?[4,zf(u,r.sourceFrom[h],o)]:[3,9];case 8:return[2,(l=c.sent()).sourceType===Mr.compressed?l:gi({},l,t)];case 9:throw new Error("Invalid texture source: "+s+".")}}))}))),[2,Promise.all(s)]}))}))()},i.loadJSON=function(t){var e=this;return T((function(){return w(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 T((function(){return w(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.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t.loadFontFamily=function(e,i){return void 0===i&&(i=d.href),T((function(){var r;return w(this,(function(n){return e?(r=e.map(T((function(e){var r,n,a;return w(this,(function(s){switch(s.label){case 0:if(!e.fontURL||t.fontCache.has(e.fontFamily))return[3,4];yt(e.fontFamily)||console.warn("Risky font family: "+e.fontFamily+"."),s.label=1;case 1:return s.trys.push([1,3,,4]),r=new h(e.fontURL,i).href,[4,(a=new FontFace(null!=(n=e.fontFamily)?n:"","url("+r+")")).load()];case 2:return s.sent(),c.fonts.add(a),t.fontCache.add(e.fontFamily),[3,4];case 3:return s.sent(),wt.warn("Invalid font family or font source: "+JSON.stringify(e.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(r)]):[2]}))}))()},t.loadPrecomposition=function(e,i){return T((function(){var r;return w(this,(function(n){switch(n.label){case 0:return[4,new t(i).loadScene(e)];case 1:return r=n.sent(),[2,new Vf(r,i)]}}))}))()},t}();function zf(t,e,i){return Bf.apply(this,arguments)}function Bf(){return(Bf=T((function(t,e,i){var r,n,a,s,o;return w(this,(function(h){switch(h.label){case 0:return r={id:i,dataType:ze.Texture},E(t,cn)?[2,gi({},t.source,r)]:[3,1];case 1:return E(t,u)||Ot(t)?[2,gi({image:t,sourceType:Mr.image,sourceFrom:e,keepImageSource:!0,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR},r)]:[3,2];case 2:return E(t,m)?[2,gi({sourceType:Mr.video,video:t,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR},r)]:[3,3];case 3:if(!E(t,ArrayBuffer))return[3,10];if(!(n=yn.getLoader("ktx2")))return[3,8];h.label=4;case 4:return h.trys.push([4,6,,7]),[4,n.loadFromBuffer(t)];case 5:return a=h.sent(),wt.info("Loading KTX2 texture."),[2,gi({sourceType:a.sourceType,type:a.type,target:a.target,internalFormat:a.internalFormat,format:a.format,mipmaps:a.mipmaps,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR,sourceFrom:e},r)];case 6:throw s=h.sent(),new Error("Failed to parse KTX2 from "+(null!=(o=null==e?void 0:e.url)?o:"buffer")+": "+(s.message||s));case 7:return[3,9];case 8:throw new Error("KTX2 loader not found. Please register it first.");case 9:return[3,11];case 10:if("width"in t&&"height"in t&&"data"in t)return[2,gi({sourceType:Mr.data,data:t,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE,minFilter:Rr.NEAREST,magFilter:Rr.NEAREST},r)];h.label=11;case 11:throw new Error("Invalid texture options.")}}))}))).apply(this,arguments)}Df.fontCache=new Set;var Uf=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(t.whiteTexture),this.builtinObjects.push(t.transparentTexture)}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var i=t;return Rf.isURL(t)&&(Rf.isJSONObject(t)||(i=t.url),Rf.isWithOptions(t)&&(e=gi({},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===te.text||t.type===te.richtext){var r=e[t.name];if(null==r)return;t.components.forEach((function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==ze.TextComponent&&(null==n?void 0:n.dataType)!==ze.RichTextComponent||(n.options.text=r)}))}}))},e.prepareAssets=function(t,e){for(var i,r=Ze(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],s=new Ec(this.engine);s.data=a,s.setInstanceId(n)}this.engine.addPackageDatas(t);for(var o,u=Ze(this.builtinObjects);!(o=u()).done;){var h=o.value;this.engine.addInstance(h)}},e.createShaderVariant=function(){for(var t,e=Ze(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];E(r,zn)&&r.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=Ze(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),Gf=new X(1,1,1),jf=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new sa,this.viewportMatrix=Sn.fromIdentity(),this.viewMatrix=Sn.fromIdentity(),this.projectionMatrix=Sn.fromIdentity(),this.viewProjectionMatrix=Sn.fromIdentity(),this.inverseViewMatrix=Sn.fromIdentity(),this.dirty=!0;var i=e.near,r=void 0===i?.1:i,n=e.far,a=void 0===n?20:n,s=e.fov,o=void 0===s?60:s,u=e.aspect,h=void 0===u?1:u,l=e.clipMode,c=void 0===l?ue.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=new Cn(m[0],m[1],m[2]),y=(new _i).setFromEuler(v);this.options={near:r,far:a,fov:o,aspect:h,clipMode:c},this.transform.setPosition(d[0],d[1],d[2]),this.transform.setQuaternion(y.x,y.y,y.z,y.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 X(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var a=i.projectPoint(e).z,s=r.projectPoint(new X(1,1,a)),o=s.x,u=s.y,h=r.projectPoint(new X(-1,-1,a)),l=h.x,c=h.y;return new X((o-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 gi({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,a=t.aspect,s=t.position,o=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=s,this.rotation=o,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,a=e.far,s=e.clipMode;this.projectionMatrix.perspective(i*k,r,n,a,s===ue.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),Gf),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:Sn.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 X,r=this.getViewProjectionMatrix();i.set(t.x,t.y,t.z),r.projectPoint(i,i);var n=this.engine.canvas.getBoundingClientRect(),a=n.width,s=n.height;return i.x=.5*(i.x+1)*a,i.y=.5*(i.y+1)*s,i.z=.5*(i.z+1),i},e.screenToWorldPoint=function(t,e){this.updateMatrix();var i=null!=e?e:new X,r=this.getInverseViewProjectionMatrix(),n=this.engine.canvas.getBoundingClientRect(),a=n.width,s=n.height,o=t.x/a*2-1,u=t.y/s*2-1,h=2*t.z-1;return i.set(o,u,h),r.projectPoint(i,i),i},xr(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}();function Xf(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var Wf,Hf=function(){function t(){this.update=new Zf,this.lateUpdate=new qf,this.preRender=new Kf}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==br.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==br.prototype.onLateUpdate&&this.lateUpdate.addComponent(t),t.onPreRender!==br.prototype.onPreRender&&this.preRender.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==br.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==br.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t),t.onPreRender!==br.prototype.onPreRender&&this.preRender.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),Yf=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}(),Zf=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=Ze(t);!(i=r()).done;){i.value.onUpdate(e)}},e}(Yf),qf=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=Ze(t);!(i=r()).done;){i.value.onLateUpdate(e)}},e}(Yf),Kf=function(t){function e(){return t.apply(this,arguments)}return oe(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=Ze(t);!(i=r()).done;){i.value.onPreRender()}},e}(Yf),Qf=function(t){function e(e,i,r){var n;(n=t.call(this)||this).engine=e,n.sceneTicking=new Hf,n.speed=1,n.isEnded=!1,n.loaderData={},n.startTime=0,n.videos=[],n.postProcessingEnabled=!1,n.destroyed=!1,n.paused=!0,n.isEndCalled=!1,n._textures=[];var a=null!=i?i:{},s=a.reusable,o=void 0!==s&&s,u=a.speed,h=void 0===u?1:u,l=a.baseRenderOrder,c=void 0===l?0:l,f=a.event,d=a.onItemMessage;n.engine.addComposition(Xf(n));var p,v,y,g,x,b,T,_=null;if(r){var w,S;n.createTexturesFromData(r.textureOptions);for(var C,A=Ze(Object.keys(r.assets));!(C=A()).done;){var M=C.value,I=r.assets[M];E(I,m)&&n.videos.push(I)}n.postProcessingEnabled=null!=(S=null==(w=r.jsonScene.renderSettings)?void 0:w.postProcessingEnabled)&&S,n.engine.renderLevel=r.renderLevel,o&&(r.consumed=!0),_=r.jsonScene.compositions[0];for(var R,O=Ze(r.jsonScene.compositions);!(R=O()).done;){var P=R.value;P.id===r.jsonScene.compositionId&&(_=P)}mt(_)}return n.rootItem=new oa(n.engine),_&&(n.rootItem.setInstanceId(_.id),n.rootItem.instantiatePreComposition(_,!1)),n.rootItem.name="rootItem",n.rootItem.composition=Xf(n),n.rootComposition=null!=(p=n.rootItem.getComponent(Ys))?p:n.rootItem.addComponent(Ys),n.rootComposition.updateMode=Bs.Manual,n.rootComposition.play(),n.rootItem.on("animationevent",(function(t){n.emit("animationevent",t)})),n.renderOrder=c,n.id=null!=(v=null==_?void 0:_.id)?v:Ft(),n.startTime=null!=(y=null==_?void 0:_.startTime)?y:0,n.event=f,n.statistic={loadStart:null!=(g=null==r?void 0:r.startTime)?g:0,loadTime:null!=(x=null==r?void 0:r.totalTime)?x:0,compileTime:0,firstFrameTime:0},n.reusable=o,n.speed=h,n.name=null!=(b=null==_?void 0:_.name)?b:"New Composition",n.camera=new jf(n.name,gi({},null==_?void 0:_.camera,{aspect:n.width/n.height})),n.camera.engine=n.engine,n.url=null!=(T=null==r?void 0:r.url)?T:"",n.interactive=!0,d&&(n.onItemMessage=d),n.createRenderFrame(),Gt.initializeComposition(Xf(n),r),n}oe(e,t);var i=e.prototype;return i.getDuration=function(){return this.rootItem.duration},i.restart=function(){this.reset(),this.forwardTime(this.startTime)},i.setIndex=function(t){this.renderOrder=t},i.getIndex=function(){return this.renderOrder},i.setSpeed=function(t){this.speed=t},i.setVisible=function(t){this.rootItem.setVisible(t)},i.getSpeed=function(){return this.speed},i.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?(this.setTime(this.time-this.startTime),this.resume()):(this.setTime(0),this.resume())},i.pause=function(){this.paused=!0,this.emit("pause")},i.getPaused=function(){return this.paused},i.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var t=this.time;this.emit("play",{time:t})},i.gotoAndPlay=function(t){this.setTime(t),this.emit("goto",{time:t}),this.resume()},i.gotoAndStop=function(t){this.setTime(t),this.emit("goto",{time:t}),this.pause()},i.createRenderFrame=function(){this.renderFrame=new Xo({camera:this.camera,renderer:this.renderer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled})},i.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)},i.addItem=function(t){t.setParent(this.rootItem)},i.getComponent=function(t){return this.rootItem.getComponent(t)},i.forwardTime=function(t){var e=1e3*t-1e3*this.time;this.update(e)},i.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.setTime(0)},i.prepareRender=function(){},i.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.rootComposition.setChildrenRenderOrder(0),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()}},i.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===ce.destroy&&!this.reusable},i.updateCamera=function(){this.camera.updateMatrix()},i.updateCompositionTime=function(t){if(this.rootComposition.state===wu.Playing&&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 ce.restart:e%=i,this.restart();break;case ce.freeze:e=Math.min(i,e);case ce.forward:case ce.destroy:}this.rootComposition.tick(e+this.startTime-this.rootComposition.getTime()),this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},i.createTexturesFromData=function(t){for(var e,i=Ze(t);!(e=i()).done;){var r=e.value,n=this.engine.findObject({id:r.id});n.initialize(),this._textures.push(n)}},i.getItemByName=function(t){return this.rootItem.find(t)},i.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return Ea((t-i.z)/r,(e-i.w)/n,this.camera)},i.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},i.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],a=this.getHitTestRay(t,e);return this.rootItem.hitTest(a,t,e,n,[],i,r),n},i.addInteractiveItem=function(t,e){if(e===Jt.MESSAGE)return null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},i.removeInteractiveItem=function(t,e){e===Jt.MESSAGE&&(null==this.onItemMessage||this.onItemMessage.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},i.destroyItem=function(t){},i.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()},i.dispose=function(){var t=this;if(!this.destroyed){this.destroyed=!0;for(var e,i=Ze(this.textures);!(e=i()).done;){e.value.dispose()}this._textures=[];for(var r,n=Ze(this.videos);!(r=n()).done;){var a=r.value;a.pause(),a.removeAttribute("src"),a.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),Gt.destroyComposition(this),this.update=function(){wt.error("Update disposed composition: "+t.name+".")},this.dispose=St,this.renderer.engine.removeComposition(this),this.engine.env!==$n&&this.renderer.clear({stencilAction:Ar.clear,clearStencil:0,depthAction:Ar.clear,clearDepth:1,colorAction:Ar.clear,clearColor:[0,0,0,0]})}},i.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},i.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.translate=function(t,e,i){this.rootItem.translate(t,e,i)},i.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},i.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},i.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},i.scale=function(t,e,i){this.rootItem.scale(t,e,i)},i.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},i.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},i.reloadTexture=function(){var t=this;return T((function(){return w(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]}}))}))()},xr(e,[{key:"width",get:function(){return this.engine.canvas.width}},{key:"height",get:function(){return this.engine.canvas.height}},{key:"renderer",get:function(){return this.engine.renderer}},{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootItem.getDescendants()}},{key:"time",get:function(){return this.rootComposition.getTime()}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),e}(ea),Jf=new Int32Array(2),$f=new Float32Array(Jf.buffer),td=new Float64Array(Jf.buffer),ed=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"}(Wf||(Wf={}));var id=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new v}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return Jf[0]=this.readInt32(t),$f[0]},e.readFloat64=function(t){return Jf[ed?0:1]=this.readInt32(t),Jf[ed?1:0]=this.readInt32(t+4),td[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){$f[0]=e,this.writeInt32(t,Jf[0])},e.writeFloat64=function(t,e){td[0]=e,this.writeInt32(t,Jf[ed?0:1]),this.writeInt32(t+4,Jf[ed?1:0])},e.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},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===Wf.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw 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},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),rd=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=id.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,a=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 o=2;o<r;o+=2)if(this.bb.readInt16(a+o)!=this.bb.readInt16(s+o))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 a=3;a>=0;a--)this.writeInt8(n.charCodeAt(a))}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=E(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=id.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),nd=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 ad(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}(),ad=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=nd.createDataVector(t,this.data);return nd.createFBEffectsObjectData(t,e,i)},t}(),sd=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 nd).__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 od(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}(),od=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=sd.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return sd.createFBEffectsPackageData(t,e)},t}(),ud=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 hd(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}(),hd=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 ud.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),ld=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 cd(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,a,s){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,s),t.endFBVertexChannel(e)},t}(),cd=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 ld.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),fd=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 ld).__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 dd(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}(),dd=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=fd.createChannelsVector(t,t.createObjectOffsetList(this.channels));return fd.createFBVertexData(t,this.vertexCount,e)},t}(),pd=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 fd).__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 ud).__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 md(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}(),md=function(){function t(t,e,i,r,n,a,s,o,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===a&&(a=[]),void 0===s&&(s=0),void 0===o&&(o=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=a,this.mode=s,this.buffer=o,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=pd.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,s=pd.createBinaryDataVector(t,this.binaryData),o=pd.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=pd.createInverseBindMatricesVector(t,this.inverseBindMatrices);return pd.startFBGeometryData(t),pd.addId(t,e),pd.addName(t,i),pd.addVertexData(t,r),pd.addIndexFormat(t,this.indexFormat),pd.addIndexOffset(t,this.indexOffset),pd.addSubMeshes(t,n),pd.addMode(t,this.mode),pd.addBuffer(t,a),pd.addBinaryData(t,s),pd.addBoneNames(t,o),pd.addRootBoneName(t,u),pd.addInverseBindMatrices(t,h),pd.endFBGeometryData(t)},t}(),vd=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 rd(1),i=new od,r=[],n=Ze(this.exportObjectDatas);!(t=n()).done;){var a=t.value,s=void 0;a.dataType===ze.Geometry&&(s=new ad("Geometry",this.geometryDataToBinary(a))),s&&r.push(s)}return i.exportObjects=r,sd.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new id(t),i=sd.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),s=n.dataType();if(a){var o=void 0;s===ze.Geometry&&(o=this.binaryToGeometryData(a)),o&&this.exportObjectDatas.push(o)}}}},e.geometryDataToBinary=function(t){var e=new rd(1),i=new md,r=t.indexFormat,n=t.indexOffset,a=t.mode,s=t.id,o=t.vertexData,u=t.boneNames,h=void 0===u?[]:u,l=t.rootBoneName,c=void 0===l?"":l,f=t.inverseBindMatrices,d=void 0===f?[]:f,p=t.binaryData,m=void 0===p?[]:p;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=s,i.boneNames=h,i.rootBoneName=c,i.inverseBindMatrices=d,i.binaryData=m;var v=new dd;v.vertexCount=o.vertexCount,v.channels=[];for(var y,g=Ze(o.channels);!(y=g()).done;){var x=y.value,b=x.semantic,T=x.offset,E=x.format,_=x.dimension,w=x.normalize,S=new cd(b,T,E,_,w);v.channels.push(S)}i.vertexData=v;for(var C,A=[],M=Ze(t.subMeshes);!(C=M()).done;){var I=C.value,R=I.offset,O=I.indexCount,P=I.vertexCount,N=new hd(R,O,P);A.push(N)}return i.subMeshes=A,sd.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new id(t),i=pd.getRootAsFBGeometryData(e),r={vertexCount:0,channels:[]},n=i.vertexData();if(n){r.vertexCount=n.vertexCount();for(var a=0;a<n.channelsLength();a++){var s=n.channels(a);if(s){var o,u={semantic:null!=(o=s.semantic())?o:"",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:ze.Geometry}},t}(),yd=60,gd=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=G(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=f.now();var i=g||function(t){return e.setTimeout(t,16.7)},r=function(){t.intervalId=i(r),t.paused||t.tick()};r()}},i.stop=function(){(y||e.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=f.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var e,i=Ze(this.tickers);!(e=i()).done;){var r=e.value;r(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)},xr(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}(),xd=function(t){function i(e,i){var r,n,a,s,o,u;return(r=t.call(this)||this).name="NewEngine",r.speed=1,r.displayScale=1,r.offscreenMode=!1,r.renderErrors=new Set,r.compositions=[],r.assetManagers=[],r.env="",r.ticker=null,r._disposed=!1,r.textures=[],r.materials=[],r.geometries=[],r.meshes=[],r.renderPasses=[],r.clearAction={stencilAction:Ar.clear,clearStencil:0,depthAction:Ar.clear,clearDepth:1,colorAction:Ar.clear,clearColor:[0,0,0,0]},r.canvas=e,r.env=null!=(n=null==i?void 0:i.env)?n:"",r.name=null!=(a=null==i?void 0:i.name)?a:r.name,r.pixelRatio=null!=(s=null==i?void 0:i.pixelRatio)?s:J(),r.jsonSceneData={},r.objectInstance={},r.whiteTexture=pn(Xf(r)),r.transparentTexture=mn(Xf(r)),(null==i?void 0:i.manualRender)||(r.ticker=new gd(null==i?void 0:i.fps),r.runRenderLoop(r.mainLoop.bind(Xf(r)))),r.eventSystem=new yu(Xf(r),null!=(o=null==i?void 0:i.notifyTouch)&&o),r.eventSystem.enabled=null!=(u=null==i?void 0:i.interactive)&&u,r.eventSystem.bindListeners(r.canvas),r.assetLoader=new Sc(Xf(r)),r.assetService=new Uf(Xf(r)),r.renderTargetPool=new qo(Xf(r)),r.renderingData={currentFrame:{}},r}oe(i,t);var r=i.prototype;return r.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},r.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},r.findEffectsObjectData=function(t){return this.jsonSceneData[t]},r.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},r.findObject=function(t){return Rt(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},r.removeInstance=function(t){delete this.objectInstance[t]},r.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=void 0===r?[]:r,a=i.items,s=void 0===a?[]:a,o=i.materials,u=void 0===o?[]:o,h=i.shaders,l=void 0===h?[]:h,c=i.geometries,f=void 0===c?[]:c,d=i.components,p=void 0===d?[]:d,m=i.animations,v=void 0===m?[]:m,y=i.bins,g=void 0===y?[]:y,x=i.miscs,b=void 0===x?[]:x,T=Ze(i.compositions);!(e=T()).done;){var E=e.value;this.addEffectsObjectData(E)}for(var _,w=Ze(s);!(_=w()).done;){var S=_.value;Pf(S.renderLevel,t.renderLevel)||(S.components=[],S.type=te.null),this.addEffectsObjectData(S)}for(var C,A=Ze(u);!(C=A()).done;){var M=C.value;this.addEffectsObjectData(M)}for(var I,R=Ze(l);!(I=R()).done;){var O=I.value;this.addEffectsObjectData(O)}for(var P,N=Ze(f);!(P=N()).done;){var L=P.value;this.addEffectsObjectData(L)}for(var F,V=Ze(p);!(F=V()).done;){var k=F.value;this.addEffectsObjectData(k)}for(var D,z=Ze(v);!(D=z()).done;){var B=D.value;this.addEffectsObjectData(B)}for(var U,G=Ze(b);!(U=G()).done;){var j=U.value;this.addEffectsObjectData(j)}for(var X=0;X<g.length;X++){var W=g[X],H=t.bins[X];if(W.dataType===ze.BinaryAsset)W.buffer=H,W.id&&this.addEffectsObjectData(W);else{var Y=new vd;Y.deserializeFromBinary(new Uint8Array(H));for(var Z,q=Ze(Y.exportObjectDatas);!(Z=q()).done;){var K=Z.value;this.addEffectsObjectData(K)}}}for(var Q,J=Ze(n);!(Q=J()).done;){var $=Q.value;this.addEffectsObjectData($)}},r.runRenderLoop=function(t){var e;null==(e=this.ticker)||e.add(t)},r.mainLoop=function(t){var e,i=this.renderErrors;if(i.size>0)return this.emit("rendererror",i.values().next().value),void(null==(e=this.ticker)||e.pause());t=Math.min(t,33)*this.speed;var r=this.compositions;r.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var n,a,s=!1,o=Ze(r);!(n=o()).done;){var u=n.value;u.textureOffloaded?(s=!0,wt.error("Composition "+u.name+" texture offloaded, skip render.")):u.update(t)}if(s)return this.emit("rendererror",new Error("Play when texture offloaded.")),void(null==(a=this.ticker)||a.pause());for(var h,l=Ze(r);!(h=l()).done;){h.value.sceneTicking.preRender.tick(0)}this.renderer.setFramebuffer(null),this.renderer.clear(this.clearAction);for(var c,f=Ze(r);!(c=f()).done;){var d=c.value;this.renderer.renderRenderFrame(d.renderFrame)}this.renderTargetPool.flush()},r.resize=function(){var t,e,i,r,n=this.canvas.parentElement;if(n){var a=this.getTargetSize(n);t=a[0],e=a[1],i=a[2],r=a[3]}else t=i=this.canvas.width,e=r=this.canvas.height;var s=t/e;if(t&&e){var o=c.documentElement.clientWidth;i>2*o&&wt.error("DPI overflowed, width "+i+" is more than 2x document width "+o+", see "+ta["DPI overflowed"]+".");var u=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>u||r>u)&&(wt.error("Container size overflowed "+i+"x"+r+", see "+ta["Container size overflowed"]+"."),s>1?(i=Math.round(u),r=Math.round(u/s)):(r=Math.round(u),i=Math.round(u*s))),this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",wt.info("Resize engine "+this.name+" ["+i+","+r+","+t+","+e+"]."),this.setSize(i,r)}},r.setSize=function(t,e){var i;this.getWidth()===t&&this.getHeight()===e||(this.canvas.width=t,this.canvas.height=e,this.viewport(0,0,t,e)),null==(i=this.compositions)||i.forEach((function(i){i.camera.aspect=t/e})),this.emit("resize",this)},r.getTargetSize=function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+ta["Container is not an HTMLElement"]+".");var i,r,n=this.displayAspect,a=null==e.getComputedStyle?void 0:e.getComputedStyle.call(e,t),s=0,o=0;(a?(s=parseInt(a.width,10),o=parseInt(a.height,10)):(s=t.clientWidth,o=t.clientHeight),n)?s/o>n?i=(r=o*this.displayScale)*n:r=(i=s*this.displayScale)/n:(i=s,r=o);var u=this.pixelRatio,h=i,l=r;if(i=Math.round(i*u),r=Math.round(r*u),i<1||r<1){if(!this.offscreenMode)throw new Error("Invalid container size "+i+"x"+r+", see "+ta["Invalid container size"]+".");i=r=h=l=1}return[h,l,i,r]},r.addTexture=function(t){this.disposed||P(this.textures,t)},r.removeTexture=function(t){this.disposed||N(this.textures,t)},r.addMaterial=function(t){this.disposed||P(this.materials,t)},r.removeMaterial=function(t){this.disposed||N(this.materials,t)},r.addGeometry=function(t){this.disposed||P(this.geometries,t)},r.removeGeometry=function(t){this.disposed||N(this.geometries,t)},r.addMesh=function(t){this.disposed||P(this.meshes,t)},r.removeMesh=function(t){this.disposed||N(this.meshes,t)},r.addRenderPass=function(t){this.disposed||P(this.renderPasses,t)},r.removeRenderPass=function(t){this.disposed||N(this.renderPasses,t)},r.addComposition=function(t){this.disposed||P(this.compositions,t)},r.removeComposition=function(t){this.disposed||N(this.compositions,t)},r.getWidth=function(){return 0},r.getHeight=function(){return 0},r.getShaderLibrary=function(){return null},r.bindSystemFramebuffer=function(){},r.viewport=function(t,e,i,r){},r.clear=function(t){},r.drawGeometry=function(t,e,i,r){},r.setSampleAlphaToCoverage=function(t){},r.setBlending=function(t){},r.setDepthTest=function(t){},r.setStencilTest=function(t){},r.setCulling=function(t){},r.setPolygonOffsetFill=function(t){},r.blendColor=function(t,e,i,r){},r.blendFuncSeparate=function(t,e,i,r){},r.blendEquationSeparate=function(t,e){},r.colorMask=function(t,e,i,r){},r.depthMask=function(t){},r.depthFunc=function(t){},r.depthRange=function(t,e){},r.polygonOffset=function(t,e){},r.cullFace=function(t){},r.frontFace=function(t){},r.stencilMaskSeparate=function(t,e){},r.stencilFuncSeparate=function(t,e,i,r){},r.stencilOpSeparate=function(t,e,i,r){},r.dispose=function(){var t,e,i;if(!this.disposed){this._disposed=!0;var r=[];this.renderPasses.length>0&&r.push("Pass "+this.renderPasses.length),this.meshes.length>0&&r.push("Mesh "+this.meshes.length),this.geometries.length>0&&r.push("Geom "+this.geometries.length),this.textures.length>0&&r.push("Tex "+this.textures.length),r.length>0&&wt.warn("Release GPU memory: "+r.join(", ")+"."),null==(t=this.ticker)||t.stop(),null==(e=this.eventSystem)||e.dispose(),null==(i=this.assetService)||i.dispose(),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.assetManagers.forEach((function(t){return t.dispose()})),this.compositions.forEach((function(t){return t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.compositions=[]}},xr(i,[{key:"disposed",get:function(){return this._disposed}}]),i}(ea),bd={format:Rr.RGBA,type:Rr.UNSIGNED_BYTE,minFilter:Rr.LINEAR,magFilter:Rr.LINEAR,wrapS:Rr.CLAMP_TO_EDGE,wrapT:Rr.CLAMP_TO_EDGE},Td=Symbol("dispose"),Ed=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,a={sourceType:Mr.framebuffer,data:{width:i,height:r},name:n},s=[n];Object.getOwnPropertyNames(bd).forEach((function(e){var i,r=null!=(i=t[e])?i:bd[e];a[e]=r,s.push(e,r)}));var o=s.join(":"),u=this.textureCache[o];if(u)this.textureRef[o]++;else{var h=this.engine;mt(h),u=cn.create(h,a),this.textureCache[o]=u,this.textureRef[o]=1,u[Td]=u.dispose,u.dispose=function(){return e.removeTexture(o)}}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[Td](),i.dispose=i[Td]),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[Td](),i.dispose=i[Td]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),_d=function(){function t(){}return t.load=function(t,e,i){void 0===i&&(i={});var r=this;return T((function(){var n,a,s,o,u,h,l,c,d,p,m,v,y;return w(this,(function(g){switch(g.label){case 0:return o=f.now(),u=null==(a=e.gpuCapability)||null==(n=a.detail)?void 0:n.asyncShaderCompile,h=e.compositions.length,l=new Df(i),e.assetManagers.push(l),[4,l.loadScene(t,e.renderer)];case 1:return c=g.sent(),e.clearResources(),Gt.onAssetsLoadFinish(c,l.options,e),e.assetService.prepareAssets(c,c.assets),e.assetService.updateTextVariables(c,i.variables),(d=r.createComposition(c,e,i)).setIndex(h),p=f.now(),[4,new Promise((function(t){var i;null==(i=e.getShaderLibrary())||i.compileAllShaders((function(){return t(null)}))}))];case 2:return g.sent(),m=f.now()-p,null==(s=e.ticker)||s.start(),v=d.name,y=f.now()-o,d.statistic.compileTime=m,d.statistic.firstFrameTime=y,wt.info("First frame ["+v+"]: "+y.toFixed(4)+"ms."),wt.info("Shader "+(u?"async":"sync")+" compile ["+v+"]: "+m.toFixed(4)+"ms."),[2,d]}}))}))()},t.createComposition=function(t,e,i){void 0===i&&(i={});var r=new Qf(e,gi({},i,{event:e.eventSystem}),t);return e.env!==$n&&e.assetService.createShaderVariant(),r},t}(),wd=function(){function t(){}return t.instantiate=function(t,e){var i=t.scene,r=t.scene.jsonScene,n=t.options,a=e.engine;a.clearResources(),Gt.onAssetsLoadFinish(i,n,a),a.assetService.prepareAssets(i,i.assets),a.assetService.updateTextVariables(i,n.variables),e.createTexturesFromData(i.textureOptions);for(var s,o=Ze(Object.keys(i.assets));!(s=o()).done;){var u=s.value,h=i.assets[u];E(h,m)&&e.videos.push(h)}var l=r.compositionId,c=r.compositions.find((function(t){return t.id===l}));if(!c)throw new Error('Composition with id "'+l+'" not found in JSONScene.');var f,d=new oa(a);return d.instantiatePreComposition(c),d.getComponent(Ys).playOnStart=null==(f=n.autoplay)||f,d.getComponent(Ys).endBehavior=0,e.addItem(d),d},t}();Bt("camera",fu),Bt("text",Tc),Bt("sprite",Su),Bt("particle",cc),Bt("interact",xu);function Sd(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:""})}wt.info("Core version: 2.9.2.");var Cd,Ad,Md=function(){function t(t,e){this.engine=t,this.byteLength=0,this.destroyed=!1;var i=e.name,r=e.data,n=e.elementCount,a=e.target,s=void 0===a?Rr.ARRAY_BUFFER:a,o=e.type,u=void 0===o?Rr.FLOAT:o,h=e.usage,l=void 0===h?Rr.STATIC_DRAW:h,c=function(t){var e,i;return null!=(i=null==(e=Id[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 Sd(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,a=n+e.byteLength;i.bindBuffer(r,this.glBuffer),a>this.byteLength&&(this.byteLength=a,i.bufferData(r,a,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!!Nr(this.engine.gl)&&(this.engine.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},xr(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Id=((Cd={})[Rr.INT]=Int32Array,Cd[Rr.FLOAT]=Float32Array,Cd[Rr.SHORT]=Int16Array,Cd[Rr.BYTE]=Int8Array,Cd[Rr.UNSIGNED_BYTE]=Uint8Array,Cd[Rr.UNSIGNED_INT]=Uint32Array,Cd[Rr.UNSIGNED_SHORT]=Uint16Array,Cd);var Rd=((Ad={})[Uint8Array.BYTES_PER_ELEMENT]=Rr.UNSIGNED_BYTE,Ad[Uint16Array.BYTES_PER_ELEMENT]=Rr.UNSIGNED_SHORT,Ad[Uint32Array.BYTES_PER_ELEMENT]=Rr.UNSIGNED_INT,Ad),Od=1,Pd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}oe(e,t);var i=e.prototype;return i.getOptions=function(){return gi({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;mt(e),e.addGeometry(this),Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new Md(t.engine,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,a=i.target;this.bufferProps[r]={data:e,usage:n,target:a,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&null!=r.data){var n=e,a=e+i.length;if(r.data.length<a){var s=new i.constructor(a);s.set(r.data),r.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var o=this.dirtyFlags[t];void 0!==o.start&&(o.start=Math.min(o.start,n)),void 0!==o.end&&(o.end=Math.max(o.end,a-1))}r.data.set(i,n),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(E(t,Uint8Array)||E(t,Uint16Array)||E(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t,n=t+e.length;if(this.indices.length<n){var a=new e.constructor(n);a.set(this.indices),this.indices=a,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}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*bo[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t){var e=Rd[t.BYTES_PER_ELEMENT],i={data:t,target:Rr.ELEMENT_ARRAY_BUFFER,type:e,name:this.name+"##index"};return new Md(this.engine,i)},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var a,s,o=t.dirtyFlags[n];if("index"==n)a=t.indicesBuffer,s=r;else{var u=e[n].dataSource;a=t.buffers[u],s=i[u].data}if((o.dirty||o.discard)&&a&&s){if(o.discard)a.bufferData(s);else if(void 0!==o.start&&void 0!==o.end){var h=o.start*s.BYTES_PER_ELEMENT+s.byteOffset,l=o.end-o.start+1,c=new s.constructor(s.buffer,h,l);a.bufferSubData(o.start,c)}o.start=Number.POSITIVE_INFINITY,o.end=0,o.dirty=o.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(r){var n=t.attributesReleasable[r],a=e[r].dataSource;i[a]&&n&&(i[a].data=void 0)})),this.indicesReleasable}},i.processProps=function(t){var e=t,i=e.drawStart,r=void 0===i?0:i,n=e.drawCount,a=e.mode,s=e.indices,o=e.name,u=void 0===o?"effectsGeometry:"+Od++:o,h=e.bufferUsage,l=void 0===h?Rr.STATIC_DRAW:h;this.name=u;var c={},f=[],d={},p={},m={},v=l;this.drawStart=r,void 0!==n&&(this.drawCount=n),this.mode=isNaN(a)?Rr.TRIANGLES:a,Object.keys(e.attributes).forEach((function(t){var i=e.attributes[t],r=i.size,n=i.stride,a=i.offset,s=i.normalize,o=i.type,u=void 0===o?Rr.FLOAT:o,h=i.releasable,l=i.data;if(!u||"dataSource"in i||l||(l=Eo(u)),l){var y=E(l,Float32Array)?Rr.FLOAT:Rr.INT;c[t]={data:l,usage:v,target:Rr.ARRAY_BUFFER,name:t},d[t]={size:r,stride:n,offset:a,type:null!=u?u:y,normalize:!!s,dataSource:t},m[t]=null!=h&&h,p[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var g=i.dataSource;g&&(d[t]={size:r,stride:n,offset:a,type:u,dataSource:g,normalize:!!s})}f.push(t)})),p.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==s?void 0:s.data,this.indicesReleasable=!0===(null==s?void 0:s.releasable),this.bufferProps=c,this.attributes=d,this.attributesName=f,this.attributesReleasable=m,this.dirtyFlags=p,this.options=e,this.initialized=!1},i.fromData=function(e){var i,n=this;if(t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes,e.buffer?i=new Uint8Array(function(t){for(var e=r(t),i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);var a=i.buffer;return a}(e.buffer)):e.binaryData&&(i=e.binaryData),i){var a=e.vertexData.vertexCount;if(this.hasSemantic(e)){var s={mode:Rr.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach((function(t){var e,r=null!=(e=Nd[t.semantic])?e:t.semantic,o=n.createVertexTypedArray(t,i,a);s.attributes[r]={type:Fr(t.format),size:t.dimension,data:o,normalize:t.normalize}})),e.indexFormat!==Ge.None){var o=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset);s.indices={data:o},s.drawCount=o.length}else s.drawCount=a;this.processProps(s)}else{var u=e.vertexData.channels[0],h=e.vertexData.channels[1],l=e.vertexData.channels[2],c=this.createVertexTypedArray(u,i,a),f=this.createVertexTypedArray(h,i,a),d=this.createVertexTypedArray(l,i,a),p=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset),m={mode:Rr.TRIANGLES,attributes:{aPos:{type:Fr(u.format),size:3,data:c,normalize:u.normalize},aUV:{type:Fr(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:Fr(l.format),size:3,data:d,normalize:l.normalize}}};m.indices={data:p},m.drawCount=p.length,this.processProps(m)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},i.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)},i.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case Ue.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case Ue.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case Ue.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case Ue.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case Ue.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)}},i.createIndexTypedArray=function(t,e,i){var r=e.buffer,n=e.byteOffset+i,a=e.byteLength-i;switch(t){case Ge.UInt16:return new Uint16Array(r,n,a/Uint16Array.BYTES_PER_ELEMENT);case Ge.UInt32:return new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,n,a/Uint32Array.BYTES_PER_ELEMENT)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},xr(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(To),Nd={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 Ld,Fd,Vd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}oe(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.engine.gl.createRenderbuffer())},i.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer.engine,r=i.gl;i.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):wt.error("Invalid render buffer size: "+t+"x"+e+".")}}else wt.error("Can't set size for uninitialized render buffer.")},i.dispose=function(){this.renderer&&(this.renderer.engine.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Lt},e}(Zo),kd=((Ld={})[Rr.RGBA]=34842,Ld[Rr.RGB]=34843,Ld[Rr.ALPHA]=33325,Ld[Rr.RED]=33325,Ld[Rr.LUMINANCE_ALPHA]=33327,Ld[Rr.LUMINANCE]=33325,Ld),Dd=((Fd={})[Rr.RGBA]=34836,Fd[Rr.RGB]=34837,Fd[Rr.ALPHA]=33326,Fd[Rr.RED]=33326,Fd[Rr.LUMINANCE_ALPHA]=33328,Fd[Rr.LUMINANCE]=33326,Fd),zd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,i&&r.fromData(i),r}oe(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(),Sd(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 Mr.image:delete this.source.image,delete this.source.cube;break;case Mr.data:delete this.source.data;break;case Mr.compressed:case Mr.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=this.target,r=this.source,n=this.engine.gl,a=this.engine.gpuCapability.detail,s=r.sourceType,o=r.data,u=r.cube,h=r.image,l=r.video,c=r.mipmaps,f=r.mipmaps,d=t.data,p=t.cube,m=t.generateMipmap,v=void 0!==m&&m,y=t.mipmaps,g=r.format,x=r.type,b=r.internalFormat,T=0,E=0;this.bind(s===Mr.video),x===Rr.HALF_FLOAT?((x=a.halfFloatTexture)||wt.error("Half float texture is not support."),Nr(n)&&b===g&&(g===Rr.LUMINANCE&&(g=Rr.RED),b=kd[g]),a.halfFloatLinear||(r.minFilter=r.magFilter=n.NEAREST,wt.warn("Half float linear not support, change to NEAREST."))):x===n.FLOAT&&((x=a.floatTexture)||wt.error("Float texture is not support."),Nr(n)&&b===g&&(g===Rr.LUMINANCE&&(g=Rr.RED),b=Dd[g]),a.floatLinear||(r.minFilter=n.NEAREST,r.magFilter=n.NEAREST,wt.warn("Float linear not support, change to NEAREST."))),void 0===r.premultiplyAlpha&&(r.premultiplyAlpha=!1),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),void 0===r.flipY&&(r.flipY=!1),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,r.flipY);var _,w,S=function(t,e){Pt(t)&&Pt(e)||Nr(n)?n.generateMipmap(i):console.error("Mipmap generation failed. Texture width and height must be power of two in WebGL1.")};if(s===Mr.framebuffer)d&&(T=null!=(_=d.width)?_:0,E=null!=(w=d.height)?w:0,T&&E&&(this.width!==T||this.height!==E)&&n.texImage2D(i,0,b,T,E,0,g,x,null));else if(s===Mr.data){var C;if(i===n.TEXTURE_CUBE_MAP)p.forEach((function(t,i){var r=e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,g,x,t),a=r[0],s=r[1];T=Math.max(a,T),E=Math.max(s,E)}));else C=this.texImage2DData(n,i,0,b,g,x,o),T=C[0],E=C[1],v&&S(T,E)}else if(s===Mr.image||s===Mr.video){if(i===n.TEXTURE_CUBE_MAP)u.forEach((function(t,i){var r=e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,b,g,x,t),a=r[0],s=r[1];T=Math.max(a,T),E=Math.max(s,E)}));else if(i===n.TEXTURE_2D){var A,M=null!=h?h:l;A=this.texImage2D(n,i,0,b,g,x,M),T=A[0],E=A[1]}v&&S(T,E)}else if(s===Mr.mipmaps){var I;i===n.TEXTURE_2D?c.forEach((function(t,r){var a;(I="data"in t?e.texImage2DData(n,i,r,b,g,x,t):e.texImage2D(n,i,r,b,g,x,t),0===r)&&(T=(a=I)[0],E=a[1])})):i===n.TEXTURE_CUBE_MAP&&f.forEach((function(t,i){t.forEach((function(t,r){var a;(I="data"in t?e.texImage2DData(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,g,x,t):e.texImage2D(n,n.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,b,g,x,t),0===i)&&(T=(a=I)[0],E=a[1])}))}))}else s===Mr.compressed&&y&&0!==y.length&&(T=y[0].width,E=y[0].height,y.forEach((function(t,e){n.compressedTexImage2D(i,e,b,t.width,t.height,0,t.data)})));this.width=T,this.height=E,this.setTextureFilters(n,i,r)},i.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=void 0===r?4:r,a=i.wrapS,s=void 0===a?t.CLAMP_TO_EDGE:a,o=i.wrapT,u=void 0===o?t.CLAMP_TO_EDGE:o,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var l=Nr(t)||Pt(this.width)&&Pt(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,a=r.sourceFrom,s=r.name,o=void 0===s?"":s;this.source=r,this.sourceType=n,this.sourceFrom=a,this.name=o},i.texImage2D=function(t,e,i,r,n,a,s){var o,u=this,h=this.source,l=h.sourceType,c=h.minFilter,f=h.magFilter,d=h.wrapS,p=h.wrapT,m=null!=(o=this.engine.gpuCapability.detail.maxTextureSize)?o:2048,v=s;if(l!==Mr.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,a,v);var g=[v.width,v.height];return l===Mr.video?[s.videoWidth,s.videoHeight]:g},i.texImage2DData=function(t,e,i,r,n,a,s){var o=s.data,u=s.width,h=s.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/o.BYTES_PER_ELEMENT):o;return t.texImage2D(e,i,r,u,h,0,n,a,l),[u,h]},i.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;if(Nr(this.engine.gl)&&t.width<n&&t.height<n)return t;var a=function(t,e,i,r){var n=t.width,a=t.height,s=Math.min(e,i||Ta(n)),o=Math.min(e,r||Ta(a));if(o!==a||s!==n){var u=fc.getCanvas(),h=u.getContext("2d");return u.width=s,u.height=o,null==h||h.drawImage(t,0,0,n,a,0,0,s,o),wt.warn("Image resize from "+n+"x"+a+" to "+s+"x"+o+"."),u}}(t,n,e,i);return a||t},i.reloadData=function(){var t=this;return T((function(){return w(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,xn().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},i.offloadData=function(){if(this.initialized&&xn().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 T((function(){return w(this,(function(e){return t.source.sourceType===Mr.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},i.updateSource=function(t){this.source=this.assembleOptions(gi({},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(){wt.error("This texture has been destroyed.")},this.initialize=Lt,void 0!==this.engine&&this.engine.removeTexture(this),t.prototype.dispose.call(this)},e}(cn);var Bd=1,Ud=function(t){function e(e,i){var r;(r=t.call(this)||this).attachmentTextures=[];var n,a=e.depthStencilAttachment,s=e.viewport,o=e.storeAction,u=e.name,h=void 0===u?"GLFramebuffer"+Bd++:u;return r.renderer=i,r.engine=i.engine,r.depthStencilStorageType=null!=(n=null==a?void 0:a.storageType)?n:oo.none,r.viewport=s,r.name=h,r.storeAction=o,r.updateProps(e),r}oe(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,e=this.viewport[2],i=this.viewport[3];this.attachmentTextures.length=0,this.colorTextures.forEach((function(r){var n={width:e,height:i,data:new Uint8Array(0)};r.initialize(),r.update({data:n}),P(t.attachmentTextures,r.textureBuffer)})),this.stencilTexture&&P(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&(this.depthTexture.update({data:{width:e,height:i,data:new Uint16Array(0)}}),P(this.attachmentTextures,this.depthTexture.textureBuffer))},i.updateProps=function(t){var e,i,r=this.renderer,n=this.engine.gpuCapability,a=null!=(i=t.depthStencilAttachment)?i:{storageType:oo.none},s=t.attachments.length>0,o=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var u=null==(e=t.depthStencilAttachment)?void 0:e.texture,h=n.detail.readableDepthStencilTextures,l=a.storageType,c=a.storage;if(this.colorTextures=t.attachments.slice(),!s&&l!==oo.none)throw new Error("Use depth stencil attachment without color attachments.");switch(s&&(this.fbo=this.engine.createGLFramebuffer(this.name)),l){case oo.depth_stencil_opaque:if(c){if(!E(c,Vd))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Vd({format:Rr.DEPTH_STENCIL,attachment:Rr.DEPTH_STENCIL_ATTACHMENT,storageType:l},r);o=!1;break;case oo.depth_16_opaque:if(c){if(!E(c,Vd))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Vd({attachment:Rr.DEPTH_ATTACHMENT,format:Rr.DEPTH_COMPONENT16,storageType:l},r);break;case oo.stencil_8_opaque:if(c){if(!E(c,Vd))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Vd({attachment:Rr.STENCIL_ATTACHMENT,format:Rr.STENCIL_INDEX8,storageType:l},r);break;case oo.depth_16_texture:if(!h)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=u?u:new zd(this.engine,{sourceType:Mr.framebuffer,format:Rr.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:Rr.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case oo.depth_24_stencil_8_texture:if(!h)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=u?u:new zd(this.engine,{sourceType:Mr.framebuffer,format:Rr.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),o=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,o),this.updateAttachmentTextures()},i.getStoreAttachments=function(t,e){var i=this.engine.gl,r=this.colorTextures.length;if(t&&Nr(i)&&r>0){var n=[];if(t.depthAction===uo.clear&&this.depthStorage&&P(n,e?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===uo.clear&&this.stencilStorage&&P(n,e?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===uo.clear)for(var a=0;a<r;a++)P(n,i["COLOR_ATTACHMENT"+a]);return n}},i.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.engine.gl;Nr(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.engine.bindSystemFramebuffer()},i.bind=function(){var t=this;if(this.fbo){var e=this.engine.gl,i=this.engine,r=this.viewport,n=r[0],a=r[1],s=r[2],o=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,a,s,o);var u=this.renderer.engine.whiteTexture,h=u.textureBuffer;Object.keys(i.textureUnitDict).forEach((function(e){var r=i.textureUnitDict[e];r&&r!==h&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),u.bind())}));for(var l=0;l<4;l++)i.activeTexture(e.TEXTURE0+l),u.bind();if(!this.ready){var c=this,f=c.depthStencilRenderbuffer,d=c.depthTexture,p=c.stencilTexture;if(i.activeTexture(e.TEXTURE0),f)f.setSize(s,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,f.attachment,e.RENDERBUFFER,f.buffer);else if(d){d.source.data={width:s,height:o},d.update({data:{width:s,height:o,data:new Uint16Array(0)}});var m=d&&p?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,m,e.TEXTURE_2D,d.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var v=e.checkFramebufferStatus(e.FRAMEBUFFER);if(v!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+v+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+". width="+s+", height="+o+".");this.ready=!0}}},i.resetColorTextures=function(t){var e=t,i=this.engine.gl,r=this.engine.gpuCapability,n=this.viewport,a=[];if(e){for(var s,o=Ze(e);!(s=o()).done;){s.value.initialize()}this.colorTextures=e.slice()}this.engine.activeTexture(i.TEXTURE0),this.colorTextures.forEach((function(t,e){var s={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:s}),r.framebufferTexture2D(i,i.FRAMEBUFFER,e,i.TEXTURE_2D,t.textureBuffer),a.push(!0)})),r.drawBuffers(i,a),this.updateAttachmentTextures()},i.resize=function(t,e,i,r){var n=this.viewport,a=n[0],s=n[1],o=n[2],u=n[3];a===t&&s===e&&o===i&&u===r||(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},i.dispose=function(t){if(this.renderer){var e;this.engine.deleteGLFramebuffer(this),delete this.fbo;var i,r,n=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:po.force;if(n===po.force||n===po.keepExternal&&!this.externalStorage)null==(i=this.depthStencilRenderbuffer)||i.dispose(),null==(r=this.depthTexture)||r.dispose();for(var a,s=Ze(this.colorTextures);!(a=s()).done;){a.value.dispose()}null==(e=this.stencilTexture)||e.dispose(),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},xr(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==oo.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==oo.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(ho),Gd=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 Nr(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),Sd(e,t),e},e.bindVertexArray=function(t){var e;Nr(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;Nr(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),jd=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,a=this.engine.gl;return t.vaos[n]?i=t.vaos[n]:((i=new Gd(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(),a.enableVertexAttribArray(i.loc),a.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 a=t.getActiveAttrib(e,n);if(a){var s=a.name,o=a.type,u=a.size,h=t.getAttribLocation(e,s);i[s]={type:o,name:s,size:u,loc:h}}}return i},e.dispose=function(){this.engine&&this.engine.gl.deleteProgram(this.program)},t}(),Xd=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}oe(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),a=0;a<t.length;a++)this.uniformLocations[t[a]]=n[a];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.definition;t.dataType=ze.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))},i.bind=function(){this.program.bind()},i.isReady=function(){return!!this.program},e}(Ln),Wd=0,Hd=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 e=t.prototype;return e.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=Ze(Object.keys(this.cachedShaders));!(i=n()).done;){var a=i.value;this.cachedShaders[a].initialized||r.push(a)}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}},e.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 a=gi({},t,{vertex:Bo.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Tr.vertex,shader:t.vertex,macros:n}),fragment:Bo.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Tr.fragment,shader:t.fragment,macros:n})}),s=this.computeShaderCacheId(a);if(this.cachedShaders[s])return s;this.shaderAllDone=!1;var o=!1;return(a.shared||a.cacheId)&&(o=!0),this.cachedShaders[s]=new Xd(this.engine,gi({},a,{vertex:a.vertex,fragment:a.fragment,name:a.name||s,shared:o})),this.cachedShaders[s].id=s,s},e.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},e.compileShader=function(t,e){var i=this,r=t.source,n=r.shared,a=r.vertex,s=r.fragment,o=r.name,u=t.source.cacheId,h=!1;(n||u)&&(h=!0);var l=this.engine.gl,c={shared:h,status:In.compiling},d=this.createProgram(l,a,s,c),p=this.glAsyncCompileExt,m=f.now(),v=function(e){c.status=In.success,c.compileTime=f.now()-m,t.program=e,t.initialized=!0,void 0!==i.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),i.programMap[t.id]=e},y=function(){if(i.engine.disposed)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==e?void 0:e(c);if(t.initialized)return null==e?void 0:e(c);var r=(!e||!p||p&&1==l.getProgramParameter(c.program,p.COMPLETION_STATUS_KHR))&&d();if(r){if(c.status!==In.fail){Sd(r,o);var n=new jd(i.engine,r,t.id);if(l.validateProgram(r),l.getProgramParameter(r,l.VALIDATE_STATUS))v(n);else{var u=l.getProgramInfoLog(r);(null==u?void 0:u.includes("the same texture"))||(null==u?void 0:u.includes("Two textures of different types use the same sampler"))?v(n):(c.status=In.fail,c.error=u,console.error("compileProgramError: "+u,"\nvertex:\n",a,"\nfragment:\n",s),l.deleteProgram(r))}}null==e||e(c)}else e&&g(y)};t.compileResult=c,y()},e.computeShaderCacheId=function(t){var e=t.vertex,i=void 0===e?"":e,r=t.fragment,n=void 0===r?"":r,a=t.shared,s=t.cacheId;return a||s?s||"shared_"+Zd(i,n):"instanced_"+Wd++},e.createProgram=function(t,e,i,r){var n=t.createProgram(),a=this.createGLShader(t,t.VERTEX_SHADER,e),s=this.createGLShader(t,t.FRAGMENT_SHADER,i);return n&&a&&s?(t.attachShader(n,a),t.attachShader(n,s),t.linkProgram(n),r.program=n,r.status=In.compiling,function(){if(r.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var o=t.getProgramInfoLog(n);console.error("Failed to link program: "+o+".");var u=Yd(t,a,"vertex",e),h=Yd(t,s,"fragment",i);return r.status=In.fail,u&&(r.error=u.error,r.status=u.status),h&&(r.error=h.error,r.status=h.status),n}return n}):(r.status=In.fail,function(){return null})},e.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Zd(null!=i?i:""),a=r.get(n);if(a)return a;var s=t.createShader(e);return s&&(t.shaderSource(s,i),t.compileShader(s),r.set(n,s)),s},e.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},e.restore=function(){},e.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 Yd(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:In.fail}}}function Zd(){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 a=e[n],s=0;s<a.length;s++)r=Math.imul(31,r)+a.charCodeAt(s)|0;return r}var qd=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=[],mt(t),this.gl=Sr(t,e,i),this.contextLostListener=function(t){for(var e,i,n=Ze(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=Ze(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(){var t;(this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl)&&(null==(t=this.gl.getExtension("WEBGL_lose_context"))||t.loseContext());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}(),Kd=function(t){function i(i,r){var n;(n=t.call(this,i,r)||this).restoreCompositionsCache=[],r=gi({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0,glType:"webgl2"},r),n.context=new qd(i,r.glType,r),n.context.addLostHandler({lost:function(t){var e;null==(e=n.ticker)||e.pause(),n.restoreCompositionsCache=n.compositions.slice(),n.compositions.forEach((function(e){return e.lost(t)})),t.preventDefault(),wt.error("WebGL context lost. Event target: "+t.target+"."),n.emit("contextlost",{engine:Xf(n),e:t})}});var a=Xf(n);n.context.addRestoreHandler({restore:T((function(){var t,i;return w(this,(function(r){switch(r.label){case 0:if(!(i=a.context.gl))throw new Error("Can not restore automatically because losing gl context.");return a.reset(),a.shaderLibrary=new Hd(a),a.gpuCapability=new Qo(i),[4,Promise.all(a.restoreCompositionsCache.map(T((function(t){var e,i,r,n,s,o,u,h,l,c,f;return w(this,(function(d){switch(d.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.reusable,s=t.renderOrder,o=t.transform,u=t.videoState,[4,_d.load(i,a)];case 1:(h=d.sent()).speed=r,h.reusable=n,h.renderOrder=s,h.transform.setPosition(o.position.x,o.position.y,o.position.z),h.transform.setRotation(o.rotation.x,o.rotation.y,o.rotation.z),h.transform.setScale(o.scale.x,o.scale.y,o.scale.z),h.onItemMessage=t.onItemMessage,l=0,d.label=2;case 2:return l<u.length?u[l]?((c=h.textures[l].source.video).currentTime=null!=(f=u[l])?f:0,[4,c.play()]):[3,4]:[3,5];case 3:d.sent(),d.label=4;case 4:return l++,[3,2];case 5:return h.isEnded=!1,h.gotoAndPlay(e),[2,h]}}))}))))];case 1:return r.sent(),a.restoreCompositionsCache=[],null==(t=a.ticker)||t.resume(),et()&&a.canvas&&(a.canvas.style.display="none",e.setTimeout((function(){a.canvas.style.display=""}),0)),a.emit("contextrestored",a),[2]}}))}))});var s=n.context.gl;return mt(s),n.gl=s,n.reset(),n.gpuCapability=new Qo(s),n.shaderLibrary=new Hd(Xf(n)),n.renderer=new tu(Xf(n)),n.maxTextureCount=n.gl.TEXTURE0+n.gl.getParameter(n.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,n.resize(),n}oe(i,t);var r=i.prototype;return r.getWidth=function(){return this.gl.drawingBufferWidth},r.getHeight=function(){return this.gl.drawingBufferHeight},r.getShaderLibrary=function(){return this.shaderLibrary},r.createGLFramebuffer=function(t){var e=this.gl.createFramebuffer();if(!e)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return Sd(e,t,t),e},r.createVAO=function(t){return new Gd(this,t)},r.deleteGLTexture=function(t){t.textureBuffer&&!this.disposed&&(this.gl.deleteTexture(t.textureBuffer),t.textureBuffer=null)},r.deleteGPUBuffer=function(t){t&&!this.disposed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},r.deleteGLFramebuffer=function(t){t&&!this.disposed&&(this.gl.deleteFramebuffer(t.fbo),delete t.fbo)},r.deleteGLRenderbuffer=function(t){t&&!this.disposed&&(this.gl.deleteRenderbuffer(t.buffer),t.buffer=null)},r.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.renderer,n.currentFrame.globalUniforms)}catch(t){return console.error(t),void this.renderErrors.add(t)}var a=this.gl;if(a){var s=t,o=i.shaderVariant.program.setupAttributes(s),u=s.indicesBuffer,h=s.drawStart,l=s.drawCount,c=s.mode,f=s.subMeshes;if(f&&f.length){var d,p=f[r];if(l<0)return;if(h=p.offset,u)l=null!=(d=p.indexCount)?d:0;else l=p.vertexCount}u?a.drawElements(c,l,u.type,null!=h?h:0):a.drawArrays(c,h,l),null==o||o.unbind()}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")}},r.clear=function(t){var e=0;if(t.colorAction===Ar.clear){var i=t.clearColor;i&&this.clearColor(i[0],i[1],i[2],i[3]),this.colorMask(!0,!0,!0,!0),e=Rr.COLOR_BUFFER_BIT}if(t.stencilAction===Ar.clear&&(this.stencilMask(255),this.clearStencil(t.clearStencil||0),e|=Rr.STENCIL_BUFFER_BIT),t.depthAction===Ar.clear){var r=t.clearDepth;this.depthMask(!0),this.clearDepth(Number.isFinite(r)?r:1),e|=Rr.DEPTH_BUFFER_BIT}e&&this.gl.clear(e)},r.dispose=function(){var e;this.disposed||(t.prototype.dispose.call(this),this.renderer.dispose(),this.renderTargetPool.dispose(),null==(e=this.shaderLibrary)||e.dispose(),this.context.dispose(),this.reset())},r.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=Rr.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},r.setSampleAlphaToCoverage=function(t){t?this.enable(Rr.SAMPLE_ALPHA_TO_COVERAGE):this.disable(Rr.SAMPLE_ALPHA_TO_COVERAGE)},r.setBlending=function(t){t?this.enable(Rr.BLEND):this.disable(Rr.BLEND)},r.setDepthTest=function(t){t?this.enable(Rr.DEPTH_TEST):this.disable(Rr.DEPTH_TEST)},r.setStencilTest=function(t){t?this.enable(Rr.STENCIL_TEST):this.disable(Rr.STENCIL_TEST)},r.setCulling=function(t){t?this.enable(Rr.CULL_FACE):this.disable(Rr.CULL_FACE)},r.setPolygonOffsetFill=function(t){t?this.enable(Rr.POLYGON_OFFSET_FILL):this.disable(Rr.POLYGON_OFFSET_FILL)},r.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},r.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},r.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},r.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},r.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},r.useProgram=function(t){this.set1("useProgram",t)},r.clearDepth=function(t){this.set1("clearDepth",t)},r.depthFunc=function(t){this.set1("depthFunc",t)},r.depthMask=function(t){this.set1("depthMask",t)},r.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},r.depthRange=function(t,e){this.set2("depthRange",t,e)},r.clearStencil=function(t){this.set1("clearStencil",t)},r.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},r.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},r.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},r.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},r.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},r.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},r.cullFace=function(t){this.set1("cullFace",t)},r.frontFace=function(t){this.set1("frontFace",t)},r.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},r.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},r.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},r.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},r.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},r.blendEquation=function(t){this.set1("blendEquation",t)},r.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},r.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},r.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},r.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},r.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},r.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},r.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)},r.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)},r.set4=function(t,e,i,r,n){var a=this.glCapabilityCache[t];a||(a=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),a.x===e&&a.y===i&&a.z===r&&a.w===n||this.gl[t](a.x=e,a.y=i,a.z=r,a.w=n)},r.get=function(t){return this.glCapabilityCache[t]},r.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},r.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},r.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},r.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},r.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},r.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},r.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},r.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},r.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},r.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},r.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},r.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},r.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)}},r.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},r.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},r.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},r.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},i}(xd);function Qd(t,e){return!e||"object"!=((i=e)&&"undefined"!=typeof Symbol&&i.constructor===Symbol?"symbol":typeof i)&&"function"!=typeof e?Xf(t):e;var i}var Jd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",$d="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",tp="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",ep="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var ip=new Map;function rp(t){return ip.has(t)}function np(t){return ip.get(t)}function ap(){return Array.from(ip.values())}var sp=!1,op=1,up=function(t){function e(e){var r;(r=t.call(this)||this).resumePending=!1,r.disposed=!1,r.lost=function(t){r.handleEmitEvent("webglcontextlost",t)};var n=Xf(r);r.restore=T((function(){return w(this,(function(t){return n.emit("webglcontextrestored"),[2]}))}));var a=e.container,s=e.canvas,o=e.fps,u=e.name,h=e.pixelRatio,l=e.manualRender,f=e.renderFramework,d=e.notifyTouch,p=e.onError,m=e.interactive,v=void 0!==m&&m,y=e.renderOptions,g=void 0===y?{}:y,x=e.env,b=void 0===x?"":x,E=g.willCaptureImage,_=g.premultipliedAlpha;if(r.onError=p,sp||"debug-disable"===f)return Qd(r);var S,C=(S=/iPhone OS (\d+)_(\d+)/.exec(i.userAgent))&&("13"===S[1]||"16"===S[1]&&"5"===S[2])?"webgl":"webgl2";f&&(C="webgl"===f?"webgl":"webgl2"),r.env=b,r.name=u||""+op++;var A=!1;try{if(Ir.length)throw new Error("Errors before player create: "+Ir.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});s?(r.canvas=s,A=!0):(!function(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Jd+".")}(a),r.canvas=c.createElement("canvas"),a.appendChild(r.canvas)),r.container=r.canvas.parentElement,r.engine=xd.create(r.canvas,{name:u,glType:C,fps:o,env:b,preserveDrawingBuffer:E,premultipliedAlpha:_,manualRender:l,notifyTouch:d,interactive:v,pixelRatio:Number.isFinite(h)?h:J()}),r.engine.offscreenMode=!0,r.engine.on("rendererror",(function(t){r.handleEmitEvent("rendererror",t)})),r.engine.on("contextlost",(function(t){r.lost(t.e)}));var M=Xf(r);r.engine.on("contextrestored",T((function(){return w(this,(function(t){switch(t.label){case 0:return[4,M.restore()];case 1:return t.sent(),[2]}}))}))),r.engine.on("click",(function(t){var e=t.behavior||$t.NOTIFY;r.emit("click",gi({},t,{player:Xf(r),compositionId:t.composition.id,compositionName:t.composition.name})),e===$t.RESUME_PLAYER&&r.resume()})),r.engine.on("pointerdown",(function(t){r.emit("pointerdown",t)})),r.engine.on("pointerup",(function(t){r.emit("pointerup",t)})),r.engine.on("pointermove",(function(t){r.emit("pointermove",t)})),r.engine.runRenderLoop((function(t){r.autoPlaying&&r.emit("update",{player:Xf(r),playing:!0})})),ip.forEach((function(t){t.gpuCapability.type!==r.gpuCapability.type&&wt.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+r.gpuCapability.type+".\nsee "+ep+".")})),ip.set(r.canvas,Xf(r)),function(){for(var t,e=[],i=Ze(ip.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&wt.error("Current running player count: "+e.length+", see "+tp+".",e)}()}catch(t){var I;r.canvas&&!A&&r.canvas.remove(),null==(I=r.engine)||I.dispose(),r.disposed=!0,r.handleThrowError(t)}return r}oe(e,t);var r=e.prototype;return r.setSpeed=function(t){isNaN(t)||(this.engine.speed=t)},r.getSpeed=function(){return this.engine.speed},r.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},r.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},r.getAssetManager=function(){return this.assetManagers},r.loadScene=function(t,e){var i=this;return T((function(){var r,n,a,s,o,u,h,l,c,f;return w(this,(function(d){switch(d.label){case 0:for(mt(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),(n=null==(r=null==e?void 0:e.autoplay)||r)&&(i.autoPlaying=!0),a=[],s=[],At(t)?(o=a).push.apply(o,[].concat(t)):a.push(t),u=Ze(i.assetManagers);!(h=u()).done;)h.value.dispose();return i.engine.assetManagers=[],l=i.engine.compositions.length,[4,Promise.all(a.map(T((function(t,r){var a,o,u,h,c,f,d;return w(this,(function(p){switch(p.label){case 0:return a=l+r,o=i.assetService.assembleSceneLoadOptions(t,gi({autoplay:n},e)),u=o.source,h=o.options,f=null==(c=null==h?void 0:h.autoplay)||c,[4,_d.load(u,i.engine,h)];case 1:return(d=p.sent()).setIndex(a),d.onItemMessage=function(t){i.emit("message",t)},s[r]=f,[2,d]}}))}))))];case 1:for(c=d.sent(),f=0;f<c.length;f++)s[f]?c[f].play():c[f].pause();return c.some((function(t){return!t.getPaused()}))&&i.emit("play",{time:0}),[2,At(t)?c:c[0]]}}))}))()},r.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})},r.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.tick(0),this.emit("play",{time:t})},r.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.tick(0),this.emit("pause")},r.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()},r.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())},r.resume=function(){var t=this;return T((function(){var e;return w(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]}}))}))()},r.tick=function(t){this.engine.mainLoop(t)},r.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},r.resize=function(){this.engine.resize()},r.clearCanvas=function(){this.renderer.clear({stencilAction:Ar.clear,clearStencil:0,depthAction:Ar.clear,clearDepth:1,colorAction:Ar.clear,clearColor:[0,0,0,0]})},r.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()}))},r.dispose=function(){if(wt.info("Call player destroyed: "+this.name+"."),!this.disposed){ip.delete(this.canvas),this.pause(),this.engine.dispose(),E(this.canvas,p)&&(fc.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var t="Never use destroyed player: "+this.name+" again, see "+$d+".",e=function(){return function(t){throw new Error(t)}(t)},i=function(){return e=t,Promise.reject(e);var e};this.tick=e,this.resize=e,this.loadScene=i,this.play=i,this.gotoAndPlay=i,this.gotoAndStop=i,this.playSequence=e,this.destroyCurrentCompositions=e,this.resume=i,this.disposed=!0}},r.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},r.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},r.handleEmitEvent=function(t,e){this.onError?E(e,x)?this.onError(new Error(e.type,{cause:t}),e):E(e,Error)?this.onError(new Error(e.message,{cause:t}),e):this.onError(new Error("Unknown error.",{cause:t}),e):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,e))},xr(e,[{key:"skipPointerMovePicking",get:function(){return this.engine.eventSystem.skipPointerMovePicking},set:function(t){this.engine.eventSystem.skipPointerMovePicking=t}},{key:"ticker",get:function(){return this.engine.ticker}},{key:"renderer",get:function(){return this.engine.renderer}},{key:"gpuCapability",get:function(){return this.engine.gpuCapability}},{key:"compositions",get:function(){return this.engine.compositions}},{key:"assetManagers",get:function(){return this.engine.assetManagers}},{key:"assetService",get:function(){return this.engine.assetService}},{key:"event",get:function(){return this.engine.eventSystem}},{key:"displayAspect",get:function(){return this.engine.displayAspect},set:function(t){this.engine.displayAspect=t}},{key:"displayScale",get:function(){return this.engine.displayScale},set:function(t){this.engine.displayScale=t}},{key:"offscreenMode",get:function(){return this.engine.offscreenMode},set:function(t){this.engine.offscreenMode=t}},{key:"pixelRatio",get:function(){return this.engine.pixelRatio},set:function(t){this.engine.pixelRatio=t}},{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}}]),e}(ea);function hp(t){sp=!!t}_([function(t,e,i){var r=i.value;return i.value=T((function(){var e,i,n,a,s=arguments;return w(this,(function(o){switch(o.label){case 0:for(e=s.length,i=new Array(e),n=0;n<e;n++)i[n]=s[n];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.apply(this,i)];case 2:return[2,o.sent()];case 3:return a=o.sent(),t.handleThrowError.call(this,a),[3,4];case 4:return[2]}}))})),i}],up.prototype,"loadScene",null),cn.create=function(t,e){return new zd(t,e)},cn.createWithData=function(t,e,i){void 0===e&&(e=ht("#fff")),void 0===i&&(i={});var r=i.type,n=void 0===r?Rr.UNSIGNED_BYTE:r,a=i.format,s=void 0===a?Rr.RGBA:a,o=i.internalFormat,u=i.wrapS,h=void 0===u?Rr.MIRRORED_REPEAT:u,l=i.wrapT,c=void 0===l?Rr.MIRRORED_REPEAT:l,f=i.minFilter,d=void 0===f?Rr.NEAREST:f,p=i.magFilter,m=void 0===p?Rr.NEAREST:p,v=i.flipY,y=void 0!==v&&v,g=i.generateMipmap,x=void 0!==g&&g;return new zd(t,{data:e,type:n,sourceType:Mr.data,format:s,internalFormat:o||s,wrapS:h,wrapT:c,minFilter:d,magFilter:m,flipY:y,generateMipmap:x})},To.create=function(t,e){return new Pd(t,e)},wo.create=function(t,e){return new wo(t,e)},Zo.create=function(t){return new Vd(t)},ho.create=function(t,e){return new Ud(t,e)},xd.create=function(t,e){return new Kd(t,e)};var lp="2.9.2";wt.info("Player version: 2.9.2.");export{Fu as ActivationMixerPlayable,Vu as ActivationPlayable,Hl as ActivationPlayableAsset,nh as ActivationTrack,ki as AndNode,Vi as AndNodeData,Ei as Animatable,Nu as AnimationClip,Ti as AnimationClipNode,xi as AnimationClipNodeData,Ou as AnimationEvent,mi as AnimationGraphAsset,wr as Animator,Ni as ApplyAdditiveNode,Pi as ApplyAdditiveNodeData,Ec as Asset,Sc as AssetLoader,Df as AssetManager,Uf as AssetService,bo as BYTES_TYPE_MAP,_r as Behaviour,ps as BezierCurve,ts as BezierCurvePath,es as BezierCurveQuat,Ra as BezierDataMap,Ba as BezierEasing,Ma as BezierLengthData,Ia as BezierMap,Da as BezierPath,za as BezierQuat,_c as BinaryAsset,Fi as BlendNode,Li as BlendNodeData,pi as BoolValueNode,Wn as BoundingBoxInfo,so as COPY_FRAGMENT_SHADER,no as COPY_MESH_SHADER_ID,ao as COPY_VERTEX_SHADER,jf as Camera,uu as CameraController,fu as CameraVFXItemLoader,bs as ColorCurve,Ru as ColorPlayable,zu as ColorPropertyMixerPlayable,Yl as ColorPropertyPlayableAsset,mh as ColorPropertyTrack,br as Component,hc as ComponentTimePlayable,uc as ComponentTimePlayableAsset,ac as ComponentTimeTrack,Qf as Composition,Ys as CompositionComponent,Ho as CompressTextureCapabilityType,Wi as ConstBoolNode,Xi as ConstBoolNodeData,ji as ConstFloatNode,Gi as ConstFloatNodeData,Js as ConstraintTarget,qi as ControlParameterBoolNode,Zi as ControlParameterBoolNodeData,Yi as ControlParameterFloatNode,Hi as ControlParameterFloatNodeData,Qi as ControlParameterTriggerNode,Ki as ControlParameterTriggerNodeData,vc as DEFAULT_FONTS,yd as DEFAULT_FPS,Cc as Database,bt as Deferred,_t as DestroyOptions,Gr as Downloader,xo as DrawObjectPass,ro as EFFECTS_COPY_MESH_NAME,du as EVENT_TYPE_CLICK,vu as EVENT_TYPE_TOUCH_END,mu as EVENT_TYPE_TOUCH_MOVE,pu as EVENT_TYPE_TOUCH_START,qs as EffectComponent,oc as EffectComponentTimeTrack,ii as EffectsObject,vd as EffectsPackage,zs as Ellipse,xd as Engine,tr as EqualNodeData,ea as EventEmitter,yu as EventSystem,nu as Fake3DAnimationMode,au as Fake3DComponent,eo as FilterMode,ca as Float16ArrayWrapper,nr as FloatComparisonNode,rr as FloatComparisonNodeData,Bu as FloatPropertyMixerPlayable,Zl as FloatPropertyPlayableAsset,sh as FloatPropertyTrack,di as FloatValueNode,su as FrameComponent,ho as Framebuffer,Kd as GLEngine,Pd as GLGeometry,Rn as GLSLVersion,Qo as GPUCapability,To as Geometry,Yo as GlobalUniforms,Qa as GradientValue,yr as GraphInstance,hi as GraphNode,li as GraphNodeData,eu as Graphics,Hs as GraphicsPath,ar as GreaterNodeData,ta as HELP_LINK,Bn as HitTestType,Eu as InteractComponent,xu as InteractLoader,Tu as InteractMesh,ui as InvalidIndex,Yn as Item,$i as LayerBlendNode,Ji as LayerBlendNodeData,sr as LessNodeData,Ja as LineSegments,Ka as LinearValue,Er as MaskMode,Un as MaskProcessor,iu as MaskableGraphic,zn as Material,Tn as MaterialDataBlock,Vn as MaterialRenderType,kn as MaterialState,lh as MaterialTrack,wo as Mesh,Ii as NodeTransform,Ui as NotNode,Bi as NotNodeData,Pu as NotifyEvent,Wl as ObjectBindingTrack,zi as OrNode,Di as OrNodeData,$ as OrderType,$n as PLAYER_OPTIONS_ENV_EDITOR,ml as POST_PROCESS_SETTINGS,Cl as ParticleBehaviourPlayable,Al as ParticleBehaviourPlayableAsset,cc as ParticleLoader,Il as ParticleMesh,Uu as ParticleMixerPlayable,Nl as ParticleSystem,Pl as ParticleSystemRenderer,ch as ParticleTrack,Ed as PassTextureCache,$a as PathSegments,wu as PlayState,Cu as Playable,Mu as PlayableAsset,Au as PlayableOutput,up as Player,ae as Plugin,Gt as PluginSystem,Gn as PointerEventData,cu as PointerEventType,Us as PolyStar,Ns as Polygon,Ri as Pose,ci as PoseNode,$s as PositionConstraint,to as PostProcessVolume,Vf as Precomposition,wd as PrecompositionManager,ku as PropertyClipPlayable,ah as PropertyTrack,dl as RENDER_PREFER_LOOKUP_TEXTURE,fl as RUNTIME_ENV,Ya as RandomSetValue,Za as RandomValue,qa as RandomVectorValue,jn as RaycastResult,Xo as RenderFrame,go as RenderPass,oo as RenderPassAttachmentStorageType,po as RenderPassDestroyAttachmentType,co as RenderPassPriorityNormal,fo as RenderPassPriorityPostprocess,lo as RenderPassPriorityPrepare,mo as RenderTargetHandle,qo as RenderTargetPool,io as RenderTextureFormat,Zo as Renderbuffer,tu as Renderer,Hn as RendererComponent,rh as RuntimeClip,Qn as SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0,Jn as SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0,qn as SEMANTIC_PRE_COLOR_ATTACHMENT_0,Kn as SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0,Zn as SPRITE_VERTEX_STRIDE,Rf as Scene,_d as SceneLoader,wc as SerializationHelper,Fn as Shader,In as ShaderCompileResultStatus,Bo as ShaderFactory,Tr as ShaderType,Ln as ShaderVariant,ru as ShapeComponent,Ws as ShapePath,cr as SourceType,Gu as SpriteColorMixerPlayable,nc as SpriteColorPlayableAsset,oh as SpriteColorTrack,lc as SpriteComponent,sc as SpriteComponentTimeTrack,Su as SpriteLoader,Ds as StarType,hr as StateMachineNode,or as StateMachineNodeData,fr as StateNode,lr as StateNodeData,Ha as StaticValue,ju as SubCompositionClipPlayable,Xu as SubCompositionMixerPlayable,ql as SubCompositionPlayableAsset,uh as SubCompositionTrack,pl as TEMPLATE_USE_OFFSCREEN_CANVAS,hs as TangentMode,bc as TextComponent,mc as TextComponentBase,dc as TextLayout,Tc as TextLoader,pc as TextStyle,cn as Texture,gn as TextureFactory,Ar as TextureLoadAction,$o as TexturePaintScaleMode,Mr as TextureSourceType,uo as TextureStoreAction,gd as Ticker,tc as TimelineAsset,eh as TimelineClip,ec as TimelineInstance,ih as TrackAsset,Lu as TrackMixerPlayable,th as TrackType,sa as Transform,Wu as TransformMixerPlayable,Ju as TransformPlayable,$u as TransformPlayableAsset,hh as TransformTrack,mr as TransitionNode,dr as TransitionNodeData,ur as TransitionState,Bs as UpdateModes,oa as VFXItem,Wa as ValueGetter,fi as ValueNode,ds as Vector2Curve,Zu as Vector2PropertyMixerPlayable,Jl as Vector2PropertyPlayableAsset,ph as Vector2PropertyTrack,fs as Vector3Curve,Yu as Vector3PropertyMixerPlayable,dh as Vector3PropertyTrack,Ql as Vector3ropertyPlayableAsset,cs as Vector4Curve,Hu as Vector4PropertyMixerPlayable,Kl as Vector4PropertyPlayableAsset,fh as Vector4PropertyTrack,ls as WeightedMode,ft as addByOrder,P as addItem,L as addItemWithOrder,kt as applyMixins,mt as assertExist,vt as asserts,Vt as base64ToFile,ka as buildBezierData,Ua as buildEasingCurve,As as buildLine,va as calculateTranslation,tt as canUseBOM,fc as canvasPool,_s as closePointEps,Lo as colorGradingFrag,q as colorStopsFromGradient,Y as colorToArr,Lf as combineImageTemplate,Sr as createGLContext,ss as createKeyFrameMeta,Oh as createShape,xs as createValueGetter,ws as curveEps,wa as decimalEqual,sn as deserializeMipmapTexture,hp as disableAllPlayer,tl as earcut,$e as effectsClass,Qe as effectsClassStore,F as enlargeBuffer,Mc as ensureFixedNumber,ya as ensureVec3,Ca as extractMinAndMax,Fo as gaussianDownHFrag,Vo as gaussianDownVFrag,ko as gaussianUpFrag,mn as generateEmptyTexture,Eo as generateEmptyTypedArray,Ft as generateGUID,fn as generateHalfFloatTexture,pn as generateWhiteTexture,ap as getActivePlayers,Nf as getBackgroundImage,Je as getClass,Z as getColorFromGradientStops,yl as getConfig,Ga as getControlPoints,xn as getDefaultTextureFactory,sl as getGeometryByShape,al as getGeometryTriangles,as as getKeyFrameMetaByRawValue,ei as getMergedStore,si as getNodeDataClass,Rl as getParticleMeshShader,J as getPixelRatio,np as getPlayerByCanvas,Xt as getPluginUsageInfo,Dr as getPreMultiAlpha,Sf as getStandardComposition,wf as getStandardImage,If as getStandardItem,Ef as getStandardJSON,Wo as getTextureSize,Rr as glContext,Vr as glType2VertexFormatType,Cr as gpuTimer,ht as imageDataFromColor,lt as imageDataFromGradient,Ir as initErrors,Pr as initGLContext,So as integrate,K as interpolateColor,ot as isAlipayMiniApp,rt as isAndroid,At as isArray,Ot as isCanvas,rp as isCanvasUsedByPlayer,Mt as isFunction,et as isIOS,it as isIOSByUA,st as isMiniProgram,It as isObject,nt as isOpenHarmony,Rt as isPlainObject,Pt as isPowerOfTwo,gt as isSafeFontFamily,at as isSimulatorCellPhone,Ct as isString,En as isUniformStruct,_n as isUniformStructArray,yt as isValidFontFamily,Nr as isWebGL2,ut as isWechatMiniApp,Ao as itemFrag,Co as itemVert,Yr as loadAVIFOptional,Qr as loadBinary,$r as loadBlob,qr as loadImage,nn as loadMedia,en as loadVideo,Wr as loadWebPOptional,wt as logger,Nn as math,Ol as modifyMaxKeyframeShader,Ta as nearestPowerOfTwo,ai as nodeDataClass,St as noop,Fc as normalizeColor,Sa as numberToFix,vs as oldBezierKeyFramesToNew,Q as parsePercent,Mo as particleFrag,ba as particleOriginTranslateMap,Ml as particleUniformTypeMap,Io as particleVert,Pf as passRenderLevel,Dt as pluginLoaderMap,Nt as randomInRange,Bt as registerPlugin,N as removeItem,ol as rotateVec2,No as screenMeshVert,ti as serialize,zr as setBlendMode,gl as setConfig,bn as setDefaultTextureFactory,Ur as setMaskMode,Ea as setRayFromCamera,Br as setSideMode,ct as sortByOrder,He as spec,yn as textureLoaderRegistry,Do as thresholdFrag,Lt as throwDestroyedError,Ro as trailVert,fa as translatePoint,_a as trianglesFromRect,Ut as unregisterPlugin,kr as valIfUndefined,Oo as value,Po as valueDefine,ga as vecFill,xa as vecMulCombine,lp as version,Fr as vertexFormatType2GLType};
|
|
2
2
|
//# sourceMappingURL=weapp.mjs.map
|