1import{P as Ol}from"./index-BtvXHrF4.js";import{d as Ll,r as Nl,f as Vl,o as kl,c as Dl,j as zl,w as Bl,u as Ul,i as Gl,b as Wl,_ as Hl}from"./index-F00fqZy-.js";/*! 2 * Name: @galacean/effects 3 * Description: Galacean Effects runtime player for the web 4 * Author: Ant Group CO., Ltd. 5 * Contributors: çç¶,é£å ®,å弦,äºå£,èå®,æç»® 6 * Version: v2.9.3 7 */function Ka(i,s,n,t,e,r,a){try{var o=i[r](a),u=o.value}catch(l){n(l);return}o.done?s(u):Promise.resolve(u).then(t,e)}function vt(i){return function(){var s=this,n=arguments;return new Promise(function(t,e){var r=i.apply(s,n);function a(u){Ka(r,t,e,a,o,"next",u)}function o(u){Ka(r,t,e,a,o,"throw",u)}a(void 0)})}}function Z(i,s){return s!=null&&typeof Symbol<"u"&&s[Symbol.hasInstance]?!!s[Symbol.hasInstance](i):Z(i,s)}function $(i,s,n,t){var e=arguments.length,r=e<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,n):t,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(i,s,n,t);else for(var o=i.length-1;o>=0;o--)(a=i[o])&&(r=(e<3?a(r):e>3?a(s,n,r):a(s,n))||r);return e>3&&r&&Object.defineProperty(s,n,r),r}function pt(i,s){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},t,e,r,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(l){return function(h){return u([l,h])}}function u(l){if(t)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(n=0)),n;)try{if(t=1,e&&(r=l[0]&2?e.return:l[0]?e.throw||((r=e.return)&&r.call(e),0):e.next)&&!(r=r.call(e,l[1])).done)return r;switch(e=0,r&&(l=[l[0]&2,r.value]),l[0]){case 0:case 1:r=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,e=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r=r.length>0&&r[r.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!r||l[1]>r[0]&&l[1]<r[3])){n.label=l[1];break}if(l[0]===6&&n.label<r[1]){n.label=r[1],r=l;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(l);break}r[2]&&n.ops.pop(),n.trys.pop();continue}l=s.call(i,n)}catch(h){l=[6,h],e=0}finally{t=r=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}var Di,Xl=new Uint8Array(16);function jl(){if(!Di&&(Di=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Di))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Di(Xl)}var ye=[];for(var Sn=0;Sn<256;++Sn)ye.push((Sn+256).toString(16).slice(1));function Yl(i,s){return s===void 0&&(s=0),ye[i[s+0]]+ye[i[s+1]]+ye[i[s+2]]+ye[i[s+3]]+"-"+ye[i[s+4]]+ye[i[s+5]]+"-"+ye[i[s+6]]+ye[i[s+7]]+"-"+ye[i[s+8]]+ye[i[s+9]]+"-"+ye[i[s+10]]+ye[i[s+11]]+ye[i[s+12]]+ye[i[s+13]]+ye[i[s+14]]+ye[i[s+15]]}var Zl=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),$a={randomUUID:Zl};function ql(i,s,n){if($a.randomUUID&&!s&&!i)return $a.randomUUID();i=i||{};var t=i.random||(i.rng||jl)();return t[6]=t[6]&15|64,t[8]=t[8]&63|128,Yl(t)}function we(i,s){return i.includes(s)||i.push(s),i}function Re(i,s){var n=i.indexOf(s);return n>-1&&i.splice(n,1),i}function Ja(i,s,n,t){t===void 0&&(t=1);var e=i.buffer;if(e.byteLength<i.BYTES_PER_ELEMENT*s){var r=Math.ceil(s*t);Number.isNaN(n)||(r=Math.min(r,n));var a=new ArrayBuffer(i.BYTES_PER_ELEMENT*r),o=new i.constructor(a);return o.set(i),o}return i}var ee=Math.PI/180,Cn=180/Math.PI,fr=1e-6;function Cu(i,s){return Math.abs(i-s)<fr||i===1/0&&s===1/0||i===-1/0&&s===-1/0}var ts=function(i,s,n){return(1-n)*i+n*s};function he(i,s,n){var t=isNaN(s)?-1/0:s,e=isNaN(n)?1/0:n,r=Math.min(t,e),a=Math.max(t,e);return Math.min(Math.max(i,r),a)}var ht=function(){function i(n,t){n===void 0&&(n=0),t===void 0&&(t=0),this.x=n,this.y=t}var s=i.prototype;return s.set=function(t,e){return this.x=t,this.y=e,this},s.setZero=function(){return this.x=0,this.y=0,this},s.setFromNumber=function(t){return this.x=t,this.y=t,this},s.setFromArray=function(t,e){e===void 0&&(e=0);var r;this.x=(r=t[e])!=null?r:0;var a;return this.y=(a=t[e+1])!=null?a:0,this},s.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},s.clone=function(){return new i(this.x,this.y)},s.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},s.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},s.add=function(t){return typeof t=="number"?(this.x+=t,this.y+=t):Z(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},s.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},s.subtract=function(t){return typeof t=="number"?(this.x-=t,this.y-=t):Z(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},s.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},s.multiply=function(t){return typeof t=="number"?(this.x*=t,this.y*=t):Z(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},s.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},s.divide=function(t){return typeof t=="number"?(this.x/=t,this.y/=t):Z(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},s.scale=function(t){return this.x*=t,this.y*=t,this},s.sum=function(){return this.x+this.y},s.min=function(t){return typeof t=="number"?(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},s.max=function(t){return typeof t=="number"?(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},s.clamp=function(t,e){return this.max(t).min(e)},s.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},s.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},s.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},s.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},s.negate=function(){return this.x=-this.x,this.y=-this.y,this},s.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},s.lengthSquared=function(){return this.x*this.x+this.y*this.y},s.normalize=function(){return this.divide(this.length()||1)},s.setLength=function(t){return this.normalize().multiply(t)},s.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},s.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this},s.dot=function(t){return this.x*t.x+this.y*t.y},s.cross=function(t){return this.x*t.y-this.y*t.x},s.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},s.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},s.equals=function(t){return this.x===t.x&&this.y===t.y}
7,s.isZero=function(){var t=fr,e=this,r=e.x,a=e.y;return Math.abs(r)<=t&&Math.abs(a)<=t},s.toArray=function(){return[this.x,this.y]},s.fill=function(t,e){e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y},s.random=function(){return this.x=Math.random(),this.y=Math.random(),this},i.fromNumber=function(t){return new i().setFromNumber(t)},i.fromArray=function(t,e){return e===void 0&&(e=0),new i().setFromArray(t,e)},i}();ht.ONE=new ht(1,1);ht.ZERO=new ht(0,0);var D=function(){function i(n,t,e){n===void 0&&(n=0),t===void 0&&(t=0),e===void 0&&(e=0),this.x=n,this.y=t,this.z=e}var s=i.prototype;return s.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},s.setZero=function(){return this.x=0,this.y=0,this.z=0,this},s.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},s.setFromArray=function(t,e){e===void 0&&(e=0);var r;this.x=(r=t[e])!=null?r:0;var a;this.y=(a=t[e+1])!=null?a:0;var o;return this.z=(o=t[e+2])!=null?o:0,this},s.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},s.clone=function(){return new i(this.x,this.y,this.z)},s.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},s.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},s.add=function(t){return typeof t=="number"?(this.x+=t,this.y+=t,this.z+=t):Z(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},s.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},s.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},s.subtract=function(t){return typeof t=="number"?(this.x-=t,this.y-=t,this.z-=t):Z(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},s.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},s.multiply=function(t){return typeof t=="number"?(this.x*=t,this.y*=t,this.z*=t):Z(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},s.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},s.divide=function(t){return typeof t=="number"?(this.x/=t,this.y/=t,this.z/=t):Z(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},s.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},s.sum=function(){return this.x+this.y+this.z},s.min=function(t){return typeof t=="number"?(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},s.max=function(t){return typeof t=="number"?(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},s.clamp=function(t,e){return this.max(t).min(e)},s.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},s.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},s.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},s.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},s.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},s.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},s.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},s.normalize=function(){return this.divide(this.length()||1)},s.setLength=function(t){return this.normalize().multiply(t)},s.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},s.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this},s.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},s.cross=function(t){return this.crossVectors(this,t)},s.crossVectors=function(t,e){var r=t.x,a=t.y,o=t.z,u=e.x,l=e.y,h=e.z;return this.x=a*h-o*l,this.y=o*u-r*h,this.z=r*l-a*u,this},s.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},s.distance=function(t){return Math.sqrt(this.distanceSquared(t))},s.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y,a=this.z-t.z;return e*e+r*r+a*a},s.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}
7,s.isZero=function(){var t=fr,e=this,r=e.x,a=e.y,o=e.z;return Math.abs(r)<=t&&Math.abs(a)<=t&&Math.abs(o)<=t},s.toArray=function(){return[this.x,this.y,this.z]},s.toVector2=function(){return new ht(this.x,this.y)},s.fill=function(t,e){e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},s.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},s.applyEuler=function(t,e){return t.rotateVector3(this,e)},s.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},s.applyMatrix=function(t,e){return t.transformPoint(this,e)},s.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},s.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},i.fromNumber=function(t){return new i().setFromNumber(t)},i.fromArray=function(t,e){return e===void 0&&(e=0),new i().setFromArray(t,e)},i}();D.X=new D(1,0,0);D.Y=new D(0,1,0);D.Z=new D(0,0,1);D.ONE=new D(1,1,1);D.ZERO=new D(0,0,0);var Dt=function(){function i(n,t,e,r){n===void 0&&(n=0),t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),this.x=n,this.y=t,this.z=e,this.w=r}var s=i.prototype;return s.set=function(t,e,r,a){return this.x=t,this.y=e,this.z=r,this.w=a,this},s.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},s.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},s.setFromArray=function(t,e){e===void 0&&(e=0);var r;this.x=(r=t[e])!=null?r:0;var a;this.y=(a=t[e+1])!=null?a:0;var o;this.z=(o=t[e+2])!=null?o:0;var u;return this.w=(u=t[e+3])!=null?u:0,this},s.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},s.clone=function(){return new i(this.x,this.y,this.z,this.w)},s.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},s.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},s.add=function(t){return typeof t=="number"?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):Z(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},s.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},s.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},s.subtract=function(t){return typeof t=="number"?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):Z(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},s.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},s.multiply=function(t){return typeof t=="number"?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):Z(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},s.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},s.divide=function(t){return typeof t=="number"?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):Z(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},s.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},s.sum=function(){return this.x+this.y+this.z+this.w},s.min=function(t){return typeof t=="number"?(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},s.max=function(t){return typeof t=="number"?(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},s.clamp=function(t,e){return this.max(t).min(e)},s.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},s.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},s.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},s.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},s.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},s.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},s.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},s.normalize=function(){return this.divide(this.length()||1)},s.setLength=function(t){return this.normalize().multiply(t)},s.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},s.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this},s.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},s.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}
7,s.isZero=function(){var t=fr,e=this,r=e.x,a=e.y,o=e.z,u=e.w;return Math.abs(r)<=t&&Math.abs(a)<=t&&Math.abs(o)<=t&&Math.abs(u)<=t},s.toArray=function(){return[this.x,this.y,this.z,this.w]},s.toVector3=function(){return new D(this.x,this.y,this.z)},s.fill=function(t,e){e===void 0&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},s.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},s.applyMatrix=function(t,e){return t.transformVector4(this,e)},i.fromNumber=function(t){return new i().setFromNumber(t)},i.fromArray=function(t,e){return e===void 0&&(e=0),new i().setFromArray(t,e)},i}();Dt.ONE=new Dt(1,1,1,1);Dt.ZERO=new Dt(0,0,0,0);var Ct=function(){function i(n,t,e,r){n===void 0&&(n=0),t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),this.r=n,this.g=t,this.b=e,this.a=r}var s=i.prototype;return s.set=function(t,e,r,a){return this.r=t,this.g=e,this.b=r,this.a=a,this},s.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},s.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},s.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},s.setFromArray=function(t,e){e===void 0&&(e=0);var r;this.r=(r=t[e])!=null?r:0;var a;this.g=(a=t[e+1])!=null?a:0;var o;this.b=(o=t[e+2])!=null?o:0;var u;return this.a=(u=t[e+3])!=null?u:0,this},s.setFromHSV=function(t,e,r,a){a===void 0&&(a=1);var o=r*e,u=t/60,l=o*(1-Math.abs(u%2-1)),h=0,c=0,f=0;u>=0&&u<=1?(h=o,c=l):u>=1&&u<=2?(h=l,c=o):u>=2&&u<=3?(c=o,f=l):u>=3&&u<=4?(c=l,f=o):u>=4&&u<=5?(h=l,f=o):u>=5&&u<=6&&(h=o,f=l);var d=r-o;return this.set(h+d,c+d,f+d,a)},s.setFromHexString=function(t){if(t.substring(0,1)!=="#"||t.length!==9&&t.length!==7)return this;var e=parseInt(t.substring(1,3),16)/255,r=parseInt(t.substring(3,5),16)/255,a=parseInt(t.substring(5,7),16)/255,o=t.length===9?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,a,o)},s.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},s.clone=function(){return new i(this.r,this.g,this.b,this.a)},s.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},s.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},s.add=function(t){return typeof t=="number"?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):Z(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},s.subtract=function(t){return typeof t=="number"?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):Z(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
7-=t.b,this.a-=t.a),this},s.multiply=function(t){return typeof t=="number"?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):Z(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},s.divide=function(t){return typeof t=="number"?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):Z(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},s.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},s.min=function(t){return typeof t=="number"?(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},s.max=function(t){return typeof t=="number"?(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},s.clamp=function(t,e){return this.max(t).min(e)},s.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},s.luminance=function(){return this.r*.3+this.g*.59+this.b*.11},s.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},s.toLinear=function(){return this.r=i.gammaToLinear(this.r),this.g=i.gammaToLinear(this.g),this.b=i.gammaToLinear(this.b),this},s.toGamma=function(){return this.r=i.linearToGamma(this.r),this.g=i.linearToGamma(this.g),this.b=i.linearToGamma(this.b),this},s.toArray=function(){return[this.r,this.g,this.b,this.a]},s.toVector4=function(){return new Dt(this.r,this.g,this.b,this.a)},s.toHSV=function(){var t=this,e=t.r,r=t.g,a=t.b,o=t.a,u=Math.max(e,r,a),l=Math.min(e,r,a),h=u,c=u-l,f=0,d=0;return u!==0&&(d=c/u),u!=l&&(u==e?(f=(r-a)/c,r<a&&(f+=6)):u==r?f=(a-e)/c+2:u==a&&(f=(e-r)/c+4),f*=60),new i(f,d,h,o)},s.toHexString=function(t){t===void 0&&(t=!0);var e=i.ToHex(Math.round(this.r*255)),r=i.ToHex(Math.round(this.g*255)),a=i.ToHex(Math.round(this.b*255)),o=i.ToHex(Math.round(this.a*255));return t?"#"+e+r+a+o:"#"+e+r+a},s.fill=function(t,e){e===void 0&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},i.fromNumber=function(t){return new i().setFromNumber(t)},i.fromArray=function(t,e){return e===void 0&&(e=0),new i().setFromArray(t,e)},i.fromHexString=function(t){return new i().setFromHexString(t)},i.fromHSV=function(t,e,r,a){return a===void 0&&(a=1),new i().setFromHSV(t,e,r,a)},i.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)},i.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)},i.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},i}();Ct.BLACK=new Ct(0,0,0,1);Ct.BLUE=new Ct(0,0,1,1);Ct.CLEAR=new Ct(0,0,0,0);Ct.CYAN=new Ct(0,1,1,1);Ct.GRAY=new Ct(.5,.5,.5,1);Ct.GREEN=new Ct(0,1,0,1);Ct.MAGENTA=new Ct(1,0,1,1);Ct.RED=new Ct(1,0,0,1);Ct.WHITE=new Ct(1,1,1,1);Ct.YELLOW=new Ct(1,.92,.016,1);function Na(i,s){var n=[0,0,0,0];if(vr(i)){i=i.replace(/[\s\t\r\n]/g,"");var t=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(i);if(t){var e=+t[4];n=[+t[1],+t[2],+t[3],isNaN(e)?255:e*255]}else/^#[a-f\d]{3}$/i.test(i)?n=[parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16),parseInt(i[3]+i[3],16),255]:(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i))&&(n=[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),255])}else Z(i,Array)&&(n=[i[0],i[1],i[2],isNaN(i[3])?255:i[3]]);if(s)for(var r=0;r<4;r++)n[r]/=255;return n}function Ql(i,s,n){if(i.length===0)return[0,0,0,0];var t;if(s<=i[0].time)t=i[0].color.toArray();else if(s>=i[i.length-1].time)t=i[i.length-1].color.toArray();else{t=i[i.length-1].color.toArray();for(var e=1;e<=i.length-1;e++){var r=i[e-1],a=i[e];if(r.time<=s&&s<=a.time){t=ka(r.color.toArray(),a.color.toArray(),(s-r.time)/(a.time-r.time));break}}}return n?t.map(function(o){return o/255}):t}function Va(i){var s=[];
7return Z(i,Array)?i.forEach(function(n){var t=n[0],e=n[1],r=n[2],a=n[3],o=n[4];s.push({time:es(t),color:new Ct(e,r,a,o)})}):Object.keys(i).forEach(function(n){var t=i[n],e=new Ct().setFromArray(Na(t));s.push({time:es(n),color:e})}),s=s.sort(function(n,t){return n.time-t.time}),s}function ka(i,s,n,t){var e=[],r=1-n;if(t)for(var a=0;a<4;a++)e[a]=i[a]*r+s[a]*n;else{for(var o=0;o<3;o++)e[o]=Math.round(Math.sqrt(i[o]*i[o]*r+s[o]*s[o]*n));e[3]=Math.round(i[3]*r+s[3]*n)}return e}function es(i){var s=/^(-)?([\d+.]+)%$/.exec(i);return s?+s[2]/100*(s[1]?-1:1):+i}function Au(){return typeof window=="object"?Math.min(2,window.devicePixelRatio||1):1}var Kl=typeof window<"u";function Mu(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)}function Iu(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function $l(){return/\bOpenHarmony\b/.test(navigator.userAgent)}function Pu(){return Iu()||$l()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function Jl(i){vr(i)&&(i=Na(i));for(var s=i,n={width:1,height:1,data:new Uint8Array(1*1*4)},t=n.data,e=0;e<4;e++)t[e]=s[e];return n}function Bn(i){var s=128,n={width:s,height:1,data:new Uint8Array(s*1*4)},t=n.data,e=Va(i);if(e.length)for(var r=0;r<s;r++){var a=r/(s-1);if(a<=e[0].time)t.set(e[0].color.toArray(),r*4);else if(a>=e[e.length-1].time)t.set(e[e.length-1].color.toArray(),r*4);else for(var o=0;o<e.length-1;o++){var u=e[o],l=e[o+1];if(u.time<=a&&l.time>a){var h=ka(u.color.toArray(),l.color.toArray(),(a-u.time)/(l.time-u.time));t.set(h,r*4);break}}}return n}var rs;(function(i){i[i.none=1]="none",i[i.ascending=2]="ascending",i[i.descending=3]="descending"})(rs||(rs={}));function th(i,s){s===void 0&&(s=2);var n=i.length;if(n<=1||s===1)return i;if(n<=30){for(var t=1;t<n;t++)Ru(i,t,s);return i}else return Un(i,s)}function eh(i,s,n){return n===void 0&&(n=2),i.includes(s)||(i.push(s),i.length===1)||n!==1&&Ru(i,i.length-1,n),i}function Ru(i,s,n){var t=i[s];if(n!==2)for(;s>=1&&i[s-1].priority<t.priority&&(i[s]=i[s-1],s--,s!==0););else for(;s>=1&&i[s-1].priority>t.priority&&(i[s]=i[s-1],s--,s!==0););i[s]=t}function Un(i,s,n,t){if(n===void 0&&(n=0),t===void 0&&(t=i.length-1),n>=t)return i;for(var e=i[n],r=n,a=t;r<a;){if(s===2){for(;i[a].priority>e.priority&&a>=r;)a--;for(;i[r].priority<=e.priority&&r<a;)r++}else{for(;i[a].priority<e.priority&&a>=r;)a--;for(;i[r].priority>=e.priority&&r<a;)r++}var o;o=[i[a],i[r]],i[r]=o[0],i[a]=o[1]}var u;return u=[i[r],i[n]],i[n]=u[0],i[r]=u[1],Un(i,s,n,r-1),Un(i,s,a+1,t),i}function ne(i,s){if(s===void 0&&(s="item doesn't exist"),i==null)throw new Error(s)}function Fu(i){return rh(i)||!Pu()}function rh(i){return/^[^\d.][\w-]*$/.test(i)}var ih="[Galacean Effects]",Br;function Da(i){return["%c"+ih,"color: #AA0100",""+i]}function nh(i){for(var s=arguments.length,n=new Array(s>1?s-1:0),t=1;t<s;t++)n[t-1]=arguments[t];var e;(e=console).error.apply(e,[].concat(Da(i),[n])),Br==null||Br("error",i,n)}function ah(i){for(var s=arguments.length,n=new Array(s>1?s-1:0),t=1;t<s;t++)n[t-1]=arguments[t];var e;(e=console).debug.apply(e,[].concat(Da(i))),Br==null||Br("info",i,n)}function sh(i){for(var s=arguments.length,n=new Array(s>1?s-1:0),t=1;t<s;t++)n[t-1]=arguments[t];var e;(e=console).warn.apply(e,[].concat(Da(i))),Br==null||Br("warn",i,n)}function oh(i){i&&za(i)&&(Br=i)}var Nt={error:nh,info:ah,warn:sh,register:oh},Dr;(function(i){i[i.destroy=0]="destroy",i[i.keep=1]="keep",i[i.force=0]="force"})(Dr||(Dr={}));function uh(){}function vr(i){return typeof i=="string"}var wr=Array.isArray||function(i){return Object.prototype.toString.call(i)==="[object Array]"};function za(i){return Object.prototype.toString.call(i)==="[object Function]"}function tr(i){return Object.prototype.toString.call(i)==="[object Object]"}function Ou(i){if(i===null||typeof i!="object"||Object.prototype.toString.call(i)!=="[object Object]")return!1;var s=Object.getPrototypeOf(i);if(s===null)return!0;var n=Object.prototype.hasOwnProperty,t=n.call(s,"constructor")&&s.constructor;return typeof t=="function"&&Function.prototype.toString.call(t)===Function.prototype.toString.call(Object)}function Lu(i){var s;return typeof i=="object"&&i!==null&&((s=i.tagName)==null?void 0:s.toUpperCase())==="CANVAS"}function zi(i){return(i&i-1)===0&&i!==0}function Ar(i,s){return i+Math.random()*(s-i)}function Ba(){throw new Error("Destroyed item cannot be used again.")}function Pt(){return ql().replace(/-/g,"")}function lh(i,s,n){s===void 0&&(s="base64File"),n===void 0&&(n="");for(var t=i.split(",")[1]||i,e=atob(t),r=[],a=0;a<e.length;a+=512){for(var o=e.slice(a,a+512),u=new Array(o.length),l=0;l<o.length;
7l++)u[l]=o.charCodeAt(l);var h=new Uint8Array(u);r.push(h)}var c=new Blob(r,{type:n}),f=new File([c],s,{type:n});return f}function hh(i,s){s.forEach(function(n){Object.getOwnPropertyNames(n.prototype).forEach(function(t){var e=Object.getOwnPropertyDescriptor(n.prototype,t);if(!e)throw new Error("Cannot find property descriptor of class "+n);Object.defineProperty(i.prototype,t,e)})})}var Gn={},Vr=[];function Oi(i,s){Gn[i]&&Nt.error("Duplicate registration for plugin "+i+"."),Gn[i]=s;var n=new s;n.name=i,Vr.push(n),Vr.sort(function(t,e){return t.order-e.order})}var tn=function(){function i(){}return i.getPlugins=function(){return Vr},i.initializeComposition=function(n,t){Vr.forEach(function(e){return e.onCompositionCreated(n,t)})},i.destroyComposition=function(n){Vr.forEach(function(t){return t.onCompositionDestroy(n)})},i.onAssetsLoadStart=function(n,t){return vt(function(){return pt(this,function(e){return[2,Promise.all(Vr.map(function(r){return r.onAssetsLoadStart(n,t)}))]})})()},i.onAssetsLoadFinish=function(n,t,e){Vr.forEach(function(r){return r.onAssetsLoadFinish(n,t,e)})},i}(),ch={"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","ric
7h-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"};function fh(i){var s=ch[i];return s?"\n请æå¦ä¸å½ä»¤è¿è¡æä½ï¼Please follow the commands below to proceedï¼ï¼\n1ãä½¿ç¨ npm å®è£
æä»¶ï¼Install Pluginï¼ï¼npm i "+s+"@latest --save\n2ã导å
¥æä»¶ï¼Import Pluginï¼ï¼import '"+s+"'":""}var Li=function(){function i(){this.order=100,this.name="Plugin"}var s=i.prototype;return s.onAssetsLoadStart=function(t,e){return vt(function(){return pt(this,function(r){return[2]})})()},s.onAssetsLoadFinish=function(t,e,r){},s.onCompositionCreated=function(t,e){},s.onCompositionDestroy=function(t){},i}();function wi(i,s){return wi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},wi(i,s)}function k(i,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(s&&s.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),s&&wi(i,s)}var Oe;(function(i){i["1_0"]="1.0",i["1_1"]="1.1",i["1_2"]="1.2",i["1_3"]="1.3",i["1_5"]="1.5",i["1_8"]="1.8",i["2_0"]="2.0",i["2_1"]="2.1",i["2_2"]="2.2",i["2_3"]="2.3",i["2_4"]="2.4",i["3_0"]="3.0",i["3_1"]="3.1",i["3_2"]="3.2",i["3_3"]="3.3",i["3_4"]="3.4",i["3_5"]="3.5",i["3_6"]="3.6",i["3_7"]="3.7",i.LATEST="3.7"})(Oe||(Oe={}));var Ne;(function(i){i.S="S",i.APlus="A+",i.A="A",i.BPlus="B+",i.B="B"})(Ne||(Ne={}));var Xt;(function(i){i[i.ALPHA=0]="ALPHA",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.BRIGHTNESS=3]="BRIGHTNESS",i[i.SUBTRACTION=4]="SUBTRACTION",i[i.STRONG_LIGHT=5]="STRONG_LIGHT",i[i.WEAK_LIGHT=6]="WEAK_LIGHT",i[i.SUPERPOSITION=7]="SUPERPOSITION"})(Xt||(Xt={}));var qe;(function(i){i[i.DOUBLE=1032]="DOUBLE",i[i.FRONT=1028]="FRONT",i[i.BACK=1029]="BACK"})(qe||(qe={}));var xi;(function(i){i[i.OBSCURED=2]="OBSCURED",i[i.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"})(xi||(xi={}));var Ae;(function(i){i[i.NONE=0]="NONE",i[i.SPHERE=1]="SPHERE",i[i.CONE=2]="CONE",i[i.HEMISPHERE=3]="HEMISPHERE",i[i.CIRCLE=4]="CIRCLE",i[i.DONUT=5]="DONUT",i[i.RECTANGLE=6]="RECTANGLE",i[i.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",i[i.EDGE=8]="EDGE",i[i.TEXTURE=9]="TEXTURE"})(Ae||(Ae={}));var is;(function(i){i[i.GYROSCOPE=0]="GYROSCOPE",i[i.SPINE=1]="SPINE"})(is||(is={}));var Ye;(function(i){i[i.CLICK=0]="CLICK",i[i.MESSAGE=1]="MESSAGE",i[i.DRAG=2]="DRAG"})(Ye||(Ye={}));var ri;(function(i){i[i.NONE=0]="NONE",i[i.NOTIFY=1]="NOTIFY",i[i.RESUME_PLAYER=2]="RESUME_PLAYER",i[i.REMOVE=3]="REMOVE",i[i.PAUSE=4]="PAUSE"})(ri||(ri={}));var rt;(function(i){i.base="0",i.sprite="1",i.particle="2",i.null="3",i.interact="4",i.plugin="5",i.camera="6",i.composition="7",i.spine="spine",i.mesh="mesh",i.tree="tree",i.text="text",i.light="light",i.skybox="skybox",i.effect="effect",i.shape="shape",i.postProcessVolume="postProcessVolume",i.node="node",i.video="video",i.audio="audio",i.richtext="richtext"})(rt||(rt={}));var er;(function(i){i[i.BILLBOARD=0]="BILLBOARD",i[i.MESH=1]="MESH",i[i.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",i[i.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"})(er||(er={}));var re;(function(i){i[i.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",i[i.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",i[i.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",i[i.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",i[i.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",i[i.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",i[i.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",i[i.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",i[i.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"})(re||(re={}));var Wn;(function(i){i.Opaque="Opaque",i.Transparent="Transparent"})(Wn||(Wn={}));var en;(function(i){i.Both="Both",i.Back="Back",i.Front="Front"})(en||(en={}));var dh=1,vh=3,ph=0,ns=2,as=1,rn;(function(i){i[i.portrait=1]="portrait",i[i.landscape=0]="landscape"})(rn||(rn={}));var dt;(function(i){i[i.CONSTANT=0]="CONSTANT",i[i.CONSTANT_VEC2=1]="CONSTANT_VEC2",i[i.CONSTANT_VEC3=2]="CONSTANT_VEC3",i[i.CONSTANT_VEC4=3]="CONSTANT_VEC4",i[i.RANDOM=4]="RANDOM",i[i.LINE=5]="LINE",i[i.CURVE=6]="CURVE",i[i.BEZIER_PATH=7]="BEZIER_PATH",i[i.RGBA_COLOR=8]="RGBA_COLOR",i[i.GRADIENT_COLOR=9]="GRADIENT_COLOR",i[i.SHAPE_POINTS=10]="SHAPE_POINTS",i[i.SHAPE_SPLITS=11]="SHAPE_SPLITS",i[i.LINEAR_PATH=12]="LINEAR_PATH",i[i.COLORS=13]="COLORS",i[i.BINARY=20]="BINARY",i[i.BEZIER_CURVE=21]="BEZIER_CURVE",i[i.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",i[i.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",i[i.COLOR_CURVE=24]="COLOR_CURVE",i[i.VECTOR4_CURVE=25
7]="VECTOR4_CURVE",i[i.VECTOR2_CURVE=26]="VECTOR2_CURVE",i[i.VECTOR3_CURVE=27]="VECTOR3_CURVE"})(dt||(dt={}));var Lt;(function(i){i[i.AUTO=0]="AUTO",i[i.EASE=1]="EASE",i[i.EASE_IN=2]="EASE_IN",i[i.EASE_OUT=3]="EASE_OUT",i[i.LINE=4]="LINE",i[i.HOLD=5]="HOLD",i[i.LINE_OUT=6]="LINE_OUT"})(Lt||(Lt={}));var Gt;(function(i){i[i.destroy=0]="destroy",i[i.restart=5]="restart",i[i.forward=2]="forward",i[i.freeze=4]="freeze"})(Gt||(Gt={}));var nn;(function(i){i[i.none=0]="none",i[i.removeParticle=1]="removeParticle"})(nn||(nn={}));var Sr;(function(i){i[i.RANDOM=0]="RANDOM",i[i.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",i[i.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",i[i.UNIFORM_BURST=3]="UNIFORM_BURST"})(Sr||(Sr={}));var ss;(function(i){i.point="point",i.spot="spot",i.directional="directional",i.ambient="ambient"})(ss||(ss={}));var os;(function(i){i[i.box=2]="box",i[i.sphere=3]="sphere"})(os||(os={}));var us;(function(i){i.orthographic="orthographic",i.perspective="perspective"})(us||(us={}));var ls;(function(i){i.unlit="unlit",i.pbr="pbr",i.hair="hair"})(ls||(ls={}));var hs;(function(i){i[i.opaque=100]="opaque",i[i.masked=101]="masked",i[i.translucent=102]="translucent",i[i.additive=103]="additive"})(hs||(hs={}));var cs;(function(i){i.none="none",i.uv="uv",i.normal="normal",i.basecolor="basecolor",i.alpha="alpha",i.metallic="metallic",i.roughness="roughness",i.ao="ao",i.emissive="emissive",i.diffuse="diffuse"})(cs||(cs={}));var Si;(function(i){i[i.visible=0]="visible",i[i.display=1]="display",i[i.clip=2]="clip",i[i.ellipsis=3]="ellipsis"})(Si||(Si={}));var Cr;(function(i){i[i.autoWidth=0]="autoWidth",i[i.autoHeight=1]="autoHeight",i[i.fixed=2]="fixed"})(Cr||(Cr={}));var fs;(function(i){i[i.top=0]="top",i[i.middle=1]="middle",i[i.bottom=2]="bottom"})(fs||(fs={}));var kr;(function(i){i[i.left=0]="left",i[i.middle=1]="middle",i[i.right=2]="right"})(kr||(kr={}));var qr;(function(i){i[i.top=0]="top",i[i.middle=1]="middle",i[i.bottom=2]="bottom"})(qr||(qr={}));var an;(function(i){i.normal="normal",i.bold="bold",i.lighter="lighter"})(an||(an={}));var Ci;(function(i){i.normal="normal",i.italic="italic",i.oblique="oblique"})(Ci||(Ci={}));var Nu={WhiteTexture:"whitetexture00000000000000000000",EmptyTexture:"emptyTexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"},_e;(function(i){i[i.Solid=0]="Solid",i[i.GradientLinear=1]="GradientLinear",i[i.GradientRadial=2]="GradientRadial",i[i.GradientAngular=3]="GradientAngular",i[i.Texture=4]="Texture"})(_e||(_e={}));var ds;(function(i){i[i.Fill=0]="Fill",i[i.Fit=1]="Fit",i[i.Crop=2]="Crop",i[i.Tile=3]="Tile"})(ds||(ds={}));var te;(function(i){i[i.Custom=0]="Custom",i[i.Rectangle=1]="Rectangle",i[i.Ellipse=2]="Ellipse",i[i.Polygon=3]="Polygon",i[i.Star=4]="Star"})(te||(te={}));var dr;(function(i){i[i.Butt=0]="Butt",i[i.Round=1]="Round",i[i.Square=2]="Square"})(dr||(dr={}));var rr;(function(i){i[i.Round=0]="Round",i[i.Bevel=1]="Bevel",i[i.Miter=2]="Miter"})(rr||(rr={}));var ae;(function(i){i.AnimationClipNodeData="AnimationClipNodeData",i.BlendNodeData="BlendNodeData",i.ApplyAdditiveNodeData="ApplyAdditiveNodeData",i.LayerBlendNodeData="LayerBlendNodeData",i.StateMachineNodeData="StateMachineNodeData",i.TransitionNodeData="TransitionNodeData",i.StateNodeData="StateNodeData",i.ConstFloatNodeData="ConstFloatNodeData",i.ConstBoolNodeData="ConstBoolNodeData",i.ControlParameterBoolNodeData="ControlParameterBoolNodeData",i.ControlParameterFloatNodeData="ControlParameterFloatNodeData",i.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",i.NotNodeData="NotNodeData",i.AndNodeData="AndNodeData",i.OrNodeData="OrNodeData",i.EqualNodeData="EqualNodeData",i.GreaterNodeData="GreaterNodeData",i.LessNodeData="LessNodeData"})(ae||(ae={}));var Hn;(function(i){i.video="video",i.image="image"})(Hn||(Hn={}));var vs;(function(i){i.video="video",i.audio="audio"})(vs||(vs={}));var ps;(function(i){i.L30="hev1.1.0.L30.B0",i.L60="hev1.1.0.L60.B0",i.L63="hev1.1.0.L63.B0",i.L90="hev1.1.0.L90.B0",i.L93="hev1.1.0.L93.B0",i.L120="hev1.1.0.L120.B0",i.L150="hev1.1.0.L150.B0",i.L180="hev1.1.0.L180.B0"})(ps||(ps={}));var tt;(function(i){i.VFXItemData="VFXItemData",i.Material="Material",i.Shader="Shader",i.Geometry="Geometry",i.Texture="Texture",i.Image="Image",i.AnimationClip="AnimationClip",i.BinaryAsset="BinaryAsset",i.TrackAsset="TrackAsset",i.TimelineAsset="TimelineAsset",i.ObjectBindingTrack="ObjectBindingTrack",i.TransformTrack="TransformTrack",i.SpriteColorTrack="SpriteColorTrack",i.ActivationTrack="ActivationTrack",i.SubCompositionTrack="SubCompositionTrack",i.FloatPropertyTrack="FloatPropertyTrack",i.ColorPropertyTrack="ColorPropertyTrack",i.Vector2PropertyTrack="Vector2PropertyTrack",i.Vector3PropertyTrack="Vector3PropertyTrack",i.Vector4PropertyTrack="Vector4PropertyTrack",i.TransformPlayableAsset="TransformPlayableAsset",i.SpriteColorPlayableAsset="SpriteColorPlayableAsset",i.ActivationPlayableAsset="ActivationPlayableAsset",i.SubCompositionPlayableAsset="SubCompositionPlayableAsset",i.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",i.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",i.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",i.Vector3PropertyPlayableAsset="Vector3PropertyPlayableAsset",i.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",i.MeshComponent="MeshComponent",i.SkyboxComponent="SkyboxComponent",i.LightComponent="LightComponent",i.CameraComponent="C
7ameraComponent",i.ModelPluginComponent="ModelPluginComponent",i.TreeComponent="TreeComponent",i.AnimationComponent="AnimationComponent",i.SpineComponent="SpineComponent",i.VideoComponent="VideoComponent",i.AudioComponent="AudioComponent",i.RichTextComponent="RichTextComponent",i.OrientationComponent="OrientationComponent",i.ShapeComponent="ShapeComponent",i.SpriteComponent="SpriteComponent",i.ParticleSystem="ParticleSystem",i.InteractComponent="InteractComponent",i.CameraController="CameraController",i.PostProcessVolume="PostProcessVolume",i.EffectComponent="EffectComponent",i.TextComponent="TextComponent",i.AnimationGraphAsset="AnimationGraphAsset",i.CompositionComponent="CompositionComponent",i.FFDComponent="FFDComponent",i.FrameComponent="FrameComponent",i.Animator="Animator",i.TimelineClip="TimelineClip"})(tt||(tt={}));var Xn;(function(i){i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(Xn||(Xn={}));var Fe;(function(i){i[i.Float16=0]="Float16",i[i.Float32=1]="Float32",i[i.Int8=2]="Int8",i[i.Int16=3]="Int16",i[i.Int32=4]="Int32",i[i.UInt8=5]="UInt8",i[i.UInt16=6]="UInt16",i[i.UInt32=7]="UInt32"})(Fe||(Fe={}));var Kr;(function(i){i[i.None=-1]="None",i[i.UInt8=0]="UInt8",i[i.UInt16=1]="UInt16",i[i.UInt32=2]="UInt32"})(Kr||(Kr={}));var sn;(function(i){i.Position="POSITION",i.Uv="TEXCOORD0",i.Uv2="TEXCOORD1",i.Normal="NORMAL",i.Tangent="TANGENT",i.Color="COLOR",i.Joints="JOINTS",i.Weights="WEIGHTS",i.PositionBS0="POSITION_BS0",i.PositionBS1="POSITION_BS1",i.PositionBS2="POSITION_BS2",i.PositionBS3="POSITION_BS3",i.PositionBS4="POSITION_BS4",i.PositionBS5="POSITION_BS5",i.PositionBS6="POSITION_BS6",i.PositionBS7="POSITION_BS7",i.NormalBS0="NORMAL_BS0",i.NormalBS1="NORMAL_BS1",i.NormalBS2="NORMAL_BS2",i.NormalBS3="NORMAL_BS3",i.TangentBS0="TANGENT_BS0",i.TangentBS1="TANGENT_BS1",i.TangentBS2="TANGENT_BS2",i.TangentBS3="TANGENT_BS3"})(sn||(sn={}));Oe.LATEST;function ms(i,s){(s==null||s>i.length)&&(s=i.length);for(var n=0,t=new Array(s);n<s;n++)t[n]=i[n];return t}function mh(i,s){if(i){if(typeof i=="string")return ms(i,s);var n=Object.prototype.toString.call(i).slice(8,-1);if(n==="Object"&&i.constructor&&(n=i.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ms(i,s)}}function M(i,s){var n=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(n)return(n=n.call(i)).next.bind(n);if(Array.isArray(i)||(n=mh(i))||s){n&&(i=n);var t=0;return function(){return t>=i.length?{done:!0}:{done:!1,value:i[t++]}}}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 qi=new Map,An=new Map,jn={};function Vu(i){return jn[i]}function xt(i){return function(s,n){jn[i]&&console.warn("Class "+i+" is already registered."),jn[i]=s}}function bt(i,s){return gh(i,s)}function gs(i){var s=i.constructor;if(An.get(s))return An.get(s);var n={};An.set(s,n);for(var t=i,e=s;e;){var r=qi.get(e);for(var a in r)n[a]=r[a];var o=Object.getPrototypeOf(t);if(e=Object.getPrototypeOf(o).constructor,e===Object)break;t=o}return n}function gh(i,s){return function(n,t){var e=yh(n);e&&(e[t]||(e[t]={type:i,sourceName:s}))}}function yh(i){var s=i.constructor;return qi.get(s)||qi.set(s,{}),qi.get(s)}var xe=function(){function i(n){this.engine=n,this.guid=Pt(),this.definition={},this.engine.addInstance(this)}var s=i.prototype;return s.getInstanceId=function(){return this.guid},s.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},s.toData=function(){},s.fromData=function(t){t.id!==void 0&&this.setInstanceId(t.id)},s.dispose=function(){this.engine.removeInstance(this.guid)},i.is=function(t){return Z(t,i)&&"guid"in t},i}(),ys=function(){function i(){this.resources=[]}var s=i.prototype;return s.getResource=function(t){return this.resources[t]},i}(),Yn={};function me(i){return function(s,n){Yn[i]&&console.warn("NodeData Class "+i+" is already registered."),Yn[i]=s}}function xh(i){return Yn[i]}var fe=-1,ku=function(){function i(){this.initializationCount=0,this.lastUpdateID=-1}var s=i.prototype;return s.getNodeData=function(){return this.asset},s.isValid=function(){return!0},s.isInitialized=function(){return this.initializationCount>0},s.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},s.shutdown=function(t){if(!this.isInitialized())throw new Error("Node not initialized!");--this.initializationCount===0&&this.shutdownInternal(t)},s.isNodeActive=function(t){return this.lastUpdateID===t},s.isUpdated=function(t){return this.isNodeActive(t.updateID)},s.markNodeActive=function(t){this.lastUpdateID=t.updateID},s.initializeInternal=function(t){this.initializationCount++},s.shutdownInternal=function(t){if(this.isInitialized())throw new Error("Node still initialized!");this.lastUpdateID=-1},i}(),be=function(){function i(){}var s=i.prototype;return s.load=function(t){this.index=t.index},s.createNode=function(t,e){var r=new t;
7return e.nodes[this.index]=r,r.asset=this,r},i}(),Gr=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.duration=0,t.previousTime=0,t.currentTime=0,t}var n=s.prototype;return n.getCurrentTime=function(){return this.currentTime},n.getPreviousTime=function(){return this.previousTime},n.getDuration=function(){return this.duration},n.getDebugInfo=function(){var e={duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime};return e},n.initializeInternal=function(e){i.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},s}(ku),Du=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.setValue=function(e){},s}(ku),zu=function(i){k(s,i);function s(){return i.apply(this,arguments)}return s}(Du),Pr=function(i){k(s,i);function s(){return i.apply(this,arguments)}return s}(Du),xs=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.nodeDatas=[],t.graphDataSet=new ys,t.controlParameterIDs=[],t.parameterLookupMap=new Map,t.rootNodeIndex=fe,t}var n=s.prototype;return n.fromData=function(e){var r=e,a=r.nodeDatas;this.rootNodeIndex=r.rootNodeIndex,this.controlParameterIDs=r.controlParameterIDs;for(var o=r.controlParameterIDs.length,u=0;u<o;u++)this.parameterLookupMap.set(r.controlParameterIDs[u],u);this.nodeDatas=[];for(var l=0;l<a.length;l++)this.nodeDatas[l]=s.createNodeData(a[l].type),this.nodeDatas[l].load(a[l]);this.graphDataSet=new ys,this.graphDataSet.resources=[];for(var h=M(r.graphDataSet.resources),c;!(c=h()).done;){var f=c.value,d=this.engine.findObject(f);this.graphDataSet.resources.push(d)}},s.createNodeData=function(e){var r=xh(e);if(r)return new r;throw new Error("Unknown node type: "+e+".")},s}(xe);xs=$([xt("AnimationGraphAsset")],xs);var on;(function(i){i[i.Active=0]="Active",i[i.Inactive=1]="Inactive"})(on||(on={}));var bh=function(){function i(){this.deltaTime=0,this.updateID=0,this.branchState=0}var s=i.prototype;return s.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},i}(),Th=function(){function i(){this.nodeDatas=[],this.nodes=[]}var s=i.prototype;return s.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t]):null},i}();function lt(){return lt=Object.assign||function(s){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s[e]=t[e])}return s},lt.apply(this,arguments)}var bs=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.playRate=1,t.loopAnimation=!0,t.dataSlotIndex=-1,t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(_h,e);r.animation=e.dataSet.getResource(this.dataSlotIndex)},n.load=function(e){i.prototype.load.call(this,e);var r=lt({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=r.playRate,this.loopAnimation=r.loopAnimation},s}(be);bs=$([me(ae.AnimationClipNodeData)],bs);var _h=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.animation=null,t.animatable=null,t}var n=s.prototype;return n.evaluate=function(e,r){if(!this.animatable)return r;this.markNodeActive(e);var a=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+e.deltaTime/this.duration*a.playRate,a.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=he(this.currentTime,0,1),this.sampleEvents(e);var o=this.currentTime*this.duration;return this.animatable.getPose(o,r.pose),r},n.sampleEvents=function(e){if(!(!this.animatable||this.animatable.events.length===0))for(var r=this.previousTime*this.duration,a=this.currentTime*this.duration,o=M(this.animatable.events),u;!(u=o()).done;){var l=u.value,h=l.data.startTime,c=!1;this.previousTime<=this.currentTime?c=r<h&&h<=a:c=h>r||h<=a,c&&(l.currentTime=a,l.deltaTime=e.deltaTime,e.activeEvents.push(l))}},n.initializeInternal=function(e){var r;i.prototype.initializeInternal.call(this,e);var a;this.duration=(a=(r=this.animation)==null?void 0:r.duration)!=null?a:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new Eh(e.skeleton,this.animation))},s}(Gr),Ts;(function(i){i[i.Position=0]="Position",i[i.Scale=1]="Scale",i[i.Rotation=2]="Rotation",i[i.Euler=3]="Euler"})(Ts||(Ts={}));var Eh=function(){function i(n,t){this.skeleton=n,this.animationClip=t,this.events=[],this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var e=M(t.positionCurves),r;!(r=e()).done;){var a=r.value;this.addTransformCurveInfo(a,0)}for(var o=M(t.scaleCurves),u;!(u=o()).done;){var l=u.value;this.addTransformCurveInfo(l,1)}for(var h=M(t.rotationCurves),c;!(c=h()).done;){var f=c.value;this.addTransformCurveInfo(f,2)}for(var d=M(t.eulerCurves),v;
7!(v=d()).done;){var p=v.value;this.addTransformCurveInfo(p,3)}for(var g=M(t.floatCurves),x;!(x=g()).done;){var b=x.value;this.addFloatCurveInfo(b)}for(var y=M(t.colorCurves),E;!(E=y()).done;){var _=E.value;this.addColorCurveInfo(_)}for(var S=M(this.animationClip.events),C;!(C=S()).done;){var I=C.value;this.events.push({data:I,currentTime:0,deltaTime:0})}}var s=i.prototype;return s.getPose=function(t,e){for(var r=he(t,0,this.animationClip.duration),a=M(this.transformCurveInfos),o;!(o=a()).done;){var u=o.value,l=u.curve.keyFrames.getValue(r),h=e.parentSpaceTransforms[u.boneIndex];switch(u.type){case 0:h.position.copyFrom(l);break;case 1:h.scale.copyFrom(l);break;case 2:h.rotation.copyFrom(l);break;case 3:h.euler.copyFrom(l);break}}for(var c=M(this.floatCurveInfos),f;!(f=c()).done;){var d=f.value,v=d.curve.keyFrames.getValue(r);e.floatPropertyValues[d.animatedObjectIndex]=v}for(var p=M(this.colorCurveInfos),g;!(g=p()).done;){var x=g.value,b=x.curve.keyFrames.getValue(r);e.colorPropertyValues[x.animatedObjectIndex]=b}},s.addTransformCurveInfo=function(t,e){var r=this.skeleton.pathToBoneIndex.get(t.path);r!==void 0&&this.transformCurveInfos.push({curve:t,boneIndex:r,type:e})},s.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);e!==void 0&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},s.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);e!==void 0&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},i}(),Zt=function(){function i(n,t,e,r){n===void 0&&(n=0),t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=1),this.x=n,this.y=t,this.z=e,this.w=r}var s=i.prototype;return s.set=function(t,e,r,a){return this.x=t,this.y=e,this.z=r,this.w=a,this},s.setFromEuler=function(t){return t.toQuaternion(this),this},s.setFromAxisAngle=function(t,e){var r=e/2,a=Math.sin(r),o=i.tempVec0;return o.copyFrom(t).normalize(),this.x=o.x*a,this.y=o.y*a,this.z=o.z*a,this.w=Math.cos(r),this},s.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},s.setFromArray=function(t,e){return e===void 0&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},s.setFromRotationMatrix=function(t){var e=t.elements,r=e[0],a=e[4],o=e[8],u=e[1],l=e[5],h=e[9],c=e[2],f=e[6],d=e[10],v=r+l+d;if(v>0){var p=.5/Math.sqrt(v+1);this.w=.25/p,this.x=(f-h)*p,this.y=(o-c)*p,this.z=(u-a)*p}else if(r>l&&r>d){var g=2*Math.sqrt(1+r-l-d);this.w=(f-h)/g,this.x=.25*g,this.y=(a+u)/g,this.z=(o+c)/g,this.negate()}else if(l>d){var x=2*Math.sqrt(1+l-r-d);this.w=(o-c)/x,this.x=(a+u)/x,this.y=.25*x,this.z=(h+f)/x,this.negate()}else{var b=2*Math.sqrt(1+d-r-l);this.w=(u-a)/b,this.x=(o+c)/b,this.y=(h+f)/b,this.z=.25*b,this.negate()}return this},s.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=r):(this.x=0,this.y=-t.z,this.z=t.y,this.w=r)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=r),this.normalize()},s.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},s.clone=function(){return new i(this.x,this.y,this.z,this.w)},s.angleTo=function(t){return 2*Math.acos(Math.abs(he(this.dot(t),-1,1)))},s.rotateTowards=function(t,e){var r=this.angleTo(t);if(r===0)return this;var a=Math.min(1,e/r);return this.slerp(t,a),this},s.identity=function(){return this.set(0,0,0,1)},s.invert=function(){return this.conjugate()},s.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},s.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},s.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},s.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},s.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},s.normalize=function(){var t=this.length();return t===0?(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},s.multiply=function(t){return this.multiplyQuaternions(this,t)},s.premultiply=function(t){return this.multiplyQuaternions(t,this)},s.multiplyQuaternions=function(t,e){var r=t.x,a=t.y,o=t.z,u=t.w,l=e.x,h=e.y,c=e.z,f=e.w;return this.x=r*f+u*l+a*c-o*h,this.y=a*f+u*h+o*l-r*c,this.z=o*f+u*c+r*h-a*l,this.w=u*f-r*l-a*h-o*c,this},s.slerp=function(t,e){if(e===0)return this;if(e===1)return this.copyFrom(t);var r=this,a=r.x,o=r.y,u=r.z,l=r.w,h=l*t.w+a*t.x+o*t.y+u*t.z;if(h<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,h=-h):this.copyFrom(t),h>=1)return this.w=l,this.x=a,this.y=o,this.z=u,this;var c=1-h*h;if(c<=Number.EPSILON){var f=1-e;return this.w=f*l+e*this.w,this.x=f*a+e*this.x,this.y=f*o+e*this.y,this.z=f*u+e*this.z,this.normalize(),this}var d=Math.sqrt(c),v=Math.atan2(d,h),p=Math.sin((1-e)*v)/d,g=Math.sin(e*v)/d;return this.w=l*p+this.w*g,this.x=a*p+this.x*g,this.y=o*p+this.y*g,this.z=u*p+this.z*g,this},s.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},s.rotateVector3=function(t,e){var r=this,a=r.x,o=r.y,u=r.z,l=r.w,h=t.x,c=t.y,f=t.z,d=l*h+o*f-u*c,v=l*c+u*h-a*f,p=l*f+a*c-o*h,g=-a*h-o*c-u*f,x=e!=null?e:t;return x.x=d*l+g*-a+v*-u-p*-o,x.y=v*l+g*-o+p*-a-d*-u,x.z=p*l+g*-u+d*-o-v*-a,x},s.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},s.toArray=function(){return[this.x,this.y,this.z,this.w]},s.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},s.toEuler=function(t){return t.setFromQuaternion(this)},s.toMatrix4=function(t){return t.compose(D.ZERO,this,D.ONE)},i.fromEuler=function(t){return new i().setFromEuler(t)},i.fromAxisAngle=function(t,e){return new i().setFromAxisAngle(t,e)},i.fromVector4=function(t){return new i().setFromVector4(t)},i.fromArray=function(t,e){return e===void 0&&(e=0),new i().setFromArray(t,e)},i.fromRotationMatrix=function(t){return new i().setFromRotationMatrix(t)},i.fromUnitVectors=function(t,e){return new i().setFromUnitVectors(t,e)},i}();Zt.tempVec0=new D;var wh=new Zt,Bu=function(){},Sh=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.blendVector3=function(e,r,a,o){o.x=e.x+(r.x-e.x)*a,o.y=e.y+(r.y-e.y)*a,o.z=e.z+(r.z-e.z)*a},n.blendQuaternion=function(e,r,a,o){o.copyFrom(e).slerp(r,a)},n.blendEuler=function(e,r,a,o){this.lerpEuler(e,r,a,o)},n.blendFloat=function(e,r,a){return e+(r-e)*a},n.blendColor=function(e,r,a,o){o.r=e.r+(r.r-e.r)*a,o.g=e.g+(r.g-e.g)*a,o.b=e.b+(r.b-e.b)*a,o.a=e.a+(r.a-e.a)*a},n.lerpEuler=function(e,r,a,o){o.x=this.lerpAngle(e.x,r.x,a),o.y=this.lerpAngle(e.y,r.y,a),o.z=this.lerpAngle(e.z,r.z,a)},n.normalizeAngle=function(e){return(e%360+360)%360},n.shortestAngleDiff=function(e,r){var a=this.normalizeAngle(r)-this.normalizeAngle(e);return a>180&&(a-=360),a<-180&&(a+=360),a},n.lerpAngle=function(e,r,a){var o=this.shortestAngleDiff(e,r);return this.normalizeAngle(e+o*a)},s}(Bu),Ch=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.blendVector3=function(e,r,a,o){o.x=e.x+r.x*a,o.y=e.y+r.y*a,o.z=e.z+r.z*a},n.blendQuaternion=function(e,r,a,o){var u=wh.copyFrom(e).multiply(r);o.copyFrom(e).slerp(u,a)},n.blendEuler=function(e,r,a,o){this.blendVector3(e,r,a,o)},n.blendFloat=function(e,r,a){return e+r*a},n.blendColor=function(e,r,a,o){o.r=e.r+r.r*a,o.g=e.g+r.g*a,o.b=e.b+r.b*a,o.a=e.a+r.a*a},s}(Bu),oi=function(){function i(){}return i.localBlend=function(n,t,e,r){i.localBlendInternal(n,t,e,r,i.normalBlendFunction)},i.additiveBlend=function(n,t,e,r){i.localBlendInternal(n,t,e,r,i.additiveBlendFunction)},i.localBlendInternal=function(n,t,e,r,a){for(var o=0;o<n.parentSpaceTransforms.length;o++){var u=n.parentSpaceTransforms[o],l=t.parentSpaceTransforms[o],h=r.parentSpaceTransforms[o],c=u.position,f=l.position,d=h.position;a.blendVector3(c,f,e,d);var v=u.rotation,p=l.rotation,g=h.rotation;a.blendQuaternion(v,p,e,g);var x=u.scale,b=l.scale,y=h.scale;a.blendVector3(x,b,e,y);var E=u.euler,_=l.euler,S=h.euler;a.blendEuler(E,_,e,S)}for(var C=0;C<n.floatPropertyValues.length;C++){var I=n.floatPropertyValues[C],R=t.floatPropertyValues[C];r.floatPropertyValues[C]=a.blendFloat(I,R,e)}for(var O=0;O<n.colorPropertyValues.length;O++){var F=n.colorPropertyValues[O],L=t.colorPropertyValues[O],V=r.colorPropertyValues[O];
7a.blendColor(F,L,e,V)}},i}();oi.normalBlendFunction=new Sh;oi.additiveBlendFunction=new Ch;var Uu=function(){function i(n){this.position=new D,this.rotation=new Zt,this.scale=new D,this.euler=new D,n&&(this.position.copyFrom(n.position),this.rotation.copyFrom(n.quat),this.scale.copyFrom(n.scale),this.euler.copyFrom(n.rotation))}var s=i.prototype;return s.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},i}(),Ah=function(){function i(n){this.skeleton=n,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var t=M(n.parentSpaceTransforms),e;!(e=t()).done;){var r=e.value;this.parentSpaceTransforms.push(new Uu().copyFrom(r))}for(var a=M(n.defaultFloatPropertyValues),o;!(o=a()).done;){var u=o.value;this.floatPropertyValues.push(u)}for(var l=M(n.defaultColorPropertyValues),h;!(h=l()).done;){var c=h.value;this.colorPropertyValues.push(new Ct().copyFrom(c))}}var s=i.prototype;return s.setPosition=function(t,e){var r=this.skeleton.pathToBoneIndex.get(t);r!==void 0&&this.parentSpaceTransforms[r].position.copyFrom(e)},s.setRotation=function(t,e){var r=this.skeleton.pathToBoneIndex.get(t);r!==void 0&&this.parentSpaceTransforms[r].rotation.copyFrom(e)},s.setEuler=function(t,e){var r=this.skeleton.pathToBoneIndex.get(t);r!==void 0&&this.parentSpaceTransforms[r].euler.copyFrom(e)},s.setScale=function(t,e){var r=this.skeleton.pathToBoneIndex.get(t);r!==void 0&&this.parentSpaceTransforms[r].scale.copyFrom(e)},s.setFloat=function(t,e){var r=this.skeleton.pathToObjectIndex.get(t);r!==void 0&&(this.floatPropertyValues[r]=e)},s.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var r=0;r<this.colorPropertyValues.length;r++)this.colorPropertyValues[r].copyFrom(t.colorPropertyValues[r]);for(var a=0;a<this.floatPropertyValues.length;a++)this.floatPropertyValues[a]=t.floatPropertyValues[a]},i}(),Mr=function(s){this.pose=new Ah(s)},_s=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Mh,e);r.baseNode=e.getNode(this.baseNodeIndex),r.additiveNode=e.getNode(this.additiveNodeIndex),r.inputParameterValueNode=e.getNode(this.inputParameterValueNodeIndex)},n.load=function(e){i.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},s}(be);_s=$([me(ae.ApplyAdditiveNodeData)],_s);var Mh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.baseNode=null,t.additiveNode=null,t.inputParameterValueNode=null,t}var n=s.prototype;return n.initializeInternal=function(e){var r,a,o;i.prototype.initializeInternal.call(this,e),this.baseNodeResult=new Mr(e.skeleton),this.additiveNodeResult=new Mr(e.skeleton),(r=this.baseNode)==null||r.initialize(e),(a=this.additiveNode)==null||a.initialize(e),(o=this.inputParameterValueNode)==null||o.initialize(e)},n.shutdownInternal=function(e){var r,a,o;(r=this.baseNode)==null||r.shutdown(e),(a=this.additiveNode)==null||a.shutdown(e),(o=this.inputParameterValueNode)==null||o.shutdown(e),i.prototype.shutdownInternal.call(this,e)},n.evaluate=function(e,r){if(!this.inputParameterValueNode)return r;this.markNodeActive(e);var a=this.inputParameterValueNode.getValue(e);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(e,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,a,r.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(e,this.baseNodeResult),this.additiveNode.evaluate(e,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,a,r.pose)),r},n.applyAdditive=function(e,r,a,o){oi.additiveBlend(e,r,a,o)},s}(Gr),Es=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Ih,e);r.source0=e.getNode(this.sourceNodeIndex0),r.source1=e.getNode(this.sourceNodeIndex1),r.inputParameterValueNode=e.getNode(this.inputParameterValueNodeIndex)},n.load=function(e){i.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},s}(be);Es=$([me(ae.BlendNodeData)],Es);var Ih=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.source0=null,t.source1=null,t.inputParameterValueNode=null,t}var n=s.prototype;return n.initializeInternal=function(e){var r,a,o;i.prototype.initializeInternal.call(this,e),this.source0Result=new Mr(e.skeleton),this.source1Result=new Mr(e.skeleton),(r=this.source0)==null||r.initialize(e),(a=this.source1)==null||a.initialize(e),(o=this.inputParameterValueNode)==null||o.initialize(e)},n.shutdownInternal=function(e){var r,a,o;(r=this.source0)==null||r.shutdown(e),(a=this.source1)==null||a.shutdown(e),(o=this.inputParameterValueNode)==null||o.shutdown(e),i.prototype.shutdownInternal.call(this,e)},n.evaluate=function(e,r){if(!this.inputParameterValueNode)return r;this.markNodeActive(e);var a=this.inputParameterValueNode.getValue(e);return this.source0&&!this.source1?(this.source0.evaluate(e,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,a,r.pose)):this.source0&&this.source1&&(this.source0.evaluate(e,this.source0Result),this.source1.evaluate(e,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,a,r.pose)),r},n.localBlend=function(e,r,a,o){oi.localBlend(e,r,a,o)},s}(Gr),ws=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.conditionNodeIndices=[],t}var n=s.prototype;return n.instantiate=function(e){for(var r=this.createNode(Ph,e),a=M(this.conditionNodeIndices),o;!(o=a()).done;){var u=o.value;r.conditionNodes.push(e.getNode(u))}},n.load=function(e){i.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},s}(be);ws=$([me(ae.AndNodeData)],ws);var Ph=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.conditionNodes=[],t.result=!1,t}var n=s.prototype;return n.getValue=function(e){if(!this.isUpdated(e)){this.markNodeActive(e),this.result=!0;
7for(var r=M(this.conditionNodes),a;!(a=r()).done;){var o=a.value;if(!o.getValue(e)){this.result=!1;break}}}return this.result},n.initializeInternal=function(e){i.prototype.initializeInternal.call(this,e);for(var r=M(this.conditionNodes),a;!(a=r()).done;){var o=a.value;o.initialize(e)}this.result=!1},n.shutdownInternal=function(e){for(var r=M(this.conditionNodes),a;!(a=r()).done;){var o=a.value;o.shutdown(e)}i.prototype.shutdownInternal.call(this,e)},s}(Pr),Ss=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.conditionNodeIndices=[],t}var n=s.prototype;return n.instantiate=function(e){for(var r=this.createNode(Rh,e),a=M(this.conditionNodeIndices),o;!(o=a()).done;){var u=o.value;r.conditionNodes.push(e.getNode(u))}},n.load=function(e){i.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},s}(be);Ss=$([me(ae.OrNodeData)],Ss);var Rh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.conditionNodes=[],t.result=!1,t}var n=s.prototype;return n.getValue=function(e){if(!this.isUpdated(e)){this.markNodeActive(e),this.result=!1;for(var r=M(this.conditionNodes),a;!(a=r()).done;){var o=a.value;if(o.getValue(e)){this.result=!0;break}}}return this.result},n.initializeInternal=function(e){i.prototype.initializeInternal.call(this,e);for(var r=M(this.conditionNodes),a;!(a=r()).done;){var o=a.value;o.initialize(e)}this.result=!1},n.shutdownInternal=function(e){for(var r=M(this.conditionNodes),a;!(a=r()).done;){var o=a.value;o.shutdown(e)}i.prototype.shutdownInternal.call(this,e)},s}(Pr),Cs=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.inputValueNodeIndex=fe,t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Fh,e);r.inputValueNode=e.getNode(this.inputValueNodeIndex)},n.load=function(e){i.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},s}(be);Cs=$([me(ae.NotNodeData)],Cs);var Fh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.inputValueNode=null,t.result=!1,t}var n=s.prototype;return n.getValue=function(e){return this.isUpdated(e)||(this.markNodeActive(e),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(e))),this.result},n.initializeInternal=function(e){var r;i.prototype.initializeInternal.call(this,e),(r=this.inputValueNode)==null||r.initialize(e),this.result=!1},n.shutdownInternal=function(e){var r;(r=this.inputValueNode)==null||r.shutdown(e),i.prototype.shutdownInternal.call(this,e)},s}(Pr),As=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=0,t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Oh,e);r.value=this.value},n.load=function(e){i.prototype.load.call(this,e),this.value=e.value},s}(be);As=$([me(ae.ConstFloatNodeData)],As);var Oh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=0,t}var n=s.prototype;return n.getValue=function(e){return this.isUpdated(e)||this.markNodeActive(e),this.value},s}(zu),Ms=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=!0,t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Lh,e);r.value=this.value},n.load=function(e){i.prototype.load.call(this,e),this.value=e.value},s}(be);
7Ms=$([me(ae.ConstBoolNodeData)],Ms);var Lh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=!0,t}var n=s.prototype;return n.getValue=function(e){return this.isUpdated(e)||this.markNodeActive(e),this.value},s}(Pr),Is=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=0,t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Nh,e);r.setValue(this.value)},n.load=function(e){i.prototype.load.call(this,e),this.value=e.value},s}(be);Is=$([me(ae.ControlParameterFloatNodeData)],Is);var Nh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=0,t}var n=s.prototype;return n.getValue=function(e){return this.isUpdated(e)||this.markNodeActive(e),this.value},n.setValue=function(e){this.value=e},s}(zu),Ps=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=!1,t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Vh,e);r.setValue(this.value)},n.load=function(e){i.prototype.load.call(this,e),this.value=e.value},s}(be);Ps=$([me(ae.ControlParameterBoolNodeData)],Ps);var Vh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=!1,t}var n=s.prototype;return n.getValue=function(e){return this.isUpdated(e)||this.markNodeActive(e),this.value},n.setValue=function(e){this.value=e},s}(Pr),Rs=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.instantiate=function(e){this.createNode(Gu,e)},n.load=function(e){i.prototype.load.call(this,e)},s}(be);Rs=$([me(ae.ControlParameterTriggerNodeData)],Rs);var Gu=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=!1,t}var n=s.prototype;return n.getValue=function(e){return this.isUpdated(e)||this.markNodeActive(e),this.value},n.setValue=function(e){this.value=e},s}(Pr),Fs=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.baseNodeIndex=fe,t.layerDatas=[],t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(kh,e);r.baseLayerNode=e.getNode(this.baseNodeIndex);for(var a=M(this.layerDatas),o;!(o=a()).done;){var u=o.value;r.layers.push({inputNode:e.getNode(u.inputNodeIndex),weightValueNode:e.getNode(u.weightValueNodeIndex),weight:0})}},n.load=function(e){i.prototype.load.call(this,e);var r;if(this.baseNodeIndex=(r=e.baseNodeIndex)!=null?r:fe,e.layerDatas)for(var a=M(e.layerDatas),o;!(o=a()).done;){var u=o.value;this.layerDatas.push(lt({inputNodeIndex:fe,weightValueNodeIndex:fe},u))}},s}(be);Fs=$([me(ae.LayerBlendNodeData)],Fs);var kh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.baseLayerNode=null,t.layers=[],t}var n=s.prototype;return n.initializeInternal=function(e){var r;i.prototype.initializeInternal.call(this,e),this.layerNodeResult=new Mr(e.skeleton),(r=this.baseLayerNode)==null||r.initialize(e);for(var a=M(this.layers),o;!(o=a()).done;){var u=o.value,l,h;(l=u.inputNode)==null||l.initialize(e),(h=u.weightValueNode)==null||h.initialize(e)}},n.shutdownInternal=function(e){var r;(r=this.baseLayerNode)==null||r.shutdown(e);for(var a=M(this.layers),o;!(o=a()).done;){var u=o.value,l,h;(l=u.inputNode)==null||l.shutdown(e),(h=u.weightValueNode)==null||h.shutdown(e)}i.prototype.shutdownInternal.call(this,e)},n.evaluate=function(e,r){return this.baseLayerNode&&this.baseLayerNode.isValid()&&(this.markNodeActive(e),this.previousTime=this.baseLayerNode.getCurrentTime(),r=this.baseLayerNode.evaluate(e,r),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(e,r)),r},n.updateLayers=function(e,r){for(var a=M(this.layers),o;!(o=a()).done;){var u=o.value;if(u.inputNode&&u.weightValueNode){this.layerNodeResult.pose.copyFrom(r.pose),u.inputNode.evaluate(e,this.layerNodeResult);var l=u.weightValueNode.getValue(e);oi.localBlend(r.pose,this.layerNodeResult.pose,l,r.pose)}}return r},s}(Gr),Os=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.inputValueNodeIndex=fe,t.comparandValueNodeIndex=fe,t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Dh,e);r.inputValueNode=e.getNode(this.inputValueNodeIndex),r.comparandValueNode=e.getNode(this.comparandValueNodeIndex)},n.load=function(e){i.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},s}(be);Os=$([me(ae.EqualNodeData)],Os);var Dh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.inputValueNode=null,t.comparandValueNode=null,t.result=!1,t}var n=s.prototype;return n.initializeInternal=function(e){i.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},n.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),i.prototype.shutdownInternal.call(this,e)},n.getValue=function(e){if(!this.isUpdated(e)&&(this.markNodeActive(e),this.inputValueNode&&this.comparandValueNode)){var r=this.inputValueNode.getValue(e),a=this.comparandValueNode.getValue(e);this.result=r===a}return this.result},s}(Pr),Wu=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.inputValueNodeIndex=fe,t.comparandValueNodeIndex=fe,t}var n=s.prototype;return n.load=function(e){i.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},s}(be),Ls;(function(i){i[i.GreaterThan=0]="GreaterThan",i[i.LessThan=1]="LessThan"})(Ls||(Ls={}));var Hu=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.inputValueNode=null,t.comparandValueNode=null,t.comparison=0,t.result=!1,t}var n=s.prototype;return n.initializeInternal=function(e){i.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},n.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),i.prototype.shutdownInternal.call(this,e)},n.getValue=function(e){if(!this.isUpdated(e)&&(this.markNodeActive(e),this.inputValueNode&&this.comparandValueNode)){var r=this.inputValueNode.getValue(e),a=this.comparandValueNode.getValue(e);switch(this.comparison){case 0:this.result=r>a;break;case 1:this.result=r<a;break}}return this.result},s}(Pr),Ns=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Hu,e);r.comparison=0,r.inputValueNode=e.getNode(this.inputValueNodeIndex),r.comparandValueNode=e.getNode(this.comparandValueNodeIndex)},s}(Wu);Ns=$([me(ae.GreaterNodeData)],Ns);var Vs=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Hu,e);r.comparison=1,r.inputValueNode=e.getNode(this.inputValueNodeIndex),r.comparandValueNode=e.getNode(this.comparandValueNodeIndex)},s}(Wu);Vs=$([me(ae.LessNodeData)],Vs);var ks=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.instantiate=function(e){for(var r=this.createNode(Xu,e),a=M(this.stateDatas),o;!(o=a()).done;){var u=o.value,l={stateNode:e.getNode(u.stateNodeIndex),transitions:[]};r.states.push(l);for(var h=M(u.transitionDatas),c;!(c=h()).done;){var f=c.value,d={transitionNode:e.getNode(f.transitionNodeIndex),conditionNode:e.getNode(f.conditionNodeIndex),targetStateIndex:f.targetStateIndex};l.transitions.push(d)}}},n.load=function(e){i.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex,this.machineName=e.machineName},s}(be);ks=$([me(ae.StateMachineNodeData)],ks);var Xu=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.states=[],t.activeTransition=null,t.activeStateIndex=fe,t}var n=s.prototype;return n.getCurrentStateName=function(){return this.states[this.activeStateIndex].stateNode.getNodeData().stateName},n.evaluate=function(e,r){if(this.markNodeActive(e),this.activeTransition!==null&&this.activeTransition.isComplete(e)&&(this.activeTransition.shutdown(e),this.activeTransition=null),this.activeTransition===null){var a=this.states[this.activeStateIndex].stateNode;r=a.evaluate(e,r),this.duration=a.getDuration(),this.previousTime=a.getPreviousTime(),this.currentTime=a.getCurrentTime()}else r=this.activeTransition.evaluate(e,r),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return e.branchState===on.Active&&this.evaluateTransitions(e,r),r},n.evaluateTransitions=function(e,r){for(var a=this.states[this.activeStateIndex],o=fe,u=a.transitions.length,l=0;l<u;l++){var h=a.transitions[l];if(h.targetStateIndex===fe)throw new Error("Invalid target state index.");if(!this.states[h.targetStateIndex].stateNode.isTransitioning()){var c=!1;if(h.transitionNode.hasExitTime){var f=a.stateNode;f.getElapsedTimeInState()/f.getDuration()>h.transitionNode.exitTime&&(c=!0)}else h.conditionNode!==null&&h.conditionNode.getValue(e)&&(c=!0);if(c){o=l;break}}}if(o!==fe){var d=a.transitions[o];d.transitionNode.initialize(e),this.activeTransition!==null?r=d.transitionNode.startTransitionFromTransition(e,r,this.activeTransition,r):r=d.transitionNode.startTransitionFromState(e,r,this.states[this.activeStateIndex].stateNode,r),this.activeTransition=d.transitionNode,this.shutdownTransitionConditions(e),this.activeStateIndex=d.targetStateIndex,this.initializeTransitionConditions(e),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},n.selectDefaultState=function(e){var r=this.getNodeData().defaultStateIndex;return r},n.initializeInternal=function(e){i.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var r=this.states[this.activeStateIndex].stateNode;r.initialize(e),this.duration=r.getDuration(),this.previousTime=r.getPreviousTime(),this.currentTime=r.getCurrentTime(),this.initializeTransitionConditions(e)},n.shutdownInternal=function(e){this.activeTransition!==null&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=fe,this.activeTransition=null,i.prototype.shutdownInternal.call(this,e)},n.initializeTransitionConditions=function(e){for(var r=M(this.states[this.activeStateIndex].transitions),a;!(a=r()).done;){var o=a.value;o.conditionNode!==null&&o.conditionNode.initialize(e)}},n.shutdownTransitionConditions=function(e){for(var r=M(this.states[this.activeStateIndex].transitions),a;!(a=r()).done;){var o=a.value;o.conditionNode!==null&&o.conditionNode.shutdown(e)}},s}(Gr),un;(function(i){i[i.None=0]="None",i[i.TransitioningIn=1]="TransitioningIn",i[i.TransitioningOut=2]="TransitioningOut"})(un||(un={}));var Ds=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.childNodeIndex=fe,t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(zh,e);r.childNode=e.getNode(this.childNodeIndex)},n.load=function(e){i.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex,this.stateName=e.stateName},s}(be);Ds=$([me(ae.StateNodeData)],Ds);var zh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.childNode=null,t.transitionState=0,t.elapsedTimeInState=0,t.isFirstStateUpdate=!1,t}var n=s.prototype;return n.isTransitioning=function(){return this.transitionState!==0},n.isTransitioningIn=function(){return this.transitionState===1},n.isTransitioningOut=function(){return this.transitionState===2},n.startTransitionIn=function(e){this.transitionState=1},n.startTransitionOut=function(e){this.transitionState=2},n.setTransitioningState=function(e){this.transitionState=e},n.getElapsedTimeInState=function(){return this.elapsedTimeInState},n.evaluate=function(e,r){return this.markNodeActive(e),this.childNode!==null&&this.childNode.isValid()&&(r=this.childNode.evaluate(e,r),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=e.deltaTime,this.isFirstStateUpdate=!1,r},n.initializeInternal=function(e){i.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,this.childNode!==null&&(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},n.shutdownInternal=function(e){this.childNode!==null&&this.childNode.shutdown(e),this.transitionState=0,i.prototype.shutdownInternal.call(this,e)},s}(Gr),zs;(function(i){i[i.State=0]="State",i[i.Transition=1]="Transition",i[i.CachedPose=2]="CachedPose"})(zs||(zs={}));var Bs=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.duration=0,t.hasExitTime=!1,t.exitTime=.75,t.targetStateNodeIndex=fe,t}var n=s.prototype;return n.instantiate=function(e){var r=this.createNode(Bh,e);r.targetNode=e.getNode(this.targetStateNodeIndex),r.hasExitTime=this.hasExitTime,r.exitTime=this.exitTime},n.load=function(e){i.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},s}(be);Bs=$([me(ae.TransitionNodeData)],Bs);var Bh=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.hasExitTime=!1,t.exitTime=.75,t.transitionLength=0,t.transitionProgress=0,t.blendWeight=0,t.sourceNode=null,t.sourceType=0,t.blendedDuration=0,t}var n=s.prototype;return n.evaluate=function(e,r){ne(this.sourceNode),this.markNodeActive(e),this.isSourceATransition()&&this.get
7SourceTransitionNode().isComplete(e)&&this.endSourceTransition(e),this.transitionProgress=this.transitionProgress+e.deltaTime/this.transitionLength,this.transitionProgress=he(this.transitionProgress,0,1),this.calculateBlendWeight();var a=this.sourceNodeResult,o=e.branchState;e.branchState=on.Inactive,a=this.sourceNode.evaluate(e,a),e.branchState=o;var u=this.targetNode.evaluate(e,this.targetNodeResult),l=r;if(this.registerPoseTasksAndUpdateRootMotion(a,u,l),this.blendedDuration=ts(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var h=e.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+h)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),l},n.isComplete=function(e){return this.transitionLength<=0?!0:this.transitionProgress+e.deltaTime/this.transitionLength>=1},n.getProgressPercentage=function(){return this.transitionProgress},n.getSourceType=function(){return this.sourceType},n.isSourceATransition=function(){return this.sourceType===1},n.isSourceAState=function(){return this.sourceType===0},n.startTransitionFromState=function(e,r,a,o){return this.sourceNode=a,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(e,r,o)},n.startTransitionFromTransition=function(e,r,a,o){return this.sourceNode=a,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(e,r,o)},n.getSourceStateNode=function(){return this.sourceNode},n.getSourceTransitionNode=function(){return this.sourceNode},n.notifyNewTransitionStarting=function(e,r){if(this.isSourceATransition()){var a=this.getSourceTransitionNode(),o=a.targetNode;o===r&&(this.sourceType=2,o.shutdown(e),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===r&&(this.sourceType=2,this.sourceNode.shutdown(e),this.sourceNode=null);if(this.isSourceATransition()){var u=this.getSourceTransitionNode();u.notifyNewTransitionStarting(e,r)}},n.initializeInternal=function(e){i.prototype.initializeInternal.call(this,e),this.sourceNodeResult=new Mr(e.skeleton),this.targetNodeResult=new Mr(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},n.shutdownInternal=function(e){this.targetNode.setTransitioningState(un.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(e),this.sourceNode.shutdown(e),this.sourceNode=null),i.prototype.shutdownInternal.call(this,e)},n.endSourceTransition=function(e){var r,a=this.getSourceTransitionNode(),o=a.targetNode;(r=this.sourceNode)==null||r.shutdown(e),this.sourceNode=o,this.sourceType=0,this.getSourceStateNode().setTransitioningState(un.TransitioningOut)},n.initializeTargetStateAndUpdateTransition=function(e,r,a){var o=this;this.markNodeActive(e);var u=this.targetNodeResult,l=function(){o.sourceType===0&&o.getSourceStateNode().startTransitionOut(e)};return l(),this.targetNode.initialize(e),this.targetNode.startTransitionIn(e),u=this.targetNode.evaluate(e,u),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(r,u,a),this.previousTime=0,this.currentTime=0,this.blendedDuration=ts(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),a},n.calculateBlendWeight=function(){this.transitionLength===0?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=he(this.blendWeight,0,1))},n.registerPoseTasksAndUpdateRootMotion=function(e,r,a){var o=this.blendWeight;oi.localBlend(e.pose,r.pose,o,a.pose)},s}(Gr),Us;(function(i){i[i.Float=0]="Float",i[i.Color=1]="Color"})(Us||(Us={}));var Uh="VFXItem",Gh=function(){function i(n,t){this.rootBone=n,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 e=M(t.position),r;!(r=e()).done;){var a=r.value;this.addReferenceTransform(a)}for(var o=M(t.rotation),u;!(u=o()).done;){var l=u.value;this.addReferenceTransform(l)}for(var h=M(t.scale),c;!(c=h()).done;){var f=c.value;this.addReferenceTransform(f)}for(var d=M(t.euler),v;!(v=d()).done;){var p=v.value;this.addReferenceTransform(p),this.useEuler=!0}for(var g=0;g<t.floats.length;g++){var x=t.floats[g];this.addRecordedProperty(x.path,x.className,x.property,0)}for(var b=0;b<t.colors.length;b++){var y=t.colors[b];this.addRecordedProperty(y.path,y.className,y.property,1)}}var s=i.prototype;return s.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new Uu(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},s.addRecordedProperty=function(t,e,r,a){var o=t+e+r;if(this.pathToObjectIndex.get(o)===void 0){var u=this.findTarget(t);if(u){var l;e===Uh?l=u:l=u.getComponent(Vu(e)),l||console.error("The "+e+" Component was not found.");for(var h=r.split("."),c=h[h.length-1],f=l,d=0;d<h.length-1;d++){var v=f[h[d]];v===void 0&&console.error("The "+h[d]+" property of "+f+" was not found."),f=v}var p={target:l,propertyPath:r,directTarget:f,propertyName:c};switch(a){case 0:this.floatAnimatedObjects.push(p),this.defaultFloatPropertyValues.push(f[c]),this.pathToObjectIndex.set(o,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(p),this.defaultColorPropertyValues.push(new Ct().copyFrom(f[c])),this.pathToObjectIndex.set(o,this.colorAnimatedObjects.length-1)}}}},s.findTarget=function(t){if(t==="")return this.rootBone;for(var e=t.split("/"),r=this.rootBone,a=M(e),o;!(o=a()).done;){var u=o.value,l=r.find(u);if(!l)return null;r=l}return r},i}(),Wh=function(){function i(n,t){this.graphAsset=n,this.nodes=[],this.activeEvents=[],this.context=new bh;for(var e={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},r=M(n.graphDataSet.resources),a;!(a=r()).done;){var o=a.value;if(o){for(var u=M(o.positionCurves),l;!(l=u()).done;){var h=l.value;e.position.push(h.path)}for(var c=M(o.rotationCurves),f;!(f=c()).done;){var d=f.value;e.rotation.push(d.path)}for(var v=M(o.scaleCurves),p;!(p=v()).done;){var g=p.value;e.scale.push(g.path)}for(var x=M(o.eulerCurves),b;!(b=x()).done;){var y=b.value;e.euler.push(y.path)}for(var E=M(o.floatCurves),_;!(_=E()).done;){var S=_.value;e.floats.push(S)}for(var C=M(o.colorCurves),I;!(I=C()).done;){var R=I.value;e.colors.push(R)}}}this.skeleton=new Gh(t,e),this.result=new Mr(this.skeleton),this.context.skeleton=this.skeleton,this.context.activeEvents=this.activeEvents;var O=new Th;O.nodes=this.nodes,O.nodeDatas=n.nodeDatas,O.dataSet=n.graphDataSet;for(var F=0;F<n.nodeDatas.length;F++)O.nodes[F]||n.nodeDatas[F].instantiate(O);this.rootNode=this.nodes[n.rootNodeIndex]}var s=i.prototype;return s.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;
7e<this.getNumControlParameters();e++){var r=this.nodes[e];Z(r,Gu)&&r.setValue(!1)}return this.result},s.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},s.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},s.getStateMachineNode=function(t){for(var e=null,r=M(this.nodes),a;!(a=r()).done;){var o=a.value;Z(o,Xu)&&o.getNodeData().machineName===t&&(e=o)}return e},s.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},s.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},s.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap,r=e.get(t);return r!==void 0?r:(console.warn("Parameter '"+t+"' does not exist."),fe)},s.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},s.setBool=function(t,e){this.setControlParameterValue(t,e)},s.setFloat=function(t,e){this.setControlParameterValue(t,e)},s.setTrigger=function(t){this.setControlParameterValue(t,!0)},s.resetTrigger=function(t){this.setControlParameterValue(t,!1)},s.getPoseNodeDebugInfo=function(t){var e=this.nodes[t];return e.getDebugInfo()},s.getRuntimeNodeDebugValue=function(t){var e=this.nodes[t];return e.getValue(this.context)},s.getNodeDebugInstance=function(t){return this.nodes[t]},s.isControlParameter=function(t){return t<this.getNumControlParameters()},s.setControlParameterValue=function(t,e){var r=this.getControlParameterIndex(t);r!==fe&&this.nodes[r].setValue(e)},i}();function Gs(i,s){for(var n=0;n<s.length;n++){var t=s[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(i,t.key,t)}}function Mt(i,s,n){return s&&Gs(i.prototype,s),n&&Gs(i,n),i}var ce=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.isAwakeCalled=!1,t.isStartCalled=!1,t.isEnableCalled=!1,t._enabled=!0,t}var n=s.prototype;return n.onAwake=function(){},n.onEnable=function(){},n.onDisable=function(){},n.onStart=function(){},n.onUpdate=function(e){},n.onLateUpdate=function(e){},n.onPreRender=function(){},n.onDestroy=function(){},n.onApplyAnimationProperties=function(){},n.onParentChanged=function(){},n.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},n.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},n.setVFXItem=function(e){this.item=e,e.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),e.isActive&&this.enabled&&(this.start(),this.enable()))},n.fromData=function(e){i.prototype.fromData.call(this,e)},n.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&Re(this.item.components,this),i.prototype.dispose.call(this)},n.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},Mt(s,[{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(e){this.enabled!==e&&(this._enabled=e,e?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),s}(xe);$([bt()],ce.prototype,"item",void 0);$([bt()],ce.prototype,"_enabled",void 0);var Ws=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.graphInstance=null,t.graphAsset=null,t}var n=s.prototype;return n.setBool=function(e,r){this.graphInstance&&this.graphInstance.setBool(e,r)},n.setFloat=function(e,r){this.graphInstance&&this.graphInstance.setFloat(e,r)},n.setTrigger=function(e){this.graphInstance&&this.graphInstance.setTrigger(e)},n.resetTrigger=function(e){this.graphInstance&&this.graphInstance.resetTrigger(e)},n.getStateMachineNode=function(e){var r=null;return this.graphInstance&&(r=this.graphInstance.getStateMachineNode(e)),r},n.onStart=function(){this.graphAsset&&(this.graphInstance=new Wh(this.graphAsset,this.item))},n.onUpdate=function(e){if(this.graphInstance){for(var r=this.graphInstance.evaluateGraph(e/1e3),a=this.graphInstance.skeleton.animatedTransforms,o=0;o<a.length;o++){var u=r.pose.parentSpaceTransforms[o].position,l=r.pose.parentSpaceTransforms[o].rotation,h=r.pose.parentSpaceTransforms[o].scale,c=r.pose.parentSpaceTransforms[o].euler;a[o].setPosition(u.x,u.y,u.z),a[o].setScale(h.x,h.y,h.z),this.graphInstance.skeleton.useEuler?a[o].setRotation(c.x,c.y,c.z):a[o].setQuaternion(l.x,l.y,l.z,l.w)}for(var f=this.graphInstance.skeleton.floatAnimatedObjects,d=0;d<f.length;d++){var v=f[d],p=v.propertyName;v.directTarget[p]=r.pose.floatPropertyValues[d],Z(v.target,ce)&&v.target.onApplyAnimationProperties()}for(var g=this.graphInstance.skeleton.colorAnimatedObjects,x=0;x<g.length;x++){var b=g[x],y=b.propertyName;b.directTarget[y]=r.pose.colorPropertyValues[x],Z(b.target,ce)&&b.target.onApplyAnimationProperties()}for(var E=M(this.graphInstance.activeEvents),_;!(_=E()).done;){var S=_.value,C=S.data,I=C.event;I.onEvent(this.item,S)}}},n.fromData=function(e){this.graphAsset=this.engine.findObject(e.graphAsset)},s}(ce);Ws=$([xt("Animator")],Ws);var Ai;(function(i){i[i.vertex=0]="vertex",i[i.fragment=1]="fragment"})(Ai||(Ai={}));var He;(function(i){i[i.NONE=0]="NONE",i[i.MASK=1]="MASK",i[i.OBSCURED=2]="OBSCURED",i[i.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"})(He||(He={}));function Hh(i,s,n){s===void 0&&(s="webgl");var t;if(s==="webgl2"&&(t=i.getContext("webgl2",n),t||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),(!t||s==="webgl")&&(t=i.getContext("webgl",n)),!t)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return t}var $r=[],P={}
7,Xh="iOS16 lockdown mode, WebGL Constants not in global",Hs="WebGL Constants not in global, please check your environment";$r.length||jh();function jh(){typeof WebGL2RenderingContext=="function"?Mn(WebGL2RenderingContext):typeof WebGLRenderingContext<"u"?(Mn(WebGLRenderingContext),Mn(WebGLRenderingContext.prototype)):Kl?$r.push(Mu()?Xh:Hs):$r.push(Hs),!$r.length&&!("HALF_FLOAT"in P)&&(P.HALF_FLOAT=5131)}function Xe(i){return typeof WebGL2RenderingContext<"u"&&i.constructor.name==="WebGL2RenderingContext"}function Mn(i){for(var s in i)/^[A-Z_]/.test(s)&&(P[s]=i[s])}function Bi(i){switch(i){case Fe.Float32:return WebGLRenderingContext.FLOAT;case Fe.Int16:return WebGLRenderingContext.SHORT;case Fe.Int8:return WebGLRenderingContext.BYTE;case Fe.UInt16:return WebGLRenderingContext.UNSIGNED_SHORT;case Fe.UInt8:return WebGLRenderingContext.UNSIGNED_BYTE;default:return WebGLRenderingContext.FLOAT}}function yn(i){switch(i){case Xt.ALPHA:return 1;case Xt.ADD:return 1;case Xt.SUBTRACTION:return 1;case Xt.STRONG_LIGHT:return 1;case Xt.WEAK_LIGHT:return 1;case Xt.SUPERPOSITION:return 2;case Xt.BRIGHTNESS:return 3;case Xt.MULTIPLY:return 0;default:return 1}}function xn(i,s){switch(s){case void 0:i.blendFunction=[P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA];break;case Xt.ALPHA:i.blendFunction=[P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA];break;case Xt.ADD:i.blendFunction=[P.ONE,P.ONE,P.ONE,P.ONE];break;case Xt.SUBTRACTION:i.blendFunction=[P.ONE,P.ONE,P.ZERO,P.ONE],i.blendEquation=[P.FUNC_REVERSE_SUBTRACT,P.FUNC_REVERSE_SUBTRACT];break;case Xt.SUPERPOSITION:i.blendFunction=[P.ONE,P.ONE,P.ONE,P.ONE];break;case Xt.MULTIPLY:i.blendFunction=[P.DST_COLOR,P.ONE_MINUS_SRC_ALPHA,P.DST_COLOR,P.ONE_MINUS_SRC_ALPHA];break;case Xt.BRIGHTNESS:i.blendFunction=[P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA];break;case Xt.STRONG_LIGHT:i.blendFunction=[P.DST_COLOR,P.DST_ALPHA,P.ZERO,P.ONE];break;case Xt.WEAK_LIGHT:i.blendFunction=[P.DST_COLOR,P.ZERO,P.ZERO,P.ONE];break;default:console.warn("BlendMode "+s+" not in specification, please set blend params separately.")}}function Ua(i,s){s===qe.DOUBLE?i.culling=!1:(i.culling=!0,i.frontFace=P.CW,i.cullFace=s===qe.BACK?P.BACK:P.FRONT)}var $t;(function(i){i[i.whatever=0]="whatever",i[i.clear=2]="clear"})($t||($t={}));var st;(function(i){i[i.none=0]="none",i[i.data=1]="data",i[i.image=2]="image",i[i.compressed=3]="compressed",i[i.video=4]="video",i[i.canvas=5]="canvas",i[i.framebuffer=6]="framebuffer",i[i.mipmaps=7]="mipmaps"})(st||(st={}));var Ga=function(){function i(){this.callbacks={}}var s=i.prototype;return s.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},s.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},s.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},s.downloadText=function(t,e,r){this.download(t,"text",e,r)},s.download=function(t,e,r,a){var o=this;if(e===void 0&&(e="json"),!this.start(t,r,a)){var u=new XMLHttpRequest,l=function(){o.finish(t,u.status,u.response)},h=function(){u.status==200||u.status==0&&i.trustXHRStatusZero?o.finish(t,200,u.response):l()};u.responseType=e,u.addEventListener("load",h),u.addEventListener("error",l),u.open("GET",t,!0),u.send()}},s.start=function(t,e,r){var a=this.callbacks[t];try{if(a)return!0;this.callbacks[t]=a=[]}finally{a.push(e,r)}},s.finish=function(t,e,r){var a=this.callbacks[t];delete this.callbacks[t];for(var o=e==200||e==0&&i.trustXHRStatusZero?[r]:[e,r],u=o.length-1,l=a.length;u<l;u+=2)a[u].apply(null,o)},i}();Ga.trustXHRStatusZero=!1;var Xs=!1,js=!1;function Yh(i,s){return Zn.apply(this,arguments)}function Zn(){return Zn=vt(function(i,s){var n,t,e;return pt(this,function(r){switch(r.label){case 0:return Xs||!s?[4,Se(i)]:[3,2];case 1:return n=r.sent(),[2,{image:n,url:i}];case 2:return r.trys.push([2,4,,6]),[4,Se(s)];case 3:return t=r.sent(),[2,{image:t,url:s}];case 4:return r.sent(),Xs=!0,[4,Se(i)];case 5:return e=r.sent(),[2,{image:e,url:i}];case 6:return[2]}})}),Zn.apply(this,arguments)}function Zh(i,s){return qn.apply(this,arguments)}function qn(){return qn=vt(function(i,s){var n,t,e;return pt(this,function(r){switch(r.label){case 0:return js||!s?[4,Se(i)]:[3,2];case 1:return n=r.sent(),[2,{image:n,url:i}];case 2:return r.trys.push([2,4,,6]),[4,Se(s)];case 3:return t=r.sent(),[2,{image:t,url:s}];case 4:return r.sent(),js=!0,[4,Se(i)];case 5:return e=r.sent(),[2,{image:e,url:i}];case 6:return[2]}})}),qn.apply(this,arguments)}function Se(i){return Qn.apply(this,arguments)}function Qn(){return Qn=vt(function(i){var s,n;return pt(this,function(t){if(s="",Z(i,HTMLImageElement)){if(i.complete)return[2,i];s=i.src}else Z(i,Blob)?(s=URL.createObjectURL(i),n=!0):typeof i=="string"&&(s=i);if(!s)throw new Error("Invalid url type: "+JSON.stringify(i)+".");return[2,new Promise(function(e,r){var a=new Image;/^data:/.test(s)||(a.crossOrigin="*"),a.onload=function(){return a.onload=null,n&&URL.revokeObjectURL(s),e(a)},a.onerror=function(o){return a.onerror=null,n&&URL.revokeObjectURL(s),r("Load image fail: "+s+", reason: "+JSON.stringify(o))},a.src=s})]})}),Qn.apply(this,arguments)}function Ys(i){return Kn.apply(this,arguments)}function Kn(){return Kn=vt(function(i){return pt(this,function(s){return[2,new Promise(function(n,t){new Ga().downloadBinary(i,n,function(e,r){t("Couldn't load bins "+i+": status "+e+", "+r)})})]})}),Kn.apply(this,arguments)}function Wa(i){return $n.apply(this,arguments)}function $n(){return $n=vt(function(i){var s;return pt(this,function(n){return s=document.createElement("video"),typeof i=="string"?s.src=i:s.srcObject=i,s.crossOrigin="anonymous",s.muted=!0,s.autoplay=!1,Iu()&&s.setAttribute("renderer","standard"),s.setAttribute("playsinline","playsinline"),[2,new Promise(function(t,e){var r=!1,a=function(){r||(r=!0,u(),t(s))},o=function(){r||(r=!0,u(),e("Load video fail."))},u=function(){s.removeEventListener("loadeddata",a),s.removeEventListener("canplay",a),s.removeEventListener("error",o)};s.addEventListener("loadeddata",a),s.addEventListener("canplay",a),s.addEventListener("error",o),s.play().catch(function(l){console.warn("Autoplay blocked:",l)})})]})}),$n.apply(this,arguments)}function qh(i,s){return Jn.apply(this,arguments)}function Jn(){return Jn=vt(function(i,s){return pt(this,function(n){switch(n.label){case 0:if(!Array.isArray(i))return[3,5];n.label=1;case 1:return n.trys.push([1,3,,5]),[4,s(i[0])];case 2:return[2,n.sent()];case 3:return n.sent(),[4,s(i[1])];case 4:return[2,n.sent()];case 5:return[2,s(i)]}})}),Jn.apply(this,arguments)}function Qh(i,s,n){return ta.apply(this,arguments)}function ta(){return ta=vt(function(i,s,n,t){var e,r,a,o,u,l,h,c,f;return pt(this,function(d){switch(d.label){case 0:return t===void 0&&(t=[]),i.target!==34067?[3,2]:(e=i.mipmaps,r=i.target,a=e.map(function(v){return Promise.all(v.map(function(p){if(p.id){var g=n[p.id];return g}else return Zs(p,s)}))}),[4,Promise.all(a)]);case 1:return o=d.sent(),[2,lt({keepImageSource:!1},i,{mipmaps:o,sourceFrom:{target:r,type:st.mipmaps}})];case 2:return u=i.mipmaps,l=i.target,h=u.map(function(v){return Zs(v,s)}),[4,Promise.all(h)];case 3:return c=d.sent(),f=t[u[0][1][0]].url,[2,lt({keepImageSource:!1},i,{mipmaps:c,sourceType:st.mipmaps,sourceFrom:{target:l,bin:f,type:st.mipmaps,mipmaps:u.map(function(v){return[v[1][1],v[1][2]]})}})];case 4:return[2]}})}),ta.apply(this,arguments)}function Zs(i,s){return ea.apply(this,arguments)}function ea(){return ea=vt(function(i,s){var n,t,e,r,a;
7return pt(this,function(o){if(n=i[1],t=n[0],e=n[1],r=n[2],a=s[t],!a)throw new Error("Invalid bin pointer: "+JSON.stringify(i)+".");return[2,Se(new Blob([new Uint8Array(a,e,r)]))]})}),ea.apply(this,arguments)}var Kh=1,Wt=function(i){k(s,i);function s(t){var e;return e=i.call(this,t)||this,e.destroyed=!1,e.id="Tex"+Kh++,e}var n=s.prototype;return n.getWidth=function(){return this.width||0},n.getHeight=function(){return this.height||0},n.uploadCurrentVideoFrame=function(){},n.offloadData=function(){},n.reloadData=function(){},n.initialize=function(){},n.assembleOptions=function(e){var r=e.target,a=r===void 0?P.TEXTURE_2D:r,o=e.format,u=o===void 0?P.RGBA:o;return e.sourceType||("image"in e?e.sourceType=st.image:"data"in e?e.sourceType=st.data:"video"in e?e.sourceType=st.video:e.sourceType=0),lt({minFilter:P.NEAREST,magFilter:P.NEAREST,wrapS:P.CLAMP_TO_EDGE,wrapT:P.CLAMP_TO_EDGE,target:a,format:P.RGBA,internalFormat:u,type:P.UNSIGNED_BYTE},e)},s.fromImage=function(e,r,a){return vt(function(){var o,u;return pt(this,function(l){switch(l.label){case 0:return[4,Se(e)];case 1:return o=l.sent(),u=s.create(r,lt({sourceType:st.image,image:o,target:P.TEXTURE_2D,id:Pt(),flipY:!0},a)),u.initialize(),[2,u]}})})()},s.fromVideo=function(e,r,a){return vt(function(){var o,u;return pt(this,function(l){switch(l.label){case 0:return[4,Wa(e)];case 1:return o=l.sent(),u=s.create(r,lt({sourceType:st.video,video:o,id:Pt(),flipY:!0},a)),u.initialize(),[2,u]}})})()},Mt(s,[{key:"isDestroyed",get:function(){return this.destroyed}}]),s}(xe);function ra(i,s,n,t){var e=s.length/n/t,r,a;return e===4||e===0?a=r=P.RGBA:e===3?a=r=P.RGB:e===2?a=r=P.LUMINANCE_ALPHA:a=r=P.LUMINANCE,Wt.createWithData(i,{data:s,width:n,height:t},{type:P.HALF_FLOAT,format:r,internalFormat:a,wrapS:P.CLAMP_TO_EDGE,wrapT:P.CLAMP_TO_EDGE})}var ju={type:P.UNSIGNED_BYTE,format:P.RGBA,internalFormat:P.RGBA,wrapS:P.MIRRORED_REPEAT,wrapT:P.MIRRORED_REPEAT,minFilter:P.NEAREST,magFilter:P.NEAREST};function $h(i){return Wt.create(i,lt({id:Nu.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:st.data},ju))}function Jh(i){return Wt.create(i,lt({id:Nu.EmptyTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:st.data},ju))}var tc=function(){function i(){this.loaders=new Map,this.instances=new Map}var s=i.prototype;return s.register=function(t,e){if(this.loaders.has(t)){console.warn('TextureLoader for type "'+t+'" is already registered, skipping.');return}this.loaders.set(t,e)},s.unregister=function(t){var e=this.instances.get(t);e&&(e.dispose(),this.instances.delete(t)),this.loaders.delete(t)},s.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 r=e();return this.instances.set(t,r),r},s.has=function(t){return this.loaders.has(t)},s.getRegisteredTypes=function(){return Array.from(this.loaders.keys())},s.dispose=function(){this.instances.forEach(function(t){return t.dispose()}),this.instances.clear(),this.loaders.clear()},i}(),Yu=new tc,ec=function(){function i(){this.reloadPending={}}var s=i.prototype;return s.reload=function(t){var e=this;return vt(function(){var r,a;return pt(this,function(o){switch(o.label){case 0:return r=t.id,e.reloadPending[r]?[2]:t.sourceFrom?(e.reloadPending[r]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return a=o.sent(),t.updateSource(a),e.reloadPending[r]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}})})()},s.canOffloadTexture=function(t){if(t){var e=t.type;if(e===st.compressed||e===st.image){var r=t.target,a=t.map,o=t.url;return r===P.TEXTURE_CUBE_MAP?typeof a=="object"&&!!a:vr(o)&&o.length>0}if(e===st.mipmaps){var u=t.bin,l=t.mipmaps,h=t.target,c=t.maps,f=t.urls;return u?l.length>0:h===P.TEXTURE_CUBE_MAP?c.every(function(d){return typeof d=="object"&&d}):f.every(function(d){return vr(d)&&d.length>0})}}return!1},s.loadSource=function(t,e){var r=this;return vt(function(){var a,o,u,l,h,c,f,d,v,p,g,x,b,y,E,_,S,C,I,R,O,F;return pt(this,function(L){switch(L.label){case 0:return a=t.type,o=t.target,u=t.map,l=t.url,h=t.bin,c=t.mipmaps,f=t.urls,d=t.maps,o===P.TEXTURE_CUBE_MAP&&a!==st.mipmaps?[4,r.loadCubeMap(u)]:[3,2];case 1:return v=L.sent(),[2,lt({},e,{cube:v,target:P.TEXTURE_CUBE_MAP,sourceType:st.image,sourceFrom:{type:st.image,map:lt({},u),target:P.TEXTURE_CUBE_MAP}})];case 2:return a!==st.image?[3,4]:[4,Se(l)];case 3:return p=L.sent(),[2,lt({},e,{image:p,sourceType:st.image,sourceFrom:{type:a,url:l,target:P.TEXTURE_2D}})];case 4:return a!==st.video?[3,6]:[4,Wa(l)];case 5:return g=L.sent(),[2,lt({},e,{video:g,sourceType:st.video})];case 6:return a!==st.compressed?[3,14]:[4,Ys(l)];case 7:if(x=L.sent(),b=Yu.getLoader("ktx2"),!b)return[3,12];L.label=8;case 8:return L.trys.push([8,10,,11]),[4,b.loadFromBuffer(x)];case 9:return y=L.sent(),y.sourceType===st.compressed?[2,lt({sourceType:y.sourceType,type:y.type,target:y.target,internalFormat:y.internalFormat,format:y.format,mipmaps:y.mipmaps,minFilter:P.LINEAR,magFilter:P.LINEAR,sourceFrom:t},e)]:[3,11];case 10:throw E=L.sent(),new Error("Failed to parse KTX2 from "+((_=t==null?void 0:t.url)!=null?_:"buffer")+": "+(E.message||E));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 a!==st.mipmaps?[3,23]:h?[4,Ys(h)]:[3,19];
7case 15:return S=L.sent(),C=o!=null?o:P.TEXTURE_2D,I=C===P.TEXTURE_2D?c.slice():c.map(function(V){return V.slice()}),o!==P.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(c.map(function(V){return r.loadMipmapImages(V,S)}))];case 16:return R=L.sent(),[3,18];case 17:R=r.loadMipmapImages(c,S),L.label=18;case 18:return[2,lt({},e,{mipmaps:R,target:C,sourceType:st.mipmaps,sourceFrom:{bin:h,mipmaps:I,target:C,type:st.mipmaps}})];case 19:return o===P.TEXTURE_2D||!o?[4,Promise.all(f.map(function(V){return Se(V)}))]:[3,21];case 20:return O=L.sent(),[2,lt({},e,{mipmaps:O,target:P.TEXTURE_2D,sourceType:st.mipmaps,sourceFrom:{type:a,urls:f.slice(),target:P.TEXTURE_2D}})];case 21:return o!==P.TEXTURE_CUBE_MAP?[3,23]:[4,Promise.all(d.map(function(V){return r.loadCubeMap(V)}))];case 22:return F=L.sent(),[2,lt({},e,{mipmaps:F,target:P.TEXTURE_CUBE_MAP,sourceType:st.mipmaps,sourceFrom:{type:a,maps:d.map(function(V){return lt({},V)}),target:P.TEXTURE_CUBE_MAP}})];case 23:throw new Error("Invalid resource type: "+a+".")}})})()},s.loadMipmapImages=function(t,e){return vt(function(){return pt(this,function(r){return[2,Promise.all(t.map(function(a){var o=new Blob([new Uint8Array(e,a[0],a[1])]);return Se(o)}))]})})()},s.loadCubeMap=function(t){return vt(function(){return pt(this,function(e){return[2,Promise.all(t.map(function(r){return Se(r)}))]})})()},i}(),In;function qs(){return In||(In=new ec),In}var Tt=function(){function i(n,t,e,r,a,o,u,l,h,c,f,d,v,p,g,x){n===void 0&&(n=1),t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),a===void 0&&(a=0),o===void 0&&(o=1),u===void 0&&(u=0),l===void 0&&(l=0),h===void 0&&(h=0),c===void 0&&(c=0),f===void 0&&(f=1),d===void 0&&(d=0),v===void 0&&(v=0),p===void 0&&(p=0),g===void 0&&(g=0),x===void 0&&(x=1),this.elements=[n,t,e,r,a,o,u,l,h,c,f,d,v,p,g,x]}var s=i.prototype;return s.set=function(t,e,r,a,o,u,l,h,c,f,d,v,p,g,x,b){var y=this.elements;return y[0]=t,y[1]=e,y[2]=r,y[3]=a,y[4]=o,y[5]=u,y[6]=l,y[7]=h,y[8]=c,y[9]=f,y[10]=d,y[11]=v,y[12]=p,y[13]=g,y[14]=x,y[15]=b,this},s.setFromRowMajorData=function(t,e,r,a,o,u,l,h,c,f,d,v,p,g,x,b){var y=this.elements;return y[0]=t,y[4]=e,y[8]=r,y[12]=a,y[1]=o,y[5]=u,y[9]=l,y[13]=h,y[2]=c,y[6]=f,y[10]=d,y[14]=v,y[3]=p,y[7]=g,y[11]=x,y[15]=b,this},s.setFromColumnVectors=function(t,e,r,a){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,a.x,a.y,a.z,a.w)},s.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},s.setFromArray=function(t,e){e===void 0&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[e+r];return this},s.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},s.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},s.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},s.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},s.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},s.setFromRotationAxis=function(t,e){var r=i.tempVec0;r.copyFrom(t).normalize();var a=Math.cos(e),o=Math.sin(e),u=1-a,l=r.x,h=r.y,c=r.z,f=u*l,d=u*h;return this.set(f*l+a,f*h+o*c,f*c-o*h,0,f*h-o*c,d*h+a,d*c+o*l,0,f*c+o*h,d*c-o*l,u*c*c+a,0,0,0,0,1)},s.setFromEuler=function(t){return t.toMatrix4(this),this},s.setFromQuaternion=function(t){return this.compose(D.ZERO,t,D.ONE)},s.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},s.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.z,0,0,0,0,1)},s.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},s.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},s.isIdentity=function(){var t=this.elements;return t[0]===1&&t[4]===0&&t[8]===0&&t[12]===0&&t[1]===0&&t[5]===1&&t[9]===0&&t[13]===0&&t[2]===0&&t[6]===0&&t[10]===1&&t[14]===0&&t[3]===0&&t[7]===0&&t[11]===0&&t[15]===1},s.clone=function(){var t=this.elements;return new i(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},s.copyFrom=function(t){return this.elements=[].concat(t.elements),this},s.getColumnVector=function(t,e){return e.set(this.elements[t*4],this.elements[t*4+1],this.elements[t*4+2],this.elements[t*4+3])},s.lookAt=function(t,e,r){var a=i.tempVec0,o=i.tempVec1,u=i.tempVec2;u.subtractVectors(t,e),u.normalize(),a.crossVectors(r,u),a.normalize(),o.crossVectors(u,a);var l=this.elements;return l[0]=a.x,l[1]=o.x,l[2]=u.x,l[3]=0,l[4]=a.y,l[5]=o.y,l[6]=u.y,l[7]=0,l[8]=a.z,l[9]=o.z,l[10]=u.z,l[11]=0,l[12]=-a.dot(t),l[13]=-o.dot(t),l[14]=-u.dot(t),l[15]=1,this},s.addScaledMatrix=function(t,e){for(var r=this.elements,a=t.elements,o=0;o<16;o++)r[o]+=a[o]*e;return this},s.multiply=function(t){if(typeof t=="number"){for(var e=0;e<16;e++)this.elements[e]*=t;return this}else return this.multiplyMatrices(this,t)},s.premultiply=function(t){return this.multiplyMatrices(t,this)},s.multiplyMatrices=function(t,e){var r=t.elements,a=e.elements,o=this.elements,u=r[0],l=r[4],h=r[8],c=r[12],f=r[1],d=r[5],v=r[9],p=r[13],g=r[2],x=r[6],b=r[10],y=r[14],E=r[3],_=r[7],S=r[11],C=r[15],I=a[0],R=a[4],O=a[8],F=a[12],L=a[1],V=a[5],U=a[9],W=a[13],G=a[2],B=a[6],X=a[10],H=a[14],Y=a[3],K=a[7],z=a[11],Q=a[15];return o[0]=u*I+l*L+h*G+c*Y,o[4]=u*R+l*V+h*B+c*K,o[8]=u*O+l*U+h*X+c*z,o[12]=u*F+l*W+h*H+c*Q,o[1]=f*I+d*L+v*G+p*Y,o[5]=f*R+d*V+v*B+p*K,o[9]=f*O+d*U+v*X+p*z,o[13]=f*F+d*W+v*H+p*Q,o[2]=g*I+x*L+b*G+y*Y,o[6]=g*R+x*V+b*B+y*K,o[10]=g*O+x*U+b*X+y*z,o[14]=g*F+x*W+b*H+y*Q,o[3]=E*I+_*L+S*G+C*Y,o[7]=E*R+_*V+S*B+C*K,o[11]=E*O+_*U+S*X+C*z,o[15]=E*F+_*W+S*H+C*Q,this},s.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},s.determinant=function(){var t=this.elements,e=t[0],r=t[4],a=t[8],o=t[12],u=t[1],l=t[5],h=t[9],c=t[13],f=t[2],d=t[6],v=t[10],p=t[14],g=t[3],x=t[7],b=t[11],y=t[15];return g*(+o*h*d-a*c*d-o*l*v+r*c*v+a*l*p-r*h*p)+x*(+e*h*p-e*c*v+o*u*v-a*u*p+a*c*f-o*h*f)+b*(+e*c*d-e*l*p-o*u*d+r*u*p+o*l*f-r*c*f)+y*(-a*l*f-e*h*d+e*l*v+a*u*d-r*u*v+r*h*f)},s.transpose=function(){var t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this},s.invert=function(){var t=this.elements,e=t[0],r=t[1],a=t[2],o=t[3],u=t[4],l=t[5],h=t[6],c=t[7],f=t[8],d=t[9],v=t[10],p=t[11],g=t[12],x=t[13],b=t[14],y=t[15],E=d*b*c-x*v*c+x*h*p-l*b*p-d*h*y+l*v*y,_=g*v*c-f*b*c-g*h*p+u*b*p+f*h*y-u*v*y,S=f*x*c-g*d*c+g*l*p-u*x*p-f*l*y+u*d*y,C=g*d*h-f*x*h-g*l*v+u*x*v+f*l*b-u*d*b,I=e*E+r*_+a*S+o*C;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var R=1/I;return t[0]=E*R,t[1]=(x*v*o-d*b*o-x*a*p+r*b*p+d*a*y-r*v*y)*R,t[2]=(l*b*o-x*h*o+x*a*c-r*b*c-l*a*y+r*h*y)*R,t[3]=(d*h*o-l*v*o-d*a*c+r*v*c+l*a*p-r*h*p)*R,t[4]=_*R,t[5]=(f*b*o-g*v*o+g*a*p-e*b*p-f*a*y+e*v*y)*R,t[6]=(g*h*o-u*b*o-g*a*c+e*b*c+u*a*y-e*h*y)*R,t[7]=(u*v*o-f*h*o+f*a*c-e*v*c-u*a*p+e*h*p)*R,t[8]=S*R,t[9]=(g*d*o-f*x*o-g*r*p+e*x*p+f*r*y-e*d*y)*R,t[10]=(u*x
7*o-g*l*o+g*r*c-e*x*c-u*r*y+e*l*y)*R,t[11]=(f*l*o-u*d*o-f*r*c+e*d*c+u*r*p-e*l*p)*R,t[12]=C*R,t[13]=(f*x*a-g*d*a+g*r*v-e*x*v-f*r*b+e*d*b)*R,t[14]=(g*l*a-u*x*a-g*r*h+e*x*h+u*r*b-e*l*b)*R,t[15]=(u*d*a-f*l*a+f*r*h-e*d*h-u*r*v+e*l*v)*R,this},s.extractBasis=function(t,e,r){var a=this.elements;return t.set(a[0],a[1],a[2]),e.set(a[4],a[5],a[6]),r.set(a[8],a[9],a[10]),this},s.compose=function(t,e,r,a){a===void 0&&(a=D.ZERO);var o=this.elements,u=e.x,l=e.y,h=e.z,c=e.w,f=-a.x,d=-a.y,v=-a.z,p=u+u,g=l+l,x=h+h,b=u*p,y=u*g,E=u*x,_=l*g,S=l*x,C=h*x,I=c*p,R=c*g,O=c*x,F=r.x,L=r.y,V=r.z;return o[0]=(1-(_+C))*F,o[1]=(y+O)*F,o[2]=(E-R)*F,o[3]=0,o[4]=(y-O)*L,o[5]=(1-(b+C))*L,o[6]=(S+I)*L,o[7]=0,o[8]=(E+R)*V,o[9]=(S-I)*V,o[10]=(1-(b+_))*V,o[11]=0,o[12]=f*o[0]+d*o[4]+v*o[8]-f+t.x,o[13]=f*o[1]+d*o[5]+v*o[9]-d+t.y,o[14]=f*o[2]+d*o[6]+v*o[10]-v+t.z,this},s.decompose=function(t,e,r){var a=i.tempVec0,o=this.elements,u=a.set(o[0],o[1],o[2]).length(),l=a.set(o[4],o[5],o[6]).length(),h=a.set(o[8],o[9],o[10]).length(),c=this.determinant();c<0&&(u=-u),t.x=o[12],t.y=o[13],t.z=o[14];var f=i.tempMat0;f.copyFrom(this);var d=1/u,v=1/l,p=1/h;return f.elements[0]*=d,f.elements[1]*=d,f.elements[2]*=d,f.elements[4]*=v,f.elements[5]*=v,f.elements[6]*=v,f.elements[8]*=p,f.elements[9]*=p,f.elements[10]*=p,e.setFromRotationMatrix(f),r.x=u,r.y=l,r.z=h,this},s.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},s.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]))},s.getTransform=function(){var t=new D,e=new Zt,r=new D;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},s.orthographic=function(t,e,r,a,o,u){var l=1/(e-t),h=1/(r-a),c=1/(u-o),f=-(e+t)*l,d=-(r+a)*h,v=-(u+o)*c;l*=2,h*=2,c*=-2;var p=this.elements;return p[0]=l,p[1]=0,p[2]=0,p[3]=0,p[4]=0,p[5]=h,p[6]=0,p[7]=0,p[8]=0,p[9]=0,p[10]=c,p[11]=0,p[12]=f,p[13]=d,p[14]=v,p[15]=1,this},s.perspective=function(t,e,r,a,o){var u=1/Math.tan(t*.5),l=1/(r-a),h=this.elements;return h[0]=o?u:u/e,h[1]=0,h[2]=0,h[3]=0,h[4]=0,h[5]=o?u*e:u,h[6]=0,h[7]=0,h[8]=0,h[9]=0,h[10]=(a+r)*l,h[11]=-1,h[12]=0,h[13]=0,h[14]=2*a*r*l,h[15]=0,(a===null||a===1/0)&&(h[10]=-1,h[14]=-2*r),this},s.projectPoint=function(t,e){var r=t.x,a=t.y,o=t.z,u=this.elements,l=e!=null?e:t;l.x=u[0]*r+u[4]*a+u[8]*o+u[12],l.y=u[1]*r+u[5]*a+u[9]*o+u[13],l.z=u[2]*r+u[6]*a+u[10]*o+u[14];var h=u[3]*r+u[7]*a+u[11]*o+u[15];return l.multiply(1/h)},s.transformPoint=function(t,e){var r=t.x,a=t.y,o=t.z,u=this.elements,l=e!=null?e:t;return l.x=u[0]*r+u[4]*a+u[8]*o+u[12],l.y=u[1]*r+u[5]*a+u[9]*o+u[13],l.z=u[2]*r+u[6]*a+u[10]*o+u[14],l},s.transformNormal=function(t,e){var r=t.x,a=t.y,o=t.z,u=this.elements,l=e!=null?e:t;return l.x=u[0]*r+u[4]*a+u[8]*o,l.y=u[1]*r+u[5]*a+u[9]*o,l.z=u[2]*r+u[6]*a+u[10]*o,l.normalize()},s.transformVector4=function(t,e){var r=t.x,a=t.y,o=t.z,u=t.w,l=this.elements,h=e!=null?e:t;return h.x=l[0]*r+l[4]*a+l[8]*o+l[12]*u,h.y=l[1]*r+l[5]*a+l[9]*o+l[13]*u,h.z=l[2]*r+l[6]*a+l[10]*o+l[14]*u,h.w=l[3]*r+l[7]*a+l[11]*o+l[15]*u,h},s.equals=function(t){for(var e=this.elements,r=t.elements,a=0;a<16;a++)if(!Cu(e[a],r[a]))return!1;return!0},s.toArray=function(){return[].concat(this.elements)},s.fill=function(t,e){e===void 0&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15]},i.fromIdentity=function(){return new i(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},i.fromLookAt=function(t,e,r){return new i().lookAt(t,e,r)},i.fromPerspective=function(t,e,r,a,o){return new i().perspective(t,e,r,a,o)},i.fromColumnVectors=function(t,e,r,a){return new i().setFromColumnVectors(t,e,r,a)},i.fromMatrix3=function(t){return new i().setFromMatrix3(t)},i.fromArray=function(t,e){return e===void 0&&(e=0),new i().setFromArray(t,e)},i.fromScale=function(t,e,r){return new i().setFromScale(t,e,r)},i.fromTranslation=function(t,e,r){return new i().setFromTranslation(t,e,r)},i.fromRotationX=function(t){return new i().setFromRotationX(t)},i.fromRotationY=function(t){return new i().setFromRotationY(t)},i.fromRotationZ=function(t){return new i().setFromRotationZ(t)},i.fromRotationAxis=function(t,e){return new i().setFromRotationAxis(t,e)},i.fromEuler=function(t){return new i().setFromEuler(t)},i.fromQuaternion=function(t){return new i().setFromQuaternion(t)},i.fromShear=function(t,e,r){return new i().setFromShear(t,e,r)},i.fromBasis=function(t,e,r){return new i().setFromBasis(t,e,r)},i.fromRowMajorData=function(t,e,r,a,o,u,l,h,c,f,d,v,p,g,x,b){return new i(t,o,c,p,e,u,f,g,r,l,d,x,a,h,v,b)},i}();Tt.IDENTITY=new Tt(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);Tt.ZERO=new Tt(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);Tt.tempVec0=new D;Tt.tempVec1=new D;Tt.tempVec2=new D;Tt.tempMat0=new Tt;var Qt;(function(i){i[i.XYZ=0]="XYZ",i[i.XZY=1]="XZY",i[i.YXZ=2]="YXZ",i[i.YZX=3]="YZX",i[i.ZXY=4]="ZXY",i[i.ZYX=5]="ZYX"})(Qt||(Qt={}));var Me=function(){function i(n,t,e,r){n===void 0&&(n=0),t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=i.DEFAULT_ORDER),this.x=n,this.y=t,this.z=e,this.order=r}var s=i.prototype;return s.set=function(t,e,r,a){return a===void 0&&(a=this.order),this.x=t,this.y=e,this.z=r,this.order=a,this},s.setZero=function(t){return t===void 0&&(t=this.order),this.set(0,0,0,t)},s.setFromRotationMatrix4=function(t,e){e===void 0&&(e=this.order);var r=t.elements,a=r[0],o=r[4],u=r[8],l=r[1],h=r[5],c=r[9],f=r[2],d=r[6],v=r[10];switch(e){case Qt.XYZ:this.y=Math.asin(he(u,-1,1)),Math.abs(u)<.9999999?(this.x=Math.atan2(-c,v),this.z=Math.atan2(-o,a)):(this.x=Math.atan2(d,h),this.z=0);break;case Qt.YXZ:this.x=Math.asin(-he(c,-1,1)),Math.abs(c)<.9999999?(this.y=Math.atan2(u,v),this.z=Math.atan2(l,h)):(this.y=Math.atan2(-f,a),this.z=0);break;case Qt.ZXY:this.x=Math.asin(he(d,-1,1)),Math.abs(d)<.9999999?(this.y=Math.atan2(-f,v),this.z=Math.atan2(-o,h)):(this.y=0,this.z=Math.atan2(l,a));break;case Qt.ZYX:this.y=Math.asin(-he(f,-1,1)),Math.abs(f)<.9999999?(this.x=Math.atan2(d,v),this.z=Math.atan2(l,a)):(this.x=0,this.z=Math.atan2(-o,h));break;case Qt.YZX:this.z=Math.asin(he(l,-1,1)),Math.abs(l)<.9999999?(this.x=Math.atan2(-c,h),this.y=Math.atan2(-f,a)):(this.x=0,this.y=Math.atan2(u,v));break;case Qt.XZY:this.z=Math.asin(-he(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(d,h),this.y=Math.atan2(u,a)):(this.x=Math.atan2(-c,v),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=Cn,this.y*=Cn,this.z*=Cn,this.order=e,this},s.setFromQuaternion=function(t,e){e===void 0&&(e=this.order);var r=i.tempMat0;return r.setFromQuaternion(t),this.setFromRotationMatrix4(r,e)},s.setFromVector3=function(t,e){return e===void 0&&(e=this.order),this.set(t.x,t.y,t.z,e)},s.setFromArray=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.order);var a;this.x=(a=t[e])!=null?a:0;var o;this.y=(o=t[e+1])!=null?o:0;var u;this.z=(u=t[e+2])!=null?u:0;var l;return this.order=(l=t[e+3])!=null?l:r,this},s.clone=function(){return new i(this.x,this.y,this.z,this.order)},s.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},s.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)},s.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)},s.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},s.reorder=function(t){var e=new Zt;return e.setFromEuler(this),this.setFromQuaternion(e,t)},s.rotateVector3=function(t,e){var r=i.tempQuat0;return r.setFromEuler(this).rotateVector3(t,e)},s.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},s.toVector3=function(t){return t.set(this.x,this.y,this.z)},s.toArray=function(){return[this.x,this.y,this.z]}
7,s.toQuaternion=function(t){var e=this,r=e.x,a=e.y,o=e.z,u=e.order,l=Math.cos(r*ee*.5),h=Math.cos(a*ee*.5),c=Math.cos(o*ee*.5),f=Math.sin(r*ee*.5),d=Math.sin(a*ee*.5),v=Math.sin(o*ee*.5);switch(u){case Qt.XYZ:t.set(f*h*c+l*d*v,l*d*c-f*h*v,l*h*v+f*d*c,l*h*c-f*d*v);break;case Qt.YXZ:t.set(f*h*c+l*d*v,l*d*c-f*h*v,l*h*v-f*d*c,l*h*c+f*d*v);break;case Qt.ZXY:t.set(f*h*c-l*d*v,l*d*c+f*h*v,l*h*v+f*d*c,l*h*c-f*d*v);break;case Qt.ZYX:t.set(f*h*c-l*d*v,l*d*c+f*h*v,l*h*v-f*d*c,l*h*c+f*d*v);break;case Qt.YZX:t.set(f*h*c+l*d*v,l*d*c+f*h*v,l*h*v-f*d*c,l*h*c-f*d*v);break;case Qt.XZY:t.set(f*h*c-l*d*v,l*d*c-f*h*v,l*h*v+f*d*c,l*h*c+f*d*v);break;default:console.error("unknown euler order: "+u)}return t},s.toMatrix4=function(t){var e=t.elements,r=this,a=r.x,o=r.y,u=r.z,l=r.order,h=Math.cos(a*ee),c=Math.sin(a*ee),f=Math.cos(o*ee),d=Math.sin(o*ee),v=Math.cos(u*ee),p=Math.sin(u*ee);if(l===Qt.XYZ){var g=h*v,x=h*p,b=c*v,y=c*p;e[0]=f*v,e[4]=-f*p,e[8]=d,e[1]=x+b*d,e[5]=g-y*d,e[9]=-c*f,e[2]=y-g*d,e[6]=b+x*d,e[10]=h*f}else if(l===Qt.YXZ){var E=f*v,_=f*p,S=d*v,C=d*p;e[0]=E+C*c,e[4]=S*c-_,e[8]=h*d,e[1]=h*p,e[5]=h*v,e[9]=-c,e[2]=_*c-S,e[6]=C+E*c,e[10]=h*f}else if(l===Qt.ZXY){var I=f*v,R=f*p,O=d*v,F=d*p;e[0]=I-F*c,e[4]=-h*p,e[8]=O+R*c,e[1]=R+O*c,e[5]=h*v,e[9]=F-I*c,e[2]=-h*d,e[6]=c,e[10]=h*f}else if(l===Qt.ZYX){var L=h*v,V=h*p,U=c*v,W=c*p;e[0]=f*v,e[4]=U*d-V,e[8]=L*d+W,e[1]=f*p,e[5]=W*d+L,e[9]=V*d-U,e[2]=-d,e[6]=c*f,e[10]=h*f}else if(l===Qt.YZX){var G=h*f,B=h*d,X=c*f,H=c*d;e[0]=f*v,e[4]=H-G*p,e[8]=X*p+B,e[1]=p,e[5]=h*v,e[9]=-c*v,e[2]=-d*v,e[6]=B*p+X,e[10]=G-H*p}else if(l===Qt.XZY){var Y=h*f,K=h*d,z=c*f,Q=c*d;e[0]=f*v,e[4]=-p,e[8]=d*v,e[1]=Y*p+Q,e[5]=h*v,e[9]=K*p-z,e[2]=z*p-K,e[6]=c*v,e[10]=Q*p+Y}else console.error("toMatrix4: Invalid order "+l);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},i.fromRotationMatrix4=function(t,e){return e===void 0&&(e=i.DEFAULT_ORDER),new i().setFromRotationMatrix4(t,e)},i.fromQuaternion=function(t,e){return e===void 0&&(e=i.DEFAULT_ORDER),new i().setFromQuaternion(t,e)},i.fromVector3=function(t,e){return e===void 0&&(e=i.DEFAULT_ORDER),new i().setFromVector3(t,e)},i.fromArray=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=i.DEFAULT_ORDER),new i().setFromArray(t,e,r)},i}();Me.DEFAULT_ORDER=Qt.ZYX;Me.tempQuat0=new Zt;Me.tempMat0=new Tt;var ia=function(){function i(n,t,e,r,a,o,u,l,h){n===void 0&&(n=1),t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),a===void 0&&(a=1),o===void 0&&(o=0),u===void 0&&(u=0),l===void 0&&(l=0),h===void 0&&(h=1),this.elements=[n,t,e,r,a,o,u,l,h]}var s=i.prototype;return s.set=function(t,e,r,a,o,u,l,h,c){var f=this.elements;return f[0]=t,f[3]=a,f[6]=l,f[1]=e,f[4]=o,f[7]=h,f[2]=r,f[5]=u,f[8]=c,this},s.setFromRowMajorData=function(t,e,r,a,o,u,l,h,c){var f=this.elements;return f[0]=t,f[3]=e,f[6]=r,f[1]=a,f[4]=o,f[7]=u,f[2]=l,f[5]=h,f[8]=c,this},s.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.z)},s.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])},s.setFromArray=function(t,e){e===void 0&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[e+r];return this},s.setFromQuaternion=function(t){var e=t.x,r=t.y,a=t.z,o=t.w,u=e+e,l=r+r,h=a+a,c=e*u,f=e*l,d=e*h,v=r*l,p=r*h,g=a*h,x=o*u,b=o*l,y=o*h,E=this.elements;return E[0]=1-(v+g),E[1]=f+y,E[2]=d-b,E[3]=f-y,E[4]=1-(c+g),E[5]=p+x,E[6]=d+b,E[7]=p-x,E[8]=1-(c+v),this},s.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},s.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},s.clone=function(){var t=this.elements;return new i(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},s.copyFrom=function(t){return this.elements=[].concat(t.elements),this},s.getColumnVector=function(t,e){return e.set(this.elements[t*3],this.elements[t*3+1],this.elements[t*3+2])},s.scale=function(t,e){var r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},s.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),a=this.elements,o=a[0],u=a[3],l=a[6],h=a[1],c=a[4],f=a[7];return a[0]=e*o+r*h,a[3]=e*u+r*c,a[6]=e*l+r*f,a[1]=-r*o+e*h,a[4]=-r*u+e*c,a[7]=-r*l+e*f,this},s.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[8],this},s.multiply=function(t){if(typeof t=="number"){for(var e=0;e<9;e++)this.elements[e]*=t;return this}else return this.multiplyMatrices(this,t)},s.premultiply=function(t){return this.multiplyMatrices(t,this)},s.multiplyMatrices=function(t,e){var r=t.elements,a=e.elements,o=this.elements,u=r[0],l=r[3],h=r[6],c=r[1],f=r[4],d=r[7],v=r[2],p=r[5],g=r[8],x=a[0],b=a[3],y=a[6],E=a[1],_=a[4],S=a[7],C=a[2],I=a[5],R=a[8];return o[0]=u*x+l*E+h*C,o[3]=u*b+l*_+h*I,o[6]=u*y+l*S+h*R,o[1]=c*x+f*E+d*C,o[4]=c*b+f*_+d*I,o[7]=c*y+f*S+d*R,o[2]=v*x+p*E+g*C,o[5]=v*b+p*_+g*I,o[8]=v*y+p*S+g*R,this},s.determinant=function(){var t=this.elements,e=t[0],r=t[3],a=t[6],o=t[1],u=t[4],l=t[7],h=t[2],c=t[5],f=t[8];return e*(u*f-c*l)+o*(c*a-r*f)+h*(r*l-u*a)},s.invert=function(){var t=this.elements,e=t[0],r=t[3],a=t[6],o=t[1],u=t[4],l=t[7],h=t[2],c=t[5],f=t[8],d=f*u-c*l,v=c*a-f*r,p=l*r-u*a,g=e*d+o*v+h*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);var x=1/g;return t[0]=d*x,t[1]=(h*l-f*o)*x,t[2]=(c*o-h*u)*x,t[3]=v*x,t[4]=(f*e-h*a)*x,t[5]=(h*r-c*e)*x,t[6]=p*x,t[7]=(o*a-l*e)*x,t[8]=(u*e-
7o*r)*x,this},s.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},s.transformPoint=function(t,e){var r=t.x,a=t.y,o=t.z,u=this.elements,l=e!=null?e:t;return l.x=u[0]*r+u[3]*a+u[6]*o,l.y=u[1]*r+u[4]*a+u[7]*o,l.z=u[2]*r+u[5]*a+u[8]*o,l},s.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},s.equals=function(t){for(var e=this.elements,r=t.elements,a=0;a<9;a++)if(!Cu(e[a],r[a]))return!1;return!0},s.toArray=function(){return[].concat(this.elements)},s.fill=function(t,e){e===void 0&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},i.fromIdentity=function(){return new i(1,0,0,0,1,0,0,0,1)},i.fromColumnVectors=function(t,e,r){return new i().setFromColumnVectors(t,e,r)},i.fromMatrix4=function(t){return new i().setFromMatrix4(t)},i.fromArray=function(t,e){return e===void 0&&(e=0),new i().setFromArray(t,e)},i.fromQuaternion=function(t){return new i().setFromQuaternion(t)},i.fromRowMajorData=function(t,e,r,a,o,u,l,h,c){return new i(t,a,l,e,o,h,r,u,c)},i}(),Ni=function(){function i(n,t){n===void 0&&(n=D.ZERO),t===void 0&&(t=D.X),this.origin=new D,this.direction=new D,this.origin.copyFrom(n),this.direction.copyFrom(t).normalize()}var s=i.prototype;return s.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},s.clone=function(){return new i(this.origin,this.direction)},s.copyFrom=function(t){return this.set(t.origin,t.direction)},s.recast=function(t){return this.origin.copyFrom(this.at(t,i.tempVec0)),this},s.at=function(t,e){var r=e||new D;return r.copyFrom(this.origin),r.addScaledVector(this.direction,t)},s.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},s.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},s.intersectBox=function(t,e){var r=this.origin,a=r.x,o=r.y,u=r.z,l=this.direction,h=l.x,c=l.y,f=l.z,d=t.min,v=d.x,p=d.y,g=d.z,x=t.max,b=x.x,y=x.y,E=x.z,_,S,C,I,R,O,F=1/h,L=1/c,V=1/f;if(F>=0?(_=(v-a)*F,S=(b-a)*F):(_=(b-a)*F,S=(v-a)*F),L>=0?(C=(p-o)*L,I=(y-o)*L):(C=(y-o)*L,I=(p-o)*L),!(_>I||C>S)&&((C>_||_!==_)&&(_=C),(I<S||S!==S)&&(S=I),(C>_||_!==_)&&(_=C),(I<S||S!==S)&&(S=I),V>=0?(R=(g-u)*V,O=(E-u)*V):(R=(E-u)*V,O=(g-u)*V),!(_>O||R>S)&&((R>_||_!==_)&&(_=R),(O<S||S!==S)&&(S=O),!(S<0))))return _>=0?this.at(_,e):this.at(S,e)},s.intersectPlane=function(t,e){var r=t.normal,a=t.distance,o=r.dot(this.direction);if(o===0){var u=r.dot(this.origin)+a;if(u===0){var l=e||new D;return l.copyFrom(this.origin)}return}var h=-(this.origin.dot(r)+a)/o;return h>=0?this.at(h,e):void 0},s.intersectSphere=function(t,e){var r=t.center,a=i.tempVec0.subtractVectors(r,this.origin),o=a.dot(this.direction),u=a.dot(a)-o*o,l=t.radius*t.radius;if(!(u>l)){var h=Math.sqrt(l-u),c=o-h,f=o+h;if(!(f<0))return c>=0?this.at(c,e):this.at(f,e)}},s.intersectTriangle=function(t,e,r){var a=t.p0,o=t.p1,u=t.p2,l=i.tempVec0.subtractVectors(o,a),h=i.tempVec1.subtractVectors(u,a),c=i.tempVec2.subtractVectors(this.origin,a),f=i.tempVec3.crossVectors(l,h),d=this.direction.dot(f),v;if(d>0){if(r)return;v=1}else if(d<0)v=-1,d=-d;else return;h.crossVectors(c,h);var p=v*this.direction.dot(h);if(!(p<0)){l.cross(c);var g=v*this.direction.dot(l);if(!(g<0)&&!(p+g>d)){var x=-v*c.dot(f);if(!(x<0))return this.at(x/d,e)}}},i}();Ni.tempVec0=new D;Ni.tempVec1=new D;Ni.tempVec2=new D;Ni.tempVec3=new D;var Je;(function(i){i[i.noShader=0]="noShader",i[i.success=1]="success",i[i.fail=2]="fail",i[i.compiling=3]="compiling"})(Je||(Je={}));var Ve;(function(i){i.GLSL1="100",i.GLSL3="300 es"})(Ve||(Ve={}));var rc=function(i){k(s,i);function s(t,e){var r;return r=i.call(this,t)||this,r.source=e,r}var n=s.prototype;return n.initialize=function(){},s}(xe),na=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createVariant=function(e){var r=[];if(e)for(var a=M(Object.keys(e)),o;!(o=a()).done;){var u=o.value;r.push([u,e[u]])}var l=this.engine.getShaderLibrary().createShader(this.shaderData,r);return l.shader=this,l},n.fromData=function(e){i.prototype.fromData.call(this,e),this.shaderData=e},s}(xe);na=$([xt(tt.Shader)],na);var Qs=function(){function i(){this.reset()}var s=i.prototype;return s.setBlendColor=function(t){var e=t[0],r=t[1],a=t[2],o=t[3];this.blendColor[0]===e&&this.blendColor[1]===r&&this.blendColor[2]===a&&this.blendColor[3]===o||(this.blendColor[0]=e,this.blendColor[1]=r,this.blendColor[2]=a,this.blendColor[3]=o)},s.setBlending=function(t){this.blending!==t&&(this.blending=t)},s.setBlendFunctionParameters=function(t){var e=t[0],r=t[1],a=t[2],o=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===r&&this.blendFunctionParameters[2]===a&&this.blendFunctionParameters[3]===o||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=r,this.blendFunctionParameters[2]=a,this.blendFunctionParameters[3]=o)},s.setBlendEquationParameters=function(t){var e=t[0],r=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===r||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=r)},s.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},s.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},s.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},s.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},s.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},s.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},s.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},s.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},s.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},s.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},s.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},s.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},s.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},s.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},s.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},s.setCulling=function(t){this.culling!==t&&(this.culling=t)},s.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},s.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},s.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[P.ONE,P.ONE_MINUS_SRC_ALPHA,P.ONE,P.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[P.FUNC_ADD,P.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=P.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=[P.ALWAYS,P.ALWAYS],this.stencilOpFail=[P.KEEP,P.KEEP],this.stencilOpZFail=[P.KEEP,P.KEEP],this.stencilOpZPass=[P.KEEP,P.KEEP],this.culling=!1,this.frontFace=P.CCW,this.cullFace=P.FRONT},s.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(P.BACK,this.stencilMask[1]),t.stencilMaskSeparate(P.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(P.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(P.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(P.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(P.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,r=e.blendColor,a=e.blendEquationParameters,o=e.blendFunctionParameters;
7t.blendColor(r[0],r[1],r[2],r[3]),t.blendEquationSeparate(a[0],a[1]),t.blendFuncSeparate(o[0],o[1],o[2],o[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])},i}(),Ks;(function(i){i[i.normal=0]="normal",i[i.transformFeedback=1]="transformFeedback"})(Ks||(Ks={}));var $s=1,Ce=function(i){k(s,i);function s(t,e){var r;if(r=i.call(this,t)||this,r.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 Qs,e){var a=e.name,o=a===void 0?"Material"+$s++:a,u=e.renderType,l=u===void 0?0:u,h=e.shader;r.name=o,r.renderType=l,r.shaderSource=h,r.props=e,r._shader=new na(t),r._shader.shaderData=lt({},e.shader,{id:Pt(),dataType:tt.Shader})}else r.name="Material"+$s++,r.renderType=0;return r}var n=s.prototype;return n.enableMacro=function(e,r){(!this.isMacroEnabled(e)||this.enabledMacros[e]!==r)&&(this.enabledMacros[e]=r!=null?r:!0,this.macrosDirty=!0)},n.disableMacro=function(e){this.isMacroEnabled(e)&&(delete this.enabledMacros[e],this.macrosDirty=!0)},n.isMacroEnabled=function(e){return this.enabledMacros[e]!==void 0},n.initialize=function(){var e=this,r=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),!this.initialized&&(r.addMaterial(this),Object.keys(this.textures).forEach(function(a){var o=e.textures[a];if(!za(o.initialize)){Nt.error("Failed to initialize texture: "+JSON.stringify(o)+". Ensure the texture conforms to the expected format.");return}o.initialize()}),this.initialized=!0)},n.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this._shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},n.setupStates=function(e){this.materialState.apply(e)},n.use=function(e,r){var a=e.engine,o=this.shaderVariant;o.bind(),this.setupStates(a);var u;if(r){for(var l=M(r.uniforms),h;!(h=l()).done;)u=h.value,this.checkUniform(u);for(var c=M(r.samplers),f;!(f=c()).done;)u=f.value,this.samplers.includes(u)||(this.samplers.push(u),this.uniformDirty=!0)}if(this.uniformDirty&&(o.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),r){for(u in r.floats)o.setFloat(u,r.floats[u]);for(u in r.ints)o.setInt(u,r.ints[u]);for(u in r.vector4s)o.setVector4(u,r.vector4s[u]);for(u in r.vector3s)o.setVector3(u,r.vector3s[u]);for(u in r.matrices)o.setMatrix(u,r.matrices[u])}for(u in this.textures)this.textures[u].initialize();for(u in this.floats)o.setFloat(u,this.floats[u]);for(u in this.ints)o.setInt(u,this.ints[u]);for(u in this.floatArrays)o.setFloats(u,this.floatArrays[u]);for(u in this.textures)o.setTexture(u,this.textures[u]);for(u in this.vector2s)o.setVector2(u,this.vector2s[u]);for(u in this.vector3s)o.setVector3(u,this.vector3s[u]);for(u in this.vector4s)o.setVector4(u,this.vector4s[u]);for(u in this.colors)o.setColor(u,this.colors[u]);for(u in this.quaternions)o.setQuaternion(u,this.quaternions[u]);for(u in this.matrices)o.setMatrix(u,this.matrices[u]);for(u in this.matrice3s)o.setMatrix3(u,this.matrice3s[u]);for(u in this.vector4Arrays)o.setVector4Array(u,this.vector4Arrays[u]);for(u in this.matrixArrays)o.setMatrixArray(u,this.matrixArrays[u])},n.getFloat=function(e){return this.floats[e]},n.setFloat=function(e,r){this.checkUniform(e),this.floats[e]=r},n.getInt=function(e){return this.ints[e]},n.setInt=function(e,r){this.checkUniform(e),this.ints[e]=r},n.getFloats=function(e){return this.floatArrays[e]},n.setFloats=function(e,r){this.checkUniform(e),this.floatArrays[e]=r},n.getVector2=function(e){return this.vector2s[e]},n.setVector2=function(e,r){this.checkUniform(e),this.vector2s[e]=r},n.getVector3=function(e){return this.vector3s[e]},n.setVector3=function(e,r){this.checkUniform(e),this.vector3s[e]=r},n.getVector4=function(e){return this.vector4s[e]},n.setVector4=function(e,r){this.checkUniform(e),this.vector4s[e]=r},n.getColor=function(e){return this.colors[e]},n.setColor=function(e,r){this.checkUniform(e),this.colors[e]=r},n.getQuaternion=function(e){return this.quaternions[e]},n.setQuaternion=function(e,r){this.checkUniform(e),this.quaternions[e]=r},n.getMatrix=function(e){return this.matrices[e]},n.setMatrix=function(e,r){this.checkUniform(e),this.matrices[e]=r},n.setMatrix3=function(e,r){this.checkUniform(e),this.matrice3s[e]=r},n.getVector4Array=function(e){return this.vector4Arrays[e]},n.setVector4Array=function(e,r){this.checkUniform(e),this.vector4Arrays[e]=[];for(var a=M(r),o;!(o=a()).done;){var u=o.value;this.vector4Arrays[e].push(u.x,u.y,u.z,u.w)}},n.getMatrixArray=function(e){return this.matrixArrays[e]},n.setMatrixArray=function(e,r){this.checkUniform(e),this.matrixArrays[e]=[];for(var a=M(r),o;!(o=a()).done;)for(var u=o.value,l=0;l<16;l++)this.matrixArrays[e].push(u.elements[l])},n.setMatrixNumberArray=function(e,r){this.checkUniform(e),this.matrixArrays[e]=r},n.getTexture=function(e){return this.textures[e]},n.setTexture=function(e,r){this.samplers.includes(e)||(this.samplers.push(e),this.uniformDirty=!0),this.textures[e]=r},n.hasUniform=function(e){return this.uniforms.includes(e)||this.samplers.includes(e)},n.clone=function(e){var r=e||this.props,a=this.engine;ne(a);var o=s.create(a,r);return o.materialState=Object.assign(new Qs,o.materialState),o.floats=this.floats,o.ints=this.ints,o.vector2s=this.vector2s,o.vector3s=this.vector3s,o.vector4s=this.vector4s,o.colors=this.colors,o.quaternions=this.quaternions,o.matrices=this.matrices,o.textures=this.textures,o.floatArrays=this.floatArrays,o.vector4Arrays=this.vector4Arrays,o.matrixArrays=this.matrixArrays,o.samplers=this.samplers,o.uniforms=this.uniforms,o.uniformDirty=!0,o},n.cloneUniforms=function(e){var r;for(r in e.floats)this.setFloat(r,e.floats[r]);for(r in e.ints)this.setInt(r,e.ints[r]);for(r in e.floatArrays)this.setFloats(r,e.floatArrays[r]);for(r in e.textures)this.setTexture(r,e.textures[r]);for(r in e.vector2s)this.setVector2(r,e.vector2s[r]);for(r in e.vector3s)this.setVector3(r,e.vector3s[r]);for(r in e.vector4s)this.setVector4(r,e.vector4s[r]);for(r in e.colors)this.setColor(r,e.colors[r]);for(r in e.quaternions)this.setQuaternion(r,e.quaternions[r]);for(r in e.matrices)this.setMatrix(r,e.matrices[r]);for(r in e.vector4Arrays){for(var a=[],o=0;o<e.vector4Arrays[r].length;o+=4)a.push(new Dt(e.vector4Arrays[r][o],e.vector4Arrays[r][o+1],e.vector4Arrays[r][o+2],e.vector4Arrays[r][o+3]));this.setVector4Array(r,a)}for(r in e.matrixArrays){for(var u=[],l=0;l<e.matrixArrays[r].length;l+=16){for(var h=Tt.fromIdentity(),c=0;c<16;c++)h.elements[c]=e.matrixArrays[r][l+c];u.push(h)}this.setMatrixArray(r,u)}
7},n.fromData=function(e){i.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var r=lt({},e);e.stringTags.RenderType!==void 0&&(this.blending=e.stringTags.RenderType===Wn.Transparent),e.floats.ZTest!==void 0&&(this.depthTest=e.floats.ZTest!==0),e.floats.ZWrite!==void 0&&(this.depthMask=e.floats.ZWrite!==0);var a=e.stringTags.RenderFace;a===en.Front?(this.culling=!0,this.cullFace=P.BACK):a===en.Back?(this.culling=!0,this.cullFace=P.FRONT):this.culling=!1;var o;for(o in r.floats)this.setFloat(o,r.floats[o]);for(o in r.ints)this.setInt(o,r.ints[o]);for(o in r.vector4s){var u=r.vector4s[o];this.setVector4(o,new Dt(u.x,u.y,u.z,u.w))}for(o in r.colors){var l=r.colors[o];this.setColor(o,new Ct(l.r,l.g,l.b,l.a))}for(o in r.textures){var h=r.textures[o],c=this.engine.findObject(h.texture);this.setTexture(o,c);var f=h.offset,d=h.scale;f&&d&&this.setVector4(o+"_ST",new Dt(d.x,d.y,f.x,f.y))}if(e.shader){var v=this.engine.findObject(e.shader);v&&(this.shader=v,this.shaderSource=v.shaderData)}var p;this.stringTags=(p=e.stringTags)!=null?p:{},this.initialized=!1},n.toData=function(){var e=this.definition;this._shader&&(e.shader=this._shader),e.floats={},e.ints={},e.vector4s={},e.colors={},e.textures={},e.dataType=tt.Material,e.stringTags=this.stringTags;for(var r in this.floats)e.floats[r]=this.floats[r];for(var a in this.ints)e.ints[a]=this.ints[a];for(var o in this.vector4s)e.vector4s[o]=this.vector4s[o];for(var u in this.colors)e.colors[u]=this.colors[u];for(var l in this.textures){e.textures[l]||(e.textures[l]={texture:this.textures[l]});var h=e.textures[l],c=this.getVector4(l+"_ST");c&&(h.scale={x:c.x,y:c.y},h.offset={x:c.z,y:c.w},delete e.vector4s[l+"_ST"])}return e},n.checkUniform=function(e){this.uniforms.includes(e)||(this.uniforms.push(e),this.uniformDirty=!0)},n.dispose=function(){var e;this.destroyed||((e=this.shaderVariant)==null||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=Ba,this.destroyed=!0,this.engine!==void 0&&this.engine.removeMaterial(this),i.prototype.dispose.call(this))},Mt(s,[{key:"shader",get:function(){return this._shader},set:function(e){this._shader!==e&&(this._shader=e,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(e){this.setTexture("_MainTex",e)}},{key:"color",get:function(){return this.getColor("_Color")}
7,set:function(e){this.setColor("_Color",e)}},{key:"blending",get:function(){return this.materialState.blending},set:function(e){e!==void 0&&this.materialState.setBlending(e)}},{key:"blendColor",get:function(){return this.materialState.blendColor},set:function(e){e&&this.materialState.setBlendColor(e)}},{key:"blendFunction",get:function(){return this.materialState.blendFunctionParameters},set:function(e){e&&this.materialState.setBlendFunctionParameters(e)}},{key:"blendEquation",get:function(){return this.materialState.blendEquationParameters},set:function(e){e&&this.materialState.setBlendEquationParameters(e)}},{key:"depthTest",get:function(){return this.materialState.depthTest},set:function(e){e!==void 0&&this.materialState.setDepthTest(e)}},{key:"depthMask",get:function(){return this.materialState.depthMask},set:function(e){e!==void 0&&this.materialState.setDepthMask(e)}},{key:"depthRange",get:function(){return this.materialState.depthRange},set:function(e){e&&this.materialState.setDepthRange(e)}},{key:"depthFunc",get:function(){return this.materialState.depthFunc},set:function(e){e!==void 0&&this.materialState.setDepthFunc(e)}},{key:"polygonOffsetFill",get:function(){return this.materialState.polygonOffsetFill},set:function(e){e!==void 0&&this.materialState.setPolygonOffsetFill(e)}},{key:"polygonOffset",get:function(){return this.materialState.polygonOffset},set:function(e){e&&this.materialState.setPolygonOffset(e)}},{key:"sampleAlphaToCoverage",get:function(){return this.materialState.sampleAlphaToCoverage},set:function(e){e!==void 0&&this.materialState.setSampleAlphaToCoverage(e)}},{key:"colorMask",get:function(){return this.materialState.colorMask[0]},set:function(e){this.materialState.setColorMask(e)}},{key:"stencilTest",get:function(){return this.materialState.stencilTest},set:function(e){e!==void 0&&this.materialState.setStencilTest(e)}},{key:"stencilMask",get:function(){return this.materialState.stencilMask},set:function(e){e&&this.materialState.setStencilMask(e)}},{key:"stencilRef",get:function(){return this.materialState.stencilRef},set:function(e){e&&this.materialState.setStencilRef(e)}},{key:"stencilFunc",get:function(){return this.materialState.stencilFunc},set:function(e){e&&this.materialState.setStencilFunc(e)}},{key:"stencilOpFail",get:function(){return this.materialState.stencilOpFail},set:function(e){e&&this.materialState.setStencilOpFail(e)}},{key:"stencilOpZFail",get:function(){return this.materialState.stencilOpZFail},set:function(e){e&&this.materialState.setStencilOpZFail(e)}},{key:"stencilOpZPass",get:function(){return this.materialState.stencilOpZPass},set:function(e){e&&this.materialState.setStencilOpZPass(e)}},{key:"culling",get:function(){return this.materialState.culling},set:function(e){e!==void 0&&this.materialState.setCulling(e)}},{key:"frontFace",get:function(){return this.materialState.frontFace},set:function(e){e!==void 0&&this.materialState.setFrontFace(e)}},{key:"cullFace",get:function(){return this.materialState.cullFace},set:function(e){e!==void 0&&this.materialState.setCullFace(e)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),s}(xe);Ce.create=function(i,s){return new Ce(i,s)};var Zu=function(){function i(){this.alphaMaskEnabled=!1,this.isMask=!1,this.inverted=!1,this.maskMode=He.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:$t.clear}}var s=i.prototype;return s.getRefValue=function(){return 1},s.setMaskOptions=function(t,e){var r=e.isMask,a=r===void 0?!1:r,o=e.inverted,u=o===void 0?!1:o,l=e.reference,h=e.alphaMaskEnabled,c=h===void 0?!1:h;if(this.alphaMaskEnabled=c,this.isMask=a,this.inverted=u,this.maskReferences=[],a)this.maskMode=He.MASK;else{this.maskMode=u?He.REVERSE_OBSCURED:He.OBSCURED;var f=t.findObject(l);f&&this.maskReferences.push({maskable:f,inverted:u})}},s.addMaskReference=function(t,e){e===void 0&&(e=!1);var r=this.maskReferences.some(function(a){return a.maskable===t});if(!r){if(this.maskReferences.length>=255){console.warn("Maximum of 255 mask references exceeded. Additional masks will be ignored.");return}this.maskReferences.push({maskable:t,inverted:e})}},s.removeMaskReference=function(t){var e=this.maskReferences.findIndex(function(r){return r.maskable===t});e!==-1&&this.maskReferences.splice(e,1)},s.clearMaskReferences=function(){this.maskReferences=[]},s.drawStencilMask=function(t,e){for(var r=e.frameClipMasks,a=M(r),o;!(o=a()).done;){var u=o.value;this.addMaskReference(u,!1)}if(this.maskReferences.length>0){t.clear(this.stencilClearAction);for(var l=[],h=[],c=M(this.maskReferences),f;!(f=c()).done;){var d=f.value;d.inverted?h.push(d):l.push(d)}for(var v=0;v<l.length;v++)l[v].maskable.drawStencilMask(v);for(var p=l.length,g=M(h),x;!(x=g()).done;){var b=x.value;b.maskable.drawStencilMask(p)}this.expectedStencilValue=p}for(var y=M(e.materials),E;!(E=y()).done;){var _=E.value;this.setupMaskedMaterial(_)}for(var S=M(r),C;!(C=S()).done;){var I=C.value;this.removeMaskReference(I)}},s.drawGeometryMask=function(t,e,r,a,o,u){u===void 0&&(u=0);var l=a.colorMask,h=a.stencilTest;this.copyStencilArrayValue(this.prevStencilFunc,a.stencilFunc),this.copyStencilArrayValue(this.prevStencilOpZPass,a.stencilOpZPass),this.copyStencilArrayValue(this.prevStencilRef,a.stencilRef),this.copyStencilArrayValue(this.prevStencilMask,a.stencilMask),this.setupMaskMaterial(a,o),t.drawGeometry(e,r,a,u),a.colorMask=l,a.stencilTest=h,a.stencilFunc=this.prevStencilFunc,a.stencilOpZPass=this.prevStencilOpZPass,a.stencilRef=this.prevStencilRef,a.stencilMask=this.prevStencilMask},s.setupMaskMaterial=function(t,e){t.stencilTest=!0,t.stencilFunc=[P.EQUAL,P.EQUAL],t.stencilRef=[e,e],t.stencilMask=[255,255],t.stencilOpZPass=[P.INCR,P.INCR],t.colorMask=!1},s.setupMaskedMaterial=function(t){this.maskReferences.length>0?(t.stencilTest=!0,t.stencilRef=[this.expectedStencilValue,this.expectedStencilValue],t.stencilMask=[255,255],t.stencilFunc=[P.EQUAL,P.EQUAL],t.stencilOpZPass=[P.KEEP,P.KEEP]):t.stencilTest=!1},s.copyStencilArrayValue=function(t,e){e&&(t[0]=e[0],t[1]=e[1])},Mt(i,[{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===He.REVERSE_OBSCURED})}}]),i}(),Ze;(function(i){i[i.triangle=1]="triangle",i[i.box=2]="box",i[i.sphere=3]="sphere",i[i.custom=4]="custom"})(Ze||(Ze={}));var ic=function(){this.position=new ht,this.delta=new ht,this.pointerCurrentRaycast=new nc},nc=function(){this.point=null,this.item=null},bn=function(){function i(n,t,e){this.vectors=[],this.vectorsWorld=[],this.directions=[];for(var r=0;r<8;r++)this.vectors.push(new D),this.vectorsWorld.push(new D);for(var a=0;a<3;a++)this.directions.push(new D);this.minimum=new D,this.maximum=new D,this.minimumWorld=new D,this.maximumWorld=new D,this.center=new D,this.centerWorld=new D,this.extendSize=new D,this.extendSizeWorld=new D,this.worldMatrix=e||Tt.fromIdentity(),this.reConstruct(n,t,e)}var s=i.prototype;return s.reConstruct=function(t,e,r){var a=t.x,o=t.y,u=t.z,l=e.x,h=e.y,c=e.z;
7this.minimum.set(a,o,u),this.maximum.set(l,h,c),this.vectors[0].set(a,o,u),this.vectors[1].set(l,h,c),this.vectors[2].set(l,o,u),this.vectors[3].set(a,h,u),this.vectors[4].set(a,o,c),this.vectors[5].set(l,h,u),this.vectors[6].set(a,h,c),this.vectors[7].set(l,o,c);var f=i.tempVector0,d=i.tempVector1;f.copyFrom(e).add(t),this.center.copyFrom(f).scale(.5),d.copyFrom(e).subtract(t),this.extendSize.copyFrom(d).scale(.5),this.worldMatrix=r||Tt.fromIdentity(),this.update(this.worldMatrix)},s.update=function(t){var e=this.minimumWorld,r=this.maximumWorld,a=this.vectorsWorld,o=this.vectors;if(t.isIdentity()){e.copyFrom(this.minimum),r.copyFrom(this.maximum);for(var f=0;f<8;f++)a[f].copyFrom(o[f]);this.extendSizeWorld.copyFrom(this.extendSize),this.centerWorld.copyFrom(this.center)}else{e.set(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r.set(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);for(var u=0;u<8;u++){t.transformPoint(o[u],a[u]);var l=a[u];e.x=Math.min(e.x,l.x),e.y=Math.min(e.y,l.y),e.z=Math.min(e.z,l.z),r.x=Math.max(r.x,l.x),r.y=Math.max(r.y,l.y),r.z=Math.max(r.z,l.z)}var h=i.tempVector0,c=i.tempVector1;h.copyFrom(r).subtract(e),this.extendSizeWorld.copyFrom(h).scale(.5),c.copyFrom(r).add(e),this.centerWorld.copyFrom(c).scale(.5)}var d=t.elements;this.directions[0].set(d[0],d[1],d[2]),this.directions[1].set(d[4],d[5],d[6]),this.directions[2].set(d[8],d[9],d[10]),this.worldMatrix=t},s.scale=function(t){var e=i.tempVector0;e.copyFrom(this.maximum).subtract(this.minimum);var r=e.length();e.scale(1/r);var a=r*t;e.scale(a*.5);var o=i.tempVector1,u=i.tempVector2;return o.copyFrom(this.center).subtract(e),u.copyFrom(this.center).add(e),this.reConstruct(o,u,this.worldMatrix),this},s.getWorldMatrix=function(){return this.worldMatrix},s.intersectsPoint=function(t){var e=this.minimumWorld,r=this.maximumWorld,a=-1e-6;return!(r.x-t.x<a||a>t.x-e.x||r.y-t.y<a||a>t.y-e.y||r.z-t.z<a||a>t.z-e.z)},s.intersectsBox=function(t){return this.intersectsMinMax(t.minimumWorld,t.maximumWorld)},s.intersectsMinMax=function(t,e){var r=this.minimumWorld,a=this.maximumWorld;return!(a.x<t.x||r.x>e.x||a.y<t.y||r.y>e.y||a.z<t.z||r.z>e.z)},i.intersects=function(t,e){return t.intersectsMinMax(e.minimumWorld,e.maximumWorld)},i}();bn.tempVector0=new D;bn.tempVector1=new D;bn.tempVector2=new D;var ac=function(){function i(){this.boundingBox=new bn(new D,new D),this.triangles=[],this.worldMatrix=new Tt,this.assemblyTriangles=function(n,t,e,r,a){for(var o=e;o<r;o+=3){var u=t[o]*3,l=t[o+1]*3,h=t[o+2]*3,c={x:n[u],y:n[u+1],z:n[u+2]},f={x:n[l],y:n[l+1],z:n[l+2]},d={x:n[h],y:n[h+1],z:n[h+2]};a.push({p0:c,p1:f,p2:d})}}}var s=i.prototype;return s.reConstruct=function(t,e,r){this.boundingBox.reConstruct(t,e,r)},s.getRawBoundingBoxTriangle=function(){return this.applyWorldMatrix(this.boundingBoxTriangle.area),this.boundingBoxTriangle},s.getBoundingBoxTriangle=function(t){for(var e=-Number.MAX_VALUE,r=-Number.MAX_VALUE,a=Number.MAX_VALUE,o=Number.MAX_VALUE,u=M(this.boundingBoxTriangle.area),l;!(l=u()).done;){var h=l.value;e=Math.max(h.p0.x,h.p1.x,h.p2.x,e),r=Math.max(h.p0.y,h.p1.y,h.p2.y,r),a=Math.min(h.p0.x,h.p1.x,h.p2.x,a),o=Math.min(h.p0.y,h.p1.y,h.p2.y,o)}var c=[],f=new D(a,r,0),d=new D(e,r,0),v=new D(e,o,0),p=new D(a,o,0);return c.push({p0:f,p1:d,p2:v}),c.push({p0:f,p1:v,p2:p}),this.applyWorldMatrix(c),{type:Ze.triangle,area:c}},s.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var r=[],a=M(this.triangles),o;!(o=a()).done;){var u=o.value;r.push({p0:u.p0,p1:u.p1,p2:u.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxTriangle={type:Ze.triangle,area:r}},s.geometryToTriangles=function(t){var e=t.getIndexData(),r=t.getAttributeData("aPos"),a=[];if(!e||!r)return a;
7if(t.subMeshes.length===0)this.assemblyTriangles(r,e,0,e.length,a);else for(var o=M(t.subMeshes),u;!(u=o()).done;){var l=u.value;if(l.indexCount!==void 0){var h=e.BYTES_PER_ELEMENT,c=l.offset/h,f=c+l.indexCount;this.assemblyTriangles(r,e,c,f,a)}}return a},s.applyWorldMatrix=function(t){var e=this;return t.forEach(function(r){r.p0=e.worldMatrix.transformPoint(r.p0,new D),r.p1=e.worldMatrix.transformPoint(r.p1,new D),r.p2=e.worldMatrix.transformPoint(r.p2,new D)}),t},i}(),ze=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.materials=[],t.frameClipMasks=[],t.maskManager=new Zu,t._priority=0,t.boundingBoxInfo=new ac,t}var n=s.prototype;return n.onEnable=function(){var e;(e=this.item.composition)==null||e.renderFrame.addMeshToDefaultRenderPass(this)},n.onDisable=function(){var e;(e=this.item.composition)==null||e.renderFrame.removeMeshFromDefaultRenderPass(this)},n.onParentChanged=function(){this.frameClipMasks=[]},n.getBoundingBoxInfo=function(){return this.boundingBoxInfo},n.render=function(e){},Mt(s,[{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e}},{key:"material",get:function(){return this.materials[0]},set:function(e){this.materials.length===0?this.materials.push(e):this.materials[0]=e}}]),s}(ce);$([bt()],ze.prototype,"materials",void 0);$([bt()],ze.prototype,"_priority",void 0);var Js=6,Ur="editor",Qr={"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"},Tn=function(){var s=this,n=this;this.listeners={},this.off=function(t,e){s.listeners[t]&&(s.listeners[t]=s.listeners[t].filter(function(r){var a=r.listener;return a!==e}))},this.on=function(t,e,r){return s.listeners[t]=s.listeners[t]||[],s.listeners[t].push({listener:e,options:r}),function(){return s.off(t,e)}},this.once=function(t,e){s.on(t,e,{once:!0})},this.emit=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),a=1;a<e;a++)r[a-1]=arguments[a];var o;(o=n.listeners[t])==null||o.forEach(function(u){var l=u.listener,h=u.options;l.apply(void 0,[].concat(r)),h!=null&&h.once&&n.off(t,l)})},this.getListeners=function(t){var e;return((e=s.listeners[t])==null?void 0:e.map(function(r){var a=r.listener;return a}))||[]}},fi=new Zt,Te=new D,gr=new D,sc=1,Mi=function(){function i(n,t){n===void 0&&(n={}),this.taggedProperties={},this.position=new D(0,0,0),this.quat=new Zt(0,0,0,1),this.rotation=new Me(0,0,0),this.scale=new D(1,1,1),this.anchor=new D(0,0,0),this.size=new ht(1,1),this.children=[],this.worldMatrix=Tt.fromIdentity(),this.localMatrix=Tt.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new D(0,0,0),quat:new Zt(0,0,0,1),scale:new D(1,1,1)},this.name="transform_"+sc++,n&&this.setTransform(n),t&&(this.parentTransform=t),n.valid!==void 0&&this.setValid(n.valid)}var s=i.prototype;return s.setPosition=function(t,e,r){(this.position.x!==t||this.position.y!==e||this.position.z!==r)&&(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},s.translate=function(t,e,r){(t!==0||e!==0||r!==0)&&(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},s.setRotation=function(t,e,r){(this.rotation.x!==t||this.rotation.y!==e||this.rotation.z!==r)&&(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},s.setQuaternion=function(t,e,r,a){(this.quat.x!==t||this.quat.y!==e||this.quat.z!==r||this.quat.w!==a)&&(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=a,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},s.setScale=function(t,e,r){(this.scale.x!==t||this.scale.y!==e||this.scale.z!==r)&&(this.scale.x=t,this.scale.y=e,this.scale.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},s.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())},s.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},s.scaleBy=function(t,e,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},s.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())},s.setTransform=function(t,e){var r=t.position,a=t.rotation,o=t.scale,u=t.size,l=t.quat,h=t.name,c=t.anchor;if(h&&(this.name=h),r&&(Z(r,D)?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),l)Z(l,Zt)?this.setQuaternion(l.x,l.y,l.z,l.w):this.setQuaternion(l[0],l[1],l[2],l[3]);else if(a){var f=e?-1:1;Z(a,Me)?this.setRotation(a.x*f,a.y*f,a.z*f):this.setRotation(a[0]*f,a[1]*f,a[2]*f)}o&&(Z(o,D)?this.setScale(o.x,o.y,o.z):this.setScale(o[0],o[1],o[2])),u&&this.setSize(u.x,u.y),c&&(Z(c,ht)?this.setAnchor(c.x,c.y):this.setAnchor(c[0],c[1]))},s.addChild=function(t){we(this.children,t)},s.removeChild=function(t){Re(this.children,t)},s.getRotation=function(){return i.getRotation(this.quat,new Me)},s.getQuaternion=function(){return this.quat},s.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)},s.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},s.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},s.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},s.getWorldScale=function(){var t=this.worldTRSCache;if(this.dirtyFlags.worldMatrix){var e=this.getWorldMatrix();e.decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1}return this.worldTRSCache.scale.clone()},s.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},s.setWorldPosition=function(t,e,r){var a=this.getParentMatrix();a?(Te.set(0,0,0),fi.set(0,0,0,1),gr.set(1,1,1),a.decompose(Te,fi,gr),Te.set(t-Te.x,e-Te.y,r-Te.z),fi.invert(),Te.applyQuaternion(fi),Te.x=gr.x!==0?Te.x/gr.x:0,Te.y=gr.y!==0?Te.y/gr.y:0,Te.z=gr.z!==0?Te.z/gr.z:0,this.setPosition(Te.x,Te.y,Te.z)):this.setPosition(t,e,r)},s.getWorldRotation=function(){return this.updateTRSCache(),i.getRotation(this.worldTRSCache.quat,new Me)},s.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.copyFrom(this.worldTRSCache.scale)},s.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()},s.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},s.getValid=function(){return this.valid},s.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},s.fromData=function(t){var e={};e.position=new D().copyFrom(t.position),t.quat?e.quat=new Zt(t.quat.x,t.quat.y,t.quat.z,t.quat.
7w):e.rotation=new Me(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=new D().copyFrom(t.scale),t.size&&(e.size=new ht().copyFrom(t.size)),t.anchor&&(e.anchor=new ht().copyFrom(t.anchor)),this.setTransform(e)},s.dispose=function(){},s.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}},s.dispatchValueChange=function(){this.children.forEach(function(t){t.parentMatrixDirty=!0})},i.getRotation=function(t,e){var r=fi.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},Mt(i,[{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())}}]),i}(),Ie=function(i){k(s,i);function s(t,e){var r;return r=i.call(this,t)||this,r.children=[],r.transform=new Mi,r.time=-1,r.duration=0,r.endBehavior=Gt.forward,r.type=rt.base,r.components=[],r.isDuringPlay=!1,r.isManuallySetRenderOrder=!1,r.active=!0,r.visible=!0,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new Tn,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=t,e&&r.fromData(e),r}var n=s.prototype;return n.on=function(e,r,a){this.eventProcessor.on(e,r,a)},n.off=function(e,r){this.eventProcessor.off(e,r)},n.once=function(e,r){this.eventProcessor.once(e,r)},n.emit=function(e){for(var r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];var u;(u=this.eventProcessor).emit.apply(u,[].concat([e],a))},n.getListeners=function(e){return this.eventProcessor.getListeners(e)},n.addComponent=function(e){var r=new e(this.engine);return this.components.push(r),r.setVFXItem(this),r},n.getComponent=function(e){for(var r,a=M(this.components),o;!(o=a()).done;){var u=o.value;if(Z(u,e)){r=u;break}}return r},n.getComponents=function(e){for(var r=[],a=M(this.components),o;!(o=a()).done;){var u=o.value;Z(u,e)&&r.push(u)}return r},n.getDescendants=function(e,r){var a=[];return this.getDescendantsInternal(a,e,r),a},n.setParent=function(e){e===this&&!e||(this.parent&&Re(this.parent.children,this),this.parent=e,this.transform.parentTransform=e.transform,e.children.push(this),!this.composition&&e.composition&&(this.composition=e.composition),this.onParentChanged(),!this.isDuringPlay&&e.isDuringPlay&&(this.awake(),this.beginPlay()))},n.setColor=function(e,r,a,o){},n.setOpacity=function(e){},n.setActive=function(e){this.active!==!!e&&(this.active=!!e,this.onActiveChanged())},n.setVisible=function(e){for(var r=M(this.components),a;!(a=r()).done;){var o=a.value;o.enabled=e}this.visible=e},n.getVisible=function(){return this.visible},n.getWorldTransform=function(e){var r=e!=null?e:new Mi({valid:!0});return r.cloneFromMatrix(this.transform.getWorldMatrix()),r},n.translate=function(e,r,a){this.transform.translate(e,r,a)},n.rotate=function(e,r,a){var o=new Me(e,r,a),u=Zt.fromEuler(o);u.conjugate(),this.transform.rotateByQuat(u)},n.scale=function(e,r,a){this.transform.scaleBy(e,r,a)},n.setPosition=function(e,r,a){this.transform.setPosition(e,r,a)},n.setRotation=function(e,r,a){this.transform.setRotation(e,r,a)},n.setScale=function(e,r,a){this.transform.setScale(e,r,a)},n.setWorldPosition=function(e,r,a){this.transform.setWorldPosition(e,r,a)},n.setPositionByPixel=function(e,r){if(this.composition){var a=this.transform.getWorldPosition().z,o=this.composition.camera.getInverseVPRatio(a),u=o.x,l=o.y,h=this.composition.engine.canvas.getBoundingClientRect(),c=h.width,f=h.height;this.transform.setPosition((2*e/c-1)*u,(1-2*r/f)*l,a)}},n.translateByPixel=function(e,r){if(this.composition){var a=this.composition.engine.canvas.getBoundingClientRect(),o=a.width,u=a.height,l=this.transform.getWorldPosition().z,h=this.composition.camera.getInverseVPRatio(l),c=h.x,f=h.y;this.transform.translate(2*e*c/o,-2*r*f/u,0)}},n.getBoundingBox=function(){}
7,n.getHitTestParams=function(e){},n.hitTest=function(e,r,a,o,u,l,h){var c;if(!this.isActive)return!1;var f=!1,d=h==null?void 0:h.maxCount,v=this.getHitTestParams(l);if(v){var p=v.clipMasks,g=!0;if(p.length>0&&!oc(e,p)&&(g=!1),g){var x=!1,b=new D;if(v.type===Ze.triangle){for(var y=v.triangles,E=v.backfaceCulling,_=0;_<y.length;_++)if(e.intersectTriangle(y[_],b,E)){x=!0,u.push(b);break}}else if(v.type===Ze.box){var S=v.center,C=v.size,I=S.clone().addScaledVector(C,.5),R=S.clone().addScaledVector(C,-.5);e.intersectBox({min:I,max:R},b)&&(x=!0,u.push(b))}else if(v.type===Ze.sphere){var O=v.center,F=v.radius;e.intersectSphere({center:O,radius:F},b)&&(x=!0,u.push(b))}else if(v.type===Ze.custom){var L=v.collect(e,new ht(r,a));L&&L.length>0&&(L.forEach(function(H){u.push(H)}),x=!0)}if(x){var V,U={id:this.getInstanceId(),name:this.name,position:u[u.length-1],parentId:this.parentId,hitPositions:u,behavior:v.behavior,item:this,composition:this.composition};if(o.push(U),f=!0,!(h==null||(V=h.stop)==null)&&V.call(h,U))return!0}}}for(var W=M(this.children),G;!(G=W()).done;){var B=G.value,X;if(d!==void 0&&o.length>=d)break;!(h==null||(X=h.skip)==null)&&X.call(h,B)||B.hitTest(e,r,a,o,u,l,h)&&(f=!0)}return s.isComposition(this)&&f&&this!==((c=this.composition)==null?void 0:c.rootItem)&&o.push({id:this.getInstanceId(),name:this.name,position:u[u.length-1],parentId:this.parentId,hitPositions:u,behavior:ri.NONE,item:this,composition:this.composition}),f},n.getCurrentPosition=function(){var e=new D;return this.transform.assignWorldTRS(e),e},n.find=function(e){var r;if(this.name===e)return this;var a=[];(r=a).push.apply(r,[].concat(this.children));for(var o=0;o<a.length;){var u,l=a[o];if(o++,l.name===e)return l;(u=a).push.apply(u,[].concat(l.children))}},n.duplicate=function(){var e=new Map;this.gatherPreviousObjectID(e),this.refreshGUIDRecursive();var r=this.engine.findObject({id:this.definition.id});return r.refreshGUIDRecursive(),this.refreshGUIDRecursive(e),this.composition&&r.setParent(this.composition.rootItem),r},n.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var e=M(this.children),r;!(r=e()).done;){var a=r.value;a.isDuringPlay||a.beginPlay()}},n.awake=function(){for(var e=M(this.components),r;!(r=e()).done;){var a=r.value;a.isAwakeCalled||(a.onAwake(),a.isAwakeCalled=!0)}for(var o=M(this.children),u;!(u=o()).done;){var l=u.value;l.awake()}},n.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},n.onEnable=function(){this.isEnabled=!0;for(var e=M(this.components),r;!(r=e()).done;){var a=r.value;a.enabled&&!a.isStartCalled&&(a.onStart(),a.isStartCalled=!0)}for(var o=M(this.components),u;!(u=o()).done;){var l=u.value;l.enabled&&!l.isEnableCalled&&l.enable()}},n.onDisable=function(){this.isEnabled=!1;for(var e=M(this.components),r;!(r=e()).done;){var a=r.value;a.enabled&&a.isEnableCalled&&a.disable()}},n.onParentChanged=function(){for(var e=M(this.components),r;!(r=e()).done;){var a=r.value;a.onParentChanged()}for(var o=M(this.children),u;!(u=o()).done;){var l=u.value;l.onParentChanged()}},n.setRendererComponentOrder=function(e){for(var r=M(this.components),a;!(a=r()).done;){var o=a.value;Z(o,ze)&&(o.priority=e)}},n.fromData=function(e){i.prototype.fromData.call(this,e);var r=e.id,a=e.name,o=e.parentId,u=e.endBehavior,l=e.transform,h=e.duration,c=h===void 0?0:h,f=e.visible,d=f===void 0?!0:f;if(this.type=e.type,this.props=e,this.id=r.toString(),this.parentId=o,this.components.length=0,s.isComposition(this)){var v=this.definition.content.options.refId,p=this.engine.findEffectsObjectData(v);if(!p)throw new Error("Referenced precomposition with Id: "+v+" does not exist.");this.instantiatePreComposition(p)}if(this.name=a,this.duration=c,this.endBehavior=u,l&&this.transform.fromData(l),this.transform.name=this.name,this.transform.engine=this.engine,e.content||(e.content={options:{}}),c<0)throw new Error("Item duration can't be less than 0, see "+Qr["Item duration can't be less than 0"]+".");if(e.components)for(var g=M(e.components),x;!(x=g()).done;){var b=x.value,y=this.engine.findObject(b);this.components.push(y)}for(var E,_=M((E=e.children)!=null?E:[]),S;!(S=_()).done;){var C=S.value,I=this.engine.findObject(C);I.setParent(this)}this.setVisible(d)},n.toData=function(){var e;if(this.definition.id=this.guid,this.definition.transform=this.transform.toData(),this.definition.dataType=tt.VFXItemData,((e=this.parent)==null?void 0:e.name)!=="rootItem"){var r;this.definition.parentId=(r=this.parent)==null?void 0:r.guid}if(!this.definition.components){this.definition.components=[];for(var a=M(this.components),o;!(o=a()).done;){var u=o.value;Z(u,ii)&&this.definition.components.push(u)}}this.definition.content={}},n.dispose=function(){if(this.composition){this.composition.destroyItem(this);for(var e=M(this.components.slice()),r;!(r=e()).done;){var a=r.value;a.dispose()}this.components=[],this._composition=null,this.transform.setValid(!1)}this.resetChildrenParent(),i.prototype.dispose.call(this)},n.resetChildrenParent=function(){for(var e=M(this.children),r;!(r=e()).done;){var a=r.value;this.parent&&a.setParent(this.parent)}if(this.parent){var o;Re((o=this.parent)==null?void 0:o.children,this)}},n.instantiatePreComposition=function(e,r){r===void 0&&(r=!0),this.name=e.name,this.duration=e.duration,this.endBehavior=e.endBehavior;var a=this.getInstanceId();this.setInstanceId(e.id);for(var o=M(e.components),u;!(u=o()).done;){var l=u.value,h=this.engine.findObject(l);h.item=this,this.components.push(h)}for(var c,f=M((c=e.children)!=null?c:[]),d;!(d=f()).done;){var v=d.value,p=this.engine.findObject(v);p.setParent(this)}if(r){for(var g=M(this.components),x;!(x=g()).done;){var b=x.value;b.setInstanceId(Pt())}for(var y=M(this.children),E;!(E=y()).done;){var _=E.value;_.refreshGUIDRecursive()}}this.setInstanceId(a)},n.refreshGUIDRecursive=function(e){var r,a=(r=e==null?void 0:e.get(this))!=null?r:Pt();this.setInstanceId(a);for(var o=M(this.components),u;!(u=o()).done;){var l=u.value,h,c=(h=e==null?void 0:e.get(l))!=null?h:Pt();l.setInstanceId(c)}for(var f=M(this.children),d;!(d=f()).done;){var v=d.value;v.refreshGUIDRecursive(e)}},n.gatherPreviousObjectID=function(e){e.set(this,this.getInstanceId());for(var r=M(this.components),a;!(a=r()).done;){var o=a.value;e.set(o,o.getInstanceId())}for(var u=M(this.children),l;!(l=u()).done;){var h=l.value;h.gatherPreviousObjectID(e)}},n.getDescendantsInternal=function(e,r,a){if(r===void 0&&(r=!1),!!this.children)for(var o=0;o<this.children.length;o++){var u=this.children[o];(!a||a(u))&&e.push(u),r||u.getDescendantsInternal(e,!1,a)}},s.isComposition=function(e){return e.type===rt.composition},s.isSprite=function(e){return e.type===rt.sprite},s.isParticle=function(e){return e.type===rt.particle},s.isNull=function(e){return e.type===rt.null},s.isTree=function(e){return e.type===rt.tree},s.isCamera=function(e){return e.type===rt.camera},s.isAncestor=function(e,r){for(var a=r.parent;a;){if(a===e)return!0;a=a.parent}return!1}
7,Mt(s,[{key:"composition",get:function(){return this._composition},set:function(e){this._composition=e;for(var r=M(this.children),a;!(a=r()).done;){var o=a.value;o.composition||(o.composition=e)}}},{key:"compositionReusable",get:function(){var e,r;return(r=(e=this.composition)==null?void 0:e.reusable)!=null?r:!1}},{key:"renderOrder",get:function(){return this.listIndex},set:function(e){this.listIndex=e,this.isManuallySetRenderOrder=!0,this.setRendererComponentOrder(e)}},{key:"isActive",get:function(){return this.active},set:function(e){this.setActive(e)}},{key:"isVisible",get:function(){return this.visible}}]),s}(xe);Ie=$([xt(tt.VFXItemData)],Ie);var to;(function(i){function s(r,a){return r.type===a}i.is=s;function n(r){return r.type===rt.composition}i.isComposition=n;function t(r){return r.type===rt.particle}i.isParticle=t;function e(r){return r.type===rt.null}i.isNull=e})(to||(to={}));function oc(i,s){for(var n=M(s),t;!(t=n()).done;){var e=t.value,r=e.item;if(!(!r.isActive||!r.transform.getValid())){var a=r.transform,o=a.getWorldMatrix(),u=a.size.x,l=a.size.y,h=new D(-.5*u,.5*l,0).applyMatrix(o),c=new D(-.5*u,-.5*l,0).applyMatrix(o),f=new D(.5*u,.5*l,0).applyMatrix(o),d=new D(.5*u,-.5*l,0).applyMatrix(o),v={p0:h,p1:c,p2:f},p={p0:f,p1:c,p2:d};if(!i.intersectTriangle(v)&&!i.intersectTriangle(p))return!1}}return!0}var eo=function(){var i=new Float32Array(1),s=new Int32Array(i.buffer);return function(t){i[0]=t;var e=s[0],r=e>>16&32768,a=e>>12&2047,o=e>>23&255;return o<103?r:o>142?(r|=31744,r|=(o==255?0:1)&&e&8388607,r):o<113?(a|=2048,r|=(a>>114-o)+(a>>113-o&1),r):(r|=o-112<<10|a>>1,r+=a&1,r)}}(),uc=function(){function i(n){if(Number.isInteger(n))this.data=new Uint16Array(n);else if(n&&typeof n=="object"&&Number.isInteger(n.length))for(var t=this.data=new Uint16Array(n.length),e=0;e<t.length;e++)t[e]=eo(n[e])}var s=i.prototype;return s.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=eo(t[r])},i}(),ro=new Me,io=new Tt;function qu(i,s,n,t,e,r,a){var o=i,u=t/e,l=t,h=s.speedOverLifetime;h&&(l=h.getIntegrateValue(0,t,e));var c=s.gravityModifier?s.gravityModifier.getIntegrateByTime(0,t):0;o.copyFrom(r),o.addScaledVector(a,l),o.addScaledVector(n,c);var f=s.linearVelOverLifetime||{},d=s.orbitalVelOverLifetime||{},v=["x","y","z"];if(d.enabled){var p=new D;d.center&&p.setFromArray(d.center);var g=o.clone().subtract(p),x=d.asRotation,b=v.map(function(F){var L=d[F];return L?x?L.getValue(u):L.getIntegrateValue(0,t,e):0});ro.setFromArray(b).negate(),io.setFromEuler(ro);var y=io.transformPoint(g);o.addVectors(p,y)}if(f.enabled){var E=f.asMovement,_=f.x,S=f.y,C=f.z;if(_){var I=E?_.getValue(u):_.getIntegrateValue(0,t,e);o.x=o.x+I}if(S){var R=E?S.getValue(u):S.getIntegrateValue(0,t,e);o.y=o.y+R}if(C){var O=E?C.getValue(u):C.getIntegrateValue(0,t,e);o.z=o.z+O}}return o}function Qu(i){return Array.isArray(i)?[i[0],i[1],i[2]]:[0,0,0]}function lc(i,s){for(var n=0,t=i.length;n<t;n++)i[n]=s;return i}function hc(i,s,n){if(s&&n)for(var t=0,e=s.length;t<e;t++)i[t]=s[t]*n[t];else if(s){if(i!==s)for(var r=0;r<s.length;r++)i[r]=s[r]}else if(n&&i!==n)for(var a=0;a<n.length;a++)i[a]=n[a];return i}var Ge;Ge={},Ge[re.PARTICLE_ORIGIN_CENTER]=[0,0],Ge[re.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Ge[re.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Ge[re.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Ge[re.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Ge[re.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Ge[re.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Ge[re.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Ge[re.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5];function no(i){return Math.pow(2,Math.round(Math.log(i)/Math.LN2))}function cc(i,s,n){var t=n.position,e=new D(i,s,0),r=new D,a=n.getInverseViewProjectionMatrix();return a.projectPoint(e,r),r.subtract(t),new Ni(t,r)}function fc(i,s,n){var t=i.x,e=i.y,r=i.z,a=new D(t-s,e+n,r),o=new D(t-s,e-n,r),u=new D(t+s,e-n,r),l=new D(t+s,e+n,r);return[{p0:a,p1:o,p2:u},{p0:a.clone(),p1:u.clone(),p2:l}]}function pr(i,s,n){return n===void 0&&(n=1e-6),Math.abs(i-s)<n}function Ht(i,s){s===void 0&&(s=2);var n=Math.pow(10,s);return Math.floor(i*n)/n}function Ha(i,s,n,t,e){t===void 0&&(t=null);var r=new D(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),a=new D(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);e||(e=3);for(var o=s,u=s*e;o<s+n;o++,u+=e){var l=i[u],h=i[u+1],c=i[u+2];r.x=Math.min(r.x,l),r.y=Math.min(r.y,h),r.z=Math.min(r.z,c),a.x=Math.max(a.x,l),a.y=Math.max(a.y,h),a.z=Math.max(a.z,c)}return t&&(r.x-=r.x*t.x+t.y,r.y-=r.y*t.x+t.y,r.z-=r.z*t.x+t.y,a.x+=a.x*t.x+t.y,a.y+=a.y*t.x+t.y,a.z+=a.z*t.x+t.y),{minimum:r,maximum:a}}var yr={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(s){s[0];var n=s[1],t=this.getPointIndexInCurve(s,this.pointIndexCache),e=t.xIndex,r=t.yIndex,a=n[e],o=n[r];return new ht(a,o)},getPointIndexInCurve:function(s,n){var t=s[0],e=s[2],r=t===Lt.LINE||t===Lt.EASE_OUT?0:t===Lt.EASE_IN||t===Lt.EASE||t===Lt.HOLD&&e===Lt.EASE_IN?2:0;return n?(n.xIndex=r,n.yIndex=r+1,n):{xIndex:r,yIndex:r+1}},isLeftSideEase:function(s){var n=s[0];s[1];var t=s[2];return n===Lt.HOLD&&this.isKeyframeTypeLeftSideEase(t)?!0:this.isKeyframeTypeLeftSideEase(n)},isRightSideEase:function(s){var n=s[0];s[1];var t=s[2];return n===Lt.HOLD&&this.isKeyframeTypeRightSideEase(t)?!0:this.isKeyframeTypeRightSideEase(n)},isKeyframeTypeLeftSideEase:function(s){return[Lt.EASE,Lt.EASE_IN,Lt.AUTO].includes(s)},isKeyframeTypeRightSideEase:function(s){return[Lt.EASE,Lt.EASE_OUT,Lt.AUTO].includes(s)},isHoldInKeyframe:function(s){var n=s[0];s[1];var t=s[2];
7return n===Lt.HOLD&&[Lt.HOLD,Lt.LINE_OUT,Lt.EASE_OUT].includes(t)},isHoldOutKeyframe:function(s){var n=s[0];s[1];var t=s[2];return n===Lt.HOLD&&[Lt.HOLD,Lt.LINE,Lt.EASE_IN].includes(t)}},dc=function(s,n){this.points=s,this.totalLength=n},Jr={},Pn={},vc=4,pc=.001,mc=1e-7,gc=10,Qi=300,Ki=11,Ui=1/(Ki-1);function Ku(i,s){return 1-3*s+3*i}function $u(i,s){return 3*s-6*i}function Ju(i){return 3*i}function ln(i,s,n){return((Ku(s,n)*i+$u(s,n))*i+Ju(s))*i}function tl(i,s,n){return 3*Ku(s,n)*i*i+2*$u(s,n)*i+Ju(s)}function yc(i,s,n,t,e){var r,a,o=0;do a=s+(n-s)/2,r=ln(a,t,e)-i,r>0?n=a:s=a;while(Math.abs(r)>mc&&++o<gc);return a}function xc(i,s,n,t){for(var e=0;e<vc;++e){var r=tl(s,n,t);if(r===0)return s;var a=ln(s,n,t)-i;s-=a/r}return s}function bc(i,s,n,t){var e=Ht(s.x-i.x,3)+"_"+Ht(s.y-i.y,3)+"_"+Ht(s.z-i.z,3),r=Ht(n.x-i.x,3)+"_"+Ht(n.y-i.y,3)+"_"+Ht(n.z-i.z,3),a=Ht(t.x-i.x,3)+"_"+Ht(t.y-i.y,3)+"_"+Ht(t.z-i.z,3),o=e+"&"+r+"&"+a;if(Pn[o])return{data:Pn[o],interval:i};for(var u=[],l=null,h=0,c=0,f=Qi,d=0;d<f;d+=1){var v=new D,p=d/(f-1);c=0,v.x=3*Math.pow(1-p,2)*p*(n.x-i.x)+3*(1-p)*Math.pow(p,2)*(t.x-i.x)+Math.pow(p,3)*(s.x-i.x),v.y=3*Math.pow(1-p,2)*p*(n.y-i.y)+3*(1-p)*Math.pow(p,2)*(t.y-i.y)+Math.pow(p,3)*(s.y-i.y),v.z=3*Math.pow(1-p,2)*p*(n.z-i.z)+3*(1-p)*Math.pow(p,2)*(t.z-i.z)+Math.pow(p,3)*(s.z-i.z),l!==null&&(c+=Math.pow(v.x-l.x,2),c+=Math.pow(v.y-l.y,2),c+=Math.pow(v.z-l.z,2)),l=v,c=Math.sqrt(c),h+=c,u[d]={partialLength:c,point:v}}var g=new dc(u,h);return Pn[o]=g,{data:g,interval:new D(i.x,i.y,i.z)}}var Tc=function(){function i(n,t,e,r){this.p1=n,this.p2=t,this.p3=e,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var a=bc(n,t,e,r),o=a.data,u=a.interval;this.lengthData=o,this.interval=u,this.totalLength=o.totalLength}var s=i.prototype;return s.getPointInPercent=function(t){var e=this.lengthData;if(t===0)return e.points[0].point.clone().add(this.interval);if(pr(1-t,0))return e.points[Qi-1].point.clone().add(this.interval);if(pr(e.totalLength,0))return this.p1.clone();var r=new D,a=Ht(e.totalLength*t,4),o=this.catching.lastAddedLength,u=this.catching.lastPoint;if(pr(o,a))return e.points[u].point.clone().add(this.interval);var l=!0,h=1;for(a<o&&(h=-1);l;){if(a>=o){if(u===Qi-1){r.x=e.points[u].point.x,r.y=e.points[u].point.y,r.z=e.points[u].point.z;break}if(a<o+e.points[u+1].partialLength){var c=(a-o)/e.points[u+1].partialLength;r.x=e.points[u].point.x+(e.points[u+1].point.x-e.points[u].point.x)*c,r.y=e.points[u].point.y+(e.points[u+1].point.y-e.points[u].point.y)*c,r.z=e.points[u].point.z+(e.points[u+1].point.z-e.points[u].point.z)*c;break}}h>0&&u<Qi-1?(u+=h,o+=Ht(e.points[u].partialLength,5)):h<0&&u>0?(o-=Ht(e.points[u].partialLength,5),u+=h):l=!1}return this.catching.lastPoint=u,this.catching.lastAddedLength=o,r.add(this.interval),r},i}(),_c=function(){function i(n,t,e,r){this.p1=n,this.p2=t,this.p3=e,this.p4=r,this.temp=new Zt,this.totalLength=0}var s=i.prototype;return s.getPointInPercent=function(t){return t===0?this.temp.copyFrom(this.p1):pr(1-t,0)?this.temp.copyFrom(this.p2):(Ec.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},i}(),bi=function(){function i(n,t,e,r){this.precomputed=!1,this.control1=new ht,this.control2=new ht,this.weighted=!1,this.isConstant=!1,this.mSampleValues=new Array(Ki),n!==void 0&&t!==void 0&&e!==void 0&&r!==void 0?(this.control1.x=n,this.control1.y=t,this.control2.x=e,this.control2.y=r,this.weighted=!0):n!==void 0&&t!==void 0?(this.control1.x=1/3,this.control1.y=n,this.control2.x=2/3,this.control2.y=t):this.isConstant=!0}var s=i.prototype;return s.getValue=function(t){if(this.isConstant)return 0;if(this.control1.x===this.control1.y&&this.control2.x===this.control2.y||t===0||t===1)return t;if(!this.weighted)return this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t);this.precomputed||this.precompute();var e=ln(this.getTForX(t),this.control1.y,this.control2.y);return e},s.bezierInterpolate=function(t,e,r,a,o){var u=1-o,l=u*u,h=l*u,c=o*o,f=c*o;return t*h+e*l*o*3+r*u*c*3+a*f},s.calcSampleValues=function(){for(var t=0;t<Ki;++t)this.mSampleValues[t]=ln(t*Ui,this.control1.x,this.control2.x)},s.getTForX=function(t){for(var e=this.mSampleValues,r=Ki-1,a=0,o=1;o!==r&&e[o]<=t;++o)a+=Ui;--o;var u=(t-e[o])/(e[o+1]-e[o]),l=a+u*Ui,h=tl(l,this.control1.x,this.control2.x);return h>=pc?xc(t,l,this.control1.x,this.control2.x):h===0?l:yc(t,a,a+Ui,this.control1.x,this.control2.x)}
7,s.precompute=function(){this.precomputed=!0,(this.control1.x!==this.control1.y||this.control2.x!==this.control2.y)&&this.calcSampleValues()},i}();function el(i,s){var n=rl(i,s),t=n.p0,e=n.p1,r=n.p2,a=n.p3;ne(r),ne(a);var o=a.x-t.x,u=a.y-t.y,l,h,c=Ht((e.x-t.x)/o,5),f=Ht((r.x-t.x)/o,5);pr(u,0)?l=h=NaN:(l=Ht((e.y-t.y)/u,5),h=Ht((r.y-t.y)/u,5)),c<0&&(c=0),f<0&&(f=0),c>1&&(c=1),f>1&&(f=1);var d=("bez_"+c+"_"+l+"_"+f+"_"+h).replace(/\./g,"p"),v;return Jr[d]?v=Jr[d]:(pr(u,0)?v=new bi:v=new bi(c,l,f,h),Jr[d]=v),{points:[t,e,r,a],timeInterval:o,valueInterval:u,curve:v}}function rl(i,s,n){var t=i[1],e=yr.isHoldOutKeyframe(i),r=yr.isHoldInKeyframe(s),a=!r&&yr.isRightSideEase(i),o=!e&&yr.isLeftSideEase(s);if(a&&!o&&!r){var u=new ht(t[t.length-4],t[t.length-3]),l=new ht(t[t.length-2],t[t.length-1]),h=yr.getPointInCurve(s),c=new ht(h.x,h.y),f=new ht(c.x-(c.x-u.x)/10,c.y);return{type:"ease",p0:u,p1:l,p2:f,p3:c}}if(!a&&o&&!e){var d=s[1],v=yr.getPointInCurve(i),p=new ht(v.x,v.y),g=new ht(d[0],d[1]),x=new ht(d[2],d[3]),b=new ht(p.x+(x.x-p.x)/10,p.y);return{type:"ease",p0:p,p1:b,p2:g,p3:x}}if(a&&o){var y=s[1],E=new ht(t[t.length-4],t[t.length-3]),_=new ht(t[t.length-2],t[t.length-1]),S=new ht(y[0],y[1]),C=new ht(y[2],y[3]);return{type:"ease",p0:E,p1:_,p2:S,p3:C}}var I=yr.getPointInCurve(i),R=yr.getPointInCurve(s);e?R.y=I.y:r&&(I.y=R.y);{var O=new ht((R.x-I.x)/3+I.x,(R.y-I.y)/3+I.y),F=new ht((R.x-I.x)/3*2+I.x,(R.y-I.y)/3*2+I.y);return{type:"line",p0:I,p1:O,p2:F,p3:R,isHold:e||r,leftHoldLine:e,rightHoldLine:r}}}var Ec=function(){function i(){}return i.slerpFlat=function(n,t,e,r){var a=t.x,o=t.y,u=t.z,l=t.w,h=e.x,c=e.y,f=e.z,d=e.w;if(r===0){n.x=a,n.y=o,n.z=u,n.w=l;return}if(r===1){n.x=h,n.y=c,n.z=f,n.w=d;return}if(l!==d||a!==h||o!==c||u!==f){var v=1-r,p=a*h+o*c+u*f+l*d,g=p>=0?1:-1,x=1-p*p;if(x>Number.EPSILON){var b=Math.sqrt(x),y=Math.atan2(b,p*g);v=Math.sin(v*y)/b,r=Math.sin(r*y)/b}var E=r*g;if(a=a*v+h*E,o=o*v+c*E,u=u*v+f*E,l=l*v+d*E,v===1-r){var _=1/Math.sqrt(a*a+o*o+u*u+l*l);a*=_,o*=_,u*=_,l*=_}}n.x=a,n.y=o,n.z=u,n.w=l},i}(),Rn=0,ao=1,wc=2,Sc=3,xr="not_implement",jt=function(){function i(n){this.onCreate(n)}var s=i.prototype;return s.onCreate=function(t){throw new Error(xr)},s.getIntegrateValue=function(t,e,r){throw new Error(xr)},s.getIntegrateByTime=function(t,e){throw new Error(xr)},s.getValue=function(t){throw new Error(xr)},s.getMaxTime=function(){throw new Error(xr)},s.toUniform=function(t){throw new Error(xr)},s.map=function(t){throw new Error(xr)},s.scaleXCoord=function(t){return this},s.toData=function(){throw new Error(xr)},i.getAllData=function(t,e){for(var r=new(e?uc:Float32Array)(t.index*4),a=0,o=0,u=t.curves;a<u.length;a++){var l=u[a].toData();r.set(l,o),o+=l.length}return e?r.data:r},i}(),hr=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){this.value=e},n.getIntegrateValue=function(e,r,a){return this.value*(r-e)},n.getIntegrateByTime=function(e,r){return .5*this.value*(r*r-e*e)},n.getValue=function(e){return this.value},n.toUniform=function(){return new Float32Array([0,this.value,0,0])},n.map=function(e){var r=this.value;return this.value=e(r),this},n.getMaxTime=function(){return 0},s}(jt),Cc=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){this.items=e},n.getValue=function(e){var r=this.items;return r[Math.floor(Math.random()*r.length)]},n.map=function(e){return this.items=this.items.map(e),this},s}(jt),$e=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){this.min=e[0],this.max=e[1]},n.getValue=function(e,r){var a=r!=null?r:Math.random();return this.min+a*(this.max-this.min)},n.getIntegrateValue=function(e,r,a){var o=a!=null?a:1;return(this.min+o*(this.max-this.min))*(r-e)},n.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},n.map=function(e){return this.min=e(this.min),this.max=e(this.max),this},s}(jt),Ac=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){this.min=e[0],this.max=e[1]},n.getValue=function(e){for(var r=this.min,a=this.max,o=[],u=0;u<r.length;u++){var l=Math.random();o[u]=r[u]*(1-l)+a[u]*l}return o},n.map=function(e){return this.min=this.min.map(e),this.max=this.max.map(e),this},s}(jt),Mc=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){this.min=e[0],this.max=e[1],this.xCoord=1},n.getValue=function(e){return e/=this.xCoord,this.min*(1-e)+this.max*e},n.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},n.getIntegrateValue=function(e,r,a){a===void 0&&(a=1);var o=this.min,u=this.max,l=this.xCoord*a,h=o+(u-o)*(r/l),c=o+(u-o)*(e/l);return((h+o)*r-(c+o)*e)/2},n.getIntegrateByTime=function(e,r){return aa(r,0,this.xCoord,this.min,this.max)-aa(e,0,this.xCoord,this.min,this.max)},n.map=function(e){return this.min=e(this.min),this.max=e(this.max),this},n.scaleXCoord=function(e){return this.xCoord=e,this},s}(jt),Ic=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){this.stops=Va(e)},n.getStops=function(){return this.stops},n.getValue=function(e){var r=this.stops;if(r.length===0)return[0,0,0,0];if(e<=r[0].time)return r[0].color.toArray();var a=r.length-1;if(e>=r[a].time)return r[a].color.toArray();for(var o=0;o<a;o++){var u=r[o],l=r[o+1];if(u.time<=e&&l.time>e){var h=(e-u.time)/(l.time-u.time);return ka(u.color.toArray(),l.color.toArray(),h,!0)}}return r[a].color.toArray()},s}(jt),Pc=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){this.keys=e.map(function(o){return o.slice?o.slice(0,2):[o.time,o.value]}).sort(function(o,u){return o[0]-u[0]});var r=this.keys[this.keys.length-1];r[0]<1&&this.keys.push([1,r[1]]);var a=this.keys[0];a[0]>0&&this.keys.unshift([0,a[1]]),this.isLineSeg=!0},n.getValue=function(e){var r=this.keys;if(e<r[0][0])return r[0][1];for(var a=r.length-1,o=0;o<a;o++){var u=r[o],l=r[o+1],h=u[0],c=l[0];if(e>=h&&e<=c){var f=(e-h)/(c-h),d=u[1];return d+f*(l[1]-d)}}return r[a][1]},n.getIntegrateValue=function(e,r,a){return a===void 0&&(a=1),(this.integrate(r,!1)-this.integrate(e,!1))*a},n.getIntegrateByTime=function(e,r){return this.integrate(r,!0)-this.integrate(e,!0)},n.integrate=function(e,r){var a=this.keys;if(e<=a[0][0])return 0;for(var o=0,u=a.length-1,l=r?aa:Lc,h=0;h<u;h++){var c=a[h],f=a[h+1],d=c[0],v=f[0];if(e>d&&e<=v)return o+l(e,d,v,c[1],f[1]);o+=l(v,d,v,c[1],f[1])}return o},n.toData=function(){for(var e=this.keys,r=new Float32Array(Math.ceil(e.length/2)*4),a=0,o=0;a<e.length;a++,o+=2)r.set(e[a],o);return r.set(e[e.length-1],r.length-2),r},n.toUniform=function(e){var r=e.index,a=this.keys,o=Math.ceil(a.length/2);return e.lineSegCount+=o,e.curves.push(this),e.index+=o,e.max=Math.max(e.max,o),new Float32Array([3,r,o,0])},n.map=function(e){return this.keys.forEach(function(r){return r[1]=e(r[1])}),this},n.scaleXCoord=function(e){return this.keys.forEach(function(r){return r[0]=e*r[0]}),this},s}(jt),Rc=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){this.keys=e[0],this.values=e[1]},n.getValue=function(e){for(var r=this.keys,a=this.values,o=0;o<r.length-1;o++){var u=r[o],l=r[o+1];if(u[0]<=e&&l[0]>=e){var h=l[1]-u[1],c=void 0;if(h===0)c=(e-u[0])/(l[0]-u[0]);else{var f=Nc(e,u,l);c=(f-u[1])/h}return this.calculateVec(o,c)}}return e<=r[0][0]?a[0].slice():a[a.length-1].slice()},n.calculateVec=function(e,r){for(var a=this.values[e],o=this.values[e+1],u=[0,0,0],l=0;l<a.length;l++)u[l]=a[l]*(1-r)+o[l]*r;return u},s}(jt),Fc=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){var r=e[0],a=e[1],o=e[2];if(this.curveSegments={},!!o.length){for(var u=0;u<r.length-1;u++){var l=r[u],h=r[u+1],c=new D(a[u][0],a[u][1],a[u][2]),f=new D(a[u+1][0],a[u+1][1],a[u+1][2]),d=new D(o[2*u][0],o[2*u][1],o[2*u][2]),v=new D(o[2*u+1][0],o[2*u+1][1],o[2*u+1][2]),p=el(l,h),g=p.points,x=p.curve,b=p.timeInterval,y=p.valueInterval,E=g[0],_=g[g.length-1],S=new Tc(c,f,d,v);this.curveSegments[E.x+"&"+_.x]={points:g,timeInterval:b,valueInterval:y,easingCurve:x,pathCurve:S,timeStart:Number(E.x),timeEnd:Number(_.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},n.getValue=function(e){var r=Ht(e,5),a=0,o=new D,u=this.keyTimeData;if(!u.length)return o;var l=this.curveSegments[u[0]].timeStart,h=this.curveSegments[u[u.length-1]].timeEnd;if(r<=l){var c=this.curveSegments[u[0]].pathCurve;return o=c.getPointInPercent(0),o}if(r>=h){var f=this.curveSegments[u[u.length-1]].pathCurve;return o=f.getPointInPercent(1),o}for(var d=0;d<u.length;d++){var v=this.curveSegments[u[d]].timeStart,p=this.curveSegments[u[d]].timeEnd;if(r>=Number(v)&&r<Number(p)){var g=this.curveSegments[u[d]].pathCurve;a=this.getPercValue(u[d],r),o=g.getPointInPercent(a)}}return o},n.getPercValue=function(e,r){var a=this.curveSegments[e],o=a.points,u=o[0],l=a.timeInterval,h=Ht((r-u.x)/l,4),c=a.easingCurve.getValue(h);return he(c,0,1)},n.getMaxTime=function(){var e=this.keyTimeData;return this.curveSegments[e[e.length-1]].timeEnd},s}(jt),Oc=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){var r=e[0],a=e[1],o=e[2];if(this.curveSegments={},!!o.length)for(var u=0;u<r.length-1;u++){var l=r[u],h=r[u+1],c=Zt.fromArray(a[u]),f=Zt.fromArray(a[u+1]),d=Zt.fromArray(o[2*u]),v=Zt.fromArray(o[2*u+1]),p=el(l,h),g=p.points,x=p.curve,b=p.timeInterval,y=p.valueInterval,E=g[0],_=g[g.length-1],S=new _c(c,f,d,v);this.curveSegments[E.x+"&"+_.x]={points:g,timeInterval:b,valueInterval:y,easingCurve:x,pathCurve:S}}},n.getValue=function(e){var r=0,a=Ht(e,5),o=Object.keys(this.curveSegments),u=Number(o[0].split("&")[0]),l=Number(o[o.length-1].split("&")[1]);if(a<=u){var h=this.curveSegments[o[0]].pathCurve;return h.getPointInPercent(0)}
7if(a>=l){var c=this.curveSegments[o[o.length-1]].pathCurve;return c.getPointInPercent(1)}for(var f=0;f<o.length;f++){var d=o[f].split("&"),v=d[0],p=d[1];if(a>=Number(v)&&a<Number(p)){var g=this.curveSegments[o[f]].pathCurve;return r=this.getPercValue(o[f],a),g.getPointInPercent(r)}}var x=this.curveSegments[o[0]].pathCurve;return x.getPointInPercent(0)},n.getPercValue=function(e,r){var a=this.curveSegments[e],o=a.points,u=o[0],l=a.timeInterval,h=Ht((r-u.x)/l,4),c=a.easingCurve.getValue(h);return he(c,0,1)},n.getMaxTime=function(){var e=Object.keys(this.curveSegments);return Number(e[e.length-1].split("&")[1])},s}(jt);function Lc(i,s,n,t,e){var r=i-s;return(t+t+(e-t)*r/(n-s))*r/2}function aa(i,s,n,t,e){var r=i*i,a=r*i,o=s*s,u=o*s;return(2*a*(t-e)+3*r*(s*e-n*t)-u*(2*t+e)+3*o*n*t)/(6*(s-n))}function Nc(i,s,n){var t=n[Rn]-s[Rn],e=s[Sc]*t,r=n[wc]*t,a=(i-s[Rn])/t,o=a*a,u=o*a,l=2*u-3*o+1,h=u-2*o+a,c=u-o,f=-2*u+3*o;return l*s[ao]+h*e+c*r+f*n[ao]}function sa(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function il(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(s){}return(il=function(){return!!i})()}function ti(i,s,n){return il()?ti=Reflect.construct:ti=function(e,r,a){var o=[null];o.push.apply(o,r);var u=Function.bind.apply(e,o),l=new u;return a&&wi(l,a.prototype),l},ti.apply(null,arguments)}var Vc=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=new Dt,t}var n=s.prototype;return n.onCreate=function(e){this.xCurve=J(e[0]),this.yCurve=J(e[1]),this.zCurve=J(e[2]),this.wCurve=J(e[3])},n.getValue=function(e){var r=this.xCurve.getValue(e),a=this.yCurve.getValue(e),o=this.zCurve.getValue(e),u=this.wCurve.getValue(e);return this.value.set(r,a,o,u),this.value},n.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},s}(jt),kc=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=new D,t}var n=s.prototype;return n.onCreate=function(e){this.xCurve=J(e[0]),this.yCurve=J(e[1]),this.zCurve=J(e[2])},n.getValue=function(e){var r=this.xCurve.getValue(e),a=this.yCurve.getValue(e),o=this.zCurve.getValue(e);return this.value.set(r,a,o),this.value},n.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},s}(jt),Dc=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=new ht,t}var n=s.prototype;return n.onCreate=function(e){this.xCurve=J(e[0]),this.yCurve=J(e[1])},n.getValue=function(e){var r=this.xCurve.getValue(e),a=this.yCurve.getValue(e);return this.value.set(r,a),this.value},n.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},s}(jt),so;(function(i){i[i.Cubic=0]="Cubic",i[i.Linear=1]="Linear",i[i.Constant=2]="Constant"})(so||(so={}));var oo;(function(i){i[i.None=0]="None",i[i.In=1]="In",i[i.Out=2]="Out",i[i.Both=3]="Both"})(oo||(oo={}));var zc=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onCreate=function(e){this.keyFrames=Uc(e);var r=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var a=0;a<r.length-1;a++){var o=r[a],u=r[a+1],l=Bc(o,u),h=l.points,c=l.curve,f=l.timeInterval,d=l.valueInterval,v=h[0],p=h[h.length-1];this.keys.push([].concat(v.toArray(),h[1].toArray())),this.keys.push([].concat(p.toArray(),h[2].toArray()));var g={points:h,timeInterval:f,valueInterval:d,curve:c,timeStart:Number(v.x),timeEnd:Number(p.x)};this.curveMap[v.x+"&"+p.x]=g,this.curveInfos.push(g)}},n.getValue=function(e){var r=0,a=this.keyFrames.length;if(e<=this.keyFrames[0].time)r=this.keyFrames[0].value;else if(e<this.keyFrames[a-1].time)for(var o=0;o<this.keyFrames.length-1;o++){var u=this.keyFrames[o].time,l=this.keyFrames[o+1].time;if(e>=u&&e<l){var h=this.curveInfos[o],c=h.points[0],f=h.timeInterval,d=h.valueInterval,v=(e-c.x)/f,p=0;this.keyFrames[o].tangentMode===1?p=v:p=h.curve.getValue(v),r=c.y+d*p;break}}else e>=this.keyFrames[a-1].time&&(r=this.keyFrames[a-1].value);return r},n.getIntegrateValue=function(e,r,a){a===void 0&&(a=1);var o=(r-e)/a,u=0,l=Object.keys(this.curveMap),h=this.curveMap[l[0]].timeStart;if(o<=h)return 0;for(var c=0;c<l.length;c++){var f=this.curveMap[l[c]].timeStart,d=this.curveMap[l[c]].timeEnd;if(o>=Number(d)&&(u+=a*this.getCurveIntegrateValue(l[c],Number(d))),o>=Number(f)&&o<Number(d)){u+=a*this.getCurveIntegrateValue(l[c],o);break}}return u},n.getIntegrateByTime=function(e,r){return this.getIntegrateValue(0,r)-this.getIntegrateValue(0,e)},n.getCurveIntegrateValue=function(e,r){for(var a=this.curveMap[e],o=a.points,u=o[0],l=a.timeInterval,h=a.valueInterval,c=20,f=0,d=(r-u.x)/c,v=0;v<=c;v++){var p=v*d,g=p/l,x=u.y+h*a.curve.getValue(g);v===0||v===c?f+=x:v%2===1?f+=4*x:f+=2*x}return f*=d/3,f},n.toUniform=function(e){var r=e.index,a=this.keys.length;return e.curves.push(this),e.index=r+a,e.max=Math.max(e.max,a),e.curveCount+=a,new Float32Array([5,r+1/a,r,a])},n.toData=function(){for(var e=this.keys,r=new Float32Array(e.length*4),a=0,o=0;a<e.length;a++,o+=4)r.set(e[a],o);return r},n.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},s}(jt);function Bc(i,s){var n=new ht(i.time,i.value),t=new ht,e=new ht,r=new ht,a=i.weightedMode===2||i.weightedMode===3||s.weightedMode===1||s.weightedMode===3,o=i.tangentMode===2,u=(a?i.outWeight:1)*(s.time-i.time)/3;t.x=i.time+u,t.y=i.value+u*(o?0:i.outSlope);var l=(a?s.inWeight:1)*(s.time-i.time)/3;e.x=s.time-l,e.y=s.value-l*(o?0:s.inSlope),r.x=s.time,r.y=o?i.value:s.value,
7ne(e),ne(r);var h=r.x-n.x,c=r.y-n.y,f,d,v=Ht((t.x-n.x)/h,5),p=Ht((e.x-n.x)/h,5);pr(c,0)?f=d=NaN:(f=Ht((t.y-n.y)/c,5),d=Ht((e.y-n.y)/c,5)),v<0&&(console.error("Invalid bezier points, x1 < 0",n,t,e,r),v=0),p<0&&(console.error("Invalid bezier points, x2 < 0",n,t,e,r),p=0),v>1&&(console.error("Invalid bezier points, x1 >= 1",n,t,e,r),v=1),p>1&&(console.error("Invalid bezier points, x2 >= 1",n,t,e,r),p=1);var g=("bez_"+v+"_"+f+"_"+p+"_"+d).replace(/\./g,"p"),x;return Jr[g]?x=Jr[g]:(pr(c,0)?x=new bi:a?x=new bi(v,f,p,d):x=new bi(f,d),Jr[g]=x),{points:[n,t,e,r],timeInterval:h,valueInterval:c,curve:x}}function Uc(i){for(var s=i,n=[],t=[],e={x:0,y:0},r=0;r<s.length;r++){var a=s[r],o=r+1<s.length?s[r+1]:s[r],u=rl(a,o),l=u.p0,h=u.p1,c=u.p2,f=u.p3,d=u.type;ne(c),ne(f);var v={leftControl:e,value:l,rightControl:h,tangentMode:d==="line"?1:0};a[0]===Lt.HOLD&&(v.tangentMode=2),t.push(v),e=c}for(var p=function(C,I){return(I.y-C.y)/(I.x-C.x+fr)},g=0;g<t.length;g++){var x=t[g].leftControl,b=t[g].value,y=t[g].rightControl,E=0,_=0;g>0&&(E=p(x,b)),g<t.length-1&&(_=p(b,y));var S={time:b.x,value:b.y,inSlope:E,outSlope:_,inWeight:0,outWeight:0,tangentMode:t[g].tangentMode,weightedMode:3};n.push(S),g>0&&(S.inWeight=(b.x-x.x)/((b.x-t[g-1].value.x)/3)),g+1<t.length&&(S.outWeight=(y.x-b.x)/((t[g+1].value.x-b.x)/3))}return n}var Gc=27,ue,uo=(ue={},ue[dt.RANDOM]=function(i){return Z(i[0],Array)?new Ac(i):new $e(i)},ue[dt.CONSTANT]=function(i){return new hr(i)},ue[dt.CONSTANT_VEC2]=function(i){return new hr(i)},ue[dt.CONSTANT_VEC3]=function(i){return new hr(i)},ue[dt.CONSTANT_VEC4]=function(i){return new hr(i)},ue[dt.RGBA_COLOR]=function(i){return new hr(i)},ue[dt.COLORS]=function(i){return new Cc(i.map(function(s){return Na(s,!1)}))},ue[dt.LINE]=function(i){return i.length===2&&i[0][0]===0&&i[1][0]===1?new Mc([i[0][1],i[1][1]]):new Pc(i)},ue[dt.GRADIENT_COLOR]=function(i){return new Ic(i)},ue[dt.LINEAR_PATH]=function(i){return new Rc(i)},ue[dt.BEZIER_CURVE]=function(i){return i.length===1?new hr(i[0][1][1]):new zc(i)},ue[dt.BEZIER_CURVE_PATH]=function(i){return i[0].length===1?new hr(ti(D,[].concat(i[1][0]))):new Fc(i)},ue[dt.BEZIER_CURVE_QUAT]=function(i){return i[0].length===1?new hr(ti(Zt,[].concat(i[1][0]))):new Oc(i)},ue[dt.COLOR_CURVE]=function(i){return new Wc(i)},ue[dt.VECTOR4_CURVE]=function(i){return new Vc(i)},ue[dt.VECTOR2_CURVE]=function(i){return new Dc(i)},ue[Gc]=function(i){return new kc(i)},ue);function J(i){if(!i||!isNaN(+i))return new hr(i||0);if(Z(i,jt))return i;if(za(uo[i[0]]))return uo[i[0]](i[1]);throw new Error("ValueType: "+i[0]+" is not supported, see "+Qr["ValueType: 21/22 is not supported"]+".")}var Wc=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.value=new Ct,t}var n=s.prototype;return n.onCreate=function(e){this.rCurve=J(e[0]),this.gCurve=J(e[1]),this.bCurve=J(e[2]),this.aCurve=J(e[3])},n.getValue=function(e){var r=this.rCurve.getValue(e),a=this.gCurve.getValue(e),o=this.bCurve.getValue(e),u=this.aCurve.getValue(e);return this.value.set(r,a,o,u),this.value},n.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},s}(jt),oa=function(){function i(n,t){n===void 0&&(n=0),t===void 0&&(t=0),this.x=0,this.y=0,this.x=n,this.y=t}var s=i.prototype;return s.clone=function(){return new i(this.x,this.y)},s.copyFrom=function(t){return this.set(t.x,t.y),this},s.copyTo=function(t){return t.set(this.x,this.y),t},s.equals=function(t){return t.x===this.x&&t.y===this.y},s.set=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=t),this.x=t,this.y=e,this},Mt(i,null,[{key:"shared",get:function(){return Fn.x=0,Fn.y=0,Fn}}]),i}(),Fn=new oa,Hc=1e-4,lo=1e-4;function ho(i,s,n,t,e,r,a,o){var u=i-n*e,l=s-t*e,h=i+n*r,c=s+t*r,f,d;a?(f=t,d=-n):(f=-t,d=n);var v=u+f,p=l+d,g=h+f,x=c+d;return o.push(v,p),o.push(g,x),2}function Lr(i,s,n,t,e,r,a,o){var u=n-i,l=t-s,h=Math.atan2(u,l),c=Math.atan2(e-i,r-s);o&&h<c?h+=Math.PI*2:!o&&h>c&&(c+=Math.PI*2);var f=h,d=c-h,v=Math.abs(d),p=Math.sqrt(u*u+l*l),g=(15*v*Math.sqrt(p)/Math.PI>>0)+1,x=d/g;if(f+=x,o){a.push(i,s),a.push(n,t);for(var b=1,y=f;b<g;b++,y+=x)a.push(i,s),a.push(i+Math.sin(y)*p,s+Math.cos(y)*p);a.push(i,s),a.push(e,r)}else{a.push(n,t),a.push(i,s);for(var E=1,_=f;E<g;E++,_+=x)a.push(i+Math.sin(_)*p,s+Math.cos(_)*p),a.push(i,s);a.push(e,r),a.push(i,s)}return g*2}function Xc(i){var s=i.length;if(s<6)return 1;for(var n=0,t=0,e=i[s-2],r=i[s-1];t<s;t+=2){var a=i[t],o=i[t+1];n+=(a-e)*(o+r),e=a,r=o}return n<0?-1:1}function jc(i,s,n,t,e,r,a,o,u){var l=Hc;if(i.length!==0){var h=s,c=h.alignment;if(s.alignment!==.5){var f=Xc(i);c=(c-.5)*f+.5}var d=new oa(i[0],i[1]),v=new oa(i[i.length-2],i[i.length-1]),p=t,g=Math.abs(d.x-v.x)<l&&Math.abs(d.y-v.y)<l;if(p){i=i.slice(),g&&(i.pop(),i.pop(),v.set(i[i.length-2],i[i.length-1]));var x=(d.x+v.x)*.5,b=(v.y+d.y)*.5;i.unshift(x,b),i.push(x,b)}var y=e,E=i.length/2,_=i.length,S=y.length/2,C=h.width/2,I=C*C,R=h.miterLimit*h.miterLimit,O=i[0],F=i[1],L=i[2],V=i[3],U=0,W=0,G=-(F-V),B=O-L,X=0,H=0,Y=Math.sqrt(G*G+B*B)+fr;G/=Y,B/=Y,G*=C,B*=C;var K=c,z=(1-K)*2,Q=K*2;p||(h.cap===dr.Round?_+=Lr(O-G*(z-Q)*.5,F-B*(z-Q)*.5,O-G*z,F-B*z,O+G*Q,F+B*Q,y,!0)+2:h.cap===dr.Square&&(_+=ho(O,F,G,B,z,Q,!0,y))),y.push(O-G*z,F-B*z),y.push(O+G*Q,F+B*Q);for(var it=1;it<E-1;++it){O=i[(it-1)*2],F=i[(it-1)*2+1],L=i[it*2],V=i[it*2+1],U=i[(it+1)*2],W=i[(it+1)*2+1],G=-(F-V),B=O-L,Y=Math.sqrt(G*G+B*B)+fr,G/=Y,B/=Y,G*=C,B*=C,X=-(V-W),H=L-U,Y=Math.sqrt(X*X+H*H)+fr,X/=Y,H/=Y,X*=C,H*=C;var ct=L-O,nt=F-V,yt=L-U,_t=W-V,Vt=ct*yt+nt*_t,mt=nt*yt-_t*ct,at=mt<0;if(Math.abs(mt)<.001*Math.abs(Vt)){y.push(L-G*z,V-B*z),y.push(L+G*Q,V+B*Q),Vt>=0&&(h.join===rr.Round?_+=Lr(L,V,L-G*z,V-B*z,L-X*z,V-H*z,y,!1)+4:_+=2,y.push(L-X*Q,V-H*Q),y.push(L+X*z,V+H*z));continue}var kt=(-G+O)*(-B+V)-(-G+L)*(-B+F),wt=(-X+U)*(-H+V)-(-X+L)*(-H+W),ut=(ct*wt-yt*kt)/mt,qt=(_t*kt-nt*wt)/mt,It=(ut-L)*(ut-L)+(qt-V)*(qt-V),ot=L+(ut-L)*z,At=V+(qt-V)*z,Rt=L-(ut-L)*Q,Ft=V-(qt-V)*Q,se=Math.min(ct*ct+nt*nt,yt*yt+_t*_t),Ot=at?z:Q,Ke=se+Ot*Ot*I,Le=It<=Ke;Le?h.join===rr.Bevel||It/I>R?(at?(y.push(ot,At),y.push(L+G*Q,V+B*Q),y.push(ot,At),y.push(L+X*Q,V+H*Q)):(y.push(L-G*z,V-B*z),y.push(Rt,Ft),y.push(L-X*z,V-H*z),y.push(Rt,Ft)),_+=2):h.join===rr.Round?at?(y.push(ot,At),y.push(L+G*Q,V+B*Q),_+=Lr(L,V,L+G*Q,V+B*Q,L+X*Q,V+H*Q,y,!0)+4,y.push(ot,At),y.push(L+X*Q,V+H*Q)):(y.push(L-G*z,V-B*z),y.push(Rt,Ft),_+=Lr(L,V,L-G*z,V-B*z,L-X*z,V-H*z,y,!1)+4,y.push(L-X*z,V-H*z),y.push(Rt,Ft)):(y.push(ot,At),y.push(Rt,Ft)):(y.push(L-G*z,V-B*z),y.push(L+G*Q,V+B*Q),h.join===rr.Round?at?_+=Lr(L,V,L+G*Q,V+B*Q,L+X*Q,V+H*Q,y,!0)+2:_+=Lr(L,V,L-G*z,V-B*z,L-X*z,V-H*z,y,!1)+2:h.join===rr.Miter&&It/I<=R&&(at?(y.push(Rt,Ft),y.push(Rt,Ft)):(y.push(ot,At),y.push(ot,At)),_+=2),y.push(L-X*z,V-H*z),y.push(L+X*Q,V+H*Q),_+=2)}O=i[(E-2)*2],F=i[(E-2)*2+1],L=i[(E-1)*2],V=i[(E-1)*2+1],G=-(F-V),B=O-L,Y=Math.sqrt(G*G+B*B)+fr,G/=Y,B/=Y,G*=C,B*=C,y.push(L-G*z,V-B*z),y.push(L+G*Q,V+B*Q),p||(h.cap===dr.Round?_+=Lr(L-G*(z-Q)*.5,V-B*(z-Q)*.5,L-G*z,V-B*z,L+G*Q,V+B*Q,y,!1)+2:h.cap===dr.Square&&(_+=ho(L,V,G,B,z,Q,!1,y)));for(var mr=lo*lo,oe=S;oe<_+S-2;++oe)O=y[oe*2],F=y[oe*2+1],L=y[(oe+1)*2],V=y[(oe+1)*2+1],U=y[(oe+2)*2],W=y[(oe+2)*2+1],!(Math.abs(O*(V-W)+L*(W-F)+U*(F-V))<mr)&&o.push(oe,oe+1,oe+2)}}var ui=function(){},co=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},_r={exports:{}};(function(i){var s;function n(m,T){return m.b===T.b&&m.a===T.a}function t(m,T){return m.b<T.b||m.b===T.b&&m.a<=T.a}function e(m,T,w){var A=T.b-m.b,N=w.b-T.b;
7return 0<A+N?A<N?T.a-m.a+A/(A+N)*(m.a-w.a):T.a-w.a+N/(A+N)*(w.a-m.a):0}function r(m,T,w){var A=T.b-m.b,N=w.b-T.b;return 0<A+N?(T.a-w.a)*A+(T.a-m.a)*N:0}function a(m,T){return m.a<T.a||m.a===T.a&&m.b<=T.b}function o(m,T,w){var A=T.a-m.a,N=w.a-T.a;return 0<A+N?A<N?T.b-m.b+A/(A+N)*(m.b-w.b):T.b-w.b+N/(A+N)*(w.b-m.b):0}function u(m,T,w){var A=T.a-m.a,N=w.a-T.a;return 0<A+N?(T.b-w.b)*A+(T.b-m.b)*N:0}function l(m){return t(m.b.a,m.a)}function h(m){return t(m.a,m.b.a)}function c(m,T,w,A){return m=0>m?0:m,w=0>w?0:w,m<=w?w===0?(T+A)/2:T+m/(m+w)*(A-T):A+w/(m+w)*(T-A)}function f(m){var T=x(m.b);return y(T,m.c),y(T.b,m.c),E(T,m.a),T}function d(m,T){var w=!1,A=!1;m!==T&&(T.a!==m.a&&(A=!0,S(T.a,m.a)),T.d!==m.d&&(w=!0,C(T.d,m.d)),b(T,m),A||(y(T,m.a),m.a.c=m),w||(E(T,m.d),m.d.a=m))}function v(m){var T=m.b,w=!1;m.d!==m.b.d&&(w=!0,C(m.d,m.b.d)),m.c===m?S(m.a,null):(m.b.d.a=ot(m),m.a.c=m.c,b(m,ot(m)),w||E(m,m.d)),T.c===T?(S(T.a,null),C(T.d,null)):(m.d.a=ot(T),T.a.c=T.c,b(T,ot(T))),_(m)}function p(m){var T=x(m),w=T.b;return b(T,m.e),T.a=m.b.a,y(w,T.a),T.d=w.d=m.d,T=T.b,b(m.b,ot(m.b)),b(m.b,T),m.b.a=T.a,T.b.a.c=T.b,T.b.d=m.b.d,T.f=m.f,T.b.f=m.b.f,T}function g(m,T){var w=!1,A=x(m),N=A.b;return T.d!==m.d&&(w=!0,C(T.d,m.d)),b(A,m.e),b(N,T),A.a=m.b.a,N.a=T.a,A.d=N.d=m.d,m.d.a=N,w||E(A,m.d),A}function x(m){var T=new It,w=new It,A=m.b.h;return w.h=A,A.b.h=T,T.h=m,m.b.h=w,T.b=w,T.c=T,T.e=w,w.b=T,w.c=w,w.e=T}function b(m,T){var w=m.c,A=T.c;w.b.e=T,A.b.e=m,m.c=A,T.c=w}function y(m,T){var w=T.f,A=new Rt(T,w);w.e=A,T.f=A,w=A.c=m;do w.a=A,w=w.c;while(w!==m)}function E(m,T){var w=T.d,A=new qt(T,w);w.b=A,T.d=A,A.a=m,A.c=T.c,w=m;do w.d=A,w=w.e;while(w!==m)}function _(m){var T=m.h;m=m.b.h,T.b.h=m,m.b.h=T}function S(m,T){var w=m.c,A=w;do A.a=T,A=A.c;while(A!==w);w=m.f,A=m.e,A.f=w,w.e=A}function C(m,T){var w=m.a,A=w;do A.d=T,A=A.e;while(A!==w);w=m.d,A=m.b,A.d=w,w.b=A}function I(m){var T=0;return Math.abs(m[1])>Math.abs(m[0])&&(T=1),Math.abs(m[2])>Math.abs(m[T])&&(T=2),T}var R=4*1e150;function O(m,T){m.f+=T.f,m.b.f+=T.b.f}function F(m,T,w){return m=m.a,T=T.a,w=w.a,T.b.a===m?w.b.a===m?t(T.a,w.a)?0>=r(w.b.a,T.a,w.a):0<=r(T.b.a,w.a,T.a):0>=r(w.b.a,m,w.a):w.b.a===m?0<=r(T.b.a,m,T.a):(T=e(T.b.a,m,T.a),m=e(w.b.a,m,w.a),T>=m)}function L(m){m.a.i=null;var T=m.e;T.a.c=T.c,T.c.a=T.a,m.e=null}function V(m,T){v(m.a),m.c=!1,m.a=T,T.i=m}function U(m){var T=m.a.a;do m=Ue(m);while(m.a.a===T);return m.c&&(T=g(de(m).a.b,m.a.e),V(m,T),m=Ue(m)),m}function W(m,T,w){var A=new Or;return A.a=w,A.e=Vt(m.f,T.e,A),w.i=A}function G(m,T){switch(m.s){case 100130:return(T&1)!==0;case 100131:return T!==0;case 100132:return 0<T;case 100133:return 0>T;case 100134:return 2<=T||-2>=T}return!1}function B(m){var T=m.a,w=T.d;w.c=m.d,w.a=T,L(m)}function X(m,T,w){for(m=T,T=T.a;m!==w;){m.c=!1;var A=de(m),N=A.a;if(N.a!==T.a){if(!A.c){B(m);break}N=g(T.c.b,N.b),V(A,N)}T.c!==N&&(d(ot(N),N),d(T,N)),B(m),T=A.a,m=A}return T}function H(m,T,w,A,N,j){var q=!0;do W(m,T,w.b),w=w.c;while(w!==A);for(N===null&&(N=de(T).a.b.c);A=de(T),w=A.a.b,w.a===N.a;)w.c!==N&&(d(ot(w),w),d(ot(N),w)),A.f=T.f-w.f,A.d=G(m,A.f),T.b=!0,!q&&Q(m,T)&&(O(w,N),L(T),v(N)),q=!1,T=A,N=w;T.b=!0,j&&ct(m,T)}function Y(m,T,w,A,N){var j=[T.g[0],T.g[1],T.g[2]];T.d=null,T.d=m.o&&m.o(j,w,A,m.c)||null,T.d===null&&(N?m.n||(ut(m,100156),m.n=!0):T.d=w[0])}function K(m,T,w){var A=[null,null,null,null];A[0]=T.a.d,A[1]=w.a.d,Y(m,T.a,A,[.5,.5,0,0],!1),d(T,w)}function z(m,T,w,A,N){var j=Math.abs(T.b-m.b)+Math.abs(T.a-m.a),q=Math.abs(w.b-m.b)+Math.abs(w.a-m.a),et=N+1;A[N]=.5*q/(j+q),A[et]=.5*j/(j+q),m.g[0]+=A[N]*T.g[0]+A[et]*w.g[0],m.g[1]+=A[N]*T.g[1]+A[et]*w.g[1],m.g[2]+=A[N]*T.g[2]+A[et]*w.g[2]}function Q(m,T){var w=de(T),A=T.a,N=w.a;if(t(A.a,N.a)){if(0<r(N.b.a,A.a,N.a))return!1;if(!n(A.a,N.a))p(N.b),d(A,ot(N)),T.b=w.b=!0;else if(A.a!==N.a){var w=m.e,j=A.a.h;if(0<=j){var w=w.b,q=w.d,et=w.e,ft=w.c,gt=ft[j];q[gt]=q[w.a],ft[q[gt]]=gt,gt<=--w.a&&(1>=gt||t(et[q[gt>>1]],et[q[gt]])?Pe(w,gt):Xr(w,gt)),et[j]=null,ft[j]=w.b,w.b=j}else for(w.c[-(j+1)]=null;0<w.a&&w.c[w.d[w.a-1]]===null;)--w.a;K(m,ot(N),A)}}else{if(0>r(A.b.a,N.a,A.a))return!1;Ue(T).b=T.b=!0,p(A.b),d(ot(N),A)}return!0}function it(m,T){var w=de(T),A=T.a,N=w.a,j=A.a,q=N.a,et=A.b.a,ft=N.b.a,gt=new Rt;if(r(et,m.a,j),r(ft,m.a,q),j===q||Math.min(j.a,et.a)>Math.max(q.a,ft.a))return!1;if(t(j,q)){if(0<r(ft,j,q))return!1}else if(0>r(et,q,j))return!1;var Yt=et,zt=j,Bt=ft,ve=q,Et,Jt;if(t(Yt,zt)||(Et=Yt,Yt=zt,zt=Et),t(Bt,ve)||(Et=Bt,Bt=ve,ve=Et),t(Yt,Bt)||(Et=Yt,Yt=Bt,Bt=Et,Et=zt,zt=ve,ve=Et),t(Bt,zt)?t(zt,ve)?(Et=e(Yt,Bt,zt),Jt=e(Bt,zt,ve),0>Et+Jt&&(Et=-Et,Jt=-Jt),gt.b=c(Et,Bt.b,Jt,zt.b)):(Et=r(Yt,Bt,zt),Jt=-r(Yt,ve,zt),0>Et+Jt&&(Et=-Et,Jt=-Jt),gt.b=c(Et,Bt.b,Jt,ve.b)):gt.b=(Bt.b+zt.b)/2,a(Yt,zt)||(Et=Yt,Yt=zt,zt=Et),a(Bt,ve)||(Et=Bt,Bt=ve,ve=Et),a(Yt,Bt)||(Et=Yt,Yt=Bt,Bt=Et,Et=zt,zt=ve,ve=Et),a(Bt,zt)?a(zt,ve)?(Et=o(Yt,Bt,zt),Jt=o(Bt,zt,ve),0>Et+Jt&&(Et=-Et,Jt=-Jt),gt.a=c(Et,Bt.a,Jt,zt.a)):(Et=u(Yt,Bt,zt),Jt=-u(Yt,ve,zt),0>Et+Jt&&(Et=-Et,Jt=-Jt),gt.a=c(Et,Bt.a,Jt,ve.a)):gt.a=(Bt.a+zt.a)/2,t(gt,m.a)&&(gt.b=m.a.b,gt.a=m.a.a),Yt=t(j,q)?j:q,t(Yt,gt)&&(gt.b=Yt.b,gt.a=Yt.a),n(gt,j)||n(gt,q))return Q(m,T),!1;if(!n(et,m.a)&&0<=r(et,m.a,gt)||!n(ft,m.a)&&0>=r(ft,m.a,gt)){if(ft===m.a)return p(A.b),d(N.b,A),T=U(T),A=de(T).a,X(m,de(T),w),H(m,T,ot(A),A,A,!0),!0;if(et===m.a){p(N.b),d(A.e,ot(N)),j=w=T,q=j.a.b.a;do j=Ue(j);while(j.a.b.a===q);return T=j,j=de(T).a.b.c,w.a=ot(N),N=X(m,w,null),H(m,T,N.c,A.b.c,j,!0),!0}return 0<=r(et,m.a,gt)&&(Ue(T).b=T.b=!0,p(A.b),A.a.b=m.a.b,A.a.a=m.a.a),0>=r(ft,m.a,gt)&&(T.b=w.b=!0,p(N.b),N.a.b=m.a.b,N.a.a=m.a.a),!1}return p(A.b),p(N.b),d(ot(N),A),A.a.b=gt.b,A.a.a=gt.a,A.a.h=Ot(m.e,A.a),A=A.a,N=[0,0,0,0],gt=[j.d,et.d,q.d,ft.d],A.g[0]=A.g[1]=A.g[2]=0,z(A,j,et,N,0),z(A,q,ft,N,2),Y(m,A,gt,N,!0),Ue(T).b=T.b=w.b=!0,!1}function ct(m,T){for(var w=de(T);;){for(;w.b;)T=w,w=de(w);if(!T.b&&(w=T,T=Ue(T),T===null||!T.b))break;T.b=!1;var A=T.a,N=w.a,j;if(j=A.b.a!==N.b.a)t:{j=T;var q=de(j),et=j.a,ft=q.a,gt=void 0;if(t(et.b.a,ft.b.a)){if(0>r(et.b.a,ft.b.a,et.a)){j=!1;break t}Ue(j).b=j.b=!0,gt=p(et),d(ft.b,gt),gt.d.c=j.d}else{if(0<r(ft.b.a,et.b.a,ft.a)){j=!1;break t}j.b=q.b=!0,gt=p(ft),d(et.e,ft.b),gt.b.d.c=j.d}j=!0}if(j&&(w.c?(L(w),v(N),w=de(T),N=w.a):T.c&&(L(T),v(A),T=Ue(w),A=T.a)),A.a!==N.a){if(A.b.a===N.b.a||T.c||w.c||A.b.a!==m.a&&N.b.a!==m.a)Q(m,T);else if(it(m,T))break}A.a===N.a&&A.b.a===N.b.a&&(O(N,A),L(T),v(A),T=Ue(w))}}function nt(m,T){m.a=T;for(var w=T.c;w.i===null;)if(w=w.c,w===T.c){var w=m,A=T,q=new Or;q.a=A.c.b;var N=w.f,et=N.a;do et=et.a;while(et.b!==null&&!N.c(N.b,q,et.b));var N=et.b,j=de(N),q=N.a,et=j.a;if(r(q.b.a,A,q.a)===0)q=N.a,n(q.a,A)||n(q.b.a,A)||(p(q.b),N.c&&(v(q.c),N.c=!1),d(A.c,q),nt(w,A));else{var ft=t(et.b.a,q.b.a)?N:j,j=void 0;N.d||ft.c?(ft===N?j=g(A.c.b,q.e):j=g(et.b.c.b,A.c).b,ft.c?V(ft,j):(q=w,N=W(w,N,j),N.f=Ue(N).f+N.a.f,N.d=G(q,N.f)),nt(w,A)):H(w,N,A.c,A.c,null,!0)}return}if(w=U(w.i),q=de(w),N=q.a,q=X(m,q,null),q.c===N){var N=q,q=N.c,et=de(w),j=w.a,ft=et.a,gt=!1;j.b.a!==ft.b.a&&it(m,w),n(j.a,m.a)&&(d(ot(q),j),w=U(w),q=de(w).a,X(m,de(w),et),gt=!0),n(ft.a,m.a)&&(d(N,ot(ft)),N=X(m,et,null),gt=!0),gt?H(m,w,N.c,q,q,!0):(t(ft.a,j.a)?A=ot(ft):A=j,A=g(N.c.b,A),H(m,w,A,A.c,A.c,!1),A.b.i.c=!0,ct(m,w))}else H(m,w,q.c,N,N,!0)}function yt(m,T){var w=new Or,A=f(m.b);A.a.b=R,A.a.a=T,A.b.a.b=-R,A.b.a.a=T,m.a=A.b.a,w.a=A,w.f=0,w.d=!1,w.c=!1,w.h=!0,w.b=!1,A=m.f,A=Vt(A,A.a,w),w.e=A}function _t(m){this.a=new mt,this.b=m,this.c=F}function Vt(m,T,w){do T=T.c;while(T.b!==null&&!m.c(m.b,T.b,w));return m=new mt(w,T.a,T),T.a.c=m,T.a=m}function mt(m,T,w){this.b=m||null,this.a=T||this,this.c=w||this}function at(){this.d=kt,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 kt=0;s=at.prototype,s.x=function(){wt(this,kt)},s.B=function(m,T){switch(m){case 100142:return;case 100140:switch(T){case 100130:case 100131:case 100132:case 100133:case 100134:this.s=T;return}break;case 100141:this.m=!!T;return;default:ut(this,100900);return}ut(this,100901)},s.y=function(m){switch(m){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:ut(this,100900)}return!1},s.A=function(m,T,w){this.j[0]=m,this.j[1]=T,this.j[2]=w},s.z=function(m,T){var w=T||null;switch(m){case 100100:case 100106:this.h=w;break;case 100104:case 100110:this.l=w;break;case 100101:case 100107:this.k=w;break;case 100102:case 100108:this.i=w;break;case 100103:case 100109:this.p=w;break;case 100105:case 100111:this.o=w;break;case 100112:this.r=w;break;default:ut(this,100900)}}
7,s.C=function(m,T){var w=!1,A=[0,0,0];wt(this,2);for(var N=0;3>N;++N){var j=m[N];-1e150>j&&(j=-1e150,w=!0),1e150<j&&(j=1e150,w=!0),A[N]=j}w&&ut(this,100155),w=this.q,w===null?(w=f(this.b),d(w,w.b)):(p(w),w=w.e),w.a.d=T,w.a.g[0]=A[0],w.a.g[1]=A[1],w.a.g[2]=A[2],w.f=1,w.b.f=-1,this.q=w},s.u=function(m){wt(this,kt),this.d=1,this.b=new At,this.c=m},s.t=function(){wt(this,1),this.d=2,this.q=null},s.v=function(){wt(this,2),this.d=1},s.w=function(){wt(this,1),this.d=kt;var m=this.j[0],T=this.j[1],w=this.j[2],A=!1,N=[m,T,w];if(m===0&&T===0&&w===0){for(var T=[-2*1e150,-2*1e150,-2*1e150],j=[2*1e150,2*1e150,2*1e150],w=[],q=[],A=this.b.c,m=A.e;m!==A;m=m.e)for(var et=0;3>et;++et){var ft=m.g[et];ft<j[et]&&(j[et]=ft,q[et]=m),ft>T[et]&&(T[et]=ft,w[et]=m)}if(m=0,T[1]-j[1]>T[0]-j[0]&&(m=1),T[2]-j[2]>T[m]-j[m]&&(m=2),j[m]>=T[m])N[0]=0,N[1]=0,N[2]=1;else{for(T=0,j=q[m],w=w[m],q=[0,0,0],j=[j.g[0]-w.g[0],j.g[1]-w.g[1],j.g[2]-w.g[2]],et=[0,0,0],m=A.e;m!==A;m=m.e)et[0]=m.g[0]-w.g[0],et[1]=m.g[1]-w.g[1],et[2]=m.g[2]-w.g[2],q[0]=j[1]*et[2]-j[2]*et[1],q[1]=j[2]*et[0]-j[0]*et[2],q[2]=j[0]*et[1]-j[1]*et[0],ft=q[0]*q[0]+q[1]*q[1]+q[2]*q[2],ft>T&&(T=ft,N[0]=q[0],N[1]=q[1],N[2]=q[2]);0>=T&&(N[0]=N[1]=N[2]=0,N[I(j)]=1)}A=!0}for(q=I(N),m=this.b.c,T=(q+1)%3,w=(q+2)%3,q=0<N[q]?1:-1,N=m.e;N!==m;N=N.e)N.b=N.g[T],N.a=q*N.g[w];if(A){for(N=0,A=this.b.a,m=A.b;m!==A;m=m.b)if(T=m.a,!(0>=T.f))do N+=(T.a.b-T.b.a.b)*(T.a.a+T.b.a.a),T=T.e;while(T!==m.a);if(0>N)for(N=this.b.c,A=N.e;A!==N;A=A.e)A.a=-A.a}for(this.n=!1,N=this.b.b,m=N.h;m!==N;m=A)A=m.h,T=m.e,n(m.a,m.b.a)&&m.e.e!==m&&(K(this,T,m),v(m),m=T,T=m.e),T.e===m&&(T!==m&&((T===A||T===A.b)&&(A=A.h),v(T)),(m===A||m===A.b)&&(A=A.h),v(m));for(this.e=N=new Ft,A=this.b.c,m=A.e;m!==A;m=m.e)m.h=Ot(N,m);for(se(N),this.f=new _t(this),yt(this,-R),yt(this,R);(N=Ke(this.e))!==null;){for(;;){t:if(m=this.e,m.a===0)A=Fr(m.b);else if(A=m.c[m.d[m.a-1]],m.b.a!==0&&(m=Fr(m.b),t(m,A))){A=m;break t}if(A===null||!n(A,N))break;A=Ke(this.e),K(this,N.c,A.c)}nt(this,N)}for(this.a=this.f.a.a.b.a.a,N=0;(A=this.f.a.a.b)!==null;)A.h||++N,L(A);for(this.f=null,N=this.e,N.b=null,N.d=null,this.e=N.c=null,N=this.b,m=N.a.b;m!==N.a;m=A)A=m.b,m=m.a,m.e.e===m&&(O(m.c,m),v(m));
7if(!this.n){if(N=this.b,this.m)for(m=N.b.h;m!==N.b;m=A)A=m.h,m.b.d.c!==m.d.c?m.f=m.d.c?1:-1:v(m);else for(m=N.a.b;m!==N.a;m=A)if(A=m.b,m.c){for(m=m.a;t(m.b.a,m.a);m=m.c.b);for(;t(m.a,m.b.a);m=m.e);for(T=m.c.b,w=void 0;m.e!==T;)if(t(m.b.a,T.a)){for(;T.e!==m&&(l(T.e)||0>=r(T.a,T.b.a,T.e.b.a));)w=g(T.e,T),T=w.b;T=T.c.b}else{for(;T.e!==m&&(h(m.c.b)||0<=r(m.b.a,m.a,m.c.b.a));)w=g(m,m.c.b),m=w.b;m=m.e}for(;T.e.e!==m;)w=g(T.e,T),T=w.b}if(this.h||this.i||this.k||this.l)if(this.m){for(N=this.b,A=N.a.b;A!==N.a;A=A.b)if(A.c){this.h&&this.h(2,this.c),m=A.a;do this.k&&this.k(m.a.d,this.c),m=m.e;while(m!==A.a);this.i&&this.i(this.c)}}else{for(N=this.b,A=!!this.l,m=!1,T=-1,w=N.a.d;w!==N.a;w=w.d)if(w.c){m||(this.h&&this.h(4,this.c),m=!0),q=w.a;do A&&(j=q.b.d.c?0:1,T!==j&&(T=j,this.l&&this.l(!!T,this.c))),this.k&&this.k(q.a.d,this.c),q=q.e;while(q!==w.a)}m&&this.i&&this.i(this.c)}if(this.r){for(N=this.b,m=N.a.b;m!==N.a;m=A)if(A=m.b,!m.c){T=m.a,w=T.e,q=void 0;do q=w,w=q.e,q.d=null,q.b.d===null&&(q.c===q?S(q.a,null):(q.a.c=q.c,b(q,ot(q))),j=q.b,j.c===j?S(j.a,null):(j.a.c=j.c,b(j,ot(j))),_(q));while(q!==T);T=m.d,m=m.b,m.d=T,T.b=m}this.r(this.b),this.c=this.b=null;return}}this.b=this.c=null};function wt(m,T){if(m.d!==T)for(;m.d!==T;)if(m.d<T)switch(m.d){case kt:ut(m,100151),m.u(null);break;case 1:ut(m,100152),m.t()}else switch(m.d){case 2:ut(m,100154),m.v();break;case 1:ut(m,100153),m.w()}}function ut(m,T){m.p&&m.p(T,m.c)}function qt(m,T){this.b=m||this,this.d=T||this,this.a=null,this.c=!1}function It(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function ot(m){return m.b.e}function At(){this.c=new Rt,this.a=new qt,this.b=new It,this.d=new It,this.b.b=this.d,this.d.b=this.b}function Rt(m,T){this.e=m||this,this.f=T||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function Ft(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new Le}function se(m){m.d=[];for(var T=0;T<m.a;T++)m.d[T]=T;m.d.sort(function(w){return function(A,N){return t(w[A],w[N])?1:-1}}(m.c)),m.e=!0,oe(m.b)}function Ot(m,T){if(m.e){var w=m.b,A=++w.a;2*A>w.f&&(w.f*=2,w.c=mr(w.c,w.f+1));var N;return w.b===0?N=A:(N=w.b,w.b=w.c[w.b]),w.e[N]=T,w.c[N]=A,w.d[A]=N,w.h&&Xr(w,A),N}return w=m.a++,m.c[w]=T,-(w+1)}function Ke(m){if(m.a===0)return Hr(m.b);var T=m.c[m.d[m.a-1]];if(m.b.a!==0&&t(Fr(m.b),T))return Hr(m.b);do--m.a;while(0<m.a&&m.c[m.d[m.a-1]]===null);return T}function Le(){this.d=mr([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 mr(m,T){for(var w=Array(T),A=0;A<m.length;A++)w[A]=m[A];for(;A<T;A++)w[A]=0;return w}function oe(m){for(var T=m.a;1<=T;--T)Pe(m,T);m.h=!0}function Fr(m){return m.e[m.d[1]]}function Hr(m){var T=m.d,w=m.e,A=m.c,N=T[1],j=w[N];return 0<m.a&&(T[1]=T[m.a],A[T[1]]=1,w[N]=null,A[N]=m.b,m.b=N,0<--m.a&&Pe(m,1)),j}function Pe(m,T){for(var w=m.d,A=m.e,N=m.c,j=T,q=w[j];;){var et=j<<1;et<m.a&&t(A[w[et+1]],A[w[et]])&&(et+=1);var ft=w[et];if(et>m.a||t(A[q],A[ft])){w[j]=q,N[q]=j;break}w[j]=ft,N[ft]=j,j=et}}function Xr(m,T){for(var w=m.d,A=m.e,N=m.c,j=T,q=w[j];;){var et=j>>1,ft=w[et];if(et===0||t(A[ft],A[q])){w[j]=q,N[q]=j;break}w[j]=ft,N[ft]=j,j=et}}function Or(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function de(m){return m.e.c.b}function Ue(m){return m.e.a.b}co.libtess={GluTesselator:at,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}},at.prototype.gluDeleteTess=at.prototype.x,at.prototype.gluTessProperty=at.prototype.B,at.prototype.gluGetTessProperty=at.prototype.y,at.prototype.gluTessNormal=at.prototype.A,at.prototype.gluTessCallback=at.prototype.z,at.prototype.gluTessVertex=at.prototype.C,at.prototype.gluTessBeginPolygon=at.prototype.u,at.prototype.gluTessBeginContour=at.prototype.t,at.prototype.gluTessEndContour=at.prototype.v,at.prototype.gluTessEndPolygon=at.prototype.w,i.exports=co.libtess})(_r);var jr=function(){function s(o,u){u[u.length]=o[0],u[u.length]=o[1]}function n(o){o!==_r.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+o)}function t(o){console.error("error callback, error number: "+o)}function e(o,u,l){return[o[0],o[1],o[2]]}function r(o){}var a=new _r.exports.GluTesselator;return a.gluTessCallback(_r.exports.gluEnum.GLU_TESS_VERTEX_DATA,s),a.gluTessCallback(_r.exports.gluEnum.GLU_TESS_BEGIN,n),a.gluTessCallback(_r.exports.gluEnum.GLU_TESS_ERROR,t),a.gluTessCallback(_r.exports.gluEnum.GLU_TESS_COMBINE,e),a.gluTessCallback(_r.exports.gluEnum.GLU_TESS_EDGE_FLAG,r),a}();function nl(i){jr.gluTessNormal(0,0,1);var s=[];jr.gluTessBeginPolygon(s);for(var n=0;n<i.length;n++){jr.gluTessBeginContour();for(var t=i[n],e=0;e<t.length;e+=2){var r=[t[e],t[e+1],0];jr.gluTessVertex(r,r)}jr.gluTessEndContour()}return jr.gluTessEndPolygon(),s}var fo=function(i){k(s,i);function s(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];var a;a=i.call(this)||this,a.points=[],a.closePath=!1;var o=Array.isArray(e[0])?e[0]:e;if(typeof o[0]!="number"){for(var u=[],l=0,h=o.length;l<h;l++)u.push(o[l].x,o[l].y);o=u}return a.points=o,a.closePath=!0,a}
7var n=s.prototype;return n.clone=function(){var e=this.points.slice(),r=new s(e);return r.closePath=this.closePath,r},n.contains=function(e,r){for(var a=!1,o=this.points.length/2,u=0,l=o-1;u<o;l=u++){var h=this.points[u*2],c=this.points[u*2+1],f=this.points[l*2],d=this.points[l*2+1],v=c>r!=d>r&&e<(f-h)*((r-c)/(d-c))+h;v&&(a=!a)}return a},n.copyFrom=function(e){return this.points=e.points.slice(),this.closePath=e.closePath,this},n.copyTo=function(e){return e.copyFrom(this),e},n.getX=function(){return this.points[this.points.length-2]},n.getY=function(){return this.points[this.points.length-1]},n.build=function(e,r){for(var a=0;a<this.points.length;a++)e[a]=this.points[a]},n.triangulate=function(e,r,a,o,u){var l=nl([e]),h=r.length/2;l.length===0&&this.getLineEndPointsTriangle(e,l);for(var c=0;c<l.length;c++)r[a*2+c]=l[c];for(var f=l.length/2,d=0;d<f;d++)o[u+d]=h+d},n.getLineEndPointsTriangle=function(e,r){if(!e||e.length<2||e.length%2!==0)throw new Error("Invalid points array");if(e.length===2){r.push(e[0],e[1],e[0],e[1],e[0],e[1]);return}var a=e[2]-e[0],o=e[3]-e[1],u=e[0],l=e[1],h=e[0],c=e[1];if(Math.abs(a)>=Math.abs(o))for(var f=0;f<e.length;f+=2){var d=e[f],v=e[f+1];d<u&&(u=d,l=v),d>h&&(h=d,c=v)}else for(var p=0;p<e.length;p+=2){var g=e[p],x=e[p+1];x<l&&(u=g,l=x),x>c&&(h=g,c=x)}r.push(u,l,h,c,h,c)},Mt(s,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),s}(ui),Yc=8,Gi=11920929e-14,Zc=1,qc=.5;function ua(i,s,n,t,e,r,a,o,u,l,h){var c=h!=null?h:1,f=Math.min(.99,Math.max(0,l!=null?l:qc)),d=(Zc-f)/c;return d*=d,Qc(s,n,t,e,r,a,o,u,i,d),i}function Qc(i,s,n,t,e,r,a,o,u,l){la(i,s,n,t,e,r,a,o,u,l,0),u.push(a,o)}function la(i,s,n,t,e,r,a,o,u,l,h){if(!(h>Yc)){var c=(i+n)/2,f=(s+t)/2,d=(n+e)/2,v=(t+r)/2,p=(e+a)/2,g=(r+o)/2,x=(c+d)/2,b=(f+v)/2,y=(d+p)/2,E=(v+g)/2,_=(x+y)/2,S=(b+E)/2;if(h>0){var C=a-i,I=o-s,R=Math.abs((n-a)*I-(t-o)*C),O=Math.abs((e-a)*I-(r-o)*C);if(R>Gi&&O>Gi){if((R+O)*(R+O)<=l*(C*C+I*I)){u.push(_,S);return}}else if(R>Gi){if(R*R<=l*(C*C+I*I)){u.push(_,S);return}}else if(O>Gi){if(O*O<=l*(C*C+I*I)){u.push(_,S);return}}else if(C=_-(i+a)/2,I=S-(s+o)/2,C*C+I*I<=l){u.push(_,S);return}}la(i,s,c,f,x,b,_,S,u,l,h+1),la(_,S,y,E,p,g,a,o,u,l,h+1)}}var Kc=function(i){k(s,i);function s(t,e,r,a){t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),a===void 0&&(a=0);var o;return o=i.call(this)||this,o.type="ellipse",o.x=t,o.y=e,o.halfWidth=r,o.halfHeight=a,o}var n=s.prototype;return n.clone=function(){return new s(this.x,this.y,this.halfWidth,this.halfHeight)},n.contains=function(e,r){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var a=(e-this.x)/this.halfWidth,o=(r-this.y)/this.halfHeight;return a*=a,o*=o,a+o<=1},n.strokeContains=function(e,r,a){var o=this,u=o.halfWidth,l=o.halfHeight;if(u<=0||l<=0)return!1;var h=a/2,c=u-h,f=l-h,d=u+h,v=l+h,p=e-this.x,g=r-this.y,x=p*p/(c*c)+g*g/(f*f),b=p*p/(d*d)+g*g/(v*v);return x>1&&b<=1},n.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.halfWidth=e.halfWidth,this.halfHeight=e.halfHeight,this},n.copyTo=function(e){return e.copyFrom(this),e},n.getX=function(){return this.x},n.getY=function(){return this.y},n.build=function(e,r){var a=this.x,o=this.y,u=this.halfWidth,l=this.halfHeight,h=0,c=0;if(!(u>=0&&l>=0&&h>=0&&c>=0))return e;var f=r!=null?r:1,d=Math.ceil(Math.sqrt(f*(u+l))),v=d*8+0+0;if(v===0)return e;if(d===0)return e[0]=e[6]=a+h,e[1]=e[3]=o+c,e[2]=e[4]=a-h,e[5]=e[7]=o-c,e;var p=0,g=d*4+0+2,x=g,b=v,y=h+u,E=c,_=a+y,S=a-y,C=o+E;e[p++]=_,e[p++]=C,e[--g]=C,e[--g]=S;for(var I=1;I<d;I++){var R=Math.PI/2*(I/d),O=h+Math.cos(R)*u,F=c+Math.sin(R)*l,L=a+O,V=a-O,U=o+F,W=o-F;e[p++]=L,e[p++]=U,e[--g]=U,e[--g]=V,e[x++]=V,e[x++]=W,e[--b]=W,e[--b]=L}y=h,E=c+l,_=a+y,S=a-y,C=o+E;var G=o-E;return e[p++]=_,e[p++]=C,e[--b]=G,e[--b]=_,e},n.triangulate=function(e,r,a,o,u){if(e.length!==0){for(var l=0,h=0,c=0;c<e.length;c+=2)l+=e[c],h+=e[c+1];l/=e.length/2,h/=e.length/2;var f=a;r[f*2]=l,r[f*2+1]=h;for(var d=f++,v=0;v<e.length;v+=2)r[f*2]=e[v],r[f*2+1]=e[v+1],v>0&&(o[u++]=f,o[u++]=d,o[u++]=f-1),f++;o[u++]=d+1,o[u++]=d,o[u++]=f-1}},s}(ui),hn;
7(function(i){i[i.Star=0]="Star",i[i.Polygon=1]="Polygon"})(hn||(hn={}));var $c=function(i){k(s,i);function s(t,e,r,a,o,u){t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),a===void 0&&(a=0),o===void 0&&(o=0),u===void 0&&(u=0);var l;return l=i.call(this)||this,l.pointCount=t,l.outerRadius=e,l.innerRadius=r,l.outerRoundness=a,l.innerRoundness=o,l.starType=u,l.v=[],l.in=[],l.out=[],l}var n=s.prototype;return n.clone=function(){var e=new s(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType);return e},n.copyFrom=function(e){this.pointCount=e.pointCount,this.outerRadius=e.outerRadius,this.innerRadius=e.innerRadius,this.outerRoundness=e.outerRoundness,this.innerRoundness=e.innerRoundness,this.starType=e.starType},n.copyTo=function(e){e.copyFrom(this)},n.build=function(e,r){switch(this.starType){case 0:{this.buildStarPath();break}case 1:{this.buildPolygonPath();break}}for(var a=r!=null?r:1,o=0;o<this.v.length-2;o+=2)ua(e,this.v[o],this.v[o+1],this.out[o],this.out[o+1],this.in[o+2],this.in[o+3],this.v[o+2],this.v[o+3],void 0,a);var u=this.v.length-1;ua(e,this.v[u-1],this.v[u],this.out[u-1],this.out[u],this.in[0],this.in[1],this.v[0],this.v[1],void 0,a)},n.triangulate=function(e,r,a,o,u){for(var l=nl([e]),h=r.length/2,c=0;c<l.length;c++)r[a*2+c]=l[c];for(var f=l.length/2,d=0;d<f;d++)o[u+d]=h+d},n.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var e=Math.floor(this.pointCount)*2,r=Math.PI*2/e,a=!0,o=this.outerRadius,u=this.innerRadius,l=this.outerRoundness/100,h=this.innerRoundness/100,c=2*Math.PI*o/(e*2),f=2*Math.PI*u/(e*2),d,v,p,g,x=-Math.PI/2,b=1;for(d=0;d<e;d++){v=a?o:u,p=a?l:h,g=a?c:f;var y=v*Math.cos(x),E=v*Math.sin(x),_=y===0&&E===0?0:E/Math.sqrt(y*y+E*E),S=y===0&&E===0?0:-y/Math.sqrt(y*y+E*E),C=d*2;this.v[C]=y,this.v[C+1]=E,this.in[C]=y+_*g*p*b,this.in[C+1]=E+S*g*p*b,this.out[C]=y-_*g*p*b,this.out[C+1]=E-S*g*p*b,a=!a,x+=r*b}},n.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var e=Math.floor(this.pointCount),r=Math.PI*2/e,a=this.outerRadius,o=this.outerRoundness/100,u=2*Math.PI*a/(e*4),l,h=-Math.PI*.5,c=1;for(l=0;l<e;l++){var f=a*Math.cos(h),d=a*Math.sin(h),v=f===0&&d===0?0:d/Math.sqrt(f*f+d*d),p=f===0&&d===0?0:-f/Math.sqrt(f*f+d*d),g=l*2;this.v[g]=f,this.v[g+1]=d,this.in[g]=f+v*u*o*c,this.in[g+1]=d+p*u*o*c,this.out[g]=f-v*u*o*c,this.out[g+1]=d-p*u*o*c,h+=r*c}},s}(ui),Xa=function(i){k(s,i);function s(t,e,r,a,o){t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),a===void 0&&(a=0),o===void 0&&(o=20);var u;return u=i.call(this)||this,u.x=t,u.y=e,u.width=r,u.height=a,u.roundness=o,u}var n=s.prototype;return n.getBounds=function(e){return e=e||new s,e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},n.clone=function(){return new s(this.x,this.y,this.width,this.height,this.roundness)},n.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this.roundness=e.roundness,this},n.copyTo=function(e){return e.copyFrom(this),e},n.build=function(e,r){var a,o=this.width/2,u=this.height/2,l=this.x+o,h=this.y+u,c=a=Math.max(0,Math.min(this.roundness/100,1)*Math.min(o,u)),f=o-c,d=u-a;if(c>=0&&a>=0&&f>=0&&d>=0){var v=r!=null?r:1,p=Math.ceil(Math.sqrt(v*(c+a))),g=p*8+(f?4:0)+(d?4:0);if(g!==0){if(p===0){e[0]=e[6]=l+f,e[1]=e[3]=h+d,e[2]=e[4]=l-f,e[5]=e[7]=h-d;return}var x=0,b=p*4+(f?2:0)+2,y=b,E=g,_=f+c,S=d,C=l+_,I=l-_,R=h+S;if(e[x++]=C,e[x++]=R,e[--b]=R,e[--b]=I,d){var O=h-S;e[y++]=I,e[y++]=O,e[--E]=O,e[--E]=C}for(var F=1;F<p;F++){var L=Math.PI/2*(F/p),V=f+Math.cos(L)*c,U=d+Math.sin(L)*a,W=l+V,G=l-V,B=h+U,X=h-U;e[x++]=W,e[x++]=B,e[--b]=B,e[--b]=G,e[y++]=G,e[y++]=X,e[--E]=X,e[--E]=W}_=f,S=d+a,C=l+_,I=l-_,R=h+S;var H=h-S;e[x++]=C,e[x++]=R,e[--E]=H,e[--E]=C,f&&(e[x++]=I,e[x++]=R,e[--E]=H,e[--E]=I)}}},n.triangulate=function(e,r,a,o,u){if(e.length!==0){for(var l=0,h=0,c=0;c<e.length;c+=2)l+=e[c],h+=e[c+1];l/=e.length/2,h/=e.length/2;var f=a;r[f*2]=l,r[f*2+1]=h;for(var d=f++,v=0;v<e.length;v+=2)r[f*2]=e[v],r[f*2+1]=e[v+1],v>0&&(o[u++]=f,o[u++]=d,o[u++]=f-1),f++;o[u++]=d+1,o[u++]=d,o[u++]=f-1}},s}(ui),Jc=function(i){k(s,i);function s(t,e,r,a,o,u){t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),a===void 0&&(a=0),o===void 0&&(o=0),u===void 0&&(u=0);var l;return l=i.call(this)||this,l.x=t,l.y=e,l.x2=r,l.y2=a,l.x3=o,l.y3=u,l}var n=s.prototype;return n.contains=function(e,r){var a=(this.x-this.x3)*(r-this.y3)-(this.y-this.y3)*(e-this.x3),o=(this.x2-this.x)*(r-this.y)-(this.y2-this.y)*(e-this.x);if(a<0!=o<0&&a!==0&&o!==0)return!1;var u=(this.x3-this.x2)*(r-this.y2)-(this.y3-this.y2)*(e-this.x2);return u===0||u<0==a+o<=0},n.clone=function(){var e=new s(this.x,this.y,this.x2,this.y2,this.x3,this.y3);return e},n.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.x2=e.x2,this.y2=e.y2,this.x3=e.x3,this.y3=e.y3,this},n.copyTo=function(e){return e.copyFrom(this),e},n.getBounds=function(e){e=e||new Xa;var r=Math.min(this.x,this.x2,this.x3),a=Math.max(this.x,this.x2,this.x3),o=Math.min(this.y,this.y2,this.y3),u=Math.max(this.y,this.y2,this.y3);
7return e.x=r,e.y=o,e.width=a-r,e.height=u-o,e},n.getX=function(){return this.x},n.getY=function(){return this.y},n.build=function(e,r){e[0]=this.x,e[1]=this.y,e[2]=this.x2,e[3]=this.y2,e[4]=this.x3,e[5]=this.y3},n.triangulate=function(e,r,a,o,u){var l=0,h=2;a*=h,r[a+l]=e[0],r[a+l+1]=e[1],l+=h,r[a+l]=e[2],r[a+l+1]=e[3],l+=h,r[a+l]=e[4],r[a+l+1]=e[5];var c=a/h;o[u++]=c,o[u++]=c+1,o[u++]=c+2},s}(ui),tf=function(i){k(s,i);function s(t,e,r){t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0);var a;return a=i.call(this)||this,a.x=t,a.y=e,a.radius=r,a}var n=s.prototype;return n.clone=function(){return new s(this.x,this.y,this.radius)},n.contains=function(e,r){if(this.radius<=0)return!1;var a=this.radius*this.radius,o=this.x-e,u=this.y-r;return o*=o,u*=u,o+u<=a},n.strokeContains=function(e,r,a,o){if(o===void 0&&(o=.5),this.radius===0)return!1;var u=this.x-e,l=this.y-r,h=this.radius,c=(1-o)*a,f=Math.sqrt(u*u+l*l);return f<=h+c&&f>h-(a-c)},n.getBounds=function(e){return e||(e=new Xa),e.x=this.x-this.radius,e.y=this.y-this.radius,e.width=this.radius*2,e.height=this.radius*2,e},n.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.radius=e.radius,this},n.copyTo=function(e){return e.copyFrom(this),e},n.build=function(e,r){var a=this.x,o=this.y,u=0,l=0,h=this.radius,c=this.radius;if(!(h<=0)){var f=r!=null?r:1,d=Math.ceil(Math.sqrt(f*(h+c))),v=d*8+0+0;if(v!==0){if(d===0){e[0]=e[6]=a+u,e[1]=e[3]=o+l,e[2]=e[4]=a-u,e[5]=e[7]=o-l;return}var p=0,g=d*4+0+2,x=g,b=v,y=u+h,E=l,_=a+y,S=a-y,C=o+E;e[p++]=_,e[p++]=C,e[--g]=C,e[--g]=S;for(var I=1;I<d;I++){var R=Math.PI/2*(I/d),O=u+Math.cos(R)*h,F=l+Math.sin(R)*c,L=a+O,V=a-O,U=o+F,W=o-F;e[p++]=L,e[p++]=U,e[--g]=U,e[--g]=V,e[x++]=V,e[x++]=W,e[--b]=W,e[--b]=L}y=u,E=l+c,_=a+y,S=a-y,C=o+E;var G=o-E;e[p++]=_,e[p++]=C,e[--b]=G,e[--b]=_}}},n.triangulate=function(e,r,a,o,u){if(e.length!==0){for(var l=0,h=0,c=0;c<e.length;c+=2)l+=e[c],h+=e[c+1];l/=e.length/2,h/=e.length/2;var f=a;r[f*2]=l,r[f*2+1]=h;for(var d=f++,v=0;v<e.length;v+=2)r[f*2]=e[v],r[f*2+1]=e[v+1],v>0&&(o[u++]=f,o[u++]=d,o[u++]=f-1),f++;o[u++]=d+1,o[u++]=d,o[u++]=f-1}},s}(ui),ef=function(){function i(n){this.graphicsPath=n,this.currentPoly=null,this.shapePrimitives=[]}var s=i.prototype;return s.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t=this.graphicsPath,e=M(t.instructions),r;!(r=e()).done;){var a=r.value,o=a.action,u=a.data;switch(o){case"bezierCurveTo":{this.bezierCurveTo(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7]);break}case"moveTo":{this.moveTo(u[0],u[1]);break}case"lineTo":{this.lineTo(u[0],u[1]);break}case"ellipse":{this.ellipse(u[0],u[1],u[2],u[3],u[4]);break}case"circle":{this.circle(u[0],u[1],u[2],u[3]);break}case"polyStar":{this.polyStar(u[0],u[1],u[2],u[3],u[4],u[5],u[6]);break}case"rect":{this.rect(u[0],u[1],u[2],u[3],u[4]);break}case"triangle":{this.triangle(u[0],u[1],u[2],u[3],u[4],u[5],u[6]);break}case"closePath":{this.closePath();break}}}this.endPoly()},s.bezierCurveTo=function(t,e,r,a,o,u,l,h){this.ensurePoly();var c=this.currentPoly;return ua(c.points,c.lastX,c.lastY,t,e,r,a,o,u,l,h),this},s.moveTo=function(t,e){return this.startPoly(t,e),this},s.lineTo=function(t,e){this.ensurePoly();var r=this.currentPoly.points,a=r[r.length-2],o=r[r.length-1];return(a!==t||o!==e)&&r.push(t,e),this},s.closePath=function(){return this.endPoly(!0),this},s.ellipse=function(t,e,r,a,o){return this.drawShape(new Kc(t,e,r,a),o),this},s.circle=function(t,e,r,a){return this.drawShape(new tf(t,e,r),a),this},s.polyStar=function(t,e,r,a,o,u,l){return this.drawShape(new $c(t,e,r,a,o,u),l),this},s.rect=function(t,e,r,a,o,u){return this.drawShape(new Xa(t,e,r,a,o),u),this},s.triangle=function(t,e,r,a,o,u,l){return this.drawShape(new Jc(t,e,r,a,o,u),l),this},s.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},s.startPoly=function(t,e){var r=this.currentPoly;return r&&this.endPoly(),r=new fo,r.points.push(t,e),this.currentPoly=r,this},s.endPoly=function(t){t===void 0&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},s.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new fo,this.currentPoly.points.push(0,0))},i}
7(),rf=function(){function i(){this.instructions=[],this.dirty=!1}var s=i.prototype;return s.bezierCurveTo=function(t,e,r,a,o,u,l,h){return this.instructions.push({action:"bezierCurveTo",data:[t,e,r,a,o,u,l,h]}),this.dirty=!0,this},s.lineTo=function(t,e){return this.instructions.push({action:"lineTo",data:[t,e]}),this.dirty=!0,this},s.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},s.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},s.ellipse=function(t,e,r,a,o){return this.instructions.push({action:"ellipse",data:[t,e,r,a,o]}),this.dirty=!0,this},s.circle=function(t,e,r,a){return this.instructions.push({action:"circle",data:[t,e,r,a]}),this.dirty=!0,this},s.rect=function(t,e,r,a,o,u){return this.instructions.push({action:"rect",data:[t,e,r,a,o,u]}),this.dirty=!0,this},s.triangle=function(t,e,r,a,o,u,l){return this.instructions.push({action:"triangle",data:[t,e,r,a,o,u,l]}),this.dirty=!0,this},s.polyStar=function(t,e,r,a,o,u,l){return this.instructions.push({action:"polyStar",data:[t,e,r,a,o,u,l]}),this.dirty=!0,this},s.clear=function(){return this.instructions.length=0,this.dirty=!0,this},Mt(i,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new ef(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),i}(),ha;(function(i){i[i.EveryUpdate=0]="EveryUpdate",i[i.Manual=1]="Manual"})(ha||(ha={}));var sr=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.items=[],t.state=je.Stopped,t.updateMode=0,t.playOnStart=!1,t.endBehavior=Gt.forward,t.time=0,t.lastTime=0,t.sceneBindings=[],t.timelineAsset=null,t._timelineInstance=null,t.nestedCompositions=[],t}var n=s.prototype;return n.onStart=function(){this.playOnStart&&this.play()},n.pause=function(){this.state=je.Paused;for(var e=M(this.nestedCompositions),r;!(r=e()).done;){var a=r.value;a.pause()}},n.play=function(){this.state=je.Playing;for(var e=M(this.nestedCompositions),r;!(r=e()).done;){var a=r.value;a.play()}},n.stop=function(){this.state=je.Stopped,this.time=0,this.lastTime=0;for(var e=M(this.nestedCompositions),r;!(r=e()).done;){var a=r.value;a.stop()}},n.getTime=function(){return this.time},n.setTime=function(e){this.time=e},n.onUpdate=function(e){this.state===je.Playing&&this.updateMode===0&&this.tick(e/1e3)},n.tick=function(e){if(this.timelineInstance){var r=this.time;if(pr(this.lastTime,this.time)&&(r+=e),r>this.item.duration)switch(this.endBehavior){case Gt.forward:break;case Gt.freeze:r=this.item.duration;break;case Gt.restart:r=r%this.item.duration;break;case Gt.destroy:this.item.dispose();return}this.timelineInstance.evaluate(r,e),this.lastTime=this.time=r}},n.onEnable=function(){this.item.getDescendants(!1,function(e){return e.setActive(!0),!1})},n.onDisable=function(){this.item.getDescendants(!1,function(e){return e.setActive(!1),!1})},n.onDestroy=function(){var e=this.item.getDescendants();e.forEach(function(r){return r.dispose()})},n.setChildrenRenderOrder=function(e){if(!this.timelineInstance)return e;var r=[];this.collectChildren(this.item,r);for(var a=new Set,o=M(this.timelineInstance.masterTrackInstances),u;!(u=o()).done;){var l=u.value;Z(l.boundObject,Ie)&&a.add(l.boundObject)}for(var h=[],c=0;c<r.length;c++)a.has(r[c])&&h.push(c);for(var f=[],d=M(this.timelineInstance.masterTrackInstances),v;!(v=d()).done;){var p=v.value;Z(p.boundObject,Ie)&&f.push(p.boundObject)}for(var g=0;g<h.length&&g<f.length;g++)r[h[g]]=f[g];for(var x=M(r),b;!(b=x()).done;){var y=b.value,E=e++;y.isManuallySetRenderOrder||y.setRendererComponentOrder(E);var _=y.getComponent(s);_&&(e=_.setChildrenRenderOrder(e))}return e},n.collectChildren=function(e,r){for(var a=M(e.children),o;!(o=a()).done;){var u=o.value;r.push(u),Ie.isComposition(u)||this.collectChildren(u,r)}},n.fromData=function(e){i.prototype.fromData.call(this,e),this._timelineInstance=null},Mt(s,[{key:"timelineInstance",get:function(){if(!this._timelineInstance&&this.timelineAsset){this._timelineInstance=new lv(this.timelineAsset,this.sceneBindings),this.nestedCompositions=[];for(var e=M(this._timelineInstance.masterTrackInstances),r;!(r=e()).done;){var a=r.value,o=a.boundObject;if(Z(o,Ie)&&Ie.isComposition(o)){var u=o.getComponent(s);u.updateMode=1,this.nestedCompositions.push(u)}}}return this._timelineInstance}}]),s}(ce);$([bt()],sr.prototype,"items",void 0);$([bt()],sr.prototype,"sceneBindings",void 0);$([bt()],sr.prototype,"timelineAsset",void 0);sr=$([xt("CompositionComponent")],sr);var al=function(i){k(s,i);function s(t){var e;
7return e=i.call(this,t)||this,e.getHitTestParams=function(r){var a=e.transform.getWorldMatrix();e.boundingBoxInfo.setGeometry(e.geometry,a);var o=e.boundingBoxInfo.getRawBoundingBoxTriangle();if(o)return{type:o.type,triangles:o.area,clipMasks:e.frameClipMasks}},e}var n=s.prototype;return n.render=function(e){this.maskManager.drawStencilMask(e,this);for(var r=0;r<this.materials.length;r++){var a=this.materials[r];e.drawGeometry(this.geometry,this.transform.getWorldMatrix(),a,r)}},n.drawStencilMask=function(e){if(this.isActiveAndEnabled)for(var r=0;r<this.materials.length;r++){var a=this.materials[r];this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),a,e,r)}},n.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.boundingBoxInfo.setGeometry(this.geometry,e);var r=this.boundingBoxInfo.getBoundingBoxTriangle();return r},n.getBoundingBoxInfo=function(){var e=this.geometry.getAttributeData("aPos");if(e){var r=Ha(e,0,e.length/3);r.minimum.x*=this.transform.size.x,r.minimum.y*=this.transform.size.y,r.maximum.x*=this.transform.size.x,r.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(r.minimum,r.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},n.fromData=function(e){i.prototype.fromData.call(this,e);var r=e.mask;r&&this.maskManager.setMaskOptions(this.engine,r)},s}(ze);$([bt()],al.prototype,"geometry",void 0);var ii=function(i){k(s,i);function s(t){var e;return e=i.call(this,t)||this,e.time=0,e.name="EffectComponent",e}var n=s.prototype;return n.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},n.onUpdate=function(e){var r=this.time,a,o=(a=this.material.getVector4("_Time"))!=null?a:new Dt;this.material.setVector4("_Time",o.set(r/20,r,r*2,r*3)),this.time+=e/1e3},n.fromData=function(e){i.prototype.fromData.call(this,e),this.material=this.materials[0]},s}(al);ii=$([xt(tt.EffectComponent)],ii);var ge=new D(0,0,0),Wi=new D(0,0,0),vo=function(){this.target=null,this.weight=1},po=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.positionAtRest=new D(0,0,0),t.positionOffset=new D(0,0,0),t.weight=1,t.constrainX=!0,t.constrainY=!0,t.constrainZ=!0,t.targets=[],t}var n=s.prototype;return n.onStart=function(){var e=this.item.transform.getWorldPosition();this.positionAtRest.copyFrom(e)},n.onUpdate=function(e){if(this.targets.length!==0){ge.set(0,0,0);for(var r=0,a=M(this.targets),o;!(o=a()).done;){var u=o.value;if(u.target){var l=u.target.transform.getWorldPosition(),h=u.weight;ge.x+=l.x*h,ge.y+=l.y*h,ge.z+=l.z*h,r+=h}}r>0&&(ge.x/=r,ge.y/=r,ge.z/=r),ge.x+=this.positionOffset.x,ge.y+=this.positionOffset.y,ge.z+=this.positionOffset.z,Wi.set(this.lerp(this.positionAtRest.x,ge.x,this.weight),this.lerp(this.positionAtRest.y,ge.y,this.weight),this.lerp(this.positionAtRest.z,ge.z,this.weight)),ge.copyFrom(this.item.transform.getWorldPosition());var c=this.constrainX?Wi.x:ge.x,f=this.constrainY?Wi.y:ge.y,d=this.constrainZ?Wi.z:ge.z;this.item.transform.setWorldPosition(c,f,d)}},n.addTarget=function(e,r){r===void 0&&(r=1);var a=new vo;a.target=e,a.weight=Math.max(0,Math.min(1,r)),this.targets.push(a)},n.removeTarget=function(e){var r=this.targets.findIndex(function(a){return a.target===e});r!==-1&&this.targets.splice(r,1)},n.clearTargets=function(){this.targets=[]},n.setPositionOffset=function(e,r,a){this.positionOffset.set(e,r,a)},n.setWeight=function(e){this.weight=Math.max(0,Math.min(1,e))},n.lerp=function(e,r,a){return e+(r-e)*a},n.fromData=function(e){i.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 r=M(e.targets),a;!(a=r()).done;){var o=a.value,u=new vo;u.target=this.engine.findObject(o.target),u.weight=o.weight,this.targets.push(u)}},s}(ce);po=$([xt("PositionConstraint")],po);var ni=function(i){k(s,i);function s(t){var e;return e=i.call(this,t)||this,e.bloom={threshold:0,intensity:0,active:!1},e.vignette={intensity:0,smoothness:0,roundness:0,active:!1},e.tonemapping={active:!1}
7,e.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},e}var n=s.prototype;return n.onStart=function(){var e=this.item.composition;e&&(e.renderFrame.globalVolume=this)},s}(ce);$([bt()],ni.prototype,"bloom",void 0);$([bt()],ni.prototype,"vignette",void 0);$([bt()],ni.prototype,"tonemapping",void 0);$([bt()],ni.prototype,"colorAdjustments",void 0);ni=$([xt(tt.PostProcessVolume)],ni);var nr;(function(i){i[i.Nearest=0]="Nearest",i[i.Linear=1]="Linear"})(nr||(nr={}));var ar;(function(i){i[i.RGBA32=0]="RGBA32",i[i.RGBAHalf=1]="RGBAHalf"})(ar||(ar={}));var ja=function(){function i(){}var s=i.prototype;return s.resize=function(t,e,r,a){},s.resetColorTextures=function(t){},s.unbind=function(){},s.bind=function(){},s.getDepthTexture=function(){},s.getStencilTexture=function(){},s.getColorTextures=function(){return[]},s.dispose=function(t){},Mt(i,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),i}(),nf=1e3,Ee;(function(i){i[i.none=0]="none",i[i.color=1]="color",i[i.stencil_8_opaque=2]="stencil_8_opaque",i[i.depth_16_opaque=3]="depth_16_opaque",i[i.depth_stencil_opaque=4]="depth_stencil_opaque",i[i.depth_16_texture=5]="depth_16_texture",i[i.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture"})(Ee||(Ee={}));var Ti;(function(i){i[i.store=0]="store",i[i.clear=2]="clear"})(Ti||(Ti={}));var sl=function(){function i(n,t){if(this.destroyed=!1,!!t){var e=t.texture,r=t.size;if(Z(e,Wt))this.texture=e,this.externalTexture=!0;else if(e){var a=e.wrapT,o=e.wrapS,u=e.minFilter,l=e.magFilter,h=e.internalFormat,c=e.format,f=c===void 0?P.RGBA:c,d=e.type,v=d===void 0?P.UNSIGNED_BYTE:d;this.externalTexture=!1,this.textureOptions={size:r,format:f,type:v,internalFormat:h||f,wrapT:a,wrapS:o,minFilter:u,magFilter:l,name:t.name},this.texture=Wt.create(n,lt({},this.textureOptions,{sourceType:st.framebuffer,data:{width:r[0],height:r[1]}}))}}}var s=i.prototype;return s.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},Mt(i,[{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}}]),i}(),_i;(function(i){i[i.force=0]="force",i[i.keep=1]="keep",i[i.keepExternal=2]="keepExternal",i[i.destroy=0]="destroy"})(_i||(_i={}));var af=1,Ya=function(){function i(n){this.priority=0,this.name="RenderPass"+af++,this.meshes=[],this.disposed=!1,this.framebuffer=null,this.renderer=n}var s=i.prototype;return s.addMesh=function(t){eh(this.meshes,t)},s.removeMesh=function(t){Re(this.meshes,t)},s.configure=function(t){},s.execute=function(t){},s.onCameraCleanup=function(t){},s.getViewport=function(){var t,e=(t=this.framebuffer)==null?void 0:t.viewport;if(e)return e;var r=this.renderer;return r?[0,0,r.getWidth(),r.getHeight()]:[0,0,0,0]},s.dispose=function(t){if(!this.disposed){var e=(t==null?void 0:t.meshes)||void 0;e!==Dr.keep&&this.meshes.forEach(function(r){r.dispose(e)}),this.meshes.length=0,this.disposed=!0}},Mt(i,[{key:"isDisposed",get:function(){return this.disposed}},{key:"viewport",get:function(){return this.getViewport()}}]),i}(),sf=function(i){k(s,i);function s(t){var e;return e=i.call(this,t)||this,e.useRenderTarget=!1,e.priority=nf,e.name="DrawObjectPass",e}var n=s.prototype;return n.setup=function(e){this.useRenderTarget=e},n.configure=function(e){this.useRenderTarget&&(this.framebuffer=e.getTemporaryRT("DrawObjectPass",e.getWidth(),e.getHeight(),16,nr.Linear,ar.RGBAHalf),e.setFramebuffer(this.framebuffer))},n.execute=function(e){this.useRenderTarget&&e.clear({colorAction:$t.clear,depthAction:$t.clear,stencilAction:$t.clear}),this.meshes.sort(function(r,a){return r.priority-a.priority}),e.renderMeshes(this.meshes)},n.onCameraCleanup=function(e){this.useRenderTarget&&this.framebuffer&&e.releaseTemporaryRT(this.framebuffer)},s}(Ya),Yr,of=(Yr={},Yr[P.FLOAT]=Float32Array.BYTES_PER_ELEMENT,Yr[P.INT]=Int32Array.BYTES_PER_ELEMENT,Yr[P.SHORT]=Int16Array.BYTES_PER_ELEMENT,Yr[P.BYTE]=Int8Array.BYTES_PER_ELEMENT,Yr),Qe
7=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.name="",t.subMeshes=[],t}var n=s.prototype;return n.initialize=function(){},n.flush=function(){},s}(xe);function uf(i){return i===P.INT?new Int32Array(0):i===P.SHORT?new Int16Array(0):new Float32Array(0)}var mo=1,ai=function(i){k(s,i);function s(t,e){var r;if(r=i.call(this,t)||this,r.destroyed=!1,r.visible=!0,e){var a=e.material,o=e.geometry,u=e.name,l=u===void 0?"<unnamed>":u,h=e.priority,c=h===void 0?0:h,f=e.worldMatrix,d=f===void 0?Tt.fromIdentity():f;r.id="Mesh"+mo++,r.name=l,r.geometry=o,r.material=a,r.priority=c,r.worldMatrix=d}else r.id="Mesh"+mo++,r.name="<unnamed>",r.worldMatrix=Tt.fromIdentity(),r._priority=0;return r}var n=s.prototype;return n.setVisible=function(e){this.visible=e},n.getVisible=function(){return this.visible},n.render=function(e){this.isDestroyed||this.getVisible()&&e.drawGeometry(this.geometry,this.worldMatrix,this.material)},n.firstGeometry=function(){return this.geometry},n.setMaterial=function(e,r){r!==Dr.keep&&this.material.dispose(),this.material=e},n.restore=function(){},n.dispose=function(e){if(!this.destroyed){(e==null?void 0:e.geometries)!==Dr.keep&&this.geometry.dispose();var r=e==null?void 0:e.material;r!==Dr.keep&&this.material.dispose(),this.destroyed=!0,this.engine!==void 0&&this.engine.removeMesh(this),i.prototype.dispose.call(this)}},Mt(s,[{key:"isDestroyed",get:function(){return this.destroyed}}]),s}(ze),lf="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);}}",hf="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;
7vec4 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;}",ol="#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
7(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",cf="#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);}
7ret.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;}}",ff="#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;
7uniform 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;}",gi="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",df="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;}
7vec3 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);}",vf="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);}",pf="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);}",mf="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);}",gf="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);}",di={},go=function(){function i(){}return i.registerInclude=function(n,t){di[n]&&Nt.warn('The "'+n+'" shader include already exist.'),di[n]=t},i.unRegisterInclude=function(n){delete di[n]}
7,i.unRegisterAllIncludes=function(){Object.keys(di).forEach(function(n){i.unRegisterInclude(n)})},i.genFinalShaderCode=function(n){var t=n.level,e=n.shaderType,r=n.shader,a=n.macros,o=n.removeVersion,u=i.genMacroString(t,a),l=i.genShaderVersion(t),h=i.parseIncludes(r),c=i.isVersion300(h);return h=i.removeWebGLVersion(h),t===2&&!c&&(h=i.convertTo300(h,e===Ai.fragment)),o?u+h:l+u+h},i.convertTo300=function(n,t){n=n.replace(/\bvarying\b/g,t?"in":"out"),n=n.replace(/\btexture(2D|Cube)\b/g,"texture");var e=/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;if(n=n.replace(e,""),t){if(n=n.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod"),n=n.replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad"),n=n.replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!i.has300Output(n)){var r=/\bgl_FragData\[.+?\]/g.test(n);if(r){n=n.replace(/\bgl_FragColor\b/g,"gl_FragData[0]");var a=n.match(/\bgl_FragData\[.+?\]/g);a&&(n=i.replaceMRTShader(n,a))}else n=n.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main("),n=n.replace(/\bgl_FragColor\b/g,"glFragColor")}}else n=n.replace(/\battribute\b/g,"in");return n},i.parseIncludes=function(n,t){t===void 0&&(t=/#include <(.+)>/gm);for(var e;(e=t.exec(n))!==null;){var r=e[1],a=di[r];if(a===void 0)throw new Error("Can't find include shader name "+r);n=n.replace(e[0],a)}return n},i.genMacroString=function(n,t,e){e===void 0&&(e=!0);var r=[],a="WEBGL"+n;return r.push("#ifndef "+a),r.push("#define "+a),r.push("#endif"),e&&r.push("#define GE_RUNTIME"),t&&t.length&&t.forEach(function(o){var u=o[0],l=o[1];l===!0?r.push("#define "+u):Number.isFinite(l)&&r.push("#define "+u+" "+l)}),r.length?r.join("\n")+"\n":""},i.genShaderVersion=function(n){return n===1?"#version 100\n":"#version 300 es\n"},i.isVersion300=function(n){var t=/#version\s+\b\d{3}\b\s*(es)?/,e=n.match(t),r=e?e[0]:"";return r.includes("300")},i.removeWebGLVersion=function(n){var t=/#version\s+\b\d{3}\b\s*(es)?/,e=n.match(t);return e?n.replace(e[0],""):n},i.has300Output=function(n){var t=/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/;return t.test(n)},i.replaceMRTShader=function(n,t){for(var e=new Set,r="",a=0;a<t.length;a++){var o=t[a].match(/\bgl_FragData\[(.+?)\]/);o&&e.add(o[1])}return e.forEach(function(u){r+="layout(location="+u+") out vec4 fragOutColor"+u+";\n"}),r+="void main(",n=n.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1"),n=n.replace(/void\s+?main\s*\(/g,r),n},i}(),yf=function(i){k(s,i);function s(t,e){e===void 0&&(e=4);var r;r=i.call(this,t)||this,r.tempRTs=[],r.iterationCount=e;var a=r.renderer.engine;return r.thresholdMaterial=Ce.create(a,{shader:{vertex:gi,fragment:gf,glslVersion:Ve.GLSL1}}),r.thresholdMaterial.blending=!1,r.thresholdMaterial.depthTest=!1,r.thresholdMaterial.culling=!1,r.downSampleHMaterial=Ce.create(a,{shader:{vertex:gi,fragment:vf,glslVersion:Ve.GLSL1}}),r.downSampleHMaterial.blending=!1,r.downSampleHMaterial.depthTest=!1,r.downSampleHMaterial.culling=!1,r.downSampleVMaterial=Ce.create(a,{shader:{vertex:gi,fragment:pf,glslVersion:Ve.GLSL1}}),r.downSampleVMaterial.blending=!1,r.downSampleVMaterial.depthTest=!1,r.downSampleVMaterial.culling=!1,r.upSampleMaterial=Ce.create(a,{shader:{vertex:gi,fragment:mf,glslVersion:Ve.GLSL1}}),r.upSampleMaterial.blending=!1,r.upSampleMaterial.depthTest=!1,r.upSampleMaterial.culling=!1,r.priority=5e3,r.name="BloomPass",r}var n=s.prototype;return n.configure=function(e){this.mainTexture=e.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture},n.execute=function(e){var r,a,o=e.getWidth(),u=e.getHeight(),l,h=(l=(a=e.renderingData.currentFrame.globalVolume)==null||(r=a.bloom)==null?void 0:r.threshold)!=null?l:1;this.thresholdRT=e.getTemporaryRT("_BloomThreshold",o,u,0,nr.Linear,ar.RGBAHalf),this.thresholdMaterial.setFloat("_Threshold",h),e.blit(this.mainTexture,this.thresholdRT,this.thresholdMaterial);for(var c=this.thresholdRT.getColorTextures()[0],f=0;f<this.iterationCount;f++){var d=Math.floor(o/Math.pow(2,f+1)),v=Math.floor(u/Math.pow(2,f+1)),p=e.getTemporaryRT("_BloomDownH"+f,d,v,0,nr.Linear,ar.RGBAHalf);this.downSampleHMaterial.setVector2("_TextureSize",On(c)),e.blit(c,p,this.downSampleHMaterial);var g=e.getTemporaryRT("_BloomDownV"+f,d,v,0,nr.Linear,ar.RGBAHalf);this.downSampleVMaterial.setVector2("_TextureSize",On(p.getColorTextures()[0])),e.blit(p.getColorTextures()[0],g,this.downSampleVMaterial),e.releaseTemporaryRT(p),this.tempRTs.push(g),c=g.getColorTextures()[0]}e.releaseTemporaryRT(this.thresholdRT);for(var x=this.iterationCount-1;x>0;x--){var b=Math.floor(o/Math.pow(2,x-1)),y=Math.floor(u/Math.pow(2,x-1)),E=e.getTemporaryRT("_BloomUp"+x,b,y,0,nr.Linear,ar.RGBAHalf),_=this.tempRTs[x-1].getColorTextures()[0];this.upSampleMaterial.setTexture("_GaussianDownTex",_),this.upSampleMaterial.setVector2("_GaussianDownTextureSize",On(_)),e.blit(c,E,this.upSampleMaterial),c=E.getColorTextures()[0],this.tempRTs.push(E)}e.setFramebuffer(this.tempRTs[this.tempRTs.length-1])},n.onCameraCleanup=function(e){for(var r=0;r<this.tempRTs.length;r++)e.releaseTemporaryRT(this.tempRTs[r]);this.tempRTs=[]},n.dispose=function(e){this.thresholdMaterial.dispose(),this.downSampleHMaterial.dispose(),this.downSampleVMaterial.dispose(),this.upSampleMaterial.dispose(),i.prototype.dispose.call(this,e)},s}(Ya),xf=function(i){k(s,i);function s(t,e){var r;r=i.call(this,t)||this;var a="PostProcess",o=r.renderer.engine;r.sceneTextureHandle=e||new sl(o);var u=Qe.create(o,{name:a,mode:P.TRIANGLE_STRIP,attributes:{aPos:{type:P.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),l=Ce.create(o,{name:a,shader:{vertex:gi,fragment:df,glslVersion:Ve.GLSL1}});return l.blending=!1,l.depthTest=!1,l.culling=!1,r.screenMesh=ai.create(o,{name:a,geometry:u,material:l,priority:0}),r.priority=5e3,r.name="ToneMappingPass",r}var n=s.prototype;return n.configure=function(e){this.mainTexture=e.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),e.setFramebuffer(null)},n.execute=function(e){e.clear({colorAction:$t.clear,depthAction:$t.clear,stencilAction:$t.clear});var r=e.renderingData.currentFrame.globalVolume,a=lt({threshold:0,intensity:0,active:!1},r==null?void 0:r.bloom),o=lt({intensity:0,smoothness:0,roundness:0,active:!1}
7,r==null?void 0:r.vignette),u=lt({brightness:0,saturation:0,contrast:0,active:!1},r==null?void 0:r.colorAdjustments),l=lt({active:!1},r==null?void 0:r.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,u.brightness)),this.screenMesh.material.setFloat("_Saturation",u.saturation*.01+1),this.screenMesh.material.setFloat("_Contrast",u.contrast*.01+1),this.screenMesh.material.setInt("_UseBloom",Number(a.active)),a.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",a.intensity)),o.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",o.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",o.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",o.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new ht(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new D(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(l.active)),e.renderMeshes([this.screenMesh])},s}(Ya),bf=1,Tf=function(){function i(n){this.disposed=!1,this.postProcessingEnabled=!1,this.enableHDR=!0;var t=n.camera,e=n.renderer,r=n.editorTransform,a=r===void 0?[1,1,0,0]:r,o=n.globalVolume,u=n.postProcessingEnabled,l=u===void 0?!1:u,h=e.engine;if(o&&(this.globalVolume=o),this.postProcessingEnabled=l,this.globalUniforms=new _f,this.renderer=e,l&&this.enableHDR&&!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");this.drawObjectPass=new sf(e);var c=[this.drawObjectPass];if(this.setRenderPasses(c),l){var f=new sl(h),d=7,v=new yf(e,d);v.sceneTextureHandle=f,this.addRenderPass(v);var p=new xf(e,f);this.addRenderPass(p)}this.name="RenderFrame"+bf++,this.camera=t,this.editorTransform=Dt.fromArray(a)}var s=i.prototype;return s.setup=function(){this.drawObjectPass.setup(this.postProcessingEnabled)},s.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},s.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},s.dispose=function(t){var e=t!=null&&t.passes?t.passes:void 0;e!==Dr.keep&&this.renderPasses.forEach(function(r){r.dispose(e)}),this.renderPasses.length=0,this.disposed=!0},s.setRenderPasses=function(t){this.renderPasses=t.slice()},s.addRenderPass=function(t){this.renderPasses.push(t)},s.removeRenderPass=function(t){Re(this.renderPasses,t)},Mt(i,[{key:"isDisposed",get:function(){return this.disposed}}]),i}();function On(i){return i?new ht(i.getWidth(),i.getHeight()):new ht}var _f=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},ul=function(){function i(s){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var n=s.storageType,t=s.format,e=s.attachment;this.storageType=n,this.format=t,this.attachment=e}return Mt(i,[{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(),Ef=function(){function i(n){this.engine=n,this.temporaryRTs=[],this.currentFrame=0,this.maxUnusedFrames=4}var s=i.prototype;return s.flush=function(t,e){t===void 0&&(t=!1),e===void 0&&(e=-1),this.currentFrame++;for(var r=e>=0?e:this.maxUnusedFrames,a=0;a<this.temporaryRTs.length;a++){var o=this.temporaryRTs[a];!o.isOccupied&&(t||this.currentFrame-o.lastFrameReleased>r)&&(o.RT.dispose(),this.temporaryRTs.splice(a--,1))}},s.get=function(t,e,r,a,o,u){a===void 0&&(a=0),o===void 0&&(o=nr.Linear),u===void 0&&(u=ar.RGBA32);for(var l=e+"_"+r+"_"+a+"_"+o+"_"+u,h=M(this.temporaryRTs),c;!(c=h()).done;){var f=c.value;if(!f.isOccupied&&f.descriptionHash===l)return f.isOccupied=!0,f.RT.name=t,f.RT}var d,v,p=Ee.none;o===nr.Linear?d=P.LINEAR:o===nr.Nearest&&(d=P.NEAREST),u===ar.RGBA32?v=P.UNSIGNED_BYTE:u===ar.RGBAHalf&&(v=P.HALF_FLOAT),a===0?p=Ee.none:a===16?p=Ee.depth_stencil_opaque:a===24&&(p=Ee.depth_24_stencil_8_texture);var g=Wt.create(this.engine,{sourceType:st.framebuffer,minFilter:d,magFilter:d,internalFormat:P.RGBA,format:P.RGBA,type:v}),x=ja.create({name:t,storeAction:{},viewport:[0,0,e,r],attachments:[g],depthStencilAttachment:{storageType:p}},this.engine.renderer),b={RT:x,lastFrameReleased:0,descriptionHash:l,isOccupied:!0};return this.temporaryRTs.push(b),b.RT},s.release=function(t){for(var e=M(this.temporaryRTs),r;!(r=e()).done;){var a=r.value;if(a.RT===t){a.isOccupied=!1,a.lastFrameReleased=this.currentFrame;break}}},s.dispose=function(){for(var t=M(this.temporaryRTs),e;!(e=t()).done;){var r=e.value;r.RT.dispose()}},i}(),wf=typeof WebGL2RenderingContext=="function",yo=function(){function i(n){this.setupCapability(n)}var s=i.prototype;return s.isCompressedFormatSupported=function(t){return!!this.compressTextureCapabilityList.get(t)},s.setupCapability=function(t){var e,r=wf&&Z(t,WebGL2RenderingContext)?2:1,a=r===2,o=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),u=t.getExtension("WEBGL_depth_texture"),l=!!t.getExtension("OES_texture_half_float_linear"),h=!!t.getExtension("OES_texture_float_linear");this.level=r,this.type=a?"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"),u&&(this.UNSIGNED_INT_24_8=u.UNSIGNED_INT_24_8_WEBGL),a&&!l&&(l=xo(t,t.HALF_FLOAT)),a&&!h&&(h=xo(t,t.FLOAT)),this.internalFormatDepth16=a?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=a?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var c=a||t.getExtension("OES_texture_float")?t.FLOAT:0,f=a?WebGL2RenderingContext.HALF_FLOAT:((e=t.getExtension("OES_texture_half_float"))==null?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")],["
7EXT_sRGB",!!t.getExtension("EXT_sRGB")]]);var d={floatTexture:c,halfFloatTexture:f,maxSample:a?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:a?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:a?!!t.getExtension("EXT_color_buffer_float"):f>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:l,floatLinear:h,maxTextureAnisotropy:o?t.getParameter(o.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:a||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:a||!!t.getExtension("ANGLE_instanced_arrays"),ktx2Support:Sf(this.compressTextureCapabilityList),drawBuffers:a||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:a||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:a||!!u,writableFragDepth:a||!!t.getExtension("EXT_frag_depth")};this.detail=d,o&&(this.textureMaxAnisotropyExt=o.TEXTURE_MAX_ANISOTROPY_EXT)},s.framebufferTexture2D=function(t,e,r,a,o){var u=this.drawBufferExtension;if(this.level===1&&!u&&r>0)throw new Error("Draw multiple color buffers not available.");var l=u?u["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r];l?t.framebufferTexture2D(e,l,a,o,0):console.error("Invalid color attachment index: "+r+".")},s.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(this.level===1&&!r){if(e.length>1)throw new Error("Draw buffers not available.");return}var a=e.map(function(o,u){return o?r?r["COLOR_ATTACHMENT"+u+"_WEBGL"]:t["COLOR_ATTACHMENT"+u]:t.NONE});r?r.drawBuffersWEBGL(a):t.drawBuffers(a)},s.setTextureAnisotropic=function(t,e,r){var a=this.detail.maxTextureAnisotropy;a&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(a,r||4))},Mt(i,[{key:"isWebGL2",get:function(){return this.level===2}}]),i}();function xo(i,s){var n=i.createTexture(),t=!1;return i.getError(),i.bindTexture(i.TEXTURE_2D,n),i.texImage2D(i.TEXTURE_2D,0,i.R16F,1,1,0,i.RED,s,null),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.getError()||(t=!0),i.deleteTexture(n),t}var bo;(function(i){i.astc="WEBGL_compressed_texture_astc",i.astc_webkit="WEBKIT_WEBGL_compressed_texture_astc",i.etc="WEBGL_compressed_texture_etc",i.etc_webkit="WEBKIT_WEBGL_compressed_texture_etc",i.etc1="WEBGL_compressed_texture_etc1",i.pvrtc="WEBGL_compressed_texture_pvrtc",i.pvrtc_webkit="WEBKIT_WEBGL_compressed_texture_pvrtc",i.sRGB="EXT_sRGB"})(bo||(bo={}));function Sf(i){var s=i.get("WEBGL_compressed_texture_astc")||i.get("WEBKIT_WEBGL_compressed_texture_astc");return!!s}var Cf="\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}",Af="\nprecision mediump float;\nvarying vec2 vTex;\nuniform sampler2D _MainTex;\nvoid main(){\n gl_FragColor = texture2D(_MainTex, vTex);\n}",Mf=function(){function i(n){this.engine=n,this.currentFramebuffer=null,this.disposed=!1,this.blitGeometry=null,this.blitMaterial=null}var s=i.prototype;return s.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},s.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},s.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},s.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},s.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},s.getFramebuffer=function(){return this.currentFramebuffer},s.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.b
7indSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},s.setViewport=function(t,e,r,a){this.engine.viewport(t,e,r,a)},s.clear=function(t){this.engine.clear(t)},s.getWidth=function(){return this.engine.getWidth()},s.getHeight=function(){return this.engine.getHeight()},s.getShaderLibrary=function(){return this.engine.getShaderLibrary()},s.renderRenderFrame=function(t){var e,r=t,a=r.renderPasses;if(this.disposed){console.error("Renderer is destroyed, target: GLRenderer.");return}(e=r.renderer.engine.getShaderLibrary())==null||e.compileAllShaders(),r.setup(),this.setFramebuffer(null);var o=r.camera;this.renderingData.currentFrame=r,this.renderingData.currentCamera=o,this.setGlobalMatrix("effects_MatrixInvV",o.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",o.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",o.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",o.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",o.position),th(a);for(var u=M(a),l;!(l=u()).done;){var h=l.value;this.renderRenderPass(h)}for(var c=M(a),f;!(f=c()).done;){var d=f.value;d.onCameraCleanup(this)}},s.renderRenderPass=function(t){this.renderingData.currentPass=t,t.configure(this),t.execute(this)},s.renderMeshes=function(t){for(var e=M(t),r;!(r=e()).done;){var a=r.value;a.render(this)}},s.drawGeometry=function(t,e,r,a){a===void 0&&(a=0),this.engine.drawGeometry(t,e,r,a)},s.getTemporaryRT=function(t,e,r,a,o,u){return this.engine.renderTargetPool.get(t,e,r,a,o,u)},s.releaseTemporaryRT=function(t){this.engine.renderTargetPool.release(t)},s.blit=function(t,e,r){this.blitGeometry||(this.blitGeometry=Qe.create(this.engine,{mode:P.TRIANGLE_STRIP,attributes:{aPos:{type:P.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4})),this.blitMaterial||(this.blitMaterial=Ce.create(this.engine,{shader:{vertex:Cf,fragment:Af}}),this.blitMaterial.blending=!1,this.blitMaterial.depthTest=!1,this.blitMaterial.culling=!1);var a=r||this.blitMaterial;a.setTexture("_MainTex",t);var o=this.currentFramebuffer;if(e){var u=e.viewport,l=u[0],h=u[1],c=u[2],f=u[3];this.setFramebuffer(e),this.setViewport(l,h,c,f)}else this.setFramebuffer(null),this.setViewport(0,0,this.getWidth(),this.getHeight());this.drawGeometry(this.blitGeometry,Tt.IDENTITY,a),this.setFramebuffer(o)},s.dispose=function(){var t,e;this.disposed||((t=this.blitGeometry)==null||t.dispose(),this.blitGeometry=null,(e=this.blitMaterial)==null||e.dispose(),this.blitMaterial=null,this.disposed=!0)},s.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},i.create=function(t){return new i(t)},Mt(i,[{key:"renderingData",get:function(){return this.engine.renderingData}}]),i}(),Za=function(i){k(s,i);function s(t){var e;e=i.call(this,t)||this,e.visible=!0,e._color=new Ct(1,1,1,1),e.getHitTestParams=function(a){var o=Tt.fromScale(e.transform.size.x,e.transform.size.y,1),u=o.premultiply(e.transform.getWorldMatrix()),l=e.interaction;if(a||l){e.boundingBoxInfo.setGeometry(e.geometry,u);var h=e.boundingBoxInfo.getRawBoundingBoxTriangle();if(h){var c;return{behavior:((c=e.interaction)==null?void 0:c.behavior)||0,type:h.type,triangles:h.area,backfaceCulling:e.renderer.side===qe.FRONT,clipMasks:e.frameClipMasks}}}},e.renderer={renderMode:er.MESH,blending:Xt.ALPHA,texture:e.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:qe.DOUBLE,mask:0},e.defaultGeometry=Qe.create(e.engine,{attributes:{aPos:{type:P.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:P.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:P.TRIANGLES,drawCount:6}),e.geometry=e.defaultGeometry;var r=Ce.create(e.engine,{shader:{fragment:hf,vertex:lf,shared:!0}});return e.material=r,e.material.setColor("_Color",new Ct(1,1,1,1)),e.configureMaterial(e.renderer),e}var n=s.prototype;return n.setVisible=function(e){this.visible=e},n.getVisible=function(){return this.visible},n.setColor=function(e){Z(e,Ct)?this._color.copyFrom(e):this._color.setFromArray(e),this.material.setColor("_Color",this._color)},n.setTexture=function(e){var r=this;return vt(function(){var a;return pt(this,function(o){switch(o.label){case 0:return typeof e!="string"?[3,2]:[4,Wt.fromImage(e,r.item.engine)];case 1:return a=o.sent(),[3,3];case 2:a=e,o.label=3;case 3:return r.renderer.texture=a,r.material.setTexture("_MainTex",a),[2]}})})()},n.onUpdate=function(e){for(var r=0;r<this.materials.length;r++){var a=this.materials[r];a.setVector2("_Size",this.transform.size),(this.renderer.renderMode===er.BILLBOARD||this.renderer.renderMode===er.VERTICAL_BILLBOARD||this.renderer.renderMode===er.HORIZONTAL_BILLBOARD)&&a.setVector3("_Scale",this.transform.scale)}},n.render=function(e){this.getVisible()&&(this.maskManager.drawStencilMask(e,this),this.draw(e))},n.drawStencilMask=function(e){if(this.isActiveAndEnabled)for(var r=0;r<this.materials.length;r++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.materials[r],e,r)}
7,n.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},n.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.boundingBoxInfo.setGeometry(this.geometry,e);var r=this.boundingBoxInfo.getBoundingBoxTriangle(this.transform.size);return r},n.getBoundingBoxInfo=function(){var e=this.geometry.getAttributeData("aPos");if(e){var r=Ha(e,0,e.length/3);r.minimum.x*=this.transform.size.x,r.minimum.y*=this.transform.size.y,r.maximum.x*=this.transform.size.x,r.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(r.minimum,r.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},n.configureMaterial=function(e){var r=e.side,a=e.occlusion,o=e.blending,u=e.texture,l=this.maskManager.maskMode,h=this.material;h.blending=!0,h.depthTest=!0,h.depthMask=a,xn(h,o),Ua(h,r),h.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',h.setVector4("_TexOffset",new Dt(0,0,1,1)),h.setTexture("_MainTex",u);var c=yn(o),f=new Dt;return f.x=e.occlusion?+e.transparentOcclusion:1,f.y=c,f.z=e.renderMode,f.w=l,h.setVector4("_TexParams",f),f.x===0||this.maskManager.alphaMaskEnabled?h.enableMacro("ALPHA_CLIP"):h.disableMacro("ALPHA_CLIP"),h},n.draw=function(e){for(var r=0;r<this.materials.length;r++)e.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.materials[r],r)},n.fromData=function(e){i.prototype.fromData.call(this,e);var r,a=(r=e.renderer)!=null?r:{},o=e.mask;o&&this.maskManager.setMaskOptions(this.engine,o);var u,l,h;this.renderer={renderMode:(u=a.renderMode)!=null?u:er.MESH,blending:(l=a.blending)!=null?l:Xt.ALPHA,texture:a.texture?this.engine.findObject(a.texture):this.engine.whiteTexture,occlusion:!!a.occlusion,transparentOcclusion:!!a.transparentOcclusion||this.maskManager.maskMode===He.MASK,side:(h=a.side)!=null?h:qe.DOUBLE,mask:this.maskManager.getRefValue()},this.configureMaterial(this.renderer)},Mt(s,[{key:"color",get:function(){return this._color},set:function(e){this.setColor(e)}}]),s}(ze),If="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;}",Pf="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;}",To;(function(i){i[i.Fill=0]="Fill",i[i.Fit=1]="Fit",i[i.Crop=2]="Crop",i[i.Tile=3]="Tile"})(To||(To={}));var ca=function(i){k(s,i);function s(t){var e;e=i.call(this,t)||this,e.shapeDirty=!0,e.materialDirty=!0,e.graphicsPath=new rf,e.fills=[],e.strokeAttributes={width:1,alignment:.5,cap:dr.Butt,join:rr.Miter,miterLimit:10},e.strokeWidth=1,e.strokeCap=dr.Butt,e.strokeJoin=rr.Miter,e.strokes=[],e.fillMaterials=[],e.strokeMaterials=[],e.getHitTestParam
7s=function(o){var u=Tt.fromScale(e.transform.size.x,e.transform.size.y,1),l=u.premultiply(e.transform.getWorldMatrix());if(o){e.boundingBoxInfo.setGeometry(e.geometry,l);var h=e.boundingBoxInfo.getRawBoundingBoxTriangle();if(h)return{behavior:0,type:h.type,triangles:h.area,backfaceCulling:e.rendererOptions.side===qe.FRONT,clipMasks:e.frameClipMasks}}},e.rendererOptions={renderMode:er.MESH,blending:Xt.ALPHA,texture:e.engine.whiteTexture,occlusion:!1,transparentOcclusion:!1,side:qe.DOUBLE,mask:0};var r={type:_e.Solid,color:new Ct(1,1,1,1)};e.strokes.push(r);var a={type:_e.Solid,color:new Ct(1,1,1,1)};return e.fills.push(a),e.shapeAttributes={type:te.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},e.geometry=Qe.create(e.engine,{attributes:{aPos:{type:P.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:P.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:P.TRIANGLES,drawCount:6}),e.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0}),e}var n=s.prototype;return n.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},n.onUpdate=function(e){if(this.shapeDirty){var r=this.computeScreenScale();this.buildPath(this.shapeAttributes,r),this.buildGeometryFromPath(this.graphicsPath.shapePath,r),this.shapeDirty=!1}this.materialDirty&&(this.updateMaterials(),this.materialDirty=!1)},n.render=function(e){this.maskManager.drawStencilMask(e,this),this.draw(e)},n.drawStencilMask=function(e){if(this.isActiveAndEnabled){for(var r=0;r<this.fillMaterials.length;r++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[r],e,0);for(var a=0;a<this.strokeMaterials.length;a++)this.maskManager.drawGeometryMask(this.engine.renderer,this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[a],e,1)}},n.draw=function(e){for(var r=0;r<this.fillMaterials.length;r++)e.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.fillMaterials[r],0);for(var a=0;a<this.strokeMaterials.length;a++)e.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.strokeMaterials[a],1)},n.getBoundingBox=function(){var e=this.transform.getWorldMatrix();this.boundingBoxInfo.setGeometry(this.geometry,e);var r=this.boundingBoxInfo.getBoundingBoxTriangle();return r},n.getBoundingBoxInfo=function(){var e=this.geometry.getAttributeData("aPos");if(e){var r=Ha(e,0,e.length/3);r.minimum.x*=this.transform.size.x,r.minimum.y*=this.transform.size.y,r.maximum.x*=this.transform.size.x,r.maximum.y*=this.transform.size.y,this.boundingBoxInfo.reConstruct(r.minimum,r.maximum,this.transform.getWorldMatrix())}return this.boundingBoxInfo},n.buildGeometryFromPath=function(e,r){var a=e.shapePrimitives,o=[],u=[];if(this.fills.length>0)for(var l=M(a),h;!(h=l()).done;){var c=h.value,f=c.shape,d=[],v=u.length,p=o.length/2;f.build(d,r),f.triangulate(d,o,p,u,v)}var g=u.length;if(this.strokes.length>0)for(var x=M(a),b;!(b=x()).done;){var y=b.value,E=y.shape,_=[];u.length;var S=o.length/2,C=this.strokeAttributes;C.cap=this.strokeCap,C.join=this.strokeJoin,C.width=this.strokeWidth;var I=!0;this.shapeAttributes.type===te.Custom&&(I=E.closePath),E.build(_,r),jc(_,C,!1,I,o,2,S,u)}var R=u.length-g,O=o.length/2,F=this.geometry.getAttributeData("aPos"),L=this.geometry.getAttributeData("aUV"),V=this.geometry.getIndexData();(!F||F.length<O*3)&&(F=new Float32Array(O*3)),(!L||L.length<O*2)&&(L=new Float32Array(O*2)),(!V||V.length<u.length)&&(V=new Uint16Array(u.length));for(var U=Number.MAX_VALUE,W=Number.MAX_VALUE,G=Number.MIN_VALUE,B=Number.MIN_VALUE,X=0;X<O;X++){var H=X*3,Y=X*2,K=o[Y],z=o[Y+1];F[H]=K,F[H+1]=z,F[H+2]=0,U=Math.min(U,K),W=Math.min(W,z),G=Math.max(G,K),B=Math.max(B,z)}for(var Q=G-U,it=B-W,ct=0;ct<O;ct++){var nt=ct*3,yt=ct*2;L[yt]=(F[nt]-U)/Q,L[yt+1]=(F[nt+1]-W)/it}V.set(u),this.geometry.setAttributeData("aPos",F),this.geometry.setAttributeData("aUV",L),this.geometry.setIndexData(V),this.geometry.setDrawCount(u.length);var _t=2,Vt=this.geometry.subMeshes[0],mt=this.geometry.subMeshes[1];Vt.indexCount=g,mt.offset=g*_t,mt.indexCount=R},n.computeScreenScale=function(){var e=1,r=this.item.composition;if(!r)return e;var a=r.camera;if(!a)return e;var o=a.getModelViewProjection(s.tempMVP,this.transform.getWorldMatrix()),u=o.elements,l=Math.abs(u[15])||1,h=Math.sqrt(u[0]*u[0]+u[1]*u[1])/l,c=Math.sqrt(u[4]*u[4]+u[5]*u[5])/l,f=Math.max(h,c),d=this.engine.canvas.getBoundingClientRect(),v=Math.max(d.width,d.height)/2,p=f*v*this.engine.pixelRatio,g=1,x=2e3;return Math.max(g,Math.min(x,p))},n.buildPath=function(e,r){r===void 0&&(r=1),this.graphicsPath.clear();var a=r;switch(e.type){case te.Custom:{for(var o=this.shapeAttributes,u=o.points,l=o.easingIns,h=o.easingOuts,c=M(o.shapes),f;!(f=c()).done;){var d=f.value,v=d.indexes,p=u[v[0].point];this.graphicsPath.moveTo(p.x,p.y);for(var g=1;g<v.length;g++){var x=v[g],b=v[g-1],y=u[x.point],E=u[b.point],_=h[b.easingOut],S=l[x.easingIn];this.graphicsPath.bezierCurveTo(_.x+E.x,_.y+E.y,S.x+y.x,S.y+y.y,y.x,y.y,void 0,a)}
7if(d.close){var C=v[0],I=v[v.length-1],R=u[C.point],O=u[I.point],F=h[I.easingOut],L=l[C.easingIn];this.graphicsPath.bezierCurveTo(F.x+O.x,F.y+O.y,L.x+R.x,L.y+R.y,R.x,R.y,void 0,a),this.graphicsPath.closePath()}}break}case te.Ellipse:{var V=e;this.graphicsPath.ellipse(0,0,V.xRadius,V.yRadius);break}case te.Rectangle:{var U=e;this.graphicsPath.rect(-U.width/2,-U.height/2,U.width,U.height,U.roundness);break}case te.Star:{var W=e;this.graphicsPath.polyStar(W.pointCount,W.outerRadius,W.innerRadius,W.outerRoundness,W.innerRoundness,hn.Star);break}case te.Polygon:{var G=e;this.graphicsPath.polyStar(G.pointCount,G.radius,G.radius,G.roundness,G.roundness,hn.Polygon);break}}},n.updateMaterials=function(){for(var e=0;e<this.fills.length;e++)this.updatePaintMaterial(this.fillMaterials[e],this.fills[e]);for(var r=0;r<this.strokes.length;r++)this.updatePaintMaterial(this.strokeMaterials[r],this.strokes[r])},n.updatePaintMaterial=function(e,r){if(e.setFloat("_FillType",r.type),r.type===_e.Solid)e.color=r.color;else if(r.type===_e.GradientLinear||r.type===_e.GradientAngular||r.type===_e.GradientRadial)this.updateGradientMaterial(e,r.gradientStops,r.startPoint,r.endPoint);else if(r.type===_e.Texture){e.setInt("_ImageScaleMode",r.scaleMode),e.setVector2("_ImageSize",new ht(r.texture.getWidth(),r.texture.getHeight()));var a=this.getBoundingBox(),o=a.area[0].p1,u=a.area[1].p2;e.setVector2("_DestSize",new ht(o.x-u.x,o.y-u.y)),e.setFloat("_ImageOpacity",r.opacity),e.setFloat("_ImageScalingFactor",r.scalingFactor),e.setTexture("_ImageTex",r.texture);var l=r.textureTransform;e.setMatrix3("_TextureTransform",new ia().scale(l.scale.x,l.scale.y).rotate(l.rotation).translate(l.offset.x,l.offset.y).invert())}},n.updateGradientMaterial=function(e,r,a,o){for(var u=[],l=[],h=M(r.stops),c;!(c=h()).done;){var f=c.value,d=f.color;u.push(new Dt(d.r,d.g,d.b,d.a)),l.push(f.time)}e.setVector4Array("_Colors",u),e.setFloats("_Stops",l),e.setInt("_StopsCount",l.length),e.setVector2("_StartPoint",a),e.setVector2("_EndPoint",o)},n.createMaterialFromRendererOptions=function(e){var r={shader:{vertex:If,fragment:Pf,glslVersion:Ve.GLSL1}},a=Ce.create(this.engine,r),o=e,u=o.side,l=o.occlusion,h=o.blending,c=o.texture,f=this.maskManager.maskMode;a.blending=!0,a.depthTest=!0,a.depthMask=l,xn(a,h),Ua(a,u),a.shader.shaderData.properties='_ImageTex("_ImageTex",2D) = "white" {}',a.setVector4("_TexOffset",new Dt(0,0,1,1)),a.setTexture("_ImageTex",c);var d=yn(h),v=new Dt;return v.x=o.occlusion?+o.transparentOcclusion:1,v.y=d,v.z=o.renderMode,v.w=f,a.setVector4("_TexParams",v),v.x===0||this.maskManager.alphaMaskEnabled?a.enableMacro("ALPHA_CLIP"):a.disableMacro("ALPHA_CLIP"),a},n.fromData=function(e){i.prototype.fromData.call(this,e),this.shapeDirty=!0,e.mask&&this.maskManager.setMaskOptions(this.engine,e.mask);var r,a=(r=e.renderer)!=null?r:{},o,u;this.rendererOptions={renderMode:er.MESH,blending:(o=a.blending)!=null?o:Xt.ALPHA,texture:a.texture?this.engine.findObject(a.texture):this.engine.whiteTexture,occlusion:!!a.occlusion,transparentOcclusion:!!a.transparentOcclusion||this.maskManager.maskMode===He.MASK,side:(u=a.side)!=null?u:qe.DOUBLE,mask:this.maskManager.getRefValue()};var l;this.strokeCap=(l=e.strokeCap)!=null?l:dr.Butt;var h;this.strokeWidth=(h=e.strokeWidth)!=null?h:1;var c;this.strokeJoin=(c=e.strokeJoin)!=null?c:rr.Miter,this.fills.length=0,this.fillMaterials.length=0;for(var f=M(e.fills),d;!(d=f()).done;){var v=d.value;this.fills.push(this.createPaint(v)),this.fillMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}this.strokes.length=0,this.strokeMaterials.length=0;for(var p=M(e.strokes),g;!(g=p()).done;){var x=g.value;this.strokes.push(this.createPaint(x)),this.strokeMaterials.push(this.createMaterialFromRendererOptions(this.rendererOptions))}switch(this.materials=[].concat(this.fillMaterials,this.strokeMaterials),e.type){case te.Custom:{for(var b=e,y={type:te.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},E=M(b.points),_;!(_=E()).done;){var S=_.value;y.points.push(new ht(S.x,S.y))}for(var C=M(b.easingIns),I;!(I=C()).done;){var R=I.value;y.easingIns.push(new ht(R.x,R.y))}for(var O=M(b.easingOuts),F;!(F=O()).done;){var L=F.value;y.easingOuts.push(new ht(L.x,L.y))}y.shapes=b.shapes,this.shapeAttributes=y;break}case te.Ellipse:{var V=e,U={type:te.Ellipse,xRadius:V.xRadius,yRadius:V.yRadius};this.shapeAttributes=U;break}case te.Rectangle:{var W=e,G={type:te.Rectangle,width:W.width,height:W.height,roundness:W.roundness};this.shapeAttributes=G;break}case te.Star:{var B=e,X={type:te.Star,pointCount:B.pointCount,innerRadius:B.innerRadius,outerRadius:B.outerRadius,innerRoundness:B.innerRoundness,outerRoundness:B.outerRoundness};this.shapeAttributes=X;break}case te.Polygon:{var H=e,Y={type:te.Polygon,pointCount:H.pointCount,radius:H.radius,roundness:H.roundness};this.shapeAttributes=Y;break}}},n.createPaint=function(e){var r;switch(e.type){case _e.Solid:{r={type:e.type,color:new Ct().copyFrom(e.color)};break}case _e.GradientLinear:case _e.GradientAngular:case _e.GradientRadial:{r={type:e.type,gradientStops:J(e.gradientStops),startPoint:new ht().copyFrom(e.startPoint),endPoint:new ht().copyFrom(e.endPoint)};break}case _e.Texture:{var a,o=lt({offset:{x:0,y:0},rotation:0,scale:{x:1,y:1}},(a=e.textureTransform)!=null?a:{}),u,l;r={type:e.type,texture:this.engine.findObject(e.texture),scaleMode:e.scaleMode,scalingFactor:(u=e.scalingFactor)!=null?u:1,opacity:(l=e.opacity)!=null?l:1,textureTransform:{offset:new ht().copyFrom(o.offset),rotation:o.rotation,scale:new ht().copyFrom(o.scale)}
7};break}}return r},n.onApplyAnimationProperties=function(){this.shapeDirty=!0,this.materialDirty=!0},Mt(s,[{key:"shape",get:function(){return this.shapeAttributes}}]),s}(ze);ca.tempMVP=Tt.fromIdentity();ca=$([xt("ShapeComponent")],ca);var pe=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.loop=!1,t.amountOfMotion=1,t.animationLength=2,t.mode=1,t.startPositionX=0,t.startPositionY=0,t.startPositionZ=0,t.endPositionX=0,t.endPositionY=0,t.endPositionZ=0,t.amplitudeX=0,t.amplitudeY=0,t.amplitudeZ=0,t.phaseX=0,t.phaseY=0,t.phaseZ=0,t}var n=s.prototype;return n.onStart=function(){this.effectComponent=this.item.getComponent(ii)},n.onUpdate=function(e){this.updateFake3D()},n.updateFake3D=function(){if(this.effectComponent){var e=this.item.time%this.animationLength/this.animationLength,r=0,a=0,o=0;switch(this.mode){case 0:{var u=Math.PI;r=Math.sin(2*u*(e+this.phaseX))*this.amplitudeX,a=Math.sin(2*u*(e+this.phaseY))*this.amplitudeY,o=Math.sin(2*u*(e+this.phaseZ))*this.amplitudeZ;break}case 1:{var l=e;this.loop&&(l>.5&&(l=1-l),l*=2),r=this.startPositionX*(1-l)+l*this.endPositionX,a=this.startPositionY*(1-l)+l*this.endPositionY,o=this.startPositionZ*(1-l)+l*this.endPositionZ;break}}var h=this.effectComponent.material;h.setFloat("_PosX",r*this.amountOfMotion),h.setFloat("_PosY",a*this.amountOfMotion),h.setFloat("_PosZ",o*this.amountOfMotion)}},s}(ce);$([bt()],pe.prototype,"loop",void 0);$([bt()],pe.prototype,"amountOfMotion",void 0);$([bt()],pe.prototype,"animationLength",void 0);$([bt()],pe.prototype,"mode",void 0);$([bt()],pe.prototype,"startPositionX",void 0);$([bt()],pe.prototype,"startPositionY",void 0);$([bt()],pe.prototype,"startPositionZ",void 0);$([bt()],pe.prototype,"endPositionX",void 0);$([bt()],pe.prototype,"endPositionY",void 0);$([bt()],pe.prototype,"endPositionZ",void 0);$([bt()],pe.prototype,"amplitudeX",void 0);$([bt()],pe.prototype,"amplitudeY",void 0);$([bt()],pe.prototype,"amplitudeZ",void 0);$([bt()],pe.prototype,"phaseX",void 0);$([bt()],pe.prototype,"phaseY",void 0);$([bt()],pe.prototype,"phaseZ",void 0);pe=$([xt("Fake3DComponent")],pe);var _o;(function(i){i[i.Circular=0]="Circular",i[i.Linear=1]="Linear"})(_o||(_o={}));var Eo=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.color=new Ct(1,1,1,1),t.worldMatrix=new Tt,t.getHitTestParams=function(e){var r=Tt.fromScale(t.transform.size.x,t.transform.size.y,1),a=r.premultiply(t.transform.getWorldMatrix());if(e){t.boundingBoxInfo.setGeometry(t.clipGeometry,a);var o=t.boundingBoxInfo.getRawBoundingBoxTriangle();if(o)return{type:o.type,triangles:o.area,clipMasks:t.frameClipMasks}}},t}var n=s.prototype;return n.onAwake=function(){this.clipGeometry=Qe.create(this.engine,{attributes:{aPos:{type:P.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:P.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:P.TRIANGLES,drawCount:6});var e=Ce.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}});e.depthTest=!0,e.depthMask=!1,e.setColor("_Color",this.color),this.material=e},n.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},n.onPreRender=function(){this.setClipRectangle(),this.material.setColor("_Color",this.color)},n.render=function(e){this.maskManager.drawStencilMask(e,this),this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),wo(this.worldMatrix,this.transform.size.x,this.transform.size.y),e.drawGeometry(this.clipGeometry,this.worldMatrix,this.material)},n.onDestroy=function(){this.clipGeometry.dispose(),this.material.dispose()},n.drawStencilMask=function(e){this.isActiveAndEnabled&&(this.worldMatrix.copyFrom(this.transform.getWorldMatrix()),wo(this.worldMatrix,this.transform.size.x,this.transform.size.y),this.maskManager.drawGeometryMask(this.engine.renderer,this.clipGeometry,this.worldMatrix,this.material,e))},n.fromData=function(e){i.prototype.fromData.call(this,e),e.color&&this.color.copyFrom(e.color)},n.setClipRectangle=function(){this.setClipRectangleRecursive(this.item)},n.setClipRectangleRecursive=function(e){for(var r=M(e.children),a;!(a=r()).done;){var o=a.value,u=o.getComponent(ze);u&&we(u.frameClipMasks,this),this.setClipRectangleRecursive(o)}},s}(ze);Eo=$([xt("FrameComponent")],Eo);function wo(i,s,n){var t=i.elements;t[0]*=s,t[1]*=s,t[2]*=s,t[3]*=s,t[4]*=n,t[5]*=n,t[6]*=n,t[7]*=n}var So=function(i){k(s,i);function s(t,e){var r;return r=i.call(this,t)||this,e&&r.fromData(e),r}var n=s.prototype;return n.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var e=this.item.composition.camera;e.near=this.options.near,e.far=this.options.far,e.fov=this.options.fov,e.clipMode=this.options.clipMode,e.transform.parentTransform=this.transform.parentTransform,e.position=this.transform.position,e.setQuat(this.transform.getQuaternion().clone().conjugate())}},n.fromData=function(e){i.prototype.fromData.call(this,e),this.options=e.options},s}(ce);So=$([xt(tt.CameraController)],So);
7function fa(i){return fa=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},fa(i)}function Rf(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function Ir(i){var s=typeof Map=="function"?new Map:void 0;return Ir=function(t){if(t===null||!Rf(t))return t;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(typeof s<"u"){if(s.has(t))return s.get(t);s.set(t,e)}function e(){return ti(t,arguments,fa(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),wi(e,t)},Ir(i)}var Ff=function(i){k(s,i);function s(){return i.apply(this,arguments)}return s}(Ir(Li)),Co="click",Ao="touchstart",Mo="touchmove",Io="touchend",Po;(function(i){i[i.PointerDown=0]="PointerDown",i[i.PointerUp=1]="PointerUp",i[i.PointerMove=2]="PointerMove"})(Po||(Po={}));var Of=function(){function i(n,t){t===void 0&&(t=!1),this.engine=n,this.allowPropagation=t,this.enabled=!0,this.skipPointerMovePicking=!0,this.handlers={},this.nativeHandlers={},this.target=null}var s=i.prototype;return s.bindListeners=function(t){var e=this;this.target=t;var r,a,o,u,l;l=function(g){return g};var h="mousedown",c="mousemove",f="mouseup",d="mouseleave",v=function(g,x,b,y,E){y===void 0&&(y=0),E===void 0&&(E=0);var _=0,S=0,C=performance.now();if(!e.target)return Nt.warn("Trigger TouchEvent after EventSystem is disposed."),{x,y:b,vx:0,vy:S,dx:y,dy:E,ts:C,width:0,height:0,origin:g};var I=e.target,R=I.width,O=I.height;if(u){var F=C-u.ts;_=(y-u.dx)/F||0,S=(E-u.dy)/F||0,u={dx:y,dy:E,ts:C}}return{x,y:b,vx:_,vy:S,dx:y,dy:E,ts:C,width:R,height:O,origin:g}};Pu()&&(l=function(g){var x=g.touches,b=g.changedTouches;return x[0]||b[0]},h="touchstart",c="touchmove",f="touchend",d="touchcancel");var p;this.nativeHandlers=(p={},p[h]=function(g){if(e.enabled){var x=l(g),b=Ln(x);r=b.x,a=b.y,u=o={clientX:x.clientX,clientY:x.clientY,ts:performance.now(),x:r,y:a},e.dispatchEvent(Ao,v(g,r,a))}},p[c]=function(g){if(o&&e.enabled){var x=Ln(l(g));r=x.x,a=x.y,e.dispatchEvent(Mo,v(g,r,a,r-o.x,a-o.y))}},p[f]=function(g){if(o&&e.enabled){!e.allowPropagation&&g.cancelable&&(g.preventDefault(),g.stopPropagation());var x=l(g),b=Ln(x),y=Math.abs(o.clientX-x.clientX)+Math.abs(o.clientY-x.clientY);r=b.x,a=b.y,y<4&&e.dispatchEvent(Co,v(g,r,a)),e.dispatchEvent(Io,v(g,r,a,r-o.x,a-o.y))}o=0},p),this.nativeHandlers[d]=this.nativeHandlers[f],Object.keys(this.nativeHandlers).forEach(function(g){var x;(x=e.target)==null||x.addEventListener(String(g),e.nativeHandlers[g])}),this.addEventListener(Co,this.onClick.bind(this)),this.addEventListener(Ao,this.onPointerDown.bind(this)),this.addEventListener(Io,this.onPointerUp.bind(this)),this.addEventListener(Mo,this.onPointerMove.bind(this))},s.dispatchEvent=function(t,e){var r=this.handlers[t];r==null||r.forEach(function(a){return a(e)})},s.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),we(r,e),function(){Re(r,e)}},s.removeEventListener=function(t,e){var r=this.handlers[t];r&&Re(r,e)},s.onClick=function(t){for(var e=t.x,r=t.y,a=[],o=M(this.engine.compositions),u;!(u=o()).done;){var l=u.value,h;(h=a).push.apply(h,[].concat(l.hitTest(e,r)))}for(var c=M(a),f;!(f=c()).done;){var d=f.value,v=d.item.composition;if(v){var p=lt({},d,{compositionId:v.id,compositionName:v.name});d.item.emit("click",d),v.emit("click",p),this.engine.emit("click",p)}}},s.onPointerDown=function(t){this.handlePointerEvent(t,0)},s.onPointerUp=function(t){this.handlePointerEvent(t,1)},s.onPointerMove=function(t){this.handlePointerEvent(t,2)},s.handlePointerEvent=function(t,e){var r=null,a=t.x,o=t.y,u=t.width,l=t.height;if(!(e===2&&this.skipPointerMovePicking))for(var h=M(this.engine.compositions),c;!(c=h()).done;){var f=c.value,d=f.hitTest(a,o);d.length>0&&(r=d[d.length-1])}var v=new ic;v.position.x=(a+1)/2*u,v.position.y=(o+1)/2*l,v.delta.x=t.vx*u,v.delta.y=t.vy*l;var p=v.pointerCurrentRaycast;r&&(p.point=r.position,p.item=r.item);var g="pointerdown";switch(e){case 0:g="pointerdown";break;case 1:g="pointerup";break;case 2:g="pointermove";break}if(r){var x=r.item,b=x.composition;x.emit(g,v),b.emit(g,v),this.engine.emit(g,v)}},s.dispose=function(){var t=this;this.target&&(this.handlers={}
7,Object.keys(this.nativeHandlers).forEach(function(e){var r;(r=t.target)==null||r.removeEventListener(String(e),t.nativeHandlers[e])}),this.nativeHandlers={})},i}();function Ln(i){var s=i.target,n=i.clientX,t=i.clientY,e=s.getBoundingClientRect(),r=e.left,a=e.top,o=e.width,u=e.height,l=(n-r)/o*2-1,h=1-(t-a)/u*2;return{x:l,y:h}}var Lf=function(i){k(s,i);function s(){return i.apply(this,arguments)}return s}(Ir(Li)),Nf="\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",Vf="\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",kf=1,Df=function(){function i(n,t,e){this.transform=t,this.engine=e,this.color=n.options.previewColor;var r=this.createMaterial(),a=this.createGeometry();this.mesh=this.createMesh(a,r),this.updateMesh()}var s=i.prototype;return s.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),a=new D,o=new Zt,u=this.transform.scale.clone();this.transform.assignWorldTRS(a,o,u),e.x=u.x,e.y=u.y,r.x=a.x,r.y=a.y,r.z=a.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",o)},s.createMaterial=function(){var t=[["ENV_EDITOR",this.engine.env===Ur]],e=J(this.color).getValue(0),r={shader:{vertex:Nf,fragment:Vf,glslVersion:Ve.GLSL1,macros:t}},a=Ce.create(this.engine,r);return a.blending=!0,a.depthTest=!1,a.setVector4("uPos",new Dt(0,0,0,0)),a.setVector2("uSize",new ht(1,1)),a.setVector4("uColor",new Dt(e[0]/255,e[1]/255,e[2]/255,e[3])),a.setQuaternion("uQuat",new Zt(0,0,0,0)),a},s.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return Qe.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:P.LINES,maxVertex:4})},s.createMesh=function(t,e){return ai.create(this.engine,{name:"Interact_preview"+kf++,priority:0,worldMatrix:Tt.fromIdentity(),geometry:t,material:e})},i}(),Ro=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.downgrade=.95,t.speed=25,t.dragRatio=[1,1],t.dragRange={dxRange:[0,0],dyRange:[0,0]},t.invalidBorderRange=0,t.invalidByBorderRange=!1,t.duringPlay=!1,t._interactive=!0,t.lastTime=-1,t.getHitTestParams=function(e){if(t.clickable){var r=t.item.props.content.options.behavior,a=t.getBoundingBox();if(a)return{type:a.type,triangles:a.area,behavior:r,clipMasks:t.frameClipMasks}}},t}var n=s.prototype;return n.getDragRangeX=function(){return this.dragRange.dxRange},n.setDragRangeX=function(e,r){this.dragRange.dxRange=[e,r]},n.getDragRangeY=function(){return this.dragRange.dyRange},n.setDragRangeY=function(e,r){this.dragRange.dyRange=[e,r]},n.onStart=function(){var e=this.item.engine.env,r=this.interactData.options,a=r.type,o=r.showPreview;a===Ye.CLICK&&(this.clickable=!0,o&&e===Ur&&(this.previewContent=new Df(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},n.onDisable=function(){i.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())},n.onEnable=function(){i.prototype.onEnable.call(this);var e=this.interactData.options.type,r=this.item.engine.env;if(e===Ye.CLICK)this.clickable=!0;else if(e===Ye.DRAG){var a=this.interactData.options,o=a.enableInEditor;if(r!==Ur||o){var u,l=((u=this.item.composition)!=null?u:{}).event;l&&this.beginDragTarget(a,l)}}},n.onUpdate=function(e){var r;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var a,o=this.item.props.content.options;(a=this.item.composition)==null||a.addInteractiveItem(this.item,o.type)}}else if(this.item.time>=0&&e>0){var u,l=this.item.props.content.options;(u=this.item.composition)==null||u.addInteractiveItem(this.item,l.type)}this.lastTime=this.item.time,(r=this.previewContent)==null||r.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,Fo(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},n.render=function(e){this.previewContent&&this.previewContent.mesh.render(e)},n.onDestroy=function(){var e;(e=this.previewContent)==null||e.mesh.dispose()},n.endDragTarget=function(){},n.handleDragMove=function(e,r){if(!(!(e!=null&&e.cameraParam)||!this.canInteract()||!this.item.composition)){var a=e.cameraParam,o=a.position,u=a.fov,l=r.dy,h=r.dx*r.width/r.height,c=o[2],f=Math.tan(u*Math.PI/180/2)*Math.abs(c),d=l*f,v=h*f,p=this.dragRange,g=p.dxRange,x=p.dyRange,b=o[
70]-this.dragRatio[0]*v,y=o[1]-this.dragRatio[1]*d,E=g[0],_=g[1],S=x[0],C=x[1];if(b=he(b,E,_),y=he(y,S,C),b!==E&&b!==_&&E!==_){var I;(I=r.origin)==null||I.preventDefault()}if(y!==S&&y!==C&&S!==C){var R;(R=r.origin)==null||R.preventDefault()}this.item.composition.camera.position=new D(b,y,c)}},n.beginDragTarget=function(e,r){var a=this;if(e.target==="camera"){var o,u={touchstart:function(l){var h;if(a.canInteract()&&(a.invalidByBorderRange=a.checkInvalidBorderRange({x:l.x,y:l.y}),!a.invalidByBorderRange)){a.dragEvent=null,a.bouncingArg=null;var c=(h=a.item.composition)==null?void 0:h.camera;o={x:l.x,y:l.y,cameraParam:{position:(c==null?void 0:c.position.toArray())||[0,0,8],fov:(c==null?void 0:c.fov)||60}}}},touchmove:function(l){a.invalidByBorderRange||(a.handleDragMove(o,l),a.bouncingArg=l)},touchend:function(l){if(a.canInteract()){var h=a.bouncingArg;!Fo(h,3)&&h&&(h.vx*=a.speed,h.vy*=a.speed,a.dragEvent=lt({},o)),o=null}}};Object.keys(u).forEach(function(l){r.addEventListener(l,u[l])}),u.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(s).endDragTarget=function(){Object.keys(u).forEach(function(l){r.removeEventListener(l,u[l])})}}},n.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),r=fc(D.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return r.forEach(function(a){e.transformPoint(a.p0),e.transformPoint(a.p1),e.transformPoint(a.p2)}),{type:Ze.triangle,area:r}},n.fromData=function(e){if(i.prototype.fromData.call(this,e),this.interactData=e,e.options.type===Ye.DRAG){var r=e.options;r.dxRange&&(this.dragRange.dxRange=r.dxRange),r.dyRange&&(this.dragRange.dyRange=r.dyRange)}},n.canInteract=function(){var e;return!!((e=this.item.composition)!=null&&e.interactive)&&this._interactive},n.checkInvalidBorderRange=function(e){var r=this.invalidBorderRange;if(r){var a=0,o=0,u=0,l=0;if(typeof r=="number")a=r,o=r,u=r,l=r;else if(wr(r)){var h,c,f,d,v;h=r,c=h[0],a=c===void 0?0:c,f=h[1],o=f===void 0?0:f,d=h[2],u=d===void 0?0:d,v=h[3],l=v===void 0?0:v}if(e.x<l-1||e.x>1-o||e.y<a-1||e.y>1-u)return!0}return!1},Mt(s,[{key:"interactive",get:function(){return this._interactive},set:function(e){this._interactive=e,e||(this.bouncingArg=null)}}]),s}(ze);Ro=$([xt(tt.InteractComponent)],Ro);function Fo(i,s){var n=1e-5*(s||1);return i&&Math.abs(i.vx||0)<n&&Math.abs(i.vy||0)<n}var zf=function(i){k(s,i);function s(){var n;return n=i.apply(this,arguments)||this,n.name="sprite",n}return s}(Ir(Li)),or=function(){function i(){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0}var s=i.prototype;return s.play=function(){switch(this.playState){case 0:break;case 1:this.playState=0,this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1;break}},s.pause=function(){switch(this.playState){case 0:this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1;break}},s.setTime=function(t){this.time=t},s.getTime=function(){return this.time},s.setDuration=function(t){this.duration=t},s.getDuration=function(){return this.duration},s.getPlayState=function(){return this.playState},s.prepareFrame=function(t){},s.processFrame=function(t){},s.onPlayableDestroy=function(){},s.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},i}(),Bf=function(){function i(){this.context={deltaTime:0,output:this}}var s=i.prototype;return s.setUserData=function(t){this.userData=t},s.getUserData=function(){return this.userData},s.prepareFrame=function(){},s.processFrame=function(){},i}(),Be=function(i){k(s,i);function s(){return i.apply(this,arguments)}return s}(xe),je;(function(i){i[i.Playing=0]="Playing",i[i.Paused=1]="Paused",i[i.Stopped=2]="Stopped"})(je||(je={}));var Uf=[1,1,1,1],Gf=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.renderColor=[1,1,1,1],t}var n=s.prototype;return n.processFrame=function(e){var r=e.output.getUserData();if(Z(r,Ie)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(r)),!this.activeMaterial){var a,o;this.activeMaterial=(a=this.activeComponent)==null?void 0:a.material;var u=(o=this.activeMaterial)==null?void 0:o.getColor("_Color");u&&(this.startColor=u.toArray())}var l=lc(Uf,1),h,c=this.time/this.getDuration(),f=this.opacityOverLifetime,d=this.colorOverLifetime;if(d&&(l=Ql(d,c,!0),h=!0),f&&(l[3]*=f.getValue(c),h=!0),h){var v,p;hc(this.renderColor,l,this.startColor),(p=this.activeMaterial)==null||(v=p.getColor("_Color"))==null||v.setFromArray(this.renderColor)}}},n.create=function(e){this.clipData=e;var r=e.colorOverLifetime;if(r){var a;this.opacityOverLifetime=J((a=r.opacity)!=null?a:1),r.color&&r.color[0]===dt.GRADIENT_COLOR&&(this.colorOverLifetime=Va(r.color[1]))}return this},n.getActiveComponent=function(e){return e.getComponent(Za)},s}(or),Wf=function(){function i(){}var s=i.prototype;return s.onEvent=function(t,e){},i}(),Hf=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.onEvent=function(e,r){e.emit("animationevent",r)},s}(Ir(Wf)),Oo=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.duration=0,t.positionCurves=[],t.rotationCurves=[],t.eulerCurves=[],t.scaleCurves=[],t.floatCurves=[],t.colorCurves=[],t.events=[],t}var n=s.prototype;return n.sampleAnimation=function(e,r){for(var a=he(r,0,this.duration),o=M(this.positionCurves),u;!(u=o()).done;){var l=u.value,h=l.keyFrames.getValue(a),c=this.findTarget(e,l.path);c==null||c.transform.setPosition(h.x,h.y,h.z)}for(var f=M(this.rotationCurves),d;!(d=f()).done;){var v=d.value,p=v.keyFrames.getValue(a),g=this.findTarget(e,v.path);g==null||g.transform.setQuaternion(p.x,p.y,p.z,p.w)}for(var x=M(this.eulerCurves),b;!(b=x()).done;){var y=b.value,E=y.keyFrames.getValue(a),_=this.findTarget(e,y.path);_==null||_.transform.setRotation(E.x,E.y,E.z)}for(var S=M(this.scaleCurves),C;!(C=S()).done;){var I=C.value,R=I.keyFrames.getValue(a),O=this.findTarget(e,I.path);O==null||O.transform.setScale(R.x,R.y,R.z)}},n.fromData=function(e){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 r=0;if(e.positionCurves)for(var a=M(e.positionCurves),o;!(o=a()).done;){var u=o.value,l={path:u.path,keyFrames:J(u.keyFrames)};r=Math.max(r,l.keyFrames.getMaxTime()),this.positionCurves.push(l)}if(e.rotationCurves)for(var h=M(e.rotationCurves),c;!(c=h()).done;){var f=c.value,d={path:f.path,keyFrames:J(f.keyFrames)};r=Math.max(r,d.keyFrames.getMaxTime()),this.rotationCurves.push(d)}if(e.eulerCurves)for(var v=M(e.eulerCurves),p;!(p=v()).done;){var g=p.value,x={path:g.path,keyFrames:J(g.keyFrames)};r=Math.max(r,x.keyFrames.getMaxTime()),this.eulerCurves.push(x)}if(e.scaleCurves)for(var b=M(e.scaleCurves),y;!(y=b()).done;){var E=y.value,_={path:E.path,keyFrames:J(E.keyFrames)};r=Math.max(r,_.keyFrames.getMaxTime()),this.scaleCurves.push(_)}if(e.floatCurves)for(var S=M(e.floatCurves),C;!(C=S()).done;){var I=C.value,R={path:I.path,keyFrames:J(I.keyFrames),property:I.property,className:I.className};r=Math.max(r,R.keyFrames.getMaxTime()),this.floatCurves.push(R)}if(e.colorCurves)for(var O=M(e.colorCurves),F;!(F=O()).done;){var L=F.value,V={path:L.path,keyFrames:J(L.keyFrames),property:L.property,className:L.className};r=Math.max(r,V.keyFrames.getMaxTime()),this.colorCurves.push(V)}if(e.duration!==void 0?this.duration=e.duration:this.duration=r,e.events)for(var U=M(e.events),W;!(W=U()).done;
7){var G=W.value,B,X={name:G.name,startTime:G.startTime,duration:(B=G.duration)!=null?B:0,event:new Hf};this.events.push(X)}},n.findTarget=function(e,r){for(var a=e,o=r.split("."),u=M(o),l;!(l=u()).done;){for(var h=l.value,c=!1,f=M(a.children),d;!(d=f()).done;){var v=d.value;if(v.name===h){a=v,c=!0;break}}if(!c)return}return a},s}(xe);Oo=$([xt(tt.AnimationClip)],Oo);var Rr=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.clipPlayables=[],t.clipWeights=[],t}var n=s.prototype;return n.processFrame=function(e){for(var r=M(this.clipPlayables),a;!(a=r()).done;){var o=a.value;o.processFrame(e)}this.evaluate(e)},n.setClipWeight=function(e,r){if(Z(e,or)){for(var a=0;a<this.clipPlayables.length;a++)if(this.clipPlayables[a]===e){this.clipWeights[a]=r;return}}else this.clipWeights.length<e+1&&(this.clipWeights.length=e+1),this.clipWeights[e]=r},n.getClipWeight=function(e){return this.clipWeights[e]},n.getClipPlayable=function(e){return this.clipPlayables[e]},n.evaluate=function(e){},s}(or),Xf=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.evaluate=function(e){var r=e.output.getUserData();if(Z(r,Ie)){for(var a=r,o=!1,u=0;u<this.clipPlayables.length;u++)if(this.getClipWeight(u)>0){o=!0;break}o?(a.transform.setValid(!0),a.setActive(!0)):(a.transform.setValid(!1),a.setActive(!1))}},s}(Rr),jf=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.processFrame=function(e){var r=e.output.getUserData();Z(r,Ie)&&(r.time=this.time)},s}(or),li=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.processFrame=function(e){this.value=this.curve.getValue(this.time/this.getDuration())},s}(or),Vi=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.propertyPath="",t.propertyName="",t}var n=s.prototype;return n.evaluate=function(e){var r=e.output.getUserData();if(r){this.directTarget||this.preparePath(r);var a=!1;if(this.propertyValue=this.directTarget[this.propertyName],!(this.propertyValue===void 0||this.propertyValue===null)){this.resetPropertyValue();for(var o=0;o<this.clipPlayables.length;o++){var u=this.getClipWeight(o);if(u>0){var l=this.getClipPlayable(o);if(!Z(l,li)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var h=l.value;this.addWeightedValue(h,u),a=!0}}a&&(this.directTarget[this.propertyName]=this.propertyValue,Z(r,ce)&&r.onApplyAnimationProperties())}}},n.preparePath=function(e){for(var r=this.propertyPath.split("."),a=e,o=0;o<r.length-1;o++){var u=a[r[o]];u===void 0&&console.error("The "+r[o]+" property of "+e+" was not found"),a=u}r.length>0&&(this.propertyName=r[r.length-1]),this.directTarget=a},s}(Rr),Yf=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.resetPropertyValue=function(){this.propertyValue.setZero()},n.addWeightedValue=function(e,r){var a=this.propertyValue;a.r+=e.r*r,a.g+=e.g*r,a.b+=e.b*r,a.a+=e.a*r},s}(Vi),Zf=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.resetPropertyValue=function(){this.propertyValue=0},n.addWeightedValue=function(e,r){this.propertyValue+=e*r},s}(Vi),qf=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.evaluate=function(e){},s}(Rr),Qf=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.evaluate=function(e){},s}(Rr),Kf=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.processFrame=function(e){var r=e.output.getUserData();Z(r,sr)&&r.tick(this.getTime()-r.getTime())},s}(or),$f=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.evaluate=function(e){var r=e.output.getUserData();if(Z(r,sr)){for(var a=r,o=!1,u=0;u<this.clipPlayables.length;u++)if(this.getClipWeight(u)>0){o=!0;break}o?a.item.setActive(!0):a.item.setActive(!1)}},s}(Rr),Jf=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.evaluate=function(e){},s}(Rr),td=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},n.addWeightedValue=function(e,r){var a=this.propertyValue;a.x+=e.x*r,a.y+=e.y*r,a.z+=e.z*r,a.w+=e.w*r},s}(Vi),ed=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0},n.addWeightedValue=function(e,r){var a=this.propertyValue;a.x+=e.x*r,a.y+=e.y*r,a.z+=e.z*r},s}(Vi),rd=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},n.addWeightedValue=function(e,r){var a=this.propertyValue;a.x+=e.x*r,a.y+=e.y*r},s}(Vi),vi=new Me,ur=new D(1,1,1),id=new D,nd=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.start=function(){var e=this.boundObject,r=e.transform.scale;this.originalTransform={position:e.transform.position.clone(),rotation:e.transform.getRotation().clone(),scale:new D(r.x,r.y,r.x)};var a=this.data.positionOverLifetime,o=this.data.rotationOverLifetime,u=this.data.sizeOverLifetime;if(a&&Object.keys(a).length!==0){this.positionOverLifetime=a,a.path&&(this.originalTransform.path=J(a.path));var l=a.linearX||a.linearY||a.linearZ;l&&(this.linearVelOverLifetime={x:a.linearX&&J(a.linearX),y:a.linearY&&J(a.linearY),z:
7a.linearZ&&J(a.linearZ),asMovement:a.asMovement,enabled:!!l});var h=a.orbitalX||a.orbitalY||a.orbitalZ;h&&(this.orbitalVelOverLifetime={x:a.orbitalX&&J(a.orbitalX),y:a.orbitalY&&J(a.orbitalY),z:a.orbitalZ&&J(a.orbitalZ),center:Qu(a.orbCenter),asRotation:a.asRotation,enabled:!!h}),this.speedOverLifetime=a.speedOverLifetime&&J(a.speedOverLifetime)}if(u&&(u.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=J(u.x||1),this.sizeYOverLifetime=J(u.y||1),this.sizeZOverLifetime=J(u.z||1)):this.sizeXOverLifetime=J(u.size||1)),o&&(this.rotationOverLifetime={asRotation:o.asRotation,separateAxes:o.separateAxes,z:J(o.z||0)},o.separateAxes)){var c=this.rotationOverLifetime;c.x=J(o.x||0),c.y=J(o.y||0)}this.gravity=D.fromArray((a==null?void 0:a.gravity)||[]);var f;this.gravityModifier=J((f=a==null?void 0:a.gravityOverLifetime)!=null?f:0),this.direction=a!=null&&a.direction?D.fromArray(a.direction).normalize():new D,this.startSpeed=(a==null?void 0:a.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},n.processFrame=function(e){if(!this.boundObject){var r=e.output.getUserData();Z(r,Ie)&&(this.boundObject=r,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},n.sampleAnimation=function(){var e=this,r=this.boundObject,a=this.getDuration(),o=this.time/a;if(o=o<0?0:o,this.sizeXOverLifetime){ur.x=this.sizeXOverLifetime.getValue(o),this.sizeSeparateAxes?(ur.y=this.sizeYOverLifetime.getValue(o),ur.z=this.sizeZOverLifetime.getValue(o)):ur.z=ur.y=ur.x;var u=this.originalTransform.scale;r.transform.setScale(ur.x*u.x,ur.y*u.y,ur.z*u.z)}if(this.rotationOverLifetime){var l=function(v){return e.rotationOverLifetime.asRotation?v.getValue(o):v.getIntegrateValue(0,o,a)},h=l(this.rotationOverLifetime.z),c=this.rotationOverLifetime.separateAxes;vi.x=c?l(this.rotationOverLifetime.x):0,vi.y=c?l(this.rotationOverLifetime.y):0,vi.z=h;var f=vi.addEulers(this.originalTransform.rotation,vi);r.transform.setRotation(f.x,f.y,f.z)}if(this.positionOverLifetime){var d=id;qu(d,this,this.gravity,this.time,a,this.originalTransform.position,this.velocity),this.originalTransform.path&&d.add(this.originalTransform.path.getValue(o)),r.transform.setPosition(d.x,d.y,d.z)}},s}(or),Lo=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){var e=new nd;return e.data=this.transformAnimationData,e},n.fromData=function(e){this.transformAnimationData=e},s}(Be);Lo=$([xt(tt.TransformPlayableAsset)],Lo);var ll=function(){function i(){this.start=0,this.duration=0}var s=i.prototype;return s.toLocalTime=function(t){var e=t-this.start,r=this.duration;return e-r>0&&(this.endBehavior===Gt.restart?e=e%r:this.endBehavior===Gt.freeze&&(e=Math.min(r,e))),e},i}(),ke=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.trackType=0,t.clipSeed=0,t.clips=[],t.children=[],t}var n=s.prototype;return n.updateAnimatedObject=function(e){return e},n.createTrackMixer=function(){return new Rr},n.createOutput=function(){var e=new Bf;return e},n.createPlayableGraph=function(e){var r=this.createMixerPlayableGraph(e);return r},n.createMixerPlayableGraph=function(e){for(var r=[],a=M(this.clips),o;!(o=a()).done;){var u=o.value;r.push(u)}var l=this.compileClips(r,e);return l},n.compileClips=function(e,r){for(var a=this.createTrackMixer(),o=M(e),u;!(u=o()).done;){var l=u.value,h=this.createClipPlayable(l);h.setDuration(l.duration);var c=new ad(l,h,a);r.push(c),a.clipPlayables.push(h),a.setClipWeight(h,0)}return a},n.createPlayable=function(){return new or},n.getChildTracks=function(){return this.children},n.addChild=function(e){this.children.push(e),e.parent=this},n.createClip=function(e,r){var a=new ll;return a.asset=new e(this.engine),a.name=r||"TimelineClip"+a.id,this.addClip(a),a},n.getClips=function(){return this.clips},n.findClip=function(e){for(var r=M(this.clips),a;!(a=r()).done;){var o=a.value;if(o.name===e)return o}},n.addClip=function(e){e.id=(this.clipSeed++).toString(),this.clips.push(e)},n.createClipPlayable=function(e){return e.asset.createPlayable()},n.fromData=function(e){i.prototype.fromData.call(this,e);for(var r=M(this.children),a;!(a=r()).done;){var o=a.value;o.parent=this}},s}(Be);$([bt(ll)],ke.prototype,"clips",void 0);$([bt()],ke.prototype,"children",void 0);ke=$([xt(tt.TrackAsset)],ke);var No;(function(i){i[i.MasterTrack=0]="MasterTrack",i[i.ObjectTrack=1]="ObjectTrack"})(No||(No={}));var ad=function(){function i(n,t,e){this.clip=n,this.playable=t,this.parentMixer=e}var s=i.prototype;return s.evaluateAt=function(t){var e=this.clip,r=1,a=!1,o=!1;t>=e.start+e.duration&&e.endBehavior===Gt.destroy?(r=0,a=!0):t-this.clip.start>=0?(r=1,o=!0):t<e.start&&(r=0),o&&this.playable.getPlayState()!==je.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var u=e.toLocalTime(t);this.playable.setTime(u),a&&this.playable.getPlayState()===je.Playing&&this.playable.pause()},Mt(i,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),i}(),da=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){return new Xf},s}(ke);da=$([xt(tt.ActivationTrack)],da);var hi=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.propertyNames=[],t.path="",t}var n=s.prototype;return n.fromData=function(e){i.prototype.fromData.call(this,e);var r=this.path.split(".");this.propertyNames=r},s}(ke);$([bt()],hi.prototype,"path",void 0);var Vo=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){var e=new Zf;return e.propertyPath=this.path,e},s}(hi);Vo=$([xt(tt.FloatPropertyTrack)],Vo);var ko=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){return new Qf},s}(ke);ko=$([xt(tt.SpriteColorTrack)],ko);var Do=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.updateAnimatedObject=function(e){if(!Z(e,Ie))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");return e.getComponent(sr)},n.createTrackMixer=function(){return new $f},s}(ke);Do=$([xt(tt.SubCompositionTrack)],Do);var zo=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){return new Jf},s}(ke);zo=$([xt(tt.TransformTrack)],zo);var va=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.updateAnimatedObject=function(e){if(!Z(e,ze))throw new Error("MaterialTrack: expected a RendererComponent bound object.");var r=e.materials;if(this.index>=r.length)throw new Error("MaterialTrack: material index "+this.index+" out of bounds (length="+r.length+").");return r[this.index]},s}(ke);$([bt()],va.prototype,"index",void 0);va=$([xt("MaterialTrack")],va);var sd=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){return new qf},s}(ke),Bo=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){var e=new td;return e.propertyPath=this.path,e},s}(hi);Bo=$([xt(tt.Vector4PropertyTrack)],Bo);var Uo=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){var e=new ed;return e.propertyPath=this.path,e},s}(hi);Uo=$([xt(tt.Vector3PropertyTrack)],Uo);var Go=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){var e=new rd;return e.propertyPath=this.path,e},s}(hi);Go=$([xt(tt.Vector2PropertyTrack)],Go);var Wo=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){var e=new Yf;return e.propertyPath=this.path,e},s}(hi);Wo=$([xt(tt.ColorPropertyTrack)],Wo);var od=function(){function i(n){var t=this;
7Object.keys(n).forEach(function(e){t[e]=n[e]})}var s=i.prototype;return s.generate=function(t){var e=ci(this.arc,this.arcMode,t),r=e*ee,a=Math.cos(r)*this.radius,o=Math.sin(r)*this.radius,u=new D(a,o,0),l=Math.tan(this.angle*ee),h=u.clone().multiply(l);return h.z+=1,{position:u.multiply(Ar(0,1)),direction:h.normalize()}},i}();function ci(i,s,n){if(s===Sr.RANDOM)i=Ar(0,i);else if(s===Sr.UNIDIRECTIONAL_CYCLE){var t=n.index%(n.total+1);i=i/n.total*t}else if(s===Sr.BIDIRECTIONAL_CYCLE){var e=n.index/(n.total+1),r=e-Math.floor(e);i=i*(Math.floor(e)%2?1-r:r)}else s===Sr.UNIFORM_BURST&&(i=i*n.burstIndex/n.burstCount);return i}var ud=function(){function i(n){var t=this;Object.keys(n).forEach(function(e){t[e]=n[e]})}var s=i.prototype;return s.generate=function(t){var e=ci(this.arc,this.arcMode,t)*ee,r=new D(Math.cos(e),Math.sin(e),0),a=this.radius;return{direction:r,position:r.clone().multiply(a)}},i}(),ld=function(){function i(n){this._d=(n.width||1)/2,this._h=(n.height||1)/2}var s=i.prototype;return s.generate=function(t){var e=Ar(-this._d,this._d),r=Ar(-this._h,this._h);return{direction:new D(0,0,1),position:new D(e,r,0)}},i}(),hd=function(){function i(n){this._d=(n.width||1)/2,this._h=(n.height||1)/2,this.arcMode=n.arcMode,this.arc=n.arc}var s=i.prototype;return s.generate=function(t){var e=ci(this.arc,this.arcMode,t)*ee,r=new D(Math.cos(e),Math.sin(e),0),a=this._d,o=this._h,u=Math.atan2(o,a),l=Math.tan(e),h=new D;return e<u?h.set(a,a*l,0):e>=u&&e<Math.PI-u?h.set(o/l,o,0):e<Math.PI+u?h.set(-a,-a*l,0):e<Math.PI*2-u?h.set(-o/l,-o,0):h.set(a,a*l,0),{direction:r,position:h}},i}(),cd=function(){function i(n){this._d=n.width||1,this.arcMode=n.arcMode}var s=i.prototype;return s.generate=function(t){var e=this.arcMode===Sr.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):Ar(0,1);return{direction:new D(0,1,0),position:new D(this._d*(e-.5),0,0)}},i}(),fd=new Tt,dd=function(){function i(n){var t=this;Object.keys(n).forEach(function(e){t[e]=n[e]})}var s=i.prototype;return s.generate=function(t){var e=this.donutRadius,r=this.radius-e,a=Ar(0,Math.PI*2),o=ci(this.arc,this.arcMode,t)*ee,u=fd.setFromRotationZ(o),l=new D(Math.cos(a),Math.sin(a),0),h=new D(r+Math.cos(a)*e,0,Math.sin(a)*e);return{direction:u.transformNormal(l),position:u.transformPoint(h)}},i}(),vd=new Tt,hl=function(){function i(n){var t=this;Object.keys(n).forEach(function(e){t[e]=n[e]})}var s=i.prototype;return s.getHorizontalAngle=function(){return Ar(-90,90)},s.generate=function(t){var e=ci(this.arc,this.arcMode,t)*ee,r=this.getHorizontalAngle()*ee,a=this.radius,o=new D(Math.cos(r),0,Math.sin(r)),u=vd.setFromRotationZ(e),l=u.transformNormal(o);return{position:l.clone().multiply(a),direction:l}},i}(),pd=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.getHorizontalAngle=function(){return Ar(0,90)},s}(hl),md=function(){function i(n){var t=n.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(t.anchors),this.width=n.width||1,this.height=n.height||1,this.block=t.block,this.arcMode=n.arcMode,this.random=he(n.random||0,0,1)}var s=i.prototype;return s.generate=function(t){var e=this.anchors,r=e.length/2-1,a=Math.floor(ci(r,this.arcMode,t)),o=(e[a*2]+this.block[0]*this.random*Math.random())%1-.5,u=(e[a*2+1]+this.block[1]*this.random*Math.random())%1-.5,l=new D(o,u,0);return{position:new D(o*this.width,u*this.height,0),direction:l.normalize()}},i}(),cl=function(){function i(){}var s=i.prototype;return s.generate=function(){return{position:new D,direction:new D}},i}(),De,gd=(De={},De[Ae.NONE]=cl,De[Ae.CONE]=od,De[Ae.SPHERE]=hl,De[Ae.HEMISPHERE]=pd,De[Ae.CIRCLE]=ud,De[Ae.DONUT]=dd,De[Ae.RECTANGLE]=ld,De[Ae.EDGE]=cd,De[Ae.RECTANGLE_EDGE]=hd,De[Ae.TEXTURE]=md,De);function yd(i){if(!i)return new cl;var s=lt({radius:1,arc:360,angle:0,arcMode:Sr.RANDOM},i),n=i.type,t=gd[n];if(!t)throw new Error("Invalid shape: "+n+".");var e=new t(s);if(n!==Ae.NONE){var r=i.alignSpeedDirection,a=i.upDirection,o=a===void 0?[0,0,1]:a;e.alignSpeedDirection=r,e.upDirection=D.fromArray(o).normalize()}return e}function xd(i,s,n,t,e){var r,a;if(e===Md(i,s,n,t)>0)for(r=s;r<n;r+=t)a=Ho(r,i[r],i[r+1],a);else for(r=n-t;r>=s;r-=t)a=Ho(r,i[r],i[r+1],a);return a&&_n(a,a.next)&&(Pi(a),a=a.next),a}function Ii(i,s){if(!i)return i;s||(s=i);var n=i,t;do if(t=!1,!n.steiner&&(_n(n,n.next)||Kt(n.prev,n,n.next)===0)){if(Pi(n),n=s=n.prev,n===n.next)break;t=!0}else n=n.next;while(t||n!==s);return s}function bd(i){var s=i.prev,n=i,t=i.next;if(Kt(s,n,t)>=0)return!1;for(var e=i.next.next;e!==i.prev;){if(yi(s.x,s.y,n.x,n.y,t.x,t.y,e.x,e.y)&&Kt(e.prev,e,e.next)>=0)return!1;e=e.next}return!0}function Td(i,s,n,t){var e=i.prev,r=i,a=i.next;if(Kt(e,r,a)>=0)return!1;for(var o=e.x<r.x?e.x<a.x?e.x:a.x:r.x<a.x?r.x:a.x,u=e.y<r.y?e.y<a.y?e.y:a.y:r.y<a.y?r.y:a.y,l=e.x>r.x?e.x>a.x?e.x:a.x:r.x>a.x?r.x:a.x,h=e.y>r.y?e.y>a.y?e.y:a.y:r.y>
7a.y?r.y:a.y,c=pa(o,u,s,n,t),f=pa(l,h,s,n,t),d=i.prevZ,v=i.nextZ;d&&d.z>=c&&v&&v.z<=f;){if(d!==i.prev&&d!==i.next&&yi(e.x,e.y,r.x,r.y,a.x,a.y,d.x,d.y)&&Kt(d.prev,d,d.next)>=0||(d=d.prevZ,v!==i.prev&&v!==i.next&&yi(e.x,e.y,r.x,r.y,a.x,a.y,v.x,v.y)&&Kt(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;d&&d.z>=c;){if(d!==i.prev&&d!==i.next&&yi(e.x,e.y,r.x,r.y,a.x,a.y,d.x,d.y)&&Kt(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;v&&v.z<=f;){if(v!==i.prev&&v!==i.next&&yi(e.x,e.y,r.x,r.y,a.x,a.y,v.x,v.y)&&Kt(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function _d(i,s,n,t){var e=i;do e.z===null&&(e.z=pa(e.x,e.y,s,n,t)),e.prevZ=e.prev,e.nextZ=e.next,e=e.next;while(e!==i);e.prevZ.nextZ=null,e.prevZ=null,Ed(e)}function Ed(i){var s,n,t,e,r,a,o,u,l=1;do{for(n=i,i=null,r=null,a=0;n;){for(a++,t=n,o=0,s=0;s<l&&(o++,t=t.nextZ,!!t);s++);for(u=l;o>0||u>0&&t;)o!==0&&(u===0||!t||n.z<=t.z)?(e=n,n=n.nextZ,o--):(e=t,t=t.nextZ,u--),r?r.nextZ=e:i=e,e.prevZ=r,r=e;n=t}r.nextZ=null,l*=2}while(a>1);return i}function pa(i,s,n,t,e){return i=32767*(i-n)*e,s=32767*(s-t)*e,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,i|s<<1}function yi(i,s,n,t,e,r,a,o){return(e-a)*(s-o)-(i-a)*(r-o)>=0&&(i-a)*(t-o)-(n-a)*(s-o)>=0&&(n-a)*(r-o)-(e-a)*(t-o)>=0}function wd(i,s){return i.next.i!==s.i&&i.prev.i!==s.i&&!Sd(i,s)&&(cn(i,s)&&cn(s,i)&&Cd(i,s)&&(Kt(i.prev,i,s.prev)||Kt(i,s.prev,s))||_n(i,s)&&Kt(i.prev,i,i.next)>0&&Kt(s.prev,s,s.next)>0)}function Kt(i,s,n){return(s.y-i.y)*(n.x-s.x)-(s.x-i.x)*(n.y-s.y)}function _n(i,s){return i.x===s.x&&i.y===s.y}function fl(i,s,n,t){var e=Xi(Kt(i,s,n)),r=Xi(Kt(i,s,t)),a=Xi(Kt(n,t,i)),o=Xi(Kt(n,t,s));return!!(e!==r&&a!==o||e===0&&Hi(i,n,s)||r===0&&Hi(i,t,s)||a===0&&Hi(n,i,t)||o===0&&Hi(n,s,t))}function Hi(i,s,n){return s.x<=Math.max(i.x,n.x)&&s.x>=Math.min(i.x,n.x)&&s.y<=Math.max(i.y,n.y)&&s.y>=Math.min(i.y,n.y)}function Xi(i){return i>0?1:i<0?-1:0}function Sd(i,s){var n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==s.i&&n.next.i!==s.i&&fl(n,n.next,i,s))return!0;n=n.next}while(n!==i);return!1}function cn(i,s){return Kt(i.prev,i,i.next)<0?Kt(i,s,i.next)>=0&&Kt(i,i.prev,s)>=0:Kt(i,s,i.prev)<0||Kt(i,i.next,s)<0}function Cd(i,s){var n=i,t=!1,e=(i.x+s.x)/2,r=(i.y+s.y)/2;do n.y>r!=n.next.y>r&&n.next.y!==n.y&&e<(n.next.x-n.x)*(r-n.y)/(n.next.y-n.y)+n.x&&(t=!t),n=n.next;while(n!==i);return t}function Ad(i,s){var n=new ma(i.i,i.x,i.y),t=new ma(s.i,s.x,s.y),e=i.next,r=s.prev;return i.next=s,s.prev=i,n.next=e,e.prev=n,t.next=n,n.prev=t,r.next=t,t.prev=r,t}function Ho(i,s,n,t){var e=new ma(i,s,n);return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function Pi(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function ma(i,s,n){this.i=i,this.x=s,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Md(i,s,n,t){for(var e=0,r=s,a=n-t;r<n;r+=t)e+=(i[a]-i[r])*(i[r+1]+i[a+1]),a=r;return e}var zr=0;function Id(i,s,n,t){n=n||2,zr=t||0;var e=i.length,r=xd(i,0,e,n,!0),a=[];if(!r||r.next===r.prev)return a;var o,u,l,h,c,f,d;if(i.length>80*n){o=l=i[0],u=h=i[1];for(var v=n;v<e;v+=n)c=i[v],f=i[v+1],c<o&&(o=c),f<u&&(u=f),c>l&&(l=c),f>h&&(h=f);d=Math.max(l-o,h-u),d=d!==0?1/d:0}return Ri(r,a,n,o,u,d),a}function Ri(i,s,n,t,e,r,a){if(i){!a&&r&&_d(i,t,e,r);for(var o=i,u,l;i.prev!==i.next;){if(u=i.prev,l=i.next,r?Td(i,t,e,r):bd(i)){s.push(u.i/n+zr),s.push(i.i/n+zr),s.push(l.i/n+zr),Pi(i),i=l.next,o=l.next;continue}if(i=l,i===o){a?a===1?(i=Pd(Ii(i),s,n),Ri(i,s,n,t,e,r,2)):a===2&&Rd(i,s,n,t,e,r):Ri(Ii(i),s,n,t,e,r,1);break}}}}function Pd(i,s,n){var t=i;do{var e=t.prev,r=t.next.next;!_n(e,r)&&fl(e,t,t.next,r)&&cn(e,r)&&cn(r,e)&&(s.push(e.i/n+zr),s.push(t.i/n+zr),s.push(r.i/n+zr),Pi(t),Pi(t.next),t=i=r),t=t.next}while(t!==i);return Ii(t)}function Rd(i,s,n,t,e,r){var a=i;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&wd(a,o)){var u=Ad(a,o);a=Ii(a,a.next),u=Ii(u,u.next),Ri(a,s,n,t,e,r),Ri(u,s,n,t,e,r);return}o=o.next}a=a.next}while(a!==i)}var Fd=2;function Od(i,s){for(var n=i.s,t=i.p,e=n[1],r=t[1],a=0,o=0;o<e.length;o++){var u=e[o];a+=u.length-1}for(var l=new Float32Array(a*Js),h=s.indexBase,c=h===void 0?0:h,f=0,d=0;d<e.length;
7d++)for(var v=e[d],p=r[d],g=r[d+1]||r[0],x=v,b=[0,0],y=0;y<x.length-1;y++){var E=x[y];kd(b,E,p,g,p[4],p[5],g[2],g[3]),S(b[0],b[1])}var _=Id(Array.from(l),null,Js,c);return{aPoint:l,index:new Uint16Array(_)};function S(C,I){l[f++]=C/2,l[f++]=I/2,l[f++]=(C+1)/2,l[f++]=(I+1)/2,f+=Fd}}function Ld(i){var s=[];return"gs"in i?i.gs.forEach(function(n){s.push({p:[dt.SHAPE_POINTS,n.p],s:[dt.SHAPE_SPLITS,n.s]})}):"g"in i?s.push({p:[dt.SHAPE_POINTS,i.g.p],s:[dt.SHAPE_SPLITS,i.g.s]}):s.push(i),s}function Nd(i,s){for(var n=[],t=Ld(i),e=0,r=0,a=0,o=0;o<t.length;o++){var u=t[o],l=Od(u,{indexBase:e,uvTransform:s});e+=l.aPoint.length/5,n.push(l),r+=l.aPoint.length,a+=l.index.length}if(n.length===1)return n[0];for(var h=new Float32Array(r),c=new Uint16Array(a),f=0,d=0,v=0;f<n[f];f++){var p=n[f];h.set(p.aPoint,d),d+=p.aPoint.length,c.set(p.index,v),v+=p.index.length}return{aPoint:h,index:c}}function Vd(i,s,n){var t=Math.cos(n),e=Math.sin(n),r=s[0],a=s[1];return i[0]=t*r+e*a,i[1]=-e*r+t*a,i}function kd(i,s,n,t,e,r,a,o){var u=1-s,l=u*u*u,h=3*s*u*u,c=3*s*s*u,f=s*s*s;return i[0]=l*n[0]+h*e+c*a+f*t[0],i[1]=l*n[1]+h*r+c*o+f*t[1],i}var Dd=function(){function i(n){var t=n.time,e=n.interval,r=n.count,a=n.cycles,o=n.probability;this.time=+t||0,this.interval=+e||1,this.count=Z(r,jt)?r:J(r),this.cycles=+a||1/0,this.probability=isNaN(o)?1:+o,this.reset()}var s=i.prototype;return s.getGeneratorOptions=function(t,e){var r=t-this.time-this.now;if(r>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},s.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},s.clone=function(){var t={time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability};return new i(t)},i}(),Xo=function(s){this.content=s},zd=function(){function i(n){this.sort=n,this.length=0}var s=i.prototype;return s.findNodeByContent=function(t){var e=this.first;if(e)do if(t(e.content))return e;while(e=e.next)},s.insertNode=function(t,e){var r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},s.shiftNode=function(t){var e=new Xo(t);if(this.length++,this.length===1)return this.first=this.last=e;for(var r=this.first;r;)if(this.sort(r.content,e.content)<=0)if(r.next)r=r.next;else return this.insertNode(r,e),this.last=e;else return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e},s.pushNode=function(t){var e=new Xo(t);if(this.length++,this.length===1)return this.last=this.first=e;for(var r=this.last;r;)if(this.sort(e.content,r.content)<=0){if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}else return this.insertNode(r,e),r===this.last&&(this.last=e),e},s.removeNode=function(t){var e=this.first;if(this.length--,e===t){var r=this.first=e.next;r&&(r.pre=null)}else if((e=this.last)===t){var a=this.last=e.pre;a&&(a.next=null)}else if(t){var o=t.pre,u=t.next;o.next=u,u&&(u.pre=o)}t.pre=null,t.next=null},s.forEach=function(t,e){var r=this.first,a=0;if(r)do t.call(e||this,r.content,a++);while(r=r.next)},s.forEachReverse=function(t,e){var r=this.last,a=this.length-1;if(r)do t.call(e||this,r.content,a--);while(r=r.pre)},s.getNodeByIndex=function(t){var e=0,r=this.first;if(!r||t>=this.length||t<0)return null;for(;e<t;)r=r.next,e++;return r},i}(),Bd="offscreen_canvas",Ud={};function Gd(i){return Ud[i]}var Wd=new D,Hd=new D,Xd=function(){function i(n,t){this.pointStart=[];var e=t.colorOverLifetime,r=t.colorOverTrail,a=t.maxTrailCount,o=t.opacityOverLifetime,u=o===void 0?J(1):o,l=t.widthOverTrail,h=t.name,c=t.occlusion,f=t.blending,d=t.texture,v=t.transparentOcclusion,p=t.minimumVertexDistance,g=t.lifetime,x=t.matrix,b=n.gpuCapability,y=b.detail,E=b.level,_=Math.max(t.pointCountPerTrail,2),S=sa(),C=y.maxVertexTextures>0,I=(n!=null?n:{}).env,R={},O=0,F=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",O],["ENV_EDITOR",I===Ur]],L=a>64,V=0;e&&(F.push(["COLOR_OVER_LIFETIME",!0]),V|=1,R.uColorOverLifetime=Wt.createWithData(n,Bn(e))),r&&(F.push(["COLOR_OVER_TRAIL",!0]),V|=4,R.uColorOverTrail=Wt.createWithData(n,Bn(r))),L?(F.push(["ATTR_TRAIL_START",1]),V|=8):R.uTrailStart=new Float32Array(a),R.uOpacityOverLifetimeValue=u.toUniform(S);var U=l.toUniform(S);if(F.push(["VERT_CURVE_VALUE_COUNT",S.index],["VERT_MAX_KEY_FRAME_COUNT",S.max]),C&&O){var W=ra(n,jt.getAllData(S,!0),S.index,1);R.uVCurveValueTexture=W}else R.uVCurveValues=jt.getAllData(S);var G=ff,B=ol,X={shader:{vertex:G,fragment:B,macros:F,glslVersion:E===1?Ve.GLSL1:Ve.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+V+"+"+S.index+"+"+S.max}},H=_*a*2,Y=(_-1)*a,K=Float32Array.BYTES_PER_ELEMENT,z=12*K,Q={attributes:{aColor:{size:4,stride:z,data:new Float32Array(H*12)},aSeed:{size:1,stride:z,offset:4*K,dataSource:"aColor"},aInfo:{size:3,stride:z,offset:5*K,dataSource:"aColor"},aPos:{size:4,stride:z,offset:8*K,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(H)},aDir:{size:3,data:new Float32Array(H*3)}},indices:{data:new Uint16Array(H*6)},drawCount:Y*6,name:"trail#"+h,bufferUsage:P.DYNAMIC_DRAW};if(L)Q.attributes.aTrailStart={size:1,data:new Float32Array(H)};else{var it=new Float32Array(H);Q.attributes.aTrailStartIndex={size:1,data:it};for(var ct=0;ct<a;ct++)for(var nt=_*2,yt=ct*nt,_t=0;_t<nt;_t++)it[yt+_t]=ct}var Vt=yn(f),mt=Ce.create(n,X);mt.blending=!0,mt.depthMask=c,mt.depthTest=!0,xn(mt,f);var at=this.mesh=ai.create(n,{name:"MTrail_"+h,material:mt,geometry:Qe.create(n,Q)}),kt=d!=null?d:Wt.createWithData(n);Object.keys(R).map(function(wt){var ut=R[wt];
7if(Z(ut,Wt))mt.setTexture(wt,ut);else if(wt==="uTrailStart")mt.setFloats("uTrailStart",ut);else if(wt==="uVCurveValues"){for(var qt=[],It=0;It<ut.length;It=It+4){var ot=new Dt(ut[It],ut[It+1],ut[It+2],ut[It+3]);qt.push(ot)}mt.setVector4Array(wt,qt)}else mt.setVector4(wt,Dt.fromArray(ut))}),mt.setFloat("uTime",0),mt.setVector4("uWidthOverTrail",Dt.fromArray(U)),mt.setVector2("uTexOffset",new ht(0,0)),mt.setVector4("uTextureMap",new Dt(0,0,1,1)),mt.setVector4("uParams",new Dt(0,_-1,0,0)),mt.setTexture("uMaskTex",kt),mt.setVector4("uColorParams",new Dt(d?1:0,+Vt,0,+(c&&!v))),this.maxTrailCount=a,this.pointCountPerTrail=_,this.checkVertexDistance=p>0,this.minimumVertexDistance=Math.pow(p||.001,2),this.useAttributeTrailStart=L,this.lifetime=g,x&&(this.mesh.worldMatrix=x),this.geometry=at.firstGeometry(),this.trailCursors=new Uint16Array(a)}var s=i.prototype;return s.addPoint=function(t,e,r){r=r||{};var a=this.trailCursors[t],o=this.pointCountPerTrail,u=this.geometry,l=o-1,h=a%o,c=(a-1)%o,f=(a-2)%o,d=this.getTrailPosition(t,c,Wd);if(!(d&&this.checkVertexDistance&&(d==null?void 0:d.distanceSquared(e))<this.minimumVertexDistance)){var v=t*o+h,p=Yo(d,e),g=r.time||this.time,x=[Math.random(),r.lifetime||this.lifetime,a],b=r.size||1,y=v*6,E=new Float32Array(6);E.set(p,0),E.set(p,3),u.setAttributeSubData("aDir",y,E),u.setAttributeSubData("aTime",v*2,new Float32Array([g,g]));var _=r.color||[1,1,1,1],S=new Float32Array(24),C=e.toArray();if(S.set(_,0),S.set(x,4),S[7]=0,S.set(C,8),S[11]=.5*b,S.set(_,12),S.set(x,16),S[19]=1,S.set(C,20),S[23]=-.5*b,u.setAttributeSubData("aColor",v*24,S),c>=0){var I=this.getTrailPosition(t,f,Hd),R=new Float32Array(Yo(I,d,e)),O=(t*o+c)*6;u.setAttributeSubData("aDir",O,R),u.setAttributeSubData("aDir",O+3,R);var F=t*o*2,L=new Uint16Array([c*2+F,c*2+1+F,h*2+F,h*2+F,c*2+1+F,h*2+1+F]),V=(t*l+(a-1)%l)*6;u.setIndexSubData(V,L)}a=++this.trailCursors[t];var U=this.mesh.material,W=U.getVector4("uParams"),G=x[2];if(this.useAttributeTrailStart){for(var B=o*2,X=new Float32Array(B),H=0;H<B;H++)X[H]=G;u.setAttributeSubData("aTrailStart",t*X.length,X)}else{var Y=U.getFloats("uTrailStart");Y!=null&&(Y[t]=G,U.setFloats("uTrailStart",Y))}W&&(W.y=Math.max(W.y,a-1)-Math.max(0,a-o),U.setVector4("uParams",W))}},s.getTrailPosition=function(t,e,r){var a=this.pointCountPerTrail;if(e>=0&&e<a){var o=(t*a+e)*24+8,u=this.geometry.getAttributeData("aColor");return ne(u),r.x=u[o],r.y=u[1+o],r.z=u[2+o],r}},s.clearAllTrails=function(){var t=this.geometry.getIndexData();ne(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},s.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");ne(e);for(var r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},s.clearTrail=function(t){if(this.trailCursors[t]!==0){var e=this.pointCountPerTrail,r=(e-1)*6,a=this.geometry.getIndexData();ne(a),a.set(new Uint16Array(r),t*r),this.geometry.setIndexData(a),this.trailCursors[t]=0}},s.getPointStartPos=function(t){return this.pointStart[t]},s.setPointStartPos=function(t,e){this.pointStart[t]=e},s.onUpdate=function(t){},Mt(i,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",t!=null?t:0)}}]),i}(),jd=new D,ji=new D,jo=new D;function Yo(i,s,n){var t=jd;return!i&&!n?[0,0,0]:(i?n?(ji.subtractVectors(s,i).normalize(),ji.subtractVectors(n,s),jo.copyFrom(ji).normalize(),t.addVectors(ji,jo)):t.subtractVectors(s,i):t.subtractVectors(n,s),t.normalize().toArray())}var Yd=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.particleSystem=null,t}var n=s.prototype;return n.getParticleSystem=function(e){if(this.particleSystem)return this.particleSystem;var r=e.output.getUserData();return Z(r,Ie)?(this.particleSystem=r.getComponent(fn),this.particleSystem):null},n.processFrame=function(e){var r=this.getParticleSystem(e);if(r){this.time>=0&&this.time<r.time&&r.reset();for(var a=.016;r.time+a<this.time;)r.simulate(a);r.simulate(this.time-r.time)}},s}(or),Zd=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){return new Yd},s}
7(Be),qd={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"},Qd=function(){function i(n,t){this.particleCount=0,this.cachedRotationVector3=new D,this.cachedRotationMatrix=new ia,this.cachedLinearMove=new D,this.tempMatrix3=new ia,this.VERT_MAX_KEY_FRAME_COUNT=0;var e=(n!=null?n:{}).env,r=t.speedOverLifetime,a=t.colorOverLifetime,o=t.linearVelOverLifetime,u=t.orbitalVelOverLifetime,l=t.sizeOverLifetime,h=t.rotationOverLifetime,c=t.sprite,f=t.gravityModifier,d=t.maxCount,v=t.textureFlip,p=t.useSprite,g=t.name,x=t.gravity,b=t.forceTarget,y=t.side,E=t.occlusion,_=t.anchor,S=t.blending,C=t.transparentOcclusion,I=t.renderMode,R=I===void 0?0:I,O=t.diffuse,F=O===void 0?Wt.createWithData(n):O,L=n.gpuCapability.detail,V=L.halfFloatTexture,U=L.maxVertexUniforms,W=[["RENDER_MODE",+R],["ENV_EDITOR",e===Ur]],G=n.gpuCapability.level,B=sa(),X=sa(),H=U>0,Y={},K=0,z=0,Q;if(this.useSprite=p,H&&W.push(["ENABLE_VERTEX_TEXTURE",!0]),r&&(W.push(["SPEED_OVER_LIFETIME",!0]),z|=2,Y.uSpeedLifetimeValue=r.toUniform(B)),c!=null&&c.animate&&(W.push(["USE_SPRITE",!0]),z|=4,Y.uFSprite=Y.uSprite=new Float32Array([c.col,c.row,c.total,c.blend?1:0]),this.useSprite=!0),a!=null&&a.color&&(W.push(["COLOR_OVER_LIFETIME",!0]),z|=16,Y.uColorOverLifetime=Z(a.color,Wt)?a.color:Wt.createWithData(n,Bn(a.color))),a!=null&&a.opacity?Y.uOpacityOverLifetimeValue=a.opacity.toUniform(B):Y.uOpacityOverLifetimeValue=J(1).toUniform(B),["x","y","z"].forEach(function(ot,At){var Rt=0,Ft=0;o!=null&&o[ot]&&(Y["uLinear"+ot.toUpperCase()+"ByLifetimeValue"]=o[ot].toUniform(B),Rt=1,z|=1<<7+At,o.enabled=!0),W.push(["LINEAR_VEL_"+ot.toUpperCase(),Rt]),u!=null&&u[ot]&&(Y["uOrb"+ot.toUpperCase()+"ByLifetimeValue"]=u[ot].toUniform(B),Ft=1,z|=1<<10+At,Q=!0,u.enabled=!0),W.push(["ORB_VEL_"+ot.toUpperCase(),Ft])}),o!=null&&o.asMovement&&(W.push(["AS_LINEAR_MOVEMENT",!0]),z|=32),Q&&(u!=null&&u.asRotation&&(W.push(["AS_ORBITAL_MOVEMENT",!0]),z|=64),Y.uOrbCenter=new Float32Array((u==null?void 0:u.center)||[0,0,0])),Y.uSizeByLifetimeValue=l==null?void 0:l.x.toUniform(B),l!=null&&l.separateAxes){var it;W.push(["SIZE_Y_BY_LIFE",1]),z|=16384,Y.uSizeYByLifetimeValue=l==null||(it=l.y)==null?void 0:it.toUniform(B)}h!=null&&h.z&&(Y.uRZByLifeTimeValue=h.z.toUniform(B),z|=32768,W.push(["ROT_Z_LIFETIME",1])),h!=null&&h.x&&(Y.uRXByLifeTimeValue=h.x.toUniform(B),z|=65536,W.push(["ROT_X_LIFETIME",1])),h!=null&&h.y&&(Y.uRYByLifeTimeValue=h.y.toUniform(B),z|=1<<17,W.push(["ROT_Y_LIFETIME",1])),h!=null&&h.asRotation&&(W.push(["ROT_LIFETIME_AS_MOVEMENT",1]),z|=1<<18),Y.uGravityModifierValue=f.toUniform(B),b&&(W.push(["FINAL_TARGET",!0]),z|=1<<19,Y.uFinalTarget=new Float32Array(b.target||[0,0,0]),Y.uForceCurve=b.curve.toUniform(B)),V&&X.max?(z|=1<<20,Y.uFCurveValueTexture=ra(n,jt.getAllData(X,!0),X.index,1)):Y.uFCurveValues=jt.getAllData(X);var ct=B.max+B.curves.length-32>U;if(ct&&V&&H){var nt=ra(n,jt.getAllData(B,!0),B.index,1);Y.uVCurveValueTexture=nt,K=1}else Y.uVCurveValues=jt.getAllData(B);var yt=["-p:",R,z,B.index,B.max,X.index,X.max].join("+");W.push(["VERT_CURVE_VALUE_COUNT",B.index],["FRAG_CURVE_VALUE_COUNT",X.index],["VERT_MAX_KEY_FRAME_COUNT",B.max],["FRAG_MAX_KEY_FRAME_COUNT",X.max]),this.VERT_MAX_KEY_FRAME_COUNT=B.max;var _t=ol,Vt="#define LOOKUP_TEXTURE_CURVE "+K+"\n"+cf,mt=Vt,at={fragment:_t,vertex:mt,glslVersion:G===1?Ve.GLSL1:Ve.GLSL3,shared:!0,cacheId:yt,macros:W,name:"particle#"+g},kt={shader:at},wt=yn(S);Y.uTexOffset=new Float32Array(F?[1/F.getWidth(),1/F.getHeight()]:[0,0]),Y.uMaskTex=F,Y.uColorParam
7s=new Float32Array([F?1:0,+wt,0,+(!!E&&!C)]),Y.uParams=[0,0,0,0],Y.uAcceleration=[(x==null?void 0:x[0])||0,(x==null?void 0:x[1])||0,(x==null?void 0:x[2])||0,0];var ut=Ce.create(n,kt);ut.blending=!0,ut.depthTest=!0,ut.depthMask=!!E,xn(ut,S),Ua(ut,y),Object.keys(Y).map(function(ot){var At=Y[ot];if(Z(At,Wt)){ut.setTexture(ot,At);return}var Rt=[];switch(qd[ot]){case"vec4":ut.setVector4(ot,Dt.fromArray(At));break;case"vec3":ut.setVector3(ot,D.fromArray(At));break;case"vec2":ut.setVector2(ot,ht.fromArray(At));break;case"vec4Array":for(var Ft=0;Ft<At.length;Ft=Ft+4){var se=new Dt(At[Ft],At[Ft+1],At[Ft+2],At[Ft+3]);Rt.push(se)}ut.setVector4Array(ot,Rt),Rt.length=0;break;default:console.warn("Uniform "+ot+"'s type not in typeMap.")}}),ut.setVector3("emissionColor",new D(0,0,0)),ut.setFloat("emissionIntensity",0);var qt=Qe.create(n,Kd(d*4,this.useSprite,"particle#"+g)),It=ai.create(n,{name:"MParticle_"+g,material:ut,geometry:qt});this.anchor=_,this.mesh=It,this.geometry=It.firstGeometry(),this.forceTarget=b,this.sizeOverLifetime=l,this.speedOverLifetime=r,this.linearVelOverLifetime=o,this.orbitalVelOverLifetime=u,this.orbitalVelOverLifetime=u,this.gravityModifier=f,this.rotationOverLifetime=h,this.maxCount=d,this.textureOffsets=v?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var s=i.prototype;return s.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),r=t*32+4;return ne(e),[e[r],e[r+1],e[r+2],e[r+3]]},s.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},s.resetGeometryData=function(t){for(var e=t.getAttributeNames(),r=t.getIndexData(),a=0;a<e.length;a++){var o=e[a],u=t.getAttributeData(o);u&&t.setAttributeData(o,new u.constructor(0))}t.setIndexData(new r.constructor(0))},s.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),r=Math.ceil(e.length/12);this.applyTranslation(r,t),this.applyRotation(r,t),this.applyLinearMove(r,t)},s.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},s.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",t*16,new Float32Array(16))},s.setPoint=function(t,e){var r=this.maxCount;if(t<r){var a=t+1,o=a*4,u=this.geometry,l=a>this.maxParticleBufferCount,h=1;this.particleCount>300?h=(this.particleCount+100)/this.particleCount:this.particleCount>100?h=1.4:this.particleCount>0&&(h=2);var c={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},f=this.useSprite;f&&(c.aSprite=new Float32Array(12));var d=new D,v=new Zt,p=new D(1,1,1);e.transform.assignWorldTRS(d,v,p);var g=Mi.getRotation(v,new Me),x=d.toArray(),b=g.toArray(),y=this.textureOffsets,E=[0,0,e.delay,e.lifetime],_=[0,0,1,1],S=e.vel,C=e.color,I=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],R=Math.random(),O;f&&(O=e.sprite);for(var F=0;F<4;F++){var L=F*2,V=F*3,U=F*4,W=F*12,G=F*8;c.aPos.set(x,W),S.fill(c.aPos,W+3),c.aRot.set(b,G),c.aRot[G+3]=R,c.aRot.set(C,G+4),f&&c.aSprite.set(O,V);var B=e.uv||_;if(B){var X=f?1-y[L+1]:y[L+1];E[0]=B[0]+y[L]*B[2],E[1]=B[1]+X*B[3]}c.aOffset.set(E,U);for(var H=F+F,Y=(I[H]-this.anchor.x)*p.x,K=(I[H+1]-this.anchor.y)*p.y,z=0;z<3;z++)c.aPos[W+6+z]=e.dirX.getElement(z)*Y,c.aPos[W+9+z]=e.dirY.getElement(z)*K}var Q=new Uint16Array([0,1,2,2,1,3].map(function(nt){return nt+t*4}));if(l){var it=u.getIndexData(),ct=Ja(it,a*6,r*6,h);ct.set(Q,t*6),u.setIndexData(ct),this.maxParticleBufferCount=ct.length/6}else u.setIndexSubData(t*6,Q);Object.keys(c).forEach(function(nt){var yt=c[nt],_t=u.getAttributeStride(nt)/Float32Array.BYTES_PER_ELEMENT;if(l){var Vt=u.getAttributeData(nt);ne(Vt);var mt=Ja(Vt,o*_t,r*4*_t,h);mt.set(yt,yt.length*t),u.setAttributeData(nt,mt)}else u.setAttributeSubData(nt,yt.length*t,yt)}),this.particleCount=Math.max(a,this.particleCount),u.setDrawCount(this.particleCount*6)}},s.applyTranslation=function(t,e){var r=this.time,a=this.geometry.getAttributeData("aTranslation"),o=this.geometry.getAttributeData("aVel"),u=this.geometry.getAttributeData("aOffset");a.length<t*3&&(a=this.expandArray(a,t*3));for(var l=0,h=0,c=0,f=this.mesh.material.getVector4("uAcceleration"),d=this.mesh.material.getVector4("uGravityModifierValue"),v=0;v<t;v+=4){var p=v*12+3;l=o[p],h=o[p+1],c=o[p+2];var g=r-u[v*4+2],x=u[v*4+3];if(f&&d){var b=this.gravityModifier.getIntegrateValue(0,g,x),y=f.x*b,E=f.y*b,_=f.z*b;if(this.speedOverLifetime){var S=this.speedOverLifetime.getValue(g/x);l=l*S+y,h=h*S+E,c=c*S+_}else l=l+y,h=h+E,c=c+_}var C=v*3;if(u[v*4+2]<r){var I=l*(e/1e3),R=h*(e/1e3),O=c*(e/1e3);a[C]+=I,a[C+1]+=R,a[C+2]+=O,a[C+3]+=I,a[C+4]+=R,a[C+5]+=O,a[C+6]+=I,a[C+7]+=R,a[C+8]+=O,a[C+9]+=I,a[C+10]+=R,a[C+11]+=O}}this.geometry.setAttributeData("aTranslation",a)},s.applyRotation=function(t,e){var r=this.geometry.getAttributeData("aRotation0"),a=this.geometry.getAttributeData("aOffset"),o=this.geometry.getAttributeData("aRot"),u=this.geometry.getAttributeData("aSeed"),l=this.time,h=this.cachedRotationMatrix;r.length<t*9&&(r=this.expandArray(r,t*9));for(var c=0;c<t;c+=4){var f=l-a[c*4+2],d=a[c*4+3],v=he(f/d,0,1),p=c*8,g=this.cachedRotationVector3.set(o[p],o[p+1],o[p+2]),x=u[c*8+3],b=g;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(Z(this.rotationOverLifetime.x,$e)?b.x+=this.rotationOverLifetime.x.getValue(v,x):b.x+=this.rotationOverLifetime.x.getValue(v)),this.rotationOverLifetime.y&&(Z(this.rotationOverLifetime.y,$e)?b.y+=this.rotationOverLifetime.y.getValue(v,x):b.y+=this.rotationOverLifetime.y.getValue(v)),this.rotationOverLifetime.z&&(Z(this.rotationOverLifetime.z,$e)?b.z+=this.rotationOverLifetime.z.getValue(v,x):b.z+=this.rotationOverLifetime.z.getValue(v))):h.setZero(),b.dot
7(b)===0&&h.identity();var y=Math.PI/180,E=b.x*y,_=b.y*y,S=b.z*y,C=Math.sin(E),I=Math.sin(_),R=Math.sin(S),O=Math.cos(E),F=Math.cos(_),L=Math.cos(S);h.set(L,-R,0,R,L,0,0,0,1),h.multiply(this.tempMatrix3.set(F,0,I,0,1,0,-I,0,F)),h.multiply(this.tempMatrix3.set(1,0,0,0,O,-C,0,C,O));var V=c*9,U=h.elements;r.set(U,V),c+4<=t&&(r.set(U,V+9),r.set(U,V+18),r.set(U,V+27))}this.geometry.setAttributeData("aRotation0",r)},s.applyLinearMove=function(t,e){var r=this.geometry.getAttributeData("aLinearMove"),a=this.geometry.getAttributeData("aOffset"),o=this.geometry.getAttributeData("aSeed"),u=this.time;r.length<t*3&&(r=this.expandArray(r,t*3));var l=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var h=0;h<t;h+=4){var c=u-a[h*4+2],f=a[h*4+3],d=c/f,v=o[h*8+3];l.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(Z(this.linearVelOverLifetime.x,$e)?l.x=this.linearVelOverLifetime.x.getValue(d,v):l.x=this.linearVelOverLifetime.x.getValue(d)),this.linearVelOverLifetime.y&&(Z(this.linearVelOverLifetime.y,$e)?l.y=this.linearVelOverLifetime.y.getValue(d,v):l.y=this.linearVelOverLifetime.y.getValue(d)),this.linearVelOverLifetime.z&&(Z(this.linearVelOverLifetime.z,$e)?l.z=this.linearVelOverLifetime.z.getValue(d,v):l.z=this.linearVelOverLifetime.z.getValue(d))):(this.linearVelOverLifetime.x&&(Z(this.linearVelOverLifetime.x,$e)?l.x=this.linearVelOverLifetime.x.getIntegrateValue(0,c,v):l.x=this.linearVelOverLifetime.x.getIntegrateValue(0,c,f)),this.linearVelOverLifetime.y&&(Z(this.linearVelOverLifetime.y,$e)?l.y=this.linearVelOverLifetime.y.getIntegrateValue(0,c,v):l.y=this.linearVelOverLifetime.y.getIntegrateValue(0,c,f)),this.linearVelOverLifetime.z&&(Z(this.linearVelOverLifetime.z,$e)?l.z=this.linearVelOverLifetime.z.getIntegrateValue(0,c,v):l.z=this.linearVelOverLifetime.z.getIntegrateValue(0,c,f)));var p=h*3;r[p]=l.x,r[p+1]=l.y,r[p+2]=l.z,r[p+3]=l.x,r[p+4]=l.y,r[p+5]=l.z,r[p+6]=l.x,r[p+7]=l.y,r[p+8]=l.z,r[p+9]=l.x,r[p+10]=l.y,r[p+11]=l.z}this.geometry.setAttributeData("aLinearMove",r)},s.expandArray=function(t,e){var r=new Float32Array(e);return r.set(t),r},i}();function Kd(i,s,n){var t=Float32Array.BYTES_PER_ELEMENT,e=t*12,r={aPos:{size:3,offset:0,stride:e,data:new Float32Array(0)},aVel:{size:3,offset:3*t,stride:e,dataSource:"aPos"},aDirX:{size:3,offset:6*t,stride:e,dataSource:"aPos"},aDirY:{size:3,offset:9*t,stride:e,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*t,data:new Float32Array(0)},aSeed:{size:1,offset:3*t,stride:8*t,dataSource:"aRot"},aColor:{size:4,offset:4*t,stride:8*t,dataSource:"aRot"},aOffset:{size:4,stride:4*t,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*t,data:new Float32Array(0)},aRotation1:{size:3,offset:3*t,stride:9*t,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*t,stride:9*t,dataSource:"aRotation0"}};return s&&(r.aSprite={size:3,stride:3*t,data:new Float32Array(0)}),{attributes:r,indices:{data:new Uint16Array(0)},name:n,maxVertex:i}}var $d=function(i){k(s,i);function s(t){var e;return e=i.call(this,t)||this,e.name="ParticleSystemRenderer",e}var n=s.prototype;return n.onStart=function(){this._priority=this.item.renderOrder},n.onUpdate=function(e){var r=this.particleMesh.time,a,o=(a=this.particleMesh.mesh.material.getVector4("uParams"))!=null?a:new Dt;this.particleMesh.mesh.material.setVector4("uParams",o.set(r,this.item.duration,0,0))},n.render=function(e){this.maskManager.drawStencilMask(e,this);for(var r=M(this.meshes),a;!(a=r()).done;){var o=a.value;o.render(e)}},n.setup=function(e,r){r===void 0&&(r=null),this.meshes=[],this.materials=[],this.particleMesh=new Qd(this.engine,e),r&&(this.trailMesh=new Xd(this.engine,r)),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))},n.reset=function(){var e;this.particleMesh.clearPoints(),(e=this.trailMesh)==null||e.clearAllTrails()},n.updateTime=function(e,r){this.particleMesh.time=e,this.particleMesh.onUp
7date(r),this.trailMesh&&(this.trailMesh.time=e,this.trailMesh.onUpdate(r))},n.minusTimeForLoop=function(e){var r;this.particleMesh.minusTime(e),(r=this.trailMesh)==null||r.minusTime(e)},n.updateWorldMatrix=function(e){this.particleMesh.mesh.worldMatrix=e,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=e)},n.setVisible=function(e){var r;this.particleMesh.mesh.setVisible(e),(r=this.trailMesh)==null||r.mesh.setVisible(e)},n.getTextures=function(){var e=[],r=this.particleMesh.mesh.material.textures;if(Object.keys(r).forEach(function(o){e.push(r[o])}),this.trailMesh){var a=this.trailMesh.mesh.material.textures;Object.keys(a).forEach(function(o){e.push(a[o])})}return e},n.setParticlePoint=function(e,r){this.particleMesh.setPoint(e,r)},n.removeParticlePoint=function(e){this.particleMesh.removePoint(e)},n.getParticlePointColor=function(e){return this.particleMesh.getPointColor(e)},n.hasTrail=function(){return this.trailMesh!==void 0},n.clearTrail=function(e){var r;(r=this.trailMesh)==null||r.clearTrail(e)},n.addTrailPoint=function(e,r,a){var o;(o=this.trailMesh)==null||o.addPoint(e,r,a)},n.setTrailStartPosition=function(e,r){var a;(a=this.trailMesh)==null||a.setPointStartPos(e,r)},n.getTrailStartPosition=function(e){return this.trailMesh.getPointStartPos(e)},s}(ze),fn=function(i){k(s,i);function s(t,e){var r;return r=i.call(this,t)||this,r.particleMeshProps=null,r.trailMeshProps=null,r.getHitTestParams=function(a){var o=r.interaction;if(a||o)return{type:Ze.custom,clipMasks:r.renderer.frameClipMasks,collect:function(u){return r.raycast({radius:(o==null?void 0:o.radius)||.4,multiple:!!(o!=null&&o.multiple),removeParticle:(o==null?void 0:o.behavior)===nn.removeParticle,ray:u})}}},r.maskManager=new Zu,e&&r.fromData(e),r}var n=s.prototype;return n.isFrozen=function(){return this.frozen},n.isEnded=function(){return this.ended},n.initEmitterTransform=function(){var e=this.item.transform.position.clone(),r=this.item.transform.rotation.clone(),a=this.props.emitterTransform&&this.props.emitterTransform.path,o;a&&(a[0]===dt.CONSTANT_VEC3?e.add(a[1]):o=J(a)),this.basicTransform={position:e,rotation:r,path:o};var u=e.clone();if(o&&u.add(o.getValue(0)),this.transform.setPosition(u.x,u.y,u.z),this.options.particleFollowParent){var l=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(l)}},n.updateEmitterTransform=function(e){var r=this.basicTransform,a=r.path,o=r.position,u=o.clone();if(a){var l=this.item.duration;u.add(a.getValue(e/l))}if(this.transform.setPosition(u.x,u.y,u.z),this.options.particleFollowParent){var h=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(h)}},n.addParticle=function(e,r){var a=this.particleLink,o=[e.delay+e.lifetime,0,e.delay,e],u;if(a.length<r)u=o[1]=a.length;else{var l=a.first;a.removeNode(l),u=o[1]=l.content[1]}a.pushNode(o),this.renderer.setParticlePoint(u,e),this.clearPointTrail(u),this.transform.parentTransform&&this.renderer.setTrailStartPosition(u,this.transform.parentTransform.position.clone())},n.setVisible=function(e){this.renderer.setVisible(e)},n.getTextures=function(){return this.renderer.getTextures()},n.startEmit=function(){(!this.started||this.ended)&&(this.reset(),this.started=!0,this.ended=!1)},n.stop=function(){this.ended=!0,this.started=!1},n.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new zd(function(e,r){return e[0]-r[0]}),this.emission.bursts.forEach(function(e){return e.reset()}),this.frozen=!1,this.ended=!1},n.onStart=function(){var e=this;this.particleMeshProps&&(this.renderer=this.item.addComponent($d),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 r;if(((r=e.interaction)==null?void 0:r.behavior)===nn.removeParticle){var a=e.clickedPoint.content[1];e.renderer.removeParticlePoint(a),e.clearPointTrail(a),e.clickedPoint.content=[0]}}))},n.onUpdate=function(e){this.frozen||this.update(e)},n.simulate=function(e){this.update(e*1e3),this.frozen=!0},n.update=function(e){var r=this;if(this.started){var a=this.time+e/1e3,o=this.options,u=this.loopStartTime,l=this.emission;this.time=a,this.upDirectionWorld=null,this.renderer.updateTime(a,e);var h=this.particleLink,c=(a-u)/this.item.duration,f=this.timePassed,d=!1,v=function(){r.trails&&!d&&(d=!0,h.forEach(function(z){var Q=z[0],it=z[1],ct=z[2],nt=z[3];Q<f?r.clearPointTrail(it):f>ct&&r.updatePointTrail(it,c,nt,ct)}))};if(!this.ended){var p=this.item.duration,g=this.lifetime;if(f<p){var x=1/l.rateOverTime.getValue(g),b=Math.floor((f-this.lastEmitTime)/x),y=b,E=x/b,_=a,S=o.maxCount;this.updateEmitterTransform(f);for(var C=function(){var z=h.first;return r.emissionStopped||h.length===S&&z&&z.content[0]-u>f},I=0;I<y&&I<S&&!C();I++){var R=this.createPoint(g);
7R.delay+=_+I*E,this.addParticle(R,S),this.lastEmitTime=f}for(var O=l.bursts,F=(O==null?void 0:O.length)-1,L=0;F>=0&&L<S&&!C();F--){var V=O[F],U=!V.disabled&&V.getGeneratorOptions(f,g);if(U){var W=[0,0,0],G=l.burstOffsets[F],B=G&&G[U.cycleIndex]||W;V.once&&this.removeBurst(F);for(var X=0;X<U.count&&L<S;X++){var H;if(C())break;var Y=this.initPoint(this.shape.generate({total:U.total,index:U.index,burstIndex:X,burstCount:U.count}));Y.delay+=_,L++,(H=Y.transform).translate.apply(H,[].concat(B)),this.addParticle(Y,S)}}}}else if(this.options.looping)v(),this.loopStartTime=a-p,this.lastEmitTime-=p,this.time-=p,l.bursts.forEach(function(z){return z.reset()}),this.particleLink.forEach(function(z){z[0]-=p,z[2]-=p,z[3]&&(z[3].delay-=p)}),this.renderer.minusTimeForLoop(p);else{this.ended=!0;var K=this.item.endBehavior;K===Gt.freeze&&(this.frozen=!0)}}v()}},n.drawStencilMask=function(e){if(this.isActiveAndEnabled)for(var r=M(this.renderer.meshes),a;!(a=r()).done;){var o=a.value;this.maskManager.drawGeometryMask(this.engine.renderer,o.geometry,o.worldMatrix,o.material,e)}},n.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach(function(e){return e.dispose()})},n.getParticleBoxes=function(){var e=this.particleLink,r=this.renderer,a=[],o=this.particleCount,u=0;if(!(e&&r))return a;for(var l=e.last,h=!1;!h;){var c=l.content[0],f=l.content[3];if(c>this.timePassed){var d=this.getPointPosition(f);a.push({center:d,size:f.transform.scale}),l.pre?l=l.pre:h=!0}u++,u>o&&(h=!0)}return a},n.raycast=function(e){var r=this.particleLink,a=this.renderer;if(r&&a){var o=r.last,u=[],l=new D,h=!1;if(o&&o.content)do{var c=o.content,f=c[0];c[2];var d=c[3];if(f>this.timePassed){var v=this.getPointPosition(d),p=e.ray,g=!1;p&&(g=!!p.intersectSphere({center:v,radius:e.radius},l)),g&&(this.clickedPoint=o,u.push(v),e.multiple||(h=!0))}}while((o=o.pre)&&!h);return u}},n.clearPointTrail=function(e){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(e)}
7,n.updatePointTrail=function(e,r,a,o){var u=this.renderer;if(u.hasTrail()){var l=this.trails,h=this.getPointPosition(a),c=l.inheritParticleColor?u.getParticlePointColor(e):[1,1,1,1],f=a.transform.getWorldScale().toArray(),d=1,v=l.lifetime.getValue(r);if(l.sizeAffectsWidth&&(d*=f[0]),l.sizeAffectsLifetime&&(v*=f[0]),l.parentAffectsPosition&&this.transform.parentTransform){h.add(this.transform.parentTransform.position);var p=u.getTrailStartPosition(e);p&&h.subtract(p)}u.addTrailPoint(e,h,{color:c,lifetime:v,size:d,time:o})}},n.getPointPositionByIndex=function(e){var r=this.particleLink.getNodeByIndex(e);return r?this.getPointPosition(r.content[3]):(console.error("Get point error."),null)},n.getPointPosition=function(e){var r=e.transform,a=e.vel,o=e.lifetime,u=e.delay,l=e.gravity,h=l===void 0?[]:l,c=this.options.forceTarget,f=this.time-u,d=new D,v=D.fromArray(h);r.assignWorldTRS(d);var p=qu(new D,this.options,v,f,o,d,a);if(c){var g=c.target||[0,0,0],x=c.curve.getValue(f/o),b=1-x;p.x=p.x*b+g[0]*x,p.y=p.y*b+g[1]*x,p.z=p.z*b+g[2]*x}return p},n.initPoint=function(e){var r=this.options,a=this.lifetime,o=this.shape,u=r.startSpeed.getValue(a),l=r.particleFollowParent?Tt.IDENTITY:this.transform.getWorldMatrix(),h=e.position,c=l.transformPoint(h,new D),f=new Mi({position:c,valid:!0}),d=e.direction;if(d=l.transformNormal(d,Jd).normalize(),r.startTurbulence&&r.turbulence){for(var v=0;v<3;v++)Zo.setElement(v,r.turbulence[v].getValue(a));qo.setFromVector3(Zo.negate());var p=av.setFromEuler(qo);p.transformNormal(d).normalize()}var g=rv,x=iv;o.alignSpeedDirection?(x.copyFrom(d),this.upDirectionWorld||(o.upDirection?this.upDirectionWorld=o.upDirection.clone():this.upDirectionWorld=D.Z.clone(),l.transformNormal(this.upDirectionWorld)),g.crossVectors(x,this.upDirectionWorld).normalize(),g.isZero()&&g.set(1,0,0)):(g.set(1,0,0),x.set(0,1,0));var b,y=this.textureSheetAnimation;y&&y.animate&&(b=nv,b[0]=y.animationDelay.getValue(a),b[1]=y.animationDuration.getValue(a),b[2]=y.cycles.getValue(a));var E=ev;r.start3DRotation?E.set(r.startRotationX.getValue(a),r.startRotationY.getValue(a),r.startRotationZ.getValue(a)):r.startRotation?E.set(0,0,r.startRotation.getValue(a)):E.set(0,0,0),f.setRotation(E.x,E.y,E.z);var _=r.startColor.getValue(a);_.length===3&&(_[3]=1);var S=tv;if(r.start3DSize)S.x=r.startSizeX.getValue(a),S.y=r.startSizeY.getValue(a);else{var C=r.startSize.getValue(a),I=r.sizeAspect.getValue(a);S.x=C,S.y=I===0?0:C/I}var R=d.clone();if(R.multiply(u),!r.particleFollowParent){var O=new D;this.transform.assignWorldTRS(void 0,void 0,O),S.x*=O.x,S.y*=O.y}return f.setScale(S.x,S.y,1),{size:S,vel:R,color:_,delay:r.startDelay.getValue(a),lifetime:r.startLifetime.getValue(a),uv:ov(this.uvs),gravity:r.gravity,sprite:b,dirY:x,dirX:g,transform:f}},n.addBurst=function(e,r){var a=!1;if(this.emission.bursts.includes(e)||(this.emission.bursts.push(e),a=!0),a&&Z(r,Array)){var o=this.emission.bursts.indexOf(e);return this.emission.burstOffsets[o]=r,o}return-1},n.removeBurst=function(e){e<this.emission.bursts.length&&(this.emission.burstOffsets[e]=null,this.emission.bursts.splice(e,1))},n.createPoint=function(e){var r={total:this.emission.rateOverTime.getValue(e),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(r))},n.stopParticleEmission=function(){this.emissionStopped=!0},n.resumeParticleEmission=function(){this.emissionStopped=!1},n.getBoundingBox=function(){var e=this.getParticleBoxes();return{type:Ze.sphere,area:e}},n.fromData=function(e){i.prototype.fromData.call(this,e);var r=e;this.props=r;var a="",o=r.options,u=r.positionOverLifetime,l=u===void 0?{}:u,h=r.shape,c=l==null?void 0:l.gravityOverLifetime,f=Qu(l==null?void 0:l.gravity),d=r.textureSheetAnimation,v=d?{animationDelay:J(d.animationDelay||0),animationDuration:J(d.animationDuration||1),cycles:J(d.cycles||1),animate:d.animate,col:d.col,row:d.row,total:d.total||d.col*d.row}:void 0,p=!!(h&&h.turbulenceX||h!=null&&h.turbulenceY||h!=null&&h.turbulenceZ),g;if(p){var x,b,y;g=[J((x=h.turbulenceX)!=null?x:0),J((b=h.turbulenceY)!=null?b:0),J((y=h.turbulenceZ)!=null?y:0)]}this.name="ParticleSystem",this.shape=yd(h);var E;
7this.emission={rateOverTime:J(r.emission.rateOverTime),burstOffsets:sv((E=r.emission.burstOffsets)!=null?E:[]),bursts:(r.emission.bursts||[]).map(function(qt){return new Dd(qt)})},this.textureSheetAnimation=v;var _=r.renderer||{},S,C=r.rotationOverLifetime;C&&(S={},S.asRotation=!!C.asRotation,S.z=C.z?J(C.z):J(0),C.separateAxes&&(S.x=C.x&&J(C.x),S.y=C.y&&J(C.y)));var I;l!=null&&l.forceTarget&&(I={target:l.target||[0,0,0],curve:J(l.forceCurve||[dt.LINE,[[0,0],[1,1]]])});var R={x:l.linearX&&J(l.linearX||0),y:l.linearY&&J(l.linearY||0),z:l.linearZ&&J(l.linearZ||0),asMovement:l.asMovement},O={x:l.orbitalX&&J(l.orbitalX),y:l.orbitalY&&J(l.orbitalY),z:l.orbitalZ&&J(l.orbitalZ),center:l.orbCenter,asRotation:l.asRotation},F=r.sizeOverLifetime||{},L=r.colorOverLifetime,V=a,U=F!=null&&F.separateAxes?{separateAxes:!0,x:J(F.x),y:J(F.y)}:{separateAxes:!1,x:J(("size"in F?F.size:F.x)||1)};_.anchor=_.anchor||[0,0];var W=ht.fromArray(_.anchor),G,B;this.options={particleFollowParent:!!o.particleFollowParent,startLifetime:J(o.startLifetime),startDelay:J(o.startDelay||0),startSpeed:J(l.startSpeed||0),startColor:J(o.startColor),looping:(G=o.looping)!=null?G:!1,maxCount:(B=o.maxCount)!=null?B:0,gravityModifier:J(c||0),gravity:f,start3DSize:!!o.start3DSize,startTurbulence:p,turbulence:g,speedOverLifetime:l.speedOverLifetime&&J(l.speedOverLifetime),linearVelOverLifetime:R,orbitalVelOverLifetime:O,forceTarget:I},o.startRotationZ&&(this.options.startRotation=J(o.startRotationZ||0)),(o.startRotationX||o.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=J(o.startRotationX||0),this.options.startRotationY=J(o.startRotationY||0),this.options.startRotationZ=J(o.startRotationZ||0)),o.start3DSize?(this.options.startSizeX=J(o.startSizeX),this.options.startSizeY=J(o.startSizeY)):(this.options.startSize=J(o.startSize),this.options.sizeAspect=J(o.sizeAspect||1)),r.mask&&this.maskManager.setMaskOptions(this.engine,r.mask);var X={name:this.name,matrix:Tt.IDENTITY,shaderCachePrefix:V,renderMode:_.renderMode||er.BILLBOARD,side:_.side||qe.DOUBLE,gravity:f,blending:_.blending||Xt.ALPHA,rotationOverLifetime:S,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:v,occlusion:!!_.occlusion,transparentOcclusion:!!_.transparentOcclusion,maxCount:o.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:I,diffuse:_.texture?this.engine.findObject(_.texture):void 0,sizeOverLifetime:U,anchor:W};if(L){var H=L.color,Y=L.opacity;X.colorOverLifetime={},Y&&(X.colorOverLifetime.opacity=J(L.opacity)),H&&(H[0]===dt.GRADIENT_COLOR?X.colorOverLifetime.color=L.color[1]:H[0]===dt.RGBA_COLOR?X.colorOverLifetime.color=Wt.createWithData(this.engine,{data:new Uint8Array(H[1]),width:1,height:1}):Z(H,Wt)&&(X.colorOverLifetime.color=H))}var K=[],z=[0,0,1,1],Q;if(r.splits){var it=r.splits[0];Q=it[4],z=Q?[it[0],it[1],it[3],it[2]]:[it[0],it[1],it[2],it[3]]}if(v&&!v.animate)for(var ct=Q?v.row:v.col,nt=Q?v.col:v.row,yt=v.total||ct*nt,_t=0,Vt=0;Vt<ct;Vt++)for(var mt=0;mt<nt&&_t<yt;mt++,_t++)K.push([Vt*z[2]/ct+z[0],mt*z[3]/nt+z[1],z[2]/ct,z[3]/nt]);else K.push(z);this.uvs=K,X.textureFlip=Q;var at=r.trails,kt;at&&(this.trails={lifetime:J(at.lifetime),dieWithParticles:at.dieWithParticles!==!1,sizeAffectsWidth:!!at.
7sizeAffectsWidth,sizeAffectsLifetime:!!at.sizeAffectsLifetime,inheritParticleColor:!!at.inheritParticleColor,parentAffectsPosition:!!at.parentAffectsPosition},kt={name:"Trail",matrix:Tt.IDENTITY,minimumVertexDistance:at.minimumVertexDistance||.02,maxTrailCount:o.maxCount,pointCountPerTrail:Math.round(at.maxPointPerTrail)||32,blending:at.blending,texture:at.texture?this.engine.findObject(at.texture):void 0,opacityOverLifetime:J(at.opacityOverLifetime||1),widthOverTrail:J(at.widthOverTrail||1),shaderCachePrefix:V,lifetime:this.trails.lifetime,occlusion:!!at.occlusion,transparentOcclusion:!!at.transparentOcclusion,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},at.colorOverLifetime&&at.colorOverLifetime[0]===dt.GRADIENT_COLOR&&(kt.colorOverLifetime=at.colorOverLifetime[1]),at.colorOverTrail&&at.colorOverTrail[0]===dt.GRADIENT_COLOR&&(kt.colorOverTrail=at.colorOverTrail[1])),this.particleMeshProps=X,kt&&(this.trailMeshProps=kt);var wt=r.interaction;if(wt){var ut;this.interaction={multiple:wt.multiple,radius:(ut=wt.radius)!=null?ut:.4,behavior:wt.behavior}}this.item.getHitTestParams=this.getHitTestParams},Mt(s,[{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(e){var r;this.options.maxCount=e,(r=this.renderer)!=null&&r.particleMesh&&(this.renderer.particleMesh.maxCount=e)}}]),s}(ce);fn=$([xt(tt.ParticleSystem)],fn);var Jd=new D,tv=new ht,ev=new Me,rv=new D,iv=new D,Zo=new D,qo=new Me,nv=[0,0,0],av=new Tt;function sv(i){var s={};return Array.isArray(i)&&i.forEach(function(n){var t=Z(n,Array),e=t?n[0]:n.index,r=s[e];r||(r=s[e]=[]),t?r.push(n.slice(1,4)):r.push([+n.x,+n.y,+n.z])}),s}function ov(i,s){var n=Math.floor(Math.random()*i.length),t=i[n];return t}var ga=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.create=function(e,r){var a=r[this.getInstanceId()];if(Z(a,Ie))for(var o=M(this.getChildTracks()),u;!(u=o()).done;){var l=u.value;if(Z(l,da)){if(a.getComponent(fn))for(var h=e.createTrack(sd,this,"ParticleTrack"),c=M(l.getClips()),f;!(f=c()).done;){var d=f.value,v=h.createClip(Zd);v.start=d.start,v.duration=d.duration,v.endBehavior=d.endBehavior}if(a.getComponent(dn))for(var p=e.createTrack(cv,this,"SpriteComponentTimeTrack"),g=M(l.getClips()),x;!(x=g()).done;){var b=x.value,y=p.createClip(tu);y.start=b.start,y.duration=b.duration,y.endBehavior=b.endBehavior}if(a.getComponent(ii))for(var E=e.createTrack(fv,this,"EffectComponentTimeTrack"),_=M(l.getClips()),S;!(S=_()).done;){var C=S.value,I=E.createClip(tu);I.start=C.start,I.duration=C.duration,I.endBehavior=C.endBehavior}break}}},s}(ke);ga=$([xt(tt.ObjectBindingTrack)],ga);var Qo=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){return new jf},s}(Be);Qo=$([xt(tt.ActivationPlayableAsset)],Qo);var ya=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){var e=new li;return e.curve=J(this.curveData),e.value=e.curve.getValue(0),e},s}(Be);$([bt()],ya.prototype,"curveData",void 0);ya=$([xt(tt.ColorPropertyPlayableAsset)],ya);var xa=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){var e=new li;return e.curve=J(this.curveData),e.value=e.curve.getValue(0),e},s}(Be);$([bt()],xa.prototype,"curveData",void 0);xa=$([xt(tt.FloatPropertyPlayableAsset)],xa);var Ko=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){return new Kf},s}(Be);Ko=$([xt(tt.SubCompositionPlayableAsset)],Ko);var ba=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){var e=new li;return e.curve=J(this.curveData),e.value=e.curve.getValue(0),e},s}(Be);$([bt()],ba.prototype,"curveData",void 0);ba=$([xt(tt.Vector4PropertyPlayableAsset)],ba);var Ta=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){var e=new li;return e.curve=J(this.curveData),e.value=e.curve.getValue(0),e},s}(Be);$([bt()],Ta.prototype,"curveData",void 0);Ta=$([xt(tt.Vector3PropertyPlayableAsset)],Ta);var _a=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){var e=new li;return e.curve=J(this.curveData),e.value=e.curve.getValue(0),e},s}(Be);$([bt()],_a.prototype,"curveData",void 0);_a=$([xt(tt.Vector2PropertyPlayableAsset)],_a);var uv=function(){function i(n,t,e){this.children=[],this.trackAsset=n,this.mixer=t,this.output=e,this.mixer.trackInstance=this}var s=i.prototype;return s.addChild=function(t){this.children.push(t)},i}(),Ea=function(i){k(s,i);function s(){var t;return t=i.apply(this,arguments)||this,t.tracks=[],t.cacheFlattenedTracks=null,t}var n=s.prototype;return n.createTrack=function(e,r,a){var o=new e(this.engine);return o.name=a||e.name,r.addChild(o),this.invalidate(),o},n.invalidate=function(){this.cacheFlattenedTracks=null},n.addSubTracksRecursive=function(e,r){for(var a=M(e.getChildTracks()),o;!(o=a()).done;){var u=o.value;r.push(u)}for(var l=M(e.getChildTracks()),h;!(h=l()).done;){var c=h.value;this.addSubTracksRecursive(c,r)}},Mt(s,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var e=M(this.tracks),r;!(r=e()).done;){var a=r.value;this.cacheFlattenedTracks.push(a),this.addSubTracksRecursive(a,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),s}(xe);$([bt()],Ea.prototype,"tracks",void 0);
7Ea=$([xt(tt.TimelineAsset)],Ea);var lv=function(){function i(n,t){this.masterTrackInstances=[],this.clips=[];for(var e={},r=M(t),a;!(a=r()).done;){var o=a.value;e[o.key.getInstanceId()]=o.value}for(var u=M(n.tracks),l;!(l=u()).done;){var h=l.value;Z(h,ga)&&h.create(n,e)}this.compileTracks(n.flattenedTracks,t)}var s=i.prototype;return s.evaluate=function(t,e){for(var r=M(this.clips),a;!(a=r()).done;){var o=a.value;o.evaluateAt(t)}for(var u=M(this.masterTrackInstances),l;!(l=u()).done;){var h=l.value;this.tickTrack(h,e)}},s.compileTracks=function(t,e){for(var r=t,a={},o=M(r),u;!(u=o()).done;){var l=u.value,h=l.createPlayableGraph(this.clips),c=l.createOutput(),f=new uv(l,h,c);a[l.getInstanceId()]=f,l.parent||this.masterTrackInstances.push(f)}for(var d=M(r),v;!(v=d()).done;)for(var p=v.value,g=a[p.getInstanceId()],x=M(p.getChildTracks()),b;!(b=x()).done;){var y=b.value,E=a[y.getInstanceId()];g.addChild(E)}for(var _=M(e),S;!(S=_()).done;){var C=S.value;a[C.key.getInstanceId()].boundObject=C.value}for(var I=M(this.masterTrackInstances),R;!(R=I()).done;){var O=R.value;this.updateTrackAnimatedObject(O)}},s.tickTrack=function(t,e){var r=t.output.context;r.deltaTime=e,t.output.setUserData(t.boundObject);for(var a=M(t.mixer.clipPlayables),o;!(o=a()).done;){var u=o.value;u.getPlayState()===je.Playing&&u.processFrame(r)}t.mixer.evaluate(r);for(var l=M(t.children),h;!(h=l()).done;){var c=h.value;this.tickTrack(c,e)}},s.updateTrackAnimatedObject=function(t){for(var e=M(t.children),r;!(r=e()).done;){var a=r.value;if(!a.boundObject){var o=a.trackAsset.updateAnimatedObject(t.boun
7dObject);a.boundObject=o}this.updateTrackAnimatedObject(a)}},i}(),$o=[[0,0,1,1,0]],hv=0,Jo=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){var e=new Gf;return e.create(this.data),e},n.fromData=function(e){this.data=e},s}(Be);Jo=$([xt(tt.SpriteColorPlayableAsset)],Jo);var dl=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createTrackMixer=function(){return new Rr},s}(ke),cv=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.updateAnimatedObject=function(e){return e.getComponent(dn)},s}(dl),fv=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.updateAnimatedObject=function(e){return e.getComponent(ii)},s}(dl),tu=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.createPlayable=function(){var e=new dv;return e},s}(Be),dv=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.processFrame=function(e){var r=e.output.getUserData();"time"in r&&(r.time=this.time)},s}(or),dn=function(i){k(s,i);function s(t,e){var r;return r=i.call(this,t)||this,r.time=0,r.duration=1,r.splits=$o,r.name="MSprite"+hv++,e&&r.fromData(e),r}var n=s.prototype;return n.onUpdate=function(e){var r=this;i.prototype.onUpdate.call(this,e);var a=this.time,o=this.duration,u=this.textureSheetAnimation,l,h=(l=u==null?void 0:u.loop)!=null?l:!0;a>o&&h&&(a=a%o);var c=Math.min(Math.max(a/o,0),1),f=this.renderer.texture.source.video;if(f&&(a===0?f.pause():f.play().catch(function(F){r.engine.renderErrors.add(F)}),this.renderer.texture.uploadCurrentVideoFrame()),u){var d,v=u.total||u.row*u.col,p=0,g=0,x=1,b=1,y;if(this.splits){var E=this.splits[0];y=E[4],p=E[0],g=E[1],y?(x=E[3],b=E[2]):(x=E[2],b=E[3])}var _,S;y?(_=1/u.row*x,S=1/u.col*b):(_=1/u.col*x,S=1/u.row*b);var C;if(u.animate){var I=Math.round(c*(v-1)),R=Math.floor(I/u.col),O=I-R*u.col;C=y?[_*R,S*(u.col-O)]:[_*O,S*(1+R)]}else C=[0,S];(d=this.material.getVector4("_TexOffset"))==null||d.setFromArray([p+C[0],b+g-C[1],_,S])}this.time=a+e/1e3},n.onDisable=function(){i.prototype.onDisable.call(this),this.time=0},n.onDestroy=function(){var e=this.renderer.texture,r=e.source;r.sourceType===st.video&&(r!=null&&r.video)&&(r.video.pause(),r.video.src="",r.video.load())},n.updateGeometry=function(e){var r=this.textureSheetAnimation?[0,0,1,1,this.splits[0][4]]:this.splits[0],a=r,o=a[0],u=a[1],l=!!a[4],h=l?a[3]:a[2],c=l?a[2]:a[3],f=l?-Math.PI/2:0,d=e.getAttributeData("aUV"),v=e.getAttributeData("aPos"),p=e.getIndexData(),g=[0,0];if(d&&v&&p){for(var x=d.length/2,b=0;b<x;b++){var y=b*3,E=b*2,_=v[y],S=v[y+1];g[0]=_,g[1]=S,Vd(g,g,f),d[E]=(g[0]+.5)*h+o,d[E+1]=(g[1]+.5)*c+u}this.geometry.setAttributeData("aPos",v.slice()),this.geometry.setAttributeData("aUV",d.slice()),this.geometry.setIndexData(p.slice()),this.geometry.setDrawCount(p.length)}this.geometry.subMeshes.length=0;for(var C=M(e.subMeshes),I;!(I=C()).done;){var R=I.value;this.geometry.subMeshes.push({offset:R.offset,indexCount:R.indexCount,vertexCount:R.vertexCount})}},n.updateGeometryFromMultiSplit=function(){for(var e=this,r=e.splits,a=e.textureSheetAnimation,o=1,u=1,l=this.defaultGeometry,h=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],c=[],f=[],d=[],v=2,p=2,g=0;g<v;g++)for(var x=0;x<p;x++){var b=(x*2+g)*4,y=a?[0,0,1,1,r[0][4]]:r[x*2+g],E=y[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],_=((g+g+1)/v-1)/2,S=((x+x+1)/p-1)/2,C=y[0],I=y[1],R=y[4]?y[3]:y[2],O=y[4]?y[2]:y[3],F=[h[0]/v+_,h[1]/p+S,h[2]/v+_,h[3]/p+S,h[4]/v+_,h[5]/p+S,h[6]/v+_,h[7]/p+S];c.push(E[0]*R+C,E[1]*O+I,E[2]*R+C,E[3]*O+I,E[4]*R+C,E[5]*O+I,E[6]*R+C,E[7]*O+I),d.push(F[0]*o,F[1]*u,0,F[2]*o,F[3]*u,0,F[4]*o,F[5]*u,0,F[6]*o,F[7]*u,0),f.push(b,1+b,2+b,2+b,1+b,3+b)}l.setAttributeData("aPos",new Float32Array(d)),l.setIndexData(new Uint16Array(f)),l.setAttributeData("aUV",new Float32Array(c)),l.setDrawCount(f.length)},n.fromData=function(e){i.prototype.fromData.call(this,e);var r,a=(r=e.splits)!=null?r:$o,o=e.textureSheetAnimation;this.splits=a,this.textureSheetAnimation=o;var u=e.geometry?this.engine.findObject(e.geometry):this.defaultGeometry;a.length===1?this.updateGeometry(u):this.updateGeometryFromMultiSplit(),this.interaction=e.interaction;var l=e.options.startColor||[1,1,1,1];this.material.setColor("_Color",new Ct().setFromArray(l));var h;this.duration=(h=e.duration)!=null?h:this.item.duration},s}(Za);dn=$([xt(tt.SpriteComponent)],dn);var vv=function(i){k(s,i);function s(){return i.apply(this,arguments)}return s}(Ir(Li));function pv(i){return i===" "||i===" "||i==="Â "}
7function mv(i){var s,n=(s=i.codePointAt(0))!=null?s:0;return n>=13312&&n<=19903||n>=19968&&n<=40959||n>=63744&&n<=64255||n>=131072&&n<=195103||n>=12352&&n<=12447||n>=12448&&n<=12543||n>=12784&&n<=12799||n>=44032&&n<=55215}function eu(i){return pv(i)?"swallow":mv(i)?"keep":!1}var gv=function(){function i(){this.elements=[]}var s=i.prototype;return s.dispose=function(){this.elements.forEach(function(t){return t.remove()}),this.elements.length=0},s.getCanvas=function(){if(this.elements.length!==0){var t=this.elements.shift();return ne(t),t}if(Gd(Bd))return window._createOffscreenCanvas(10,10);var e=document.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},s.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?we(this.elements,t):t.remove()},i}(),si=new gv,yv=function(){function i(n){this.width=0,this.height=0,this.autoResize=Cr.fixed,this.keepWordIntact=!0,this.update(n)}var s=i.prototype;return s.update=function(t){var e=t.textHeight,r=e===void 0?100:e,a=t.textWidth,o=a===void 0?100:a,u=t.textOverflow,l=u===void 0?Si.clip:u,h=t.textVerticalAlign,c=h===void 0?qr.top:h,f=t.textAlign,d=f===void 0?kr.left:f,v=t.letterSpace,p=v===void 0?0:v,g=t.fontSize,x=t.lineHeight,b=x===void 0?g:x,y=t.autoResize,E=y===void 0?Cr.fixed:y,_=t.keepWordIntact,S=_===void 0?!0:_;this.letterSpace=p,this.overflow=l,this.textVerticalAlign=c,this.textAlign=d,this.width=o,this.height=r,this.autoResize=E,this.keepWordIntact=S,this.lineHeight=b},s.getOffsetY=function(t,e,r,a,o){var u=(r-a)/3,l=a,h=o!==void 0?o:r*(e-1),c=0;switch(this.textVerticalAlign){case qr.top:c=l+u;break;case qr.middle:c=(this.height-h+l)/2;break;case qr.bottom:c=this.height-h-u;break}return c},s.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case kr.left:r=0;break;case kr.middle:r=(this.width-e)/2;break;case kr.right:r=this.width-e;break}return r},s.setSize=function(t,e){this.width=t,this.height=e},i}(),xv=function(){function i(n){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(n)}var s=i.prototype;return s.update=function(t){var e=t.textColor,r=e===void 0?[1,1,1,1]:e,a=t.fontSize,o=a===void 0?40:a,u=t.outline,l=t.shadow,h=t.fontWeight,c=h===void 0?"normal":h,f=t.fontStyle,d=f===void 0?"normal":f,v=t.fontFamily,p=v===void 0?"sans-serif":v;this.textColor=[].concat(r),this.textWeight=c,this.fontStyle=d,this.fontFamily=p,this.fontSize=o,this.isOutlined=!1,this.outlineColor=[1,1,1,1],this.outlineWidth=0;var g;if(u&&((g=u.outlineWidth)!=null?g:0)>0){this.isOutlined=!0;var x;this.outlineColor=[].concat((x=u.outlineColor)!=null?x:[1,1,1,1]);var b;this.outlineWidth=(b=u.outlineWidth)!=null?b:0}if(this.hasShadow=!1,this.shadowBlur=2,this.shadowColor=[0,0,0,1],this.shadowOffsetX=0,this.shadowOffsetY=0,l){this.hasShadow=!0;var y;this.shadowBlur=(y=l.shadowBlur)!=null?y:2;var E;this.shadowColor=[].concat((E=l.shadowColor)!=null?E:[0,0,0,1]);var _;this.shadowOffsetX=(_=l.shadowOffsetX)!=null?_:0;var S;this.shadowOffsetY=(S=l.shadowOffsetY)!=null?S:0}this.fontOffset=0,this.fontStyle!==Ci.normal&&(this.fontOffset+=this.fontSize*Math.tan(12*.0174532925))},i}(),bv=function(){function i(){this.isDirty=!0,this.maxLineWidth=0,this.ALPHA_FIX_VALUE=1/255}var s=i.prototype;return s.setText=function(t){this.text!==t&&(this.text=t.toString(),this.isDirty=!0)},s.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},s.setTextVerticalAlign=function(t){this.textLayout.textVerticalAlign!==t&&(this.textLayout.textVerticalAlign=t,this.isDirty=!0)},s.setTextBaseline=function(t){console.warn("setTextBaseline å·²åºå¼ï¼è¯·æ¹ç¨ setTextVerticalAlignãæ¬æ¬¡è°ç¨å°è½¬è°ç¨ setTextVerticalAlignã"),this.setTextVerticalAlign(t)},s.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},s.setFontFamily=function(t){if(!Fu(t)){console.warn("Risky font family, ignored:",t);return}this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0)},s.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},s.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},s.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},s.setOutlineEnabled=function(t){this.textStyle.isOutlined!==t&&(this.textStyle.isOutlined=t,this.isDirty=!0)},s.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},s.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},s.getFontDesc=function(t){var e=this.textStyle,r=e.fontSize,a=e.fontFamily,o=e.textWeight,u=e.fontStyle,l=""+(t||r).toString()+"px ";return["serif","sans-serif","monospace","courier"].includes(a)?l+=a:l+='"'+a+'"',o!==an.normal&&(l=o+" "+l),u!==Ci.normal&&(l=u+" "+l),l},s.setupOutline=function(t){t===void 0&&(t=1);var e=this.context,r=this.textStyle,a=r.outlineColor,o=r.outlineWidth,u=a[0],l=a[1],h=a[2],c=a[3];e&&(e.strokeStyle="rgba("+u*255+", "+l*255+", "+h*255+", "+c+")",e.lineWidth=o*2/t)},s.setupShadow=function(){var t=this.context,e=this.textStyle,r=e.shadowColor,a=e.shadowBlur,o=e.shadowOffsetX,u=e.shadowOffsetY,l=e.fontScale,h=r[0],c=r[1],f=r[2],d=r[3];t&&(t.shadowColor="rgba("+h*255+", "+c*255+", "+f*255+", "+d+")",t.shadowBlur=a*l,t.shadowOffsetX=o*l,t.shadowOffsetY=-u*l)},s.disposeTextTexture=function(){var t=this.renderer.texture;
7t&&t!==this.engine.whiteTexture&&t.dispose()},s.renderToTexture=function(t,e,r,a,o){if(o===void 0&&(o={}),!(!this.context||!this.canvas)){var u=this.context;u.save(),this.canvas.width=t,this.canvas.height=e,u.setTransform(1,0,0,1,0,0),r||(u.translate(0,e),u.scale(1,-1)),u.clearRect(0,0,t,e),u.fillStyle="rgba(255, 255, 255, "+this.ALPHA_FIX_VALUE+")",a(u),u.restore();var l=u.getImageData(0,0,t,e),h=Wt.createWithData(this.engine,{data:new Uint8Array(l.data),width:l.width,height:l.height},{flipY:r,magFilter:P.LINEAR,minFilter:P.LINEAR,wrapS:P.CLAMP_TO_EDGE,wrapT:P.CLAMP_TO_EDGE});o.disposeOld!==!1&&this.disposeTextTexture(),this.renderer.texture=h,this.material.setTexture("_MainTex",h)}},s.initTextBase=function(t){this.engine=t,this.canvas=si.getCanvas(),si.saveCanvas(this.canvas),this.context=this.canvas.getContext("2d",{willReadFrequently:!0})},i}(),ru=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/,Tv=0,wa=function(i){k(s,i);function s(t){var e;e=i.call(this,t)||this,e.isDirty=!0,e.lineCount=0,e.effectScaleX=1,e.effectScaleY=1,e.maxLineWidth=0,e.name="MText"+Tv++,e.canvas=si.getCanvas(),si.saveCanvas(e.canvas),e.context=e.canvas.getContext("2d",{willReadFrequently:!0});var r=e.getDefaultProps(),a=r.options;return e.updateWithOptions(a),e}var n=s.prototype;return n.onUpdate=function(e){i.prototype.onUpdate.call(this,e),this.updateTexture();for(var r=M(this.materials),a;!(a=r()).done;){var o=a.value,u=this.transform.size.x,l=this.transform.size.y,h=this.getTextureExpandScale(),c=h[0],f=h[1];u*=c,l*=f,o.setVector2("_Size",new ht(u,l))}},n.render=function(e){this.maskManager.drawStencilMask(e,this),e.drawGeometry(this.geometry,this.transform.getWorldMatrix(),this.material)},n.onDestroy=function(){i.prototype.onDestroy.call(this),this.disposeTextTexture()},n.fromData=function(e){i.prototype.fromData.call(this,e);var r=e.interaction,a=e.options;this.interaction=r,this.resetState(),this.updateWithOptions(a),this.renderText(a),this.material.setColor("_Color",new Ct(1,1,1,1))},n.resetState=function(){this.disposeTextTexture(),this.isDirty=!0,this.lineCount=0,this.maxLineWidth=0},n.updateWithOptions=function(e){this.textStyle?this.textStyle.update(e):this.textStyle=new xv(e),this.textLayout?this.textLayout.update(e):this.textLayout=new yv(e),this.text=e.text.toString()},n.getLineCount=function(e){var r=this.context,a=this.textLayout,o=a.letterSpace,u=a.overflow;this.maxLineWidth=0;var l=this.textLayout.width+this.textStyle.fontOffset,h=1,c=0,f=0,d=Array.from(e);if(r&&(r.font=this.getFontDesc(this.textStyle.fontSize)),u===Si.display){for(var v=M(d),p;!(p=v()).done;){var g=p.value,x,b,y=(b=r==null||(x=r.measureText(g))==null?void 0:x.width)!=null?b:0;g==="\n"?(h++,c=0,f=0):(f>0&&(c+=o),c+=y,f++,this.maxLineWidth=Math.max(this.maxLineWidth,c))}return h}if(this.textLayout.keepWordIntact)for(var E=0,_=0,S=M(d),C;!(C=S()).done;){var I=C.value,R,O,F=(O=r==null||(R=r.measureText(I))==null?void 0:R.width)!=null?O:0;if(I==="\n"){h++,this.maxLineWidth=Math.max(this.maxLineWidth,c),c=0,f=0,E=0,_=0;continue}var L=f>0?o:0,V=c+L+F;V>l&&f>0&&(h++,_>1?(this.maxLineWidth=Math.max(this.maxLineWidth,E),c=c-E,f=f-_):(this.maxLineWidth=Math.max(this.maxLineWidth,c),c=0,f=0),E=0,_=0),f>0&&(c+=o),c+=F,f++,eu(I)!==!1&&(E=c,_=f)}else for(var U=0;U<d.length;U++){var W,G=d[U],B,X=(B=r==null||(W=r.measureText(G))==null?void 0:W.width)!=null?B:0;f>0&&(c+=o),(c+X>l&&U>0||G==="\n")&&(h++,this.maxLineWidth=Math.max(this.maxLineWidth,c),c=0,f=0),G!=="\n"&&(c+=X,f++)}return this.maxLineWidth=Math.max(this.maxLineWidth,c),h},n.setLineHeight=function(e){var r=this.textStyle.fontSize,a=Math.max(r,e);this.textLayout.lineHeight!==a&&(this.textLayout.lineHeight=a,this.isDirty=!0)},n.updateTexture=function(e){var r=this;if(e===void 0&&(e=!0),!(!this.isDirty||!this.context||!this.canvas)){var a=this.textStyle,o=this.textLayout,u=a.fontScale;o.autoResize===Cr.autoWidth?(o.width=this.getTextWidth(),this.lineCount=this.getLineCount(this.text),o.height=o.lineHeight*this.lineCount):o.autoResize===Cr.autoHeight?(this.lineCount=this.getLineCount(this.text),o.height=o.lineHeight*this.lineCount):this.lineCount=this.getLineCount(this.text);var l=o.width+a.fontOffset,h=o.height,c=a.fontSize,f=o.lineHeight;a.fontDesc=this.getFontDesc(c);var d=Array.from(this.text||""),v=this.getEffectPadding(),p=v.padL,g=v.padR,x=v.padT,b=v.padB,y=(p|g|x|b)!==0,E=this.engine.gpuCapability.detail.maxTextureSize/2,_=y?l+p+g:l,S=y?h+x+b:h,C=Math.max(_,S,1);u=Math.min(u,E/C);var I=Math.ceil(_*u),R=Math.ceil(S*u),O=y?p:0,F=y?e?x:b:0;this.effectScaleX=l>0?I/(l*u):1,this.effectScaleY=h>0?R/(h*u):1;var L=.11092565,V=L*L;this.transform.setSize(l*V,h*V),this.renderToTexture(I,R,e,function(U){U.scale(u,u),r.maxLineWidth>l&&o.overflow===Si.display?U.font=r.getFontDesc(c*l/r.maxLineWidth):U.font=a.fontDesc;var W=a.textColor,G=W[0],B=W[1],X=W[2],H=W[3];U.fillStyle="rgba("+G*255+", "+B*255+", "+X*255+", "+H+")";var Y=[],K=0,z=o.getOffsetY(a,r.lineCount,f,c),Q=[],it=[];if(o.keepWordIntact)for(var ct=-1,nt=!1,yt=0;yt<d.length;
7yt++){var _t=d[yt],Vt=U.measureText(_t);if(_t==="\n"){Y.push({y:z,width:K,chars:Q,charOffsetX:it}),K=0,z+=f,Q=[],it=[],ct=-1,nt=!1;continue}var mt=Q.length>0?o.letterSpace:0,at=K+mt+Vt.width;if(at>l&&Q.length>0)if(ct>0){var kt=nt?ct:ct+1,wt=Q.slice(0,kt),ut=it.slice(0,kt),qt=wt.length>0?ut[ut.length-1]+U.measureText(wt[wt.length-1]).width:0;Y.push({y:z,width:qt,chars:wt,charOffsetX:ut}),z+=f,Q=Q.slice(ct+1),K=0,it=[];for(var It=0;It<Q.length;It++)It>0&&(K+=o.letterSpace),it.push(K),K+=U.measureText(Q[It]).width;ct=-1,nt=!1}else Y.push({y:z,width:K,chars:Q,charOffsetX:it}),K=0,z+=f,Q=[],it=[],ct=-1,nt=!1;Q.length>0&&(K+=o.letterSpace),it.push(K),Q.push(_t),K+=Vt.width;var ot=eu(_t);ot!==!1&&(ct=Q.length-1,nt=ot==="swallow")}else for(var At=0;At<d.length;At++){var Rt=d[At],Ft=U.measureText(Rt);Q.length>0&&(K+=o.letterSpace),(K+Ft.width>l&&At>0||Rt==="\n")&&(Y.push({y:z,width:K,chars:Q,charOffsetX:it}),K=0,z+=f,Q=[],it=[]),Rt!=="\n"&&(Q.push(Rt),it.push(K),K+=Ft.width)}Q.length>0&&Y.push({y:z,width:K,chars:Q,charOffsetX:it});var se=a.isOutlined&&a.outlineWidth>0;se&&(a.hasShadow&&r.setupShadow(),r.setupOutline(u),Y.forEach(function(Ot){var Ke=F+Ot.y,Le=Ot.chars.join(""),mr=Le.length>0&&ru.test(Le);if(mr){var oe=U.measureText(Le).width,Fr=o.getOffsetX(a,oe);U.save(),U.direction="rtl",U.strokeText(Le,O+Fr+oe,Ke),U.restore()}else for(var Hr=o.getOffsetX(a,Ot.width),Pe=0;Pe<Ot.chars.length;Pe++){var Xr=Ot.chars[Pe],Or=O+Hr+Ot.charOffsetX[Pe];U.strokeText(Xr,Or,Ke)}}),a.hasShadow&&(U.shadowColor="transparent")),!se&&a.hasShadow&&r.setupShadow(),Y.forEach(function(Ot){var Ke=F+Ot.y,Le=Ot.chars.join(""),mr=Le.length>0&&ru.test(Le);if(mr){var oe=U.measureText(Le).width,Fr=o.getOffsetX(a,oe);U.save(),U.direction="rtl",U.fillText(Le,O+Fr+oe,Ke),U.restore()}else for(var Hr=o.getOffsetX(a,Ot.width),Pe=0;Pe<Ot.chars.length;Pe++){var Xr=Ot.chars[Pe],Or=O+Hr+Ot.charOffsetX[Pe];U.fillText(Xr,Or,Ke)}}),a.hasShadow&&(U.shadowColor="transparent")}),this.isDirty=!1}},n.renderText=function(e){this.updateTexture()},n.getTextureExpandScale=function(){return[this.effectScaleX,this.effectScaleY]},n.getEffectPadding=function(){var e=this.textStyle,r=e.isOutlined&&e.outlineWidth>0,a=r?Math.ceil(e.outlineWidth*2):0,o=e.hasShadow&&(e.shadowBlur>0||e.shadowOffsetX!==0||e.shadowOffsetY!==0),u=o?Math.ceil(Math.abs(e.shadowOffsetX)+Math.abs(e.shadowOffsetY)+e.shadowBlur):0,l=a+u;return{padL:l,padR:l,padT:l,padB:l}},n.setAutoResize=function(e){this.textLayout.autoResize!==e&&(this.textLayout.autoResize=e,this.isDirty=!0)},n.setTextWidth=function(e){var r=Math.max(0,Number(e)||0),a=this.textLayout;a.width!==r&&(a.autoResize===Cr.autoWidth&&(a.autoResize=Cr.autoHeight),a.width=r,this.isDirty=!0)},n.setTextHeight=function(e){var r=Math.max(0,Number(e)||0);if(r!==0){var a=this.textLayout;a.height!==r&&(a.height=r,this.isDirty=!0)}},n.setFontSize=function(e){var r=Math.max(1,Number(e)||1);this.textStyle.fontSize!==r&&(this.textStyle.fontSize=r,this.isDirty=!0)},n.setOutlineWidth=function(e){var r=Math.max(0,Number(e)||0);this.textStyle.outlineWidth!==r&&(this.textStyle.outlineWidth=r,this.isDirty=!0)},n.setOutlineEnabled=function(e){this.textStyle.isOutlined!==e&&(this.textStyle.isOutlined=e,this.isDirty=!0)},n.setShadowBlur=function(e){var r=Math.max(0,Number(e)||0);this.textStyle.shadowBlur!==r&&(this.textStyle.shadowBlur=r,this.isDirty=!0)},n.setShadowColor=function(e){var r=e!=null?e:[0,0,0,1];this.textStyle.shadowColor!==r&&(this.textStyle.shadowColor=r,this.isDirty=!0)},n.setShadowOffsetX=function(e){var r=Number(e)||0;this.textStyle.shadowOffsetX!==r&&(this.textStyle.shadowOffsetX=r,this.isDirty=!0)},n.setShadowOffsetY=function(e){var r=Number(e)||0;this.textStyle.shadowOffsetY!==r&&(this.textStyle.shadowOffsetY=r,this.isDirty=!0)},n.getTextWidth=function(){var e=this.context;if(!e){var r,a;return(a=(r=this.textLayout)==null?void 0:r.width)!=null?a:0}var o,u=((o=this.text)!=null?o:"").toString(),l=this.textLayout,h=this.textStyle;e.font=this.getFontDesc(h.fontSize);for(var c=0,f=0,d=0;d<u.length;d++){var v=u[d];if(v==="\n"){c=Math.max(c,f),f=0;continue}f+=l.letterSpace||0,f+=e.measureText(v).width}c=Math.max(c,f);var p=2,g=1e-4,x=Math.ceil(c-(h.fontOffset||0)-g)+p;return Math.max(0,x)},n.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:tt.TextComponent,options:{text:"é»è®¤ææ¬",fontFamily:"AlibabaSans-BoldItalic",fontSize:40,textColor:[1,1,1,1],fontWeight:an.normal,letterSpace:0,textAlign:kr.middle,fontStyle:Ci.normal,textWidth:200,textHeight:42,lineHeight:40.148}
7,renderer:{renderMode:1,anchor:[.5,.5]}}},s}(Za);wa=$([xt(tt.TextComponent)],wa);hh(wa,[bv]);var _v=function(i){k(s,i);function s(){return i.apply(this,arguments)}return s}(Ir(Li)),Ev=function(i){k(s,i);function s(){return i.apply(this,arguments)}return s}(xe),Sa=function(i){k(s,i);function s(){return i.apply(this,arguments)}return s}(xe);$([bt()],Sa.prototype,"buffer",void 0);Sa=$([xt(tt.BinaryAsset)],Sa);var wv=function(){function i(){}return i.serialize=function(n,t){n.toData(),t||(t={});var e=gs(n);if(e)for(var r=M(Object.keys(e)),a;!(a=r()).done;){var o=a.value,u=n[o];typeof u=="number"||typeof u=="string"||typeof u=="boolean"||i.checkTypedArray(u)?t[o]=u:wr(u)?(t[o]||(t[o]=[]),i.serializeArrayProperty(u,t[o],0)):xe.is(u)?t[o]={id:u.getInstanceId()}:tr(u)&&(t[o]||(t[o]={}),i.serializeObjectProperty(u,t[o],0))}for(var l=M(Object.keys(n.definition)),h;!(h=l()).done;){var c=h.value,f=n.definition[c];typeof f=="number"||typeof f=="string"||typeof f=="boolean"||i.checkTypedArray(f)?t[c]=f:wr(f)?(t[c]||(t[c]=[]),i.serializeArrayProperty(f,t[c],0)):xe.is(f)?t[c]={id:f.getInstanceId()}:tr(f)&&(t[c]||(t[c]={}),i.serializeObjectProperty(f,t[c],0))}return t},i.deserialize=function(n,t){t.definition=n;var e=gs(t),r=t.engine;if(e)for(var a=M(Object.keys(e)),o;!(o=a()).done;){var u=o.value,l=n[u];if(l!==void 0){var h=e[u].type;t[u]=i.deserializeProperty(l,r,0,h)}}t.fromData(t.definition)},i.checkTypedArray=function(n){return Z(n,Int8Array)||Z(n,Uint8Array)||Z(n,Uint8ClampedArray)||Z(n,Int16Array)||Z(n,Uint16Array)||Z(n,Int32Array)||Z(n,Uint32Array)||Z(n,Float32Array)||Z(n,Float64Array)||Z(n,ArrayBuffer)},i.checkDataPath=function(n){return!!(tr(n)&&Object.keys(n).length===1&&"id"in n&&vr(n.id))},i.checkGLTFNode=function(n){return tr(n)&&n.nodeIndex!==void 0&&n.isJoint!==void 0},i.checkImageSource=function(n){return Lu(n)||Z(n,HTMLImageElement)},i.deserializeProperty=function(n,t,e,r,a){if(a===void 0&&(a=!0),e>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}if(wr(n)){for(var o=[],u=M(n),l;!(l=u()).done;){var h=l.value;o.push(i.deserializeProperty(h,t,e+1,r,a))}return o}else if(i.checkDataPath(n)){var c=t.findObject(n);return a?c:n}else if(Ou(n)){var f;r?f=new r:f={};for(var d=M(Object.keys(n)),v;!(v=d()).done;){var p=v.value;f[p]=i.deserializeProperty(n[p],t,e+1,void 0,a)}return f}else return n},i.serializeObjectProperty=function(n,t,e){if(e>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}t||(t={});for(var r=M(Object.keys(n)),a;!(a=r()).done;){var o=a.value,u=n[o];typeof u=="number"||typeof u=="string"||typeof u=="boolean"||i.checkTypedArray(n)?t[o]=u:wr(u)?(t[o]||(t[o]=[]),i.serializeArrayProperty(u,t[o],e+1)):xe.is(u)?t[o]={id:u.getInstanceId()}:tr(u)&&(t[o]||(t[o]={}),i.serializeObjectProperty(u,t[o],e+1))}},i.serializeArrayProperty=function(n,t,e){if(e>14){console.error("The nested object layers of the serialized data exceed the maximum limit.");return}t||(t=[]);for(var r=0;r<n.length;r++){var a=n[r];typeof a=="number"||typeof a=="string"||typeof a=="boolean"||i.checkTypedArray(n)?t[r]=a:wr(a)?(t[r]||(t[r]=[]),i.serializeArrayProperty(a,t[r],e+1)):xe.is(a)?t[r]={id:a.getInstanceId()}:tr(a)&&(t[r]||(t[r]={}),i.serializeObjectProperty(a,t[r],e+1))}},i}(),Sv=function(){function i(n){this.engine=n}var s=i.prototype;return s.loadGUID=function(t){if(!t)return null;var e=t.id,r=this.findData(e),a;if(!r){console.warn("Object data with uuid: "+e+" not found.");return}switch(r.dataType){case tt.Material:a=Ce.create(this.engine);break;case tt.Geometry:a=Qe.create(this.engine);break;case tt.Texture:a=Wt.create(this.engine);break;default:{var o=Vu(r.dataType);o&&(a=new o(this.engine))}}if(!a){console.warn("Constructor for DataType: "+r.dataType+" not found.");return}return a.setInstanceId(r.id),this.engine.addInstance(a),wv.deserialize(r,a),a},s.findData=function(t){return this.engine.jsonSceneData[t]},i}();function iu(i,s){if(!i.includes(s))return i.push(s),!0}function St(i){if(Number.isFinite(i))return[dt.CONSTANT,i];if(i){var s=i[0],n=i[1];if(Array.isArray(s))return;if(s==="static"||s===dt.CONSTANT)return[dt.CONSTANT,i[1]];if(s==="lines")return[dt.LINE,i[1]];if(s===dt.LINE){var t=n.map(function(e){return[Lt.LINE,e]});return[dt.BEZIER_CURVE,t]}return s==="curve"||s===dt.CURVE?[dt.BEZIER_CURVE,pl(n)]:i}}function nu(i,s){return Array.isArray(i)&&i[0]==="random"?[dt.CONSTANT,i[1][s]]:St(i)}function vl(i){return i&&i[0]==="color"?vn(i[1],!0):[1,1,1,1]}
7function Cv(i,s){if(i)return i[0]==="colors"?[dt.COLORS,i[1].map(function(n){return vn(n,s)})]:i[0]==="gradient"?Ca(i[1],s):i[0]==="color"?[dt.RGBA_COLOR,vn(i[1],s)]:i}function Ut(i){return i&&i[0]==="random"?[dt.RANDOM,i[1]]:St(i)}function Ca(i,s){if(i){var n=[];return Object.getOwnPropertyNames(i).forEach(function(t){var e=Mv(t),r=vn(i[t],s);n.push([e,r[0],r[1],r[2],r[3]])}),n=n.sort(function(t,e){return t[0]-e[0]}),[dt.GRADIENT_COLOR,n]}}function vn(i,s){var n;if(typeof i=="string"){i=i.replace(/[\s\t\r\n]/g,"");var t=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(i);if(t){var e=+t[4];n=[+t[1],+t[2],+t[3],isNaN(e)?255:Math.round(e*255)]}else/^#[a-f\d]{3}$/i.test(i)?n=[parseInt(i[1]+i[1],16),parseInt(i[2]+i[2],16),parseInt(i[3]+i[3],16),255]:(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i))&&(n=[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),255])}else Z(i,Array)&&(n=[i[0],i[1],i[2],isNaN(i[3])?255:Math.round(i[3]*255)]);return s&&(n=Av(n)),n}function Av(i){if(Array.isArray(i))return i.map(function(s){return Number.isFinite(s/255)?Number((s/255).toFixed(6)):0})}function Mv(i){var s=/^(-)?([\d+.]+)%$/.exec(i);return s?+s[2]/100*(s[1]?-1:1):+i}function $i(i,s){return Array.isArray(i)?i[0]===dt.GRADIENT_COLOR?i:(i[0]==="gradient"||i[0]==="color")&&Ca(i[1],s):Ca(i,s)}function En(i){if(i){if(i.length===3)return[dt.CONSTANT_VEC3,i];var s=i[0];if(s==="path"||s==="bezier"||s===dt.BEZIER_PATH||s===dt.LINEAR_PATH){var n=i[1],t=n[0],e=n[1],r=n[2],a=pl(t);if(!r){r=[];for(var o=0;o<e.length;o++){var u=e[o].slice();o===0||o<e.length-1&&r.push(u),r.push(u)}}return[dt.BEZIER_CURVE_PATH,[a,e,r]]}return i}}function au(i){for(var s=M(Object.keys(i)),n;!(n=s()).done;){var t=n.value;i[t]=Number(i[t])}return i}function Fi(i){for(var s=M(Object.keys(i)),n;!(n=s()).done;){var t=n.value;i[t]===void 0&&delete i[t]}return i}var Nn=Math.cos,Vn=Math.sin,Zr=Math.PI/180,Yi=180/Math.PI;function Iv(i,s,n,t){var e=Nn(s*Zr/2),r=Nn(n*Zr/2),a=Nn(t*Zr/2),o=Vn(s*Zr/2),u=Vn(n*Zr/2),l=Vn(t*Zr/2);return i[0]=o*r*a+e*u*l,i[1]=e*u*a-o*r*l,i[2]=e*r*l+o*u*a,i[3]=e*r*a-o*u*l,i}function Pv(i,s,n){return i>n?n:i<s?s:i}function Rv(i,s){var n=s[0],t=s[1],e=s[2],r=s[3],a=n+n,o=t+t,u=e+e,l=n*a,h=t*a,c=t*o,f=e*a,d=e*o,v=e*u,p=r*a,g=r*o,x=r*u,b=1-c-v,y=h-x,E=h+x,_=1-l-v,S=f-g,C=d+p,I=1-l-c;return i[1]=Math.asin(Pv(-S,-1,1))*Yi,Math.abs(S)<.9999999?(i[0]=Math.atan2(C,I)*Yi,i[2]=Math.atan2(E,b)*Yi):(i[0]=0,i[2]=Math.atan2(-y,_)*Yi),i}function su(i,s){return i?[i[0]-.5,.5-i[1]]:s?Fv[s]:[0,0]}var We,Fv=(We={},We[re.PARTICLE_ORIGIN_CENTER]=[0,0],We[re.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],We[re.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],We[re.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],We[re.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],We[re.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],We[re.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],We[re.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],We[re.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],We);function Ov(i,s,n,t){var e=n[0],r=n[1],a=t[0],o=t[1],u=a-e;i=i*u,s=s*u;var l=[[e+(a-e)/3,r+i/3],[a-(a-e)/3,o-s/3]];return l}function pl(i){for(var s=-1e6,n=1e6,t=0;t<i.length;t++)s=Math.max(s,i[t][1]),n=Math.min(n,i[t][1]);for(var e=[[i[0][0],i[0][1]]],r=0;r<i.length-1;r++){var a=i[r][3]*(s-n),o=i[r+1][2]*(s-n),u=[i[r][0],i[r][1]],l=[i[r+1][0],i[r+1][1]];if(u[0]!=l[0]){var h=Ov(a,o,u,l),c=h[0],f=h[1];e[e.length-1].push(c[0]),e[e.length-1].push(c[1]),e.push([f[0],f[1],l[0],l[1]])}else e[e.length-1].push(l[0]),e[e.length-1].push(l[1])}return e.map(function(d,v){return v===0?[Lt.EASE_OUT,d]:v===e.length-1?[Lt.EASE_IN,d]:[Lt.EASE,d]})}function Lv(i){var s,n=i.options,t={options:{fov:n.fov,far:n.far,near:n.near,clipMode:n.clipMode}},e=i.velocityOverLifetime;if(e||(s=i.transform)!=null&&s.path){var r,a={path:En((r=i.transform)==null?void 0:r.path),linearX:St(e==null?void 0:e.translateX),linearY:St(e==null?void 0:e.translateY),linearZ:St(e==null?void 0:e.translateZ)};Fi(a),t.positionOverLifetime=a}var o=i.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:St(o==null?void 0:o.rotateX),y:St(o==null?void 0:o.rotateY),z:o.separateAxes?St(o==null?void 0:o.rotateZ):St(o.rotation)};Fi(u),t.rotationOverLifetime=u}return t}function Nv(i){var s=i.options,n;switch(s.type){case"click":{n={type:Ye.CLICK,showPreview:s.showPreview,previewColor:s.previewColor&&vl(s.previewColor),behavior:s.behavior||ri.NOTIFY};break}case"drag":{n={type:Ye.DRAG,enableInEditor:!!s.enableInEditor,dxRange:s.dxRange,dyRange:s.dyRange,target:s.target};break}case"message":{n={type:Ye.MESSAGE};break}}var t={options:n};return t}var ou,pn=new Map,Aa=new Map;function uu(i){return i.compositions.forEach(function(s){s.items.forEac
7h(function(n){n.type===rt.null&&n.endBehavior===Gt.destroy&&(n.endBehavior=Gt.freeze)})}),i.version=Oe["2_1"],i}function Vv(i){var s,n=(s=i.version)==null?void 0:s.split(".");return!n||Number(n[0])>2||Number(n[0])===2&&Number(n[1])>=2||i.compositions.forEach(function(t){t.items.forEach(function(e){(e.type===rt.mesh||e.type===rt.light)&&(e.endBehavior=e.endBehavior===1?Gt.destroy:e.endBehavior)})}),i}function kv(i){return i.compositions.map(function(s){for(var n=M(s.items),t;!(t=n()).done;){var e=t.value;ml(e.content)}}),i}function lu(i){for(var s=function(){var K=f.value;(K.endBehavior===vh||K.endBehavior===dh)&&(K.endBehavior=Gt.freeze),K.items=K.items.filter(function(nt){return nt.type!=="8"}),K.items.forEach(function(nt){if(nt.type===rt.particle){var yt=nt.content.filter;yt&&delete nt.content.filter}});for(var z=M(K.items),Q;!(Q=z()).done;){var it=Q.value;l[it.id]=Pt(),it.oldId=it.id,it.id=l[it.id],h[it.id]=it}K.items.forEach(function(nt,yt){if(nt.parentId)if(nt.parentId.includes("^")){var _t=nt.parentId.split("^")[0],Vt=nt.parentId.split("^")[1];nt.parentId=l[_t]+"^"+Vt}else nt.parentId=l[nt.parentId];t.items.push(nt),K.items[yt]={id:nt.id}});var ct=lt({},K,{timelineAsset:{id:""},sceneBindings:[]});t.compositions.push(ct),Wv(ct,h,t)},n,t=lt({},i,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),e=M(t.images),r;!(r=e()).done;){var a=r.value;a.id=Pt()}var o;if((o=(n=t).textures)!=null||(n.textures=[]),t.textures.forEach(function(K){var z;K.id=Pt(),K.dataType=tt.Texture,K.source={id:(z=t.images[K.source])==null?void 0:z.id}}),t.textures.length<t.images.length)for(var u=t.textures.length;u<t.images.length;u++)t.textures.push({id:Pt(),dataType:tt.Texture,source:{id:t.images[u].id},flipY:!0});i.bins&&Hv(i.bins,t);for(var l={},h={},c=M(i.compositions),f;!(f=c()).done;)s();for(var d=M(t.items),v;!(v=d()).done;){var p=v.value;if(p.content){if(p.content.renderer&&p.content.renderer.texture!==void 0){var g=p.content.renderer.texture;p.content.renderer.texture={id:t.textures[g].id}}if(p.content.trails&&p.content.trails.texture!==void 0){var x=p.content.trails.texture;p.content.trails.texture={id:t.textures[x].id}}}if(p.transform){var b,y=[].concat((b=p.transform.position)!=null?b:[0,0,0]),E,_=[].concat((E=p.transform.rotation)!=null?E:[0,0,0]),S,C=[].concat((S=p.transform.scale)!=null?S:[1,1,1]);if(Object.assign(p,{transform:{position:{x:y[0],y:y[1],z:y[2]},eulerHint:{x:_[0],y:_[1],z:_[2]},scale:{x:C[0],y:C[1],z:C[0]}}}),p.type===rt.sprite&&(p.transform.size={x:C[0],y:C[1]},p.transform.scale={x:1,y:1,z:1}),p.type===rt.sprite){var I=p.content;I.renderer||(I.renderer={});var R=I.renderer,O=su(R.anchor,R.particleOrigin),F=p.transform.size;if(!R.anchor&&R.particleOrigin!==void 0){var L;p.transform.position.x+=-O[0]*((L=F==null?void 0:F.x)!=null?L:1);var V;p.transform.position.y+=-O[1]*((V=F==null?void 0:F.y)!=null?V:1)}var U,W;p.transform.anchor={x:O[0]*((U=F==null?void 0:F.x)!=null?U:1),y:O[1]*((W=F==null?void 0:F.y)!=null?W:1)}}}if(p.type===rt.particle){var G=p.content;G.renderer||(G.renderer={});var B=G.renderer;G.renderer.anchor=su(B.anchor,B.particleOrigin)}if(p.type===rt.camera&&p.content.positionOverLifetime&&Object.keys(p.content.positionOverLifetime).length!==0&&(p.content.positionOverLifetime.asMovement=!0),p.pn!==void 0){var X=p.pn,H=i.plugins,Y=H===void 0?[]:H;X!==void 0&&Number.isInteger(X)&&(p.pluginName=Y[X])}switch(p.pluginName==="editor-gizmo"&&(p.type="editor-gizmo"),p.pluginName==="orientation-transformer"&&(p.type="orientation-transformer"),p.content.options.target&&p.pluginName==="editor-gizmo"&&(p.content.options.target=l[p.content.options.target]),p.type===rt.spine&&i.spines&&i.spines.length!==0&&Xv(i.spines[p.content.options.spine],p.content,t),(p.type===rt.sprite||p.type===rt.particle||p.type===rt.mesh||p.type===rt.skybox||p.type===rt.light||p.type==="camera"||p.type===rt.tree||p.type===rt.interact||p.type===rt.camera||p.type===rt.text||p.type===rt.spine||p.type==="editor-gizmo"||p.type==="orientation-transformer")&&(p.components=[],t.components.push(p.content),p.content.id=Pt(),p.content.item={id:p.id},p.dataType=tt.VFXItemData,p.components.push({id:p.content.id})),(p.type===rt.null||p.type===rt.composition)&&(p.components=[],p.dataType=tt.VFXItemData),p.type){case rt.sprite:p.content.dataType=tt.SpriteComponent;break;case rt.particle:p.content.dataType=tt.ParticleSystem;break;case rt.mesh:p.content.dataType=tt.MeshComponent;break;case rt.skybox:p.content.dataType=tt.SkyboxComponent;break;case rt.light:p.content.dataType=tt.LightComponent;break;case"camera":p.content.dataType=tt.CameraComponent;break;case"editor-gizmo":p.content.dataType="GizmoComponent";break;case"orientation-transformer":p.content.dataType="OrientationComponent";break;case rt.tree:p.content.dataType=tt.TreeComponent;break;case rt.interact:p.content.dataType=tt.InteractComponent;break;case rt.camera:p.content.dataType=tt.CameraController;break;case rt.text:p.content.dataType=tt.TextComponent;break;case rt.spine:p.content.dataType=tt.SpineComponent;break}}return t.version=Oe["3_0"],t}function hu(i){for(var s=M(i.components),n;!(n=s()).done;){var t=n.value;if(t.dataType===tt.ShapeComponent){var e=t;if(e.type===te.Custom){var r,a=e;((r=a.shapes)==null?void 0:r.length)>0&&a.shapes[0].fill&&(a.fill=a.shapes[0].fill);for(var o=new Array(a.easingIns.length),u=new Array(a.easingOuts.length).fill(!1),l=M(a.shapes),h;!(h=l()).done;)for(var c=h.value,f=M(c.indexes),d;!(d=f()).done;){var v=d.value,p=a.points[v.point],g=a.easingIns[v.easingIn],x=a.easingOuts[v.easingOut];o[v.easingIn]||(g.x-=p.x,g.y-=p.y,o[v.easingIn]=!0),u[v.easingOut]||(x.x-=p.x,x.y-=p.y,u[v.easingOut]=!0)}}}}return i.version=Oe["3_2"],i}function cu(i){pn.clear(),Aa.clear();for(var s=i.compositions,n=i.items,t=i.components,e=M(t),r;!(r=e()).done;){var a=r.value;pn.set(a.id,a)}for(var o=M(n),u;!(u=o()).done;){var l=u.value;Aa.set(l.id,l)}for(var h=M(s),c;!(c=h()).done;){var f=c.value;Uv(f)}return i.version=Oe["3_3"],i}function fu(i){var s;
7(s=i.plugins)==null||s.forEach(function(E,_){E==="richtext"&&(i.plugins[_]="rich-text")});for(var n=M(i.items),t;!(t=n()).done;){var e=t.value;if(e.type===rt.sprite){var r=pn.get(e.components[0].id);if(r){var a=r.renderer.shape,o=void 0;if(Number.isInteger(a)){var u;o=(u=i.shapes)==null?void 0:u[a]}else o=a;r.renderer.shape=o}}}for(var l=i.compositionId,h={},c=M(i.compositions),f;!(f=c()).done;){var d=f.value,v=Pt();h[d.id]=v,d.id===l&&(i.compositionId=v),d.id=v;var p={id:Pt(),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:p.id}],i.components.push(p)}for(var g=M(i.items),x;!(x=g()).done;){var b=x.value;if(b.content){var y=b.content.options;y&&y.refId!==void 0&&(y.refId=h[y.refId])}}return i.version=Oe["3_4"],i}function du(i){for(var s={},n=M(i.components),t;!(t=n()).done;){var e=t.value;s[e.id]=e}for(var r=M(i.compositions),a;!(a=r()).done;)for(var o=a.value,u=M(o.components),l;!(l=u()).done;){var h=l.value,c=h.id;s[c].item.id=o.id}for(var f=M(i.components),d;!(d=f()).done;){var v=d.value;if(v.dataType===tt.SpriteComponent){var p=v,g=p.renderer,x=g.shape;if(x!=null&&!("aPoint"in x&&"index"in x)){var b=Bv(x);p.geometry={id:b.id},i.geometries.push(b)}}if(v.dataType===tt.ShapeComponent){var y=v;if(y.fills=[],y.fill){var E={type:_e.Solid,color:y.fill.color};y.fills.push(E)}if(delete y.fill,y.strokes=[],y.stroke){var _={type:_e.Solid,color:y.stroke.color};y.strokes.push(_),y.strokeWidth=y.stroke.width,y.strokeCap=y.stroke.cap,y.strokeJoin=y.stroke.join,delete y.stroke}}}return i.version=Oe["3_5"],i}function vu(i){if(i.components)for(var s=M(i.components),n;!(n=s()).done;){var t=n.value;if(t.dataType===tt.RichTextComponent){var e=t;e.options&&e.options.useLegacyRichText===void 0&&(e.options.lineGap===void 0?e.options.useLegacyRichText=!0:e.options.useLegacyRichText=!1)}(t.dataType===tt.TextComponent||t.dataType===tt.RichTextComponent&&t.options)&&Dv(t.options),t.dataType===tt.TextComponent&&zv(t.options)}return i.version=Oe["3_6"],i}function pu(i){for(var s=function(){var W=r.value;if(W.type===rt.text&&W.transform){for(var G,B=i.components.find(function(_t){return W.components[0].id===_t.id}),X,H=W.transform.scale.x/((X=(G=B.options)==null?void 0:G.textWidth)!=null?X:1),Y=.0123,K=H/Y,z=W.transform.scale.x,Q=W.transform.scale.y,it=W.transform.scale.z,ct=M(i.items),nt;!(nt=ct()).done;){var yt=nt.value;yt.parentId===W.id&&yt.transform&&(yt.transform.scale.x*=z/K,yt.transform.scale.y*=Q/K,yt.transform.scale.z*=it/K)}W.transform.scale.x=K,W.transform.scale.y=K,W.transform.scale.z=K,t.push({item:W,scaleFactor:K,oldScaleX:z,oldScaleY:Q,oldScaleZ:it})}},n,t=[],e=M(i.items),r;!(r=e()).done;)s();t.length>0&&((n=i.animations)!=null&&n.length)&&jv(i,t);for(var a=new Map,o=new Map,u=new Map,l=M(i.components),h;!(h=l()).done;){var c=h.value;u.set(c.id,c)}for(var f=M(i.items),d;!(d=f()).done;){var v=d.value;v.children=[],a.set(v.id,v)}for(var p=M(i.compositions),g;!(g=p()).done;){var x=g.value;x.children=[];for(var b=M(x.components),y;!(y=b()).done;){var E=y.value,_=u.get(E.id);if(_.dataType===tt.CompositionComponent){for(var S=_,C=M(S.items),I;!(I=C()).done;){var R=I.value,O=a.get(R.id);O.parentId===void 0&&x.children.push({id:O.id})}delete S.items}}o.set(x.id,x)}for(var F=M(i.items),L;!(L=F()).done;){var V=L.value;if(V.parentId){var U=a.get(V.parentId);U&&U.children.push({id:V.id})}}return i.version=Oe["3_7"],i}function Dv(i){!i||i.TextVerticalAlign!==void 0||i.TextVerticalAlign===void 0&&(i.TextVerticalAlign=i.textBaseline)}function zv(i){if(!(!i||!i.textColor)){var s=i.textColor,n;i.textColor=[s[0]/255,s[1]/255,s[2]/255,(n=s[3])!=null?n:1]}}function Bv(i,s){s===void 0&&(s="å½¢ç¶");for(var n=Nd(i),t=n.index,e=t===void 0?[]:t,r=n.aPoint,a=r===void 0?[]:r,o=new Float32Array(a),u=[],l=[],h=0;h<o.length;h+=6)l.push(a[h+2],a[h+3]),u.push(o[h],o[h+1],0);var c=[],f=u.length/3,d=e.length,v=u.length*4,p=l.length*4,g=v+p,x=e.length*2,b={mode:Xn.TRIANGLES,vertexData:{vertexCount:f,channels:[]},name:s,indexFormat:Kr.UInt16,indexOffset:g,buffer:"",id:Pt(),dataType:tt.Geometry,subMeshes:c};b.vertexData.channels.push({semantic:sn.Position,offset:0,format:Fe.Float32,dimension:3}),b.vertexData.channels.push({semantic:sn.Uv,offset:v,format:Fe.Float32,dimension:2}),b.subMeshes.push({offset:0,indexCount:d,vertexCount:f});var y=x%4===0?0:2,E=new ArrayBuffer(g+x+y),_=new Float32Array(E);_.set(u,0),_.set(l,u.length);var S=new Uint16Array(E,g);S.set(e,0);var C=new Uint8Array(E).slice(0,g+x);return b.binaryData=C,b}function Uv(i){for(var s=M(i.items),n;!(n=s()).done;){var t=n.value,e=Aa.get(t.id);if(!e)return;if(e.type===rt.sprite||e.type===rt.particle||e.type===rt.spine||e.type===rt.text||e.type===rt.richtext||e.type===rt.video||e.type===rt.shape){var r=pn.get(e.components[0].id);r&&Gv(r)}}}function Gv(i){var s=i.renderer,n=s==null?void 0:s.maskMode;!n||n===He.NONE||(n===He.MASK?(i.mask={isMask:!0},ou=i.id):(n===xi.OBSCURED||n===xi.REVERSE_OBSCURED)&&(i.mask={inverted:n===xi.REVERSE_OBSCURED,reference:{i
7d:ou}}))}function ml(i){if(i)for(var s=M(Object.keys(i)),n;!(n=s()).done;){var t=n.value,e=i[t],r=Array.isArray(e);r&&e.length===2&&Array.isArray(e[1])?t==="path"?i[t]=En(e):i[t]=St(e):!r&&typeof e=="object"&&ml(e)}}function Wv(i,s,n){for(var t=[],e=[],r=[],a={tracks:[],id:Pt(),dataType:"TimelineAsset"},o=M(i.items),u;!(u=o()).done;){var l=u.value,h=s[l.id],c=[],f={id:Pt(),dataType:"ActivationPlayableAsset"};r.push(f);var d={id:Pt(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:f.id}}]};if(c.push({id:d.id}),e.push(d),h.type!==rt.particle){var v={id:Pt(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};r.push(v);var p={id:Pt(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:v.id}}]};c.push({id:p.id}),e.push(p)}if(h.type===rt.sprite||h.type===rt.text){var g={id:Pt(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};r.push(g);var x={id:Pt(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:g.id}}]};c.push({id:x.id}),e.push(x)}if(h.type===rt.composition){var b={id:Pt(),dataType:"SubCompositionPlayableAsset"};r.push(b);var y={id:Pt(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:b.id}}]};c.push({id:y.id}),e.push(y)}var E={id:Pt(),dataType:"ObjectBindingTrack",children:c,clips:[]};e.push(E),a.tracks.push({id:E.id}),t.push({key:{id:E.id},value:{id:h.id}})}for(var _=[],S=M(e),C;!(C=S()).done;){var I=C.value;_.push({id:I.id})}i.timelineAsset={id:a.id},i.sceneBindings=t,n.miscs.push(a);for(var R=M(e),O;!(O=R()).done;){var F=O.value;n.miscs.push(F)}for(var L=M(r),V;!(V=L()).done;){var U=V.value;n.miscs.push(U)}}function Hv(i,s){s.bins=i.map(function(n){return{url:n.url,dataType:"BinaryAsset",id:Pt()}})}function Xv(i,s,n){s.resource={atlas:{bins:{id:n.bins[i.atlas[1][0]].id},source:i.atlas[1].slice(1)},skeleton:{bins:{id:n.bins[i.skeleton[1][0]].id},source:i.skeleton[1].slice(1)},skeletonType:i.skeletonType,images:i.images.map(function(t){return{id:n.textures[t].id}})}}function jv(i,s){for(var n=new Map,t=new Map,e=M(i.items),r;!(r=e()).done;){var a=r.value;if(n.set(a.id,a),a.parentId){var o=t.get(a.parentId);o||(o=[],t.set(a.parentId,o)),o.push(a)}}for(var u=new Map,l=new Map,h=M(s),c;!(c=h()).done;){var f=c.value;u.set(f.item.id,f);var d=t.get(f.item.id);if(d)for(var v=M(d),p;!(p=v()).done;){var g=p.value;l.set(g.id,f)}}for(var x=new Map,b=M(i.components),y;!(y=b()).done;){var E=y.value;x.set(E.id,E)}for(var _=new Map,S=M(i.animations),C;!(C=S()).done;){var I=C.value;_.set(I.id,I)}for(var R=M(i.compositions),O;!(O=R()).done;){for(var F=O.value,L,V,U=void 0,W=void 0,G=M(F.components),B;!(B=G()).done;){var X=B.value,H=x.get(X.id);if((H==null?void 0:H.dataType)===tt.Animator?U=H:(H==null?void 0:H.dataType)===tt.CompositionComponent&&(W=H),U&&W)break}if(U){var Y=void 0;if(W){var K=W,z=K.items;if(z){Y=[];for(var Q=M(z),it;!(it=Q()).done;){var ct=it.value,nt=n.get(ct.id);nt&&!nt.parentId&&Y.push(nt)}}}if((!Y||Y.length===0)&&F.children){Y=[];for(var yt=M(F.children),_t;!(_t=yt()).done;){var Vt=_t.value,mt=n.get(Vt.id);mt&&Y.push(mt)}}if(!(!Y||Y.length===0)){var at=U,kt=_.get((L=at.graphAsset)==null?void 0:L.id);if(!(kt==null||(V=kt.graphDataSet)==null)&&V.resources)for(var wt=M(kt.graphDataSet.resources),ut;!(ut=wt()).done;){var qt=ut.value,It=_.get(qt.id);if(It!=null&&It.scaleCurves)for(var ot=M(It.scaleCurves),At;!(At=ot()).done;){var Rt=At.value,Ft=Yv(Y,Rt.path,t);if(Ft){var se=u.get(Ft.id);if(se){mu(Rt.keyFrames,se.scaleFactor/se.oldScaleX,se.scaleFactor/se.oldScaleY,se.scaleFactor/se.oldScaleZ);continue}var Ot=l.get(Ft.id);Ot&&mu(Rt.keyFrames,Ot.oldScaleX/Ot.scaleFactor,Ot.oldScaleY/Ot.scaleFactor,Ot.oldScaleZ/Ot.scaleFactor)}}}}}}}function Yv(i,s,n){var t=function(o){var u;r=(u=n.get(r.id))==null?void 0:u.find(function(l){return l.name===e[o]})};if(s){for(var e=s.split("/"),r=i.find(function(o){return o.name===e[0]}),a=1;a<e.length&&r;a++)t(a);return r}}function mu(i,s,n,t){if(!(!Array.isArray(i)||i[0]!==dt.VECTOR3_CURVE)){var e=i[1];!Array.isArray(e)||e.length!==3||(kn(e[0],s),kn(e[1],n),kn(e[2],t))}}function kn(i,s){if(!(!Array.isArray(i)||i[0]!==dt.BEZIER_CURVE||!Array.isArray(i[1])))for(var n=i[1],t=M(n),e;!(e=t()).done;){var r=e.value;if(!(!Array.isArray(r)||r.length<2||!Array.isArray(r[1])))for(var a=r[1],o=1;o<a.length;o+=2)a[o]*=s}}function Zv(i){var s=i.options,n=i.transform,t={type:Ae.NONE};if(i.shape){var e,r=(e=i.shape.shape)==null?void 0:e.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(t=lt({},i.shape,{type:Ae[r]}),i.shape.upDirection){var a=i.shape.upDirection,o=a[0],u=a[1],l=a[2];o===0&&u===0&&l===0&&delete t.upDirection}}s.startTurbulence&&(t.turbulenceX=Ut(s.turbulenceX),t.turbulenceY=Ut(s.turbulenceY),t.turbulenceZ=Ut(s.turbulenceZ));var h=i.emission;h.bursts&&h.bursts.length>0&&(h.bursts=h.bursts.map(function(_){return au(_)}
7)),h.burstOffsets&&h.burstOffsets.length>0&&(h.burstOffsets=h.burstOffsets.map(function(_){return au(_)})),h.rateOverTime&&(h.rateOverTime=Ut(h.rateOverTime));var c={renderer:i.renderer,shape:t,splits:i.splits,emission:h,options:{startLifetime:Ut(s.startLifetime),start3DSize:!!s.start3DSize,startSize:Ut(s.startSize),startSizeX:Ut(s.startSizeX),startSizeY:Ut(s.startSizeY),sizeAspect:Ut(s.sizeAspect),maxCount:s.maxCount,startDelay:Ut(s.startDelay),startColor:Cv(s.startColor,!0),startRotationZ:Ut(s.startRotation||s.startRotationZ),particleFollowParent:s.particleFollowParent}};s.start3DRotation&&(c.options.startRotationX=Ut(s.startRotationX),c.options.startRotationY=Ut(s.startRotationY)),n&&n.path&&(c.emitterTransform={path:En(n.path)});var f=i.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:Ut(f.x),y:Ut(f.y)}:c.sizeOverLifetime={size:Ut(f.size)});var d=i.velocityOverLifetime||{},v=d.speedOverLifetime;v?v=St(v):v=void 0,c.positionOverLifetime={gravity:s.gravity,gravityOverLifetime:St(s.gravityModifier),startSpeed:Ut(s.startSpeed),speedOverLifetime:v,asMovement:d.asMovement,linearX:Ut(d.linearX),linearY:Ut(d.linearY),linearZ:Ut(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Ut(d.orbitalX),orbitalY:Ut(d.orbitalY),orbitalZ:Ut(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:St(d.forceCurve)},Fi(c.positionOverLifetime);var p=i.rotationOverLifetime;p&&(c.rotationOverLifetime={separateAxes:p.separateAxes,asRotation:p.asRotation,z:Ut(p.separateAxes?p.z:p.angularVelocity)},p.separateAxes&&(c.rotationOverLifetime.y=St(p.y),c.rotationOverLifetime.x=St(p.x)));var g=i.colorOverLifetime;if(g){var x=c.colorOverLifetime={opacity:St(g.opacity)};g.color&&(x.color=$i(g.color))}var b=i.textureSheetAnimation;b&&(c.textureSheetAnimation={row:b.row,col:b.col,total:b.total,animate:b.animate,cycles:St(b.cycles),animationDelay:nu(b.animationDelay,0),animationDuration:nu(b.animationDuration,0)});var y=i.trails;y&&(c.trails={lifetime:Ut(y.lifetime),dieWithParticles:y.dieWithParticles,maxPointPerTrail:y.maxPointPerTrail,minimumVertexDistance:y.minimumVertexDistance,widthOverTrail:St(y.widthOverTrail),colorOverTrail:y.colorOverTrail&&$i(y.colorOverTrail,!1),blending:y.blending,colorOverLifetime:y.colorOverLifetime&&$i(y.colorOverLifetime,!1),inheritParticleColor:y.inheritParticleColor,occlusion:y.occlusion,transparentOcclusion:y.transparentOcclusion,orderOffset:y.orderOffset,sizeAffectsLifetime:y.sizeAffectsLifetime,sizeAffectsWidth:y.sizeAffectsWidth,texture:y.texture,parentAffectsPosition:y.parentAffectsPosition,opacityOverLifetime:Ut(y.opacityOverLifetime)}),c.trails&&Fi(c.trails);var E=i.interaction;return E&&(c.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),c}function gl(i,s){var n,t=i.options,e=i.velocityOverLifetime||{},r={path:En((n=i.transform)==null?void 0:n.path),gravity:t.gravity,gravityOverLifetime:St(t.gravityModifier),direction:t.direction,startSpeed:t.startSpeed,asMovement:e.asMovement,linearX:St(e.linearX),linearY:St(e.linearY),linearZ:St(e.linearZ),asRotation:e.asRotation,orbCenter:e.orbCenter,orbitalX:St(e.orbitalX),orbitalY:St(e.orbitalY),orbitalZ:St(e.orbitalZ),speedOverLifetime:St(e.speedOverLifetime)};Fi(r);var a={options:{startColor:vl(t.startColor)},positionOverLifetime:r};t.startSize&&(s.scale=[t.startSize,t.startSize/(t.sizeAspect||1),1]),t.startRotation&&(s.rotation?s.rotation[2]+=t.startRotation:s.rotation=[0,0,t.startRotation]);var o=i.rotationOverLifetime;if(o){var u=a.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=St(o.x),u.y=St(o.y),u.z=St(o.z)):u.z=St(o.angularVelocity)}var l=i.colorOverLifetime;if(l){var h=a.colorOverLifetime={opacity:St(l.opacity)};
7l.color&&(h.color=$i(l.color))}var c=i.sizeOverLifetime;return c&&(a.sizeOverLifetime={separateAxes:c.separateAxes,size:St(c.size),x:St(c.x),y:St(c.y),z:St(c.z)}),a}function qv(i,s){var n=gl(i,s),t=i.textureSheetAnimation;return t&&(n.textureSheetAnimation={row:t.row,col:t.col,total:t.total||void 0,animate:t.animate}),n.renderer=i.renderer,i.splits&&(n.splits=i.splits),i.interaction&&(n.interaction=i.interaction),n}var yl="2.9.3",Ma=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,gu=/^(\d+)\.(\d+)$/,Ia=!1;function Qv(i){if(!i||typeof i!="object")throw new Error("Invalid input: Expected a JSON object.");if(rp(i)){var s;console.warn("The JSON need higher than "+((s=i.playerVersion)==null?void 0:s.web)+" runtime version(current: "+yl+"). Some features may not work as expected.")}if(Vv(i),Ma.test(i.version)){var n;return Ia=((n=/^(\d+)/.exec(i.version))==null?void 0:n[0])==="0",pu(vu(du(fu(cu(hu(lu(uu(Kv(i)))))))))}Ia=!1;var t=gu.exec(i.version)||[],e=Number(t[1]),r=Number(t[2]);if(e)return(e<2||e===2&&r<4)&&(i=kv(i)),e<3&&(i=lu(uu(i))),t=gu.exec(i.version)||[],e=Number(t[1]),r=Number(t[2]),e<4&&(r<2&&(i=hu(i)),r<3&&(i=cu(i)),r<4&&(i=fu(i)),r<5&&(i=du(i)),r<6&&(i=vu(i)),r<7&&(i=pu(i))),i;throw new Error("Invalid JSON version: "+i.version+".")}var Dn=Oe["1_0"];function Kv(i){var s;Dn=Oe["1_0"];var n=i.plugins||[];(s=i.bins)!=null&&s.length&&(Dn=Oe["1_3"]);var t=(i.requires||[]).slice(),e=i.images.map(function(u,l){return $v(u,l,i.imageTags||[])}),r=i.textures||e.map(function(u,l){return{source:l,flipY:!0}}),a,o={plugins:n,shapes:i.shapes||[],type:"ge",version:Dn,playerVersion:(a=i.playerVersion)!=null?a:{web:"",native:""},compositionId:i.compositionId+"",compositions:i.compositions.map(function(u){return Jv(u,{plugins:n,requires:t})}),images:e,imgUsage:i._imgs,binUsage:i.binUsage,spines:i.spines,requires:i.requires,textures:r,bins:(i.bins||[]).slice()};return i._textures&&(o._textures=i._textures),o}function $v(i,s,n){var t=n[s];if(typeof i=="string")return{id:Pt(),renderLevel:t,url:i};if(i.template)return{id:Pt(),url:i.url,template:i.template,webp:i.webp,renderLevel:t};if(i.compressed)return{id:Pt(),url:i.url,compressed:{astc:i.compressed.android,pvrtc:i.compressed.iOS},webp:i.webp,renderLevel:t};if(i.url)return{id:Pt(),url:i.url,webp:i.webp,renderLevel:t};if(i&&i.sourceType)return i;throw new Error("Invalid image type.")}function Jv(i,s){s===void 0&&(s={});var n,t={id:i.id+"",camera:lt({clipMode:ph},i.camera),duration:i.duration,endBehavior:i.endBehavior,items:i.items.map(function(a){return ep(a,s)}),name:i.name},e=i.startTime||i.st;e&&(t.startTime=e);var r=(n=i.meta)==null?void 0:n.previewSize;return r&&r[0]===r[1]&&r[0]===0&&(r=void 0),r&&(t.previewSize=r),t}var tp=[0,0,0,1],yu=.5;function ep(i,s){s===void 0&&(s={});var n,t=rt.base,e,r,a,o=i.endBehavior,u,l,h=NaN,c;if(i.content?(t=i.type||rt.plugin,c=i.pn,l=i.pluginName,a=i.content,r=i.content,isNaN(c)&&!l&&(l=a.options.type),i.duration&&(h=i.duration),e=i.transform||x(r.transform)):i.particle?(t=rt.particle,r=i.particle,e=x(r.transform,Ia,!0),a=Zv(r)):i.sprite?(t=rt.sprite,r=i.sprite,e=x(r.transform,!1,!0),a=qv(r,e)):i.cal?(t=rt.null,r=i.cal,e=x(r.transform,!1,!0),a=gl(r,e)):i.ui?(t=rt.interact,r=i.ui,e=x(r.transform),a=Nv(r),e.scale=[r.options.width||1,r.options.height||1,1]):i.model&&(r=i.model,i.model.options.type===1&&(t=rt.camera,e=x(r.transform),a=Lv(r))),(n=a.renderer)!=null&&n.anchor){var f=new Float32Array(a.renderer.anchor);f[0]==yu&&f[1]==yu?delete a.renderer.anchor:s.requires&&iu(s.requires,"anchor")}if(r){var d,v=(d=r.options)==null?void 0:d.looping;if(v)Array.isArray(v)?o=v[1]?Gt.restart:Gt.destroy:o=Gt.restart;else{var p;o=o||(r==null||(p=r.options)==null?void 0:p.endBehavior)||Gt.destroy}r.options.renderLevel&&(u=r.options.renderLevel),isNaN(h)&&(h=r.options.duration)}var g={type:t,name:i.name,delay:i.delay,duration:h,id:i.id+"",transform:e,endBehavior:o,renderLevel:u,content:a};return l?s.plugins?(iu(s.plugins,l),g.pn=s.plugins.indexOf(l)):g.pluginName=l:Number.isInteger(c)&&(g.pn=c),i.parentId&&(g.parentId=i.parentId+""),g;function x(b,y,E){if(b){var _={},S=b.rotation;if(S&&(y?_.rotation=[-S[0],-S[1],-S[2]]:_.rotation=[S[0],S[1],S[2]],E)){var C=Iv(tp,_.rotation[0],_.rotation[1],_.rotation[2]);_.rotation=Rv([],C)}var I=b.position;return I&&(_.position=b.position),Array.isArray(b.scale)&&(_.scale=[b.scale[0]||1,b.scale[1]||1,b.scale[2]||1]),_}return{}}}function rp(i){var s=i.playerVersion||{},n=s.web,t=n===void 0?"":n;if(t){var e,r=(e=Ma.exec(t))!=null?e:[],a,o=(a=Ma.exec(yl))!=null?a:[],u=r[1],l=r[2],h=o[1],c=o[2];return Number(h)<Number(u)||Number(h)===Number(u)&&Number(c)<Number(l)}return!1}var pi,ip=(pi={},pi[Ne.S]=[Ne.S,Ne.BPlus,Ne.APlus],pi[Ne.A]=[Ne.A,Ne.BPlus,Ne.APlus],pi[Ne.B]=[Ne.B,Ne.BPlus],pi);
7function xl(i,s){if(!i||!s)return!0;var n=ip[s];return n?n.includes(i):!1}var ei;(function(i){function s(e){return tr(e)&&"jsonScene"in e}i.isJSONObject=s;function n(e){return tr(e)&&"url"in e}i.isURL=n;function t(e){return tr(e)&&"options"in e}i.isWithOptions=t})(ei||(ei={}));function bl(i,s){var n,t,e=(t=i==null?void 0:i.background)!=null?t:{},r=e.name,a=e.url;return r&&(s&&s[r]?n=s[r]:a&&(n=a)),n}function np(i,s,n){return Pa.apply(this,arguments)}function Pa(){return Pa=vt(function(i,s,n){var t,e;return pt(this,function(r){switch(r.label){case 0:return typeof i!="string"?[3,2]:[4,Se(i)];case 1:return t=r.sent(),[3,3];case 2:t=i,r.label=3;case 3:if(!t)throw new Error("Image not provided.");if(!s)return[2,t];if(e=bl(s,n),e){if(vr(e)&&e!==t.src)return[2,Se(e)];if(Z(e,HTMLImageElement))return[2,e]}return[2,t]}})}),Pa.apply(this,arguments)}var ap=function(s,n){n===void 0&&(n={}),this.scene=s,this.options=n},sp=1,Tl=function(){function i(n,t){n===void 0&&(n={}),t===void 0&&(t=new Ga),this.options=n,this.downloader=t,this.assets={},this.sourceFrom={},this.id=sp++,this.timers=[],this.updateOptions(n)}var s=i.prototype;return s.updateOptions=function(t){t===void 0&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=e===void 0?10:e;this.timeout=r},s.loadScene=function(t,e){var r=this;return vt(function(){var a,o,u,l,h,c,f,d,v,p,g,x,b;return pt(this,function(y){return o=vr(t)?t:r.id,u=performance.now(),l=[],h=e==null?void 0:e.engine.gpuCapability,f=(c=h==null?void 0:h.detail.ktx2Support)!=null?c:!1,d={},p=!1,g=new Promise(function(E,_){v=window.setTimeout(function(){p=!0,r.removeTimer(v);var S=performance.now()-u;_(new Error("Load time out: totalTime: "+S.toFixed(4)+"ms "+l.join(" ")+", url: "+o+"."))},r.timeout*1e3),r.timers.push(v)}),x=vt(function(E,_){var S,C,I,R;return pt(this,function(O){switch(O.label){case 0:if(p)return[3,4];S=performance.now(),O.label=1;case 1:return O.trys.push([1,3,,4]),[4,_()];case 2:return C=O.sent(),I=performance.now()-S,l.push("["+E+": "+I.toFixed(2)+"]"),d[E]=I,[2,C];case 3:throw R=O.sent(),new Error("Load error in "+E+", "+R+".");case 4:throw new Error("Load canceled.")}})}),b=vt(function(){var E,_,S,C,I,R,O,F,L,V,U,W,G,B,X;return pt(this,function(H){switch(H.label){case 0:return vr(t)?(_=new URL(t,location.href).href,r.baseUrl=_,[4,x("loadJSON",function(){return r.loadJSON(_)})]):[3,2];case 1:return a=H.sent(),vr(a)&&(a=JSON.parse(a)),[3,3];case 2:a=t,r.baseUrl=location.href,H.label=3;case 3:return ei.isJSONObject(a)?(E=lt({},a),[3,9]):[3,4];case 4:return[4,x("processJSON",function(){return r.processJSON(a)})];case 5:return R=H.sent().jsonScene,E={timeInfos:d,url:t,storage:{},jsonScene:R,bins:[],textureOptions:[],images:[],assets:r.assets},[4,x("plugin:onAssetsLoadStart",function(){return r.onPluginSceneLoadStart(E)})];case 6:return H.sent(),O=R.bins,F=O===void 0?[]:O,L=R.images,V=R.fonts,[4,Promise.all([x("processBins",function(){return r.processBins(F)}),x("processImages",function(){return r.processImages(L,f)}),x("processFontURL",function(){return r.processFontURL(V)})])];case 7:return U=H.sent(),W=U[0],G=U[1],[4,x("processTextures",function(){return r.processTextures(G,W,R)})];case 8:B=H.sent(),(S=E.bins).push.apply(S,[].concat(W)),(C=E.textureOptions).push.apply(C,[].concat(B)),(I=E.images).push.apply(I,[].concat(G)),E.renderLevel=r.options.renderLevel,H.label=9;case 9:return X=performance.now()-u,Nt.info("Load asset: totalTime: "+X.toFixed(4)+"ms "+l.join(" ")+", url: "+o+"."),window.clearTimeout(v),r.removeTimer(v),E.totalTime=X,E.startTime=u,E.timeInfos=d,[2,E]}})}),[2,Promise.race([g,b()])]})})()},s.getAssets=function(){return this.assets},s.processJSON=function(t){return vt(function(){var e,r,a,o,u,l;return pt(this,function(h){for(e=Qv(t),r=e.plugins,a=r===void 0?[]:r,o=M(a);!(u=o()).done;)if(l=u.value,!Gn[l])throw new Error("The plugin '"+l+"' not found."+fh(l));return[2,{jsonScene:e}]})})()},s.processBins=function(t){var e=this;return vt(function(){var r,a,o;return pt(this,function(u){return r=e.options.renderLevel,a=e.baseUrl,o=t.map(function(l){if(Z(l,ArrayBuffer))return l;if(xl(l.renderLevel,r))return e.loadBins(new URL(l.url,a).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")}),[2,Promise.all(o)]})})()},s.processFontURL=function(t){var e=this;return vt(function(){return pt(this,function(r){return[2,i.loadFontFamily(t,e.baseUrl)]})})()},s.processImages=function(t,e){e===void 0&&(e=!1);var r=this;return vt(function(){var a,o,u,l,h,c,f,d;return pt(this,function(v){switch(v.label){case 0:return a=r.options,o=a.useCompressedTexture,u=a.variables,l=a.disableWebP,h=a.disableAVIF,c=r.baseUrl,f=t.map(vt(function(p,g){var x,b,y,E,_,S,C,I,R,O,F,L,V,U,W,G,B,X,H,Y;return pt(this,function(K){switch(K.label){case 0:if(x=p.url,b=p.webp,y=p.avif,E=p.ktx2,_=new URL(x,c).href,S=!l&&b?new URL(b,c).href:void 0,C=!h&&y?new URL(y,c).href:void 0,I=E&&o&&e?new URL(E,c).href:void 0,R=p.id,!("template"in p))return[3,8];if(O=p.template,F=O.background,!F)return[3,7];L=bl(O,u),V=F.type===Hn.video,U=F&&V?Wa:Se,K.label=1;case 1:return K.trys.push([1,6,,7]),[4,qh(L,U)];case 2:return W=K.sent(),Z(W,HTMLVideoElement)?(r.sourceFrom[R]={url:W.src,type:st.video},[2,W]):[3,3];case 3:return F&&Array.isArray(L)&&u&&(u[F.name]=W.src),r.sourceFrom[R]={url:W.src,type:st.image},[4,np(W,O,u)];case 4:return[2,K.sent()];case 5:return[3,7];case 6:throw G=K.sent(),new Error("Failed to load. Check the template or if the URL is "+(V?"video":"image")+" type, URL: "+L+", Error: "+(G.message||G)+".");case 7:return[3,9];case 8:if("ktx2"in p&&I)return r.sourceFrom[R]={url:I,type:st.compressed},[2,r.loadBins(I)];if(Z(p,HTMLImageElement)||Z(p,HTMLCanvasElement)||Z(p,HTMLVideoElement)||Z(p,Wt))return[2,p];K.label=9;case 9:return C?[4,Zh(_,C)]:[3,11];case 10:return Y=K.sent(),[3,13];case 11:return[4,Yh(_,S)];case 12:Y=K.sent(),K.label=13;case 13:return B=Y,X=B.url,H=B.image,r.sourceFrom[R]={url:X,type:st.image},[2,H]}})})),[4,Promise.all(f)];case 1:return d=v.sent(),r.assignImagesToAssets(t,d),[2,d]}})})()},s.onPluginSceneLoadStart=function(t){var e=this;return vt(function(){return pt(this,function(r){switch(r.label){case 0:return[4,tn.onAssetsLoadStart(t,e.options)];case 1:return r.sent(),[2]}})})()},s.processTextures=function(t,e,r){var a=this;return vt(function(){var o,u,l;return pt(this,function(h){return u=(o=r.textures)!=null?o:t.map(function(c,f){return{source:f}}),l=u.map(vt(function(c,f){var d,v,p,g,x,b;return pt(this,function(y){switch(y.label){case 0:if(Z(c,Wt))return[2,c];
7if(!("mipmaps"in c))return[3,4];y.label=1;case 1:return y.trys.push([1,3,,4]),[4,Qh(c,e,a.assets,r.bins)];case 2:return[2,y.sent()];case 3:throw d=y.sent(),new Error("Load texture "+f+" fails, error message: "+d+".");case 4:return v=c.source,p=c.id,x="",tr(v)?(g=a.assets[v.id],x=v.id,[3,7]):[3,5];case 5:return typeof v!="string"?[3,7]:[4,Se(lh(v))];case 6:g=y.sent(),y.label=7;case 7:return g?[4,op(g,a.sourceFrom[x],p)]:[3,9];case 8:return b=y.sent(),[2,b.sourceType===st.compressed?b:lt({},b,c)];case 9:throw new Error("Invalid texture source: "+v+".")}})})),[2,Promise.all(l)]})})()},s.loadJSON=function(t){var e=this;return vt(function(){return pt(this,function(r){return[2,new Promise(function(a,o){e.downloader.downloadJSON(t,a,function(u,l){o("Couldn't load JSON "+JSON.stringify(t)+": status "+u+", "+l)})})]})})()},s.loadBins=function(t){var e=this;return vt(function(){return pt(this,function(r){return[2,new Promise(function(a,o){e.downloader.downloadBinary(t,a,function(u,l){o("Couldn't load bins "+JSON.stringify(t)+": status "+u+", "+l)})})]})})()},s.assignImagesToAssets=function(t,e){for(var r=0;r<t.length;r++)this.assets[t[r].id]=e[r]},s.removeTimer=function(t){var e=this.timers.indexOf(t);e!==-1&&this.timers.splice(e,1)},s.dispose=function(){this.timers.length&&this.timers.map(function(t){return window.clearTimeout(t)}),this.assets={},this.sourceFrom={},this.timers=[]},i.loadFontFamily=function(t,e){return e===void 0&&(e=location.href),vt(function(){var r;return pt(this,function(a){return t?(r=t.map(vt(function(o){var u,l,h;return pt(this,function(c){switch(c.label){case 0:if(!(o.fontURL&&!i.fontCache.has(o.fontFamily)))return[3,4];Fu(o.fontFamily)||console.warn("Risky font family: "+o.fontFamily+"."),c.label=1;case 1:return c.trys.push([1,3,,4]),u=new URL(o.fontURL,e).href,h=new FontFace((l=o.fontFamily)!=null?l:"","url("+u+")"),[4,h.load()];case 2:return c.sent(),document.fonts.add(h),i.fontCache.add(o.fontFamily),[3,4];case 3:return c.sent(),Nt.warn("Invalid font family or font source: "+JSON.stringify(o.fontURL)+"."),[3,4];case 4:return[2]}})})),[2,Promise.all(r)]):[2]})})()},i.loadPrecomposition=function(t,e){return vt(function(){var r,a;return pt(this,function(o){switch(o.label){case 0:return r=new i(e),[4,r.loadScene(t)];case 1:return a=o.sent(),[2,new ap(a,e)]}})})()},i}();Tl.fontCache=new Set;function op(i,s,n){return Ra.apply(this,arguments)}function Ra(){return Ra=vt(function(i,s,n){var t,e,r,a,o;return pt(this,function(u){switch(u.label){case 0:return t={id:n,dataType:tt.Texture},Z(i,Wt)?[2,lt({},i.source,t)]:[3,1];case 1:return Z(i,HTMLImageElement)||Lu(i)?[2,lt({image:i,sourceType:st.image,sourceFrom:s,keepImageSource:!0,minFilter:P.LINEAR,magFilter:P.LINEAR},t)]:[3,2];case 2:return Z(i,HTMLVideoElement)?[2,lt({sourceType:st.video,video:i,minFilter:P.LINEAR,magFilter:P.LINEAR},t)]:[3,3];case 3:if(!Z(i,ArrayBuffer))return[3,10];if(e=Yu.getLoader("ktx2"),!e)return[3,8];u.label=4;case 4:return u.trys.push([4,6,,7]),[4,e.loadFromBuffer(i)];case 5:return r=u.sent(),Nt.info("Loading KTX2 texture."),[2,lt({sourceType:r.sourceType,type:r.type,target:r.target,internalFormat:r.internalFormat,format:r.format,mipmaps:r.mipmaps,minFilter:P.LINEAR,magFilter:P.LINEAR,sourceFrom:s},t)];case 6:throw a=u.sent(),new Error("Failed to parse KTX2 from "+((o=s==null?void 0:s.url)!=null?o:"buffer")+": "+(a.message||a));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 i&&"height"in i&&"data"in i)return[2,lt({sourceType:st.data,data:i,wrapS:P.CLAMP_TO_EDGE,wrapT:P.CLAMP_TO_EDGE,minFilter:P.NEAREST,magFilter:P.NEAREST},t)];u.label=11;case 11:throw new Error("Invalid texture options.")}})}),Ra.apply(this,arguments)}var up=function(){function i(n){this.engine=n,this.builtinObjects=[],this.builtinObjects.push(n.whiteTexture),this.builtinObjects.push(n.transparentTexture)}var s=i.prototype;return s.assembleSceneLoadOptions=function(t,e){e===void 0&&(e={});var r=t;return ei.isURL(t)&&(ei.isJSONObject(t)||(r=t.url),ei.isWithOptions(t)&&(e=lt({},e,t.options))),{source:r,options:e}},s.updateTextVariables=function(t,e){var r=this;e===void 0&&(e={}
7),t.jsonScene.items.forEach(function(a){if(a.type===rt.text||a.type===rt.richtext){var o=e[a.name];if(o==null)return;a.components.forEach(function(u){var l=u.id,h=r.engine.findEffectsObjectData(l);((h==null?void 0:h.dataType)===tt.TextComponent||(h==null?void 0:h.dataType)===tt.RichTextComponent)&&(h.options.text=o)})}})},s.prepareAssets=function(t,e){for(var r=M(Object.keys(e)),a;!(a=r()).done;){var o=a.value,u=e[o],l=new Ev(this.engine);l.data=u,l.setInstanceId(o)}this.engine.addPackageDatas(t);for(var h=M(this.builtinObjects),c;!(c=h()).done;){var f=c.value;this.engine.addInstance(f)}},s.createShaderVariant=function(){for(var t=M(Object.keys(this.engine.objectInstance)),e;!(e=t()).done;){var r=e.value,a=this.engine.objectInstance[r];Z(a,Ce)&&a.createShaderVariant()}},s.destroyBuiltinObjects=function(){for(var t=M(this.builtinObjects),e;!(e=t()).done;){var r=e.value;r.dispose()}this.builtinObjects.length=0},s.dispose=function(){this.destroyBuiltinObjects()},i}(),lp=new D(1,1,1),hp=function(){function i(n,t){t===void 0&&(t={}),this.name=n,this.transform=new Mi,this.viewportMatrix=Tt.fromIdentity(),this.viewMatrix=Tt.fromIdentity(),this.projectionMatrix=Tt.fromIdentity(),this.viewProjectionMatrix=Tt.fromIdentity(),this.inverseViewMatrix=Tt.fromIdentity(),this.dirty=!0;var e=t.near,r=e===void 0?.1:e,a=t.far,o=a===void 0?20:a,u=t.fov,l=u===void 0?60:u,h=t.aspect,c=h===void 0?1:h,f=t.clipMode,d=f===void 0?rn.portrait:f,v=t.position,p=v===void 0?[0,0,8]:v,g=t.rotation,x=g===void 0?[0,0,0]:g,b=new Me(x[0],x[1],x[2]),y=new Zt().setFromEuler(b);this.options={near:r,far:o,fov:l,aspect:c,clipMode:d},this.transform.setPosition(p[0],p[1],p[2]),this.transform.setQuaternion(y.x,y.y,y.z,y.w),this.dirty=!0,this.updateMatrix()}var s=i.prototype;return s.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},s.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},s.getViewportMatrix=function(){return this.viewportMatrix},s.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},s.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},s.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},s.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),(t=this.inverseProjectionMatrix)==null?void 0:t.clone()},s.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},s.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},s.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},s.getInverseVPRatio=function(t){var e=new D(this.position.x,this.position.y,t),r=this.getViewProjectionMatrix(),a=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var o=this.viewportMatrix.clone();a.premultiply(o),r.multiply(o.invert())}var u=r.projectPoint(e),l=u.z,h=a.projectPoint(new D(1,1,l)),c=h.x,f=h.y,d=a.projectPoint(new D(-1,-1,l)),v=d.x,p=d.y;return new D((c-v)/2,(f-p)/2,0)},s.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},s.getQuat=function(){return this.transform.quat.clone()},s.getOptions=function(){return lt({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},s.copy=function(t){var e=t.near,r=t.far,a=t.fov,o=t.clipMode,u=t.aspect,l=t.position,h=t.rotation;this.near=e,this.far=r,this.fov=a,this.clipMode=o,this.aspect=u,this.position=l,this.rotation=h,this.updateMatrix()},s.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,r=t.aspect,a=t.near,o=t.far,u=t.clipMode;this.projectionMatrix.perspective(e*ee,r,a,o,u===rn.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),lp);var l;this.inverseViewMatrix.premultiply((l=this.transform.getParentMatrix())!=null?l:Tt.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},s.worldToScreenPoint=function(t,e){this.updateMatrix();var r=e!=null?e:new D,a=this.getViewProjectionMatrix();r.set(t.x,t.y,t.z),a.projectPoint(r,r);var o=this.engine.canvas.getBoundingClientRect(),u=o.width,l=o.height;return r.x=(r.x+1)*.5*u,r.y=(r.y+1)*.5*l,r.z=(r.z+1)*.5,r},s.screenToWorldPoint=function(t,e){this.updateMatrix();var r=e!=null?e:new D,a=this.getInverseViewProjectionMatrix(),o=this.engine.canvas.getBoundingClientRect(),u=o.width,l=o.height,h=t.x/u*2-1,c=t.y/l*2-1,f=t.z*2-1;return r.set(h,c,f),a.projectPoint(r,r),r},Mt(i,[{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){t!==void 0&&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)}}]),i}();function ie(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}var cp=function(){function i(){this.update=new fp,this.lateUpdate=new dp,this.preRender=new vp}var s=i.prototype;return s.addComponent=function(t){t.onUpdate!==ce.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==ce.prototype.onLateUpdate&&this.lateUpdate.addComponent(t),t.onPreRender!==ce.prototype.onPreRender&&this.preRender.addComponent(t)},s.removeComponent=function(t){t.onUpdate!==ce.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==ce.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t),t.onPreRender!==ce.prototype.onPreRender&&this.preRender.removeComponent(t)},s.clear=function(){this.update.clear(),this.lateUpdate.clear()},i}(),qa=function(){function i(){this.components=[],this.ticks=[]}var s=i.prototype;return s.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},s.tickComponents=function(t,e){},s.addComponent=function(t){this.components.includes(t)||this.components.push(t)},s.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},s.addTick=function(t,e){var r=t.bind(e);this.ticks.includes(r)||this.ticks.push(r)},s.clear=function(){this.components=[]},i}(),fp=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.tickComponents=function(e,r){for(var a=M(e),o;!(o=a()).done;){var u=o.value;u.onUpdate(r)}},s}(qa),dp=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.tickComponents=function(e,r){for(var a=M(e),o;!(o=a()).done;){var u=o.value;u.onLateUpdate(r)}},s}(qa),vp=function(i){k(s,i);function s(){return i.apply(this,arguments)}var n=s.prototype;return n.tickComponents=function(e,r){for(var a=M(e),o;!(o=a()).done;){var u=o.value;u.onPreRender()}},s}(qa),pp=function(i){k(s,i);function s(t,e,r){var a;a=i.call(this)||this,a.engine=t,a.sceneTicking=new cp,a.speed=1,a.isEnded=!1,a.loaderData={},a.startTime=0,a.videos=[],a.postProcessingEnabled=!1,a.destroyed=!1,a.paused=!0,a.isEndCalled=!1,a._textures=[];var o=e!=null?e:{},u=o.reusable,l=u===void 0?!1:u,h=o.speed,c=h===void 0?1:h,f=o.baseRenderOrder,d=f===void 0?0:f,v=o.event,p=o.onItemMessage;a.engine.addComposition(ie(a));var g=null;if(r){var x;a.createTexturesFromData(r.textureOptions);for(var b=M(Object.keys(r.assets)),y;!(y=b()).done;){var E=y.value,_=r.assets[E];Z(_,HTMLVideoElement)&&a.videos.push(_)}var S;a.postProcessingEnabled=(S=(x=r.jsonScene.renderSettings)==null?void 0:x.postProcessingEnabled)!=null?S:!1,a.engine.renderLevel=r.renderLevel,l&&(r.consumed=!0),g=r.jsonScene.compositions[0];for(var C=M(r.jsonScene.compositions),I;!(I=C()).done;){var R=I.value;R.id===r.jsonScene.compositionId&&(g=R)}ne(g)}a.rootItem=new Ie(a.engine),g&&(a.rootItem.setInstanceId(g.id),a.rootItem.instantiatePreComposition(g,!1)),a.rootItem.name="rootItem",a.rootItem.composition=ie(a);var O;a.rootComposition=(O=a.rootItem.getComponent(sr))!=null?O:a.rootItem.addComponent(sr),a.rootComposition.updateMode=ha.Manual,a.rootComposition.play(),a.rootItem.on("animationevent",function(B){a.emit
7("animationevent",B)}),a.renderOrder=d;var F;a.id=(F=g==null?void 0:g.id)!=null?F:Pt();var L;a.startTime=(L=g==null?void 0:g.startTime)!=null?L:0,a.event=v;var V,U;a.statistic={loadStart:(V=r==null?void 0:r.startTime)!=null?V:0,loadTime:(U=r==null?void 0:r.totalTime)!=null?U:0,compileTime:0,firstFrameTime:0},a.reusable=l,a.speed=c;var W;a.name=(W=g==null?void 0:g.name)!=null?W:"New Composition",a.camera=new hp(a.name,lt({},g==null?void 0:g.camera,{aspect:a.width/a.height})),a.camera.engine=a.engine;var G;return a.url=(G=r==null?void 0:r.url)!=null?G:"",a.interactive=!0,p&&(a.onItemMessage=p),a.createRenderFrame(),tn.initializeComposition(ie(a),r),a}var n=s.prototype;return n.getDuration=function(){return this.rootItem.duration},n.restart=function(){this.reset(),this.forwardTime(this.startTime)},n.setIndex=function(e){this.renderOrder=e},n.getIndex=function(){return this.renderOrder},n.setSpeed=function(e){this.speed=e},n.setVisible=function(e){this.rootItem.setVisible(e)},n.getSpeed=function(){return this.speed},n.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?(this.setTime(this.time-this.startTime),this.resume()):(this.setTime(0),this.resume())},n.pause=function(){this.paused=!0,this.emit("pause")},n.getPaused=function(){return this.paused},n.resume=function(){this.paused=!1,this.isEnded&&this.reusable&&this.restart();var e=this.time;this.emit("play",{time:e})},n.gotoAndPlay=function(e){this.setTime(e),this.emit("goto",{time:e}),this.resume()},n.gotoAndStop=function(e){this.setTime(e),this.emit("goto",{time:e}),this.pause()},n.createRenderFrame=function(){this.renderFrame=new Tf({camera:this.camera,renderer:this.renderer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled})},n.setTime=function(e){var r=this.speed,a=this.getPaused();a&&this.resume(),this.setSpeed(1),this.forwardTime(e+this.startTime),this.setSpeed(r),a&&(this.paused=!0)},n.addItem=function(e){e.setParent(this.rootItem)},n.getComponent=function(e){return this.rootItem.getComponent(e)},n.forwardTime=function(e){var r=e*1e3-this.time*1e3;this.update(r)},n.reset=function(){this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.setTime(0)},n.prepareRender=function(){},n.update=function(e){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.rootItem.awake(),this.rootItem.beginPlay());var r=this.time;this.updateCompositionTime(e*this.speed/1e3);var a=(this.time-r)*1e3;this.rootComposition.setChildrenRenderOrder(0),this.sceneTicking.update.tick(a),this.sceneTicking.lateUpdate.tick(a),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},n.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===Gt.destroy&&!this.reusable},n.updateCamera=function(){this.camera.updateMatrix()},n.updateCompositionTime=function(e){if(!(this.rootComposition.state!==je.Playing||!this.rootComposition.isActiveAndEnabled)){var r=this.time+e-this.startTime;e<0&&r<0&&(r=0);var a=this.rootItem.duration,o=this.rootItem.endBehavior,u=!1;if(r>=a)switch(u=!0,o){case Gt.restart:{r=r%a,this.restart();break}case Gt.freeze:{r=Math.min(a,r);break}case Gt.forward:break;case Gt.destroy:break}this.rootComposition.tick(r+this.startTime-this.rootComposition.getTime()),this.isEnded!==u&&(u?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},n.createTexturesFromData=function(e){for(var r=M(e),a;!(a=r()).done;){var o=a.value,u=this.engine.findObject({id:o.id});u.initialize(),this._textures.push(u)}},n.getItemByName=function(e){return this.rootItem.find(e)},n.getHitTestRay=function(e,r){var a=this.renderFrame.editorTransform,o=a.x,u=a.y,l=a.z,h=a.w;return cc((e-l)/o,(r-h)/u,this.camera)},n.getEngine=function(){var e;return(e=this.renderer)==null?void 0:e.engine},n.hitTest=function(e,r,a,o){if(this.isDestroyed||!this.interactive)return[];var u=[],l=this.getHitTestRay(e,r),h=[];return this.rootItem.hitTest(l,e,r,u,h,a,o),u},n.addInteractiveItem=function(e,r){if(r===Ye.MESSAGE)return this.onItemMessage==null||this.onItemMessage.call(this,{name:e.name,phrase:ns,id:e.id,compositionId:this.id}),e.emit("message",{name:e.name,phrase:ns,id:e.id}
7),e.id},n.removeInteractiveItem=function(e,r){r===Ye.MESSAGE&&(this.onItemMessage==null||this.onItemMessage.call(this,{name:e.name,phrase:as,id:e.id,compositionId:this.id}),e.emit("message",{name:e.name,phrase:as,id:e.id}))},n.destroyItem=function(e){},n.lost=function(e){this.videoState=this.textures.map(function(r){if("video"in r.source)return r.source.video.pause(),r.source.video.currentTime}),this.textures.map(function(r){return r.dispose()}),this.dispose()},n.dispose=function(){var e=this;if(!this.destroyed){this.destroyed=!0;for(var r=M(this.textures),a;!(a=r()).done;){var o=a.value;o.dispose()}this._textures=[];for(var u=M(this.videos),l;!(l=u()).done;){var h=l.value;h.pause(),h.removeAttribute("src"),h.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),tn.destroyComposition(this),this.update=function(){Nt.error("Update disposed composition: "+e.name+".")},this.dispose=uh,this.renderer.engine.removeComposition(this),this.engine.env!==Ur&&this.renderer.clear({stencilAction:$t.clear,clearStencil:0,depthAction:$t.clear,clearDepth:1,colorAction:$t.clear,clearColor:[0,0,0,0]})}},n.setEditorTransform=function(e,r,a){this.renderFrame.editorTransform.set(e,e,r,a)},n.translateByPixel=function(e,r){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.translateByPixel(e,r)},n.setPositionByPixel=function(e,r){if(!this.renderer){console.warn("Renderer not assigned. Operation aborted.");return}this.rootItem.setPositionByPixel(e,r)},n.translate=function(e,r,a){this.rootItem.translate(e,r,a)},n.setPosition=function(e,r,a){this.rootItem.setPosition(e,r,a)},n.rotate=function(e,r,a){this.rootItem.rotate(e,r,a)},n.setRotation=function(e,r,a){this.rootItem.setRotation(e,r,a)},n.scale=function(e,r,a){this.rootItem.scale(e,r,a)},n.setScale=function(e,r,a){this.rootItem.setScale(e,r,a)},n.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach(function(e){return e&&e.offloadData()}),this.textureOffloaded=!0)},n.reloadTexture=function(){var e=this;return vt(function(){return pt(this,function(r){switch(r.label){case 0:return e.textureOffloaded?[4,Promise.all(e.textures.map(function(a){return a==null?void 0:a.reloadData()}))]:[3,2];case 1:r.sent(),e.textureOffloaded=!1,r.label=2;case 2:return[2]}})})()},Mt(s,[{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(e){this.camera.setViewportMatrix(e)}}]),s}(Tn),zn=2,ir=4,cr=4,Wr=4,Er=new Int32Array(2),xu=new Float32Array(Er.buffer),bu=new Float64Array(Er.buffer),Zi=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1,Fa;(function(i){i[i.UTF8_BYTES=1]="UTF8_BYTES",i[i.UTF16_STRING=2]="UTF16_STRING"})(Fa||(Fa={}));var mn=function(){function i(n){this.bytes_=n,this.position_=0,this.text_decoder_=new TextDecoder}var s=i.prototype;return s.clear=function(){this.position_=0},s.bytes=function(){return this.bytes_},s.position=function(){return this.position_},s.setPosition=function(t){this.position_=t},s.capacity=function(){return this.bytes_.length},s.readInt8=function(t){return this.readUint8(t)<<24>>24},s.readUint8=function(t){return this.bytes_[t]},s.readInt16=function(t){return this.readUint16(t)<<16>>16},s.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},s.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},s.readUint32=function(t){return this.readInt32(t)>>>0},s.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},s.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},s.readFloat32=function(t){return Er[0]=this.readInt32(t),xu[0]},s.readFloat64=function(t){return Er[Zi?0:1]=this.readInt32(t),Er[Zi?1:0]=this.readInt32(t+4),bu[0]},s.writeInt8=function(t,e){this.bytes_[t]=e},s.writeUint8=function(t,e){this.bytes_[t]=e},s.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},s.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},s.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},s.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},s.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},s.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},s.writeFloat32=function(t,e){xu[0]=e,this.writeInt32(t,Er[0])},s.writeFloat64=function(t,e){bu[0]=e,this.writeInt32(t,Er[Zi?0:1]),this.writeInt32(t+4,Er[Zi?1:0])},s.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+ir+cr)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<cr;e++)t+=String.fromCharCode(this.readInt8(this.position_+ir+e));return t},s.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},s.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}
7,s.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t);t+=ir;var a=this.bytes_.subarray(t,t+r);return e===Fa.UTF8_BYTES?a:this.text_decoder_.decode(a)},s.__union_with_string=function(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)},s.__indirect=function(t){return t+this.readInt32(t)},s.__vector=function(t){return t+this.readInt32(t)+ir},s.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},s.__has_identifier=function(t){if(t.length!=cr)throw new Error("FlatBuffers: file identifier must be length "+cr);for(var e=0;e<cr;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+ir+e))return!1;return!0},s.createScalarList=function(t,e){for(var r=[],a=0;a<e;++a){var o=t(a);o!==null&&r.push(o)}return r},s.createObjList=function(t,e){for(var r=[],a=0;a<e;++a){var o=t(a);o!==null&&r.push(o.unpack())}return r},i.allocate=function(t){return new i(new Uint8Array(t))},i}(),Tu=function(){function i(n){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;var t;n?t=n:t=1024,this.bb=mn.allocate(t),this.space=t}var s=i.prototype;return s.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},s.forceDefaults=function(n){this.force_defaults=n},s.dataBuffer=function(){return this.bb},s.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},s.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var r=~(this.bb.capacity()-this.space+e)+1&t-1;this.space<r+t+e;){var a=this.bb.capacity();this.bb=i.growByteBuffer(this.bb),this.space+=this.bb.capacity()-a}this.pad(r)},s.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},s.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},s.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},s.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},s.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},s.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},s.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},s.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},s.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},s.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},s.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},s.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},s.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},s.addFieldInt8=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},s.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},s.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},s.addFieldInt64=function(t,e,r){(this.force_defaults||e!==r)&&(this.addInt64(e),this.slot(t))},s.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},s.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},s.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},s.addFieldStruct=function(t,e,r){e!=r&&(this.nested(e),this.slot(t))},s.nested=function(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")},s.notNested=function(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")},s.slot=function(t){this.vtable!==null&&(this.vtable[t]=this.offset())},s.offset=function(){return this.bb.capacity()-this.space},s.addOffset=function(t){this.prep(ir,0),this.writeInt32(this.offset()-t+ir)},s.startObject=function(t){this.notNested(),this.vtable==null&&(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()},s.endObject=function(){if(this.vtable==null||!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&&this.vtable[e]==0;e--);for(var r=e+1;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);var a=2;this.addInt16(t-this.object_start);var o=(r+a)*zn;this.addInt16(o);var u=0,l=this.space;t:for(e=0;e<this.vtables.length;e++){var h=this.bb.capacity()-this.vtables[e];if(o==this.bb.readInt16(h)){for(var c=zn;c<o;c+=zn)if(this.bb.readInt16(l+c)!=this.bb.readInt16(h+c))continue t;u=this.vtables[e];break}}return u?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,u-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},s.finish=function(t,e,r){var a=r?Wr:0;if(e){var o=e;if(this.prep(this.minalign,ir+cr+a),o.length!=cr)throw new TypeError("FlatBuffers: file identifier must be length "+cr);for(var u=cr-1;u>=0;
7u--)this.writeInt8(o.charCodeAt(u))}this.prep(this.minalign,ir+a),this.addOffset(t),a&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},s.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},s.requiredField=function(t,e){var r=this.bb.capacity()-t,a=r-this.bb.readInt32(r),o=e<this.bb.readInt16(a)&&this.bb.readInt16(a+e)!=0;if(!o)throw new TypeError("FlatBuffers: field "+e+" must be set")},s.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(ir,t*e),this.prep(r,t*e)},s.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},s.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},s.createString=function(t){if(t==null)return 0;var e;return Z(t,Uint8Array)?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()},s.createByteVector=function(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},s.createObjectOffset=function(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)},s.createObjectOffsetList=function(t){for(var e=[],r=0;r<t.length;++r){var a=t[r];if(a!==null)e.push(this.createObjectOffset(a));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e},s.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},i.growByteBuffer=function(t){var e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var r=e<<1,a=mn.allocate(r);return a.setPosition(r-e),a.bytes().set(t.bytes(),r-e),a},i}(),Oa=function(){function i(){this.bb=null,this.bb_pos=0}var s=i.prototype;return s.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},s.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},s.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},s.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},s.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},s.unpack=function(){return new _l(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},s.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},i.getRootAsFBEffectsObjectData=function(t,e){return(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.getSizePrefixedRootAsFBEffectsObjectData=function(t,e){return t.setPosition(t.position()+Wr),(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.startFBEffectsObjectData=function(t){t.startObject(2)},i.addDataType=function(t,e){t.addFieldOffset(0,e,0)},i.addData=function(t,e){t.addFieldOffset(1,e,0)},i.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()},i.startDataVector=function(t,e){t.startVector(1,e,1)},i.endFBEffectsObjectData=function(t){var e=t.endObject();return e},i.createFBEffectsObjectData=function(t,e,r){return i.startFBEffectsObjectData(t),i.addDataType(t,e),i.addData(t,r),i.endFBEffectsObjectData(t)},i}(),_l=function(){function i(n,t){n===void 0&&(n=null),t===void 0&&(t=[]),this.dataType=n,this.data=t}var s=i.prototype;return s.pack=function(t){var e=this.dataType!==null?t.createString(this.dataType):0,r=Oa.createDataVector(t,this.data);return Oa.createFBEffectsObjectData(t,e,r)},i}(),Ei=function(){function i(){this.bb=null,this.bb_pos=0}var s=i.prototype;return s.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},s.exportObjects=function(t,e){var r=this.bb.__offset(this.bb_pos,4);return r?(e||new Oa).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null},s.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},s.unpack=function(){return new El(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},s.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},i.getRootAsFBEffectsPackageData=function(t,e){return(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.getSizePrefixedRootAsFBEffectsPackageData=function(t,e){return t.setPosition(t.position()+Wr),(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.startFBEffectsPackageData=function(t){t.startObject(1)},i.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},i.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()},i.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},i.endFBEffectsPackageData=function(t){var e=t.endObject();return e},i.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},i.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},i.createFBEffectsPackageData=function(t,e){return i.startFBEffectsPackageData(t),i.addExportObjects(t,e),i.endFBEffectsPackageData(t)},i}(),El=function(){function i(n){n===void 0&&(n=[]),this.exportObjects=n}var s=i.prototype;return s.pack=function(t){var e=Ei.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Ei.createFBEffectsPackageData(t,e)},i}(),wl=function(){function i(){this.bb=null,this.bb_pos=0}var s=i.prototype;return s.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},s.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},s.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},s.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},s.unpack=function(){return new Sl(this.offset(),this.indexCount(),this.vertexCount())},s.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},i.getRootAsFBSubMesh=function(t,e){return(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.getSizePrefixedRootAsFBSubMesh=function(t,e){return t.setPosition(t.position()+Wr),(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.startFBSubMesh=function(t){t.startObject(3)},i.addOffset=function(t,e){t.addFieldInt32(0,e,0)},i.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},i.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},i.endFBSubMesh=function(t){var e=t.endObject();return e},i.createFBSubMesh=function(t,e,r,a){return i.startFBSubMesh(t),i.addOffset(t,e),i.addIndexCount(t,r),i.addVertexCount(t,a),i.endFBSubMesh(t)},i}(),Sl=function(){function i(n,t,e){n===void 0&&(n=0),t===void 0&&(t=0),e===void 0&&(e=0),this.offset=n,this.indexCount=t,this.vertexCount=e}var s=i.prototype;return s.pack=function(t){return wl.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},i}(),Cl=function(){function i(){this.bb=null,this.bb_pos=0}var s=i.prototype;return s.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},s.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},s.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},s.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},s.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},s.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return t?!!this.bb.readInt8(this.bb_pos+t):!1},s.unpack=function(){return new Al(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},s.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},i.getRootAsFBVertexChannel=function(t,e){return(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.getSizePrefixedRootAsFBVertexChannel=function(t,e){return t.setPosition(t.position()+Wr),(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.startFBVertexChannel=function(t){t.startObject(5)},i.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},i.addOffset=function(t,e){t.addFieldInt32(1,e,0)},i.addFormat=function(t,e){t.addFieldInt32(2,e,0)},i.addDimension=function(t,e){t.addFieldInt32(3,e,0)},i.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},i.endFBVertexChannel=function(t){var e=t.endObject();return e},i.createFBVertexChannel=function(t,e,r,a,o,u){return i.startFBVertexChannel
7(t),i.addSemantic(t,e),i.addOffset(t,r),i.addFormat(t,a),i.addDimension(t,o),i.addNormalize(t,u),i.endFBVertexChannel(t)},i}(),Al=function(){function i(n,t,e,r,a){n===void 0&&(n=null),t===void 0&&(t=0),e===void 0&&(e=0),r===void 0&&(r=0),a===void 0&&(a=!1),this.semantic=n,this.offset=t,this.format=e,this.dimension=r,this.normalize=a}var s=i.prototype;return s.pack=function(t){var e=this.semantic!==null?t.createString(this.semantic):0;return Cl.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},i}(),La=function(){function i(){this.bb=null,this.bb_pos=0}var s=i.prototype;return s.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},s.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},s.channels=function(t,e){var r=this.bb.__offset(this.bb_pos,6);return r?(e||new Cl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null},s.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},s.unpack=function(){return new Ml(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},s.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},i.getRootAsFBVertexData=function(t,e){return(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.getSizePrefixedRootAsFBVertexData=function(t,e){return t.setPosition(t.position()+Wr),(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.startFBVertexData=function(t){t.startObject(2)},i.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},i.addChannels=function(t,e){t.addFieldOffset(1,e,0)},i.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()},i.startChannelsVector=function(t,e){t.startVector(4,e,4)},i.endFBVertexData=function(t){var e=t.endObject();return e},i.createFBVertexData=function(t,e,r){return i.startFBVertexData(t),i.addVertexCount(t,e),i.addChannels(t,r),i.endFBVertexData(t)},i}(),Ml=function(){function i(n,t){n===void 0&&(n=0),t===void 0&&(t=[]),this.vertexCount=n,this.channels=t}var s=i.prototype;return s.pack=function(t){var e=La.createChannelsVector(t,t.createObjectOffsetList(this.channels));return La.createFBVertexData(t,this.vertexCount,e)},i}(),le=function(){function i(){this.bb=null,this.bb_pos=0}var s=i.prototype;return s.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},s.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},s.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},s.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new La).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},s.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},s.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},s.subMeshes=function(t,e){var r=this.bb.__offset(this.bb_pos,14);return r?(e||new wl).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null},s.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},s.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},s.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},s.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},s.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},s.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},s.boneNames=function(t,e){var r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+t*4,e):null},s.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},s.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},s.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+t*4):0},s.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},s.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},s.unpack=function(){return new Il(this.id(),this.name(),this.vertexData()!==null?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()))},s.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=this.vertexData()!==null?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())},i.getRootAsFBGeometryData=function(t,e){return(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.getSizePrefixedRootAsFBGeometryData=function(t,e){return t.setPosition(t.position()+Wr),(e||new i).__init(t.readInt32(t.position())+t.position(),t)},i.startFBGeometryData=function(t){t.startObject(12)},i.addId=function(t,e){t.addFieldOffset(0,e,0)},i.addName=function(t,e){t.addFieldOffset(1,e,0)},i.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},i.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},i.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},i.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},i.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()},i.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},i.addMode=function(t,e){t.addFieldInt32(6,e,0)},i.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},i.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},i.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()},i.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},i.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},i.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()},i.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},i.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},i.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},i.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var r=e.length-1;r>=0;r--)t.addFloat32(e[r]);return t.endVector()},i.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},i.endFBGeometryData=function(t){var e=t.endObject();return e},i}(),Il=function(){function i(n,t,e,r,a,o,u,l,h,c,f,d){n===void 0&&(n=null),t===void 0&&(t=null),e===void 0&&(e=null),r===void 0&&(r=0),a===void 0&&(a=0),o===void 0&&(o=[]),u===void 0&&(u=0),l===void 0&&(l=null),h===void 0&&(h=[]),c===void 0&&(c=[]),f===void 0&&(f=null),d===void 0&&(d=[]),this.id=n,this.name=t,this.vertexData=e,this.indexFormat=r,this.indexOffset=a,this.subMeshes=o,this.mode=u,this.buffer=l,this.binaryData=h,this.boneNames=c,this.rootBoneName=f,this.inverseBindMatrices=d}var s=i.prototype;return s.pack=function(t){var e=this.id!==null?t.createString(this.id
7):0,r=this.name!==null?t.createString(this.name):0,a=this.vertexData!==null?this.vertexData.pack(t):0,o=le.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),u=this.buffer!==null?t.createString(this.buffer):0,l=le.createBinaryDataVector(t,this.binaryData),h=le.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),c=this.rootBoneName!==null?t.createString(this.rootBoneName):0,f=le.createInverseBindMatricesVector(t,this.inverseBindMatrices);return le.startFBGeometryData(t),le.addId(t,e),le.addName(t,r),le.addVertexData(t,a),le.addIndexFormat(t,this.indexFormat),le.addIndexOffset(t,this.indexOffset),le.addSubMeshes(t,o),le.addMode(t,this.mode),le.addBuffer(t,u),le.addBinaryData(t,l),le.addBoneNames(t,h),le.addRootBoneName(t,c),le.addInverseBindMatrices(t,f),le.endFBGeometryData(t)},i}(),mp=function(){function i(){this.exportObjectDatas=[]}var s=i.prototype;return s.addData=function(t){this.exportObjectDatas.push(t)},s.serializeToBinary=function(){for(var t=new Tu(1),e=new El,r=[],a=M(this.exportObjectDatas),o;!(o=a()).done;){var u=o.value,l=void 0;u.dataType===tt.Geometry&&(l=new _l("Geometry",this.geometryDataToBinary(u))),l&&r.push(l)}return e.exportObjects=r,Ei.finishFBEffectsPackageDataBuffer(t,e.pack(t)),t.asUint8Array()},s.deserializeFromBinary=function(t){for(var e=new mn(t),r=Ei.getRootAsFBEffectsPackageData(e),a=0;a<r.exportObjectsLength();a++){var o=r.exportObjects(a);if(o){var u=o.dataArray(),l=o.dataType();if(u){var h=void 0;l===tt.Geometry&&(h=this.binaryToGeometryData(u)),h&&this.exportObjectDatas.push(h)}}}},s.geometryDataToBinary=function(t){var e=new Tu(1),r=new Il,a=t.indexFormat,o=t.indexOffset,u=t.mode,l=t.id,h=t.vertexData,c=t.boneNames,f=c===void 0?[]:c,d=t.rootBoneName,v=d===void 0?"":d,p=t.inverseBindMatrices,g=p===void 0?[]:p,x=t.binaryData,b=x===void 0?[]:x;r.indexFormat=a,r.indexOffset=o,r.mode=u,r.id=l,r.boneNames=f,r.rootBoneName=v,r.inverseBindMatrices=g,r.binaryData=b;var y=new Ml;y.vertexCount=h.vertexCount,y.channels=[];for(var E=M(h.channels),_;!(_=E()).done;){var S=_.value,C=S.semantic,I=S.offset,R=S.format,O=S.dimension,F=S.normalize,L=new Al(C,I,R,O,F);y.channels.push(L)}r.vertexData=y;for(var V=[],U=M(t.subMeshes),W;!(W=U()).done;){var G=W.value,B=G.offset,X=G.indexCount,H=G.vertexCount,Y=new Sl(B,X,H);V.push(Y)}return r.subMeshes=V,Ei.finishFBEffectsPackageDataBuffer(e,r.pack(e)),e.asUint8Array()},s.binaryToGeometryData=function(t){var e=new mn(t),r=le.getRootAsFBGeometryData(e),a={vertexCount:0,channels:[]},o=r.vertexData();if(o){a.vertexCount=o.vertexCount();for(var u=0;u<o.channelsLength();u++){var l=o.channels(u);if(l){var h,c={semantic:(h=l.semantic())!=null?h:"",offset:l.offset(),format:l.format(),dimension:l.dimension(),normalize:l.normalize()};a.channels.push(c)}}}for(var f=[],d=0;d<r.subMeshesLength();d++){var v=r.subMeshes(d);if(v){var p={offset:v.offset(),vertexCount:v.vertexCount(),indexCount:v.indexCount()};f.push(p)}}for(var g=[],x=0;x<r.boneNamesLength();x++){var b=r.boneNames(x);g.push(b)}var y=r.inverseBindMatricesArray(),E,_,S,C,I={vertexData:a,indexFormat:r.indexFormat(),indexOffset:r.indexOffset(),subMeshes:f,mode:r.mode(),buffer:(E=r.buffer())!=null?E:"",boneNames:g,rootBoneName:(_=r.rootBoneName())!=null?_:"",inverseBindMatrices:y?Array.from(y):void 0,binaryData:(S=r.binaryDataArray())!=null?S:void 0,id:(C=r.id())!=null?C:"",dataType:tt.Geometry};return I},i}(),gp=60,yp=function(){function i(n){n===void 0&&(n=gp),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(n),this.tickers=[]}var s=i.prototype;return s.getFPS=function(){return this.targetFPS},s.setFPS=function(t){this.targetFPS=he(t,1,120),this.interval=Math.floor(1e3/t)-2},s.getPaused=function(){return this.paused},s.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(a){return window.setTimeout(a,16.7)},r=function(){t.intervalId=e(r),t.paused||t.tick()};r()}},s.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},s.pause=function(){this.paused=!0,this.dt=0},s.resume=function(){this.paused=!1,this.dt=0},s.tick=function(){if(!this.paused){var t=performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter(function(o){return o}
7),this.resetTickers=!1);for(var e=M(this.tickers),r;!(r=e()).done;){var a=r.value;a(this.dt)}}}},s.add=function(t){if(typeof t!="function")throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},Mt(i,[{key:"deltaTime",get:function(){return this.dt}}]),i}(),Qa=function(i){k(s,i);function s(t,e){var r;r=i.call(this)||this,r.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:$t.clear,clearStencil:0,depthAction:$t.clear,clearDepth:1,colorAction:$t.clear,clearColor:[0,0,0,0]},r.canvas=t;var a;r.env=(a=e==null?void 0:e.env)!=null?a:"";var o;r.name=(o=e==null?void 0:e.name)!=null?o:r.name;var u;r.pixelRatio=(u=e==null?void 0:e.pixelRatio)!=null?u:Au(),r.jsonSceneData={},r.objectInstance={},r.whiteTexture=$h(ie(r)),r.transparentTexture=Jh(ie(r)),e!=null&&e.manualRender||(r.ticker=new yp(e==null?void 0:e.fps),r.runRenderLoop(r.mainLoop.bind(ie(r))));var l;r.eventSystem=new Of(ie(r),(l=e==null?void 0:e.notifyTouch)!=null?l:!1);var h;return r.eventSystem.enabled=(h=e==null?void 0:e.interactive)!=null?h:!1,r.eventSystem.bindListeners(r.canvas),r.assetLoader=new Sv(ie(r)),r.assetService=new up(ie(r)),r.renderTargetPool=new Ef(ie(r)),r.renderingData={currentFrame:{}},r}var n=s.prototype;return n.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},n.addEffectsObjectData=function(e){this.jsonSceneData[e.id]=e},n.findEffectsObjectData=function(e){return this.jsonSceneData[e]},n.addInstance=function(e){this.objectInstance[e.getInstanceId()]=e},n.findObject=function(e){if(!Ou(e))return e;if(this.objectInstance[e.id])return this.objectInstance[e.id];var r=this.assetLoader.loadGUID(e);return r},n.removeInstance=function(e){delete this.objectInstance[e]},n.addPackageDatas=function(e){for(var r=e.jsonScene,a=e.textureOptions,o=a===void 0?[]:a,u=r.items,l=u===void 0?[]:u,h=r.materials,c=h===void 0?[]:h,f=r.shaders,d=f===void 0?[]:f,v=r.geometries,p=v===void 0?[]:v,g=r.components,x=g===void 0?[]:g,b=r.animations,y=b===void 0?[]:b,E=r.bins,_=E===void 0?[]:E,S=r.miscs,C=S===void 0?[]:S,I=r.compositions,R=M(I),O;!(O=R()).done;){var F=O.value;this.addEffectsObjectData(F)}for(var L=M(l),V;!(V=L()).done;){var U=V.value;xl(U.renderLevel,e.renderLevel)||(U.components=[],U.type=rt.null),this.addEffectsObjectData(U)}for(var W=M(c),G;!(G=W()).done;){var B=G.value;this.addEffectsObjectData(B)}for(var X=M(d),H;!(H=X()).done;){var Y=H.value;this.addEffectsObjectData(Y)}for(var K=M(p),z;!(z=K()).done;){var Q=z.value;this.addEffectsObjectData(Q)}for(var it=M(x),ct;!(ct=it()).done;){var nt=ct.value;this.addEffectsObjectData(nt)}for(var yt=M(y),_t;!(_t=yt()).done;){var Vt=_t.value;this.addEffectsObjectData(Vt)}for(var mt=M(C),at;!(at=mt()).done;){var kt=at.value;this.addEffectsObjectData(kt)}for(var wt=0;wt<_.length;wt++){var ut=_[wt],qt=e.bins[wt];if(ut.dataType===tt.BinaryAsset)ut.buffer=qt,ut.id&&this.addEffectsObjectData(ut);else{var It=new mp;It.deserializeFromBinary(new Uint8Array(qt));for(var ot=M(It.exportObjectDatas),At;!(At=ot()).done;){var Rt=At.value;this.addEffectsObjectData(Rt)}}}for(var Ft=M(o),se;!(se=Ft()).done;){var Ot=se.value;this.addEffectsObjectData(Ot)}},n.runRenderLoop=function(e){var r;(r=this.ticker)==null||r.add(e)},n.mainLoop=function(e){var r=this.renderErrors;if(r.size>0){var a;this.emit("rendererror",r.values().next().value),(a=this.ticker)==null||a.pause();return}e=Math.min(e,33)*this.speed;var o=this.compositions;o.sort(function(y,E){return y.getIndex()-E.getIndex()});for(var u=!1,l=M(o),h;!(h=l()).done;){var c=h.value;if(c.textureOffloaded){u=!0,Nt.error("Composition "+c.name+" texture offloaded, skip render.");continue}c.update(e)}if(u){var f;this.emit("rendererror",new Error("Play when texture offloaded.")),(f=this.ticker)==null||f.pause();return}for(var d=M(o),v;!(v=d()).done;){var p=v.value;p.sceneTicking.preRender.tick(0)}this.renderer.setFramebuffer(null),this.renderer.clear(this.clearAction);for(var g=M(o),x;!(x=g()).done;){var b=x.value;this.renderer.renderRenderFrame(b.renderFrame)}this.renderTargetPool.flush()},n.resize=function(){var e=this.canvas.parentElement,r,a,o,u;if(e){var l=this.getTargetSize(e);r=l[0],a=l[1],o=l[2],u=l[3]}else r=o=this.canvas.width,a=u=this.canvas.height;var h=r/a;if(r&&a){var c=document.documentElement.clientWidth;o>c*2&&Nt.error("DPI overflowed, width "+o+" is more than 2x document width "+c+", see "+Qr["DPI overflowed"]+".");var f=this.env?this.gpuCapability.detail.maxTextureSize:2048;(o>f||u>f)&&(Nt.error("Container size overflowed "+o+"x"+u+", see "+Qr["Container size overflowed"]+"."),h>
71?(o=Math.round(f),u=Math.round(f/h)):(u=Math.round(f),o=Math.round(f*h))),this.canvas.style.width=r+"px",this.canvas.style.height=a+"px",Nt.info("Resize engine "+this.name+" ["+o+","+u+","+r+","+a+"]."),this.setSize(o,u)}},n.setSize=function(e,r){var a;(this.getWidth()!==e||this.getHeight()!==r)&&(this.canvas.width=e,this.canvas.height=r,this.viewport(0,0,e,r)),(a=this.compositions)==null||a.forEach(function(o){o.camera.aspect=e/r}),this.emit("resize",this)},n.getTargetSize=function(e){if(e==null)throw new Error("Container is not an HTMLElement, see "+Qr["Container is not an HTMLElement"]+".");var r=this.displayAspect,a=window.getComputedStyle==null?void 0:window.getComputedStyle.call(window,e),o,u,l=0,h=0;if(a?(l=parseInt(a.width,10),h=parseInt(a.height,10)):(l=e.clientWidth,h=e.clientHeight),r){var c=l/h;c>r?(u=h*this.displayScale,o=u*r):(o=l*this.displayScale,u=o/r)}else o=l,u=h;var f=this.pixelRatio,d=o,v=u;if(o=Math.round(o*f),u=Math.round(u*f),o<1||u<1)if(this.offscreenMode)o=u=d=v=1;else throw new Error("Invalid container size "+o+"x"+u+", see "+Qr["Invalid container size"]+".");return[d,v,o,u]},n.addTexture=function(e){this.disposed||we(this.textures,e)},n.removeTexture=function(e){this.disposed||Re(this.textures,e)},n.addMaterial=function(e){this.disposed||we(this.materials,e)},n.removeMaterial=function(e){this.disposed||Re(this.materials,e)},n.addGeometry=function(e){this.disposed||we(this.geometries,e)},n.removeGeometry=function(e){this.disposed||Re(this.geometries,e)},n.addMesh=function(e){this.disposed||we(this.meshes,e)},n.removeMesh=function(e){this.disposed||Re(this.meshes,e)},n.addRenderPass=function(e){this.disposed||we(this.renderPasses,e)},n.removeRenderPass=function(e){this.disposed||Re(this.renderPasses,e)},n.addComposition=function(e){this.disposed||we(this.compositions,e)},n.removeComposition=function(e){this.disposed||Re(this.compositions,e)},n.getWidth=function(){return 0},n.getHeight=function(){return 0},n.getShaderLibrary=function(){return null},n.bindSystemFramebuffer=function(){},n.viewport=function(e,r,a,o){},n.clear=function(e){},n.drawGeometry=function(e,r,a,o){},n.setSampleAlphaToCoverage=function(e){},n.setBlending=function(e){},n.setDepthTest=function(e){},n.setStencilTest=function(e){},n.setCulling=function(e){},n.setPolygonOffsetFill=function(e){},n.blendColor=function(e,r,a,o){},n.blendFuncSeparate=function(e,r,a,o){},n.blendEquationSeparate=function(e,r){},n.colorMask=function(e,r,a,o){},n.depthMask=function(e){},n.depthFunc=function(e){},n.depthRange=function(e,r){},n.polygonOffset=function(e,r){},n.cullFace=function(e){},n.frontFace=function(e){},n.stencilMaskSeparate=function(e,r){},n.stencilFuncSeparate=function(e,r,a,o){},n.stencilOpSeparate=function(e,r,a,o){},n.dispose=function(){var e,r,a;if(!this.disposed){this._disposed=!0;var o=[];this.renderPasses.length>0&&o.push("Pass "+this.renderPasses.length),this.meshes.length>0&&o.push("Mesh "+this.meshes.length),this.geometries.length>0&&o.push("Geom "+this.geometries.length),this.textures.length>0&&o.push("Tex "+this.textures.length),o.length>0&&Nt.warn("Release GPU memory: "+o.join(", ")+"."),(e=this.ticker)==null||e.stop(),(r=this.eventSystem)==null||r.dispose(),(a=this.assetService)==null||a.dispose(),this.renderPasses.forEach(function(u){return u.dispose()}),this.meshes.forEach(function(u){return u.dispose()}),this.geometries.forEach(function(u){return u.dispose()}),this.materials.forEach(function(u){return u.dispose()}),this.textures.forEach(function(u){return u.dispose()}),this.assetManagers.forEach(function(u){return u.dispose()}),this.compositions.forEach(function(u){return u.dispose()}),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.compositions=[]}},Mt(s,[{key:"disposed",get:function(){return this._disposed}}]),s}(Tn);P.RGBA,P.UNSIGNED_BYTE,P.LINEAR,P.LINEAR,P.CLAMP_TO_EDGE,P.CLAMP_TO_EDGE;var Pl=function(){function i(){}return i.load=function(n,t,e){e===void 0&&(e={});var r=this;return vt(function(){var a,o,u,l,h,c,f,d,v,p,g,x,b;return pt(this,function(y){switch(y.label){case 0:return l=performance.now(),h=(o=t.gpuCapability)==null||(a=o.detail)==null?void 0:a.asyncShaderCompile,c=t.compositions.length,f=new Tl(e),t.assetManagers.push(f),[4,f.loadScene(n,t.renderer)];case 1:return d=y.sent(),t.clearResources(),tn.onAssetsLoadFinish(d,f.options,t),t.assetService.prepareAssets(d,d.assets),t.assetService.updateTextVariables(d,e.variables),v=r.createComposition(d,t,e),v.setIndex(c),p=performance.now(),[4,new Promise(function(E){var _;(_=t.getShaderLibrary())==null||_.compileAllShaders(function(){return E(null)})})];case 2:return y.sent(),g=performance.now()-p,(u=t.ticker)==null||u.start(),x=v.name,b=performance.now()-l,v.statistic.compileTime=g,v.statistic.firstFrameTime=b,Nt.info("First frame ["+x+"]: "+b.toFixed(4)+"ms."),Nt.info("Shader "+(h?"async":"sync")+" compile ["+x+"]: "+g.toFixed(4)+"ms."),[2,v]}})})()},i.createComposition=function(n,t,e){e===void 0&&(e={});var r=new pp(t,lt({},e,{event:t.eventSystem}),n);return t.env!==Ur&&t.assetService.createShaderVariant(),r},i}();Oi("camera",Ff);Oi("text",_v);Oi("sprite",zf);Oi("particle",vv);Oi("interact",Lf);var xp="2.9.3";Nt.info("Core version: "+xp+".");function ki(i,s,n){s===void 0||i===null||(i.__SPECTOR_Metadata={name:s}
7,i.__SPECTOR_Object_TAG?(i.__SPECTOR_Object_TAG.displayText=s,n&&(i.__SPECTOR_Object_TAG.id=n)):i.__SPECTOR_Object_TAG={displayText:s,id:""})}var _u=function(){function i(n,t){this.engine=n,this.byteLength=0,this.destroyed=!1;var e=t.name,r=t.data,a=t.elementCount,o=t.target,u=o===void 0?P.ARRAY_BUFFER:o,l=t.type,h=l===void 0?P.FLOAT:l,c=t.usage,f=c===void 0?P.STATIC_DRAW:c,d=Tp(h);this.target=u,this.type=h,this.usage=f,this.glBuffer=this.createGLBuffer(e),this.bytesPerElement=d,r?this.bufferData(r):a&&this.bufferData(d*a)}var s=i.prototype;return s.createGLBuffer=function(t){var e=this.engine.gl.createBuffer();return ki(e,t),e},s.bind=function(){this.engine.gl.bindBuffer(this.target,this.glBuffer)},s.bufferData=function(t){var e=typeof t=="number"?t:t.byteLength;if(this.engine){this.byteLength=e;var r=this.engine.gl,a=this.target;r.bindBuffer(a,this.glBuffer),e===0?r.bufferData(a,1,this.usage):(r.bufferData(a,e,this.usage),typeof t!="number"&&r.bufferSubData(a,0,t))}else this.byteLength=0},s.bufferSubData=function(t,e){if(this.engine){var r=this.engine.gl,a=this.target,o=t*this.bytesPerElement,u=o+e.byteLength;r.bindBuffer(a,this.glBuffer),u>this.byteLength&&(this.byteLength=u,r.bufferData(a,u,this.usage)),r.bufferSubData(a,o,e)}else this.byteLength=0},s.dispose=function(){this.engine.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},s.readSubData=function(t,e){return Xe(this.engine.gl)?(this.engine.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0):!1},Mt(i,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),i}(),lr,bp=(lr={},lr[P.INT]=Int32Array,lr[P.FLOAT]=Float32Array,lr[P.SHORT]=Int16Array,lr[P.BYTE]=Int8Array,lr[P.UNSIGNED_BYTE]=Uint8Array,lr[P.UNSIGNED_INT]=Uint32Array,lr[P.UNSIGNED_SHORT]=Uint16Array,lr);function Tp(i){var s,n;return(n=(s=bp[i])==null?void 0:s.BYTES_PER_ELEMENT)!=null?n:0}var mi,_p=(mi={},mi[Uint8Array.BYTES_PER_ELEMENT]=P.UNSIGNED_BYTE,mi[Uint16Array.BYTES_PER_ELEMENT]=P.UNSIGNED_SHORT,mi[Uint32Array.BYTES_PER_ELEMENT]=P.UNSIGNED_INT,mi),Ep=1,wp=function(i){k(s,i);function s(t,e){var r;return r=i.call(this,t)||this,r.drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,e&&r.processProps(e),r}var n=s.prototype;return n.getOptions=function(){return lt({},this.options)},n.initialize=function(){var e=this;if(!this.initialized){var r=this.engine;ne(r),r.addGeometry(this),Object.keys(this.bufferProps).forEach(function(a){e.buffers[a]=new _u(e.engine,e.bufferProps[a])}),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},n.getAttributeBuffer=function(e){if(this.initialized){var r=this.attributes[e].dataSource;return this.buffers[r]}},n.setAttributeData=function(e,r){if(this.bufferProps!=null){var a=this.getAttributeBufferOption(e),o=this.attributes[e].dataSource;if(a){var u=a.usage,l=a.target;this.bufferProps[o]={data:r,usage:u,target:l,elementCount:r.length},this.dirtyFlags[o].discard=!0,this.dirtyFlags[o].dirty=!0}}},n.getAttributeData=function(e){if(this.bufferProps!=null){var r=this.getAttributeBufferOption(e);return r?r.data:void 0}},n.setAttributeSubData=function(e,r,a){if(this.bufferProps!=null){var o=this.getAttributeBufferOption(e);if(o&&o.data!=null){var u=r,l=r+a.length;if(o.data.length<l){var h=new a.constructor(l);h.set(o.data),o.data=h,this.dirtyFlags[e].discard=!0}else if(!this.dirtyFlags[e].discard){var c=this.dirtyFlags[e];c.start!==void 0&&(c.start=Math.min(c.start,u)),c.end!==void 0&&(c.end=Math.max(c.end,l-1))}o.data.set(a,u),this.dirtyFlags[e].dirty=!0}}},n.getIndexData=function(){return this.indices},n.setIndexData=function(e){(Z(e,Uint8Array)||Z(e,Uint16Array)||Z(e,Uint32Array))&&(this.indices=e,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},n.setIndexSubData=function(e,r){if(this.indices){var a,o=e,u=e+r.length;if(this.indices.length<u){var l=new r.constructor(u);l.set(this.indices),this.indices=l,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var h=this.dirtyFlags.index;h.start!==void 0&&(h.start=Math.min(h.start,o)),h.end!==void 0&&(h.end=Math.max(h.end,u-1))}(a=this.indices)==null||a.set(r,o),this.dirtyFlags.index.dirty=!0}},n.getAttributeStride=function(e){var r=this.attributes[e],a=r.stride,o=r.size,u=r.type;return a||o*of[u]},n.getAttributeNames=function(){return this.attributesName},n.setDrawStart=function(e){this.drawStart=e},n.getDrawStart=function(){return this.drawStart},n.setDrawCount=function(e){this.drawCount=e},n.getDrawCount=function(){return this.drawCount},n.getSkinProps=function(){return this.skin},n.getAttributeBufferOption=function(e){var r=this.attributes[e];return r?this.bufferProps[r.dataSource]:void 0},n.createIndicesBuffer=function(e){var r=_p[e.BYTES_PER_ELEMENT],a={data:e,target:P.ELEMENT_ARRAY_BUFFER,type:r,name:""+this.name+"##index"};return new _u(this.engine,a)},n.flush=function(){var e=this;if(this.initialized){var r=this.attributes,a=this.bufferProps,o=this.indices;
7Object.keys(this.dirtyFlags).forEach(function(u){var l=e.dirtyFlags[u],h,c;if(u=="index")h=e.indicesBuffer,c=o;else{var f=r[u].dataSource;h=e.buffers[f],c=a[f].data}if((l.dirty||l.discard)&&h&&c){if(l.discard)h.bufferData(c);else if(l.start!==void 0&&l.end!==void 0){var d=l.start*c.BYTES_PER_ELEMENT+c.byteOffset,v=l.end-l.start+1,p=new c.constructor(c.buffer,d,v);h.bufferSubData(l.start,p)}l.start=Number.POSITIVE_INFINITY,l.end=0,l.dirty=l.discard=!1}}),Object.keys(this.attributesReleasable).forEach(function(u){var l=e.attributesReleasable[u],h=r[u].dataSource;a[h]&&l&&(a[h].data=void 0)}),this.indicesReleasable}},n.processProps=function(e){var r=e,a=r.drawStart,o=a===void 0?0:a,u=r.drawCount,l=r.mode,h=r.indices,c=r.name,f=c===void 0?"effectsGeometry:"+Ep++:c,d=r.bufferUsage,v=d===void 0?P.STATIC_DRAW:d;this.name=f;var p={},g=[],x={},b={},y={},E=v;this.drawStart=o,u!==void 0&&(this.drawCount=u),this.mode=isNaN(l)?P.TRIANGLES:l,Object.keys(r.attributes).forEach(function(_){var S=r.attributes[_],C=S.size,I=S.stride,R=S.offset,O=S.normalize,F=S.type,L=F===void 0?P.FLOAT:F,V=S.releasable,U=S.data;if(L&&!("dataSource"in S)&&!U&&(U=uf(L)),U){var W=Z(U,Float32Array)?P.FLOAT:P.INT;p[_]={data:U,usage:E,target:P.ARRAY_BUFFER,name:_},x[_]={size:C,stride:I,offset:R,type:L!=null?L:W,normalize:!!O,dataSource:_},y[_]=V!=null?V:!1,b[_]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var G=S.dataSource;G&&(x[_]={size:C,stride:I,offset:R,type:L,dataSource:G,normalize:!!O})}g.push(_)}),b.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=h==null?void 0:h.data,this.indicesReleasable=(h==null?void 0:h.releasable)===!0,this.bufferProps=p,this.attributes=x,this.attributesName=g,this.attributesReleasable=y,this.dirtyFlags=b,this.options=r,this.initialized=!1},n.fromData=function(e){var r=this;i.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes;var a;if(e.buffer?a=new Uint8Array(Cp(e.buffer)):e.binaryData&&(a=e.binaryData),!!a){var o=e.vertexData.vertexCount;if(this.hasSemantic(e)){var u={mode:P.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach(function(b){var y,E=(y=Sp[b.semantic])!=null?y:b.semantic,_=r.createVertexTypedArray(b,a,o);u.attributes[E]={type:Bi(b.format),size:b.dimension,data:_,normalize:b.normalize}}),e.indexFormat!==Kr.None){var l=this.createIndexTypedArray(e.indexFormat,a,e.indexOffset);u.indices={data:l},u.drawCount=l.length}else u.drawCount=o;this.processProps(u)}else{var h=e.vertexData.channels[0],c=e.vertexData.channels[1],f=e.vertexData.channels[2],d=this.createVertexTypedArray(h,a,o),v=this.createVertexTypedArray(c,a,o),p=this.createVertexTypedArray(f,a,o),g=this.createIndexTypedArray(e.indexFormat,a,e.indexOffset),x={mode:P.TRIANGLES,attributes:{aPos:{type:Bi(h.format),size:3,data:d,normalize:h.normalize},aUV:{type:Bi(c.format),size:2,data:v,normalize:c.normalize},aNormal:{type:Bi(f.format),size:3,data:p,normalize:f.normalize}}};x.indices={data:g},x.drawCount=g.length,this.processProps(x)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},n.dispose=function(){var e=this;if(this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized){var r;Object.keys(this.buffers).forEach(function(a){e.buffers[a].dispose()}),this.buffers={},(r=this.indicesBuffer)==null||r.dispose(),Object.keys(this.vaos).forEach(function(a){var o;(o=e.vaos[a])==null||o.dispose(),e.vaos[a]=void 0}),this.indicesBuffer=void 0,this.engine!==void 0&&this.engine.removeGeometry(this)}this.destroyed=!0,i.prototype.dispose.call(this)},n.createVertexTypedArray=function(e,r,a){var o=r.buffer;switch(e.format){case Fe.Float32:return new Float32Array(o,r.byteOffset+e.offset,e.dimension*a);case Fe.Int16:return new Int16Array(o,r.byteOffset+e.offset,e.dimension*a);case Fe.Int8:return new Int8Array(o,r.byteOffset+e.offset,e.dimension*a);case Fe.UInt16:return new Uint16Array(o,r.byteOffset+e.offset,e.dimension*a);case Fe.UInt8:return new Uint8Array(o,r.byteOffset+e.offset,e.dimension*a);default:return console.error("Invalid vertex format type: "+e.format+"."),new Float32Array(o,r.byteOffset+e.offset,e.dimension*a)}},n.createIndexTypedArray=function(e,r,a){var o=r.buffer,u=r.byteOffset+a,l=r.byteLength-a;switch(e){case Kr.UInt16:return new Uint16Array(o,u,l/Uint16Array.BYTES_PER_ELEMENT);case Kr.UInt32:return new Uint32Array(o,u,l/Uint32Array.BYTES_PER_ELEMENT);default:return console.error("Invalid index format type: "+e+"."),new Uint32Array(o,u,l/Uint32Array.BYTES_PER_ELEMENT)}},n.hasSemantic=function(e){var r=!1,a=e.vertexData;
7return a.channels.forEach(function(o){o.semantic&&o.semantic.length>0&&(r=!0)}),r},Mt(s,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),s}(Qe),Sp={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"};function Cp(i){for(var s=atob(i),n=new Uint8Array(s.length),t=0;t<s.length;t++)n[t]=s.charCodeAt(t);var e=n.buffer;return e}var Nr=function(i){k(s,i);function s(t,e){var r;return r=i.call(this,t)||this,r.initialized=!1,e!==void 0&&r.initialize(e),r}var n=s.prototype;return n.initialize=function(e){this.initialized||(this.initialized=!0,this.renderer=e,this.buffer=e.engine.gl.createRenderbuffer())},n.setSize=function(e,r){if(!this.initialized){Nt.error("Can't set size for uninitialized render buffer.");return}if(this.renderer&&(e!==this.size[0]||r!==this.size[1])){var a=this.renderer.engine,o=a.gl;a.bindRenderbuffer(o.RENDERBUFFER,this.buffer),e&&r?o.renderbufferStorage(o.RENDERBUFFER,this.format,this.size[0]=e,this.size[1]=r):Nt.error("Invalid render buffer size: "+e+"x"+r+".")}},n.dispose=function(){this.renderer&&(this.renderer.engine.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Ba},s}(ul),br,Ap=(br={},br[P.RGBA]=34842,br[P.RGB]=34843,br[P.ALPHA]=33325,br[P.RED]=33325,br[P.LUMINANCE_ALPHA]=33327,br[P.LUMINANCE]=33325,br),Tr,Mp=(Tr={},Tr[P.RGBA]=34836,Tr[P.RGB]=34837,Tr[P.ALPHA]=33326,Tr[P.RED]=33326,Tr[P.LUMINANCE_ALPHA]=33328,Tr[P.LUMINANCE]=33326,Tr),gn=function(i){k(s,i);function s(t,e){var r;return r=i.call(this,t)||this,r.initialized=!1,e&&r.fromData(e),r}var n=s.prototype;
7return n.bind=function(e){this.engine.bindTexture(this.target,this.textureBuffer,e)},n.initialize=function(){if(!this.initialized){var e=this.engine;e.addTexture(this);var r=this.engine.gl,a=this.source,o=a.target,u=o===void 0?r.TEXTURE_2D:o,l=a.name;this.textureBuffer=r.createTexture(),ki(this.textureBuffer,l),this.target=u,this.update(this.source),this.release(),this.initialized=!0}},n.clone=function(){var e=new s(this.engine,this.source);return e.sourceFrom=this.sourceFrom,e.sourceType=this.sourceType,e.width=this.width,e.height=this.height,e},n.release=function(){var e=this.source.sourceType;switch(e){case st.image:delete this.source.image,delete this.source.cube;break;case st.data:delete this.source.data;break;case st.compressed:delete this.source.mipmaps;break;case st.mipmaps:delete this.source.mipmaps;break}},n.update=function(e){var r=this;if(!this.engine||!this.textureBuffer){this.width=0,this.height=0;return}var a=this.target,o=this.source,u=this.engine.gl,l=this.engine.gpuCapability.detail,h=o.sourceType,c=o.data,f=o.cube,d=o.image,v=o.video,p=o.mipmaps,g=o.mipmaps,x=e.data,b=e.cube,y=e.generateMipmap,E=y===void 0?!1:y,_=e.mipmaps,S=o.format,C=o.type,I=o.internalFormat,R=0,O=0;this.bind(h===st.video),C===P.HALF_FLOAT?(C=l.halfFloatTexture,C||Nt.error("Half float texture is not support."),Xe(u)&&I===S&&(S===P.LUMINANCE&&(S=P.RED),I=Ap[S]),l.halfFloatLinear||(o.minFilter=o.magFilter=u.NEAREST,Nt.warn("Half float linear not support, change to NEAREST."))):C===u.FLOAT&&(C=l.floatTexture,C||Nt.error("Float texture is not support."),Xe(u)&&I===S&&(S===P.LUMINANCE&&(S=P.RED),I=Mp[S]),l.floatLinear||(o.minFilter=u.NEAREST,o.magFilter=u.NEAREST,Nt.warn("Float linear not support, change to NEAREST."))),o.premultiplyAlpha===void 0&&(o.premultiplyAlpha=!1),u.pixelStorei(u.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),o.flipY===void 0&&(o.flipY=!1),u.pixelStorei(u.UNPACK_FLIP_Y_WEBGL,o.flipY);var F=function(X,H){zi(X)&&zi(H)||Xe(u)?u.generateMipmap(a):console.error("Mipmap generation failed. Texture width and height must be power of two in WebGL1.")};if(h===st.framebuffer){if(x){var L;R=(L=x.width)!=null?L:0;var V;O=(V=x.height)!=null?V:0,R&&O&&(this.width!==R||this.height!==O)&&u.texImage2D(a,0,I,R,O,0,S,C,null)}}else if(h===st.data)if(a===u.TEXTURE_CUBE_MAP)b.forEach(function(X,H){var Y=r.texImage2DData(u,u.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,I,S,C,X),K=Y[0],z=Y[1];R=Math.max(K,R),O=Math.max(z,O)});else{var U;U=this.texImage2DData(u,a,0,I,S,C,c),R=U[0],O=U[1],E&&F(R,O)}else if(h===st.image||h===st.video){if(a===u.TEXTURE_CUBE_MAP)f.forEach(function(X,H){var Y=r.texImage2D(u,u.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,I,S,C,X),K=Y[0],z=Y[1];R=Math.max(K,R),O=Math.max(z,O)});else if(a===u.TEXTURE_2D){var W=d!=null?d:v,G;G=this.texImage2D(u,a,0,I,S,C,W),R=G[0],O=G[1]}E&&F(R,O)}else if(h===st.mipmaps){var B;a===u.TEXTURE_2D?p.forEach(function(X,H){if("data"in X?B=r.texImage2DData(u,a,H,I,S,C,X):B=r.texImage2D(u,a,H,I,S,C,X),H===0){var Y;Y=B,R=Y[0],O=Y[1]}}):a===u.TEXTURE_CUBE_MAP&&g.forEach(function(X,H){X.forEach(function(Y,K){if("data"in Y?B=r.texImage2DData(u,u.TEXTURE_CUBE_MAP_POSITIVE_X+K,H,I,S,C,Y):B=r.texImage2D(u,u.TEXTURE_CUBE_MAP_POSITIVE_X+K,H,I,S,C,Y),H===0){var z;z=B,R=z[0],O=z[1]}})})}else h===st.compressed&&_&&_.length!==0&&(R=_[0].width,O=_[0].height,_.forEach(function(X,H){u.compressedTexImage2D(a,H,I,X.width,X.height,0,X.data)}));this.width=R,this.height=O,this.setTextureFilters(u,a,o)},n.setTextureFilters=function(e,r,a){var o=a.anisotropic,u=o===void 0?4:o,l=a.wrapS,h=l===void 0?e.CLAMP_TO_EDGE:l,c=a.wrapT,f=c===void 0?e.CLAMP_TO_EDGE:c,d=this.engine.gpuCapability;this.target===e.TEXTURE_2D&&d.setTextureAnisotropic(e,this.target,u);var v=Xe(e)||zi(this.width)&&zi(this.height),p=a.magFilter?a.magFilter:e.NEAREST,g=a.minFilter?a.minFilter:e.NEAREST;v||(g===e.LINEAR_MIPMAP_LINEAR||g===e.LINEAR_MIPMAP_NEAREST||g===e.NEAREST_MIPMAP_LINEAR||g===e.NEAREST_MIPMAP_NEAREST)&&(g=e.LINEAR),e.texParameteri(r,e.TEXTURE_MIN_FILTER,g),e.texParameteri(r,e.TEXTURE_MAG_FILTER,p),e.texParameteri(r,e.TEXTURE_WRAP_S,v?h:e.CLAMP_TO_EDGE),e.texParameteri(r,e.TEXTURE_WRAP_T,v?f:e.CLAMP_TO_EDGE)},n.fromData=function(e){i.prototype.fromData.call(this,e);var r=e,a=this.assembleOptions(r),o=a.sourceType,u=a.sourceFrom,l=a.name,h=l===void 0?"":l;this.source=a,this.sourceType=o,this.sourceFrom=u,this.name=h},n.texImage2D=function(e,r,a,o,u,l,h){var c=this,f=this.source,d=f.sourceType,v=f.minFilter,p=f.magFilter,g=f.wrapS,x=f.wrapT,b,y=(b=this.engine.gpuCapability.detail.maxTextureSize)!=null?b:2048,E=h;if(d!==st.video){var _=v!==e.NEAREST||p!==e.NEAREST||g!==e.CLAMP_TO_EDGE||x!==e.CLAMP_TO_EDGE;_=_||h.width>y||h.height>y,_&&setTimeout(function(){E=c.resizeImage(h)})}e.texImage2D(r,a,o,u,l,E);var S=[E.width,E.height];if(d===st.video){var C=h.videoWidth,I=h.videoHeight;return[C,I]}return S},n.texImage2DData=function(e,r,a,o,u,l,h){var c=h.data,f=h.width,d=h.height,v=u===e.UNSIGNED_BYTE?new Uint8Array(c.buffer,c.byteOffset,c.byteLength/c.BYTES_PER_ELEMENT):c;return e.texImage2D(r,a,o,f,d,0,u,l,v),[f,d]},n.resizeImage=function(e,r,a){var o=this.engine.gpuCapability.detail,u,l=(u=o.maxTextureSize)!=null?u:2048,h=this.engine.gl;if(Xe(h)&&e.width<l&&e.height<l)return e;var c=Ip(e,l,r,a);return c||e},n.reloadData=function(){var e=this;return vt(function(){return pt(this,function(r){switch(r.label){case 0:return e.offloaded?[4,qs().reload(e)]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}})})()},n.offloadData=function(){if(this.initialized&&qs().canOffloadTexture(this.source.sourceFrom)){var e=this.target,r=this.engine.gl;if(r&&this.textureBuffer){var a=new Uint8Array([255]);if(this.bind(),e===r.TEXTURE_2D)r.texImage2D(e,0,r.LUMINANCE,1,1,0,r.LUMINANCE,r.UNSIGNED_BYTE,a);else if(e===r.TEXTURE_CUBE_MAP)for(var o=[r.TEXTURE_CUBE_MAP_NEGATIVE_X,r.TEXTURE_CUBE_MAP_NEGATIVE_Y,r.TEXTURE_CUBE_MAP_NEGATIVE_Z,r.TEXTURE_CUBE_MAP_POSITIVE_X,r.TEXTURE_CUBE_MAP_POSITIVE_Y,r.TEXTURE_CUBE_MAP_POSITIVE_Z],u=0;u<o.length;u++)r.texImage2D(o[u],0,r.LUMINANCE,1,1,0,r.LUMINANCE,r.UNSIGNED_BYTE,a);r.generateMipmap(e),this.width=1,this.height=1}this.offloaded=!0}},n.uploadCurrentVideoFrame=function(){var e=this;return vt(function(){return pt(this,function(r){return e.source.sourceType===st.video&&e.source.video&&e.initialized?(e.update({video:e.source.video}),[2,!0]):[2,!1]})})()},n.updateSource=function(e){this.source=this.assembleOptions(lt({},this.source,e)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},n.restore=function(){},n.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(){Nt.error("This texture has been destroyed.")},this.initialize=Ba,this.engine!==void 0&&this.engine.removeTexture(this),i.prototype.dispose.call(this)},s}(Wt);function Ip(i,s,n,t){var e=i.width,r=i.height,a=Math.min(s,n||no(e)),o=Math.min(s,t||no(r));if(o!==r||a!==e){var u=si.getCanvas(),l=u.getContext("2d");return u.width=a,u.height=o,l==null||l.drawImage(i,0,0,e,r,0,0,a,o),Nt.warn("Image resize from "+e+"x"+r+" to "+a+"x"+o+"."),u}}var Pp=1,Rp=function(i){k(s,i);function s(t,e){var r;r=i.call(this)||this,r.attachmentTextures=[];var a=t.depthStencilAttachment,o=t.viewport,u=t.storeAction,l=t.name,h=l===void 0?"GLFramebuffer"+Pp++:l;r.renderer=e,r.engine=e.engine;var c;return r.depthStencilStorageType=(c=a==null?void 0:a.storageType)!=null?c:Ee.none,r.viewport=o,r.name=h,r.storeAction=u,r.updateProps(t),r}var n=s.prototype;return n.getDepthTexture=function(){return this.depthTexture},n.getStencilTexture=function(){return this.stencilTexture},n.getColorTextures=function(){return this.colorTextures},n.updateAttachmentTextures=function(){var e=this,r=this.viewport[2],a=this.viewport[3];
7this.attachmentTextures.length=0,this.colorTextures.forEach(function(o){var u={width:r,height:a,data:new Uint8Array(0)};o.initialize(),o.update({data:u}),we(e.attachmentTextures,o.textureBuffer)}),this.stencilTexture&&we(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&(this.depthTexture.update({data:{width:r,height:a,data:new Uint16Array(0)}}),we(this.attachmentTextures,this.depthTexture.textureBuffer))},n.updateProps=function(e){var r,a=this.renderer,o=this.engine.gpuCapability,u,l=(u=e.depthStencilAttachment)!=null?u:{storageType:Ee.none},h=e.attachments.length>0,c=!0;if(this.externalStorage=!1,e.attachments.length>1&&!o.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var f=(r=e.depthStencilAttachment)==null?void 0:r.texture,d=o.detail.readableDepthStencilTextures,v=l.storageType,p=l.storage;if(this.colorTextures=e.attachments.slice(),!h&&v!==Ee.none)throw new Error("Use depth stencil attachment without color attachments.");switch(h&&(this.fbo=this.engine.createGLFramebuffer(this.name)),v){case Ee.depth_stencil_opaque:if(p)if(Z(p,Nr))this.depthStencilRenderbuffer=p,this.externalStorage=!0;else throw new Error("Invalid depth stencil attachment storage.");else this.depthStencilRenderbuffer=new Nr({format:P.DEPTH_STENCIL,attachment:P.DEPTH_STENCIL_ATTACHMENT,storageType:v},a);c=!1;break;case Ee.depth_16_opaque:if(p)if(Z(p,Nr))this.depthStencilRenderbuffer=p,this.externalStorage=!0;else throw new Error("Invalid depth attachment storage.");else this.depthStencilRenderbuffer=new Nr({attachment:P.DEPTH_ATTACHMENT,format:P.DEPTH_COMPONENT16,storageType:v},a);break;case Ee.stencil_8_opaque:if(p)if(Z(p,Nr))this.depthStencilRenderbuffer=p,this.externalStorage=!0;else throw new Error("Invalid stencil attachment storage.");else this.depthStencilRenderbuffer=new Nr({attachment:P.STENCIL_ATTACHMENT,format:P.STENCIL_INDEX8,storageType:v},a);break;case Ee.depth_16_texture:if(!d)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=f!=null?f:new gn(this.engine,{sourceType:st.framebuffer,format:P.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:P.UNSIGNED_SHORT,name:""+this.name+"##depthTex"}),this.depthTexture.initialize();break;case Ee.depth_24_stencil_8_texture:if(!d)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=f!=null?f:new gn(this.engine,{sourceType:st.framebuffer,format:P.DEPTH_STENCIL,internalFormat:o.internalFormatDepth24_stencil8,type:o.UNSIGNED_INT_24_8,name:""+this.name+"##dpthStclTex"}),this.depthTexture.initialize(),c=!0;break}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,c),this.updateAttachmentTextures()},n.getStoreAttachments=function(e,r){var a=this.engine.gl,o=this.colorTextures.length;if(e&&Xe(a)&&o>0){var u=[];if(e.depthAction===Ti.clear&&this.depthStorage&&we(u,r?a.DEPTH_ATTACHMENT:a.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===Ti.clear&&this.stencilStorage&&we(u,r?a.STENCIL_ATTACHMENT:a.DEPTH_STENCIL_ATTACHMENT),e.colorAction===Ti.clear)for(var l=0;l<o;l++)we(u,a["COLOR_ATTACHMENT"+l]);return u}},n.unbind=function(){var e=this.storeInvalidAttachments;if(e!=null&&e.length){var r=this.engine.gl;Xe(r)&&r.invalidateFramebuffer(r.FRAMEBUFFER,e)}
7this.engine.bindSystemFramebuffer()},n.bind=function(){var e=this;if(this.fbo){var r=this.engine.gl,a=this.engine,o=this.viewport,u=o[0],l=o[1],h=o[2],c=o[3];a.bindFramebuffer(r.FRAMEBUFFER,this.fbo),a.viewport(u,l,h,c);var f=this.renderer.engine.whiteTexture,d=f.textureBuffer;Object.keys(a.textureUnitDict).forEach(function(_){var S=a.textureUnitDict[_];S&&S!==d&&e.attachmentTextures.includes(S)&&(a.activeTexture(+_),f.bind())});for(var v=0;v<4;v++)a.activeTexture(r.TEXTURE0+v),f.bind();if(!this.ready){var p=this,g=p.depthStencilRenderbuffer,x=p.depthTexture,b=p.stencilTexture;if(a.activeTexture(r.TEXTURE0),g)g.setSize(h,c),r.framebufferRenderbuffer(r.FRAMEBUFFER,g.attachment,r.RENDERBUFFER,g.buffer);else if(x){x.source.data={width:h,height:c},x.update({data:{width:h,height:c,data:new Uint16Array(0)}});var y=x&&b?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.framebufferTexture2D(r.FRAMEBUFFER,y,r.TEXTURE_2D,x.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var E=r.checkFramebufferStatus(r.FRAMEBUFFER);if(E!==r.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+E+", gl error="+r.getError()+", gl isContextLost="+r.isContextLost()+". width="+h+", height="+c+".");this.ready=!0}}},n.resetColorTextures=function(e){var r=e,a=this.engine.gl,o=this.engine.gpuCapability,u=this.viewport,l=[];if(r){for(var h=M(r),c;!(c=h()).done;){var f=c.value;f.initialize()}this.colorTextures=r.slice()}this.engine.activeTexture(a.TEXTURE0),this.colorTextures.forEach(function(d,v){var p=u[2],g=u[3],x={width:p,height:g,data:new Uint8Array(0)};d.update({data:x}),o.framebufferTexture2D(a,a.FRAMEBUFFER,v,a.TEXTURE_2D,d.textureBuffer),l.push(!0)}),o.drawBuffers(a,l),this.updateAttachmentTextures()},n.resize=function(e,r,a,o){var u=this.viewport,l=u[0],h=u[1],c=u[2],f=u[3];(l!==e||h!==r||c!==a||f!==o)&&(this.viewport=[e,r,a,o],this.ready=!1,this.bind())},n.dispose=function(e){if(this.renderer){var r;this.engine.deleteGLFramebuffer(this),delete this.fbo;var a=e!=null&&e.depthStencilAttachment?e.depthStencilAttachment:_i.force;if(a===_i.force||a===_i.keepExternal&&!this.externalStorage){var o,u;(o=this.depthStencilRenderbuffer)==null||o.dispose(),(u=this.depthTexture)==null||u.dispose()}for(var l=M(this.colorTextures),h;!(h=l()).done;){var c=h.value;c.dispose()}(r=this.stencilTexture)==null||r.dispose(),this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},Mt(s,[{key:"stencilStorage",get:function(){var e=this.depthStencilStorageType;if(e!==Ee.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==Ee.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),s}(ja),Rl=function(){function i(n,t){this.ready=!1,this.disposed=!1,this.gl=n.gl,this.vaoExt=n.gpuCapability.vaoExt,this.vao=this.createVertexArray(t)}var s=i.prototype;return s.bind=function(){this.bindVertexArray(this.vao)},s.unbind=function(){this.bindVertexArray(null)},s.createVertexArray=function(t){var e=null;return Xe(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),ki(e,t),e},s.bindVertexArray=function(t){if(Xe(this.gl))this.gl.bindVertexArray(t);else{var e;(e=this.vaoExt)==null||e.bindVertexArrayOES(t)}},s.dispose=function(){if(Xe(this.gl))this.gl.deleteVertexArray(this.vao);else{var t;(t=this.vaoExt)==null||t.deleteVertexArrayOES(this.vao)}},i}(),Fp=function(){function i(n,t,e){this.engine=n,this.program=t,this.id=e,this.engine.useProgram(t),this.attribInfoMap=this.createAttribMap(),this.engine.useProgram(null)}var s=i.prototype;return s.bind=function(){this.engine.useProgram(this.program)},s.setupAttributes=function(t){var e=this,r,a=this.id,o=this.engine.gl,u;return t.vaos[a]?u=t.vaos[a]:(u=new Rl(this.engine,t.name+"-"+a),u||console.error("Failed to create VAO object."),t.vaos[a]=u),u&&u.vao&&(u.bind(),u.ready)||(Object.keys(this.attribInfoMap).forEach(function(l){var h=e.attribInfoMap[l],c=t.attributes[l];if(c){var f=t.buffers[c.dataSource];if(!f)throw new Error("Failed to find a buffer named '"+(c.dataSource||l)+"'. Please ensure the buffer is correctly initialized and bound.");f.bind(),o.enableVertexAttribArray(h.loc),o.vertexAttribPointer(h.loc,c.size,c.type,c.normalize,c.stride||0,c.offset||0)}}),(r=t.indicesBuffer)==null||r.bind(),u&&(u.ready=!0)),u},s.createAttribMap=function(){for(var t=this.engine.gl,e=this.program,r={},a=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),o=0;o<a;o++){var u=t.getActiveAttrib(e,o);if(u){var l=u.name,h=u.type,c=u.size,f=t.getAttribLocation(e,l);r[l]={type:h,name:l,size:c,loc:f}}}return r},s.dispose=function(){this.engine&&this.engine.gl.deleteProgram(this.program)},i}(),Op=function(i){k(s,i);function s(t,e){var r;return r=i.call(this,t,e)||this,r.initialized=!1,r.uniformLocations={},r.samplerChannels={},r}var n=s.prototype;return n.initialize=function(){this.initialized||this.engine.shaderLibrary.compileShader(this)},n.setFloat=function(e,r){this.engine.setFloat(this.uniformLocations[e],r)},n.setInt=function(e,r){this.engine.setInt(this.uniformLocations[e],r)},n.setFloats=function(e,r){this.engine.setFloats(this.uniformLocations[e],r)},n.setTexture=function(e,r){this.engine.setTexture(this.uniformLocations[e],this.samplerChannels[e],r)},n.setVector2=function(e,r){this.engine.setVector2(this.uniformLocations[e],r)},n.setVector3=function(e,r){this.engine.setVector3(this.uniformLocations[e],r)},n.setVector4=function(e,r){this.engine.setVector4(this.uniformLocations[e],r)},n.setColor=function(e,r){this.engine.setColor(this.uniformLocations[e],r)},n.setQuaternion=function(e,r){this.engine.setQuaternion(this.uniformLocations[e],r)}
7,n.setMatrix=function(e,r){this.engine.setMatrix(this.uniformLocations[e],r)},n.setMatrix3=function(e,r){this.engine.setMatrix3(this.uniformLocations[e],r)},n.setVector4Array=function(e,r){this.engine.setVector4Array(this.uniformLocations[e],r)},n.setMatrixArray=function(e,r){this.engine.setMatrixArray(this.uniformLocations[e],r)},n.fillShaderInformation=function(e,r){var a=r.slice();e=e.concat(a);for(var o=this.engine.getUniforms(this.program.program,e),u=0;u<e.length;u++)this.uniformLocations[e[u]]=o[u];var l;for(l=0;l<a.length;l++){var h=this.uniformLocations[a[l]];h==null&&(a.splice(l,1),l--)}for(l=0;l<a.length;l++){var c=a[l];this.samplerChannels[c]=l}},n.toData=function(){var e=this.definition;e.dataType=tt.Shader,e.id=this.guid,e.vertex=this.source.vertex,e.fragment=this.source.fragment},n.dispose=function(){var e;this.compileResult&&this.compileResult.shared||((e=this.program)==null||e.dispose(),i.prototype.dispose.call(this))},n.bind=function(){this.program.bind()},n.isReady=function(){return!!this.program},s}(rc),Lp=0,Eu=function(){function i(n){this.engine=n,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=n.gpuCapability.glAsyncCompileExt}var s=i.prototype;return s.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var r=[],a=M(Object.keys(this.cachedShaders)),o;!(o=a()).done;){var u=o.value;this.cachedShaders[u].initialized||r.push(u)}t?r.length?Promise.all(r.map(function(l){return new Promise(function(h){return e.compileShader(e.cachedShaders[l],h)})})).then(t).catch(function(){return 0}):t([]):r.map(function(l){return e.compileShader(e.cachedShaders[l])}),this.shaderAllDone=!0}},s.addShader=function(t,e){var r=[];if(t.macros){var a;(a=r).push.apply(a,[].concat(t.macros))}if(e){var o;(o=r).push.apply(o,[].concat(e))}var u=lt({},t,{vertex:go.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Ai.vertex,shader:t.vertex,macros:r}),fragment:go.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Ai.fragment,shader:t.fragment,macros:r})}),l=this.computeShaderCacheId(u);if(this.cachedShaders[l])return l;this.shaderAllDone=!1;var h=!1;return(u.shared||u.cacheId)&&(h=!0),this.cachedShaders[l]=new Op(this.engine,lt({},u,{vertex:u.vertex,fragment:u.fragment,name:u.name||l,shared:h})),this.cachedShaders[l].id=l,l},s.createShader=function(t,e){var r=this.addShader(t,e);return this.cachedShaders[r]},s.compileShader=function(t,e){var r=this,a=t.source,o=a.shared,u=a.vertex,l=a.fragment,h=a.name,c=t.source.cacheId,f=!1;(o||c)&&(f=!0);var d=this.engine.gl,v={shared:f,status:Je.compiling},p=this.createProgram(d,u,l,v),g=this.glAsyncCompileExt,x=performance.now(),b=function(E){v.status=Je.success,v.compileTime=performance.now()-x,t.program=E,t.initialized=!0,r.programMap[t.id]!==void 0&&console.warn("Find duplicated shader id: "+t.id+"."),r.programMap[t.id]=E},y=function(){if(r.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."),e==null?void 0:e(v);if(t.initialized)return e==null?void 0:e(v);var E=!e||!g||g&&d.getProgramParameter(v.program,g.COMPLETION_STATUS_KHR)==!0,_=E&&p();if(_){if(v.status!==Je.fail){ki(_,h);var S=new Fp(r.engine,_,t.id);d.validateProgram(_);var C=d.getProgramParameter(_,d.VALIDATE_STATUS);if(C)b(S);else{var I=d.getProgramInfoLog(_),R="the same texture",O="Two textures of different types use the same sampler";I!=null&&I.includes(R)||I!=null&&I.includes(O)?b(S):(v.status=Je.fail,v.error=I,console.error("compileProgramError: "+I,"\nvertex:\n",u,"\nfragment:\n",l),d.deleteProgram(_))}}e==null||e(v)}else e&&requestAnimationFrame(y)};t.compileResult=v,y()},s.computeShaderCacheId=function(t){var e=t.vertex,r=e===void 0?"":e,a=t.fragment,o=a===void 0?"":a,u=t.shared,l=t.cacheId,h;return u||l?h=l||"shared_"+Su(r,o):h="instanced_"+Lp++,h},s.createProgram=function(t,e,r,a){var o=t.createProgram(),u=this.createGLShader(t,t.VERTEX_SHADER,e),l=this.createGLShader(t,t.FRAGMENT_SHADER,r);return o&&u&&l?(t.attachShader(o,u),t.attachShader(o,l),t.linkProgram(o),a.program=o,a.status=Je.compiling,function(){a.program=void 0;var h=t.getProgramParameter(o,t.LINK_STATUS);if(!h){var c=t.getProgramInfoLog(o);console.error("Failed to link program: "+c+".");var f=wu(t,u,"vertex",e),d=wu(t,l,"fragment",r);return a.status=Je.fail,f&&(a.error=f.error,a.status=f.status),d&&(a.error=d.error,a.status=d.status),o}return o}
7):(a.status=Je.fail,function(){return null})},s.createGLShader=function(t,e,r){var a=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,o=Su(r!=null?r:""),u=a.get(o);if(u)return u;var l=t.createShader(e);return l&&(t.shaderSource(l,r),t.compileShader(l),a.set(o,l)),l},s.deleteShader=function(t){var e=this.programMap[t];e!==void 0&&(e.dispose(),delete this.programMap[t]);var r=this.shaderResults[t];r!==void 0&&delete this.shaderResults[t]},s.restore=function(){},s.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach(function(r){var a=t.programMap[r];a.dispose()}),this.programMap={},this.engine){var e=this.engine.gl;this.glFragShaderMap.forEach(function(r){e.deleteShader(r)}),this.glVertShaderMap.forEach(function(r){e.deleteShader(r)}),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},i}();function wu(i,s,n,t){if(!i.getShaderParameter(s,i.COMPILE_STATUS)){var e=i.getShaderInfoLog(s);return console.error("compile "+n+" error: "+e,(t!=null?t:"").split("\n").map(function(r,a){return a+1+" "+r}).join("\n")),{error:e,status:Je.fail}}}function Su(){for(var i=arguments.length,s=new Array(i),n=0;n<i;n++)s[n]=arguments[n];for(var t=0,e=0;e<arguments.length;e++)for(var r=s[e],a=0;a<r.length;a++)t=Math.imul(31,t)+r.charCodeAt(a)|0;return t}var Np=function(){function i(n,t,e){var r=this;t===void 0&&(t="webgl"),e===void 0&&(e={}),this.canvas=n,this.glType=t,this.restoreHandlers=[],this.lostHandlers=[],ne(n),this.gl=Hh(n,t,e),this.contextLostListener=function(a){for(var o,u=M(r.lostHandlers),l;!(l=u()).done;){var h=l.value;h.lost(a)}(o=r.canvas)==null||o.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(a){for(var o,u=M(r.restoreHandlers),l;!(l=u()).done;){var h=l.value;h.restore()}(o=r.canvas)==null||o.addEventListener("webglcontextlost",r.contextLostListener)},n.addEventListener("webglcontextlost",this.contextLostListener),n.addEventListener("webglcontextrestored",this.contextRestoredListener)}var s=i.prototype;return s.dispose=function(){if(this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl){var t;(t=this.gl.getExtension("WEBGL_lose_context"))==null||t.loseContext()}this.gl=null,this.canvas=null},s.addLostHandler=function(t){this.lostHandlers.push(t)},s.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},s.addRestoreHandler=function(t){this.restoreHandlers.push(t)},s.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},i}(),Vp=function(i){k(s,i);function s(t,e){var r;r=i.call(this,t,e)||this,r.restoreCompositionsCache=[],e=lt({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0,glType:"webgl2"},e),r.context=new Np(t,e.glType,e),r.context.addLostHandler({lost:function(u){var l;(l=r.ticker)==null||l.pause(),r.restoreCompositionsCache=r.compositions.slice(),r.compositions.forEach(function(h){return h.lost(u)}),u.preventDefault(),Nt.error("WebGL context lost. Event target: "+u.target+"."),r.emit("contextlost",{engine:ie(r),e:u})}});var a=ie(r);r.context.addRestoreHandler({restore:vt(function(){var u,l;return pt(this,function(h){switch(h.label){case 0:if(l=a.context.gl,!l)throw new Error("Can not restore automatically because losing gl context.");return a.reset(),a.shaderLibrary=new Eu(a),a.gpuCapability=new yo(l),[4,Promise.all(a.restoreCompositionsCache.map(vt(function(c){var f,d,v,p,g,x,b,y,E,_,S;return pt(this,function(C){switch(C.label){case 0:return f=c.time,d=c.url,v=c.speed,p=c.reusable,g=c.renderOrder,x=c.transform,b=c.videoState,[4,Pl.load(d,a)];case 1:y=C.sent(),y.speed=v,y.reusable=p,y.renderOrder=g,y.transform.setPosition(x.position.x,x.position.y,x.position.z),y.transform.setRotation(x.rotation.x,x.rotation.y,x.rotation.z),y.transform.setScale(x.scale.x,x.scale.y,x.scale.z),y.onItemMessage=c.onItemMessage,E=0,C.label=2;case 2:return E<b.length?b[E]?(_=y.textures[E].source.video,_.currentTime=(S=b[E])!=null?S:0,[4,_.play()]):[3,4]:[3,5];
7case 3:C.sent(),C.label=4;case 4:return E++,[3,2];case 5:return y.isEnded=!1,y.gotoAndPlay(f),[2,y]}})})))];case 1:return h.sent(),a.restoreCompositionsCache=[],(u=a.ticker)==null||u.resume(),Mu()&&a.canvas&&(a.canvas.style.display="none",window.setTimeout(function(){a.canvas.style.display=""},0)),a.emit("contextrestored",a),[2]}})})});var o=r.context.gl;return ne(o),r.gl=o,r.reset(),r.gpuCapability=new yo(o),r.shaderLibrary=new Eu(ie(r)),r.renderer=new Mf(ie(r)),r.maxTextureCount=r.gl.TEXTURE0+r.gl.getParameter(r.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,r.resize(),r}var n=s.prototype;return n.getWidth=function(){return this.gl.drawingBufferWidth},n.getHeight=function(){return this.gl.drawingBufferHeight},n.getShaderLibrary=function(){return this.shaderLibrary},n.createGLFramebuffer=function(e){var r=this.gl.createFramebuffer();if(r)ki(r,e,e);else throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return r},n.createVAO=function(e){var r=new Rl(this,e);return r},n.deleteGLTexture=function(e){e.textureBuffer&&!this.disposed&&(this.gl.deleteTexture(e.textureBuffer),e.textureBuffer=null)},n.deleteGPUBuffer=function(e){e&&!this.disposed&&(this.gl.deleteBuffer(e.glBuffer),delete e.glBuffer)},n.deleteGLFramebuffer=function(e){e&&!this.disposed&&(this.gl.deleteFramebuffer(e.fbo),delete e.fbo)},n.deleteGLRenderbuffer=function(e){e&&!this.disposed&&(this.gl.deleteRenderbuffer(e.buffer),e.buffer=null)},n.drawGeometry=function(e,r,a,o){if(o===void 0&&(o=0),!(!e||!a)){a.initialize(),e.initialize(),e.flush();var u=this.renderingData;a.setMatrix("effects_ObjectToWorld",r);try{a.use(this.renderer,u.currentFrame.globalUniforms)}catch(E){console.error(E),this.renderErrors.add(E);return}var l=this.gl;if(!l){console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.");return}var h=e,c=a.shaderVariant.program,f=c.setupAttributes(h),d=h.indicesBuffer,v=h.drawStart,p=h.drawCount,g=h.mode,x=h.subMeshes;if(x&&x.length){var b=x[o];if(p<0)return;if(v=b.offset,d){var y;p=(y=b.indexCount)!=null?y:0}else p=b.vertexCount}d?l.drawElements(g,p,d.type,v!=null?v:0):l.drawArrays(g,v,p),f==null||f.unbind()}},n.clear=function(e){var r=0;if(e.colorAction===$t.clear){var a=e.clearColor;a&&this.clearColor(a[0],a[1],a[2],a[3]),this.colorMask(!0,!0,!0,!0),r=P.COLOR_BUFFER_BIT}if(e.stencilAction===$t.clear&&(this.stencilMask(255),this.clearStencil(e.clearStencil||0),r=r|P.STENCIL_BUFFER_BIT),e.depthAction===$t.clear){var o=e.clearDepth;this.depthMask(!0),this.clearDepth(Number.isFinite(o)?o:1),r=r|P.DEPTH_BUFFER_BIT}r&&this.gl.clear(r)},n.dispose=function(){var e;this.disposed||(i.prototype.dispose.call(this),this.renderer.dispose(),this.renderTargetPool.dispose(),(e=this.shaderLibrary)==null||e.dispose(),this.context.dispose(),this.reset())},n.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=P.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},n.setSampleAlphaToCoverage=function(e){e?this.enable(P.SAMPLE_ALPHA_TO_COVERAGE):this.disable(P.SAMPLE_ALPHA_TO_COVERAGE)},n.setBlending=function(e){e?this.enable(P.BLEND):this.disable(P.BLEND)},n.setDepthTest=function(e){e?this.enable(P.DEPTH_TEST):this.disable(P.DEPTH_TEST)},n.setStencilTest=function(e){e?this.enable(P.STENCIL_TEST):this.disable(P.STENCIL_TEST)},n.setCulling=function(e){e?this.enable(P.CULL_FACE):this.disable(P.CULL_FACE)},n.setPolygonOffsetFill=function(e){e?this.enable(P.POLYGON_OFFSET_FILL):this.disable(P.POLYGON_OFFSET_FILL)},n.enable=function(e){var r=this.glCapabilityCache[e];r!==!0&&(this.glCapabilityCache[e]=!0,this.gl.enable(e))},n.disable=function(e){var r=this.glCapabilityCache[e];r!==!1&&(this.glCapabilityCache[e]=!1,this.gl.disable(e))},n.bindFramebuffer=function(e,r){this.currentFramebuffer[e]!==r&&(this.currentFramebuffer[e]=r,this.gl.bindFramebuffer(e,r))},n.bindRenderbuffer=function(e,r){this.currentRenderbuffer[e]!==r&&(this.currentRenderbuffer[e]=r,this.gl.bindRenderbuffer(e,r))},n.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},n.useProgram=function(e){this.set1("useProgram",e)},n.clearDepth=function(e){this.set1("clearDepth",e)},n.depthFunc=function(e){this.set1("depthFunc",e)},n.depthMask=function(e){this.set1("depthMask",e)},n.polygonOffset=function(e,r){this.set2("polygonOffset",e,r)},n.depthRange=function(e,r){this.set2("depthRange",e,r)},n.clearStencil=function(e){this.set1("clearStencil",e)},n.stencilMask=function(e){this.stencilMaskSeparate(this.gl.FRONT,e),this.stencilMaskSeparate(this.gl.BACK,e)},n.stencilFunc=function(e,r,a){this.stencilFuncSeparate(this.gl.FRONT,e,r,a),this.stencilFuncSeparate(this.gl.BACK,e,r,a)},n.stencilFuncSeparate=function(e,r,a,o){this.set4("stencilFuncSeparate",e,r,a,o)},n.stencilMaskSeparate=function(e,r){this.set2("stencilMaskSeparate",e,r)},n.stencilOp=function(e,r,a){this.stencilOpSeparate(this.gl.FRONT,e,r,a),this.stencilOpSeparate(this.gl.BACK,e,r,a)},n.stencilOpSeparate=function(e,r,a,o){this.set4("stencilOpSeparate",e,r,a,o)},n.cullFace=function(e){this.set1("cullFace",e)},n.frontFace=function(e){this.set1("frontFace",e)}
7,n.clearColor=function(e,r,a,o){this.set4("clearColor",e,r,a,o)},n.colorMask=function(e,r,a,o){this.set4("colorMask",e,r,a,o)},n.blendColor=function(e,r,a,o){this.set4("blendColor",e,r,a,o)},n.blendFunc=function(e,r){this.blendFuncSeparate(e,r,e,r)},n.blendFuncSeparate=function(e,r,a,o){this.set4("blendFuncSeparate",e,r,a,o)},n.blendEquation=function(e){this.set1("blendEquation",e)},n.blendEquationSeparate=function(e,r){this.set2("blendEquationSeparate",e,r)},n.setPixelStorei=function(e,r){var a=this.pixelStorei[e];a!==r&&(this.pixelStorei[e]=r,this.gl.pixelStorei(e,r))},n.viewport=function(e,r,a,o){this.set4("viewport",e,r,a,o)},n.activeTexture=function(e){e=Math.min(e,this.maxTextureCount),this.activeTextureIndex!==e&&(this.activeTextureIndex=e,this.gl.activeTexture(e))},n.bindTexture=function(e,r,a){(this.currentTextureBinding!==r||a)&&(this.gl.bindTexture(e,r),this.currentTextureBinding=r),this.textureUnitDict[this.activeTextureIndex]=r},n.set1=function(e,r){var a=this.glCapabilityCache[e];a!==r&&(this.glCapabilityCache[e]=r,this.gl[e](r))},n.set2=function(e,r,a){var o=this.glCapabilityCache[e];o||(o=this.glCapabilityCache[e]={x:NaN,y:NaN}),(o.x!==r||o.y!==a)&&this.gl[e](o.x=r,o.y=a)},n.set3=function(e,r,a,o){var u=this.glCapabilityCache[e];u||(u=this.glCapabilityCache[e]={x:NaN,y:NaN,z:NaN}),(u.x!==r||u.y!==a||u.z!==o)&&this.gl[e](u.x=r,u.y=a,u.z=o)},n.set4=function(e,r,a,o,u){var l=this.glCapabilityCache[e];l||(l=this.glCapabilityCache[e]={x:NaN,y:NaN,z:NaN,w:NaN}),(l.x!==r||l.y!==a||l.z!==o||l.w!==u)&&this.gl[e](l.x=r,l.y=a,l.z=o,l.w=u)},n.get=function(e){return this.glCapabilityCache[e]},n.setFloat=function(e,r){e&&this.gl.uniform1f(e,r)},n.setInt=function(e,r){e&&this.gl.uniform1i(e,r)},n.setFloats=function(e,r){e&&this.gl.uniform1fv(e,r)},n.setVector2=function(e,r){this.setFloat2(e,r.x,r.y)},n.setVector3=function(e,r){this.setFloat3(e,r.x,r.y,r.z)},n.setVector4=function(e,r){this.setFloat4(e,r.x,r.y,r.z,r.w)},n.setColor=function(e,r){this.setFloat4(e,r.r,r.g,r.b,r.a)},n.setQuaternion=function(e,r){this.setFloat4(e,r.x,r.y,r.z,r.w)},n.setVector4Array=function(e,r){!e||r.length%4!==0||this.gl.uniform4fv(e,r)},n.setMatrix=function(e,r){e&&this.gl.uniformMatrix4fv(e,!1,r.elements)},n.setMatrix3=function(e,r){e&&this.gl.uniformMatrix3fv(e,!1,r.elements)},n.setMatrixArray=function(e,r){!e||r.length%16!==0||this.gl.uniformMatrix4fv(e,!1,r)},n.setTexture=function(e,r,a){if(e){this.gl.activeTexture(this.gl.TEXTURE0+r);var o=a.target;this.gl.bindTexture(o,a.textureBuffer),this.gl.uniform1i(e,r)}},n.getUniforms=function(e,r){for(var a=[],o=0;o<r.length;o++)a.push(this.gl.getUniformLocation(e,r[o]));return a},n.setFloat4=function(e,r,a,o,u){e&&this.gl.uniform4f(e,r,a,o,u)},n.setFloat3=function(e,r,a,o){e&&this.gl.uniform3f(e,r,a,o)},n.setFloat2=function(e,r,a){e&&this.gl.uniform2f(e,r,a)},s}(Qa);function kp(i,s){return ie(i)}var wn={"Container size overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY","DPI overflowed":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT","Invalid container size":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW","Container is not an HTMLElement":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg","Never use destroyed player again":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr","Current running player count":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ","Create player with different WebGL version":"https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg"};function Dp(){var i=/iPhone OS (\d+)_(\d+)/,s=i.exec(navigator.userAgent);return s?s[1]==="13"||s[1]==="16"&&s[2]==="5":!1}function zp(i){throw new Error(i)}function Bp(i){return Promise.reject(i)}function Up(i,s,n){var t=n.value;return n.value=vt(function(){var e,r,a,o,u,l=arguments;return pt(this,function(h){switch(h.label){case 0:for(e=l.length,r=new Array(e),a=0;a<e;a++)r[a]=l[a];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,t.apply(this,r)];case 2:return o=h.sent(),[2,o];case 3:return u=h.sent(),i.handleThrowError.call(this,u),[3,4];case 4:return[2]}})}),n}var Ji=new Map;function Gp(){for(var i=[],s=M(Ji.values()),n;!(n=s()).done;){var t=n.value;t.paused||i.push(t)}i.length>1&&Nt.error("Current running player count: "+i.length+", see "+wn["Current running player count"]+".",i)}var Wp=1,Fl=function(i){k(s,i);function s(t){var e;e=i.call(this)||this,e.resumePending=!1,e.disposed=!1,e.lost=function(F){e.handleEmitEvent("webglcontextlost",F)};var r=ie(e);e.restore=vt(function(){return pt(this,function(F){return r.emit("webglcontextrestored"),[2]})});var a=t.container,o=t.canvas,u=t.fps,l=t.name,h=t.pixelRatio,c=t.manualRender,f=t.renderFramework,d=t.notifyTouch,v=t.onError,p=t.interactive,g=p===void 0?!1:p,x=t.renderOptions,b=x===void 0?{}:x,y=t.env,E=y===void 0?"":y,_=b.willCaptureImage,S=b.premultipliedAlpha;if(e.onError=v,f==="debug-disable")return kp(e);var C=Dp()?"webgl":"webgl2";f&&(C=f==="webgl"?"webgl":"webgl2"),e.env=E,e.name=l||""+Wp++;var I=!1;try{if($r.length)throw new Error("Errors before player create: "+$r.map(function(F,L){return"\n "+(L+1)+": "+F})+".",{cause:"webgliniterror"});o?(e.canvas=o,I=!0):(Hp(a),e.canvas=document.createElement("canvas"),a.appendChild(e.canvas)),e.container=e.canvas.parentElement,e.engine=Qa.create(e.canvas,{name:l,glType:C,fps:u,env:E,preserveDrawingBuffer:_,premultipliedAlpha:S,manualRender:c,notifyTouch:d,interactive:g,pixelRatio:Number.isFinite(h)?h:Au()}),e.engine.offscreenMode=!0,e.engine.on("rendererror",function(F){e.handleEmitEvent("rendererror",F)}),e.engine.on("contextlost",function(F){e.lost(F.e)});var R=ie(e);e.engine.on("contextrestored",vt(function(){return pt(this,function(F){switch(F.label){case 0:return[4,R.restore(
7)];case 1:return F.sent(),[2]}})})),e.engine.on("click",function(F){var L=F.behavior||ri.NOTIFY;e.emit("click",lt({},F,{player:ie(e),compositionId:F.composition.id,compositionName:F.composition.name})),L===ri.RESUME_PLAYER&&e.resume()}),e.engine.on("pointerdown",function(F){e.emit("pointerdown",F)}),e.engine.on("pointerup",function(F){e.emit("pointerup",F)}),e.engine.on("pointermove",function(F){e.emit("pointermove",F)}),e.engine.runRenderLoop(function(F){e.autoPlaying&&e.emit("update",{player:ie(e),playing:!0})}),Ji.forEach(function(F){F.gpuCapability.type!==e.gpuCapability.type&&Nt.warn("Create player with different WebGL version: old="+F.gpuCapability.type+", new="+e.gpuCapability.type+".\nsee "+wn["Create player with different WebGL version"]+".")}),Ji.set(e.canvas,ie(e)),Gp()}catch(F){var O;e.canvas&&!I&&e.canvas.remove(),(O=e.engine)==null||O.dispose(),e.disposed=!0,e.handleThrowError(F)}return e}var n=s.prototype;return n.setSpeed=function(e){isNaN(e)||(this.engine.speed=e)},n.getSpeed=function(){return this.engine.speed},n.getCompositionByName=function(e){return this.compositions.find(function(r){return r.name===e})},n.getCompositions=function(){return this.compositions.sort(function(e,r){return e.getIndex()-r.getIndex()})},n.getAssetManager=function(){return this.assetManagers},n.loadScene=function(e,r){var a=this;return vt(function(){var o,u,l,h,c,f,d,v,p,g,x;return pt(this,function(b){switch(b.label){case 0:for(ne(a.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),u=(o=r==null?void 0:r.autoplay)!=null?o:!0,u&&(a.autoPlaying=!0),l=[],h=[],wr(e)?(c=l).push.apply(c,[].concat(e)):l.push(e),f=M(a.assetManagers);!(d=f()).done;)v=d.value,v.dispose();return a.engine.assetManagers=[],p=a.engine.compositions.length,[4,Promise.all(l.map(vt(function(y,E){var _,S,C,I,R,O,F;return pt(this,function(L){switch(L.label){case 0:return _=p+E,S=a.assetService.assembleSceneLoadOptions(y,lt({autoplay:u},r)),C=S.source,I=S.options,O=(R=I==null?void 0:I.autoplay)!=null?R:!0,[4,Pl.load(C,a.engine,I)];case 1:return F=L.sent(),F.setIndex(_),F.onItemMessage=function(V){a.emit("message",V)},h[E]=O,[2,F]}})})))];case 1:for(g=b.sent(),x=0;x<g.length;x++)h[x]?g[x].play():g[x].pause();return g.some(function(y){return!y.getPaused()})&&a.emit("play",{time:0}),[2,wr(e)?g:g[0]]}})})()},n.play=function(){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(r){r.play()}),(e=this.ticker)==null||e.start(),this.emit("play",{time:0})},n.gotoAndPlay=function(e){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map(function(r){r.gotoAndPlay(e)}),this.ticker?this.ticker.start():this.tick(0),this.emit("play",{time:e})},n.gotoAndStop=function(e){var r;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map(function(a){a.gotoAndStop(e)}),(!this.ticker||(r=this.ticker)!=null&&r.getPaused())&&this.tick(0),this.emit("pause")},n.playSequence=function(e){for(var r=function(u){e[u].on("end",function(){e[u+1].play()})},a,o=0;o<e.length-1;o++)r(o);e[0].play(),(a=this.ticker)==null||a.start()},n.pause=function(e){var r;this.paused||((r=this.ticker)==null||r.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),this.compositions.map(function(a){a.pause()}),e&&e.offloadTexture&&this.offloadTexture())},n.resume=function(){var e=this;return vt(function(){var r;return pt(this,function(a){switch(a.label){case 0:return e.resumePending?[2]:e.paused?(e.resumePending=!0,[4,Promise.all(e.compositions.map(function(o){return o.reloadTexture()}))]):[3,2];case 1:a.sent(),e.resumePending=!1,e.emit("resume"),a.label=2;case 2:return e.compositions.map(function(o){o.resume()}),(r=e.ticker)==null||r.resume(),[2]}})})()},n.tick=function(e){this.engine.mainLoop(e)},n.resizeToAspect=function(e,r){r===void 0&&(r=1),e!==this.displayAspect&&(this.displayAspect=e),r!==this.displayScale&&(this.displayScale=r),this.resize()},n.resize=function(){this.engine.resize()},n.clearCanvas=function(){this.renderer.clear({stencilAction:$t.clear,clearStencil:0,depthAction:$t.clear,clearDepth:1,colorAction:$t.clear,clearColor:[0,0,0,0]})},n.destroyCurrentCompositions=function(){this.compositions.forEach(function(e){return e.dispose()})},n.dispose=function(){if(Nt.info("Call player destroyed: "+this.name+"."),!this.disposed){Ji.delete(this.canvas),this.pause(),this.engine.dispose(),Z(this.canvas,HTMLCanvasElement)&&(si.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var e=Xp(this.name),r=function(){return zp(e)},a=function(){return Bp(e)};this.tick=r,this.resize=r,this.loadScene=a,this.play=a,this.gotoAndPlay=a,this.gotoAndStop=a,this.playSequence=r,this.destroyCurrentCompositions=r,this.resume=a,this.disposed=!0}},n.offloadTexture=function(){this.compositions.forEach(function(e){return e.offloadTexture()})},n.handleThrowError=function(e){if(this.onError)this.onError(e);else throw e},n.handleEmitEvent=function(e,r){this.onError?Z(r,Event)?this.onError(new Error(r.type,{cause:e}),r):Z(r,Error)?this.onError(new Error(r.message,{cause:e}),r):this.onError(new Error("Unknown error.",{cause:e}),r):(console.warn("["+e+"] event is deprecated, please use 'onError' instead."),this.emit
7(e,r))},Mt(s,[{key:"skipPointerMovePicking",get:function(){return this.engine.eventSystem.skipPointerMovePicking},set:function(e){this.engine.eventSystem.skipPointerMovePicking=e}},{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(e){this.engine.displayAspect=e}},{key:"displayScale",get:function(){return this.engine.displayScale},set:function(e){this.engine.displayScale=e}},{key:"offscreenMode",get:function(){return this.engine.offscreenMode},set:function(e){this.engine.offscreenMode=e}},{key:"pixelRatio",get:function(){return this.engine.pixelRatio},set:function(e){this.engine.pixelRatio=e}},{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var e;return(e=this.ticker)==null?void 0:e.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(e){this.event.enabled=e}}]),s}(Tn);$([Up],Fl.prototype,"loadScene",null);function Hp(i){if(i==null)throw new Error("Container is not an HTMLElement, see "+wn["Container is not an HTMLElement"]+".")}function Xp(i){return"Never use destroyed player: "+i+" again, see "+wn["Never use destroyed player again"]+"."}Wt.create=function(i,s){return new gn(i,s)};Wt.createWithData=function(i,s,n){s===void 0&&(s=Jl("#fff")),n===void 0&&(n={});var t=n.type,e=t===void 0?P.UNSIGNED_BYTE:t,r=n.format,a=r===void 0?P.RGBA:r,o=n.internalFormat,u=n.wrapS,l=u===void 0?P.MIRRORED_REPEAT:u,h=n.wrapT,c=h===void 0?P.MIRRORED_REPEAT:h,f=n.minFilter,d=f===void 0?P.NEAREST:f,v=n.magFilter,p=v===void 0?P.NEAREST:v,g=n.flipY,x=g===void 0?!1:g,b=n.generateMipmap,y=b===void 0?!1:b,E=new gn(i,{data:s,type:e,sourceType:st.data,format:a,internalFormat:o||a,wrapS:l,wrapT:c,minFilter:d,magFilter:p,flipY:x,generateMipmap:y});return E};Qe.create=function(i,s){return new wp(i,s)};ai.create=function(i,s){return new ai(i,s)};ul.create=function(i){return new Nr(i)};ja.create=function(i,s){return new Rp(i,s)};Qa.create=function(i,s){return new Vp(i,s)};var jp="2.9.3";Nt.info("Player version: "+jp+".");const Yp={bg:"!transparent","h-screen":"","w-screen":""},Zp=Ll({__name:"index",setup(i){const s=Nl(!0);async function n(){let t;const e=document.getElementById("J-Container");try{t=new Fl({container:e,interactive:!1}),await t.loadScene("https://cck-data-lovekey.oss-cn-shanghai.aliyuncs.com/h5/popup/index.json")}catch(r){if(console.error("ð ~ file: popup.vue ~ initPlayer ~ err:",r),t==null||t.dispose(),!(e instanceof HTMLDivElement))return;e.style.backgroundImage="url('https://cck-data-lovekey.oss-cn-shanghai.aliyuncs.com/h5/popup/downgrade.png')",e.style.backgroundRepeat="no-repeat",e.style.backgroundSize="cover",e.style.backgroundPosition="center"}}return Vl(async()=>{await n()}),(t,e)=>{const r=Ol;return kl(),Dl("div",Yp,[zl(r,{show:Ul(s),"onUpdate:show":e[0]||(e[0]=a=>Gl(s)?s.value=a:null),bg:"!transparent","close-on-click-overlay":!1},{default:Bl(()=>e[1]||(e[1]=[Wl("div",{id:"J-Container","h-screen":"","w-screen":""},null,-1)])),_:1},8,["show"])])}}}),Kp=Hl(Zp,[["__scopeId","data-v-97275c69"]]);export{Kp as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.