@galacean/effects 2.6.4 → 2.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/weapp.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{crypto as t,screen as e,document as i,window as r,navigator as n,atob as a,Blob as s,WebGL2RenderingContext as o,WebGLRenderingContext as u,XMLHttpRequest as h,HTMLImageElement as l,URL as c,Image as f,performance as d,HTMLVideoElement as p,HTMLCanvasElement as m,location as v,TextDecoder as y,cancelAnimationFrame as g,requestAnimationFrame as x,Event as b}from"@galacean/appx-adapter/weapp";function T(t,e,i,r,n,a,s){try{var o=t[a](s),u=o.value}catch(t){return void i(t)}o.done?e(u):Promise.resolve(u).then(r,n)}function E(t){return function(){var e=this,i=arguments;return new Promise((function(r,n){var a=t.apply(e,i);function s(t){T(a,r,n,s,o,"next",t)}function o(t){T(a,r,n,s,o,"throw",t)}s(void 0)}))}}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function w(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return _(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function C(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):C(t,e)}function A(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function S(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s}function I(t,e){var i,r,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(o){return function(u){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}var R;"function"==typeof SuppressedError&&SuppressedError;var O=new Uint8Array(16);function M(){if(!R&&!(R=void 0!==t&&t.getRandomValues&&t.getRandomValues.bind(t)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return R(O)}for(var N=[],P=0;P<256;++P)N.push((P+256).toString(16).slice(1));var F={randomUUID:void 0!==t&&t.randomUUID&&t.randomUUID.bind(t)};function L(t,e,i){if(F.randomUUID&&!e&&!t)return F.randomUUID();var r=(t=t||{}).random||(t.rng||M)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){i=i||0;for(var n=0;n<16;++n)e[i+n]=r[n];return e}return function(t,e){return void 0===e&&(e=0),N[t[e+0]]+N[t[e+1]]+N[t[e+2]]+N[t[e+3]]+"-"+N[t[e+4]]+N[t[e+5]]+"-"+N[t[e+6]]+N[t[e+7]]+"-"+N[t[e+8]]+N[t[e+9]]+"-"+N[t[e+10]]+N[t[e+11]]+N[t[e+12]]+N[t[e+13]]+N[t[e+14]]+N[t[e+15]]}(r)}function V(t,e){return t.includes(e)||t.push(e),t}function D(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function k(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}}function z(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),s=new t.constructor(a);return s.set(t),s}return t}function U(t,e){var i=[0,0,0,0];if(gt(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else C(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function B(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var a=t[n-1],s=t[n];if(a.stop<=e&&e<=s.stop){r=j(a.color,s.color,(e-a.stop)/(s.stop-a.stop));break}}return r||(r=t[t.length-1].color),i?r.map((function(t){return t/255})):r}return[0,0,0,0]}function G(t){var e=[];if(C(t,Array)?t.forEach((function(t){var i=t[0],r=t[1],n=t[2],a=t[3],s=t[4];e.push({stop:X(i),color:[r,n,a,s]})})):Object.keys(t).forEach((function(i){var r=U(t[i]);e.push({stop:X(i),color:r})})),(e=e.sort((function(t,e){return t.stop-e.stop}))).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var i=e[e.length-1];1!==i.stop&&e.push({stop:1,color:i.color.slice()})}return e}function j(t,e,i,r){var n=[],a=1-i;if(r)for(var s=0;s<4;s++)n[s]=t[s]*a+e[s]*i;else{for(var o=0;o<3;o++)n[o]=Math.round(Math.sqrt(t[o]*t[o]*a+e[o]*e[o]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function X(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function H(){if("object"==typeof e&&"object"==typeof i){var t=Math.max(i.documentElement.clientWidth,r.innerWidth||0),n=e.width/t;return Math.min(2*n,2)}return 1}var W,Y=void 0!==r;function Z(){return!!n.platform&&/iPad|iPhone|iPod/.test(n.platform)}function q(){var t=n.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0}function K(){return/\b[Aa]ndroid\b/.test(n.userAgent)}function Q(){return/\bOpenHarmony\b/.test(n.userAgent)}function J(){return K()||Q()||/\b(iPad|iPhone|iPod)\b/.test(n.userAgent)}function $(){return tt()||et()}function tt(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function et(){return"miniprogram"===r.__wxjs_environment}function it(t){gt(t)&&(t=U(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}function rt(t){var e=128,i={width:e,height:1,data:new Uint8Array(512)},r=i.data,n=G(t);if(n.length){r.set(n[0].color,0);for(var a=1;a<127;a++){for(var s=a/e,o=void 0,u=void 0,h=0;h<n.length&&(o=n[h],u=n[h+1],!(o.stop<=s&&u.stop>s));h++);var l=j(o.color,u.color,(s-o.stop)/(u.stop-o.stop));r.set(l,4*a)}r.set(n[n.length-1].color,508)}return i}function nt(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(i<=30){for(var r=1;r<i;r++)st(t,r,e);return t}return ot(t,e)}function at(t,e,i){return void 0===i&&(i=2),t.includes(e)?t:(t.push(e),1===t.length||1!==i&&st(t,t.length-1,i),t)}function st(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function ot(t,e,i,r){if(void 0===i&&(i=0),void 0===r&&(r=t.length-1),i>=r)return t;for(var n,a=t[i],s=i,o=r;s<o;){if(2===e){for(;t[o].priority>a.priority&&o>=s;)o--;for(;t[s].priority<=a.priority&&s<o;)s++}else{for(;t[o].priority<a.priority&&o>=s;)o--;for(;t[s].priority>=a.priority&&s<o;)s++}var u;u=[t[o],t[s]],t[s]=u[0],t[o]=u[1]}return n=[t[s],t[i]],t[i]=n[0],t[s]=n[1],ot(t,e,i,s-1),ot(t,e,o+1,r),t}function ut(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function ht(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)}function lt(t){return/^[^\d.][\w-]*$/.test(t)}!function(t){t[t.none=1]="none",t[t.ascending=2]="ascending",t[t.descending=3]="descending"}(W||(W={}));var ct,ft=function(){var t=this;this.promise=new Promise((function(e,i){t.resolve=e,t.reject=i}))},dt="[Galacean Effects]";function pt(t){return["%c"+dt,"color: #AA0100",""+t]}var mt,vt={error:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).error.apply(n,[].concat(pt(t),[i])),null==ct||ct("error",t,i)},info:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).debug.apply(n,[].concat(pt(t))),null==ct||ct("info",t,i)},warn:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).warn.apply(n,[].concat(pt(t))),null==ct||ct("warn",t,i)},register:function(t){t&&bt(t)&&(ct=t)}};function yt(){}function gt(t){return"string"==typeof t}!function(t){t[t.destroy=0]="destroy",t[t.keep=1]="keep",t[t.force=0]="force"}(mt||(mt={}));var xt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function bt(t){return"[object Function]"===Object.prototype.toString.call(t)}function Tt(t){return"[object Object]"===Object.prototype.toString.call(t)}function Et(t){if(null===t||"object"!=typeof t)return!1;if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function _t(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function wt(t,e){return t+Math.random()*(e-t)}function Ct(){throw new Error("Destroyed item cannot be used again.")}function At(){return L().replace(/-/g,"")}function St(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=t.split(",")[1]||t,n=a(r),o=[],u=0;u<n.length;u+=512){for(var h=n.slice(u,u+512),l=new Array(h.length),c=0;c<h.length;c++)l[c]=h.charCodeAt(c);var f=new Uint8Array(l);o.push(f)}var d=new s(o,{type:i});return new File([d],e,{type:i})}function It(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)}))}))}var Rt={},Ot=[],Mt={};function Nt(t,e,i){Mt[t]&&vt.error("Duplicate registration for plugin "+t+"."),Mt[t]=i,Rt[t]=e,V(Ot,t)}function Pt(t){delete Mt[t],delete Rt[t],D(Ot,t)}var Ft=function(){function t(t){var e={},i=[];Ot.forEach((function(t){var r=Rt[t];i.includes(r)||(i.push(r),e[t]=r)}));for(var r,n=w(t);!(r=n()).done;){var a=r.value;if(!Rt[a])throw new Error("The plugin '"+a+"' not found."+Vt(a))}this.plugins=Object.keys(e).map((function(t){var e=new(0,Rt[t]);return e.name=t,e})).sort((function(t,e){return t.order-e.order}))}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach((function(i){return i.onCompositionConstructed(t,e)}))},e.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},e.resetComposition=function(t,e){this.plugins.forEach((function(i){return i.onCompositionReset(t,e)}))},e.processRawJSON=function(t,e){var i=this;return E((function(){return I(this,(function(r){return[2,i.callStatic("processRawJSON",t,e)]}))}))()},e.processAssets=function(t,e){var i=this;return E((function(){return I(this,(function(r){return[2,i.callStatic("processAssets",t,e)]}))}))()},e.precompile=function(t,e){for(var i,r=w(this.plugins);!(i=r()).done;){i.value.precompile(t,e)}},e.loadResources=function(t,e){var i=this;return E((function(){return I(this,(function(r){return[2,i.callStatic("prepareResource",t,e)]}))}))()},e.callStatic=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n=this;return E((function(){var e,r,a,s,o,u,h;return I(this,(function(l){for(e=[],r=n.plugins,a=0;a<r.length;a++)s=r[a],o=Rt[s.name],t in o&&e.push(Promise.resolve(null==(h=o[t])?void 0:(u=h).call.apply(u,[].concat([o],i))));return[2,Promise.all(e)]}))}))()},t}(),Lt={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer","rich-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"};function Vt(t){var e=Lt[t];return e?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""}var Dt,kt,zt,Ut,Bt,Gt,jt,Xt,Ht,Wt,Yt,Zt,qt,Kt,Qt=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.precompile=function(t,e){},e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t}();function Jt(t,e){return Jt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Jt(t,e)}function $t(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Jt(t,e)}!function(t){t["1_0"]="1.0",t["1_1"]="1.1",t["1_2"]="1.2",t["1_3"]="1.3",t["1_5"]="1.5",t["1_8"]="1.8",t["2_0"]="2.0",t["2_1"]="2.1",t["2_2"]="2.2",t["2_3"]="2.3",t["2_4"]="2.4",t["3_0"]="3.0",t["3_1"]="3.1",t["3_2"]="3.2",t["3_3"]="3.3",t["3_4"]="3.4",t.LATEST="3.4"}(Dt||(Dt={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(kt||(kt={})),function(t){t[t.ALPHA=0]="ALPHA",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.BRIGHTNESS=3]="BRIGHTNESS",t[t.SUBTRACTION=4]="SUBTRACTION",t[t.STRONG_LIGHT=5]="STRONG_LIGHT",t[t.WEAK_LIGHT=6]="WEAK_LIGHT",t[t.SUPERPOSITION=7]="SUPERPOSITION"}(zt||(zt={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(Ut||(Ut={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Bt||(Bt={})),function(t){t[t.NONE=0]="NONE",t[t.SPHERE=1]="SPHERE",t[t.CONE=2]="CONE",t[t.HEMISPHERE=3]="HEMISPHERE",t[t.CIRCLE=4]="CIRCLE",t[t.DONUT=5]="DONUT",t[t.RECTANGLE=6]="RECTANGLE",t[t.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",t[t.EDGE=8]="EDGE",t[t.TEXTURE=9]="TEXTURE"}(Gt||(Gt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(jt||(jt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Xt||(Xt={})),function(t){t[t.NONE=0]="NONE",t[t.NOTIFY=1]="NOTIFY",t[t.RESUME_PLAYER=2]="RESUME_PLAYER",t[t.REMOVE=3]="REMOVE",t[t.PAUSE=4]="PAUSE"}(Ht||(Ht={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox",t.effect="effect",t.shape="shape",t.postProcessVolume="postProcessVolume",t.node="node",t.video="video",t.audio="audio",t.richtext="richtext"}(Wt||(Wt={})),function(t){t[t.BILLBOARD=0]="BILLBOARD",t[t.MESH=1]="MESH",t[t.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",t[t.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(Yt||(Yt={})),function(t){t[t.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",t[t.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",t[t.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",t[t.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",t[t.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",t[t.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",t[t.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",t[t.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",t[t.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(Zt||(Zt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(qt||(qt={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(Kt||(Kt={}));var te,ee,ie,re,ne,ae,se,oe,ue,he,le,ce,fe,de,pe,me,ve,ye=1,ge=3,xe=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(te||(te={})),function(t){t[t.CONSTANT=0]="CONSTANT",t[t.CONSTANT_VEC2=1]="CONSTANT_VEC2",t[t.CONSTANT_VEC3=2]="CONSTANT_VEC3",t[t.CONSTANT_VEC4=3]="CONSTANT_VEC4",t[t.RANDOM=4]="RANDOM",t[t.LINE=5]="LINE",t[t.CURVE=6]="CURVE",t[t.BEZIER_PATH=7]="BEZIER_PATH",t[t.RGBA_COLOR=8]="RGBA_COLOR",t[t.GRADIENT_COLOR=9]="GRADIENT_COLOR",t[t.SHAPE_POINTS=10]="SHAPE_POINTS",t[t.SHAPE_SPLITS=11]="SHAPE_SPLITS",t[t.LINEAR_PATH=12]="LINEAR_PATH",t[t.COLORS=13]="COLORS",t[t.BINARY=20]="BINARY",t[t.BEZIER_CURVE=21]="BEZIER_CURVE",t[t.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",t[t.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",t[t.COLOR_CURVE=24]="COLOR_CURVE",t[t.VECTOR4_CURVE=25]="VECTOR4_CURVE",t[t.VECTOR2_CURVE=26]="VECTOR2_CURVE",t[t.VECTOR3_CURVE=27]="VECTOR3_CURVE"}(ee||(ee={})),function(t){t[t.AUTO=0]="AUTO",t[t.EASE=1]="EASE",t[t.EASE_IN=2]="EASE_IN",t[t.EASE_OUT=3]="EASE_OUT",t[t.LINE=4]="LINE",t[t.HOLD=5]="HOLD",t[t.LINE_OUT=6]="LINE_OUT"}(ie||(ie={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(re||(re={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(ne||(ne={})),function(t){t[t.RANDOM=0]="RANDOM",t[t.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",t[t.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",t[t.UNIFORM_BURST=3]="UNIFORM_BURST"}(ae||(ae={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(se||(se={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(oe||(oe={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(ue||(ue={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(he||(he={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(le||(le={})),function(t){t.none="none",t.uv="uv",t.normal="normal",t.basecolor="basecolor",t.alpha="alpha",t.metallic="metallic",t.roughness="roughness",t.ao="ao",t.emissive="emissive",t.diffuse="diffuse"}(ce||(ce={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(fe||(fe={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(de||(de={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(pe||(pe={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(me||(me={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(ve||(ve={}));var be,Te,Ee,_e,we,Ce,Ae,Se,Ie,Re,Oe,Me={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};!function(t){t[t.Custom=0]="Custom",t[t.Rectangle=1]="Rectangle",t[t.Ellipse=2]="Ellipse",t[t.Polygon=3]="Polygon",t[t.Star=4]="Star"}(be||(be={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(Te||(Te={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(Ee||(Ee={})),function(t){t.AnimationClipNodeData="AnimationClipNodeData",t.BlendNodeData="BlendNodeData",t.ApplyAdditiveNodeData="ApplyAdditiveNodeData",t.LayerBlendNodeData="LayerBlendNodeData",t.StateMachineNodeData="StateMachineNodeData",t.TransitionNodeData="TransitionNodeData",t.StateNodeData="StateNodeData",t.ConstFloatNodeData="ConstFloatNodeData",t.ConstBoolNodeData="ConstBoolNodeData",t.ControlParameterBoolNodeData="ControlParameterBoolNodeData",t.ControlParameterFloatNodeData="ControlParameterFloatNodeData",t.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",t.NotNodeData="NotNodeData",t.AndNodeData="AndNodeData",t.OrNodeData="OrNodeData",t.EqualNodeData="EqualNodeData",t.GreaterNodeData="GreaterNodeData",t.LessNodeData="LessNodeData"}(_e||(_e={})),function(t){t.video="video",t.image="image"}(we||(we={})),function(t){t.video="video",t.audio="audio"}(Ce||(Ce={})),function(t){t.VFXItemData="VFXItemData",t.Material="Material",t.Shader="Shader",t.Geometry="Geometry",t.Texture="Texture",t.Image="Image",t.AnimationClip="AnimationClip",t.BinaryAsset="BinaryAsset",t.TrackAsset="TrackAsset",t.TimelineAsset="TimelineAsset",t.ObjectBindingTrack="ObjectBindingTrack",t.TransformTrack="TransformTrack",t.SpriteColorTrack="SpriteColorTrack",t.ActivationTrack="ActivationTrack",t.SubCompositionTrack="SubCompositionTrack",t.FloatPropertyTrack="FloatPropertyTrack",t.ColorPropertyTrack="ColorPropertyTrack",t.Vector2PropertyTrack="Vector2PropertyTrack",t.Vector4PropertyTrack="Vector4PropertyTrack",t.TransformPlayableAsset="TransformPlayableAsset",t.SpriteColorPlayableAsset="SpriteColorPlayableAsset",t.ActivationPlayableAsset="ActivationPlayableAsset",t.SubCompositionPlayableAsset="SubCompositionPlayableAsset",t.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",t.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",t.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",t.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",t.MeshComponent="MeshComponent",t.SkyboxComponent="SkyboxComponent",t.LightComponent="LightComponent",t.CameraComponent="CameraComponent",t.ModelPluginComponent="ModelPluginComponent",t.TreeComponent="TreeComponent",t.AnimationComponent="AnimationComponent",t.SpineComponent="SpineComponent",t.VideoComponent="VideoComponent",t.AudioComponent="AudioComponent",t.RichTextComponent="RichTextComponent",t.OrientationComponent="OrientationComponent",t.ShapeComponent="ShapeComponent",t.SpriteComponent="SpriteComponent",t.ParticleSystem="ParticleSystem",t.InteractComponent="InteractComponent",t.CameraController="CameraController",t.PostProcessVolume="PostProcessVolume",t.EffectComponent="EffectComponent",t.TextComponent="TextComponent",t.AnimationGraphAsset="AnimationGraphAsset",t.Animator="Animator",t.TimelineClip="TimelineClip"}(Ae||(Ae={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(Se||(Se={})),function(t){t[t.Float16=0]="Float16",t[t.Float32=1]="Float32",t[t.Int8=2]="Int8",t[t.Int16=3]="Int16",t[t.Int32=4]="Int32",t[t.UInt8=5]="UInt8",t[t.UInt16=6]="UInt16",t[t.UInt32=7]="UInt32"}(Ie||(Ie={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(Re||(Re={})),function(t){t.Position="POSITION",t.Uv="TEXCOORD0",t.Uv2="TEXCOORD1",t.Normal="NORMAL",t.Tangent="TANGENT",t.Color="COLOR",t.Joints="JOINTS",t.Weights="WEIGHTS",t.PositionBS0="POSITION_BS0",t.PositionBS1="POSITION_BS1",t.PositionBS2="POSITION_BS2",t.PositionBS3="POSITION_BS3",t.PositionBS4="POSITION_BS4",t.PositionBS5="POSITION_BS5",t.PositionBS6="POSITION_BS6",t.PositionBS7="POSITION_BS7",t.NormalBS0="NORMAL_BS0",t.NormalBS1="NORMAL_BS1",t.NormalBS2="NORMAL_BS2",t.NormalBS3="NORMAL_BS3",t.TangentBS0="TANGENT_BS0",t.TangentBS1="TANGENT_BS1",t.TangentBS2="TANGENT_BS2",t.TangentBS3="TANGENT_BS3"}(Oe||(Oe={}));var Ne=Dt.LATEST,Pe=Object.freeze({__proto__:null,LATEST_VERSION:Ne,get RenderLevel(){return kt},get BlendingMode(){return zt},get SideMode(){return Ut},get ObscuredMode(){return Bt},get ParticleEmitterShapeType(){return Gt},get PluginType(){return jt},get InteractType(){return Xt},get InteractBehavior(){return Ht},get ItemType(){return Wt},get RenderMode(){return Yt},get ParticleOrigin(){return Zt},get RenderType(){return qt},get RenderFace(){return Kt},get CameraClipMode(){return te},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:ye,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:ge,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:xe,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return ee},get BezierKeyframeType(){return ie},get JSONSceneVersion(){return Dt},get EndBehavior(){return re},get ParticleInteractionBehavior(){return ne},get ShapeArcMode(){return ae},get LightType(){return se},get ModelBoundingType(){return oe},get CameraType(){return ue},get MaterialType(){return he},get MaterialBlending(){return le},get RenderMode3D(){return ce},get TextOverflow(){return fe},get TextBaseline(){return de},get TextAlignment(){return pe},get TextWeight(){return me},get FontStyle(){return ve},BuiltinObjectGUID:Me,get ShapePrimitiveType(){return be},get LineCap(){return Te},get LineJoin(){return Ee},get NodeDataType(){return _e},get BackgroundType(){return we},get MultimediaType(){return Ce},get DataType(){return Ae},get GeometryType(){return Se},get VertexFormatType(){return Ie},get IndexFormatType(){return Re},get VertexBufferSemantic(){return Oe}}),Fe=new Map,Le=new Map,Ve={};function De(t){return Ve[t]}function ke(t){return function(e,i){Ve[t]&&console.warn("Class "+t+" is already registered."),Ve[t]=e}}function ze(t,e){return function(t,e){return function(i,r){var n=function(t){var e=t.constructor;Fe.get(e)||Fe.set(e,{});return Fe.get(e)}(i);n&&(n[r]||(n[r]={type:t,sourceName:e}))}}(t,e)}function Ue(t){var e=t.constructor;if(Le.get(e))return Le.get(e);var i={};Le.set(e,i);for(var r=t,n=e;n;){var a=Fe.get(n);for(var s in a)i[s]=a[s];var o=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(o).constructor)===Object)break;r=o}return i}var Be=function(){function t(t){this.engine=t,this.guid=At(),this.defination={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){},e.dispose=function(){},t.is=function(e){return C(e,t)&&"guid"in e},t}(),Ge=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),je={};function Xe(t){return function(e,i){je[t]&&console.warn("NodeData Class "+t+" is already registered."),je[t]=e}}function He(t){return je[t]}var We,Ye=-1,Ze=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw new Error("Node not initialized!");0==--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw new Error("Node still initialized!");this.lastUpdateID=-1},t}(),qe=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i},t}(),Ke=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.previousTime=0,e.currentTime=0,e}$t(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(Ze),Qe=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.setValue=function(t){},e}(Ze),Je=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qe),$e=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qe),ti=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).nodeDatas=[],e.graphDataSet=new Ge,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=Ye,e}return $t(e,t),e.prototype.fromData=function(t){var i=t,r=i.nodeDatas;this.rootNodeIndex=i.rootNodeIndex,this.controlParameterIDs=i.controlParameterIDs;for(var n=i.controlParameterIDs.length,a=0;a<n;a++)this.parameterLookupMap.set(i.controlParameterIDs[a],a);this.nodeDatas=[];for(var s=0;s<r.length;s++)this.nodeDatas[s]=e.createNodeData(r[s].type),this.nodeDatas[s].load(r[s]);this.graphDataSet=new Ge,this.graphDataSet.resources=[];for(var o,u=w(i.graphDataSet.resources);!(o=u()).done;){var h=o.value,l=this.engine.findObject(h);this.graphDataSet.resources.push(l)}},e.createNodeData=function(t){var e=He(t);if(e)return new e;throw new Error("Unknown node type: "+t+".")},e}(Be);ti=S([ke("AnimationGraphAsset")],ti),function(t){t[t.Active=0]="Active",t[t.Inactive=1]="Inactive"}(We||(We={}));var ei=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),ii=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t].asset=this.nodeDatas[t],this.nodes[t]):null},t}();function ri(){return ri=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},ri.apply(this,arguments)}var ni=2*Math.PI,ai=Math.PI/180,si=180/Math.PI,oi=1e-6;function ui(t,e){return Math.abs(t-e)<oi||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var hi=function(t,e,i){return(1-i)*t+i*e};function li(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,a=Math.min(r,n),s=Math.max(r,n);return Math.min(Math.max(t,a),s)}var ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(di,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=ri({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(qe);ci=S([Xe(_e.AnimationClipNodeData)],ci);var fi,di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).animation=null,e.animatable=null,e}$t(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=li(this.currentTime,0,1);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new pi(e.skeleton,this.animation))},e}(Ke);!function(t){t[t.Position=0]="Position",t[t.Scale=1]="Scale",t[t.Rotation=2]="Rotation",t[t.Euler=3]="Euler"}(fi||(fi={}));var pi=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=w(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var a,s=w(e.scaleCurves);!(a=s()).done;){var o=a.value;this.addTransformCurveInfo(o,1)}for(var u,h=w(e.rotationCurves);!(u=h()).done;){var l=u.value;this.addTransformCurveInfo(l,2)}for(var c,f=w(e.eulerCurves);!(c=f()).done;){var d=c.value;this.addTransformCurveInfo(d,3)}for(var p,m=w(e.floatCurves);!(p=m()).done;){var v=p.value;this.addFloatCurveInfo(v)}for(var y,g=w(e.colorCurves);!(y=g()).done;){var x=y.value;this.addColorCurveInfo(x)}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=li(t,0,this.animationClip.duration),n=w(this.transformCurveInfos);!(i=n()).done;){var a=i.value,s=a.curve.keyFrames.getValue(r),o=e.parentSpaceTransforms[a.boneIndex];switch(a.type){case 0:o.position.copyFrom(s);break;case 1:o.scale.copyFrom(s);break;case 2:o.rotation.copyFrom(s);break;case 3:o.euler.copyFrom(s)}}for(var u,h=w(this.floatCurveInfos);!(u=h()).done;){var l=u.value,c=l.curve.keyFrames.getValue(r);e.floatPropertyValues[l.animatedObjectIndex]=c}for(var f,d=w(this.colorCurveInfos);!(f=d()).done;){var p=f.value,m=p.curve.keyFrames.getValue(r);e.colorPropertyValues[p.animatedObjectIndex]=m}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),mi=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):C(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):C(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):C(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):C(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=oi,e=this.x,i=this.y;return Math.abs(e)<=t&&Math.abs(i)<=t},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();mi.ONE=new mi(1,1),mi.ZERO=new mi(0,0);var vi=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):C(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):C(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):C(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):C(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,s=e.y,o=e.z;return this.x=r*o-n*s,this.y=n*a-i*o,this.z=i*s-r*a,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=oi,e=this,i=e.x,r=e.y,n=e.z;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new mi(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();vi.X=new vi(1,0,0),vi.Y=new vi(0,1,0),vi.Z=new vi(0,0,1),vi.ONE=new vi(1,1,1),vi.ZERO=new vi(0,0,0);var yi=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],a=e[1],s=e[5],o=e[9],u=e[2],h=e[6],l=e[10],c=i+s+l;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(h-o)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>s&&i>l){var d=2*Math.sqrt(1+i-s-l);this.w=(h-o)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(s>l){var p=2*Math.sqrt(1+s-i-l);this.w=(n-u)/p,this.x=(r+a)/p,this.y=.25*p,this.z=(o+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-s);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(o+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=i):(this.x=0,this.y=-t.z,this.z=t.y,this.w=i)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=i),this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(li(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);if(0===i)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,s=e.x,o=e.y,u=e.z,h=e.w;return this.x=i*h+a*s+r*u-n*o,this.y=r*h+a*o+n*s-i*u,this.z=n*h+a*u+i*o-r*s,this.w=a*h-i*s-r*o-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this,r=i.x,n=i.y,a=i.z,s=i.w,o=s*t.w+r*t.x+n*t.y+a*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=s,this.x=r,this.y=n,this.z=a,this;var u=1-o*o;if(u<=Number.EPSILON){var h=1-e;return this.w=h*s+e*this.w,this.x=h*r+e*this.x,this.y=h*n+e*this.y,this.z=h*a+e*this.z,this.normalize(),this}var l=Math.sqrt(u),c=Math.atan2(l,o),f=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this.w=s*f+this.w*d,this.x=r*f+this.x*d,this.y=n*f+this.y*d,this.z=a*f+this.z*d,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this,r=i.x,n=i.y,a=i.z,s=i.w,o=t.x,u=t.y,h=t.z,l=s*o+n*h-a*u,c=s*u+a*o-r*h,f=s*h+r*u-n*o,d=-r*o-n*u-a*h,p=null!=e?e:t;return p.x=l*s+d*-r+c*-a-f*-n,p.y=c*s+d*-n+f*-r-l*-a,p.z=f*s+d*-a+l*-n-c*-r,p},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(vi.ZERO,this,vi.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,i){return(new t).setFromAxisAngle(e,i)},t.fromVector4=function(e){return(new t).setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromRotationMatrix=function(e){return(new t).setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return(new t).setFromUnitVectors(e,i)},t}();yi.tempVec0=new vi;var gi=new yi,xi=function(){},bi=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(xi),Ti=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=gi.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(xi),Ei=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var a=0;a<t.parentSpaceTransforms.length;a++){var s=t.parentSpaceTransforms[a],o=e.parentSpaceTransforms[a],u=r.parentSpaceTransforms[a],h=s.position,l=o.position,c=u.position;n.blendVector3(h,l,i,c);var f=s.rotation,d=o.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=s.scale,v=o.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=s.euler,x=o.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var E=t.floatPropertyValues[T],_=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,_,i)}for(var w=0;w<t.colorPropertyValues.length;w++){var C=t.colorPropertyValues[w],A=e.colorPropertyValues[w],S=r.colorPropertyValues[w];n.blendColor(C,A,i,S)}},t}();Ei.normalBlendFunction=new bi,Ei.additiveBlendFunction=new Ti;var _i=function(){function t(t){this.position=new vi,this.rotation=new yi,this.scale=new vi,this.euler=new vi,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),wi=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=w(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push((new _i).copyFrom(r))}for(var n,a=w(t.defaultFloatPropertyValues);!(n=a()).done;){var s=n.value;this.floatPropertyValues.push(s)}for(var o,u=w(t.defaultColorPropertyValues);!(o=u()).done;){var h=o.value;this.colorPropertyValues.push(h)}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),Ci=function(t){this.pose=new wi(t)},Ai=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Si,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(qe);Ai=S([Xe(_e.ApplyAdditiveNodeData)],Ai);var Si=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new Ci(e.skeleton),this.additiveNodeResult=new Ci(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){Ei.additiveBlend(t,e,i,r)},e}(Ke),Ii=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Ri,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(qe);Ii=S([Xe(_e.BlendNodeData)],Ii);var Ri=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).source0=null,e.source1=null,e.inputParameterValueNode=null,e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new Ci(e.skeleton),this.source1Result=new Ci(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){Ei.localBlend(t,e,i,r)},e}(Ke),Oi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(Mi,t),r=w(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(qe);Oi=S([Xe(_e.AndNodeData)],Oi);var Mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=w(this.conditionNodes);!(e=i()).done;){if(!e.value.getValue(t)){this.result=!1;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=w(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=w(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}($e),Ni=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(Pi,t),r=w(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(qe);Ni=S([Xe(_e.OrNodeData)],Ni);var Pi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=w(this.conditionNodes);!(e=i()).done;){if(e.value.getValue(t)){this.result=!0;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=w(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=w(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}($e),Fi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Ye,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Li,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(qe);Fi=S([Xe(_e.NotNodeData)],Fi);var Li=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.result=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}($e),Vi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Di,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(qe);Vi=S([Xe(_e.ConstFloatNodeData)],Vi);var Di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}return $t(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(Je),ki=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(zi,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(qe);ki=S([Xe(_e.ConstBoolNodeData)],ki);var zi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}return $t(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}($e),Ui=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Bi,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(qe);Ui=S([Xe(_e.ControlParameterFloatNodeData)],Ui);var Bi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(Je),Gi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ji,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(qe);Gi=S([Xe(_e.ControlParameterBoolNodeData)],Gi);var ji=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}($e),Xi=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Hi,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(qe);Xi=S([Xe(_e.ControlParameterTriggerNodeData)],Xi);var Hi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}($e),Wi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNodeIndex=Ye,e.layerDatas=[],e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Yi,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=w(this.layerDatas);!(i=r()).done;){var n=i.value;e.layers.push({inputNode:t.getNode(n.inputNodeIndex),weightValueNode:t.getNode(n.weightValueNodeIndex),weight:0})}},i.load=function(e){var i;if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:Ye,e.layerDatas)for(var r,n=w(e.layerDatas);!(r=n()).done;){var a=r.value;this.layerDatas.push(ri({inputNodeIndex:Ye,weightValueNodeIndex:Ye},a))}},e}(qe);Wi=S([Xe(_e.LayerBlendNodeData)],Wi);var Yi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseLayerNode=null,e.layers=[],e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new Ci(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var r,n=w(this.layers);!(r=n()).done;){var a,s,o=r.value;null==(a=o.inputNode)||a.initialize(e),null==(s=o.weightValueNode)||s.initialize(e)}},i.shutdownInternal=function(e){var i;null==(i=this.baseLayerNode)||i.shutdown(e);for(var r,n=w(this.layers);!(r=n()).done;){var a,s,o=r.value;null==(a=o.inputNode)||a.shutdown(e),null==(s=o.weightValueNode)||s.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()?(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e),e):e},i.updateLayers=function(t,e){for(var i,r=w(this.layers);!(i=r()).done;){var n=i.value;if(n.inputNode&&n.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),n.inputNode.evaluate(t,this.layerNodeResult);var a=n.weightValueNode.getValue(t);Ei.localBlend(e.pose,this.layerNodeResult.pose,a,e.pose)}}return e},e}(Ke),Zi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Ye,e.comparandValueNodeIndex=Ye,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Ki,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(qe);Zi=S([Xe(_e.EqualNodeData)],Zi);var qi,Ki=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}($e),Qi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Ye,e.comparandValueNodeIndex=Ye,e}return $t(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(qe);!function(t){t[t.GreaterThan=0]="GreaterThan",t[t.LessThan=1]="LessThan"}(qi||(qi={}));var Ji=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}($e),$i=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.instantiate=function(t){var e=this.createNode(Ji,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(Qi);$i=S([Xe(_e.GreaterNodeData)],$i);var tr=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.instantiate=function(t){var e=this.createNode(Ji,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(Qi);tr=S([Xe(_e.LessNodeData)],tr);var er=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rr,t);e.defaultStateIndex=this.defaultStateIndex;for(var i,r=w(this.stateDatas);!(i=r()).done;){var n=i.value,a={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};e.states.push(a);for(var s,o=w(n.transitionDatas);!(s=o()).done;){var u=s.value,h={transitionNode:t.getNode(u.transitionNodeIndex),conditionNode:t.getNode(u.conditionNodeIndex),targetStateIndex:u.targetStateIndex};a.transitions.push(h)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex},e}(qe);er=S([Xe(_e.StateMachineNodeData)],er);var ir,rr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).states=[],e.defaultStateIndex=Ye,e.activeTransition=null,e.activeStateIndex=Ye,e}$t(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===We.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=Ye,n=i.transitions.length,a=0;a<n;a++){var s=i.transitions[a];if(s.targetStateIndex===Ye)throw new Error("Invalid target state index.");if(!this.states[s.targetStateIndex].stateNode.isTransitioning()){var o=!1;if(s.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>s.transitionNode.exitTime&&(o=!0)}else null!==s.conditionNode&&s.conditionNode.getValue(t)&&(o=!0);if(o){r=a;break}}}if(r!==Ye){var h=i.transitions[r];h.transitionNode.initialize(t),e=null!==this.activeTransition?h.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):h.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=h.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=h.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=Ye,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=w(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=w(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(Ke);!function(t){t[t.None=0]="None",t[t.TransitioningIn=1]="TransitioningIn",t[t.TransitioningOut=2]="TransitioningOut"}(ir||(ir={}));var nr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNodeIndex=Ye,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(sr,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex},e}(qe);nr=S([Xe(_e.StateNodeData)],nr);var ar,sr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}$t(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(Ke);!function(t){t[t.State=0]="State",t[t.Transition=1]="Transition",t[t.CachedPose=2]="CachedPose"}(ar||(ar={}));var or=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=Ye,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(hr,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(qe);or=S([Xe(_e.TransitionNodeData)],or);var ur,hr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).hasExitTime=!1,e.exitTime=.75,e.transitionLength=0,e.transitionProgress=0,e.blendWeight=0,e.sourceNode=null,e.sourceType=0,e.blendedDuration=0,e}$t(e,t);var i=e.prototype;return i.evaluate=function(t,e){ut(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=li(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=We.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult),a=e;if(this.registerPoseTasksAndUpdateRootMotion(i,n,a),this.blendedDuration=hi(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var s=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+s)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),a},i.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},i.getProgressPercentage=function(){return this.transitionProgress},i.getSourceType=function(){return this.sourceType},i.isSourceATransition=function(){return 1===this.sourceType},i.isSourceAState=function(){return 0===this.sourceType},i.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.getSourceStateNode=function(){return this.sourceNode},i.getSourceTransitionNode=function(){return this.sourceNode},i.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.sourceNodeResult=new Ci(e.skeleton),this.targetNodeResult=new Ci(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},i.shutdownInternal=function(e){this.targetNode.setTransitioningState(ir.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(e),this.sourceNode.shutdown(e),this.sourceNode=null),t.prototype.shutdownInternal.call(this,e)},i.endSourceTransition=function(t){var e,i=this.getSourceTransitionNode().targetNode;null==(e=this.sourceNode)||e.shutdown(t),this.sourceNode=i,this.sourceType=0,this.getSourceStateNode().setTransitioningState(ir.TransitioningOut)},i.initializeTargetStateAndUpdateTransition=function(t,e,i){var r=this;this.markNodeActive(t);var n=this.targetNodeResult;return 0===r.sourceType&&r.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),n=this.targetNode.evaluate(t,n),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,n,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=hi(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},i.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=li(this.blendWeight,0,1))},i.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;Ei.localBlend(t.pose,e.pose,r,i.pose)},e}(Ke);!function(t){t[t.Float=0]="Float",t[t.Color=1]="Color"}(ur||(ur={}));var lr=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=w(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var a,s=w(e.rotation);!(a=s()).done;){var o=a.value;this.addReferenceTransform(o)}for(var u,h=w(e.scale);!(u=h()).done;){var l=u.value;this.addReferenceTransform(l)}for(var c,f=w(e.euler);!(c=f()).done;){var d=c.value;this.addReferenceTransform(d),this.useEuler=!0}for(var p=0;p<e.floats.length;p++){var m=e.floats[p];this.addRecordedProperty(m.path,m.className,m.property,0)}for(var v=0;v<e.colors.length;v++){var y=e.colors[v];this.addRecordedProperty(y.path,y.className,y.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new _i(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n=t+e+i;if(void 0===this.pathToObjectIndex.get(n)){var a=this.findTarget(t);if(a){var s;(s="VFXItem"===e?a:a.getComponent(De(e)))||console.error("The "+e+" Component was not found.");for(var o=i.split("."),u=o[o.length-1],h=s,l=0;l<o.length-1;l++){var c=h[o[l]];void 0===c&&console.error("The "+o[l]+" property of "+h+" was not found."),h=c}var f={target:h,property:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(n,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push(h[u]),this.pathToObjectIndex.set(n,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=w(i);!(e=n()).done;){var a=e.value,s=r.find(a);if(!s)return null;r=s}return r},t}(),cr=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.context=new ei;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=w(t.graphDataSet.resources);!(i=n()).done;){var a=i.value;if(a){for(var s,o=w(a.positionCurves);!(s=o()).done;){var u=s.value;r.position.push(u.path)}for(var h,l=w(a.rotationCurves);!(h=l()).done;){var c=h.value;r.rotation.push(c.path)}for(var f,d=w(a.scaleCurves);!(f=d()).done;){var p=f.value;r.scale.push(p.path)}for(var m,v=w(a.eulerCurves);!(m=v()).done;){var y=m.value;r.euler.push(y.path)}for(var g,x=w(a.floatCurves);!(g=x()).done;){var b=g.value;r.floats.push(b)}for(var T,E=w(a.colorCurves);!(T=E()).done;){var _=T.value;r.colors.push(_)}}}this.skeleton=new lr(e,r),this.result=new Ci(this.skeleton),this.context.skeleton=this.skeleton;var C=new ii;C.nodes=this.nodes,C.nodeDatas=t.nodeDatas,C.dataSet=t.graphDataSet;for(var A=0;A<t.nodeDatas.length;A++)C.nodes[A]||t.nodeDatas[A].instantiate(C);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];C(i,Hi)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),Ye)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);i!==Ye&&this.nodes[i].setValue(e)},t}();function fr(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function dr(t,e,i){return e&&fr(t.prototype,e),i&&fr(t,i),t}var pr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}$t(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onDestroy=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&D(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},dr(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(Be);S([ze()],pr.prototype,"item",void 0),S([ze()],pr.prototype,"_enabled",void 0);var mr=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(pr),vr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).graph=null,e.graphAsset=null,e}$t(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graph&&this.graph.setBool(t,e)},i.setFloat=function(t,e){this.graph&&this.graph.setFloat(t,e)},i.setTrigger=function(t){this.graph&&this.graph.setTrigger(t)},i.resetTrigger=function(t){this.graph&&this.graph.resetTrigger(t)},i.onStart=function(){this.graphAsset&&(this.graph=new cr(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graph){for(var e=this.graph.evaluateGraph(t/1e3),i=this.graph.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,a=e.pose.parentSpaceTransforms[r].rotation,s=e.pose.parentSpaceTransforms[r].scale,o=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(s.x,s.y,s.z),this.graph.skeleton.useEuler?i[r].setRotation(o.x,o.y,o.z):i[r].setQuaternion(a.x,a.y,a.z,a.w)}for(var u=this.graph.skeleton.floatAnimatedObjects,h=0;h<u.length;h++){var l=u[h],c=l.property;l.target[c]=e.pose.floatPropertyValues[h]}for(var f=this.graph.skeleton.colorAnimatedObjects,d=0;d<f.length;d++){var p=f[d],m=p.property;p.target[m]=e.pose.colorPropertyValues[d]}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(pr);vr=S([ke("Animator")],vr);var yr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e._priority=0,e}$t(e,t);var i=e.prototype;return i.render=function(t){},i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},dr(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(pr);S([ze()],yr.prototype,"materials",void 0),S([ze()],yr.prototype,"_priority",void 0);var gr=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(a=t[e+3])?a:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):C(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):C(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):C(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):C(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=oi,e=this,i=e.x,r=e.y,n=e.z,a=e.w;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t&&Math.abs(a)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new vi(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();gr.ONE=new gr(1,1,1,1),gr.ZERO=new gr(0,0,0,0);var xr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).meshCollider=new Ru,e.getHitTestParams=function(t){var i=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,i);var r=e.meshCollider.getBoundingBoxData();if(r)return{type:r.type,triangles:r.area}},e}$t(e,t);var i=e.prototype;return i.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.materials[e],e)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(yr);S([ze()],xr.prototype,"geometry",void 0);var br=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}$t(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new gr;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(xr);br=S([ke(Ae.EffectComponent)],br);var Tr=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return $t(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(pr);S([ze()],Tr.prototype,"bloom",void 0),S([ze()],Tr.prototype,"vignette",void 0),S([ze()],Tr.prototype,"tonemapping",void 0),S([ze()],Tr.prototype,"colorAdjustments",void 0),Tr=S([ke(Ae.PostProcessVolume)],Tr);var Er=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,s=n*(1-Math.abs(a%2-1)),o=0,u=0,h=0;a>=0&&a<=1?(o=n,u=s):a>=1&&a<=2?(o=s,u=n):a>=2&&a<=3?(u=n,h=s):a>=3&&a<=4?(u=s,h=n):a>=4&&a<=5?(o=s,h=n):a>=5&&a<=6&&(o=n,h=s);var l=i-n;return this.set(o+l,u+l,h+l,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):C(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):C(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):C(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):C(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new gr(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,i=e.r,r=e.g,n=e.b,a=e.a,s=Math.max(i,r,n),o=Math.min(i,r,n),u=s-o,h=0,l=0;return 0!==s&&(l=u/s),s!=o&&(s==i?(h=(r-n)/u,r<n&&(h+=6)):s==r?h=(n-i)/u+2:s==n&&(h=(i-r)/u+4),h*=60),new t(h,l,s,a)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),(new t).setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();Er.BLACK=new Er(0,0,0,1),Er.BLUE=new Er(0,0,1,1),Er.CLEAR=new Er(0,0,0,0),Er.CYAN=new Er(0,1,1,1),Er.GRAY=new Er(.5,.5,.5,1),Er.GREEN=new Er(0,1,0,1),Er.MAGENTA=new Er(1,0,1,1),Er.RED=new Er(1,0,0,1),Er.WHITE=new Er(1,1,1,1),Er.YELLOW=new Er(1,.92,.016,1);var _r=function(){function t(t,e,i,r,n,a,s,o,u,h,l,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=1),void 0===s&&(s=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,a,s,o,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,s,o,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=a,v[6]=s,v[7]=o,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,a,s,o,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=a,v[9]=s,v[13]=o,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),a=Math.sin(i),s=1-n,o=r.x,u=r.y,h=r.z,l=s*o,c=s*u;return this.set(l*o+n,l*u+a*h,l*h-a*u,0,l*u-a*h,c*u+n,c*h+a*o,0,l*h+a*u,c*h-a*o,s*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(vi.ZERO,t,vi.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,s=t.tempVec2;s.subtractVectors(e,i),s.normalize(),n.crossVectors(r,s),n.normalize(),a.crossVectors(s,n);var o=this.elements;return o[0]=n.x,o[1]=a.x,o[2]=s.x,o[3]=0,o[4]=n.y,o[5]=a.y,o[6]=s.y,o[7]=0,o[8]=n.z,o[9]=a.z,o[10]=s.z,o[11]=0,o[12]=-n.dot(e),o[13]=-a.dot(e),o[14]=-s.dot(e),o[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],s=i[4],o=i[8],u=i[12],h=i[1],l=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],E=r[4],_=r[8],w=r[12],C=r[1],A=r[5],S=r[9],I=r[13],R=r[2],O=r[6],M=r[10],N=r[14],P=r[3],F=r[7],L=r[11],V=r[15];return n[0]=a*T+s*C+o*R+u*P,n[4]=a*E+s*A+o*O+u*F,n[8]=a*_+s*S+o*M+u*L,n[12]=a*w+s*I+o*N+u*V,n[1]=h*T+l*C+c*R+f*P,n[5]=h*E+l*A+c*O+f*F,n[9]=h*_+l*S+c*M+f*L,n[13]=h*w+l*I+c*N+f*V,n[2]=d*T+p*C+m*R+v*P,n[6]=d*E+p*A+m*O+v*F,n[10]=d*_+p*S+m*M+v*L,n[14]=d*w+p*I+m*N+v*V,n[3]=y*T+g*C+x*R+b*P,n[7]=y*E+g*A+x*O+b*F,n[11]=y*_+g*S+x*M+b*L,n[15]=y*w+g*I+x*N+b*V,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],a=t[1],s=t[5],o=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*o*l-r*u*l-n*s*c+i*u*c+r*s*f-i*o*f)+t[7]*(+e*o*f-e*u*c+n*a*c-r*a*f+r*u*h-n*o*h)+t[11]*(+e*u*l-e*s*f-n*a*l+i*a*f+n*s*h-i*u*h)+t[15]*(-r*s*h-e*o*l+e*s*c+r*a*l-i*a*c+i*o*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],s=t[5],o=t[6],u=t[7],h=t[8],l=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=l*m*u-p*c*u+p*o*f-s*m*f-l*o*v+s*c*v,g=d*c*u-h*m*u-d*o*f+a*m*f+h*o*v-a*c*v,x=h*p*u-d*l*u+d*s*f-a*p*f-h*s*v+a*l*v,b=d*l*o-h*p*o-d*s*c+a*p*c+h*s*m-a*l*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=y*E,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*E,t[2]=(s*m*n-p*o*n+p*r*u-i*m*u-s*r*v+i*o*v)*E,t[3]=(l*o*n-s*c*n-l*r*u+i*c*u+s*r*f-i*o*f)*E,t[4]=g*E,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*E,t[6]=(d*o*n-a*m*n-d*r*u+e*m*u+a*r*v-e*o*v)*E,t[7]=(a*c*n-h*o*n+h*r*u-e*c*u-a*r*f+e*o*f)*E,t[8]=x*E,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*E,t[10]=(a*p*n-d*s*n+d*i*u-e*p*u-a*i*v+e*s*v)*E,t[11]=(h*s*n-a*l*n-h*i*u+e*l*u+a*i*f-e*s*f)*E,t[12]=b*E,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*E,t[14]=(d*s*r-a*p*r-d*i*o+e*p*o+a*i*m-e*s*m)*E,t[15]=(a*l*r-h*s*r+h*i*o-e*l*o-a*i*c+e*s*c)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=vi.ZERO);var n=this.elements,a=e.x,s=e.y,o=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=a+a,d=s+s,p=o+o,m=a*f,v=a*d,y=a*p,g=s*d,x=s*p,b=o*p,T=u*f,E=u*d,_=u*p,w=i.x,C=i.y,A=i.z;return n[0]=(1-(g+b))*w,n[1]=(v+_)*w,n[2]=(y-E)*w,n[3]=0,n[4]=(v-_)*C,n[5]=(1-(m+b))*C,n[6]=(x+T)*C,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=h*n[0]+l*n[4]+c*n[8]-h+t.x,n[13]=h*n[1]+l*n[5]+c*n[9]-l+t.y,n[14]=h*n[2]+l*n[6]+c*n[10]-c+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,a=this.elements,s=n.set(a[0],a[1],a[2]).length(),o=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();this.determinant()<0&&(s=-s),e.x=a[12],e.y=a[13],e.z=a[14];var h=t.tempMat0;h.copyFrom(this);var l=1/s,c=1/o,f=1/u;return h.elements[0]*=l,h.elements[1]*=l,h.elements[2]*=l,h.elements[4]*=c,h.elements[5]*=c,h.elements[6]*=c,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),r.x=s,r.y=o,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new vi,e=new yi,i=new vi;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var s=1/(e-t),o=1/(i-r),u=1/(a-n),h=-(e+t)*s,l=-(i+r)*o,c=-(a+n)*u;s*=2,o*=2,u*=-2;var f=this.elements;return f[0]=s,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=o,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=l,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var a=1/Math.tan(.5*t),s=1/(i-r),o=this.elements;return o[0]=n?a:a/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n?a*e:a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(r+i)*s,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*r*i*s,o[15]=0,null!==r&&r!==1/0||(o[10]=-1,o[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;s.x=a[0]*i+a[4]*r+a[8]*n+a[12],s.y=a[1]*i+a[5]*r+a[9]*n+a[13],s.z=a[2]*i+a[6]*r+a[10]*n+a[14];var o=a[3]*i+a[7]*r+a[11]*n+a[15];return s.multiply(1/o)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n+a[12],s.y=a[1]*i+a[5]*r+a[9]*n+a[13],s.z=a[2]*i+a[6]*r+a[10]*n+a[14],s},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n,s.y=a[1]*i+a[5]*r+a[9]*n,s.z=a[2]*i+a[6]*r+a[10]*n,s.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,s=this.elements,o=null!=e?e:t;return o.x=s[0]*i+s[4]*r+s[8]*n+s[12]*a,o.y=s[1]*i+s[5]*r+s[9]*n+s[13]*a,o.z=s[2]*i+s[6]*r+s[10]*n+s[14]*a,o.w=s[3]*i+s[7]*r+s[11]*n+s[15]*a,o},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!ui(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return(new t).lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,a){return(new t).perspective(e,i,r,n,a)},t.fromColumnVectors=function(e,i,r,n){return(new t).setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromScale=function(e,i,r){return(new t).setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return(new t).setFromTranslation(e,i,r)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return(new t).setFromRotationAxis(e,i)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,i,r){return(new t).setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return(new t).setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,a,s,o,u,h,l,c,f,d,p,m,v){return new t(e,a,h,d,i,s,l,p,r,o,c,m,n,u,f,v)},t}();function wr(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"===e&&((r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}function Cr(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),n=E((function(){return I(this,(function(a){return[2,new Promise((function(a,s){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(e.GPU_DISJOINT_EXT);if(o&&!u){var h=t.getQueryParameter(i,t.QUERY_RESULT);a(h/1e3/1e3)}(o||u)&&(t.deleteQuery(i),i=null),null!==o&&i&&r.setTimeout((function(){n().then(a).catch}),1)}}))]}))}));if(!i)return;return{begin:function(){i&&t.beginQuery(e.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:n}}}_r.IDENTITY=new _r(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),_r.ZERO=new _r(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),_r.tempVec0=new vi,_r.tempVec1=new vi,_r.tempVec2=new vi,_r.tempMat0=new _r;var Ar,Sr,Ir,Rr,Or=[],Mr={},Nr="WebGL Constants not in global, please check your environment";function Pr(){"function"==typeof o?Lr(o):void 0!==u?(Lr(u),Lr(u.prototype)):Y?Or.push(Z()?"iOS16 lockdown mode, WebGL Constants not in global":Nr):Or.push(Nr),Or.length||"HALF_FLOAT"in Mr||(Mr.HALF_FLOAT=5131)}function Fr(t){return void 0!==o&&"WebGL2RenderingContext"===t.constructor.name}function Lr(t){for(var e in t)/^[A-Z_]/.test(e)&&(Mr[e]=t[e])}function Vr(t){switch(t){case Ie.Float32:return u.FLOAT;case Ie.Int16:return u.SHORT;case Ie.Int8:return u.BYTE;case Ie.UInt16:return u.UNSIGNED_SHORT;case Ie.UInt8:return u.UNSIGNED_BYTE;default:return u.FLOAT}}function Dr(t){switch(t){case u.FLOAT:return Ie.Float32;case u.SHORT:return Ie.Int16;case u.BYTE:return Ie.Int8;case u.UNSIGNED_SHORT:return Ie.UInt16;case u.UNSIGNED_BYTE:return Ie.UInt8;default:return Ie.Float32}}function kr(t,e){return null==t?e:t}function zr(t){switch(t){case zt.ALPHA:case zt.ADD:case zt.SUBTRACTION:case zt.STRONG_LIGHT:case zt.WEAK_LIGHT:return 1;case zt.SUPERPOSITION:return 2;case zt.BRIGHTNESS:return 3;case zt.MULTIPLY:return 0;default:return 1}}function Ur(t,e){switch(e){case void 0:case zt.ALPHA:t.blendFunction=[Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA,Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA];break;case zt.ADD:t.blendFunction=[Mr.ONE,Mr.ONE,Mr.ONE,Mr.ONE];break;case zt.SUBTRACTION:t.blendFunction=[Mr.ONE,Mr.ONE,Mr.ZERO,Mr.ONE],t.blendEquation=[Mr.FUNC_REVERSE_SUBTRACT,Mr.FUNC_REVERSE_SUBTRACT];break;case zt.SUPERPOSITION:t.blendFunction=[Mr.ONE,Mr.ONE,Mr.ONE,Mr.ONE];break;case zt.MULTIPLY:t.blendFunction=[Mr.DST_COLOR,Mr.ONE_MINUS_SRC_ALPHA,Mr.DST_COLOR,Mr.ONE_MINUS_SRC_ALPHA];break;case zt.BRIGHTNESS:t.blendFunction=[Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA,Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA];break;case zt.STRONG_LIGHT:t.blendFunction=[Mr.DST_COLOR,Mr.DST_ALPHA,Mr.ZERO,Mr.ONE];break;case zt.WEAK_LIGHT:t.blendFunction=[Mr.DST_COLOR,Mr.ZERO,Mr.ZERO,Mr.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Br(t,e){e===Ut.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=Mr.CW,t.cullFace=e===Ut.BACK?Mr.BACK:Mr.FRONT)}function Gr(t,e){switch(e){case void 0:t.stencilTest=!1;break;case Sr.MASK:t.stencilTest=!0,t.stencilFunc=[Mr.ALWAYS,Mr.ALWAYS],t.stencilOpZPass=[Mr.REPLACE,Mr.REPLACE];break;case Sr.OBSCURED:t.stencilTest=!0,t.stencilFunc=[Mr.EQUAL,Mr.EQUAL];break;case Sr.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[Mr.NOTEQUAL,Mr.NOTEQUAL];break;case Sr.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}Or.length||Pr(),function(t){t[t.vertex=0]="vertex",t[t.fragment=1]="fragment"}(Ar||(Ar={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Sr||(Sr={})),function(t){t[t.whatever=0]="whatever",t[t.clear=2]="clear"}(Ir||(Ir={})),function(t){t[t.none=0]="none",t[t.data=1]="data",t[t.image=2]="image",t[t.compressed=3]="compressed",t[t.video=4]="video",t[t.canvas=5]="canvas",t[t.framebuffer=6]="framebuffer",t[t.mipmaps=7]="mipmaps"}(Rr||(Rr={}));var jr=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.download=function(t,e,i,r){var n=this;if(void 0===e&&(e="json"),!this.start(t,i,r)){var a=new h,s=function(){n.finish(t,a.status,a.response)};a.responseType=e,a.addEventListener("load",(function(){200==a.status?n.finish(t,200,a.response):s()})),a.addEventListener("error",s),a.open("GET",t,!0),a.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(t,e,i){var r=this.callbacks[t];delete this.callbacks[t];for(var n=200==e?[i]:[e,i],a=n.length-1,s=r.length;a<s;a+=2)r[a].apply(null,n)},t}(),Xr=!1,Hr=!1;function Wr(t,e){return Yr.apply(this,arguments)}function Yr(){return(Yr=E((function(t,e){return I(this,(function(i){switch(i.label){case 0:return!Xr&&e?[3,2]:[4,Kr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,Kr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Xr=!0,[4,Kr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Zr(t,e){return qr.apply(this,arguments)}function qr(){return(qr=E((function(t,e){return I(this,(function(i){switch(i.label){case 0:return!Hr&&e?[3,2]:[4,Kr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,Kr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Hr=!0,[4,Kr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Kr(t){return Qr.apply(this,arguments)}function Qr(){return(Qr=E((function(t){var e,i;return I(this,(function(r){if(e="",C(t,l)){if(t.complete)return[2,t];e=t.src}else C(t,s)?(e=c.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,r){var n=new f;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&c.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&c.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e}))]}))}))).apply(this,arguments)}function Jr(t){return $r.apply(this,arguments)}function $r(){return($r=E((function(t){return I(this,(function(e){return[2,new Promise((function(e,i){(new jr).downloadBinary(t,e,(function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function tn(t){return en.apply(this,arguments)}function en(){return(en=E((function(t){return I(this,(function(e){return[2,new Promise((function(e,i){(new jr).downloadBlob(t,e,(function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function rn(t){return nn.apply(this,arguments)}function nn(){return(nn=E((function(t){var e;return I(this,(function(r){return e=i.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,K()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,i){var r=e.play().catch((function(t){i(t)}));r?r.then((function(){return t(e)})):e.addEventListener("loadeddata",(function i(){t(e),e.removeEventListener("loadeddata",i)}),!0),e.addEventListener("error",(function(t){i("Load video fail.")}))}))]}))}))).apply(this,arguments)}function an(t,e){return sn.apply(this,arguments)}function sn(){return(sn=E((function(t,e){return I(this,(function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 4:return[2,i.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function on(t,e,i){return un.apply(this,arguments)}function un(){return(un=E((function(t,e,i,r){var n,a,s,o,u,h,l,c,f;return I(this,(function(d){switch(d.label){case 0:return void 0===r&&(r=[]),34067!==t.target?[3,2]:(n=t.mipmaps,a=t.target,s=n.map((function(t){return Promise.all(t.map((function(t){return t.id?i[t.id]:hn(t,e)})))})),[4,Promise.all(s)]);case 1:return o=d.sent(),[2,ri({keepImageSource:!1},t,{mipmaps:o,sourceFrom:{target:a,type:Rr.mipmaps}})];case 2:return u=t.mipmaps,h=t.target,l=u.map((function(t){return hn(t,e)})),[4,Promise.all(l)];case 3:return c=d.sent(),f=r[u[0][1][0]].url,[2,ri({keepImageSource:!1},t,{mipmaps:c,sourceType:Rr.mipmaps,sourceFrom:{target:h,bin:f,type:Rr.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function hn(t,e){return ln.apply(this,arguments)}function ln(){return ln=E((function(t,e){var i,r,n,a,o;return I(this,(function(u){if(i=t[1],r=i[0],n=i[1],a=i[2],!(o=e[r]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,Kr(new s([new Uint8Array(o,n,a)]))]}))})),ln.apply(this,arguments)}var cn=1,fn=function(t){function e(e){var i;return(i=t.call(this,e)||this).destroyed=!1,i.id="Tex"+cn++,i}$t(e,t);var i=e.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(t){var e=t.target,i=void 0===e?Mr.TEXTURE_2D:e,r=t.format,n=void 0===r?Mr.RGBA:r;return t.sourceType||(t.sourceType="image"in t?Rr.image:"data"in t?Rr.data:"video"in t?Rr.video:0),ri({minFilter:Mr.NEAREST,magFilter:Mr.NEAREST,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE,target:i,format:Mr.RGBA,internalFormat:n,type:Mr.UNSIGNED_BYTE},t)},e.fromImage=function(t,i,r){return E((function(){var n,a;return I(this,(function(s){switch(s.label){case 0:return[4,Kr(t)];case 1:return n=s.sent(),(a=e.create(i,ri({sourceType:Rr.image,image:n,target:Mr.TEXTURE_2D,id:At(),flipY:!0},r))).initialize(),[2,a]}}))}))()},e.fromVideo=function(t,i,r){return E((function(){var n,a;return I(this,(function(s){switch(s.label){case 0:return[4,rn(t)];case 1:return n=s.sent(),(a=e.create(i,ri({sourceType:Rr.video,video:n,id:At(),flipY:!0},r))).initialize(),[2,a]}}))}))()},dr(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Be);function dn(t,e,i,r){var n,a,s=e.length/i/r;return a=n=4===s||0===s?Mr.RGBA:3===s?Mr.RGB:2===s?Mr.LUMINANCE_ALPHA:Mr.LUMINANCE,fn.createWithData(t,{data:e,width:i,height:r},{type:Mr.HALF_FLOAT,format:n,internalFormat:a,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE})}var pn={type:Mr.UNSIGNED_BYTE,format:Mr.RGBA,internalFormat:Mr.RGBA,wrapS:Mr.MIRRORED_REPEAT,wrapT:Mr.MIRRORED_REPEAT,minFilter:Mr.NEAREST,magFilter:Mr.NEAREST};function mn(t){return fn.create(t,ri({id:Me.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:Rr.data},pn))}function vn(t){return fn.create(t,ri({id:Me.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:Rr.data},pn))}var yn=function(){function t(t,e,i){void 0===i&&(i=0),this.arrayBuffer=t,this.baseOffset=i;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==r[0]||75!==r[1]||84!==r[2]||88!==r[3]||32!==r[4]||49!==r[5]||49!==r[6]||187!==r[7]||13!==r[8]||10!==r[9]||26!==r[10]||10!==r[11])throw new Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),s=67305985===a.getUint32(0,!0);this.glType=a.getUint32(1*n,s),this.glTypeSize=a.getUint32(2*n,s),this.glFormat=a.getUint32(3*n,s),this.glInternalFormat=a.getUint32(4*n,s),this.glBaseInternalFormat=a.getUint32(5*n,s),this.pixelWidth=a.getUint32(6*n,s),this.pixelHeight=a.getUint32(7*n,s),this.pixelDepth=a.getUint32(8*n,s),this.numberOfArrayElements=a.getUint32(9*n,s),this.numberOfFaces=a.getUint32(10*n,s),this.numberOfMipmapLevels=a.getUint32(11*n,s),this.bytesOfKeyValueData=a.getUint32(12*n,s),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:vt.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+"."):vt.warn("Texture arrays not currently supported."):vt.warn("Only 2D textures currently supported.")}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,s=0;s<a;s++){for(var o=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,o);e.push({data:h,width:r,height:n}),i+=o+4,i+=3-(o+3)%4}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function gn(t){var e=new yn(t,1),i=e.numberOfMipmapLevels,r=e.pixelWidth,n=e.pixelHeight,a=e.glType,s=e.numberOfFaces,o=e.glInternalFormat,u=e.glFormat,h=i>=Math.floor(Math.log2(Math.max(r,n))+1);return{sourceType:Rr.compressed,type:a,target:6===s?Mr.TEXTURE_CUBE_MAP:Mr.TEXTURE_2D,internalFormat:o,format:u,mipmaps:e.mipmaps(h)}}var xn,bn=function(){function t(){this.reloadPending={}}var e=t.prototype;return e.reload=function(t){var e=this;return E((function(){var i,r;return I(this,(function(n){switch(n.label){case 0:return i=t.id,e.reloadPending[i]?[2]:t.sourceFrom?(e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},e.canOffloadTexture=function(t){if(t){var e=t.type;if(e===Rr.compressed||e===Rr.image){var i=t.target,r=t.map,n=t.url;return i===Mr.TEXTURE_CUBE_MAP?"object"==typeof r&&!!r:gt(n)&&n.length>0}if(e===Rr.mipmaps){var a=t.bin,s=t.mipmaps,o=t.target,u=t.maps,h=t.urls;return a?s.length>0:o===Mr.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return gt(t)&&t.length>0}))}}return!1},e.loadSource=function(t,e){var i=this;return E((function(){var r,n,a,s,o,u,h,l,c,f,d,p,m,v,y,g,x;return I(this,(function(b){switch(b.label){case 0:return r=t.type,n=t.target,a=t.map,s=t.url,o=t.bin,u=t.mipmaps,h=t.urls,l=t.maps,n!==Mr.TEXTURE_CUBE_MAP||r===Rr.mipmaps?[3,2]:[4,i.loadCubeMap(a)];case 1:return c=b.sent(),[2,ri({},e,{cube:c,target:Mr.TEXTURE_CUBE_MAP,sourceType:Rr.image,sourceFrom:{type:Rr.image,map:ri({},a),target:Mr.TEXTURE_CUBE_MAP}})];case 2:return r!==Rr.image?[3,4]:[4,Kr(s)];case 3:return f=b.sent(),[2,ri({},e,{image:f,sourceType:Rr.image,sourceFrom:{type:r,url:s,target:Mr.TEXTURE_2D}})];case 4:return r!==Rr.video?[3,6]:[4,rn(s)];case 5:return d=b.sent(),[2,ri({},e,{video:d,sourceType:Rr.video})];case 6:return r!==Rr.compressed?[3,8]:[4,Jr(s)];case 7:return[2,ri({},gn(b.sent()),e,{sourceFrom:{url:s,type:Rr.compressed}})];case 8:return r!==Rr.mipmaps?[3,17]:o?[4,Jr(o)]:[3,13];case 9:return p=b.sent(),m=null!=n?n:Mr.TEXTURE_2D,v=m===Mr.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==Mr.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(u.map((function(t){return i.loadMipmapImages(t,p)})))];case 10:return y=b.sent(),[3,12];case 11:y=i.loadMipmapImages(u,p),b.label=12;case 12:return[2,ri({},e,{mipmaps:y,target:m,sourceType:Rr.mipmaps,sourceFrom:{bin:o,mipmaps:v,target:m,type:Rr.mipmaps}})];case 13:return n!==Mr.TEXTURE_2D&&n?[3,15]:[4,Promise.all(h.map((function(t){return Kr(t)})))];case 14:return g=b.sent(),[2,ri({},e,{mipmaps:g,target:Mr.TEXTURE_2D,sourceType:Rr.mipmaps,sourceFrom:{type:r,urls:h.slice(),target:Mr.TEXTURE_2D}})];case 15:return n!==Mr.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(l.map((function(t){return i.loadCubeMap(t)})))];case 16:return x=b.sent(),[2,ri({},e,{mipmaps:x,target:Mr.TEXTURE_CUBE_MAP,sourceType:Rr.mipmaps,sourceFrom:{type:r,maps:l.map((function(t){return ri({},t)})),target:Mr.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: "+r+".")}}))}))()},e.loadMipmapImages=function(t,e){return E((function(){return I(this,(function(i){return[2,Promise.all(t.map((function(t){return Kr(new s([new Uint8Array(e,t[0],t[1])]))})))]}))}))()},e.loadCubeMap=function(t){return E((function(){return I(this,(function(e){return[2,Promise.all(t.map((function(t){return Kr(t)})))]}))}))()},t}();function Tn(){return xn||(xn=new bn),xn}function En(t){xn=t}var _n,wn=function(){function t(t){this.destroyed=!1;var e=t.name,i=void 0===e?"defaultDataBlock":e;this.name=i}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(i){e.setUniformValue(i,t[i])}))},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function Cn(t){return"object"==typeof t&&t&&void 0===t.length&&C(t,fn)}function An(t){return t&&void 0!==t.length&&Cn(t[0])}!function(t){t[t.normal=0]="normal",t[t.transformFeedback=1]="transformFeedback"}(_n||(_n={}));var Sn,In,Rn=1,On=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,a=void 0===n?"Material"+Rn++:n,s=i.renderType,o=void 0===s?0:s,u=i.shader,h=i.uniformSemantics;r.name=a,r.renderType=o,r.shaderSource=u,r.props=i,r.uniformSemantics=ri({},h)}else r.name="Material"+Rn++,r.renderType=0;return r}$t(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},dr(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(Be),Mn=function(){function t(t){this.engine=t,this.alphaMaskEnabled=!1,this.maskMode=Sr.NONE,this.maskable=null,this.stencilClearAction={stencilAction:Ir.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.setMaskOptions=function(t){var e=t.isMask,i=void 0!==e&&e,r=t.inverted,n=void 0!==r&&r,a=t.reference,s=t.alphaMaskEnabled,o=void 0!==s&&s;this.alphaMaskEnabled=o,i?this.maskMode=Sr.MASK:(this.maskMode=n?Sr.REVERSE_OBSCURED:Sr.OBSCURED,this.maskable=this.engine.findObject(a))},e.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},t}();!function(t){t[t.noShader=0]="noShader",t[t.success=1]="success",t[t.fail=2]="fail",t[t.compiling=3]="compiling"}(Sn||(Sn={})),function(t){t.GLSL1="100",t.GLSL3="300 es"}(In||(In={}));var Nn=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return $t(e,t),e}(Be),Pn=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=w(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(Be);Pn=S([ke(Ae.Shader)],Pn);var Fn="effects-internal-copy",Ln="effects-internal-copy-mesh",Vn="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",Dn="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function kn(t,e){return{name:Fn,vertex:Vn,fragment:Dn,glslVersion:2===t?In.GLSL3:In.GLSL1,macros:[["DEPTH_TEXTURE",!!e]],cacheId:Ln+ +e}}var zn,Un,Bn={format:Mr.RGBA,type:Mr.UNSIGNED_BYTE,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE},Gn=Symbol("dispose"),jn=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,i=t.width,r=t.height,n=t.name,a={sourceType:Rr.framebuffer,data:{width:i,height:r},name:n},s=[n];Object.getOwnPropertyNames(Bn).forEach((function(e){var i,r=null!=(i=t[e])?i:Bn[e];a[e]=r,s.push(e,r)}));var o=s.join(":"),u=this.textureCache[o];if(u)this.textureRef[o]++;else{var h=this.engine;ut(h),u=fn.create(h,a),this.textureCache[o]=u,this.textureRef[o]=1,u[Gn]=u.dispose,u.dispose=function(){return e.removeTexture(o)}}return u},e.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[Gn](),i.dispose=i[Gn]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var i=t.textureCache[e];i[Gn](),i.dispose=i[Gn]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Xn=function(){function t(t){void 0===t&&(t={}),this.semantics=ri({},t)}var e=t.prototype;return e.toObject=function(){return ri({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var i=this.semantics[t];return bt(i)?i(e):i},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach((function(e){delete t.semantics[e]}))},t}(),Hn=((zn={})[Mr.FLOAT]=Float32Array.BYTES_PER_ELEMENT,zn[Mr.INT]=Int32Array.BYTES_PER_ELEMENT,zn[Mr.SHORT]=Int16Array.BYTES_PER_ELEMENT,zn[Mr.BYTE]=Int8Array.BYTES_PER_ELEMENT,zn),Wn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}$t(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(Be);function Yn(t){return t===Mr.INT?new Int32Array(0):t===Mr.SHORT?new Int16Array(0):new Float32Array(0)}!function(t){t[t.XYZ=0]="XYZ",t[t.XZY=1]="XZY",t[t.YXZ=2]="YXZ",t[t.YZX=3]="YZX",t[t.ZXY=4]="ZXY",t[t.ZYX=5]="ZYX"}(Un||(Un={}));var Zn=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],a=i[8],s=i[1],o=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case Un.XYZ:this.y=Math.asin(li(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,o),this.z=0);break;case Un.YXZ:this.x=Math.asin(-li(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(a,c),this.z=Math.atan2(s,o)):(this.y=Math.atan2(-h,r),this.z=0);break;case Un.ZXY:this.x=Math.asin(li(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,o)):(this.y=0,this.z=Math.atan2(s,r));break;case Un.ZYX:this.y=Math.asin(-li(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(l,c),this.z=Math.atan2(s,r)):(this.x=0,this.z=Math.atan2(-n,o));break;case Un.YZX:this.z=Math.asin(li(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,o),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case Un.XZY:this.z=Math.asin(-li(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(l,o),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=si,this.y*=si,this.z*=si,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,a,s;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(a=t[e+2])?a:0,this.order=null!=(s=t[e+3])?s:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?(console.error("add euler with different order"),this):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},e.addEulers=function(t,e){return t.order!=e.order?(console.error("add euler with different order"),this):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order,this)},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new yi;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this,i=e.x,r=e.y,n=e.z,a=e.order,s=Math.cos(i*ai*.5),o=Math.cos(r*ai*.5),u=Math.cos(n*ai*.5),h=Math.sin(i*ai*.5),l=Math.sin(r*ai*.5),c=Math.sin(n*ai*.5);switch(a){case Un.XYZ:t.set(h*o*u+s*l*c,s*l*u-h*o*c,s*o*c+h*l*u,s*o*u-h*l*c);break;case Un.YXZ:t.set(h*o*u+s*l*c,s*l*u-h*o*c,s*o*c-h*l*u,s*o*u+h*l*c);break;case Un.ZXY:t.set(h*o*u-s*l*c,s*l*u+h*o*c,s*o*c+h*l*u,s*o*u-h*l*c);break;case Un.ZYX:t.set(h*o*u-s*l*c,s*l*u+h*o*c,s*o*c-h*l*u,s*o*u+h*l*c);break;case Un.YZX:t.set(h*o*u+s*l*c,s*l*u+h*o*c,s*o*c-h*l*u,s*o*u-h*l*c);break;case Un.XZY:t.set(h*o*u-s*l*c,s*l*u-h*o*c,s*o*c+h*l*u,s*o*u+h*l*c);break;default:console.error("unknown euler order: "+a)}return t},e.toMatrix4=function(t){var e=t.elements,i=this,r=i.x,n=i.y,a=i.z,s=i.order,o=Math.cos(r*ai),u=Math.sin(r*ai),h=Math.cos(n*ai),l=Math.sin(n*ai),c=Math.cos(a*ai),f=Math.sin(a*ai);if(s===Un.XYZ){var d=o*c,p=o*f,m=u*c,v=u*f;e[0]=h*c,e[4]=-h*f,e[8]=l,e[1]=p+m*l,e[5]=d-v*l,e[9]=-u*h,e[2]=v-d*l,e[6]=m+p*l,e[10]=o*h}else if(s===Un.YXZ){var y=h*c,g=h*f,x=l*c,b=l*f;e[0]=y+b*u,e[4]=x*u-g,e[8]=o*l,e[1]=o*f,e[5]=o*c,e[9]=-u,e[2]=g*u-x,e[6]=b+y*u,e[10]=o*h}else if(s===Un.ZXY){var T=h*c,E=h*f,_=l*c,w=l*f;e[0]=T-w*u,e[4]=-o*f,e[8]=_+E*u,e[1]=E+_*u,e[5]=o*c,e[9]=w-T*u,e[2]=-o*l,e[6]=u,e[10]=o*h}else if(s===Un.ZYX){var C=o*c,A=o*f,S=u*c,I=u*f;e[0]=h*c,e[4]=S*l-A,e[8]=C*l+I,e[1]=h*f,e[5]=I*l+C,e[9]=A*l-S,e[2]=-l,e[6]=u*h,e[10]=o*h}else if(s===Un.YZX){var R=o*h,O=o*l,M=u*h,N=u*l;e[0]=h*c,e[4]=N-R*f,e[8]=M*f+O,e[1]=f,e[5]=o*c,e[9]=-u*c,e[2]=-l*c,e[6]=O*f+M,e[10]=R-N*f}else if(s===Un.XZY){var P=o*h,F=o*l,L=u*h,V=u*l;e[0]=h*c,e[4]=-f,e[8]=l*c,e[1]=P*f+V,e[5]=o*c,e[9]=F*f-L,e[2]=L*f-F,e[6]=u*c,e[10]=V*f+P}else console.error("toMatrix4: Invalid order "+s);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromArray(e,i,r)},t}();Zn.DEFAULT_ORDER=Un.ZYX,Zn.tempQuat0=new yi,Zn.tempMat0=new _r;var qn=function(){function t(t,e,i,r,n,a,s,o,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,s,o,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,s,o,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=s,h[1]=e,h[4]=n,h[7]=o,h[2]=i,h[5]=a,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,s,o,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=a,h[2]=s,h[5]=o,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,a=e+e,s=i+i,o=r+r,u=e*a,h=e*s,l=e*o,c=i*s,f=i*o,d=r*o,p=n*a,m=n*s,v=n*o,y=this.elements;return y[0]=1-(c+d),y[1]=h+v,y[2]=l-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=l+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],a=r[3],s=r[6],o=r[1],u=r[4],h=r[7];return r[0]=e*n+i*o,r[3]=e*a+i*u,r[6]=e*s+i*h,r[1]=-i*n+e*o,r[4]=-i*a+e*u,r[7]=-i*s+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],s=i[3],o=i[6],u=i[1],h=i[4],l=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],E=r[8];return n[0]=a*p+s*y+o*b,n[3]=a*m+s*g+o*T,n[6]=a*v+s*x+o*E,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*E,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],s=t[7],o=t[2],u=t[5],h=t[8];return e*(a*h-u*s)+n*(u*r-i*h)+o*(i*s-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],s=t[7],o=t[2],u=t[5],h=t[8],l=h*a-u*s,c=u*r-h*i,f=s*i-a*r,d=e*l+n*c+o*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(o*s-h*n)*p,t[2]=(u*n-o*a)*p,t[3]=c*p,t[4]=(h*e-o*r)*p,t[5]=(o*i-u*e)*p,t[6]=f*p,t[7]=(n*r-s*e)*p,t[8]=(a*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[3]*r+a[6]*n,s.y=a[1]*i+a[4]*r+a[7]*n,s.z=a[2]*i+a[5]*r+a[8]*n,s},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!ui(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return(new t).setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,a,s,o,u,h){return new t(e,n,o,i,a,u,r,s,h)},t}(),Kn=function(){function t(t,e){void 0===t&&(t=vi.ZERO),void 0===e&&(e=vi.X),this.origin=new vi,this.direction=new vi,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new vi;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,s,o,u=this.origin,h=u.x,l=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,E=b.y,_=b.z,w=1/d,C=1/p,A=1/m;if(w>=0?(i=(y-h)*w,r=(T-h)*w):(i=(T-h)*w,r=(y-h)*w),C>=0?(n=(g-l)*C,a=(E-l)*C):(n=(E-l)*C,a=(g-l)*C),!(i>a||n>r||((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),A>=0?(s=(x-c)*A,o=(_-c)*A):(s=(_-c)*A,o=(x-c)*A),i>o||s>r||((s>i||i!=i)&&(i=s),(o<r||r!=r)&&(r=o),r<0))))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new vi).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),s=n.dot(n)-a*a,o=e.radius*e.radius;if(!(s>o)){var u=Math.sqrt(o-s),h=a-u,l=a+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,s=e.p1,o=e.p2,u=t.tempVec0.subtractVectors(s,a),h=t.tempVec1.subtractVectors(o,a),l=t.tempVec2.subtractVectors(this.origin,a),c=t.tempVec3.crossVectors(u,h),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(l,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(l);var p=n*this.direction.dot(u);if(!(p<0||d+p>f)){var m=-n*l.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();Kn.tempVec0=new vi,Kn.tempVec1=new vi,Kn.tempVec2=new vi,Kn.tempVec3=new vi;var Qn,Jn,$n=function(){function t(t,e){void 0===t&&(t=new vi(1/0,1/0,1/0)),void 0===e&&(e=new vi(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,a=-1/0,s=-1/0,o=0,u=t.length;o<u;o+=3){var h=t[o],l=t[o+1],c=t[o+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>a&&(a=l),c>s&&(s=c)}return this.min.set(e,i,r),this.max.set(n,a,s),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return(new t).copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new vi),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new vi),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,a=0,s=n.length;a<s;a++)this.expandByObject(n[a]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new vi),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){var e=new vi;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new vi),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new vi),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new vi),this.isEmpty())return[];var i=[];return i[0]=new vi(this.min.x,this.min.y,this.min.z),i[1]=new vi(this.min.x,this.min.y,this.max.z),i[2]=new vi(this.min.x,this.max.y,this.min.z),i[3]=new vi(this.min.x,this.max.y,this.max.z),i[4]=new vi(this.max.x,this.min.y,this.min.z),i[5]=new vi(this.max.x,this.min.y,this.max.z),i[6]=new vi(this.max.x,this.max.y,this.min.z),i[7]=new vi(this.max.x,this.max.y,this.max.z),i.forEach((function(i){i.subtract(e),i.applyMatrix(t),i.add(e)})),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new vi;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),ta=function(){function t(t,e){void 0===t&&(t=vi.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var a=(new $n).setFromPoints(t);a.getCenter(i),this.radius=a.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new vi),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return void 0===t&&(t=new $n),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],a=Math.sqrt(Math.max(i,r,n));return this.center.applyMatrix(t),this.radius=this.radius*a,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new vi).subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=.5*(r-this.radius);this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new vi,i=new vi;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=(new vi).subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new t).copyFrom(this)},t}(),ea=Object.freeze({__proto__:null,get EulerOrder(){return Un},Euler:Zn,Quaternion:yi,Vector2:mi,Vector3:vi,Vector4:gr,Matrix3:qn,Matrix4:_r,Ray:Kn,PI2:ni,DEG2RAD:ai,RAD2DEG:si,NumberEpsilon:oi,isZero:function(t){return isNaN(t)||Math.abs(t)<oi},isEqual:ui,damp:function(t,e,i,r){return hi(t,e,1-Math.exp(-i*r))},lerp:hi,degToRad:function(t){return t*ai},radToDeg:function(t){return t*si},clamp:li,Color:Er,Box3:$n,Sphere:ta}),ia=1,ra=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).destroyed=!1,r.visible=!0,i){var n=i.material,a=i.geometry,s=i.name,o=void 0===s?"<unnamed>":s,u=i.priority,h=void 0===u?0:u,l=i.worldMatrix,c=void 0===l?_r.fromIdentity():l;r.id="Mesh"+ia++,r.name=o,r.geometry=a,r.material=n,r.priority=h,r.worldMatrix=c}else r.id="Mesh"+ia++,r.name="<unnamed>",r.worldMatrix=_r.fromIdentity(),r._priority=0;return r}$t(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){this.isDestroyed||this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(t,e){e!==mt.keep&&this.material.dispose(e),this.material=t},i.restore=function(){},i.dispose=function(t){if(!this.destroyed){(null==t?void 0:t.geometries)!==mt.keep&&this.geometry.dispose();var e=null==t?void 0:t.material;e!==mt.keep&&this.material.dispose(e),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},dr(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(yr),na=0,aa=1e3,sa=3e3;!function(t){t[t.none=0]="none",t[t.color=1]="color",t[t.stencil_8_opaque=2]="stencil_8_opaque",t[t.depth_16_opaque=3]="depth_16_opaque",t[t.depth_stencil_opaque=4]="depth_stencil_opaque",t[t.depth_16_texture=5]="depth_16_texture",t[t.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture"}(Qn||(Qn={})),function(t){t[t.store=0]="store",t[t.clear=2]="clear"}(Jn||(Jn={}));var oa,ua=function(){function t(t,e){if(this.destroyed=!1,e){var i=e.texture,r=e.size;if(C(i,fn))this.texture=i,this.externalTexture=!0;else if(i){var n=i.wrapT,a=i.wrapS,s=i.minFilter,o=i.magFilter,u=i.internalFormat,h=i.format,l=void 0===h?Mr.RGBA:h,c=i.type,f=void 0===c?Mr.UNSIGNED_BYTE:c;this.externalTexture=!1,this.textureOptions={size:r,format:l,type:f,internalFormat:u||l,wrapT:n,wrapS:a,minFilter:s,magFilter:o,name:e.name},this.texture=fn.create(t,ri({},this.textureOptions,{sourceType:Rr.framebuffer,data:{width:r[0],height:r[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},dr(t,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),t}();!function(t){t[t.force=0]="force",t[t.keep=1]="keep",t[t.keepExternal=2]="keepExternal",t[t.destroy=0]="destroy"}(oa||(oa={}));var ha=1,la=function(){function t(t,e){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=e.name,r=void 0===i?"RenderPass_"+ha++:i,n=e.clearAction,a=e.semantics,s=e.depthStencilAttachment,o=e.storeAction,u=e.priority,h=void 0===u?0:u,l=e.meshOrder,c=void 0===l?W.ascending:l,f=e.meshes,d=void 0===f?[]:f,p=e.delegate,m=void 0===p?{}:p;this.name=r,this.renderer=t,this.priority=h,this.meshOrder=c,this.meshes=nt(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=ri({},n),this.storeAction=ri({colorAction:0,depthAction:0,stencilAction:0},o),this.semantics=new Xn(a),this.options=e,this.delegate=m,this.setViewportOptions(e)}var e=t.prototype;return e.addMesh=function(t){at(this.meshes,t,this.meshOrder)},e.removeMesh=function(t){D(this.meshes,t)},e.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),nt(this.meshes,this.meshOrder),this.meshes},e.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],a=e[3];t.setViewport(i,r,n,a)}},e.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.frameCleanup=function(t){},e.resetColorAttachments=function(t){var e=this;if(t.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=t.map((function(t){return t.updateSource({sourceType:Rr.framebuffer}),new ua(e.renderer.engine,{texture:t})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=i,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(t.map((function(t){return t}))))}else this.resetAttachments({attachments:t.map((function(t){return{texture:t}}))})},e.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},e._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var a=this.viewportScale,s=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*a,r.getHeight()*a],o=[s[2],s[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map((function(t,e){var r;return new ua(i.renderer.engine,ri({size:o,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))}));this.attachments=h;var l=qa.create({storeAction:this.storeAction,name:u,viewport:s,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);l.bind(),l.unbind(),this.framebuffer=l}else this.attachments.length=0},e.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var i=this.renderer,r=this.viewportScale;return i?[0,0,i.getWidth()*r,i.getHeight()*r]:[0,0,0,0]},e.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:i}}},e.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:i}}},e.getDepthTexture=function(t,e){if(!this.depthTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.getStencilTexture=function(t,e){if(!this.stencilTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.dispose=function(t){if(!this.destroyed){var e=(null==t?void 0:t.meshes)||void 0;e!==mt.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0;var i=(null==t?void 0:t.colorAttachment)?t.colorAttachment:0;this.attachments.forEach((function(t){t.externalTexture&&2===i||1===i||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==mt.keep&&this.semantics.dispose(),this.destroyed=!0;var r,n,a=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:0,s=this.framebuffer;if(s)if(s.dispose({depthStencilAttachment:a}),!(s.externalStorage&&2===a||1===a))null==(r=this.stencilTexture)||r.dispose(),null==(n=this.depthTexture)||n.dispose();this.options=this.renderer=null,this.initialize=Ct}},dr(t,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),t}(),ca="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",fa="#version 100\nprecision highp float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}",da="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.;}",pa="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;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid 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);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",ma="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",va="#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\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\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",ya="#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;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}",ga="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",xa="#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.;}",ba="#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",Ta="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",Ea="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",_a="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",wa="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);}",Ca="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);}",Aa="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);}",Sa="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);}",Ia={},Ra=function(){function t(){}return t.registerInclude=function(t,e){Ia[t]&&vt.warn('The "'+t+'" shader include already exist.'),Ia[t]=e},t.unRegisterInclude=function(t){delete Ia[t]},t.unRegisterAllIncludes=function(){Object.keys(Ia).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var i=e.level,r=e.shaderType,n=e.shader,a=e.macros,s=e.removeVersion,o=t.genMacroString(i,a),u=t.genShaderVersion(i),h=t.parseIncludes(n),l=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==i||l||(h=t.convertTo300(h,r===Ar.fragment)),s?o+h:u+o+h},t.convertTo300=function(e,i){if(e=(e=(e=e.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(e=(e=(e=e.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!t.has300Output(e))if(/\bgl_FragData\[.+?\]/g.test(e)){var r=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(e=t.replaceMRTShader(e,r))}else e=(e=e.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}else e=e.replace(/\battribute\b/g,"in");return e},t.parseIncludes=function(t,e){var i;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var r=i[1],n=Ia[r];if(void 0===n)throw new Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},t.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach((function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)})),r.length?r.join("\n")+"\n":""},t.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},t.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},t.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},t.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},t.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[1])}return i.forEach((function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},t}(),Oa=function(t){function e(e,i){var r,n=(r=t.call(this,e,i)||this).renderer.engine,a=Wn.create(n,{mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=On.create(n,{shader:{vertex:Ta,fragment:Sa,glslVersion:In.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=ra.create(n,{geometry:a,material:s,priority:0}),r.priority=5e3,r}$t(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},i.execute=function(t){var e,i,r;t.clear({colorAction:Jn.clear,depthAction:Jn.clear,stencilAction:Jn.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var n=null!=(r=null==(i=t.renderingData.currentFrame.globalVolume)||null==(e=i.bloom)?void 0:e.threshold)?r:1;this.screenMesh.material.setFloat("_Threshold",n),t.renderMeshes([this.screenMesh])},e}(la),Ma=function(t){function e(e,i,r){var n;(n=t.call(this,e,r)||this).type=i;var a=n.renderer.engine,s="PostProcess",o=Wn.create(a,{name:s,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u={vertex:Ta,fragment:"H"===i?wa:Ca,glslVersion:In.GLSL1},h=On.create(a,{name:s,shader:u});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=ra.create(a,{name:s,geometry:o,material:h,priority:0}),n.priority=5e3,n}$t(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.execute=function(t){t.clear({colorAction:Jn.clear,depthAction:Jn.clear,stencilAction:Jn.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",Da(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFramebuffer().getColorTextures()[0])},e}(la),Na=function(t){function e(e,i){var r,n="PostProcess",a=(r=t.call(this,e,i)||this).renderer.engine,s=Wn.create(a,{name:n,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o={vertex:Ta,fragment:Aa},u=On.create(a,{name:n,shader:o});return u.blending=!1,u.depthTest=!1,u.culling=!1,r.screenMesh=ra.create(a,{name:n,geometry:s,material:u,priority:0}),r.priority=5e3,r}$t(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.execute=function(t){t.clear({colorAction:Jn.clear,depthAction:Jn.clear,stencilAction:Jn.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",Da(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},e}(la),Pa=function(t){function e(e,i){var r,n="PostProcess",a=(r=t.call(this,e,{})||this).renderer.engine;r.sceneTextureHandle=i||new ua(a);var s=Wn.create(a,{name:n,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=On.create(a,{name:n,shader:{vertex:Ta,fragment:Ea,glslVersion:In.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,r.screenMesh=ra.create(a,{name:n,geometry:s,material:o,priority:0}),r.priority=5e3,r}$t(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},i.execute=function(t){t.clear({colorAction:Jn.clear,depthAction:Jn.clear,stencilAction:Jn.clear});var e=t.renderingData.currentFrame.globalVolume,i=ri({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),r=ri({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=ri({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),a=ri({active:!1},null==e?void 0:e.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,n.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*n.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*n.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(i.active)),i.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i.intensity)),r.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",r.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",r.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",r.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new mi(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new vi(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(a.active)),t.renderMeshes([this.screenMesh])},e}(la),Fa="_effects_default_",La=1,Va=function(){function t(t){var e;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=t.camera,r=t.keepColorBuffer,n=t.renderer,a=t.editorTransform,s=void 0===a?[1,1,0,0]:a,o=t.globalVolume,u=t.postProcessingEnabled,h=void 0!==u&&u,l=t.clearAction,c=void 0===l?{colorAction:Ir.whatever,stencilAction:Ir.clear,depthAction:Ir.whatever}:l,f=n.engine;o&&(this.globalVolume=o),this.globalUniforms=new ja;var d,p=[],m={};if(this.renderer=n,h){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");var v=Mr.HALF_FLOAT;p=[{texture:{format:Mr.RGBA,type:v,magFilter:Mr.LINEAR,minFilter:Mr.LINEAR}}],d={storageType:Qn.depth_stencil_opaque},m={colorAction:Ir.clear,stencilAction:Ir.clear,depthAction:Ir.clear}}this.drawObjectPass=new la(n,{name:Fa,priority:aa,meshOrder:W.ascending,depthStencilAttachment:d,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),h){var g=new ua(f),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=new Array(7),T=Mr.HALF_FLOAT,E=new Oa(n,{name:"BloomThresholdPass",attachments:[{texture:{format:Mr.RGBA,type:T,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new ua(f);var w=new Ma(n,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:Mr.RGBA,type:T,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR}}]}),C=new Ma(n,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:Mr.RGBA,type:T,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR}}]});C.gaussianResult=b[_],this.addRenderPass(w),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var S=new Na(n,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:Mr.RGBA,type:T,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR}}]});S.gaussianDownSampleResult=b[5-A],this.addRenderPass(S),x[2]*=2,x[3]*=2}var I=new Pa(n,g);this.addRenderPass(I)}this.semantics=new Xn(t.semantics),this.clearAction=c,this.name="RenderFrame"+La++;var R=y[0];this.emptyTexture=mn(f),this.transparentTexture=vn(f),this.camera=i,this.keepColorBuffer=r,this.renderPassInfoMap.set(R,{listStart:0,listEnd:0,renderPass:R,intermedia:!1}),this.editorTransform=gr.fromArray(s),t.clearAction||this.resetClearActions(),this.passTextureCache=new jn(f);var O=f.gpuCapability,M=O.detail,N=kn(O.level,M.readableDepthStencilTextures&&M.writableFragDepth);null==(e=this.renderer.getShaderLibrary())||e.addShader(N)}var e=t.prototype;return e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){(null==t?void 0:t.semantics)!==mt.keep&&this.semantics.dispose();var e,i,r=(null==t?void 0:t.passes)?t.passes:void 0;(r!==mt.keep&&this._renderPasses.forEach((function(t){t.dispose(r)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource)&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(i=this.resource.depthStencil)||null==(e=i.texture)||e.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null);this.destroyed=!0},e.resetRenderPassDefaultAttachment=function(t,e){for(var i,r=this.resource,n=r.color_a,a=r.color_b,s=e;s<t.length;s++){var o,u,h=t[s],l=null==(o=h.attachments[0])?void 0:o.texture;if(l&&i===l){var c=l===n?a:n;h.resetColorAttachments([c])}(l=null==(u=h.attachments[0])?void 0:u.texture)&&(i=l)}},e.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(i,r){return!i.name.startsWith(Fa)||!i.meshes.includes(t)||(e=r,!1)})),e},e.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;i&&(0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e))},e.getRPAttachments=function(t,e){if(1===(null==t?void 0:t.length)){var i,r=t[0],n=r.texture,a=r.persistent,s=n.format,o=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(s===Mr.RGBA&&!a){var u=this.resource.color_a;return 0===o.length?[{texture:u}]:[{texture:o[0].texture===u?this.resource.color_b:u}]}}return t},e.resetClearActions=function(){var t=this.renderPasses.length>1?Ir.clear:Ir.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=Ir.whatever)},e.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.createResource=function(){var t=this.renderer.engine;if(!this.resource){var e,i=t.gpuCapability,r=i.detail,n=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),o=2===n?Mr.LINEAR:Mr.NEAREST,u=fn.create(t,{sourceType:Rr.framebuffer,format:Mr.RGBA,name:"frame_a",minFilter:o,magFilter:o}),h=fn.create(t,{sourceType:Rr.framebuffer,format:Mr.RGBA,data:{width:a,height:s},minFilter:o,magFilter:o,name:"frame_b"}),l=r.readableDepthStencilTextures&&r.writableFragDepth?Qn.depth_24_stencil_8_texture:Qn.depth_stencil_opaque,c=new la(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:u}]}).initialize(this.renderer),f=new Ga(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:Ir.clear,stencilAction:Ir.clear,colorAction:Ir.clear},meshOrder:W.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(e=c.getDepthAttachment())?void 0:e.texture})]});this.resource={color_a:c.attachments[0].texture,color_b:h,finalCopyRP:f,depthStencil:c.depthAttachment,resRP:c}}},e.createCopyMesh=function(t){var e,i=Fn,r=this.renderer.engine,n=Wn.create(r,{name:i,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=kn(r.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(a);var s=On.create(r,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:i,shader:a});return s.blending=!1,s.depthTest=!1,s.culling=!1,(null==t?void 0:t.blend)&&(s.blending=!0,s.blendFunction=[Mr.SRC_ALPHA,Mr.ONE_MINUS_SRC_ALPHA,Mr.SRC_ALPHA,Mr.ONE_MINUS_SRC_ALPHA]),ra.create(r,{name:i,geometry:n,material:s,priority:0})},e.removeRenderPass=function(t){D(this._renderPasses,t)},dr(t,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function Da(t){return t?new mi(t.getWidth(),t.getHeight()):new mi}function ka(t,e){var i=t.indexOf(e);return t[i-1]}var za,Ua,Ba,Ga=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Da(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(la),ja=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Xa=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return dr(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Ha="function"==typeof o,Wa=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=Ha&&C(t,o)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),s=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),r&&!s&&(s=Ya(t,t.HALF_FLOAT)),r&&!u&&(u=Ya(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=r||t.getExtension("OES_texture_float")?t.FLOAT:0,l=r?o.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,c={floatTexture:h,halfFloatTexture:l,maxSample:r?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:Za(t),halfFloatLinear:s,floatLinear:u,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!a,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=c,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw new Error("Draw multiple color buffers not available.");var s=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];s?t.framebufferTexture2D(e,s,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1!==this.level||i){var r=e.map((function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE}));i?i.drawBuffersWEBGL(r):t.drawBuffers(r)}else if(e.length>1)throw new Error("Draw buffers not available.")},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function Ya(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}function Za(t){return t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0}!function(t){t[t.NONE=0]="NONE",t[t.PVRTC=1]="PVRTC",t[t.ASTC=2]="ASTC"}(za||(za={})),function(t){t[t.Nearest=0]="Nearest",t[t.Linear=1]="Linear"}(Ua||(Ua={})),function(t){t[t.RGBA32=0]="RGBA32",t[t.RGBAHalf=1]="RGBAHalf"}(Ba||(Ba={}));var qa=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},dr(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),Ka=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i){},e.getTemporaryRT=function(t,e,i,r,n,a){return null},e.dispose=function(t){},t}(),Qa=function(){function t(t){var e=this;Object.keys(t).forEach((function(i){e[i]=t[i]}))}return t.prototype.generate=function(t){var e=Ja(this.arc,this.arcMode,t)*ai,i=Math.cos(e)*this.radius,r=Math.sin(e)*this.radius,n=new vi(i,r,0),a=Math.tan(this.angle*ai),s=n.clone().multiply(a);return s.z+=1,{position:n.multiply(wt(0,1)),direction:s.normalize()}},t}();function Ja(t,e,i){if(e===ae.RANDOM)t=wt(0,t);else if(e===ae.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===ae.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===ae.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var $a,ts=function(){function t(t){var e=this;Object.keys(t).forEach((function(i){e[i]=t[i]}))}return t.prototype.generate=function(t){var e=Ja(this.arc,this.arcMode,t)*ai,i=new vi(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),es=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=wt(-this._d,this._d),i=wt(-this._h,this._h);return{direction:new vi(0,0,1),position:new vi(e,i,0)}},t}(),is=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=Ja(this.arc,this.arcMode,t)*ai,i=new vi(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),s=Math.tan(e),o=new vi;return e<a?o.set(r,r*s,0):e>=a&&e<Math.PI-a?o.set(n/s,n,0):e<Math.PI+a?o.set(-r,-r*s,0):e<2*Math.PI-a?o.set(-n/s,-n,0):o.set(r,r*s,0),{direction:i,position:o}},t}(),rs=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===ae.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):wt(0,1);return{direction:new vi(0,1,0),position:new vi(this._d*(e-.5),0,0)}},t}(),ns=new _r,as=function(){function t(t){var e=this;Object.keys(t).forEach((function(i){e[i]=t[i]}))}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=wt(0,2*Math.PI),n=Ja(this.arc,this.arcMode,t)*ai,a=ns.setFromRotationZ(n),s=new vi(Math.cos(r),Math.sin(r),0),o=new vi(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(s),position:a.transformPoint(o)}},t}(),ss=new _r,os=function(){function t(t){var e=this;Object.keys(t).forEach((function(i){e[i]=t[i]}))}var e=t.prototype;return e.getHorizontalAngle=function(){return wt(-90,90)},e.generate=function(t){var e=Ja(this.arc,this.arcMode,t)*ai,i=this.getHorizontalAngle()*ai,r=this.radius,n=new vi(Math.cos(i),0,Math.sin(i)),a=ss.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),us=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.getHorizontalAngle=function(){return wt(0,90)},e}(os),hs=function(){function t(t){var e=t.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(e.anchors),this.width=t.width||1,this.height=t.height||1,this.block=e.block,this.arcMode=t.arcMode,this.random=li(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=e.length/2-1,r=Math.floor(Ja(i,this.arcMode,t)),n=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,a=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,s=new vi(n,a,0);return{position:new vi(n*this.width,a*this.height,0),direction:s.normalize()}},t}(),ls=function(){function t(){}return t.prototype.generate=function(){return{position:new vi,direction:new vi}},t}(),cs=(($a={})[Gt.NONE]=ls,$a[Gt.CONE]=Qa,$a[Gt.SPHERE]=os,$a[Gt.HEMISPHERE]=us,$a[Gt.CIRCLE]=ts,$a[Gt.DONUT]=as,$a[Gt.RECTANGLE]=es,$a[Gt.EDGE]=rs,$a[Gt.RECTANGLE_EDGE]=is,$a[Gt.TEXTURE]=hs,$a);function fs(t){if(!t)return new ls;var e=ri({radius:1,arc:360,angle:0,arcMode:ae.RANDOM},t),i=t.type,r=cs[i];if(!r)throw new Error("Invalid shape: "+i+".");var n=new r(e);if(i!==Gt.NONE){var a=t.alignSpeedDirection,s=t.upDirection,o=void 0===s?[0,0,1]:s;n.alignSpeedDirection=a,n.upDirection=vi.fromArray(o).normalize()}return n}function ds(t,e,i,r,n){var a,s;if(n===function(t,e,i,r){for(var n=0,a=e,s=i-r;a<i;a+=r)n+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)s=Ms(a,t[a],t[a+1],s);else for(a=i-r;a>=e;a-=r)s=Ms(a,t[a],t[a+1],s);return s&&Cs(s,s.next)&&(Ns(s),s=s.next),s}function ps(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Cs(r,r.next)&&0!==ws(r.prev,r,r.next))r=r.next;else{if(Ns(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function ms(t){var e=t.prev,i=t,r=t.next;if(ws(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Es(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&ws(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function vs(t,e,i,r){var n=t.prev,a=t,s=t.next;if(ws(n,a,s)>=0)return!1;for(var o=n.x<a.x?n.x<s.x?n.x:s.x:a.x<s.x?a.x:s.x,u=n.y<a.y?n.y<s.y?n.y:s.y:a.y<s.y?a.y:s.y,h=n.x>a.x?n.x>s.x?n.x:s.x:a.x>s.x?a.x:s.x,l=n.y>a.y?n.y>s.y?n.y:s.y:a.y>s.y?a.y:s.y,c=bs(o,u,e,i,r),f=bs(h,l,e,i,r),d=t.prevZ,p=t.nextZ;d&&d.z>=c&&p&&p.z<=f;){if(d!==t.prev&&d!==t.next&&Es(n.x,n.y,a.x,a.y,s.x,s.y,d.x,d.y)&&ws(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==t.prev&&p!==t.next&&Es(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&ws(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&Es(n.x,n.y,a.x,a.y,s.x,s.y,d.x,d.y)&&ws(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&Es(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&ws(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function ys(t,e){return t.x-e.x}function gs(t,e){if(e=function(t,e){var i,r=e,n=t.x,a=t.y,s=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var o=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=n&&o>s){if(s=o,o===n){if(a===r.y)return r;if(a===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===s)return i;var u,h=i,l=i.x,c=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=l&&n!==r.x&&Es(a<c?n:s,a,l,c,a<c?s:n,a,r.x,r.y)&&(u=Math.abs(a-r.y)/(n-r.x),Rs(r,t)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&xs(i,r)))&&(i=r,f=u)),r=r.next}while(r!==h);return i}(t,e),e){var i=Os(e,t);ps(e,e.next),ps(i,i.next)}}function xs(t,e){return ws(t.prev,t,e.prev)<0&&ws(e.next,t,t.next)<0}function bs(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ts(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Es(t,e,i,r,n,a,s,o){return(n-s)*(e-o)-(t-s)*(a-o)>=0&&(t-s)*(r-o)-(i-s)*(e-o)>=0&&(i-s)*(a-o)-(n-s)*(r-o)>=0}function _s(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&As(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Rs(t,e)&&Rs(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(ws(t.prev,t,e.prev)||ws(t,e.prev,e))||Cs(t,e)&&ws(t.prev,t,t.next)>0&&ws(e.prev,e,e.next)>0)}function ws(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Cs(t,e){return t.x===e.x&&t.y===e.y}function As(t,e,i,r){var n=Is(ws(t,e,i)),a=Is(ws(t,e,r)),s=Is(ws(i,r,t)),o=Is(ws(i,r,e));return n!==a&&s!==o||(!(0!==n||!Ss(t,i,e))||(!(0!==a||!Ss(t,r,e))||(!(0!==s||!Ss(i,t,r))||!(0!==o||!Ss(i,e,r)))))}function Ss(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Is(t){return t>0?1:t<0?-1:0}function Rs(t,e){return ws(t.prev,t,t.next)<0?ws(t,e,t.next)>=0&&ws(t,t.prev,e)>=0:ws(t,e,t.prev)<0||ws(t,t.next,e)<0}function Os(t,e){var i=new Ps(t.i,t.x,t.y),r=new Ps(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function Ms(t,e,i,r){var n=new Ps(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Ns(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ps(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Fs=0;function Ls(t,e,i,r){i=i||2,Fs=r||0;var n,a,s,o,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=ds(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,a,s,o=[];for(n=0,a=e.length;n<a;n++)(s=ds(t,e[n]*r,n<a-1?e[n+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),o.push(Ts(s));for(o.sort(ys),n=0;n<o.length;n++)gs(o[n],i),i=ps(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=s=t[0],a=o=t[1];for(var m=i;m<f;m+=i)(u=t[m])<n&&(n=u),(h=t[m+1])<a&&(a=h),u>s&&(s=u),h>o&&(o=h);l=0!==(l=Math.max(s-n,o-a))?1/l:0}return Vs(d,p,i,n,a,l),p}function Vs(t,e,i,r,n,a,s){if(t){!s&&a&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=bs(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,s,o,u,h=1;do{for(i=t,t=null,a=null,s=0;i;){for(s++,r=i,o=0,e=0;e<h&&(o++,r=r.nextZ);e++);for(u=h;o>0||u>0&&r;)0!==o&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,o--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(s>1)}(n)}(t,r,n,a);for(var o,u,h=t;t.prev!==t.next;)if(o=t.prev,u=t.next,a?vs(t,r,n,a):ms(t))e.push(o.i/i+Fs),e.push(t.i/i+Fs),e.push(u.i/i+Fs),Ns(t),t=u.next,h=u.next;else if((t=u)===h){s?1===s?Vs(t=Ds(ps(t),e,i),e,i,r,n,a,2):2===s&&ks(t,e,i,r,n,a):Vs(ps(t),e,i,r,n,a,1);break}}}function Ds(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!Cs(n,a)&&As(n,r,r.next,a)&&Rs(n,a)&&Rs(a,n)&&(e.push(n.i/i+Fs),e.push(r.i/i+Fs),e.push(a.i/i+Fs),Ns(r),Ns(r.next),r=t=a),r=r.next}while(r!==t);return ps(r)}function ks(t,e,i,r,n,a){var s=t;do{for(var o=s.next.next;o!==s.prev;){if(s.i!==o.i&&_s(s,o)){var u=Os(s,o);return s=ps(s,s.next),u=ps(u,u.next),Vs(s,e,i,r,n,a),void Vs(u,e,i,r,n,a)}o=o.next}s=s.next}while(s!==t)}var zs=6,Us="PRE_COLOR_0",Bs="PRE_COLOR_SIZE_0",Gs="PRE_MAIN_COLOR_0",js="PRE_MAIN_COLOR_SIZE_0",Xs="editor",Hs={"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"},Ws=2;function Ys(t,e){for(var i=t.s,r=t.p,n=i[1],a=r[1],s=0,o=0;o<n.length;o++){s+=n[o].length-1}var u,h=new Float32Array(s*zs),l=e.indexBase,c=void 0===l?0:l,f=e.uvTransform,d=0,p=0,m=0,v=1,y=1;f&&(p=f[0],m=f[1],u=f[4],v=u?f[3]:f[2],y=u?f[2]:f[3]);for(var g=[0,0],x=0===u?0:-Math.PI/2,b=0;b<n.length;b++)for(var T=n[b],E=a[b],_=a[b+1]||a[0],w=T,C=[0,0],A=0;A<w.length-1;A++){Ks(C,w[A],E,_,E[4],E[5],_[2],_[3]),I(C[0],C[1])}var S=Ls(Array.from(h),null,zs,c);return{aPoint:h,index:new Uint16Array(S)};function I(t,e){h[d++]=t/2,h[d++]=e/2,f?(g[0]=t,g[1]=e,qs(g,g,x),h[d++]=p+(g[0]+1)/2*v,h[d++]=m+(g[1]+1)/2*y):(h[d++]=(t+1)/2,h[d++]=(e+1)/2),d+=Ws}}function Zs(t,e){for(var i=[],r=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[ee.SHAPE_POINTS,t.p],s:[ee.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[ee.SHAPE_POINTS,t.g.p],s:[ee.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,a=0,s=0,o=0;o<r.length;o++){var u=Ys(r[o],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,i.push(u),a+=u.aPoint.length,s+=u.index.length}if(1===i.length)return i[0];for(var h=new Float32Array(a),l=new Uint16Array(s),c=0,f=0,d=0;c<i[c];c++){var p=i[c];h.set(p.aPoint,f),f+=p.aPoint.length,l.set(p.index,d),d+=p.index.length}return{aPoint:h,index:l}}function qs(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],s=e[1];return t[0]=r*a+n*s,t[1]=-n*a+r*s,t}function Ks(t,e,i,r,n,a,s,o){var u=1-e,h=u*u*u,l=3*e*u*u,c=3*e*e*u,f=e*e*e;return t[0]=h*i[0]+l*n+c*s+f*r[0],t[1]=h*i[1]+l*a+c*o+f*r[1],t}var Qs=[[0,0,1,1,0]],Js=function(t){function e(e){var i;(i=t.call(this,e)||this).visible=!0,i.splits=Qs,i.meshCollider=new Ru,i._color=new Er(1,1,1,1),i.getHitTestParams=function(t){var e=_r.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.meshCollider.setGeometry(i.geometry,e);var n,a=i.meshCollider.getBoundingBoxData();if(a)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===Ut.FRONT}}},i.renderer={renderMode:Yt.MESH,blending:zt.ALPHA,texture:i.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:Ut.DOUBLE,mask:0},i.defaultGeometry=Wn.create(i.engine,{attributes:{aPos:{type:Mr.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:Mr.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:Mr.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var r=On.create(i.engine,{shader:{fragment:ma,vertex:pa,shared:!0}});return i.material=r,i.material.setColor("_Color",new Er(1,1,1,1)),i.maskManager=new Mn(e),i}$t(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){C(t,Er)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return E((function(){var i;return I(this,(function(r){switch(r.label){case 0:return"string"!=typeof t?[3,2]:[4,fn.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}}))}))()},i.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},i.getItemGeometryData=function(t){var e=this.splits,i=this.textureSheetAnimation,r=this.defaultGeometry;if(t.shape){for(var n=t.shape,a=n.index,s=void 0===a?[]:a,o=n.aPoint,u=void 0===o?[]:o,h=new Float32Array(u),l=[],c=[],f=0;f<h.length;f+=6)h[f]*=1,h[f+1]*=1,c.push(u[f+2],u[f+3]),l.push(h[f],h[f+1],0);return r.setAttributeData("aPos",new Float32Array(l)),{index:s,aUV:c}}var d=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],p=[],m=[],v=[];if(1===e.length){var y=i?[0,0,1,1,e[0][4]]:e[0],g=y[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],x=y[0],b=y[1],T=y[4]?y[3]:y[2],E=y[4]?y[2]:y[3];p.push(g[0]*T+x,g[1]*E+b,g[2]*T+x,g[3]*E+b,g[4]*T+x,g[5]*E+b,g[6]*T+x,g[7]*E+b),v.push(d[0],d[1],0,d[2],d[3],0,d[4],d[5],0,d[6],d[7],0),m.push(0,1,2,2,1,3)}else for(var _=0;_<2;_++)for(var w=0;w<2;w++){var C=4*(2*w+_),A=i?[0,0,1,1,e[0][4]]:e[2*w+_],S=A[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],I=((_+_+1)/2-1)/2,R=((w+w+1)/2-1)/2,O=A[0],M=A[1],N=A[4]?A[3]:A[2],P=A[4]?A[2]:A[3],F=[d[0]/2+I,d[1]/2+R,d[2]/2+I,d[3]/2+R,d[4]/2+I,d[5]/2+R,d[6]/2+I,d[7]/2+R];p.push(S[0]*N+O,S[1]*P+M,S[2]*N+O,S[3]*P+M,S[4]*N+O,S[5]*P+M,S[6]*N+O,S[7]*P+M),v.push(1*F[0],1*F[1],0,1*F[2],1*F[3],0,1*F[4],1*F[5],0,1*F[6],1*F[7],0),m.push(C,1+C,2+C,2+C,1+C,3+C)}return r.setAttributeData("aPos",new Float32Array(v)),{index:m,aUV:p}},i.configureDefaultGeometry=function(t){var e=this.getItemGeometryData(t),i=e.index,r=e.aUV,n=this.defaultGeometry;return n.setIndexData(new Uint16Array(i)),n.setAttributeData("aUV",new Float32Array(r)),n.setDrawCount(i.length),n},i.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.mask,a=t.texture,s=this.maskManager.maskMode,o=this.material;o.blending=!0,o.depthTest=!0,o.depthMask=i,o.stencilRef=void 0!==n?[n,n]:void 0,Ur(o,r),Gr(o,s),Br(o,e),o.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',o.setVector4("_TexOffset",new gr(0,0,1,1)),o.setTexture("_MainTex",a);var u=zr(r),h=new gr;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=u,h.z=t.renderMode,h.w=s,o.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?o.enableMacro("ALPHA_CLIP"):o.disableMacro("ALPHA_CLIP"),o},i.draw=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++){var i=this.materials[e];i.setVector2("_Size",this.transform.size),this.renderer.renderMode!==Yt.BILLBOARD&&this.renderer.renderMode!==Yt.VERTICAL_BILLBOARD&&this.renderer.renderMode!==Yt.HORIZONTAL_BILLBOARD||i.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,i,e)}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r=e,n=null!=(i=r.renderer)?i:{},a=r.splits,s=r.textureSheetAnimation,o=r.mask;o&&this.maskManager.setMaskOptions(o);var u,h,l,c=n.shape,f=a&&!s?a[0]:void 0,d=void 0;if(null==c||"aPoint"in c&&"index"in c||(d=Zs(c,f)),this.splits=a||Qs,this.textureSheetAnimation=s,this.renderer={renderMode:null!=(u=n.renderMode)?u:Yt.MESH,blending:null!=(h=n.blending)?h:zt.ALPHA,texture:n.texture?this.engine.findObject(n.texture):this.engine.emptyTexture,occlusion:!!n.occlusion,transparentOcclusion:!!n.transparentOcclusion||this.maskManager.maskMode===Sr.MASK,side:null!=(l=n.side)?l:Ut.DOUBLE,mask:this.maskManager.getRefValue(),shape:d},this.configureMaterial(this.renderer),r.geometry){var p=this.engine.findObject(r.geometry),m=r.splits&&!r.textureSheetAnimation?r.splits[0]:Qs[0],v=m[0],y=m[1],g=Boolean(m[4]),x=g?m[3]:m[2],b=g?m[2]:m[3],T=g?-Math.PI/2:0,E=p.getAttributeData("aUV"),_=p.getAttributeData("aPos"),C=p.getIndexData(),A=[0,0];if(E&&_&&C){for(var S=E.length/2,I=0;I<S;I++){var R=3*I,O=2*I,M=_[R],N=_[R+1];A[0]=M,A[1]=N,qs(A,A,T),E[O]=(A[0]+.5)*x+v,E[O+1]=(A[1]+.5)*b+y}this.geometry.setAttributeData("aPos",_.slice()),this.geometry.setAttributeData("aUV",E.slice()),this.geometry.setIndexData(C.slice()),this.geometry.setDrawCount(C.length)}this.geometry.subMeshes.length=0;for(var P,F=w(p.subMeshes);!(P=F()).done;){var L=P.value;this.geometry.subMeshes.push({offset:L.offset,indexCount:L.indexCount,vertexCount:L.vertexCount})}}else this.geometry=this.defaultGeometry,this.configureDefaultGeometry(this.renderer)},dr(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(yr),$s=function(t){function e(e){var i;(i=t.call(this,e)||this).hasStroke=!1,i.hasFill=!1,i.shapeDirty=!0,i.graphicsPath=new lc,i.vert="\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n",i.frag="\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n",i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0});var r={shader:{vertex:i.vert,fragment:i.frag,glslVersion:In.GLSL1}},n=On.create(e,r),a=On.create(e,r);return n.color=new Er(1,1,1,1),n.depthMask=!1,n.depthTest=!0,n.blending=!0,i.material=n,a.color=new Er(.25,.25,.25,1),a.depthMask=!1,a.depthTest=!0,a.blending=!0,i.materials[1]=a,i.strokeAttributes={width:1,alignment:.5,cap:Te.Butt,join:Ee.Miter,miterLimit:10,color:new Er(1,1,1,1)},i.fillAttribute={color:new Er(1,1,1,1)},i.shapeAttribute={type:be.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i}$t(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){this.material.color=this.fillAttribute.color,this.materials[1].color=this.strokeAttributes.color,this.shapeDirty&&(this.buildPath(this.shapeAttribute),this.buildGeometryFromPath(this.graphicsPath.shapePath),this.shapeDirty=!1)},i.buildGeometryFromPath=function(t){var e=t.shapePrimitives,i=[],r=[];if(this.hasFill)for(var n,a=w(e);!(n=a()).done;){var s=n.value.shape,o=[],u=r.length,h=i.length/2;s.build(o),s.triangulate(o,i,h,r,u)}var l=r.length;if(this.hasStroke)for(var c,f=w(e);!(c=f()).done;){var d=c.value.shape,p=[],m=i.length/2,v=this.strokeAttributes,y=!0;this.shapeAttribute.type===be.Custom&&(y=d.closePath),d.build(p),Zl(p,v,!1,y,i,2,m,r)}var g=r.length-l,x=i.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<r.length)&&(E=new Uint16Array(r.length));for(var _=0;_<x;_++){var C=3*_,A=2*_,S=2*_;b[C]=i[A],b[C+1]=i[A+1],b[C+2]=0,T[S]=b[C],T[S+1]=b[C+1]}E.set(r),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(r.length);var I=this.geometry.subMeshes[0],R=this.geometry.subMeshes[1];I.indexCount=l,R.offset=2*l,R.indexCount=g},i.buildPath=function(t){switch(this.graphicsPath.clear(),t.type){case be.Custom:for(var e,i=this.shapeAttribute,r=i.points,n=i.easingIns,a=i.easingOuts,s=w(i.shapes);!(e=s()).done;){var o=e.value,u=o.indexes,h=r[u[0].point];this.graphicsPath.moveTo(h.x,h.y);for(var l=1;l<u.length;l++){var c=u[l],f=u[l-1],d=r[c.point],p=r[f.point],m=a[f.easingOut],v=n[c.easingIn];this.graphicsPath.bezierCurveTo(m.x+p.x,m.y+p.y,v.x+d.x,v.y+d.y,d.x,d.y,1)}if(o.close){var y=u[0],g=u[u.length-1],x=r[y.point],b=r[g.point],T=a[g.easingOut],E=n[y.easingIn];this.graphicsPath.bezierCurveTo(T.x+b.x,T.y+b.y,E.x+x.x,E.y+x.y,x.x,x.y,1),this.graphicsPath.closePath()}}break;case be.Ellipse:var _=t;this.graphicsPath.ellipse(0,0,_.xRadius,_.yRadius);break;case be.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case be.Star:var A=t;this.graphicsPath.polyStar(A.pointCount,A.outerRadius,A.innerRadius,A.outerRoundness,A.innerRoundness,ac.Star);break;case be.Polygon:var S=t;this.graphicsPath.polyStar(S.pointCount,S.radius,S.radius,S.roundness,S.roundness,ac.Polygon)}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shapeDirty=!0;var i=e.stroke;i&&(this.hasStroke=!0,this.strokeAttributes.width=i.width,this.strokeAttributes.color.copyFrom(i.color),this.strokeAttributes.cap=i.cap,this.strokeAttributes.join=i.join);var r=e.fill;switch(r&&(this.hasFill=!0,this.fillAttribute.color.copyFrom(r.color)),e.type){case be.Custom:for(var n,a=e,s={type:be.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:a.fill},o=w(a.points);!(n=o()).done;){var u=n.value;s.points.push(new mi(u.x,u.y))}for(var h,l=w(a.easingIns);!(h=l()).done;){var c=h.value;s.easingIns.push(new mi(c.x,c.y))}for(var f,d=w(a.easingOuts);!(f=d()).done;){var p=f.value;s.easingOuts.push(new mi(p.x,p.y))}s.shapes=a.shapes,this.shapeAttribute=s;break;case be.Ellipse:var m=e,v={type:be.Ellipse,xRadius:m.xRadius,yRadius:m.yRadius,fill:m.fill};this.shapeAttribute=v;break;case be.Rectangle:var y=e,g={type:be.Rectangle,width:y.width,height:y.height,roundness:y.roundness,fill:y.fill};this.shapeAttribute=g;break;case be.Star:var x=e,b={type:be.Star,pointCount:x.pointCount,innerRadius:x.innerRadius,outerRadius:x.outerRadius,innerRoundness:x.innerRoundness,outerRoundness:x.outerRoundness,fill:x.fill};this.shapeAttribute=b;break;case be.Polygon:var T=e,E={type:be.Polygon,pointCount:T.pointCount,radius:T.radius,roundness:T.roundness,fill:T.fill};this.shapeAttribute=E}e.mask&&this.maskManager.setMaskOptions(e.mask);var _=this.maskManager.getRefValue();this.material.stencilRef=void 0!==_?[_,_]:void 0,Gr(this.material,this.maskManager.maskMode)},dr(e,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),e}(Js);$s=S([ke("ShapeComponent")],$s);var to,eo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).loop=!1,e.amountOfMotion=1,e.animationLength=2,e.mode=1,e.startPositionX=0,e.startPositionY=0,e.startPositionZ=0,e.endPositionX=0,e.endPositionY=0,e.endPositionZ=0,e.amplitudeX=0,e.amplitudeY=0,e.amplitudeZ=0,e.phaseX=0,e.phaseY=0,e.phaseZ=0,e}$t(e,t);var i=e.prototype;return i.onStart=function(){this.effectComponent=this.item.getComponent(br)},i.onUpdate=function(t){this.updateFake3D()},i.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var a=t;this.loop&&(a>.5&&(a=1-a),a*=2),e=this.startPositionX*(1-a)+a*this.endPositionX,i=this.startPositionY*(1-a)+a*this.endPositionY,r=this.startPositionZ*(1-a)+a*this.endPositionZ}var s=this.effectComponent.material;s.setFloat("_PosX",e*this.amountOfMotion),s.setFloat("_PosY",i*this.amountOfMotion),s.setFloat("_PosZ",r*this.amountOfMotion)}},e}(pr);S([ze()],eo.prototype,"loop",void 0),S([ze()],eo.prototype,"amountOfMotion",void 0),S([ze()],eo.prototype,"animationLength",void 0),S([ze()],eo.prototype,"mode",void 0),S([ze()],eo.prototype,"startPositionX",void 0),S([ze()],eo.prototype,"startPositionY",void 0),S([ze()],eo.prototype,"startPositionZ",void 0),S([ze()],eo.prototype,"endPositionX",void 0),S([ze()],eo.prototype,"endPositionY",void 0),S([ze()],eo.prototype,"endPositionZ",void 0),S([ze()],eo.prototype,"amplitudeX",void 0),S([ze()],eo.prototype,"amplitudeY",void 0),S([ze()],eo.prototype,"amplitudeZ",void 0),S([ze()],eo.prototype,"phaseX",void 0),S([ze()],eo.prototype,"phaseY",void 0),S([ze()],eo.prototype,"phaseZ",void 0),eo=S([ke("Fake3DComponent")],eo),function(t){t[t.Circular=0]="Circular",t[t.Linear=1]="Linear"}(to||(to={}));var io=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(pr);io=S([ke(Ae.CameraController)],io);var ro,no=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt);!function(t){t[t.triangle=1]="triangle",t[t.box=2]="box",t[t.sphere=3]="sphere",t[t.custom=4]="custom"}(ro||(ro={}));var ao="click",so="touchstart",oo="touchmove",uo="touchend",ho=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var e=t.prototype;return e.bindListeners=function(){var t,e,i,r,n,a=this;n=function(t){return t};var s,o="mousedown",u="mousemove",h="mouseup",l="mouseleave",c=function(t,e,i,n,s){void 0===n&&(n=0),void 0===s&&(s=0);var o=0,u=0,h=d.now();if(!a.target)return vt.warn("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:s,ts:h,width:0,height:0,origin:t};var l=a.target,c=l.width,f=l.height;if(r){var p=h-r.ts;o=(n-r.dx)/p||0,u=(s-r.dy)/p||0,r={dx:n,dy:s,ts:h}}return{x:e,y:i,vx:o,vy:u,dx:n,dy:s,ts:h,width:c,height:f,origin:t}};J()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},o="touchstart",u="touchmove",h="touchend",l="touchcancel"),this.nativeHandlers=((s={})[o]=function(s){if(a.enabled){var o=n(s),u=lo(o);t=u.x,e=u.y,r=i={clientX:o.clientX,clientY:o.clientY,ts:d.now(),x:t,y:e},a.dispatchEvent(so,c(s,t,e))}},s[u]=function(r){if(i&&a.enabled){var s=lo(n(r));t=s.x,e=s.y,a.dispatchEvent(oo,c(r,t,e,t-i.x,e-i.y))}},s[h]=function(r){if(i&&a.enabled){!a.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var s=n(r),o=lo(s),u=Math.abs(i.clientX-s.clientX)+Math.abs(i.clientY-s.clientY);t=o.x,e=o.y,u<4&&a.dispatchEvent(ao,c(r,t,e)),a.dispatchEvent(uo,c(r,t,e,t-i.x,e-i.y))}i=0},s),this.nativeHandlers[l]=this.nativeHandlers[h],Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.nativeHandlers[t])}))},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach((function(t){return t(e)}))},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),V(i,e),function(){D(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&D(i,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function lo(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,s=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-s)/n.height*2}}var co,fo,po=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt),mo=(co=new Float32Array(1),fo=new Int32Array(co.buffer),function(t){co[0]=t;var e=fo[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?i|=((r|=2048)>>114-n)+(r>>113-n&1):(i|=n-112<<10|r>>1,i+=1&r)}),vo=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=mo(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=mo(t[i])},t}();function yo(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i}var go,xo=new Zn,bo=new _r;function To(t,e,i,r,n,a,s){var o=t,u=r/n,h=r,l=e.speedOverLifetime;l&&(h=l.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;o.copyFrom(a),o.addScaledVector(s,h),o.addScaledVector(i,c);var f=e.linearVelOverLifetime||{},d=e.orbitalVelOverLifetime||{};if(d.enabled){var p=new vi;d.center&&p.setFromArray(d.center);var m=o.clone().subtract(p),v=d.asRotation,y=["x","y","z"].map((function(t){var e=d[t];return e?v?e.getValue(u):e.getIntegrateValue(0,r,n):0}));xo.setFromArray(y).negate(),bo.setFromEuler(xo);var g=bo.transformPoint(m);o.addVectors(p,g)}if(f.enabled){var x=f.asMovement,b=f.x,T=f.y,E=f.z;if(b){var _=x?b.getValue(u):b.getIntegrateValue(0,r,n);o.x=o.x+_}if(T){var w=x?T.getValue(u):T.getIntegrateValue(0,r,n);o.y=o.y+w}if(E){var C=x?E.getValue(u):E.getIntegrateValue(0,r,n);o.z=o.z+C}}return o}function Eo(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function _o(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function wo(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var s=0;s<i.length;s++)t[s]=i[s];return t}var Co=((go={})[Zt.PARTICLE_ORIGIN_CENTER]=[0,0],go[Zt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],go[Zt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],go[Zt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],go[Zt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],go[Zt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],go[Zt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],go[Zt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],go[Zt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],go);function Ao(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function So(t,e,i){var r=i.position,n=new vi(t,e,0),a=new vi;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new Kn(r,a)}function Io(t,e,i){var r=t.x,n=t.y,a=t.z,s=new vi(r-e,n+i,a),o=new vi(r-e,n-i,a),u=new vi(r+e,n-i,a),h=new vi(r+e,n+i,a);return[{p0:s,p1:o,p2:u},{p0:s.clone(),p1:u.clone(),p2:h}]}function Ro(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function Oo(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var Mo={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex,a=e[r],s=e[n];return new mi(a,s)},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===ie.LINE||i===ie.EASE_OUT?0:i===ie.EASE_IN||i===ie.EASE||i===ie.HOLD&&r===ie.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==ie.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==ie.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[ie.EASE,ie.EASE_IN,ie.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[ie.EASE,ie.EASE_OUT,ie.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===ie.HOLD&&[ie.HOLD,ie.LINE_OUT,ie.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===ie.HOLD&&[ie.HOLD,ie.LINE,ie.EASE_IN].includes(i)}},No=function(t,e){this.points=t,this.totalLength=e},Po={},Fo={},Lo=.1;function Vo(t,e){return 1-3*e+3*t}function Do(t,e){return 3*e-6*t}function ko(t){return 3*t}function zo(t,e,i){return((Vo(e,i)*t+Do(e,i))*t+ko(e))*t}function Uo(t,e,i){return 3*Vo(e,i)*t*t+2*Do(e,i)*t+ko(e)}var Bo=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,i,r){var n=Oo(e.x-t.x,3)+"_"+Oo(e.y-t.y,3)+"_"+Oo(e.z-t.z,3)+"&"+Oo(i.x-t.x,3)+"_"+Oo(i.y-t.y,3)+"_"+Oo(i.z-t.z,3)+"&"+Oo(r.x-t.x,3)+"_"+Oo(r.y-t.y,3)+"_"+Oo(r.z-t.z,3);if(Fo[n])return{data:Fo[n],interval:t};for(var a=[],s=null,o=0,u=0,h=0;h<300;h+=1){var l=new vi,c=h/299;u=0,l.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),l.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),l.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==s&&(u+=Math.pow(l.x-s.x,2),u+=Math.pow(l.y-s.y,2),u+=Math.pow(l.z-s.z,2)),s=l,o+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new No(a,o);return Fo[n]=f,{data:f,interval:new vi(t.x,t.y,t.z)}}(t,e,i,r),a=n.data,s=n.interval;this.lengthData=a,this.interval=s,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(Ro(1-t,0))return e.points[299].point.clone().add(this.interval);if(Ro(e.totalLength,0))return this.p1.clone();var i=new vi,r=Oo(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(Ro(n,r))return e.points[a].point.clone().add(this.interval);var s=!0,o=1;for(r<n&&(o=-1);s;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}o>0&&a<299?(a+=o,n+=Oo(e.points[a].partialLength,5)):o<0&&a>0?(n-=Oo(e.points[a].partialLength,5),a+=o):s=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),Go=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new yi,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):Ro(1-t,0)?this.temp.copyFrom(this.p2):(Wo.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),jo=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new mi,this.control2=new mi,this.weighted=!1,this.isConstant=!1,this.mSampleValues=new Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),zo(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var a=1-n,s=a*a,o=n*n;return t*(s*a)+e*s*n*3+i*a*o*3+r*(o*n)},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=zo(t*Lo,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=Lo;var n=i+(t-e[--r])/(e[r+1]-e[r])*Lo,a=Uo(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=Uo(e,i,r);if(0===a)return e;e-=(zo(e,i,r)-t)/a}return e}(t,n,this.control1.x,this.control2.x):0===a?n:function(t,e,i,r,n){var a,s,o=0;do{(a=zo(s=e+(i-e)/2,r,n)-t)>0?i=s:e=s}while(Math.abs(a)>1e-7&&++o<10);return s}(t,i,i+Lo,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,this.control1.x===this.control1.y&&this.control2.x===this.control2.y||this.calcSampleValues()},t}();function Xo(t,e){var i=Ho(t,e,!0),r=i.p0,n=i.p1,a=i.p2,s=i.p3;ut(a),ut(s);var o,u,h=s.x-r.x,l=s.y-r.y,c=Oo((n.x-r.x)/h,5),f=Oo((a.x-r.x)/h,5);Ro(l,0)?o=u=NaN:(o=Oo((n.y-r.y)/l,5),u=Oo((a.y-r.y)/l,5)),c<0&&(console.error("Invalid bezier points, x1 < 0",r,n,a,s),c=0),f<0&&(console.error("Invalid bezier points, x2 < 0",r,n,a,s),f=0),c>1&&(console.error("Invalid bezier points, x1 >= 1",r,n,a,s),c=1),f>1&&(console.error("Invalid bezier points, x2 >= 1",r,n,a,s),f=1);var d,p=("bez_"+c+"_"+o+"_"+f+"_"+u).replace(/\./g,"p");return Po[p]?d=Po[p]:(d=Ro(l,0)?new jo:new jo(c,o,f,u),Po[p]=d),{points:[r,n,a,s],timeInterval:h,valueInterval:l,curve:d}}function Ho(t,e,i){var r=t[1],n=Mo.isHoldOutKeyframe(t),a=Mo.isHoldInKeyframe(e),s=!a&&Mo.isRightSideEase(t),o=!n&&Mo.isLeftSideEase(e);if(s&&!o&&!a){var u=new mi(r[r.length-4],r[r.length-3]),h=new mi(r[r.length-2],r[r.length-1]),l=Mo.getPointInCurve(e),c=new mi(l.x,l.y);return{type:"ease",p0:u,p1:h,p2:new mi(c.x-(c.x-u.x)/10,c.y),p3:c}}if(!s&&o&&!n){var f=e[1],d=Mo.getPointInCurve(t),p=new mi(d.x,d.y),m=new mi(f[0],f[1]),v=new mi(f[2],f[3]);return{type:"ease",p0:p,p1:new mi(p.x+(v.x-p.x)/10,p.y),p2:m,p3:v}}if(s&&o){var y=e[1];return{type:"ease",p0:new mi(r[r.length-4],r[r.length-3]),p1:new mi(r[r.length-2],r[r.length-1]),p2:new mi(y[0],y[1]),p3:new mi(y[2],y[3])}}var g=Mo.getPointInCurve(t),x=Mo.getPointInCurve(e);return n?x.y=g.y:a&&(g.y=x.y),i?{type:"ease",p0:g,p1:new mi((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new mi((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}:{type:"line",p0:g,p1:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var Wo=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,s=e.z,o=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r)return t.x=n,t.y=a,t.z=s,void(t.w=o);if(1===r)return t.x=u,t.y=h,t.z=l,void(t.w=c);if(o!==c||n!==u||a!==h||s!==l){var f=1-r,d=n*u+a*h+s*l+o*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,a=a*f+h*g,s=s*f+l*g,o=o*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+s*s+o*o);n*=x,a*=x,s*=x,o*=x}}t.x=n,t.y=a,t.z=s,t.w=o},t}(),Yo="not_implement",Zo=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(Yo)},e.getIntegrateValue=function(t,e,i){throw new Error(Yo)},e.getIntegrateByTime=function(t,e){throw new Error(Yo)},e.getValue=function(t){throw new Error(Yo)},e.getMaxTime=function(){throw new Error(Yo)},e.toUniform=function(t){throw new Error(Yo)},e.map=function(t){throw new Error(Yo)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(Yo)},t.getAllData=function(t,e){for(var i=new(e?vo:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var s=a[r].toData();i.set(s,n),n+=s.length}return e?i.data:i},t}(),qo=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(Zo),Ko=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(Zo),Qo=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){var i=null!=e?e:Math.random();return this.min+i*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){var r=null!=i?i:1;return(this.min+r*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(Zo),Jo=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(Zo),$o=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return su(e,0,this.xCoord,this.min,this.max)-su(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(Zo),tu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=G(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1];if(n.stop<=t&&a.stop>t){var s=(t-n.stop)/(a.stop-n.stop);return j(n.color,a.color,s,!0)}}return e[i].color.slice()},e}(Zo),eu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1],s=n[0],o=a[0];if(t>=s&&t<=o){var u=(t-s)/(o-s),h=n[1];return h+u*(a[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,a=e?su:au,s=0;s<n;s++){var o=i[s],u=i[s+1],h=o[0],l=u[0];if(t>h&&t<=l)return r+a(t,h,l,o[1],u[1]);r+=a(l,h,l,o[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=this.keys,r=Math.ceil(i.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},i.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},i.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(Zo),iu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],a=e[r+1];if(n[0]<=t&&a[0]>=t){var s=a[1]-n[1],o=void 0;if(0===s)o=(t-n[0])/(a[0]-n[0]);else o=(ou(t,n,a)-n[1])/s;return this.calculateVec(r,o)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(Zo),ru=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var a=e[n],s=e[n+1],o=new vi(i[n][0],i[n][1],i[n][2]),u=new vi(i[n+1][0],i[n+1][1],i[n+1][2]),h=new vi(r[2*n][0],r[2*n][1],r[2*n][2]),l=new vi(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=Xo(a,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Bo(o,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=Oo(t,5),i=0,r=new vi,n=this.keyTimeData;if(!n.length)return r;var a=this.curveSegments[n[0]].timeStart,s=this.curveSegments[n[n.length-1]].timeEnd;if(e<=a)return r=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=s)return r=this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<n.length;o++){var u=this.curveSegments[n[o]].timeStart,h=this.curveSegments[n[o]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[o]].pathCurve;i=this.getPercValue(n[o],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=Oo((e-r.x)/n,4);return li(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Zo),nu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var a=e[n],s=e[n+1],o=yi.fromArray(i[n]),u=yi.fromArray(i[n+1]),h=yi.fromArray(r[2*n]),l=yi.fromArray(r[2*n+1]),c=Xo(a,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Go(o,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=Oo(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<r.length;s++){var o=r[s].split("&"),u=o[0],h=o[1];if(i>=Number(u)&&i<Number(h)){var l=this.curveSegments[r[s]].pathCurve;return e=this.getPercValue(r[s],i),l.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=Oo((e-r.x)/n,4);return li(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Zo);function au(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function su(t,e,i,r,n){var a=t*t,s=e*e;return(2*(a*t)*(r-n)+3*a*(e*n-i*r)-s*e*(2*r+n)+3*s*i*r)/(6*(e-i))}function ou(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,s=(t-e[0])/r,o=s*s,u=o*s,h=u-2*o+s,l=u-o,c=-2*u+3*o;return(2*u-3*o+1)*e[1]+h*n+l*a+c*i[1]}function uu(t,e){if(e){var i=e[0],r=e[1];if(i===ee.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===ee.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var s=Math.ceil(a/2);t.lineSegCount+=s,t.curves.push(r),t.index+=s,t.max=Math.max(t.max,s)}else if(i===ee.BEZIER_CURVE){var o=r.length-1;t.index+=2*o,t.curves.push(r),t.max=Math.max(t.max,2*o),t.curveCount+=2*o}}}function hu(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function lu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(lu=function(){return!!t})()}function cu(t,e,i){return cu=lu()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Jt(n,i.prototype),n},cu.apply(null,arguments)}var fu,du,pu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new gr,e}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=Eu(t[0]),this.yCurve=Eu(t[1]),this.zCurve=Eu(t[2]),this.wCurve=Eu(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(Zo),mu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new vi,e}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=Eu(t[0]),this.yCurve=Eu(t[1]),this.zCurve=Eu(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(Zo),vu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new mi,e}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=Eu(t[0]),this.yCurve=Eu(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(Zo);!function(t){t[t.Cubic=0]="Cubic",t[t.Linear=1]="Linear",t[t.Constant=2]="Constant"}(fu||(fu={})),function(t){t[t.None=0]="None",t[t.In=1]="In",t[t.Out=2]="Out",t[t.Both=3]="Both"}(du||(du={}));var yu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=t;var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=gu(e[i],e[i+1]),n=r.points,a=r.curve,s=r.timeInterval,o=r.valueInterval,u=n[0],h=n[n.length-1];this.keys.push([].concat(u.toArray(),n[1].toArray())),this.keys.push([].concat(h.toArray(),n[2].toArray()));var l={points:n,timeInterval:s,valueInterval:o,curve:a,timeStart:Number(u.x),timeEnd:Number(h.x)};this.curveMap[u.x+"&"+h.x]=l,this.curveInfos.push(l)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,a=this.keyFrames[r+1].time;if(t>=n&&t<a){var s=this.curveInfos[r],o=s.points[0],u=s.timeInterval,h=s.valueInterval,l=(t-o.x)/u,c=s.curve.getValue(l);e=o.y+h*c;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var s=0;s<a.length;s++){var o=this.curveMap[a[s]].timeStart,u=this.curveMap[a[s]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[s],Number(u))),r>=Number(o)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[s],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,s=0,o=(e-r.x)/20,u=0;u<=20;u++){var h=u*o/n,l=r.y+a*i.curve.getValue(h);s+=0===u||20===u?l:u%2==1?4*l:2*l}return s*=o/3},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(Zo);function gu(t,e){var i=new mi(t.time,t.value),r=new mi,n=new mi,a=new mi,s=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,o=2===t.tangentMode,u=(s?t.outWeight:1)*(e.time-t.time)/3;r.x=t.time+u,r.y=t.value+u*(o?0:t.outSlope);var h=(s?e.inWeight:1)*(e.time-t.time)/3;n.x=e.time-h,n.y=e.value-h*(o?0:e.inSlope),a.x=e.time,a.y=o?t.value:e.value,ut(n),ut(a);var l,c,f=a.x-i.x,d=a.y-i.y,p=Oo((r.x-i.x)/f,5),m=Oo((n.x-i.x)/f,5);Ro(d,0)?l=c=NaN:(l=Oo((r.y-i.y)/d,5),c=Oo((n.y-i.y)/d,5)),p<0&&(console.error("Invalid bezier points, x1 < 0",i,r,n,a),p=0),m<0&&(console.error("Invalid bezier points, x2 < 0",i,r,n,a),m=0),p>1&&(console.error("Invalid bezier points, x1 >= 1",i,r,n,a),p=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",i,r,n,a),m=1);var v,y=("bez_"+p+"_"+l+"_"+m+"_"+c).replace(/\./g,"p");return Po[y]?v=Po[y]:(v=Ro(d,0)?new jo:s?new jo(p,l,m,c):new jo(l,c),Po[y]=v),{points:[i,r,n,a],timeInterval:f,valueInterval:d,curve:v}}function xu(t){for(var e=t,i=[],r=[],n={x:0,y:0},a=0;a<e.length-1;a++){var s=e[a],o=e[a+1],u=Ho(s,o,!0),h=u.p0,l=u.p1,c=u.p2,f=u.p3;ut(c),ut(f);var d={leftControl:n,value:h,rightControl:l,tangentMode:0};if(s[0]===ie.HOLD&&(d.tangentMode=2),r.push(d),n=c,a===e.length-2){var p=Ho(o,o,!0);ut(p.p3),r.push({leftControl:c,value:p.p3,rightControl:{x:0,y:0},tangentMode:o[0]===ie.HOLD?2:0})}}for(var m=function(t,e){return(e.y-t.y)/(e.x-t.x+oi)},v=0;v<r.length;v++){var y=r[v].leftControl,g=r[v].value,x=r[v].rightControl,b=m(g,x),T=m(y,g),E={time:g.x,value:g.y,inSlope:T,outSlope:b,inWeight:0,outWeight:0,tangentMode:r[v].tangentMode,weightedMode:3};i.push(E),v>0&&(E.inWeight=(g.x-y.x)/((g.x-r[v-1].value.x)/3)),v+1<r.length&&(E.outWeight=(x.x-g.x)/((r[v+1].value.x-g.x)/3))}return i}var bu,Tu=((bu={})[ee.RANDOM]=function(t){return C(t[0],Array)?new Jo(t):new Qo(t)},bu[ee.CONSTANT]=function(t){return new qo(t)},bu[ee.CONSTANT_VEC2]=function(t){return new qo(t)},bu[ee.CONSTANT_VEC3]=function(t){return new qo(t)},bu[ee.CONSTANT_VEC4]=function(t){return new qo(t)},bu[ee.RGBA_COLOR]=function(t){return new qo(t)},bu[ee.COLORS]=function(t){return new Ko(t.map((function(t){return U(t,!1)})))},bu[ee.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new $o([t[0][1],t[1][1]]):new eu(t)},bu[ee.GRADIENT_COLOR]=function(t){return new tu(t)},bu[ee.LINEAR_PATH]=function(t){return new iu(t)},bu[ee.BEZIER_CURVE]=function(t){return 1===t.length?new qo(t[0][1][1]):new yu(xu(t))},bu[ee.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new qo(cu(vi,[].concat(t[1][0]))):new ru(t)},bu[ee.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new qo(cu(yi,[].concat(t[1][0]))):new nu(t)},bu[ee.COLOR_CURVE]=function(t){return new _u(t)},bu[ee.VECTOR4_CURVE]=function(t){return new pu(t)},bu[ee.VECTOR2_CURVE]=function(t){return new vu(t)},bu[27]=function(t){return new mu(t)},bu);function Eu(t){if(!t||!isNaN(+t))return new qo(t||0);if(C(t,Zo))return t;if(bt(Tu[t[0]]))return Tu[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Hs["ValueType: 21/22 is not supported"]+".")}var _u=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Er,e}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=Eu(t[0]),this.gCurve=Eu(t[1]),this.bCurve=Eu(t[2]),this.aCurve=Eu(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(Zo),wu=1,Cu=function(){function t(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),a=this.createGeometry();this.mesh=this.createMesh(a,n),this.updateMesh()}var e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new vi,n=new yi,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},e.createMaterial=function(t){var e,i=[["ENV_EDITOR",(null==(e=this.engine.renderer)?void 0:e.env)===Xs]],r=Eu(this.color).getValue(0),n={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:In.GLSL1,cacheId:t.cachePrefix+"_effects_interact",macros:i},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=On.create(this.engine,n);return a.blending=!0,a.depthTest=!1,a.setVector4("uPos",new gr(0,0,0,0)),a.setVector2("uSize",new mi(1,1)),a.setVector4("uColor",new gr(r[0]/255,r[1]/255,r[2]/255,r[3])),a.setQuaternion("uQuat",new yi(0,0,0,0)),a},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return Wn.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:Mr.LINES,maxVertex:4})},e.createMesh=function(t,e){return ra.create(this.engine,{name:"Interact_preview"+wu++,priority:0,worldMatrix:_r.fromIdentity(),geometry:t,material:e})},t}(),Au=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.speed=25,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.invalidBorderRange=0,e.invalidByBorderRange=!1,e.duringPlay=!1,e._interactive=!0,e.lastTime=-1,e.getHitTestParams=function(t){if(e.clickable){var i=e.item.props.content.options.behavior,r=e.getBoundingBox();return r?{type:r.type,triangles:r.area,behavior:i}:void 0}},e}$t(e,t);var i=e.prototype;return i.getDragRangeX=function(){return this.dragRange.dxRange},i.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},i.getDragRangeY=function(){return this.dragRange.dyRange},i.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},i.onStart=function(){var t=this.item.engine.renderer.env,e=this.item.composition,i=this.interactData.options,r=i.type,n=i.showPreview;if(r===Xt.CLICK&&(this.clickable=!0,n&&t===Xs)){var a=null==e?void 0:e.getRendererOptions();void 0!==a&&(this.previewContent=new Cu(this.item.props.content,a,this.transform,this.engine))}this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},i.onDisable=function(){t.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},i.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,i=this.item.engine.renderer.env;if(e===Xt.CLICK)this.clickable=!0;else if(e===Xt.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==Xs||n){var a,s=(null!=(a=this.item.composition)?a:{}).event;s&&this.beginDragTarget(r,s)}}},i.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,a=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,a.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,Su(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},i.endDragTarget=function(){},i.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,a=n.position,s=n.fov,o=e.dy,u=e.dx*e.width/e.height,h=a[2],l=Math.tan(s*Math.PI/180/2)*Math.abs(h),c=o*l,f=u*l,d=this.dragRange,p=d.dxRange,m=d.dyRange,v=a[0]-this.dragRatio[0]*f,y=a[1]-this.dragRatio[1]*c,g=p[0],x=p[1],b=m[0],T=m[1];if(v=li(v,g,x),y=li(y,b,T),v!==g&&v!==x&&g!==x)null==(i=e.origin)||i.preventDefault();if(y!==b&&y!==T&&b!==T)null==(r=e.origin)||r.preventDefault();this.item.composition.camera.position=new vi(v,y,h)}},i.beginDragTarget=function(t,i){var r=this;if("camera"===t.target){var n,a={touchstart:function(t){var e;if(r.canInteract()&&(r.invalidByBorderRange=r.checkInvalidBorderRange({x:t.x,y:t.y}),!r.invalidByBorderRange)){r.dragEvent=null,r.bouncingArg=null;var i=null==(e=r.item.composition)?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){r.invalidByBorderRange||(r.handleDragMove(n,t),r.bouncingArg=t)},touchend:function(t){if(r.canInteract()){var e=r.bouncingArg;!Su(e,3)&&e&&(e.vx*=r.speed,e.vy*=r.speed,r.dragEvent=ri({},n)),n=null}}};Object.keys(a).forEach((function(t){i.addEventListener(t,a[t])})),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(a).forEach((function(t){i.removeEventListener(t,a[t])}))}}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=Io(vi.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:ro.triangle,area:e}},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===Xt.DRAG){var i=e.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},i.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},i.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i=0,r=0,n=0,a=0;if("number"==typeof e)i=e,r=e,n=e,a=e;else if(xt(e)){var s,o,u,h,l;i=void 0===(o=(s=e)[0])?0:o,r=void 0===(u=s[1])?0:u,n=void 0===(h=s[2])?0:h,a=void 0===(l=s[3])?0:l}if(t.x<a-1||t.x>1-r||t.y<i-1||t.y>1-n)return!0}return!1},dr(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(yr);function Su(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}Au=S([ke(Ae.InteractComponent)],Au);var Iu,Ru=function(){function t(){this.triangles=[],this.worldMatrix=new _r,this.assemblyTriangles=function(t,e,i,r,n){for(var a=i;a<r;a+=3){var s=3*e[a],o=3*e[a+1],u=3*e[a+2],h={x:t[s],y:t[s+1],z:t[s+2]},l={x:t[o],y:t[o+1],z:t[o+2]},c={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:l,p2:c})}}}var e=t.prototype;return e.getBoundingBoxData=function(){return this.applyWorldMatrix(this.boundingBoxData.area),this.boundingBoxData},e.getBoundingBox=function(){for(var t,e=-Number.MAX_VALUE,i=-Number.MAX_VALUE,r=Number.MAX_VALUE,n=Number.MAX_VALUE,a=w(this.boundingBoxData.area);!(t=a()).done;){var s=t.value;e=Math.max(s.p0.x,s.p1.x,s.p2.x,e),i=Math.max(s.p0.y,s.p1.y,s.p2.y,i),r=Math.min(s.p0.x,s.p1.x,s.p2.x,r),n=Math.min(s.p0.y,s.p1.y,s.p2.y,n)}var o=[],u=new vi(r,i,0),h=new vi(e,i,0),l=new vi(e,n,0),c=new vi(r,n,0);return o.push({p0:u,p1:h,p2:l}),o.push({p0:u,p1:l,p2:c}),this.applyWorldMatrix(o),{type:ro.triangle,area:o}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var i,r=[],n=w(this.triangles);!(i=n()).done;){var a=i.value;r.push({p0:a.p0,p1:a.p1,p2:a.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxData={type:ro.triangle,area:r}},e.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,a=w(t.subMeshes);!(n=a()).done;){var s=n.value;if(void 0!==s.indexCount){var o=e.BYTES_PER_ELEMENT,u=s.offset/o,h=u+s.indexCount;this.assemblyTriangles(i,e,u,h,r)}}return r},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new vi),t.p1=e.worldMatrix.transformPoint(t.p1,new vi),t.p2=e.worldMatrix.transformPoint(t.p2,new vi)})),t},t}(),Ou=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return $t(e,t),e}(Qt),Mu=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=w(this.playableOutputs);!(e=i()).done;){e.value.context.deltaTime=t}for(var r,n=w(this.playableOutputs);!(r=n()).done;){var a=r.value;this.prepareFrameWithRoot(a)}for(var s,o=w(this.playableOutputs);!(s=o()).done;){var u=s.value;this.processFrameWithRoot(u)}},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrame(t.context),t.processFrame()},e.prepareFrameWithRoot=function(t){t.prepareFrame(),t.sourcePlayable.prepareFrame(t.context)},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&t.setTime(t.getTime()+e)},t}(),Nu=function(){function t(t,e){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0,t.addPlayable(this)}var e=t.prototype;return e.play=function(){switch(this.playState){case 0:break;case 1:this.playState=0,this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1}},e.pause=function(){if(0===this.playState)this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},t}(),Pu=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayable=function(t){this.sourcePlayable=t},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),Fu=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Be);function Lu(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}!function(t){t[t.Playing=0]="Playing",t[t.Paused=1]="Paused"}(Iu||(Iu={}));var Vu=new yi,Du=1,ku=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new vi(0,0,0),this.quat=new yi(0,0,0,1),this.rotation=new Zn(0,0,0),this.scale=new vi(1,1,1),this.anchor=new vi(0,0,0),this.size=new mi(1,1),this.children=[],this.worldMatrix=_r.fromIdentity(),this.localMatrix=_r.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new vi(0,0,0),quat:new yi(0,0,0,1),scale:new vi(1,1,1)},this.name="transform_"+Du++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){this.position.x===t&&this.position.y===e&&this.position.z===i||(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){0===t&&0===e&&0===i||(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===i||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){this.quat.x===t&&this.quat.y===e&&this.quat.z===i&&this.quat.w===r||(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){this.scale.x===t&&this.scale.y===e&&this.scale.z===i||(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,a=t.size,s=t.quat,o=t.name,u=t.anchor;if(o&&(this.name=o),i&&(C(i,vi)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),s)C(s,yi)?this.setQuaternion(s.x,s.y,s.z,s.w):this.setQuaternion(s[0],s[1],s[2],s[3]);else if(r){var h=e?-1:1;C(r,Zn)?this.setRotation(r.x*h,r.y*h,r.z*h):this.setRotation(r[0]*h,r[1]*h,r[2]*h)}n&&(C(n,vi)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(C(u,mi)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){V(this.children,t)},e.removeChild=function(t){D(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Zn)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Zn)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=(new vi).copyFrom(t.position),t.quat?e.quat=new yi(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new Zn(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=(new vi).copyFrom(t.scale),t.size&&(e.size=(new mi).copyFrom(t.size)),t.anchor&&(e.anchor=(new mi).copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var i=Vu.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},dr(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}(),zu=new vi(1,1,1),Uu=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new ku,this.viewportMatrix=_r.fromIdentity(),this.viewMatrix=_r.fromIdentity(),this.projectionMatrix=_r.fromIdentity(),this.viewProjectionMatrix=_r.fromIdentity(),this.inverseViewMatrix=_r.fromIdentity(),this.dirty=!0;var i=e.near,r=void 0===i?.1:i,n=e.far,a=void 0===n?20:n,s=e.fov,o=void 0===s?60:s,u=e.aspect,h=void 0===u?1:u,l=e.clipMode,c=void 0===l?te.portrait:l,f=e.position,d=void 0===f?[0,0,8]:f,p=e.rotation,m=void 0===p?[0,0,0]:p,v=new Zn(m[0],m[1],m[2]),y=(new yi).setFromEuler(v);this.options={near:r,far:a,fov:o,aspect:h,clipMode:c},this.transform.setPosition(d[0],d[1],d[2]),this.transform.setQuaternion(y.x,y.y,y.z,y.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new vi(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var a=i.projectPoint(e).z,s=r.projectPoint(new vi(1,1,a)),o=s.x,u=s.y,h=r.projectPoint(new vi(-1,-1,a)),l=h.x,c=h.y;return new vi((o-l)/2,(u-c)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return ri({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,a=t.aspect,s=t.position,o=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=s,this.rotation=o,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,a=e.far,s=e.clipMode;this.projectionMatrix.perspective(i*ai,r,n,a,s===te.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),zu),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:_r.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},dr(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.transform.position.clone()},set:function(t){this.transform.position.equals(t)||(this.transform.setPosition(t.x,t.y,t.z),this.dirty=!0)}},{key:"worldPosition",get:function(){return this.transform.getWorldPosition()}},{key:"rotation",get:function(){return this.transform.rotation.clone()},set:function(t){this.transform.rotation.equals(t)||(this.transform.setRotation(t.x,t.y,t.z),this.dirty=!0)}}]),t}(),Bu=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=C(r,Zo)?r:Eu(r),this.cycles=+n||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),Gu=function(t){this.content=t},ju=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new Gu(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(this.sort(i.content,e.content)<=0))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new Gu(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(this.sort(e.content,i.content)<=0))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,a=t.next;n.next=a,a&&(a.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do{t.call(e||this,i.content,r++)}while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do{t.call(e||this,i.content,r--)}while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),Xu="runtime_env",Hu="lookup_texture",Wu="offscreen_canvas",Yu="post_process_settings",Zu={};function qu(t){return Zu[t]}function Ku(t,e){return Zu[t]=e}var Qu=new vi,Ju=new vi,$u=function(){function t(t,e){this.pointStart=[];var i,r=e.colorOverLifetime,n=e.colorOverTrail,a=e.maxTrailCount,s=e.opacityOverLifetime,o=void 0===s?Eu(1):s,u=e.widthOverTrail,h=e.name,l=e.occlusion,c=e.blending,f=e.maskMode,d=e.mask,p=e.textureMap,m=void 0===p?[0,0,1,1]:p,v=e.texture,y=e.transparentOcclusion,g=e.minimumVertexDistance,x=e.lifetime,b=e.matrix,T=t.gpuCapability,E=T.detail,_=T.level,w=Math.max(e.pointCountPerTrail,2),A={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},S=E.maxVertexTextures>0,I=(null!=(i=t.renderer)?i:{}).env,R={},O=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",I===Xs]],M=a>64,N=0;r&&(O.push(["COLOR_OVER_LIFETIME",!0]),N|=1,R.uColorOverLifetime=fn.createWithData(t,rt(r))),n&&(O.push(["COLOR_OVER_TRAIL",!0]),N|=4,R.uColorOverTrail=fn.createWithData(t,rt(n))),M?(O.push(["ATTR_TRAIL_START",1]),N|=8):R.uTrailStart=new Float32Array(a),R.uOpacityOverLifetimeValue=o.toUniform(A);var P=u.toUniform(A);O.push(["VERT_CURVE_VALUE_COUNT",A.index],["VERT_MAX_KEY_FRAME_COUNT",A.max]),R.uVCurveValues=Zo.getAllData(A);var F={shader:{vertex:ga,fragment:va,macros:O,glslVersion:1===_?In.GLSL1:In.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+N+"+"+A.index+"+"+A.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},L=w*a*2,V=(w-1)*a,D=Float32Array.BYTES_PER_ELEMENT,k=12*D,z={attributes:{aColor:{size:4,stride:k,data:new Float32Array(12*L)},aSeed:{size:1,stride:k,offset:4*D,dataSource:"aColor"},aInfo:{size:3,stride:k,offset:5*D,dataSource:"aColor"},aPos:{size:4,stride:k,offset:8*D,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(L)},aDir:{size:3,data:new Float32Array(3*L)}},indices:{data:new Uint16Array(6*L)},drawCount:6*V,name:"trail#"+h,bufferUsage:Mr.DYNAMIC_DRAW};if(M)z.attributes.aTrailStart={size:1,data:new Float32Array(L)};else{var U=new Float32Array(L);z.attributes.aTrailStartIndex={size:1,data:U};for(var B=0;B<a;B++)for(var G=2*w,j=B*G,X=0;X<G;X++)U[j+X]=B}var H=zr(c),W=On.create(t,F);W.blending=!0,W.depthMask=l,W.depthTest=!0,W.stencilRef=d?[d,d]:void 0,Gr(W,f),Ur(W,c);var Y=this.mesh=ra.create(t,{name:"MTrail_"+h,material:W,geometry:Wn.create(t,z)}),Z=null!=v?v:fn.createWithData(t);Object.keys(R).map((function(t){var e=R[t];if(C(e,fn))W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new gr(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}W.setVector4Array(t,i)}else W.setVector4(t,gr.fromArray(e))})),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",gr.fromArray(P)),W.setVector2("uTexOffset",new mi(0,0)),W.setVector4("uTextureMap",gr.fromArray(m)),W.setVector4("uParams",new gr(0,w-1,0,0)),W.setTexture("uMaskTex",Z),W.setVector4("uColorParams",new gr(v?1:0,+H,0,+(l&&!y))),this.maxTrailCount=a,this.pointCountPerTrail=w,this.checkVertexDistance=g>0,this.minimumVertexDistance=Math.pow(g||.001,2),this.useAttributeTrailStart=M,this.lifetime=x,b&&(this.mesh.worldMatrix=b),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(a)}var e=t.prototype;return e.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,a=this.geometry,s=n-1,o=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,Qu);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+o,f=rh(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=6*c,y=new Float32Array(6);y.set(f,0),y.set(f,3),a.setAttributeSubData("aDir",v,y),a.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var g=i.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(p,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(p,16),x[19]=1,x.set(b,20),x[23]=-.5*m,a.setAttributeSubData("aColor",24*c,x),u>=0){var T=this.getTrailPosition(t,h,Ju),E=new Float32Array(rh(T,l,e)),_=6*(t*n+u);a.setAttributeSubData("aDir",_,E),a.setAttributeSubData("aDir",_+3,E);var w=t*n*2,C=new Uint16Array([2*u+w,2*u+1+w,2*o+w,2*o+w,2*u+1+w,2*o+1+w]),A=6*(t*s+(r-1)%s);a.setIndexSubData(A,C)}r=++this.trailCursors[t];var S=this.mesh.material,I=S.getVector4("uParams"),R=p[2];if(this.useAttributeTrailStart){for(var O=2*n,M=new Float32Array(O),N=0;N<O;N++)M[N]=R;a.setAttributeSubData("aTrailStart",t*M.length,M)}else{var P=S.getFloats("uTrailStart");null!=P&&(P[t]=R,S.setFloats("uTrailStart",P))}I&&(I.y=Math.max(I.y,r-1)-Math.max(0,r-n),S.setVector4("uParams",I))}},e.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=24*(t*r+e)+8,a=this.geometry.getAttributeData("aColor");return ut(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();ut(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},e.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");ut(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),i=this.geometry.getIndexData();ut(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},e.getPointStartPos=function(t){return this.pointStart[t]},e.setPointStartPos=function(t,e){this.pointStart[t]=e},e.onUpdate=function(t){},dr(t,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),t}(),th=new vi,eh=new vi,ih=new vi;function rh(t,e,i){var r=th;return t||i?(t?i?(eh.subtractVectors(e,t).normalize(),eh.subtractVectors(i,e),ih.copyFrom(eh).normalize(),r.addVectors(eh,ih)):r.subtractVectors(e,t):r.subtractVectors(i,e),r.normalize().toArray()):[0,0,0]}var nh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).lastTime=0,e}$t(e,t);var i=e.prototype;return i.start=function(t){var e=t.output.getUserData();!this.particleSystem&&C(e,gl)&&(this.particleSystem=e.getComponent(dh),this.particleSystem&&(this.particleSystem.name=e.name))},i.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;e&&(this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),e.update(this.time-e.time)),this.lastTime=this.time},e}(Nu),ah=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){return new nh(t)},e}(Fu),sh={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"},oh=function(){function t(t,e){var i;this.particleCount=0,this.cachedRotationVector3=new vi,this.cachedRotationMatrix=new qn,this.cachedLinearMove=new vi,this.tempMatrix3=new qn,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,a=(null!=(i=t.renderer)?i:{}).env,s=e.speedOverLifetime,o=e.colorOverLifetime,u=e.linearVelOverLifetime,h=e.orbitalVelOverLifetime,l=e.sizeOverLifetime,c=e.rotationOverLifetime,f=e.sprite,d=e.gravityModifier,p=e.maxCount,m=e.textureFlip,v=e.useSprite,y=e.name,g=e.gravity,x=e.forceTarget,b=e.side,T=e.occlusion,E=e.anchor,_=e.blending,w=e.maskMode,A=e.mask,S=e.transparentOcclusion,I=e.meshSlots,R=e.renderMode,O=void 0===R?0:R,M=e.diffuse,N=void 0===M?fn.createWithData(t):M,P=t.gpuCapability.detail,F=P.halfFloatTexture,L=P.maxVertexUniforms,V=[["RENDER_MODE",+O],["ENV_EDITOR",a===Xs]],D=t.gpuCapability.level,k={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},z={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},U=L>0,B={},G=0,j=0;(this.useSprite=v,U&&V.push(["ENABLE_VERTEX_TEXTURE",!0]),s&&(V.push(["SPEED_OVER_LIFETIME",!0]),j|=2,B.uSpeedLifetimeValue=s.toUniform(k)),(null==f?void 0:f.animate)&&(V.push(["USE_SPRITE",!0]),j|=4,B.uFSprite=B.uSprite=new Float32Array([f.col,f.row,f.total,f.blend?1:0]),this.useSprite=!0),(null==o?void 0:o.color)&&(V.push(["COLOR_OVER_LIFETIME",!0]),j|=16,B.uColorOverLifetime=C(o.color,fn)?o.color:fn.createWithData(t,rt(o.color))),(null==o?void 0:o.opacity)?B.uOpacityOverLifetimeValue=o.opacity.toUniform(k):B.uOpacityOverLifetimeValue=Eu(1).toUniform(k),["x","y","z"].forEach((function(t,e){var i=0,n=0;(null==u?void 0:u[t])&&(B["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=u[t].toUniform(k),i=1,j|=1<<7+e,u.enabled=!0),V.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==h?void 0:h[t])&&(B["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(k),n=1,j|=1<<10+e,r=!0,h.enabled=!0),V.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==u?void 0:u.asMovement)&&(V.push(["AS_LINEAR_MOVEMENT",!0]),j|=32),r&&((null==h?void 0:h.asRotation)&&(V.push(["AS_ORBITAL_MOVEMENT",!0]),j|=64),B.uOrbCenter=new Float32Array((null==h?void 0:h.center)||[0,0,0])),B.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(k),null==l?void 0:l.separateAxes)&&(V.push(["SIZE_Y_BY_LIFE",1]),j|=16384,B.uSizeYByLifetimeValue=null==l||null==(n=l.y)?void 0:n.toUniform(k));(null==c?void 0:c.z)&&(B.uRZByLifeTimeValue=c.z.toUniform(k),j|=32768,V.push(["ROT_Z_LIFETIME",1])),(null==c?void 0:c.x)&&(B.uRXByLifeTimeValue=c.x.toUniform(k),j|=65536,V.push(["ROT_X_LIFETIME",1])),(null==c?void 0:c.y)&&(B.uRYByLifeTimeValue=c.y.toUniform(k),j|=1<<17,V.push(["ROT_Y_LIFETIME",1])),(null==c?void 0:c.asRotation)&&(V.push(["ROT_LIFETIME_AS_MOVEMENT",1]),j|=1<<18),B.uGravityModifierValue=d.toUniform(k),x&&(V.push(["FINAL_TARGET",!0]),j|=1<<19,B.uFinalTarget=new Float32Array(x.target||[0,0,0]),B.uForceCurve=x.curve.toUniform(k)),F&&z.max?(j|=1<<20,B.uFCurveValueTexture=dn(t,Zo.getAllData(z,!0),z.index,1)):B.uFCurveValues=Zo.getAllData(z);var X=k.max+k.curves.length-32>L;if(2===D&&(k.max=-1,k.index=I?I[0]:hh(k.index),z.index>0&&(z.max=-1,z.index=I?I[1]:hh(z.index))),X&&F&&U){var H=dn(t,Zo.getAllData(k,!0),k.index,1);B.uVCurveValueTexture=H,G=1}else B.uVCurveValues=Zo.getAllData(k);var W=["-p:",O,j,k.index,k.max,z.index,z.max].join("+");V.push(["VERT_CURVE_VALUE_COUNT",k.index],["FRAG_CURVE_VALUE_COUNT",z.index],["VERT_MAX_KEY_FRAME_COUNT",k.max],["FRAG_MAX_KEY_FRAME_COUNT",z.max]),this.VERT_MAX_KEY_FRAME_COUNT=k.max;var Y={shader:{fragment:va,vertex:"#define LOOKUP_TEXTURE_CURVE "+G+"\n"+ya,glslVersion:1===D?In.GLSL1:In.GLSL3,shared:!0,cacheId:W,macros:V,name:"particle#"+y},uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},Z=zr(_);B.uTexOffset=new Float32Array(N?[1/N.getWidth(),1/N.getHeight()]:[0,0]),B.uMaskTex=N,B.uColorParams=new Float32Array([N?1:0,+Z,0,+(!!T&&!S)]),B.uParams=[0,0,0,0],B.uAcceleration=[(null==g?void 0:g[0])||0,(null==g?void 0:g[1])||0,(null==g?void 0:g[2])||0,0];var q=On.create(t,Y);q.blending=!0,q.depthTest=!0,q.depthMask=!!T,q.stencilRef=A?[A,A]:void 0,Gr(q,w),Ur(q,_),Br(q,b),Object.keys(B).map((function(t){var e=B[t];if(C(e,fn))q.setTexture(t,e);else{var i=[];switch(sh[t]){case"vec4":q.setVector4(t,gr.fromArray(e));break;case"vec3":q.setVector3(t,vi.fromArray(e));break;case"vec2":q.setVector2(t,mi.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new gr(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}q.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),q.setVector3("emissionColor",new vi(0,0,0)),q.setFloat("emissionIntensity",0);var K=Wn.create(t,function(t,e,i){var r=Float32Array.BYTES_PER_ELEMENT,n=12*r,a={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*r,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*r,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*r,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*r,data:new Float32Array(0)},aSeed:{size:1,offset:3*r,stride:8*r,dataSource:"aRot"},aColor:{size:4,offset:4*r,stride:8*r,dataSource:"aRot"},aOffset:{size:4,stride:4*r,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*r,data:new Float32Array(0)},aRotation1:{size:3,offset:3*r,stride:9*r,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*r,stride:9*r,dataSource:"aRotation0"}};e&&(a.aSprite={size:3,stride:3*r,data:new Float32Array(0)});return{attributes:a,indices:{data:new Uint16Array(0)},name:i,maxVertex:t}}(4*p,this.useSprite,"particle#"+y)),Q=ra.create(t,{name:"MParticle_"+y,material:q,geometry:K});this.anchor=E,this.mesh=Q,this.geometry=Q.firstGeometry(),this.forceTarget=x,this.sizeOverLifetime=l,this.speedOverLifetime=s,this.linearVelOverLifetime=u,this.orbitalVelOverLifetime=h,this.orbitalVelOverLifetime=h,this.gravityModifier=d,this.rotationOverLifetime=c,this.maxCount=p,this.textureOffsets=m?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var e=t.prototype;return e.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return ut(e),[e[i],e[i+1],e[i+2],e[i+3]]},e.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.constructor(0))}t.setIndexData(new i.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),i=Math.ceil(e.length/12);this.applyTranslation(i,t),this.applyRotation(i,t),this.applyLinearMove(i,t)},e.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r=t+1,n=4*r,a=this.geometry,s=r>this.maxParticleBufferCount,o=1;this.particleCount>300?o=(this.particleCount+100)/this.particleCount:this.particleCount>100?o=1.4:this.particleCount>0&&(o=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},h=this.useSprite;h&&(u.aSprite=new Float32Array(12));var l=new vi,c=new yi,f=new vi(1,1,1);e.transform.assignWorldTRS(l,c,f);var d,p=ku.getRotation(c,new Zn),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();h&&(d=e.sprite);for(var w=0;w<4;w++){var C=2*w,A=3*w,S=4*w,I=12*w,R=8*w;u.aPos.set(m,I),b.fill(u.aPos,I+3),u.aRot.set(v,R),u.aRot[R+3]=_,u.aRot.set(T,R+4),h&&u.aSprite.set(d,A);var O=e.uv||x;if(O){var M=h?1-y[C+1]:y[C+1];g[0]=O[0]+y[C]*O[2],g[1]=O[1]+M*O[3]}u.aOffset.set(g,S);for(var N=w+w,P=(E[N]-this.anchor.x)*f.x,F=(E[N+1]-this.anchor.y)*f.y,L=0;L<3;L++)u.aPos[I+6+L]=e.dirX.getElement(L)*P,u.aPos[I+9+L]=e.dirY.getElement(L)*F}var V=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(s){var D=z(a.getIndexData(),6*r,6*i,o);D.set(V,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,V);Object.keys(u).forEach((function(e){var r=u[e],h=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=a.getAttributeData(e);ut(l);var c=z(l,n*h,4*i*h,o);c.set(r,r.length*t),a.setAttributeData(e,c)}else a.setAttributeSubData(e,r.length*t,r)})),this.particleCount=Math.max(r,this.particleCount),a.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var s=0,o=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),l=this.mesh.material.getVector4("uGravityModifierValue"),c=0;c<t;c+=4){var f=12*c+3;s=n[f],o=n[f+1],u=n[f+2];var d=i-a[4*c+2],p=a[4*c+3];if(h&&l){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);s=s*x+v,o=o*x+y,u=u*x+g}else s+=v,o+=y,u+=g}var b=3*c;if(a[4*c+2]<i){var T=s*(e/1e3),E=o*(e/1e3),_=u*(e/1e3);r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},e.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),a=this.geometry.getAttributeData("aSeed"),s=this.time,o=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var h=li((s-r[4*u+2])/r[4*u+3],0,1),l=8*u,c=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),f=a[8*u+3],d=c;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(C(this.rotationOverLifetime.x,Qo)?d.x+=this.rotationOverLifetime.x.getValue(h,f):d.x+=this.rotationOverLifetime.x.getValue(h)),this.rotationOverLifetime.y&&(C(this.rotationOverLifetime.y,Qo)?d.y+=this.rotationOverLifetime.y.getValue(h,f):d.y+=this.rotationOverLifetime.y.getValue(h)),this.rotationOverLifetime.z&&(C(this.rotationOverLifetime.z,Qo)?d.z+=this.rotationOverLifetime.z.getValue(h,f):d.z+=this.rotationOverLifetime.z.getValue(h))):o.setZero(),0===d.dot(d)&&o.identity();var p=Math.PI/180,m=d.x*p,v=d.y*p,y=d.z*p,g=Math.sin(m),x=Math.sin(v),b=Math.sin(y),T=Math.cos(m),E=Math.cos(v),_=Math.cos(y);o.set(_,-b,0,b,_,0,0,0,1),o.multiply(this.tempMatrix3.set(E,0,x,0,1,0,-x,0,E)),o.multiply(this.tempMatrix3.set(1,0,0,0,T,-g,0,g,T));var w=9*u,A=o.elements;i.set(A,w),u+4<=t&&(i.set(A,w+9),i.set(A,w+18),i.set(A,w+27))}this.geometry.setAttributeData("aRotation0",i)},e.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var s=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var o=0;o<t;o+=4){var u=a-r[4*o+2],h=r[4*o+3],l=u/h,c=n[8*o+3];s.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(C(this.linearVelOverLifetime.x,Qo)?s.x=this.linearVelOverLifetime.x.getValue(l,c):s.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(C(this.linearVelOverLifetime.y,Qo)?s.y=this.linearVelOverLifetime.y.getValue(l,c):s.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(C(this.linearVelOverLifetime.z,Qo)?s.z=this.linearVelOverLifetime.z.getValue(l,c):s.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(C(this.linearVelOverLifetime.x,Qo)?s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,c):s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.y&&(C(this.linearVelOverLifetime.y,Qo)?s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,c):s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.z&&(C(this.linearVelOverLifetime.z,Qo)?s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,c):s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,h)));var f=3*o;i[f]=s.x,i[f+1]=s.y,i[f+2]=s.z,i[f+3]=s.x,i[f+4]=s.y,i[f+5]=s.z,i[f+6]=s.x,i[f+7]=s.y,i[f+8]=s.z,i[f+9]=s.x,i[f+10]=s.y,i[f+11]=s.z}this.geometry.setAttributeData("aLinearMove",i)},e.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},t}(),uh=[10,32,64,160];function hh(t){for(var e=0;e<uh.length;e++){var i=uh[e];if(i>t)return i}return t||uh[0]}function lh(t,e,i){var r;void 0===i&&(i="");var n,a=t.content,s=+((null==(r=a.renderer)?void 0:r.renderMode)||0),o=[["RENDER_MODE",s],["ENV_EDITOR",i===Xs]],u=e.level,h=e.detail,l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=h.maxVertexUniforms>0,d=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,p=0,m=0;f&&o.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(o.push(["SPEED_OVER_LIFETIME",!0]),m|=2,uu(l,d));var v=a.textureSheetAnimation;v&&v.animate&&(o.push(["USE_SPRITE",!0]),m|=4);var y=a.colorOverLifetime;y&&y.color&&(o.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&uu(l,g);var x,b=a.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[r])&&(uu(l,b[r]),i=1,m|=1<<7+e),o.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==b?void 0:b[n])&&(uu(l,b[n]),a=1,m|=1<<10+e,x=!0),o.push(["ORB_VEL_"+t.toUpperCase(),a])})),(null==b?void 0:b.asMovement)&&(o.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),x&&(null==b?void 0:b.asRotation)&&(o.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64),a.sizeOverLifetime){var T=a.sizeOverLifetime;T.separateAxes?(uu(l,T.x),o.push(["SIZE_Y_BY_LIFE",1]),m|=16384,uu(l,T.y)):uu(l,T.size)}if(a.rotationOverLifetime){var E=a.rotationOverLifetime;E.z&&(uu(l,null==E?void 0:E.z),m|=32768,o.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(uu(l,E.x),m|=65536,o.push(["ROT_X_LIFETIME",1])),E.y&&(uu(l,E.y),m|=1<<17,o.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(o.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=1<<18)}uu(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(o.push(["FINAL_TARGET",!0]),m|=1<<19,uu(l,b.forceCurve));var _=h.halfFloatTexture;_&&c.max&&(m|=1<<20);var w=h.maxVertexUniforms,C=l.max+l.curves.length-32>w;qu(Hu)&&(C=!0),2===u&&(l.max=-1,c.index>0&&(c.max=-1)),C&&_&&f&&(p=1);var A=["-p:",s,m,l.index,l.max,c.index,c.max].join("+"),S={fragment:va,vertex:"#define LOOKUP_TEXTURE_CURVE "+p+"\n"+ya,shared:!0,cacheId:A,macros:o,name:"particle#"+t.name};return o.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",c.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",c.max]),{shader:S,vertex:l.index,fragment:c.index}}function ch(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var a=0;a<t.macros.length;a++){var s=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===s[0])s[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===s[0]){s[1]=i;break}}}var fh=function(t){function e(e,i,r){var n;(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new oh(e,i)),r&&(n.trailMesh=new $u(e,r));var a=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(a.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=a,n}$t(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=w(this.meshes);!(t=e()).done;){t.value.onStart()}},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new gr;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t);for(var e,i=w(this.meshes);!(e=i()).done;){e.value.render(t)}},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach((function(i){t.push(e[i])})),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach((function(e){t.push(i[e])}))}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(yr),dh=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).destroyed=!1,r.getHitTestParams=function(t){var e=r.interaction;if(t||e)return{type:ro.custom,collect:function(t){return r.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===ne.removeParticle,ray:t})}}},r.maskManager=new Mn(e),i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.isFrozen=function(){return this.frozen},i.isEnded=function(){return this.ended},i.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===ee.CONSTANT_VEC3?e.add(r[1]):t=Eu(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},i.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},i.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var a=r.first;r.removeNode(a),i=n[1]=a.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},i.setVisible=function(t){this.renderer.setVisible(t)},i.getTextures=function(){return this.renderer.getTextures()},i.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new ju((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1,this.destroyed=!1},i.onStart=function(){this.startEmit(),this.initEmitterTransform()},i.onUpdate=function(t){this.update(t)},i.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var s=this.particleLink,o=(i-n)/this.item.duration,u=this.timePassed,h=!1,l=function(){e.trails&&!h&&(h=!0,s.forEach((function(t){var i=t[0],r=t[1],n=t[2],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,o,a,n)})))};if(this.ended){if(this.item.endBehavior!==re.restart&&re.destroy===this.item.endBehavior){var c=s.last;c&&c.content[0]<this.time&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/a.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=m,y=p/m,g=i,x=r.maxCount;this.updateEmitterTransform(u);for(var b=function(){var t=s.first;return e.emissionStopped||s.length===x&&t&&t.content[0]-n>u},T=0;T<v&&T<x&&!b();T++){var E=this.createPoint(d);E.delay+=g+T*y,this.addParticle(E,x),this.lastEmitTime=u}for(var _=a.bursts,w=(null==_?void 0:_.length)-1,C=0;w>=0&&C<x&&!b();w--){var A=_[w],S=!A.disabled&&A.getGeneratorOptions(u,d);if(S){var I=a.burstOffsets[w],R=I&&I[S.cycleIndex]||[0,0,0];A.once&&this.removeBurst(w);for(var O=0;O<S.count&&C<x;O++){var M;if(b())break;var N=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:O,burstCount:S.count}));N.delay+=g,C++,(M=N.transform).translate.apply(M,[].concat(R)),this.addParticle(N,x)}}}}else if(this.item.endBehavior===re.restart)l(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.time-=f,a.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=f,t[2]-=f,t[3].delay-=f})),this.renderer.minusTimeForLoop(f);else{this.ended=!0,this.item.endBehavior===re.freeze&&(this.frozen=!0)}}l()}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=[],i=0;i<this.renderer.meshes.length;i++){var r=this.renderer.meshes[i].material;e.push(r.colorMask),r.colorMask=!1}for(var n,a=w(this.renderer.meshes);!(n=a()).done;){n.value.render(t)}for(var s=0;s<this.renderer.meshes.length;s++){this.renderer.meshes[s].material.colorMask=e[s]}}},i.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach((function(t){return t.dispose({material:{textures:mt.keep}})}))},i.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!t||!e)return i;for(var a=t.last,s=!1;!s;){var o=a.content[0],u=a.content[3];if(o>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),a.pre?a=a.pre:s=!0}++n>r&&(s=!0)}return i},i.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new vi,s=!1;if(r&&r.content)do{var o=r.content,u=o[0],h=o[1];o[2];var l=o[3];if(u>this.timePassed){var c=this.getPointPosition(l),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:c,radius:t.radius},a)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),r.content=[0]),n.push(c),t.multiple||(s=!0))}}while((r=r.pre)&&!s);return n}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var a=this.trails,s=this.getPointPosition(i),o=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(l*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){s.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&s.subtract(c)}n.addTrailPoint(t,s,{color:o,lifetime:l,size:h,time:r})}},i.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},i.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,s=void 0===a?[]:a,o=this.options.forceTarget,u=this.time-n,h=new vi,l=vi.fromArray(s);e.assignWorldTRS(h);var c=To(new vi,this.options,l,u,r,h,i);if(o){var f=o.target||[0,0,0],d=o.curve.getValue(u/r),p=1-d;c.x=c.x*p+f[0]*d,c.y=c.y*p+f[1]*d,c.z=c.z*p+f[2]*d}return c},i.initPoint=function(t){var e=this.options,i=this.lifetime,r=this.shape,n=e.startSpeed.getValue(i),a=e.particleFollowParent?_r.IDENTITY:this.transform.getWorldMatrix(),s=t.position,o=a.transformPoint(s,new vi),u=new ku({position:o,valid:!0}),h=t.direction;if(h=a.transformNormal(h,ph).normalize(),e.startTurbulence&&e.turbulence){for(var l=0;l<3;l++)xh.setElement(l,e.turbulence[l].getValue(i));bh.setFromVector3(xh.negate()),Eh.setFromEuler(bh).transformNormal(h).normalize()}var c,f=yh,d=gh;r.alignSpeedDirection?(d.copyFrom(h),this.upDirectionWorld||(r.upDirection?this.upDirectionWorld=r.upDirection.clone():this.upDirectionWorld=vi.Z.clone(),a.transformNormal(this.upDirectionWorld)),f.crossVectors(d,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),d.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((c=Th)[0]=p.animationDelay.getValue(i),c[1]=p.animationDuration.getValue(i),c[2]=p.cycles.getValue(i));var m=vh;e.start3DRotation?m.set(e.startRotationX.getValue(i),e.startRotationY.getValue(i),e.startRotationZ.getValue(i)):e.startRotation?m.set(0,0,e.startRotation.getValue(i)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(i);3===v.length&&(v[3]=1);var y=mh;if(e.start3DSize)y.x=e.startSizeX.getValue(i),y.y=e.startSizeY.getValue(i);else{var g=e.startSize.getValue(i),x=e.sizeAspect.getValue(i);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new vi;this.transform.assignWorldTRS(void 0,void 0,T),y.x*=T.x,y.y*=T.y}return u.setScale(y.x,y.y,1),{size:y,vel:b,color:v,delay:e.startDelay.getValue(i),lifetime:e.startLifetime.getValue(i),uv:wh(this.uvs,!0),gravity:e.gravity,sprite:c,dirY:d,dirX:f,transform:u}},i.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&C(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return-1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:ro.sphere,area:t}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e;this.props=i,this.destroyed=!1;var r,n,a,s,o,u=i.options,h=i.positionOverLifetime,l=void 0===h?{}:h,c=i.shape,f=null==l?void 0:l.gravityOverLifetime,d=Eo(null==l?void 0:l.gravity),p=i.textureSheetAnimation,m=p?{animationDelay:Eu(p.animationDelay||0),animationDuration:Eu(p.animationDuration||1),cycles:Eu(p.cycles||1),animate:p.animate,col:p.col,row:p.row,total:p.total||p.col*p.row}:void 0,v=!!(c&&c.turbulenceX||(null==c?void 0:c.turbulenceY)||(null==c?void 0:c.turbulenceZ));v&&(r=[Eu(null!=(n=c.turbulenceX)?n:0),Eu(null!=(a=c.turbulenceY)?a:0),Eu(null!=(s=c.turbulenceZ)?s:0)]);this.name="ParticleSystem",this.shape=fs(c),this.emission={rateOverTime:Eu(i.emission.rateOverTime),burstOffsets:_h(null!=(o=i.emission.burstOffsets)?o:[]),bursts:(i.emission.bursts||[]).map((function(t){return new Bu(t)}))},this.textureSheetAnimation=m;var y,g,x=i.renderer||{},b=i.rotationOverLifetime;b&&((y={}).asRotation=!!b.asRotation,y.z=b.z?Eu(b.z):Eu(0),b.separateAxes&&(y.x=b.x&&Eu(b.x),y.y=b.y&&Eu(b.y))),(null==l?void 0:l.forceTarget)&&(g={target:l.target||[0,0,0],curve:Eu(l.forceCurve||[ee.LINE,[[0,0],[1,1]]])});var T={x:l.linearX&&Eu(l.linearX||0),y:l.linearY&&Eu(l.linearY||0),z:l.linearZ&&Eu(l.linearZ||0),asMovement:l.asMovement},E={x:l.orbitalX&&Eu(l.orbitalX),y:l.orbitalY&&Eu(l.orbitalY),z:l.orbitalZ&&Eu(l.orbitalZ),center:l.orbCenter,asRotation:l.asRotation},_=i.sizeOverLifetime||{},w=i.colorOverLifetime,A=(null==_?void 0:_.separateAxes)?{separateAxes:!0,x:Eu(_.x),y:Eu(_.y)}:{separateAxes:!1,x:Eu(("size"in _?_.size:_.x)||1)};x.anchor=x.anchor||[0,0];var S,I=mi.fromArray(x.anchor);this.options={particleFollowParent:!!u.particleFollowParent,startLifetime:Eu(u.startLifetime),startDelay:Eu(u.startDelay||0),startSpeed:Eu(l.startSpeed||0),startColor:Eu(u.startColor),looping:!1,maxCount:null!=(S=u.maxCount)?S:0,gravityModifier:Eu(f||0),gravity:d,start3DSize:!!u.start3DSize,startTurbulence:v,turbulence:r,speedOverLifetime:l.speedOverLifetime&&Eu(l.speedOverLifetime),linearVelOverLifetime:T,orbitalVelOverLifetime:E,forceTarget:g},u.startRotationZ&&(this.options.startRotation=Eu(u.startRotationZ||0)),(u.startRotationX||u.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=Eu(u.startRotationX||0),this.options.startRotationY=Eu(u.startRotationY||0),this.options.startRotationZ=Eu(u.startRotationZ||0)),u.start3DSize?(this.options.startSizeX=Eu(u.startSizeX),this.options.startSizeY=Eu(u.startSizeY)):(this.options.startSize=Eu(u.startSize),this.options.sizeAspect=Eu(u.sizeAspect||1)),i.mask&&this.maskManager.setMaskOptions(i.mask);var R={meshSlots:u.meshSlots,name:this.name,matrix:_r.IDENTITY,shaderCachePrefix:"",renderMode:x.renderMode||Yt.BILLBOARD,side:x.side||Ut.DOUBLE,gravity:d,blending:x.blending||zt.ALPHA,rotationOverLifetime:y,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:m,occlusion:!!x.occlusion,transparentOcclusion:!!x.transparentOcclusion,maxCount:u.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:g,diffuse:x.texture?this.engine.findObject(x.texture):void 0,sizeOverLifetime:A,anchor:I};if(w){var O=w.color,M=w.opacity;R.colorOverLifetime={},M&&(R.colorOverLifetime.opacity=Eu(w.opacity)),O&&(O[0]===ee.GRADIENT_COLOR?R.colorOverLifetime.color=w.color[1]:O[0]===ee.RGBA_COLOR?R.colorOverLifetime.color=fn.createWithData(this.engine,{data:new Uint8Array(O[1]),width:1,height:1}):C(O,fn)&&(R.colorOverLifetime.color=O))}var N,P=[],F=[0,0,1,1];if(i.splits){var L=i.splits[0];F=(N=L[4])?[L[0],L[1],L[3],L[2]]:[L[0],L[1],L[2],L[3]]}if(m&&!m.animate)for(var V=N?m.row:m.col,D=N?m.col:m.row,k=m.total||V*D,z=0,U=0;U<V;U++)for(var B=0;B<D&&z<k;B++,z++)P.push([U*F[2]/V+F[0],B*F[3]/D+F[1],F[2]/V,F[3]/D]);else P.push(F);this.uvs=P,R.textureFlip=N;var G,j=i.trails;j&&(this.trails={lifetime:Eu(j.lifetime),dieWithParticles:!1!==j.dieWithParticles,sizeAffectsWidth:!!j.sizeAffectsWidth,sizeAffectsLifetime:!!j.sizeAffectsLifetime,inheritParticleColor:!!j.inheritParticleColor,parentAffectsPosition:!!j.parentAffectsPosition},j.mask&&this.maskManager.setMaskOptions(j.mask),G={name:"Trail",matrix:_r.IDENTITY,minimumVertexDistance:j.minimumVertexDistance||.02,maxTrailCount:u.maxCount,pointCountPerTrail:Math.round(j.maxPointPerTrail)||32,blending:j.blending,texture:j.texture?this.engine.findObject(j.texture):void 0,opacityOverLifetime:Eu(j.opacityOverLifetime||1),widthOverTrail:Eu(j.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!j.occlusion,transparentOcclusion:!!j.transparentOcclusion,textureMap:j.textureMap,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},j.colorOverLifetime&&j.colorOverLifetime[0]===ee.GRADIENT_COLOR&&(G.colorOverLifetime=j.colorOverLifetime[1]),j.colorOverTrail&&j.colorOverTrail[0]===ee.GRADIENT_COLOR&&(G.colorOverTrail=j.colorOverTrail[1])),this.renderer=new fh(this.engine,R,G),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var X,H=i.interaction;H&&(this.interaction={multiple:H.multiple,radius:null!=(X=H.radius)?X:.4,behavior:H.behavior});this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},dr(e,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),e}(pr);dh=S([ke(Ae.ParticleSystem)],dh);var ph=new vi,mh=new mi,vh=new Zn,yh=new vi,gh=new vi,xh=new vi,bh=new Zn,Th=[0,0,0],Eh=new _r;function _h(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var i=C(t,Array),r=i?t[0]:t.index,n=e[r];n||(n=e[r]=[]),i?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function wh(t,e){var i=Math.floor(Math.random()*t.length),r=t[i];return e||t.splice(i,1),r}var Ch,Ah=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}$t(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=w(this.clipPlayables);!(e=i()).done;){e.value.processFrame(t)}this.evaluate(t)},i.setClipWeight=function(t,e){if(C(t,Nu)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t)return void(this.clipWeights[i]=e)}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(Nu),Sh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(C(e,gl)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},e}(Ah),Ih=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(Nu),Rh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyName="",e}return $t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(e){var i=!1;if(this.propertyValue=e[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var a=this.getClipPlayable(r);if(!C(a,Ih)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var s=a.value;this.addWeightedValue(s,n),i=!0}}i&&(e[this.propertyName]=this.propertyValue)}}},e}(Ah),Oh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(Rh),Mh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(Rh),Nh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){},e}(Ah),Ph=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){},e}(Ah),Fh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();C(e,ll)&&(e.time=this.getTime())},e}(Nu),Lh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(C(e,ll)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},e}(Ah),Vh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){},e}(Ah),Dh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(Rh),kh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(Rh),zh=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===re.restart?e%=i:this.endBehavior===re.freeze&&(e=Math.min(i,e))),e},t}(),Uh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}$t(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new Ah(t)},i.createOutput=function(){return new Pu},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=w(this.clips);!(i=n()).done;){var a=i.value;r.push(a)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),a=w(e);!(r=a()).done;){var s=r.value,o=this.createClipPlayable(t,s);o.setDuration(s.duration);var u=new Bh(s,o,n,this);i.push(u),n.clipPlayables.push(o),n.setClipWeight(o,0)}return n},i.createPlayable=function(t){return new Nu(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new zh;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=w(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=w(this.children);!(i=r()).done;){i.value.parent=this}},e}(Fu);S([ze(zh)],Uh.prototype,"clips",void 0),S([ze()],Uh.prototype,"children",void 0),Uh=S([ke(Ae.TrackAsset)],Uh),function(t){t[t.MasterTrack=0]="MasterTrack",t[t.ObjectTrack=1]="ObjectTrack"}(Ch||(Ch={}));var Bh=function(){function t(t,e,i,r){this.clip=t,this.playable=e,this.parentMixer=i,this.track=r,C(this.track.boundObject,gl)&&(this.particleSystem=this.track.boundObject.getComponent(dh))}return t.prototype.evaluateAt=function(t){var e=this.clip,i=1,r=!1,n=!1,a=this.track.boundObject;t>=e.start+e.duration&&e.endBehavior===re.destroy?C(a,gl)&&gl.isParticle(a)&&this.particleSystem&&!this.particleSystem.destroyed?i=1:(i=0,r=!0):t-this.clip.start>=0?(i=1,n=!0):t<e.start&&(i=0),n&&this.playable.getPlayState()!==Iu.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,i);var s=e.toLocalTime(t);this.playable.setTime(s),r&&this.playable.getPlayState()===Iu.Playing&&this.playable.pause()},dr(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}(),Gh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Sh(t)},e}(Uh);Gh=S([ke(Ae.ActivationTrack)],Gh);var jh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}$t(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(Uh);S([ze()],jh.prototype,"path",void 0);var Xh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new Mh(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},e}(jh);Xh=S([ke(Ae.FloatPropertyTrack)],Xh);var Hh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Ph(t)},e}(Uh);Hh=S([ke(Ae.SpriteColorTrack)],Hh);var Wh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){if(!this.parent||!C(this.parent.boundObject,gl))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(ll)},i.createTrackMixer=function(t){return new Lh(t)},e}(Uh);Wh=S([ke(Ae.SubCompositionTrack)],Wh);var Yh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Vh(t)},e}(Uh);Yh=S([ke(Ae.TransformTrack)],Yh);var Zh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.updateAnimatedObject=function(){C(this.parent.boundObject,yr)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(Uh);S([ze()],Zh.prototype,"index",void 0),Zh=S([ke("MaterialTrack")],Zh);var qh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Nh(t)},e}(Uh),Kh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){var e=new Dh(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(jh);Kh=S([ke(Ae.Vector4PropertyTrack)],Kh);var Qh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){var e=new kh(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(jh);Qh=S([ke("Vector2PropertyTrack")],Qh);var Jh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){var e=new Oh(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(jh);Jh=S([ke(Ae.ColorPropertyTrack)],Jh);var $h=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){var e=new Ih(t);return e.curve=Eu(this.curveData),e.value=e.curve.getValue(0),e},e}(Fu);S([ze()],$h.prototype,"curveData",void 0),$h=S([ke(Ae.ColorPropertyPlayableAsset)],$h);var tl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){var e=new Ih(t);return e.curve=Eu(this.curveData),e.value=e.curve.getValue(0),e},e}(Fu);S([ze()],tl.prototype,"curveData",void 0),tl=S([ke(Ae.FloatPropertyPlayableAsset)],tl);var el=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){return new Fh(t)},e}(Fu);el=S([ke(Ae.SubCompositionPlayableAsset)],el);var il=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){},i.create=function(t){if(C(this.boundObject,gl)){for(var e,i=this.boundObject,r=!1,n=w(this.getChildTracks());!(e=n()).done;){if(C(e.value,Gh)){r=!0;break}}if(r){if(i.getComponent(dh)){var a=t.createTrack(qh,this,"ParticleTrack");a.boundObject=this.boundObject;var s=a.createClip(ah);s.start=i.start,s.duration=i.duration,s.endBehavior=i.endBehavior}if(i.getComponent(Al)){var o=t.createTrack(_l,this,"ComponentTimeTrack");o.boundObject=this.boundObject.getComponent(Al);var u=o.createClip(wl);u.start=i.start,u.duration=i.duration,u.endBehavior=i.endBehavior}if(i.getComponent(br)){var h=t.createTrack(_l,this,"ComponentTimeTrack");h.boundObject=this.boundObject.getComponent(br);var l=h.createClip(wl);l.start=i.start,l.duration=i.duration,l.endBehavior=i.endBehavior}}}},e}(Uh);il=S([ke(Ae.ObjectBindingTrack)],il);var rl=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i}return t.prototype.addChild=function(t){this.children.push(t)},t}(),nl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}$t(e,t);var i=e.prototype;return i.createPlayable=function(t){for(var e,i=new al(t),r=w(this.tracks);!(e=r()).done;){var n=e.value;C(n,il)&&n.create(this)}return this.sortTracks(this.tracks),i.compileTracks(t,this.flattenedTracks),i},i.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},i.invalidate=function(){this.cacheFlattenedTracks=null},i.addSubTracksRecursive=function(t,e){for(var i,r=w(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,s=w(t.getChildTracks());!(a=s()).done;){var o=a.value;this.addSubTracksRecursive(o,e)}},i.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new sl(t[i],i));e.sort(ol),t.length=0;for(var r,n=w(e);!(r=n()).done;){var a=r.value;t.push(a.track)}},i.fromData=function(t){},dr(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=w(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(Fu);S([ze()],nl.prototype,"tracks",void 0),nl=S([ke(Ae.TimelineAsset)],nl);var al=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clips=[],e.masterTrackInstances=[],e}$t(e,t);var i=e.prototype;return i.prepareFrame=function(t){},i.evaluate=function(){for(var t,e=this.getTime(),i=w(this.clips);!(t=i()).done;){t.value.evaluateAt(e)}},i.compileTracks=function(t,e){for(var i,r=e,n={},a=w(r);!(i=a()).done;){var s=i.value,o=s.createPlayableGraph(t,this.clips),u=s.createOutput();u.setUserData(s.boundObject),t.addOutput(u),u.setSourcePlayable(o);var h=new rl(s,o,u);n[s.getInstanceId()]=h,s.parent||this.masterTrackInstances.push(h)}for(var l,c=w(r);!(l=c()).done;)for(var f,d=l.value,p=n[d.getInstanceId()],m=w(d.getChildTracks());!(f=m()).done;){var v=n[f.value.getInstanceId()];p.addChild(v)}},e}(Nu),sl=function(t,e){this.track=t,this.originalIndex=e};function ol(t,e){var i=t.track.boundObject,r=e.track.boundObject;return C(i,gl)&&C(r,gl)?gl.isAncestor(i,r)?-1:gl.isAncestor(r,i)?1:t.originalIndex-e.originalIndex:t.originalIndex-e.originalIndex}var ul=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){var e=new Ih(t);return e.curve=Eu(this.curveData),e.value=e.curve.getValue(0),e},e}(Fu);S([ze()],ul.prototype,"curveData",void 0),ul=S([ke(Ae.Vector4PropertyPlayableAsset)],ul);var hl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){var e=new Ih(t);return e.curve=Eu(this.curveData),e.value=e.curve.getValue(0),e},e}(Fu);S([ze()],hl.prototype,"curveData",void 0),hl=S([ke(Ae.Vector2PropertyPlayableAsset)],hl);var ll=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).time=0,e.items=[],e.state=Iu.Playing,e.reusable=!1,e.sceneBindings=[],e.graph=new Mu,e}$t(e,t);var i=e.prototype;return i.onStart=function(){var t;this.timelineAsset||(this.timelineAsset=new nl(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==re.destroy&&this.setReusable(!0),null==(t=this.item.composition)||t.refContent.push(this.item)},i.setReusable=function(t){for(var i,r=w(this.timelineAsset.tracks);!(i=r()).done;){var n=i.value.boundObject;if(C(n,gl)){var a=n.getComponent(e);a&&a.setReusable(t)}}},i.getReusable=function(){return this.reusable},i.pause=function(){this.state=Iu.Paused},i.resume=function(){this.state=Iu.Playing},i.onUpdate=function(t){if(this.state!==Iu.Paused){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.timelinePlayable.evaluate(),this.graph.evaluate(t)}},i.onEnable=function(){for(var t,e=w(this.items);!(t=e()).done;){t.value.setActive(!0)}},i.onDisable=function(){for(var t,e=w(this.items);!(t=e()).done;){t.value.setActive(!1)}},i.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},i.hitTest=function(t,e,i,r,n,a){for(var s,o=function(a){var o=s.items[a];if(o.isActive&&o.transform.getValid()&&!gl.isComposition(o)&&!l(o)){var c=o.getHitTestParams(n);if(c){var f=!1,d=new vi;if(c.type===ro.triangle)for(var p=c.triangles,m=c.backfaceCulling,v=0;v<p.length;v++){var y=p[v];if(t.intersectTriangle(y,d,m)){f=!0,u.push(d);break}}else if(c.type===ro.box){var g=c.center,x=c.size,b=g.clone().addScaledVector(x,.5),T=g.clone().addScaledVector(x,-.5);t.intersectBox({min:b,max:T},d)&&(f=!0,u.push(d))}else if(c.type===ro.sphere){var E=c.center,_=c.radius;t.intersectSphere({center:E,radius:_},d)&&(f=!0,u.push(d))}else if(c.type===ro.custom){var w=c.collect(t,new mi(e,i));w&&w.length>0&&(w.forEach((function(t){u.push(t)})),f=!0)}if(f){var C={compContent:s.item,id:o.id,name:o.name,position:u[u.length-1],parentId:o.parentId,hitPositions:u,behavior:c.behavior};if(o.emit("click",C),r.push(C),h(C))return{v:r}}}}},u=[],h=(null==a?void 0:a.stop)||yt,l=(null==a?void 0:a.skip)||yt,c=(null==a?void 0:a.maxCount)||this.items.length,f=0;f<this.items.length&&r.length<c;f++){var d=(s=this,o(f));if("object"===A(d))return d.v}return r},i.setChildrenRenderOrder=function(t){for(var i,r=w(this.items);!(i=r()).done;){var n=i.value;n.renderOrder=t++;var a=n.getComponent(e);a&&(t=a.setChildrenRenderOrder(t))}return t},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.resolveBindings=function(){for(var t,e=w(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,n=w(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value;this.updateTrackAnimatedObject(a)}},i.updateTrackAnimatedObject=function(t){for(var e,i=w(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},e}(pr);S([ze()],ll.prototype,"items",void 0),S([ze()],ll.prototype,"sceneBindings",void 0),S([ze()],ll.prototype,"timelineAsset",void 0),ll=S([ke("CompositionComponent")],ll);var cl,fl=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter((function(t){return t.listener!==i})))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];var a;null==(a=e.listeners[t])||a.forEach((function(i){var n=i.listener,a=i.options;n.apply(void 0,[].concat(r)),(null==a?void 0:a.once)&&e.off(t,n)}))},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map((function(t){return t.listener})))||[]}},dl=function(){function t(){this.update=new ml,this.lateUpdate=new vl}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==pr.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==pr.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==pr.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==pr.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),pl=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),ml=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=w(t);!(i=r()).done;){i.value.onUpdate(e)}},e}(pl),vl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=w(t);!(i=r()).done;){i.value.onLateUpdate(e)}},e}(pl),yl=function(t){function e(i,r){var n,a;(n=t.call(this)||this).sceneTicking=new dl,n.speed=1,n.isEnded=!1,n.loaderData={},n.refContent=[],n.startTime=0,n.postProcessingEnabled=!1,n.destroyed=!1,n.postLoaders=[],n.paused=!1,n.isEndCalled=!1,n._textures=[],n.videos=[];var s,o=i.reusable,u=void 0!==o&&o,h=i.speed,l=void 0===h?1:h,c=i.baseRenderOrder,f=void 0===c?0:c,d=i.renderer,m=i.event,v=i.width,y=i.height,g=i.handleItemMessage;n.renderer=d,n._textures=r.textures;for(var x,b=w(Object.keys(r.assets));!(x=b()).done;){var T=x.value,E=r.assets[T];C(E,p)&&n.videos.push(E)}n.postProcessingEnabled=null!=(s=null==(a=r.jsonScene.renderSettings)?void 0:a.postProcessingEnabled)&&s,n.getEngine().renderLevel=r.renderLevel,u&&(n.keepResource=!0,r.consumed=!0);for(var _,A=r.jsonScene.compositions[0],S=w(r.jsonScene.compositions);!(_=S()).done;){var I=_.value;I.id===r.jsonScene.compositionId&&(A=I)}ut(A),n.rootItem=new gl(n.getEngine()),n.rootItem.name="rootItem",n.rootItem.duration=A.duration,n.rootItem.endBehavior=A.endBehavior,n.rootItem.composition=Lu(n);for(var R,O,M,N,P=w(A.components);!(R=P()).done;){var F=R.value,L=n.getEngine().findObject(F);n.rootItem.components.push(L),L.item=n.rootItem}return n.rootComposition=n.rootItem.getComponent(ll),n.width=v,n.height=y,n.renderOrder=f,n.id=A.id,n.startTime=null!=(O=A.startTime)?O:0,n.renderer=d,n.event=m,n.statistic={loadStart:null!=(M=r.startTime)?M:0,loadTime:null!=(N=r.totalTime)?N:0,compileTime:0,firstFrameTime:0},n.reusable=u,n.speed=l,n.name=A.name,n.pluginSystem=r.pluginSystem,n.pluginSystem.initializeComposition(Lu(n),r),n.camera=new Uu(n.name,ri({},null==A?void 0:A.camera,{aspect:v/y})),n.url=r.url,n.interactive=!0,n.handleItemMessage=g,n.createRenderFrame(),n.rendererOptions=null,e.buildItemTree(n.rootItem),n.rootComposition.setChildrenRenderOrder(0),n.pluginSystem.resetComposition(Lu(n),n.renderFrame),n}$t(e,t);var i=e.prototype;return i.getDuration=function(){return this.rootItem.duration},i.restart=function(){this.reset(),this.forwardTime(this.startTime)},i.setIndex=function(t){this.renderOrder=t},i.getIndex=function(){return this.renderOrder},i.setSpeed=function(t){this.speed=t},i.setVisible=function(t){this.rootItem.setVisible(t)},i.getSpeed=function(){return this.speed},i.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},i.pause=function(){this.paused=!0,this.emit("pause")},i.getPaused=function(){return this.paused},i.resume=function(){this.paused=!1},i.gotoAndPlay=function(t){this.setTime(t),this.resume(),this.emit("play",{time:t})},i.gotoAndStop=function(t){this.setTime(t),this.pause()},i.createRenderFrame=function(){this.renderFrame=new Va({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},i.setTime=function(t){var e=this.speed,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0),this.emit("goto",{time:t})},i.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},i.getComponent=function(t){return this.rootItem.getComponent(t)},i.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},i.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},i.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)})),this.postLoaders.forEach((function(i){return i.postProcessFrame(t,e)}))},i.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=1e3*(this.time-e);this.updatePluginLoaders(i),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},i.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===re.destroy&&!this.reusable},i.callAwake=function(t){for(var e,i=w(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var n,a=w(t.children);!(n=a()).done;){var s=n.value;this.callAwake(s)}},i.updateCamera=function(){this.camera.updateMatrix()},i.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(i){return i.onCompositionUpdate(e,t)}))},i.updateCompositionTime=function(t){if(this.rootComposition.state!==Iu.Paused&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e-i>.001)switch(n=!0,r){case re.restart:e%=i,this.restart();break;case re.freeze:e=Math.min(i,e);case re.forward:case re.destroy:}this.rootComposition.time=e+this.startTime,this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},i.getItemByName=function(t){return this.rootItem.find(t)},i.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return So((t-i.z)/r,(e-i.w)/n,this.camera)},i.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},i.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],a=this.getHitTestRay(t,e);return this.refContent.forEach((function(s){var o;null==(o=s.getComponent(ll))||o.hitTest(a,t,e,n,i,r)})),n},i.addInteractiveItem=function(t,e){if(e===Xt.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},i.removeInteractiveItem=function(t,e){e===Xt.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},i.destroyItem=function(t){var e=this;t.type==Wt.composition?t.endBehavior!==re.freeze&&t.getComponent(ll).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(i){return i.onCompositionItemRemoved(e,t)}))})):(D(this.items,t),this.pluginSystem.plugins.forEach((function(i){return i.onCompositionItemRemoved(e,t)})))},i.lost=function(t){this.videoState=this.textures.map((function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime})),this.textures.map((function(t){return t.dispose()})),this.dispose()},i.dispose=function(){var t,e,i=this;if(!this.destroyed){this.destroyed=!0;var r={},n=this.textures;n&&this.keepResource&&n.forEach((function(t){(null==t?void 0:t.dispose)&&(r[t.id]=t.dispose,t.dispose=yt)}));for(var a,s=w(this.videos);!(a=s()).done;){var o=a.value;o.pause(),o.removeAttribute("src"),o.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),null==(t=this.rendererOptions)||t.emptyTexture.dispose(),null==(e=this.pluginSystem)||e.destroyComposition(this),this.update=function(){vt.error("Update disposed composition: "+i.name+".")},this.dispose=yt,n&&this.keepResource&&n.forEach((function(t){t.dispose=r[t.id],t.dispose()})),this.renderer.env!==Xs&&this.renderer.clear({stencilAction:Ir.clear,clearStencil:0,depthAction:Ir.clear,clearDepth:1,colorAction:Ir.clear,clearColor:[0,0,0,0]})}},i.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},i.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.translate=function(t,e,i){this.rootItem.translate(t,e,i)},i.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},i.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},i.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},i.scale=function(t,e,i){this.rootItem.scale(t,e,i)},i.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},i.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},i.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},i.reloadTexture=function(){var t=this;return E((function(){return I(this,(function(e){switch(e.label){case 0:return t.textureOffloaded?[4,Promise.all(t.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))()},e.buildItemTree=function(t){for(var e,i=new Map,r=t.getComponent(ll).items,n=w(r);!(e=n()).done;){var a=e.value;i.set(a.id,a)}for(var s,o=w(r);!(s=o()).done;){var u=s.value;if(void 0===u.parentId)u.setParent(t);else{var h=i.get(u.parentId);if(!h)throw new Error("The element references a non-existent element, please check the data.");u.setParent(h)}}},dr(e,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),e}(fl),gl=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).children=[],r.transform=new ku,r.time=-1,r.duration=0,r.start=0,r.endBehavior=re.forward,r.type=Wt.base,r.components=[],r.isDuringPlay=!1,r.active=!0,r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new fl,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=e,i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.on=function(t,e,i){this.eventProcessor.on(t,e,i)},i.off=function(t,e){this.eventProcessor.off(t,e)},i.once=function(t,e){this.eventProcessor.once(t,e)},i.emit=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],i))},i.getListeners=function(t){return this.eventProcessor.getListeners(t)},i.setSpeed=function(t){this.speed=t},i.getSpeed=function(){return this.speed},i.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},i.getComponent=function(t){for(var e,i,r=w(this.components);!(i=r()).done;){var n=i.value;if(C(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,i=[],r=w(this.components);!(e=r()).done;){var n=e.value;C(n,t)&&i.push(n)}return i},i.setParent=function(t){(t!==this||t)&&(this.parent&&D(this.parent.children,this),this.parent=t,this.transform.parentTransform=t.transform,t.children.push(this),!this.composition&&t.composition&&(this.composition=t.composition),!this.isDuringPlay&&t.isDuringPlay&&this.beginPlay())},i.setColor=function(t,e,i,r){},i.setOpacity=function(t){},i.setActive=function(t){this.active!==!!t&&(this.active=!!t,this.onActiveChanged())},i.setVisible=function(t){for(var e,i=w(this.components);!(e=i()).done;){e.value.enabled=t}this.visible=t},i.getVisible=function(){return this.visible},i.getWorldTransform=function(t){var e=null!=t?t:new ku({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.translate=function(t,e,i){this.transform.translate(t,e,i)},i.rotate=function(t,e,i){var r=new Zn(t,e,i),n=yi.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},i.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,a=r.y,s=this.composition.renderer.getWidth()/2,o=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/s-1)*n,(1-2*e/o)*a,i)}},i.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},i.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},i.setScale=function(t,e,i){this.transform.setScale(t,e,i)},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.getCurrentPosition=function(){var t=new vi;return this.transform.assignWorldTRS(t),t},i.find=function(t){var e;if(this.name===t)return this;var i=[];(e=i).push.apply(e,[].concat(this.children));for(var r=0;r<i.length;){var n,a=i[r];if(r++,a.name===t)return a;(n=i).push.apply(n,[].concat(a.children))}},i.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.resetGUID();var e=this.engine.findObject({id:this.defination.id});return e.resetGUID(),this.resetGUID(t),this.composition&&e.setParent(this.composition.rootItem),e},i.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=w(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},i.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},i.onEnable=function(){this.isEnabled=!0;for(var t,e=w(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=w(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},i.onDisable=function(){this.isEnabled=!1;for(var t,e=w(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},i.fromData=function(i){t.prototype.fromData.call(this,i);var r=i.id,n=i.name,a=i.delay,s=i.parentId,o=i.endBehavior,u=i.transform,h=i.duration,l=void 0===h?0:h;if(this.props=i,this.type=i.type,this.id=r.toString(),this.name=n,this.start=a||this.start,u&&this.transform.fromData(u),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=s,this.duration=l,this.endBehavior=o,i.content||(i.content={options:{}}),l<0)throw new Error("Item duration can't be less than 0, see "+Hs["Item duration can't be less than 0"]+".");if(i.components){this.components.length=0;for(var c,f=w(i.components);!(c=f()).done;){var d=c.value,p=this.engine.findObject(d);this.components.push(p),C(p,dh)&&(this.components.includes(p.renderer)||this.components.push(p.renderer))}}e.isComposition(this)&&this.instantiatePreComposition()},i.toData=function(){var t,e;(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=Ae.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.defination.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.defination.components){this.defination.components=[];for(var i,r=w(this.components);!(i=r()).done;){var n=i.value;C(n,br)&&this.defination.components.push(n)}}this.defination.content={}},i.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,s=this.composition.camera.getInverseVPRatio(a),o=s.x,u=s.y;this.transform.translate(2*t*o/r,-2*e*u/n,0)}},i.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=w(this.components.slice());!(t=e()).done;){t.value.dispose()}this.components=[],this._content=void 0,this._composition=null,this.transform.setValid(!1)}},i.resetChildrenParent=function(){for(var t,e=w(this.children);!(t=e()).done;){var i=t.value;this.parent&&i.setParent(this.parent)}var r;this.parent&&D(null==(r=this.parent)?void 0:r.children,this)},i.instantiatePreComposition=function(){var t=this.props.content.options.refId,e=this.engine.findEffectsObjectData(t);if(!e)throw new Error("Referenced precomposition with Id: "+t+" does not exist.");for(var i,r=w(e.components);!(i=r()).done;){var n=i.value,a=this.engine.findObject(n);if(a.item=this,this.components.push(a),a.setInstanceId(At()),C(a,ll))for(var s,o=w(a.items);!(s=o()).done;){var u=s.value;u.setInstanceId(At());for(var h,l=w(u.components);!(h=l()).done;){h.value.setInstanceId(At())}}}yl.buildItemTree(this)},i.resetGUID=function(t){var e,i=null!=(e=null==t?void 0:t.get(this))?e:At();this.setInstanceId(i);for(var r,n=w(this.components);!(r=n()).done;){var a,s=r.value,o=null!=(a=null==t?void 0:t.get(s))?a:At();s.setInstanceId(o)}for(var u,h=w(this.children);!(u=h()).done;){u.value.resetGUID(t)}},i.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=w(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=w(this.children);!(n=a()).done;){n.value.gatherPreviousObjectID(t)}},e.isComposition=function(t){return t.type===Wt.composition},e.isSprite=function(t){return t.type===Wt.sprite},e.isParticle=function(t){return t.type===Wt.particle},e.isNull=function(t){return t.type===Wt.null},e.isTree=function(t){return t.type===Wt.tree},e.isCamera=function(t){return t.type===Wt.camera},e.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},dr(e,[{key:"content",get:function(){return this._content}},{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=w(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=w(this.components);!(e=i()).done;){var r=e.value;C(r,yr)&&(r.priority=t)}}}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),e}(Be);gl=S([ke(Ae.VFXItemData)],gl),function(t){t.is=function(t,e){return t.type===e},t.isComposition=function(t){return t.type===Wt.composition},t.isParticle=function(t){return t.type===Wt.particle},t.isNull=function(t){return t.type===Wt.null}}(cl||(cl={}));var xl=[1,1,1,1],bl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}$t(e,t);var i=e.prototype;return i.processFrame=function(t){var e=t.output.getUserData();if(C(e,gl)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(e)),!this.activeMaterial){var i,r;this.activeMaterial=null==(i=this.activeComponent)?void 0:i.material;var n=null==(r=this.activeMaterial)?void 0:r.getColor("_Color");n&&(this.startColor=n.toArray())}var a,s,o,u=_o(xl,1),h=this.time/e.duration,l=this.opacityOverLifetime,c=this.colorOverLifetime;if(c&&(u=B(c,h,!0),a=!0),l&&(u[3]*=l.getValue(h),a=!0),a)wo(this.renderColor,u,this.startColor),null==(o=this.activeMaterial)||null==(s=o.getColor("_Color"))||s.setFromArray(this.renderColor)}},i.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;i&&(this.opacityOverLifetime=Eu(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===ee.GRADIENT_COLOR&&(this.colorOverLifetime=G(i.color[1])));return this},i.getActiveComponent=function(t){return t.getComponent(Js)},e}(Nu),Tl=0,El=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new bl(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(Fu);El=S([ke(Ae.SpriteColorPlayableAsset)],El);var _l=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Ah(t)},e}(Uh),wl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){return new Cl(t)},e}(Fu),Cl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(Nu),Al=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).time=0,r.duration=0,r.frameAnimationLoop=!0,r.name="MSprite"+Tl++,i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.onUpdate=function(t){var e=this,i=this.time,r=this.duration;i>r&&this.frameAnimationLoop&&(i%=r);var n=Math.min(Math.max(i/r,0),1),a=this.textureSheetAnimation,s=this.renderer.texture.source.video;if(s&&(0===i?s.pause():s.play().catch((function(t){e.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),a){var o,u,h,l,c,f=a.total||a.row*a.col,d=0,p=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],d=y[0],p=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/a.row*m,l=1/a.col*v):(h=1/a.col*m,l=1/a.row*v),a.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/a.col),b=g-x*a.col;c=u?[h*x,l*(a.col-b)]:[h*b,l*(1+x)]}else c=[0,l];null==(o=this.material.getVector4("_TexOffset"))||o.setFromArray([d+c[0],v+p-c[1],h,l])}this.time=i+t/1e3},i.onDisable=function(){t.prototype.onDisable.call(this),this.time=0},i.onDestroy=function(){var t=this.renderer.texture.source;t.sourceType===Rr.video&&(null==t?void 0:t.video)&&(t.video.pause(),t.video.src="",t.video.load())},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i;var n,a=r.startColor||[1,1,1,1];this.material.setColor("_Color",(new Er).setFromArray(a)),this.duration=null!=(n=e.duration)?n:this.item.duration},e}(Js);Al=S([ke(Ae.SpriteComponent)],Al);var Sl=8;function Il(t){return t.maxVertexUniforms>=256?Sl=32:t.maxVertexUniforms>=128?Sl=16:void 0}function Rl(t){Sl=t}var Ol=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt),Ml=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt),Nl=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,i){return this.findCurveValue(t,e)?this.curveValues[t+e].value=i:this.curveValues[t+e]={componentType:t,propertyName:e,value:i},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},t}(),Pl=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new Nl(Lu(i)),i}return $t(e,t),e}(Nu),Fl=new Zn,Ll=new vi(1,1,1),Vl=new vi,Dl=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new vi(e.x,e.y,e.x)};var i,r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=Eu(r.path));var s=r.linearX||r.linearY||r.linearZ;s&&(this.linearVelOverLifetime={x:r.linearX&&Eu(r.linearX),y:r.linearY&&Eu(r.linearY),z:r.linearZ&&Eu(r.linearZ),asMovement:r.asMovement,enabled:!!s});var o=r.orbitalX||r.orbitalY||r.orbitalZ;o&&(this.orbitalVelOverLifetime={x:r.orbitalX&&Eu(r.orbitalX),y:r.orbitalY&&Eu(r.orbitalY),z:r.orbitalZ&&Eu(r.orbitalZ),center:Eo(r.orbCenter),asRotation:r.asRotation,enabled:!!o}),this.speedOverLifetime=r.speedOverLifetime&&Eu(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Eu(a.x||1),this.sizeYOverLifetime=Eu(a.y||1),this.sizeZOverLifetime=Eu(a.z||1)):this.sizeXOverLifetime=Eu(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:Eu(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=Eu(n.x||0),u.y=Eu(n.y||0)}this.gravity=vi.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=Eu(null!=(i=null==r?void 0:r.gravityOverLifetime)?i:0),this.direction=(null==r?void 0:r.direction)?vi.fromArray(r.direction).normalize():new vi,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},i.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();C(e,gl)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},i.sampleAnimation=function(){var t=this,e=this.boundObject,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){Ll.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(Ll.y=this.sizeYOverLifetime.getValue(r),Ll.z=this.sizeZOverLifetime.getValue(r)):Ll.z=Ll.y=Ll.x;var n=this.originalTransform.scale;e.transform.setScale(Ll.x*n.x,Ll.y*n.y,Ll.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},s=a(this.rotationOverLifetime.z),o=this.rotationOverLifetime.separateAxes;Fl.x=o?a(this.rotationOverLifetime.x):0,Fl.y=o?a(this.rotationOverLifetime.y):0,Fl.z=s;var u=Fl.addEulers(this.originalTransform.rotation,Fl);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Vl;To(h,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(h.x,h.y,h.z)}},e}(Pl),kl=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new Dl(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(Fu);kl=S([ke(Ae.TransformPlayableAsset)],kl);var zl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();C(e,gl)&&(e.time=this.time)},e}(Nu),Ul=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){return new zl(t)},e}(Fu);Ul=S([ke(Ae.ActivationPlayableAsset)],Ul);var Bl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e}$t(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=li(e,0,this.duration),n=w(this.positionCurves);!(i=n()).done;){var a=i.value,s=a.keyFrames.getValue(r),o=this.findTarget(t,a.path);null==o||o.transform.setPosition(s.x,s.y,s.z)}for(var u,h=w(this.rotationCurves);!(u=h()).done;){var l=u.value,c=l.keyFrames.getValue(r),f=this.findTarget(t,l.path);null==f||f.transform.setQuaternion(c.x,c.y,c.z,c.w)}for(var d,p=w(this.eulerCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(r),y=this.findTarget(t,m.path);null==y||y.transform.setRotation(v.x,v.y,v.z)}for(var g,x=w(this.scaleCurves);!(g=x()).done;){var b=g.value,T=b.keyFrames.getValue(r),E=this.findTarget(t,b.path);null==E||E.transform.setScale(T.x,T.y,T.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=w(t.positionCurves);!(i=r()).done;){var n=i.value,a={path:n.path,keyFrames:Eu(n.keyFrames)};e=Math.max(e,a.keyFrames.getMaxTime()),this.positionCurves.push(a)}if(t.rotationCurves)for(var s,o=w(t.rotationCurves);!(s=o()).done;){var u=s.value,h={path:u.path,keyFrames:Eu(u.keyFrames)};e=Math.max(e,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}if(t.eulerCurves)for(var l,c=w(t.eulerCurves);!(l=c()).done;){var f=l.value,d={path:f.path,keyFrames:Eu(f.keyFrames)};e=Math.max(e,d.keyFrames.getMaxTime()),this.eulerCurves.push(d)}if(t.scaleCurves)for(var p,m=w(t.scaleCurves);!(p=m()).done;){var v=p.value,y={path:v.path,keyFrames:Eu(v.keyFrames)};e=Math.max(e,y.keyFrames.getMaxTime()),this.scaleCurves.push(y)}if(t.floatCurves)for(var g,x=w(t.floatCurves);!(g=x()).done;){var b=g.value,T={path:b.path,keyFrames:Eu(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,T.keyFrames.getMaxTime()),this.floatCurves.push(T)}if(t.colorCurves)for(var E,_=w(t.colorCurves);!(E=_()).done;){var C=E.value,A={path:C.path,keyFrames:Eu(C.keyFrames),property:C.property,className:C.className};e=Math.max(e,A.keyFrames.getMaxTime()),this.colorCurves.push(A)}void 0!==t.duration?this.duration=t.duration:this.duration=e},i.findTarget=function(t,e){for(var i,r=t,n=w(e.split("."));!(i=n()).done;){for(var a,s=i.value,o=!1,u=w(r.children);!(a=u()).done;){var h=a.value;if(h.name===s){r=h,o=!0;break}}if(!o)return}return r},e}(Be);Bl=S([ke(Ae.AnimationClip)],Bl);var Gl=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){return this.set(t.x,t.y),this},e.copyTo=function(t){return t.set(this.x,this.y),t},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},dr(t,null,[{key:"shared",get:function(){return jl.x=0,jl.y=0,jl}}]),t}(),jl=new Gl,Xl=1e-4,Hl=1e-4;function Wl(t,e,i,r,n,a,s,o){var u,h;s?(u=r,h=-i):(u=-r,h=i);var l=t-i*n+u,c=e-r*n+h,f=t+i*a+u,d=e+r*a+h;return o.push(l,c),o.push(f,d),2}function Yl(t,e,i,r,n,a,s,o){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,a-e);o&&l<c?l+=2*Math.PI:!o&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.abs(d),m=Math.sqrt(u*u+h*h),v=1+(15*p*Math.sqrt(m)/Math.PI>>0),y=d/v;if(f+=y,o){s.push(t,e),s.push(i,r);for(var g=1,x=f;g<v;g++,x+=y)s.push(t,e),s.push(t+Math.sin(x)*m,e+Math.cos(x)*m);s.push(t,e),s.push(n,a)}else{s.push(i,r),s.push(t,e);for(var b=1,T=f;b<v;b++,T+=y)s.push(t+Math.sin(T)*m,e+Math.cos(T)*m),s.push(t,e);s.push(n,a),s.push(t,e)}return 2*v}function Zl(t,e,i,r,n,a,s,o,u){var h=Xl;if(0!==t.length){var l=e,c=l.alignment;if(.5!==e.alignment){var f=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],a=t[e-1];r<e;r+=2){var s=t[r],o=t[r+1];i+=(s-n)*(o+a),n=s,a=o}return i<0?-1:1}(t);i&&(f*=-1),c=(c-.5)*f+.5}var d=new Gl(t[0],t[1]),p=new Gl(t[t.length-2],t[t.length-1]),m=r,v=Math.abs(d.x-p.x)<h&&Math.abs(d.y-p.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));var y=.5*(d.x+p.x),g=.5*(p.y+d.y);t.unshift(y,g),t.push(y,g)}var x=n,b=t.length/2,T=t.length,E=x.length/2,_=l.width/2,w=_*_,C=l.miterLimit*l.miterLimit,A=t[0],S=t[1],I=t[2],R=t[3],O=0,M=0,N=-(S-R),P=A-I,F=0,L=0,V=Math.sqrt(N*N+P*P)+oi;N/=V,P/=V,N*=_,P*=_;var D=2*(1-c),k=2*c;m||(l.cap===Te.Round?T+=Yl(A-N*(D-k)*.5,S-P*(D-k)*.5,A-N*D,S-P*D,A+N*k,S+P*k,x,!0)+2:l.cap===Te.Square&&(T+=Wl(A,S,N,P,D,k,!0,x))),x.push(A-N*D,S-P*D),x.push(A+N*k,S+P*k);for(var z=1;z<b-1;++z){A=t[2*(z-1)],S=t[2*(z-1)+1],I=t[2*z],R=t[2*z+1],O=t[2*(z+1)],M=t[2*(z+1)+1],N=-(S-R),P=A-I,N/=V=Math.sqrt(N*N+P*P)+oi,P/=V,N*=_,P*=_,F=-(R-M),L=I-O,F/=V=Math.sqrt(F*F+L*L)+oi,L/=V,F*=_,L*=_;var U=I-A,B=S-R,G=I-O,j=M-R,X=U*G+B*j,H=B*G-j*U,W=H<0;if(Math.abs(H)<.001*Math.abs(X))x.push(I-N*D,R-P*D),x.push(I+N*k,R+P*k),X>=0&&(l.join===Ee.Round?T+=Yl(I,R,I-N*D,R-P*D,I-F*D,R-L*D,x,!1)+4:T+=2,x.push(I-F*k,R-L*k),x.push(I+F*D,R+L*D));else{var Y=(-N+A)*(-P+R)-(-N+I)*(-P+S),Z=(-F+O)*(-L+R)-(-F+I)*(-L+M),q=(U*Z-G*Y)/H,K=(j*Y-B*Z)/H,Q=(q-I)*(q-I)+(K-R)*(K-R),J=I+(q-I)*D,$=R+(K-R)*D,tt=I-(q-I)*k,et=R-(K-R)*k,it=W?D:k;Q<=Math.min(U*U+B*B,G*G+j*j)+it*it*w?l.join===Ee.Bevel||Q/w>C?(W?(x.push(J,$),x.push(I+N*k,R+P*k),x.push(J,$),x.push(I+F*k,R+L*k)):(x.push(I-N*D,R-P*D),x.push(tt,et),x.push(I-F*D,R-L*D),x.push(tt,et)),T+=2):l.join===Ee.Round?W?(x.push(J,$),x.push(I+N*k,R+P*k),T+=Yl(I,R,I+N*k,R+P*k,I+F*k,R+L*k,x,!0)+4,x.push(J,$),x.push(I+F*k,R+L*k)):(x.push(I-N*D,R-P*D),x.push(tt,et),T+=Yl(I,R,I-N*D,R-P*D,I-F*D,R-L*D,x,!1)+4,x.push(I-F*D,R-L*D),x.push(tt,et)):(x.push(J,$),x.push(tt,et)):(x.push(I-N*D,R-P*D),x.push(I+N*k,R+P*k),l.join===Ee.Round?T+=W?Yl(I,R,I+N*k,R+P*k,I+F*k,R+L*k,x,!0)+2:Yl(I,R,I-N*D,R-P*D,I-F*D,R-L*D,x,!1)+2:l.join===Ee.Miter&&Q/w<=C&&(W?(x.push(tt,et),x.push(tt,et)):(x.push(J,$),x.push(J,$)),T+=2),x.push(I-F*D,R-L*D),x.push(I+F*k,R+L*k),T+=2)}}A=t[2*(b-2)],S=t[2*(b-2)+1],I=t[2*(b-1)],N=-(S-(R=t[2*(b-1)+1])),P=A-I,N/=V=Math.sqrt(N*N+P*P)+oi,P/=V,N*=_,P*=_,x.push(I-N*D,R-P*D),x.push(I+N*k,R+P*k),m||(l.cap===Te.Round?T+=Yl(I-N*(D-k)*.5,R-P*(D-k)*.5,I-N*D,R-P*D,I+N*k,R+P*k,x,!1)+2:l.cap===Te.Square&&(T+=Wl(I,R,N,P,D,k,!1,x)));for(var rt=Hl*Hl,nt=E;nt<T+E-2;++nt)A=x[2*nt],S=x[2*nt+1],I=x[2*(nt+1)],R=x[2*(nt+1)+1],O=x[2*(nt+2)],M=x[2*(nt+2)+1],Math.abs(A*(R-M)+I*(M-S)+O*(S-R))<rt||o.push(nt,nt+1,nt+2)}}var ql=function(){},Kl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ql={exports:{}};!function(t){var e;function i(t,e){return t.b===e.b&&t.a===e.a}function r(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function a(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function s(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function u(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function h(t){return r(t.b.a,t.a)}function l(t){return r(t.a,t.b.a)}function c(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function d(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,E(e.a,t.a)),e.d!==t.d&&(i=!0,_(e.d,t.d)),g(e,t),r||(x(e,t.a),t.a.c=t),i||(b(e,t.d),t.d.a=t))}function p(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,_(t.d,t.b.d)),t.c===t?E(t.a,null):(t.b.d.a=$(t),t.a.c=t.c,g(t,$(t)),i||b(t,t.d)),e.c===e?(E(e.a,null),_(e.d,null)):(t.d.a=$(e),e.a.c=e.c,g(e,$(e))),T(t)}function m(t){var e=y(t),i=e.b;return g(e,t.e),e.a=t.b.a,x(i,e.a),e.d=i.d=t.d,e=e.b,g(t.b,$(t.b)),g(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function v(t,e){var i=!1,r=y(t),n=r.b;return e.d!==t.d&&(i=!0,_(e.d,t.d)),g(r,t.e),g(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||b(r,t.d),r}function y(t){var e=new J,i=new J,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function g(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function x(t,e){var i=e.f,r=new et(e,i);i.e=r,e.f=r,i=r.c=t;do{i.a=r,i=i.c}while(i!==t)}function b(t,e){var i=e.d,r=new Q(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do{i.d=r,i=i.e}while(i!==t)}function T(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function E(t,e){var i=t.c,r=i;do{r.a=e,r=r.c}while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function _(t,e){var i=t.a,r=i;do{r.d=e,r=r.e}while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function w(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var C=4e150;function A(t,e){t.f+=e.f,t.b.f+=e.b.f}function S(t,e,i){return t=t.a,e=e.a,i=i.a,e.b.a===t?i.b.a===t?r(e.a,i.a)?0>=a(i.b.a,e.a,i.a):0<=a(e.b.a,i.a,e.a):0>=a(i.b.a,t,i.a):i.b.a===t?0<=a(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(i.b.a,t,i.a))}function I(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function R(t,e){p(t.a),t.c=!1,t.a=e,e.i=t}function O(t){var e=t.a.a;do{t=dt(t)}while(t.a.a===e);return t.c&&(R(t,e=v(ft(t).a.b,t.a.e)),t=dt(t)),t}function M(t,e,i){var r=new ct;return r.a=i,r.e=H(t.f,e.e,r),i.i=r}function N(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function P(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,I(t)}function F(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=ft(t),n=r.a;if(n.a!==e.a){if(!r.c){P(t);break}R(r,n=v(e.c.b,n.b))}e.c!==n&&(d($(n),n),d(e,n)),P(t),e=r.a,t=r}return e}function L(t,e,i,r,n,a){var s=!0;do{M(t,e,i.b),i=i.c}while(i!==r);for(null===n&&(n=ft(e).a.b.c);(i=(r=ft(e)).a.b).a===n.a;)i.c!==n&&(d($(i),i),d($(n),i)),r.f=e.f-i.f,r.d=N(t,r.f),e.b=!0,!s&&z(t,e)&&(A(i,n),I(e),p(n)),s=!1,e=r,n=i;e.b=!0,a&&B(t,e)}function V(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=i[0])}function D(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),d(e,i)}function k(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),s=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),o=n+1;r[n]=.5*s/(a+s),r[o]=.5*a/(a+s),t.g[0]+=r[n]*e.g[0]+r[o]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[o]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[o]*i.g[2]}function z(t,e){var n=ft(e),s=e.a,o=n.a;if(r(s.a,o.a)){if(0<a(o.b.a,s.a,o.a))return!1;if(i(s.a,o.a)){if(s.a!==o.a){n=t.e;var u=s.a.h;if(0<=u){var h=(n=n.b).d,l=n.e,c=n.c,f=c[u];h[f]=h[n.a],c[h[f]]=f,f<=--n.a&&(1>=f||r(l[h[f>>1]],l[h[f]])?ht(n,f):lt(n,f)),l[u]=null,c[u]=n.b,n.b=u}else for(n.c[-(u+1)]=null;0<n.a&&null===n.c[n.d[n.a-1]];)--n.a;D(t,$(o),s)}}else m(o.b),d(s,$(o)),e.b=n.b=!0}else{if(0>a(s.b.a,o.a,s.a))return!1;dt(e).b=e.b=!0,m(s.b),d($(o),s)}return!0}function U(t,e){var h=ft(e),l=e.a,f=h.a,p=l.a,v=f.a,y=l.b.a,g=f.b.a,x=new et;if(a(y,t.a,p),a(g,t.a,v),p===v||Math.min(p.a,y.a)>Math.max(v.a,g.a))return!1;if(r(p,v)){if(0<a(g,p,v))return!1}else if(0>a(y,v,p))return!1;var b,T,E=y,_=p,w=g,C=v;if(r(E,_)||(b=E,E=_,_=b),r(w,C)||(b=w,w=C,C=b),r(E,w)||(b=E,E=w,w=b,b=_,_=C,C=b),r(w,_)?r(_,C)?(0>(b=n(E,w,_))+(T=n(w,_,C))&&(b=-b,T=-T),x.b=c(b,w.b,T,_.b)):(0>(b=a(E,w,_))+(T=-a(E,C,_))&&(b=-b,T=-T),x.b=c(b,w.b,T,C.b)):x.b=(w.b+_.b)/2,s(E,_)||(b=E,E=_,_=b),s(w,C)||(b=w,w=C,C=b),s(E,w)||(b=E,E=w,w=b,b=_,_=C,C=b),s(w,_)?s(_,C)?(0>(b=o(E,w,_))+(T=o(w,_,C))&&(b=-b,T=-T),x.a=c(b,w.a,T,_.a)):(0>(b=u(E,w,_))+(T=-u(E,C,_))&&(b=-b,T=-T),x.a=c(b,w.a,T,C.a)):x.a=(w.a+_.a)/2,r(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=r(p,v)?p:v,r(E,x)&&(x.b=E.b,x.a=E.a),i(x,p)||i(x,v))return z(t,e),!1;if(!i(y,t.a)&&0<=a(y,t.a,x)||!i(g,t.a)&&0>=a(g,t.a,x)){if(g===t.a)return m(l.b),d(f.b,l),l=ft(e=O(e)).a,F(t,ft(e),h),L(t,e,$(l),l,l,!0),!0;if(y===t.a){m(f.b),d(l.e,$(f)),v=(p=h=e).a.b.a;do{p=dt(p)}while(p.a.b.a===v);return p=ft(e=p).a.b.c,h.a=$(f),L(t,e,(f=F(t,h,null)).c,l.b.c,p,!0),!0}return 0<=a(y,t.a,x)&&(dt(e).b=e.b=!0,m(l.b),l.a.b=t.a.b,l.a.a=t.a.a),0>=a(g,t.a,x)&&(e.b=h.b=!0,m(f.b),f.a.b=t.a.b,f.a.a=t.a.a),!1}return m(l.b),m(f.b),d($(f),l),l.a.b=x.b,l.a.a=x.a,l.a.h=rt(t.e,l.a),l=l.a,f=[0,0,0,0],x=[p.d,y.d,v.d,g.d],l.g[0]=l.g[1]=l.g[2]=0,k(l,p,y,f,0),k(l,v,g,f,2),V(t,l,x,f,!0),dt(e).b=e.b=h.b=!0,!1}function B(t,e){for(var i=ft(e);;){for(;i.b;)e=i,i=ft(i);if(!e.b&&(i=e,null===(e=dt(e))||!e.b))break;e.b=!1;var n,s=e.a,o=i.a;if(n=s.b.a!==o.b.a)t:{var u=ft(n=e),h=n.a,l=u.a,c=void 0;if(r(h.b.a,l.b.a)){if(0>a(h.b.a,l.b.a,h.a)){n=!1;break t}dt(n).b=n.b=!0,c=m(h),d(l.b,c),c.d.c=n.d}else{if(0<a(l.b.a,h.b.a,l.a)){n=!1;break t}n.b=u.b=!0,c=m(l),d(h.e,l.b),c.b.d.c=n.d}n=!0}if(n&&(i.c?(I(i),p(o),o=(i=ft(e)).a):e.c&&(I(e),p(s),s=(e=dt(i)).a)),s.a!==o.a)if(s.b.a===o.b.a||e.c||i.c||s.b.a!==t.a&&o.b.a!==t.a)z(t,e);else if(U(t,e))break;s.a===o.a&&s.b.a===o.b.a&&(A(o,s),I(e),p(s),e=dt(i))}}function G(t,e){t.a=e;for(var n=e.c;null===n.i;)if((n=n.c)===e.c){n=t;var s=e;(h=new ct).a=s.c.b;var o=(c=n.f).a;do{o=o.a}while(null!==o.b&&!c.c(c.b,h,o.b));var u=ft(c=o.b),h=c.a;o=u.a;if(0===a(h.b.a,s,h.a))i((h=c.a).a,s)||i(h.b.a,s)||(m(h.b),c.c&&(p(h.c),c.c=!1),d(s.c,h),G(n,s));else{var l=r(o.b.a,h.b.a)?c:u;u=void 0;c.d||l.c?(u=l===c?v(s.c.b,h.e):v(o.b.c.b,s.c).b,l.c?R(l,u):(h=n,(c=M(n,c,u)).f=dt(c).f+c.a.f,c.d=N(h,c.f)),G(n,s)):L(n,c,s.c,s.c,null,!0)}return}if(c=(h=ft(n=O(n.i))).a,(h=F(t,h,null)).c===c){h=(c=h).c,o=ft(n),u=n.a,l=o.a;var c,f=!1;u.b.a!==l.b.a&&U(t,n),i(u.a,t.a)&&(d($(h),u),h=ft(n=O(n)).a,F(t,ft(n),o),f=!0),i(l.a,t.a)&&(d(c,$(l)),c=F(t,o,null),f=!0),f?L(t,n,c.c,h,h,!0):(s=r(l.a,u.a)?$(l):u,L(t,n,s=v(c.c.b,s),s.c,s.c,!1),s.b.i.c=!0,B(t,n))}else L(t,n,h.c,c,c,!0)}function j(t,e){var i=new ct,r=f(t.b);r.a.b=C,r.a.a=e,r.b.a.b=-C,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=H(r=t.f,r.a,i),i.e=r}function X(t){this.a=new W,this.b=t,this.c=S}function H(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i));return t=new W(i,e.a,e),e.a.c=t,e.a=t}function W(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function Y(){this.d=Z,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var Z=0;function q(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case Z:K(t,100151),t.u(null);break;case 1:K(t,100152),t.t()}else switch(t.d){case 2:K(t,100154),t.v();break;case 1:K(t,100153),t.w()}}function K(t,e){t.p&&t.p(e,t.c)}function Q(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function J(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function $(t){return t.b.e}function tt(){this.c=new et,this.a=new Q,this.b=new J,this.d=new J,this.b.b=this.d,this.d.b=this.b}function et(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function it(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new at}function rt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=st(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&lt(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function nt(t){if(0===t.a)return ut(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&r(ot(t.b),e))return ut(t.b);do{--t.a}while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function at(){this.d=st([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function st(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function ot(t){return t.e[t.d[1]]}function ut(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),a}function ht(t,e){for(var i=t.d,n=t.e,a=t.c,s=e,o=i[s];;){var u=s<<1;u<t.a&&r(n[i[u+1]],n[i[u]])&&(u+=1);var h=i[u];if(u>t.a||r(n[o],n[h])){i[s]=o,a[o]=s;break}i[s]=h,a[h]=s,s=u}}function lt(t,e){for(var i=t.d,n=t.e,a=t.c,s=e,o=i[s];;){var u=s>>1,h=i[u];if(0===u||r(n[h],n[o])){i[s]=o,a[o]=s;break}i[s]=h,a[h]=s,s=u}}function ct(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function ft(t){return t.e.c.b}function dt(t){return t.e.a.b}(e=Y.prototype).x=function(){q(this,Z)},e.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=e)}break;case 100141:return void(this.m=!!e);default:return void K(this,100900)}K(this,100901)},e.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:K(this,100900)}return!1},e.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},e.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:K(this,100900)}},e.C=function(t,e){var i=!1,r=[0,0,0];q(this,2);for(var n=0;3>n;++n){var a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}i&&K(this,100155),null===(i=this.q)?d(i=f(this.b),i.b):(m(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},e.u=function(t){q(this,Z),this.d=1,this.b=new tt,this.c=t},e.t=function(){q(this,1),this.d=2,this.q=null},e.v=function(){q(this,2),this.d=1},e.w=function(){q(this,1),this.d=Z;var t=!1,e=[c=this.j[0],n=this.j[1],o=this.j[2]];if(0===c&&0===n&&0===o){for(var n=[-2e150,-2e150,-2e150],s=[2e150,2e150,2e150],o=[],u=[],c=(t=this.b.c).e;c!==t;c=c.e)for(var f=0;3>f;++f){var d=c.g[f];d<s[f]&&(s[f]=d,u[f]=c),d>n[f]&&(n[f]=d,o[f]=c)}if(c=0,n[1]-s[1]>n[0]-s[0]&&(c=1),n[2]-s[2]>n[c]-s[c]&&(c=2),s[c]>=n[c])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,s=u[c],o=o[c],u=[0,0,0],s=[s.g[0]-o.g[0],s.g[1]-o.g[1],s.g[2]-o.g[2]],f=[0,0,0],c=t.e;c!==t;c=c.e)f[0]=c.g[0]-o.g[0],f[1]=c.g[1]-o.g[1],f[2]=c.g[2]-o.g[2],u[0]=s[1]*f[2]-s[2]*f[1],u[1]=s[2]*f[0]-s[0]*f[2],u[2]=s[0]*f[1]-s[1]*f[0],(d=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=d,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[w(s)]=1)}t=!0}for(u=w(e),c=this.b.c,n=(u+1)%3,o=(u+2)%3,u=0<e[u]?1:-1,e=c.e;e!==c;e=e.e)e.b=e.g[n],e.a=u*e.g[o];if(t){for(e=0,c=(t=this.b.a).b;c!==t;c=c.b)if(!(0>=(n=c.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==c.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,c=(e=this.b.b).h;c!==e;c=t)t=c.h,n=c.e,i(c.a,c.b.a)&&c.e.e!==c&&(D(this,n,c),p(c),n=(c=n).e),n.e===c&&(n!==c&&(n!==t&&n!==t.b||(t=t.h),p(n)),c!==t&&c!==t.b||(t=t.h),p(c));for(this.e=e=new it,c=(t=this.b.c).e;c!==t;c=c.e)c.h=rt(e,c);for(function(t){t.d=[];for(var e=0;e<t.a;e++)t.d[e]=e;t.d.sort(function(t){return function(e,i){return r(t[e],t[i])?1:-1}}(t.c)),t.e=!0,function(t){for(var e=t.a;1<=e;--e)ht(t,e);t.h=!0}(t.b)}(e),this.f=new X(this),j(this,-C),j(this,C);null!==(e=nt(this.e));){for(;;){t:if(c=this.e,0===c.a)t=ot(c.b);else if(t=c.c[c.d[c.a-1]],0!==c.b.a&&(c=ot(c.b),r(c,t))){t=c;break t}if(null===t||!i(t,e))break;t=nt(this.e),D(this,e.c,t.c)}G(this,e)}for(this.a=this.f.a.a.b.a.a,e=0;null!==(t=this.f.a.a.b);)t.h||++e,I(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,c=(e=this.b).a.b;c!==e.a;c=t)t=c.b,(c=c.a).e.e===c&&(A(c.c,c),p(c));if(!this.n){if(e=this.b,this.m)for(c=e.b.h;c!==e.b;c=t)t=c.h,c.b.d.c!==c.d.c?c.f=c.d.c?1:-1:p(c);else for(c=e.a.b;c!==e.a;c=t)if(t=c.b,c.c){for(c=c.a;r(c.b.a,c.a);c=c.c.b);for(;r(c.a,c.b.a);c=c.e);for(n=c.c.b,o=void 0;c.e!==n;)if(r(c.b.a,n.a)){for(;n.e!==c&&(h(n.e)||0>=a(n.a,n.b.a,n.e.b.a));)n=(o=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==c&&(l(c.c.b)||0<=a(c.b.a,c.a,c.c.b.a));)c=(o=v(c,c.c.b)).b;c=c.e}for(;n.e.e!==c;)n=(o=v(n.e,n)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(t=(e=this.b).a.b;t!==e.a;t=t.b)if(t.c){this.h&&this.h(2,this.c),c=t.a;do{this.k&&this.k(c.a.d,this.c),c=c.e}while(c!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,c=!1,n=-1,o=e.a.d;o!==e.a;o=o.d)if(o.c){c||(this.h&&this.h(4,this.c),c=!0),u=o.a;do{t&&(n!==(s=u.b.d.c?0:1)&&(n=s,this.l&&this.l(!!n,this.c))),this.k&&this.k(u.a.d,this.c),u=u.e}while(u!==o.a)}c&&this.i&&this.i(this.c)}if(this.r){for(c=(e=this.b).a.b;c!==e.a;c=t)if(t=c.b,!c.c){o=(n=c.a).e,u=void 0;do{o=(u=o).e,u.d=null,null===u.b.d&&(u.c===u?E(u.a,null):(u.a.c=u.c,g(u,$(u))),(s=u.b).c===s?E(s.a,null):(s.a.c=s.c,g(s,$(s))),T(u))}while(u!==n);n=c.d,(c=c.b).d=n,n.b=c}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Kl.libtess={GluTesselator:Y,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},Y.prototype.gluDeleteTess=Y.prototype.x,Y.prototype.gluTessProperty=Y.prototype.B,Y.prototype.gluGetTessProperty=Y.prototype.y,Y.prototype.gluTessNormal=Y.prototype.A,Y.prototype.gluTessCallback=Y.prototype.z,Y.prototype.gluTessVertex=Y.prototype.C,Y.prototype.gluTessBeginPolygon=Y.prototype.u,Y.prototype.gluTessBeginContour=Y.prototype.t,Y.prototype.gluTessEndContour=Y.prototype.v,Y.prototype.gluTessEndPolygon=Y.prototype.w,t.exports=Kl.libtess}(Ql);var Jl=function(){var t=new Ql.exports.GluTesselator;return t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==Ql.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,i){return[t[0],t[1],t[2]]})),t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function $l(t){Jl.gluTessNormal(0,0,1);var e=[];Jl.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){Jl.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];Jl.gluTessVertex(a,a)}Jl.gluTessEndContour()}return Jl.gluTessEndPolygon(),e}var tc=function(t){function e(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var a=Array.isArray(i[0])?i[0]:i;if("number"!=typeof a[0]){for(var s=[],o=0,u=a.length;o<u;o++)s.push(a[o].x,a[o].y);a=s}return n.points=a,n.closePath=!0,n}$t(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,a=r-1;n<r;a=n++){var s=this.points[2*n],o=this.points[2*n+1],u=this.points[2*a],h=this.points[2*a+1];o>e!=h>e&&t<(e-o)/(h-o)*(u-s)+s&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){var a=$l([t]),s=e.length/2;0===a.length&&this.getLineEndPointsTriangle(t,a);for(var o=0;o<a.length;o++)e[2*i+o]=a[o];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=s+h},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw new Error("Invalid points array");if(2!==t.length){var i=t[2]-t[0],r=t[3]-t[1],n=t[0],a=t[1],s=t[0],o=t[1];if(Math.abs(i)>=Math.abs(r))for(var u=0;u<t.length;u+=2){var h=t[u],l=t[u+1];h<n&&(n=h,a=l),h>s&&(s=h,o=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<a&&(n=f,a=d),d>o&&(s=f,o=d)}e.push(n,a,s,o,s,o)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},dr(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(ql),ec=8,ic=1.1920929e-7;function rc(t,e,i,r,n,a,s,o,u,h){var l=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function(t,e,i,r,n,a,s,o,u,h){nc(t,e,i,r,n,a,s,o,u,h,0),u.push(s,o)}(e,i,r,n,a,s,o,u,t,l*=l),t}function nc(t,e,i,r,n,a,s,o,u,h,l){if(!(l>ec)){var c=(t+i)/2,f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+s)/2,v=(a+o)/2,y=(c+d)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(y+x)/2,E=(g+b)/2;if(l>0){var _=s-t,w=o-e,C=Math.abs((i-s)*w-(r-o)*_),A=Math.abs((n-s)*w-(a-o)*_);if(C>ic&&A>ic){if((C+A)*(C+A)<=h*(_*_+w*w))return void u.push(T,E)}else if(C>ic){if(C*C<=h*(_*_+w*w))return void u.push(T,E)}else if(A>ic){if(A*A<=h*(_*_+w*w))return void u.push(T,E)}else if((_=T-(t+s)/2)*_+(w=E-(e+o)/2)*w<=h)return void u.push(T,E)}nc(t,e,c,f,y,g,T,E,u,h,l+1),nc(T,E,x,b,m,v,s,o,u,h,l+1)}}var ac,sc=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}$t(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return(i*=i)+(r*=r)<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var a=i/2,s=r-a,o=n-a,u=r+a,h=n+a,l=t-this.x,c=e-this.y;return l*l/(s*s)+c*c/(o*o)>1&&l*l/(u*u)+c*c/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var a=Math.ceil(5*Math.sqrt(r+n)),s=8*a+0+0;if(0===s)return t;if(0===a)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var o=0,u=4*a+0+2,h=u,l=s,c=0+r,f=0,d=e+c,p=e-c,m=i+f;t[o++]=d,t[o++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<a;v++){var y=Math.PI/2*(v/a),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,_=i-x;t[o++]=b,t[o++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--l]=_,t[--l]=b}d=e+(c=0),p=e-c,m=i+(f=0+n);var w=i-f;return t[o++]=d,t[o++]=m,t[--l]=w,t[--l]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=s;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(ql);!function(t){t[t.Star=0]="Star",t[t.Polygon=1]="Polygon"}(ac||(ac={}));var oc=function(t){function e(e,i,r,n,a,s){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=0),(o=t.call(this)||this).pointCount=e,o.outerRadius=i,o.innerRadius=r,o.outerRoundness=n,o.innerRoundness=a,o.starType=s,o.v=[],o.in=[],o.out=[],o}$t(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)rc(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var i=this.v.length-1;rc(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var a=$l([t]),s=e.length/2,o=0;o<a.length;o++)e[2*i+o]=a[o];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=s+h},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),a=2*Math.PI/n,s=!0,o=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*o/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){i=s?h:l,r=s?c:f;var p=(e=s?o:u)*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,s=!s,d+=1*a}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,a=2*Math.PI*r/(4*e),s=.5*-Math.PI;for(t=0;t<e;t++){var o=r*Math.cos(s),u=r*Math.sin(s),h=0===o&&0===u?0:u/Math.sqrt(o*o+u*u),l=0===o&&0===u?0:-o/Math.sqrt(o*o+u*u),c=2*t;this.v[c]=o,this.v[c+1]=u,this.in[c]=o+h*a*n*1,this.in[c+1]=u+l*a*n*1,this.out[c]=o-h*a*n*1,this.out[c+1]=u-l*a*n*1,s+=1*i}},e}(ql),uc=function(t){function e(e,i,r,n,a){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=20),(s=t.call(this)||this).x=e,s.y=i,s.width=r,s.height=n,s.roundness=a,s}$t(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t){var e,i=this.width/2,r=this.height/2,n=this.x+i,a=this.y+r,s=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(i,r)),o=i-s,u=r-e;if(s>=0&&e>=0&&o>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(s+e)),l=8*h+(o?4:0)+(u?4:0);if(0!==l){if(0===h)return t[0]=t[6]=n+o,t[1]=t[3]=a+u,t[2]=t[4]=n-o,void(t[5]=t[7]=a-u);var c=0,f=4*h+(o?2:0)+2,d=f,p=l,m=o+s,v=u,y=n+m,g=n-m,x=a+v;if(t[c++]=y,t[c++]=x,t[--f]=x,t[--f]=g,u){var b=a-v;t[d++]=g,t[d++]=b,t[--p]=b,t[--p]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),_=o+Math.cos(E)*s,w=u+Math.sin(E)*e,C=n+_,A=n-_,S=a+w,I=a-w;t[c++]=C,t[c++]=S,t[--f]=S,t[--f]=A,t[d++]=A,t[d++]=I,t[--p]=I,t[--p]=C}y=n+(m=o),g=n-m,x=a+(v=u+e);var R=a-v;t[c++]=y,t[c++]=x,t[--p]=R,t[--p]=y,o&&(t[c++]=g,t[c++]=x,t[--p]=R,t[--p]=g)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=s;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(ql),hc=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=w(this.graphicsPath.instructions);!(t=e()).done;){var i=t.value,r=i.action,n=i.data;switch(r){case"bezierCurveTo":this.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);break;case"polyStar":this.polyStar(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"rect":this.rect(n[0],n[1],n[2],n[3],n[4]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,s){this.ensurePoly();var o=this.currentPoly;return rc(o.points,o.lastX,o.lastY,t,e,i,r,n,a,s),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new sc(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,a,s){return this.drawShape(new oc(t,e,i,r,n,a),s),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new uc(t,e,i,r,n),a),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new tc).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new tc,this.currentPoly.points.push(0,0))},t}(),lc=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,s){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,s]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,a){return this.instructions.push({action:"rect",data:[t,e,i,r,n,a]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,a,s){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,a,s]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},dr(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new hc(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function cc(t,e){return!e||"object"!==A(e)&&"function"!=typeof e?Lu(t):e}var fc=new(function(){function t(){this.elements=[]}var e=t.prototype;return e.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},e.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return ut(t),t}if(qu(Wu))return r._createOffscreenCanvas(10,10);var e=i.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?V(this.elements,t):t.remove()},t}()),dc=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=void 0===e?100:e,r=t.textWidth,n=void 0===r?100:r,a=t.textOverflow,s=void 0===a?fe.clip:a,o=t.textBaseline,u=void 0===o?de.top:o,h=t.textAlign,l=void 0===h?pe.left:h,c=t.text,f=void 0===c?" ":c,d=t.letterSpace,p=void 0===d?0:d,m=t.autoWidth,v=void 0!==m&&m,y=t.fontSize,g=t.lineHeight,x=void 0===g?y:g,b=y+p;this.autoWidth=v,this.maxTextWidth=f.length*b,this.width=n,this.height=i,this.letterSpace=p,this.overflow=s,this.textBaseline=u,this.textAlign=l,this.lineHeight=x}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,a=t.fontScale,s=(i-r)/3,o=r+n*a,u=i*(e-1),h=0;switch(this.textBaseline){case de.top:h=o+s;break;case de.middle:h=(this.height*a-u+o)/2;break;case de.bottom:h=this.height*a-u-s}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case pe.left:i=t.outlineWidth*t.fontScale;break;case pe.middle:i=(this.width*t.fontScale-e)/2;break;case pe.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),pc=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,a,s,o=t.textColor,u=void 0===o?[1,1,1,1]:o,h=t.fontSize,l=void 0===h?40:h,c=t.outline,f=t.shadow,d=t.fontWeight,p=void 0===d?"normal":d,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,g=void 0===y?"sans-serif":y;(this.textColor=u,this.textWeight=p,this.fontStyle=v,this.fontFamily=g,this.fontSize=l,c)&&(this.isOutlined=!0,this.outlineColor=null!=(e=c.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=c.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth);f&&(this.hasShadow=!0,this.shadowBlur=null!=(r=f.shadowBlur)?r:2,this.shadowColor=null!=(n=f.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(a=f.shadowOffsetX)?a:0,this.shadowOffsetY=null!=(s=f.shadowOffsetY)?s:0);this.fontStyle!==ve.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},mc=["serif","sans-serif","monospace","courier"],vc=0,yc=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.maxLineWidth=0,r.SCALE_FACTOR=.1,r.ALPHA_FIX_VALUE=1/255,r.name="MText"+vc++,i&&r.fromData(i),r.canvas=fc.getCanvas(),fc.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return cc(r);var n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}$t(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new Er(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(Js);yc=S([ke(Ae.TextComponent)],yc);var gc=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new pc(t),this.textLayout=new dc(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var i=this.context,r=this.textLayout,n=r.letterSpace,a=r.overflow,s=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,o=this.textLayout.width+this.textStyle.fontOffset,u=1,h=0,l=0;l<t.length;l++){var c,f,d=t[l],p=(null!=(f=null==i||null==(c=i.measureText(d))?void 0:c.width)?f:0)*s;h+=n,a===fe.display?"\n"===d?(u++,h=0):(h+=p,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+p>o&&l>0||"\n"===d)&&(u++,this.maxLineWidth=Math.max(this.maxLineWidth,h),h=0),"\n"!==d&&(h+=p))}return u},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){this.textStyle.fontFamily!==t||lt(t)?(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("The font is either the current font or an risky font family.")},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,i=this.textStyle,r=this.textLayout,n=i.fontScale,a=(r.width+i.fontOffset)*n,s=r.lineHeight*this.lineCount,o=i.fontSize*n,u=r.lineHeight*n;i.fontDesc=this.getFontDesc(o),this.char=(this.text||"").split(""),this.canvas.width=a,r.autoWidth?(this.canvas.height=s*n,this.item.transform.size.set(1,s/r.height)):this.canvas.height=r.height*n;var h=this.canvas.height;e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),this.maxLineWidth>a&&r.overflow===fe.display?e.font=this.getFontDesc(o*a/this.maxLineWidth):e.font=i.fontDesc,e.clearRect(0,0,a,h),i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var l=[],c=0,f=r.getOffsetY(i,this.lineCount,u,o),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((c+=r.letterSpace*n)+y.width>a&&m>0||"\n"===v)&&(l.push({y:f,width:c,chars:d,charOffsetX:p}),c=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(c),c+=y.width)}l.push({y:f,width:c,chars:d,charOffsetX:p}),l.forEach((function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach((function(r,a){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[a],t.y),e.fillText(r,n+t.charOffsetX[a],t.y)}))})),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=fn.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:Mr.LINEAR,minFilter:Mr.LINEAR,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE});this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontScale,n=e.fontFamily,a=e.textWeight,s=e.fontStyle,o=(t||i*r).toString()+"px ";return mc.includes(n)?o+=n:o+='"'+n+'"',a!==me.normal&&(o=a+" "+o),s!==ve.normal&&(o=s+" "+o),o},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],a=i[1],s=i[2],o=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*a+", "+255*s+", "+o+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,s=i[0],o=i[1],u=i[2],h=i[3];t&&(t.shadowColor="rgba("+255*s+", "+255*o+", "+255*u+", "+h+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-a)},t}();It(yc,[gc]);var xc=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt),bc=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Be),Tc=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Be);S([ze()],Tc.prototype,"buffer",void 0),Tc=S([ke(Ae.BinaryAsset)],Tc);var Ec=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=Ue(e);if(r)for(var n,a=w(Object.keys(r));!(n=a()).done;){var s=n.value,o=e[s];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(o)?i[s]=o:xt(o)?(i[s]||(i[s]=[]),t.serializeArrayProperty(o,i[s],0)):Be.is(o)?i[s]={id:o.getInstanceId()}:Tt(o)&&(i[s]||(i[s]={}),t.serializeObjectProperty(o,i[s],0))}for(var u,h=w(Object.keys(e.defination));!(u=h()).done;){var l=u.value,c=e.defination[l];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(c)?i[l]=c:xt(c)?(i[l]||(i[l]=[]),t.serializeArrayProperty(c,i[l],0)):Be.is(c)?i[l]={id:c.getInstanceId()}:Tt(c)&&(i[l]||(i[l]={}),t.serializeObjectProperty(c,i[l],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=Ue(i),n=i.engine;if(r)for(var a,s=w(Object.keys(r));!(a=s()).done;){var o=a.value,u=e[o];if(void 0!==u){var h=r[o].type;i[o]=t.deserializeProperty(u,n,0,h)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return C(t,Int8Array)||C(t,Uint8Array)||C(t,Uint8ClampedArray)||C(t,Int16Array)||C(t,Uint16Array)||C(t,Int32Array)||C(t,Uint32Array)||C(t,Float32Array)||C(t,Float64Array)||C(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(Tt(t)&&1===Object.keys(t).length&&"id"in t&&gt(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return Tt(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return _t(t)||C(t,l)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),!(r>14)){if(xt(e)){for(var s,o=[],u=w(e);!(s=u()).done;){var h=s.value;o.push(t.deserializeProperty(h,i,r+1,n,a))}return o}if(t.checkDataPath(e)){var l=i.findObject(e);return a?l:e}if(Et(e)){var c;c=n?new n:{};for(var f,d=w(Object.keys(e));!(f=d()).done;){var p=f.value;c[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return c}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.serializeObjectProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i={});for(var n,a=w(Object.keys(e));!(n=a()).done;){var s=n.value,o=e[s];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[s]=o:xt(o)?(i[s]||(i[s]=[]),t.serializeArrayProperty(o,i[s],r+1)):Be.is(o)?i[s]={id:o.getInstanceId()}:Tt(o)&&(i[s]||(i[s]={}),t.serializeObjectProperty(o,i[s],r+1))}}},t.serializeArrayProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i=[]);for(var n=0;n<e.length;n++){var a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:xt(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):Be.is(a)?i[n]={id:a.getInstanceId()}:Tt(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}}},t}(),_c=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(r){switch(r.dataType){case Ae.Material:e=On.create(this.engine);break;case Ae.Geometry:e=Wn.create(this.engine);break;case Ae.Texture:e=fn.create(this.engine);break;default:var n=De(r.dataType);n&&(e=new n(this.engine))}if(e)return e.setInstanceId(r.id),this.engine.addInstance(e),Ec.deserialize(r,e),e;console.error("Constructor for DataType: "+r.dataType+" not found.")}else console.error("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),wc=function(){function t(){}return t.prototype.loadGUID=function(t){return E((function(){return I(this,(function(t){return[2,void 0]}))}))()},t}();function Cc(t,e){if(!t.includes(e))return t.push(e),!0}function Ac(t){if(Number.isFinite(t))return[ee.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===ee.CONSTANT)return[ee.CONSTANT,t[1]];if("lines"===e)return[ee.LINE,t[1]];if(e===ee.LINE){var r=i.map((function(t){return[ie.LINE,t]}));return[ee.BEZIER_CURVE,r]}return"curve"===e||e===ee.CURVE?[ee.BEZIER_CURVE,Yc(i)]:t}}function Sc(t,e){return Array.isArray(t)&&"random"===t[0]?[ee.CONSTANT,t[1][e]]:Ac(t)}function Ic(t){return t&&"color"===t[0]?Nc(t[1],!0):[1,1,1,1]}function Rc(t,e){if(t)return"colors"===t[0]?[ee.COLORS,t[1].map((function(t){return Nc(t,e)}))]:"gradient"===t[0]?Mc(t[1],e):"color"===t[0]?[ee.RGBA_COLOR,Nc(t[1],e)]:t}function Oc(t){return t&&"random"===t[0]?[ee.RANDOM,t[1]]:Ac(t)}function Mc(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach((function(r){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(r),a=Nc(t[r],e);i.push([n,a[0],a[1],a[2],a[3]])})),i=i.sort((function(t,e){return t[0]-e[0]})),[ee.GRADIENT_COLOR,i]}}function Nc(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else C(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=Pc(i)),i}function Pc(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Fc(t,e){return Array.isArray(t)?t[0]===ee.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Mc(t[1],e):Mc(t,e)}function Lc(t){if(t){if(3===t.length)return[ee.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===ee.BEZIER_PATH||e===ee.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],s=Yc(r);if(!a){a=[];for(var o=0;o<n.length;o++){var u=n[o].slice();0===o?a.push(u):o<n.length-1?(a.push(u),a.push(u)):a.push(u)}}return[ee.BEZIER_CURVE_PATH,[s,n,a]]}return t}}function Vc(t){for(var e,i=w(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function Dc(t){for(var e,i=w(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var kc,zc=Math.cos,Uc=Math.sin,Bc=Math.PI/180,Gc=180/Math.PI;function jc(t,e){return t?[t[0]-.5,.5-t[1]]:e?Hc[e]:[0,0]}var Xc,Hc=((kc={})[Zt.PARTICLE_ORIGIN_CENTER]=[0,0],kc[Zt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],kc[Zt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],kc[Zt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],kc[Zt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],kc[Zt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],kc[Zt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],kc[Zt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],kc[Zt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],kc);function Wc(t,e,i,r){var n=i[0],a=i[1],s=r[0],o=s-n;return[[n+(s-n)/3,a+(t*=o)/3],[s-(s-n)/3,r[1]-(e*=o)/3]]}function Yc(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],a=0;a<t.length-1;a++){var s=t[a][3]*(e-i),o=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],h=[t[a+1][0],t[a+1][1]];if(u[0]!=h[0]){var l=Wc(s,o,u,h),c=l[0],f=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map((function(t,e){return 0===e?[ie.EASE_OUT,t]:e===n.length-1?[ie.EASE_IN,t]:[ie.EASE,t]}))}function Zc(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===Wt.null&&t.endBehavior===re.destroy&&(t.endBehavior=re.freeze)}))})),t.version=Dt["2_1"],t}var qc=new Map,Kc=new Map;function Qc(t){for(var e,i=w(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===Ae.ShapeComponent){var n=r;if(n.type===be.Custom){var a,s=n;(null==(a=s.shapes)?void 0:a.length)>0&&s.shapes[0].fill&&(s.fill=s.shapes[0].fill);for(var o,u=new Array(s.easingIns.length),h=new Array(s.easingOuts.length).fill(!1),l=w(s.shapes);!(o=l()).done;)for(var c,f=w(o.value.indexes);!(c=f()).done;){var d=c.value,p=s.points[d.point],m=s.easingIns[d.easingIn],v=s.easingOuts[d.easingOut];u[d.easingIn]||(m.x-=p.x,m.y-=p.y,u[d.easingIn]=!0),h[d.easingOut]||(v.x-=p.x,v.y-=p.y,h[d.easingOut]=!0)}}}}return t.version=Dt["3_2"],t}function Jc(t){qc.clear(),Kc.clear();for(var e,i=t.compositions,r=t.items,n=w(t.components);!(e=n()).done;){var a=e.value;qc.set(a.id,a)}for(var s,o=w(r);!(s=o()).done;){var u=s.value;Kc.set(u.id,u)}for(var h,l=w(i);!(h=l()).done;){tf(h.value)}return t.version=Dt["3_3"],t}function $c(t){var e;null==(e=t.plugins)||e.forEach((function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")}));for(var i,r=w(t.items);!(i=r()).done;){var n=i.value;if(n.type===Wt.sprite){var a=qc.get(n.components[0].id);if(a){var s=a.renderer.shape,o=void 0;o=Number.isInteger(s)?t.shapes[s]:s,a.renderer.shape=o}}}for(var u,h=t.compositionId,l={},c=w(t.compositions);!(u=c()).done;){var f=u.value,d=At();l[f.id]=d,f.id===h&&(t.compositionId=d),f.id=d;var p={id:At(),dataType:"CompositionComponent",items:f.items,timelineAsset:f.timelineAsset,sceneBindings:f.sceneBindings};f.timelineAsset=void 0,f.sceneBindings=void 0,f.components=[{id:p.id}],t.components.push(p)}for(var m,v=w(t.items);!(m=v()).done;){var y=m.value;if(y.content){var g=y.content.options;g&&void 0!==g.refId&&(g.refId=l[g.refId])}}return t.version=Dt["3_4"],t}function tf(t){for(var e,i=w(t.items);!(e=i()).done;){var r=e.value,n=Kc.get(r.id);if(!n)return;if(n.type===Wt.sprite||n.type===Wt.particle||n.type===Wt.spine||n.type===Wt.text||n.type===Wt.richtext||n.type===Wt.video||n.type===Wt.shape){var a=qc.get(n.components[0].id);a&&ef(a)}}}function ef(t){var e=t.renderer,i=null==e?void 0:e.maskMode;i&&i!==Sr.NONE&&(i===Sr.MASK?(t.mask={isMask:!0},Xc=t.id):i!==Bt.OBSCURED&&i!==Bt.REVERSE_OBSCURED||(t.mask={inverted:i===Bt.REVERSE_OBSCURED,reference:{id:Xc}}))}function rf(t){for(var e,i,r,n=function(){var t=u.value;t.endBehavior!==ge&&t.endBehavior!==ye||(t.endBehavior=re.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===Wt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,i=w(t.items);!(e=i()).done;){var r=e.value;h[r.id]=At(),r.oldId=r.id,r.id=h[r.id],l[r.id]=r}t.items.forEach((function(e,i){if(e.parentId)if(e.parentId.includes("^")){var r=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=h[r]+"^"+n}else e.parentId=h[e.parentId];a.items.push(e),t.items[i]={id:e.id}}));var n=ri({},t,{timelineAsset:{id:""},sceneBindings:[]});a.compositions.push(n),function(t,e,i){for(var r,n=[],a=[],s=[],o={tracks:[],id:At(),dataType:"TimelineAsset"},u=w(t.items);!(r=u()).done;){var h=e[r.value.id],l=[],c={id:At(),dataType:"ActivationPlayableAsset"};s.push(c);var f={id:At(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:c.id}}]};if(l.push({id:f.id}),a.push(f),h.type!==Wt.particle){var d={id:At(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};s.push(d);var p={id:At(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};l.push({id:p.id}),a.push(p)}if(h.type===Wt.sprite||h.type===Wt.text){var m={id:At(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};s.push(m);var v={id:At(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};l.push({id:v.id}),a.push(v)}if(h.type===Wt.composition){var y={id:At(),dataType:"SubCompositionPlayableAsset"};s.push(y);var g={id:At(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};l.push({id:g.id}),a.push(g)}var x={id:At(),dataType:"ObjectBindingTrack",children:l,clips:[]};a.push(x),o.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],E=w(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:o.id},t.sceneBindings=n,i.miscs.push(o);for(var C,A=w(a);!(C=A()).done;){var S=C.value;i.miscs.push(S)}for(var I,R=w(s);!(I=R()).done;){var O=I.value;i.miscs.push(O)}}(n,l,a)},a=ri({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),s=w(a.images);!(i=s()).done;){i.value.id=At()}if(null!=(e=a).textures||(e.textures=[]),a.textures.forEach((function(t){var e;t.id=At(),t.dataType=Ae.Texture,t.source={id:null==(e=a.images[t.source])?void 0:e.id}})),a.textures.length<a.images.length)for(var o=a.textures.length;o<a.images.length;o++)a.textures.push({id:At(),dataType:Ae.Texture,source:{id:a.images[o].id},flipY:!0});t.bins&&(r=t.bins,a.bins=r.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:At()}})));for(var u,h={},l={},c=w(t.compositions);!(u=c()).done;)n();for(var f,d=w(a.items);!(f=d()).done;){var p=f.value;if(p.content){if(p.content.renderer&&void 0!==p.content.renderer.texture){var m=p.content.renderer.texture;p.content.renderer.texture={id:a.textures[m].id}}if(p.content.trails&&void 0!==p.content.trails.texture){var v=p.content.trails.texture;p.content.trails.texture={id:a.textures[v].id}}}if(p.transform){var y,g,x,b=[].concat(null!=(y=p.transform.position)?y:[0,0,0]),T=[].concat(null!=(g=p.transform.rotation)?g:[0,0,0]),E=[].concat(null!=(x=p.transform.scale)?x:[1,1,1]);if(Object.assign(p,{transform:{position:{x:b[0],y:b[1],z:b[2]},eulerHint:{x:T[0],y:T[1],z:T[2]},scale:{x:E[0],y:E[1],z:E[0]}}}),p.type===Wt.sprite&&(p.transform.size={x:E[0],y:E[1]},p.transform.scale={x:1,y:1,z:1}),p.type===Wt.sprite){var _=p.content;_.renderer||(_.renderer={});var C,A,S,I,R=_.renderer,O=jc(R.anchor,R.particleOrigin),M=p.transform.size;if(!R.anchor&&void 0!==R.particleOrigin)p.transform.position.x+=-O[0]*(null!=(C=null==M?void 0:M.x)?C:1),p.transform.position.y+=-O[1]*(null!=(A=null==M?void 0:M.y)?A:1);p.transform.anchor={x:O[0]*(null!=(S=null==M?void 0:M.x)?S:1),y:O[1]*(null!=(I=null==M?void 0:M.y)?I:1)}}}if(p.type===Wt.particle){var N=p.content;N.renderer||(N.renderer={});var P=N.renderer;N.renderer.anchor=jc(P.anchor,P.particleOrigin)}if(p.type===Wt.camera&&p.content.positionOverLifetime&&0!==Object.keys(p.content.positionOverLifetime).length&&(p.content.positionOverLifetime.asMovement=!0),void 0!==p.pn){var F=p.pn,L=t.plugins,V=void 0===L?[]:L;void 0!==F&&Number.isInteger(F)&&(p.pluginName=V[F])}switch("editor-gizmo"===p.pluginName&&(p.type="editor-gizmo"),"orientation-transformer"===p.pluginName&&(p.type="orientation-transformer"),p.content.options.target&&"editor-gizmo"===p.pluginName&&(p.content.options.target=h[p.content.options.target]),p.type===Wt.spine&&t.spines&&0!==t.spines.length&&af(t.spines[p.content.options.spine],p.content,a),p.type!==Wt.sprite&&p.type!==Wt.particle&&p.type!==Wt.mesh&&p.type!==Wt.skybox&&p.type!==Wt.light&&"camera"!==p.type&&p.type!==Wt.tree&&p.type!==Wt.interact&&p.type!==Wt.camera&&p.type!==Wt.text&&p.type!==Wt.spine&&"editor-gizmo"!==p.type&&"orientation-transformer"!==p.type||(p.components=[],a.components.push(p.content),p.content.id=At(),p.content.item={id:p.id},p.dataType=Ae.VFXItemData,p.components.push({id:p.content.id})),p.type!==Wt.null&&p.type!==Wt.composition||(p.components=[],p.dataType=Ae.VFXItemData),p.type){case Wt.sprite:p.content.dataType=Ae.SpriteComponent;break;case Wt.particle:p.content.dataType=Ae.ParticleSystem;break;case Wt.mesh:p.content.dataType=Ae.MeshComponent;break;case Wt.skybox:p.content.dataType=Ae.SkyboxComponent;break;case Wt.light:p.content.dataType=Ae.LightComponent;break;case"camera":p.content.dataType=Ae.CameraComponent;break;case"editor-gizmo":p.content.dataType="GizmoComponent";break;case"orientation-transformer":p.content.dataType="OrientationComponent";break;case Wt.tree:p.content.dataType=Ae.TreeComponent;break;case Wt.interact:p.content.dataType=Ae.InteractComponent;break;case Wt.camera:p.content.dataType=Ae.CameraController;break;case Wt.text:p.content.dataType=Ae.TextComponent;break;case Wt.spine:p.content.dataType=Ae.SpineComponent}}return a.version=Dt["3_0"],a}function nf(t){if(t)for(var e,i=w(Object.keys(t));!(e=i()).done;){var r=e.value,n=t[r],a=Array.isArray(n);a&&2===n.length&&Array.isArray(n[1])?t[r]="path"===r?Lc(n):Ac(n):a||"object"!=typeof n||nf(n)}}function af(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map((function(t){return{id:i.textures[t].id}}))}}function sf(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:Lc(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:Ac(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:Ac(n.linearX),linearY:Ac(n.linearY),linearZ:Ac(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Ac(n.orbitalX),orbitalY:Ac(n.orbitalY),orbitalZ:Ac(n.orbitalZ),speedOverLifetime:Ac(n.speedOverLifetime)};Dc(a);var s={options:{startColor:Ic(r.startColor)},positionOverLifetime:a};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var o=t.rotationOverLifetime;if(o){var u=s.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=Ac(o.x),u.y=Ac(o.y),u.z=Ac(o.z)):u.z=Ac(o.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=s.colorOverLifetime={opacity:Ac(h.opacity)};h.color&&(l.color=Fc(h.color))}var c=t.sizeOverLifetime;return c&&(s.sizeOverLifetime={separateAxes:c.separateAxes,size:Ac(c.size),x:Ac(c.x),y:Ac(c.y),z:Ac(c.z)}),s}var of="2.6.4",uf=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,hf=/^(\d+)\.(\d+)$/,lf=!1;function cf(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e,i;(function(t){var e=t.playerVersion||{},i=e.web,r=void 0===i?"":i;if(r){var n,a,s=null!=(n=uf.exec(r))?n:[],o=null!=(a=uf.exec(of))?a:[],u=s[1],h=s[2],l=o[1],c=o[2];return Number(l)<Number(u)||Number(l)===Number(u)&&Number(c)<Number(h)}return!1})(t)&&console.warn("The JSON need higher than "+(null==(e=t.playerVersion)?void 0:e.web)+" runtime version(current: "+of+"). Some features may not work as expected.");if(function(t){var e,i=null==(e=t.version)?void 0:e.split(".");!i||Number(i[0])>2||2===Number(i[0])&&Number(i[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==Wt.mesh&&t.type!==Wt.light||(t.endBehavior=1===t.endBehavior?re.destroy:t.endBehavior)}))}))}(t),uf.test(t.version))return lf="0"===(null==(i=/^(\d+)/.exec(t.version))?void 0:i[0]),$c(Jc(Qc(rf(Zc(function(t){var e;ff=Dt["1_0"];var i=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(ff=Dt["1_3"]);var r,n=(t.requires||[]).slice(),a=t.images.map((function(e,i){return df(e,i,t.imageTags||[])})),s=t.textures||a.map((function(t,e){return{source:e,flipY:!0}})),o={plugins:i,shapes:t.shapes||[],type:"ge",version:ff,playerVersion:null!=(r=t.playerVersion)?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return pf(t,{plugins:i,requires:n})})),images:a,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:s,bins:(t.bins||[]).slice()};t._textures&&(o._textures=t._textures);return o}(t))))));lf=!1;var r=hf.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]);if(n)return(n<2||2===n&&a<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,i=w(t.items);!(e=i()).done;)nf(e.value.content)})),t}(t)),n<3&&(t=rf(Zc(t))),r=hf.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]),n<4&&(a<2&&(t=Qc(t)),a<3&&(t=Jc(t)),a<4&&(t=$c(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var ff=Dt["1_0"];function df(t,e,i){var r=i[e];if("string"==typeof t)return{id:At(),renderLevel:r,url:t};if(t.template)return{id:At(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:At(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:At(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function pf(t,e){var i;void 0===e&&(e={});var r={id:t.id+"",camera:ri({clipMode:xe},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return gf(t,e)})),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var mf,vf=[0,0,0,1],yf=.5;function gf(t,e){var i;void 0===e&&(e={});var r,n,a,s,o,u,h=Wt.base,l=t.endBehavior,c=NaN;if(t.content?(h=t.type||Wt.plugin,u=t.pn,o=t.pluginName,a=t.content,n=t.content,isNaN(u)&&!o&&(o=a.options.type),t.duration&&(c=t.duration),r=t.transform||y(n.transform)):t.particle?(h=Wt.particle,r=y((n=t.particle).transform,lf,!0),a=function(t){var e=t.options,i=t.transform,r={type:Gt.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=ri({},t.shape,{type:Gt[a]}),t.shape.upDirection){var s=t.shape.upDirection,o=s[0],u=s[1],h=s[2];0===o&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=Oc(e.turbulenceX),r.turbulenceY=Oc(e.turbulenceY),r.turbulenceZ=Oc(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return Vc(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return Vc(t)}))),l.rateOverTime&&(l.rateOverTime=Oc(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:Oc(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Oc(e.startSize),startSizeX:Oc(e.startSizeX),startSizeY:Oc(e.startSizeY),sizeAspect:Oc(e.sizeAspect),maxCount:e.maxCount,startDelay:Oc(e.startDelay),startColor:Rc(e.startColor,!0),startRotationZ:Oc(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=Oc(e.startRotationX),c.options.startRotationY=Oc(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:Lc(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:Oc(f.x),y:Oc(f.y)}:c.sizeOverLifetime={size:Oc(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?Ac(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Ac(e.gravityModifier),startSpeed:Oc(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:Oc(d.linearX),linearY:Oc(d.linearY),linearZ:Oc(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Oc(d.orbitalX),orbitalY:Oc(d.orbitalY),orbitalZ:Oc(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Ac(d.forceCurve)},Dc(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Oc(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=Ac(m.y),c.rotationOverLifetime.x=Ac(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:Ac(v.opacity)};v.color&&(y.color=Fc(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Ac(g.cycles),animationDelay:Sc(g.animationDelay,0),animationDuration:Sc(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:Oc(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Ac(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Fc(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Fc(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:Oc(x.opacityOverLifetime)}),c.trails&&Dc(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(n)):t.sprite?(h=Wt.sprite,a=function(t,e){var i=sf(t,e),r=t.textureSheetAnimation;return r&&(i.textureSheetAnimation={row:r.row,col:r.col,total:r.total||void 0,animate:r.animate}),i.renderer=t.renderer,t.splits&&(i.splits=t.splits),t.interaction&&(i.interaction=t.interaction),i}(n=t.sprite,r=y(n.transform,!1,!0))):t.cal?(h=Wt.null,a=sf(n=t.cal,r=y(n.transform,!1,!0))):t.ui?(h=Wt.interact,r=y((n=t.ui).transform),a=function(t){var e,i=t.options;switch(i.type){case"click":e={type:Xt.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&Ic(i.previewColor),behavior:i.behavior||Ht.NOTIFY};break;case"drag":e={type:Xt.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:Xt.MESSAGE}}return{options:e}}(n),r.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=Wt.camera,r=y(n.transform),a=function(t){var e,i=t.options,r={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var a,s={path:Lc(null==(a=t.transform)?void 0:a.path),linearX:Ac(null==n?void 0:n.translateX),linearY:Ac(null==n?void 0:n.translateY),linearZ:Ac(null==n?void 0:n.translateZ)};Dc(s),r.positionOverLifetime=s}var o=t.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:Ac(null==o?void 0:o.rotateX),y:Ac(null==o?void 0:o.rotateY),z:o.separateAxes?Ac(null==o?void 0:o.rotateZ):Ac(o.rotation)};Dc(u),r.rotationOverLifetime=u}return r}(n))),null==(i=a.renderer)?void 0:i.anchor){var f=new Float32Array(a.renderer.anchor);f[0]==yf&&f[1]==yf?delete a.renderer.anchor:e.requires&&Cc(e.requires,"anchor")}if(n){var d,p,m=null==(d=n.options)?void 0:d.looping;if(m)l=Array.isArray(m)?m[1]?re.restart:re.destroy:re.restart;else l=l||(null==n||null==(p=n.options)?void 0:p.endBehavior)||re.destroy;n.options.renderLevel&&(s=n.options.renderLevel),isNaN(c)&&(c=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:c,id:t.id+"",transform:r,endBehavior:l,renderLevel:s,content:a};return o?e.plugins?(Cc(e.plugins,o),v.pn=e.plugins.indexOf(o)):v.pluginName=o:Number.isInteger(u)&&(v.pn=u),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,i){if(t){var r={},n=t.rotation;if(n&&(r.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],i)){var a=(s=vf,o=r.rotation[0],u=r.rotation[1],h=r.rotation[2],l=zc(o*Bc/2),c=zc(u*Bc/2),f=zc(h*Bc/2),d=Uc(o*Bc/2),p=Uc(u*Bc/2),m=Uc(h*Bc/2),s[0]=d*c*f+l*p*m,s[1]=l*p*f-d*c*m,s[2]=l*c*m+d*p*f,s[3]=l*c*f-d*p*m,s);r.rotation=function(t,e){var i,r,n,a=e[0],s=e[1],o=e[2],u=e[3],h=a+a,l=s+s,c=o+o,f=a*h,d=s*h,p=s*l,m=o*c,v=u*c,y=1-p-m,g=d-v,x=d+v,b=1-f-m,T=o*h-u*l,E=o*l+u*h,_=1-f-p;return t[1]=Math.asin((r=-1,(i=-T)>(n=1)?n:i<r?r:i))*Gc,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Gc,t[2]=Math.atan2(x,y)*Gc):(t[0]=0,t[2]=Math.atan2(-g,b)*Gc),t}([],a)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}var s,o,u,h,l,c,f,d,p,m;return{}}}var xf,bf=((mf={})[kt.S]=[kt.S,kt.BPlus,kt.APlus],mf[kt.A]=[kt.A,kt.BPlus,kt.APlus],mf[kt.B]=[kt.B,kt.BPlus],mf);function Tf(t,e){if(!t||!e)return!0;var i=bf[e];return!!i&&i.includes(t)}function Ef(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,s=n.url;return a&&(e&&e[a]?i=e[a]:s&&(i=s)),i}function _f(t,e,i){return wf.apply(this,arguments)}function wf(){return(wf=E((function(t,e,i){var r,n;return I(this,(function(a){switch(a.label){case 0:return"string"!=typeof t?[3,2]:[4,Kr(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw new Error("Image not provided.");if(!e)return[2,r];if(n=Ef(e,i)){if(gt(n)&&n!==r.src)return[2,Kr(n)];if(C(n,l))return[2,n]}return[2,r]}}))}))).apply(this,arguments)}!function(t){t.isJSONObject=function(t){return Tt(t)&&"jsonScene"in t},t.isURL=function(t){return Tt(t)&&"url"in t},t.isWithOptions=function(t){return Tt(t)&&"options"in t}}(xf||(xf={}));var Cf=1,Af=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new jr),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=Cf++,this.timers=[],this.updateOptions(t)}var e=t.prototype;return e.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,i=void 0===e?10:e;this.timeout=i},e.loadScene=function(t,e,i){var n=this;return E((function(){var a,s,o,u,h,l,f,p,m,y,g,x,b;return I(this,(function(T){return s=gt(t)?t:n.id,o=d.now(),u=[],h=null==e?void 0:e.engine.gpuCapability,f=null!=(l=null==h?void 0:h.detail.compressedTexture)?l:za.NONE,p={},y=!1,g=new Promise((function(t,e){m=r.setTimeout((function(){y=!0,n.removeTimer(m);var t=d.now()-o;e(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+u.join(" ")+", url: "+s+"."))}),1e3*n.timeout),n.timers.push(m)})),x=E((function(t,e){var i,r,n,a;return I(this,(function(s){switch(s.label){case 0:if(y)return[3,4];i=d.now(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e()];case 2:return r=s.sent(),n=d.now()-i,u.push("["+t+": "+n.toFixed(2)+"]"),p[t]=n,[2,r];case 3:throw a=s.sent(),new Error("Load error in "+t+", "+a+".");case 4:throw new Error("Load canceled.")}}))})),b=E((function(){var e,h,l,y,g,b,T,E,_,w,C,A,S,R;return I(this,(function(I){switch(I.label){case 0:return gt(t)?(h=new c(t,v.href).href,n.baseUrl=h,[4,x("loadJSON",(function(){return n.loadJSON(h)}))]):[3,2];case 1:return gt(a=I.sent())&&(a=JSON.parse(a)),[3,3];case 2:a=t,n.baseUrl=v.href,I.label=3;case 3:return xf.isJSONObject(a)?(e=ri({},a),[3,9]):[3,4];case 4:return[4,x("processJSON",(function(){return n.processJSON(a)}))];case 5:return l=I.sent(),y=l.jsonScene,g=l.pluginSystem,b=y.bins,T=void 0===b?[]:b,E=y.images,_=y.fonts,[4,Promise.all([x("processBins",(function(){return n.processBins(T)})),x("processImages",(function(){return n.processImages(E,f)})),x("plugin:processAssets",(function(){return n.processPluginAssets(y,g,i)})),x("processFontURL",(function(){return n.processFontURL(_)}))])];case 6:return w=I.sent(),C=w[0],A=w[1],[4,x("processTextures",(function(){return n.processTextures(A,C,y)}))];case 7:return S=I.sent(),e={timeInfos:p,url:t,renderLevel:n.options.renderLevel,storage:{},pluginSystem:g,jsonScene:y,bins:C,textureOptions:S,textures:[],images:A,assets:n.assets},[4,x("plugin:prepareResource",(function(){return g.loadResources(e,n.options)}))];case 8:I.sent(),I.label=9;case 9:return R=d.now()-o,vt.info("Load asset: totalTime: "+R.toFixed(4)+"ms "+u.join(" ")+", url: "+s+"."),r.clearTimeout(m),n.removeTimer(m),e.totalTime=R,e.startTime=o,e.timeInfos=p,[2,e]}}))})),[2,Promise.race([g,b()])]}))}))()},e.getAssets=function(){return this.assets},e.processJSON=function(t){var e=this;return E((function(){var i,r,n;return I(this,(function(a){switch(a.label){case 0:return i=cf(t),r=i.plugins,[4,(n=new Ft(void 0===r?[]:r)).processRawJSON(i,e.options)];case 1:return a.sent(),[2,{jsonScene:i,pluginSystem:n}]}}))}))()},e.processBins=function(t){var e=this;return E((function(){var i,r,n;return I(this,(function(a){return i=e.options.renderLevel,r=e.baseUrl,n=t.map((function(n){if(C(n,ArrayBuffer))return n;if(Tf(n.renderLevel,i))return e.loadBins(new c(n.url,r).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(n)]}))}))()},e.processFontURL=function(e){var r=this;return E((function(){var n;return I(this,(function(a){return e?(n=e.map(E((function(e){var n,a,s;return I(this,(function(o){switch(o.label){case 0:if(!e.fontURL||t.fontCache.has(e.fontFamily))return[3,4];lt(e.fontFamily)||console.warn("Risky font family: "+e.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),n=new c(e.fontURL,r.baseUrl).href,[4,(s=new FontFace(null!=(a=e.fontFamily)?a:"","url("+n+")")).load()];case 2:return o.sent(),i.fonts.add(s),t.fontCache.add(e.fontFamily),[3,4];case 3:return o.sent(),vt.warn("Invalid font family or font source: "+JSON.stringify(e.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(n)]):[2]}))}))()},e.processImages=function(t,e){void 0===e&&(e=0);var i=this;return E((function(){var r,n,a,s,o,u,h,f;return I(this,(function(d){switch(d.label){case 0:return r=i.options,n=r.useCompressedTexture,a=r.variables,s=r.disableWebP,o=r.disableAVIF,u=i.baseUrl,h=t.map(E((function(t,r){var h,f,d,v,y,g,x,b,T,E,_,w,A,S,R,O,M,N,P,F,L;return I(this,(function(r){switch(r.label){case 0:if(h=t.url,f=t.webp,d=t.avif,v=new c(h,u).href,y=!s&&f?new c(f,u).href:void 0,g=!o&&d?new c(d,u).href:void 0,x=t.id,!("template"in t))return[3,8];if(b=t.template,!(T=b.background))return[3,7];E=Ef(b,a),_=T.type===we.video,w=T&&_?rn:Kr,r.label=1;case 1:return r.trys.push([1,6,,7]),[4,an(E,w)];case 2:return C(A=r.sent(),p)?(i.sourceFrom[x]={url:A.src,type:Rr.video},[2,A]):[3,3];case 3:return T&&Array.isArray(E)&&a&&(a[T.name]=A.src),i.sourceFrom[x]={url:A.src,type:Rr.image},[4,_f(A,b,a)];case 4:return[2,r.sent()];case 5:return[3,7];case 6:throw S=r.sent(),new Error("Failed to load. Check the template or if the URL is "+(_?"video":"image")+" type, URL: "+E+", Error: "+(S.message||S)+".");case 7:return[3,9];case 8:if("compressed"in t&&n&&e){if(R=t.compressed,e===za.ASTC?O=R.astc:e===za.PVRTC&&(O=R.pvrtc),O)return M=new c(O,u).href,i.sourceFrom[x]={url:M,type:Rr.compressed},[2,i.loadBins(M)]}else if(C(t,l)||C(t,m)||C(t,p)||C(t,fn))return[2,t];r.label=9;case 9:return g?[4,Zr(v,g)]:[3,11];case 10:return L=r.sent(),[3,13];case 11:return[4,Wr(v,y)];case 12:L=r.sent(),r.label=13;case 13:return P=(N=L).url,F=N.image,i.sourceFrom[x]={url:P,type:Rr.image},[2,F]}}))}))),[4,Promise.all(h)];case 1:return f=d.sent(),i.assignImagesToAssets(t,f),[2,f]}}))}))()},e.processPluginAssets=function(t,e,i){var r=this;return E((function(){var n,a,s,o,u;return I(this,(function(h){switch(h.label){case 0:return[4,e.processAssets(t,i)];case 1:for(n=h.sent(),a=n.reduce((function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t}),{assets:[],loadedAssets:[]}),s=a.assets,o=a.loadedAssets,u=0;u<s.length;u++)r.assets[s[u].id]=o[u];return[2]}}))}))()},e.processTextures=function(t,e,i){var r=this;return E((function(){var n,a,s;return I(this,(function(o){return a=null!=(n=i.textures)?n:t.map((function(t,e){return{source:e}})),s=a.map(E((function(t,n){var a,s,o,u,h,c;return I(this,(function(f){switch(f.label){case 0:if(C(t,fn))return[2,t];if(!("mipmaps"in t))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,on(t,e,r.assets,i.bins)];case 2:return[2,f.sent()];case 3:throw a=f.sent(),new Error("Load texture "+n+" fails, error message: "+a+".");case 4:return s=t.source,o=t.id,h="",Tt(s)?(u=r.assets[s.id],h=s.id,[3,7]):[3,5];case 5:return"string"!=typeof s?[3,7]:[4,Kr(St(s))];case 6:u=f.sent(),f.label=7;case 7:if(u)return c=function(t,e,i){var r={id:i,dataType:Ae.Texture};if(C(t,fn))return ri({},t.source,r);if(C(t,l)||_t(t))return ri({image:t,sourceType:Rr.image,sourceFrom:e,keepImageSource:!0,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR},r);if(C(t,p))return ri({sourceType:Rr.video,video:t,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR},r);if(C(t,ArrayBuffer))return ri({},gn(t),{sourceFrom:e},r);if("width"in t&&"height"in t&&"data"in t)return ri({sourceType:Rr.data,data:t,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE,minFilter:Mr.NEAREST,magFilter:Mr.NEAREST},r);throw new Error("Invalid texture options.")}(u,r.sourceFrom[h],o),[2,c.sourceType===Rr.compressed?c:ri({},c,t)];throw new Error("Invalid texture source: "+s+".")}}))}))),[2,Promise.all(s)]}))}))()},e.loadJSON=function(t){var e=this;return E((function(){return I(this,(function(i){return[2,new Promise((function(i,r){e.downloader.downloadJSON(t,i,(function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)}))}))]}))}))()},e.loadBins=function(t){var e=this;return E((function(){return I(this,(function(i){return[2,new Promise((function(i,r){e.downloader.downloadBinary(t,i,(function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)}))}))]}))}))()},e.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},e.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},e.dispose=function(){this.timers.length&&this.timers.map((function(t){return r.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t}();Af.fontCache=new Set;var Sf,If=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(mn(t))}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var i=t;return xf.isURL(t)&&(xf.isJSONObject(t)||(i=t.url),xf.isWithOptions(t)&&(e=ri({},e,t.options))),{source:i,options:e}},e.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===Wt.text||t.type===Wt.richtext){var r=e[t.name];if(!r)return;t.components.forEach((function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==Ae.TextComponent&&(null==n?void 0:n.dataType)!==Ae.RichTextComponent||(n.options.text=r)}))}}))},e.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++)t.textures[e]=this.engine.findObject({id:t.textureOptions[e].id}),t.textures[e].initialize()},e.prepareAssets=function(t,e){this.engine.clearResources();for(var i,r=w(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],s=new bc(this.engine);s.data=a,s.setInstanceId(n)}this.engine.addPackageDatas(t);for(var o,u=w(this.builtinObjects);!(o=u()).done;){var h=o.value;this.engine.addInstance(h)}},e.createShaderVariant=function(){for(var t,e=w(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];C(r,On)&&r.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=w(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),Rf=new Int32Array(2),Of=new Float32Array(Rf.buffer),Mf=new Float64Array(Rf.buffer),Nf=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];!function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(Sf||(Sf={}));var Pf=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new y}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return Rf[0]=this.readInt32(t),Of[0]},e.readFloat64=function(t){return Rf[Nf?0:1]=this.readInt32(t),Rf[Nf?1:0]=this.readInt32(t+4),Mf[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){Of[0]=e,this.writeInt32(t,Rf[0])},e.writeFloat64=function(t,e){Mf[0]=e,this.writeInt32(t,Rf[Nf?0:1]),this.writeInt32(t+4,Rf[Nf?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===Sf.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),Ff=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=Pf.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=1+~(this.bb.capacity()-this.space+i)&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=2*(i+2);this.addInt16(r);var n=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){var s=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(s)){for(var o=2;o<r;o+=2)if(this.bb.readInt16(a+o)!=this.bb.readInt16(s+o))continue t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){var n=e;if(this.prep(this.minalign,8+r),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var a=3;a>=0;a--)this.writeInt8(n.charCodeAt(a))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw new TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){return null==t?0:(e=C(t,Uint8Array)?t:this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector());var e},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null===r)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=Pf.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),Lf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new Vf(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),Vf=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=Lf.createDataVector(t,this.data);return Lf.createFBEffectsObjectData(t,e,i)},t}(),Df=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new Lf).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new kf(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),kf=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=Df.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Df.createFBEffectsPackageData(t,e)},t}(),zf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new Uf(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),Uf=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return zf.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),Bf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new Gf(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,a,s){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,s),t.endFBVertexChannel(e)},t}(),Gf=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return Bf.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),jf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new Bf).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new Xf(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),Xf=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=jf.createChannelsVector(t,t.createObjectOffsetList(this.channels));return jf.createFBVertexData(t,this.vertexCount,e)},t}(),Hf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new jf).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new zf).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new Wf(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),Wf=function(){function t(t,e,i,r,n,a,s,o,u,h,l,c){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=[]),void 0===s&&(s=0),void 0===o&&(o=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===l&&(l=null),void 0===c&&(c=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=a,this.mode=s,this.buffer=o,this.binaryData=u,this.boneNames=h,this.rootBoneName=l,this.inverseBindMatrices=c}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=Hf.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,s=Hf.createBinaryDataVector(t,this.binaryData),o=Hf.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=Hf.createInverseBindMatricesVector(t,this.inverseBindMatrices);return Hf.startFBGeometryData(t),Hf.addId(t,e),Hf.addName(t,i),Hf.addVertexData(t,r),Hf.addIndexFormat(t,this.indexFormat),Hf.addIndexOffset(t,this.indexOffset),Hf.addSubMeshes(t,n),Hf.addMode(t,this.mode),Hf.addBuffer(t,a),Hf.addBinaryData(t,s),Hf.addBoneNames(t,o),Hf.addRootBoneName(t,u),Hf.addInverseBindMatrices(t,h),Hf.endFBGeometryData(t)},t}(),Yf=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new Ff(1),i=new kf,r=[],n=w(this.exportObjectDatas);!(t=n()).done;){var a=t.value,s=void 0;a.dataType===Ae.Geometry&&(s=new Vf("Geometry",this.geometryDataToBinary(a))),s&&r.push(s)}return i.exportObjects=r,Df.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new Pf(t),i=Df.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),s=n.dataType();if(a){var o=void 0;s===Ae.Geometry&&(o=this.binaryToGeometryData(a)),o&&this.exportObjectDatas.push(o)}}}},e.geometryDataToBinary=function(t){var e=new Ff(1),i=new Wf,r=t.indexFormat,n=t.indexOffset,a=t.mode,s=t.id,o=t.vertexData,u=t.boneNames,h=void 0===u?[]:u,l=t.rootBoneName,c=void 0===l?"":l,f=t.inverseBindMatrices,d=void 0===f?[]:f,p=t.binaryData,m=void 0===p?[]:p;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=s,i.boneNames=h,i.rootBoneName=c,i.inverseBindMatrices=d,i.binaryData=m;var v=new Xf;v.vertexCount=o.vertexCount,v.channels=[];for(var y,g=w(o.channels);!(y=g()).done;){var x=y.value,b=x.semantic,T=x.offset,E=x.format,_=x.dimension,C=x.normalize,A=new Gf(b,T,E,_,C);v.channels.push(A)}i.vertexData=v;for(var S,I=[],R=w(t.subMeshes);!(S=R()).done;){var O=S.value,M=O.offset,N=O.indexCount,P=O.vertexCount,F=new Uf(M,N,P);I.push(F)}return i.subMeshes=I,Df.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new Pf(t),i=Hf.getRootAsFBGeometryData(e),r={vertexCount:0,channels:[]},n=i.vertexData();if(n){r.vertexCount=n.vertexCount();for(var a=0;a<n.channelsLength();a++){var s=n.channels(a);if(s){var o,u={semantic:null!=(o=s.semantic())?o:"",offset:s.offset(),format:s.format(),dimension:s.dimension(),normalize:s.normalize()};r.channels.push(u)}}}for(var h=[],l=0;l<i.subMeshesLength();l++){var c=i.subMeshes(l);if(c){var f={offset:c.offset(),vertexCount:c.vertexCount(),indexCount:c.indexCount()};h.push(f)}}for(var d=[],p=0;p<i.boneNamesLength();p++){var m=i.boneNames(p);d.push(m)}var v,y,g,x,b=i.inverseBindMatricesArray();return{vertexData:r,indexFormat:i.indexFormat(),indexOffset:i.indexOffset(),subMeshes:h,mode:i.mode(),buffer:null!=(v=i.buffer())?v:"",boneNames:d,rootBoneName:null!=(y=i.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=i.binaryDataArray())?g:void 0,id:null!=(x=i.id())?x:"",dataType:Ae.Geometry}},t}(),Zf=function(){function t(){this.renderErrors=new Set,this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new _c(this),this.emptyTexture=mn(this),this.transparentTexture=vn(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.findObject=function(t){return Et(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=void 0===r?[]:r,a=i.items,s=void 0===a?[]:a,o=i.materials,u=void 0===o?[]:o,h=i.shaders,l=void 0===h?[]:h,c=i.geometries,f=void 0===c?[]:c,d=i.components,p=void 0===d?[]:d,m=i.animations,v=void 0===m?[]:m,y=i.bins,g=void 0===y?[]:y,x=i.miscs,b=void 0===x?[]:x,T=w(i.compositions);!(e=T()).done;){var E=e.value;this.addEffectsObjectData(E)}for(var _,C=w(s);!(_=C()).done;){var A=_.value;Tf(A.renderLevel,t.renderLevel)||(A.components=[],A.type=Wt.null),this.addEffectsObjectData(A)}for(var S,I=w(u);!(S=I()).done;){var R=S.value;this.addEffectsObjectData(R)}for(var O,M=w(l);!(O=M()).done;){var N=O.value;this.addEffectsObjectData(N)}for(var P,F=w(f);!(P=F()).done;){var L=P.value;this.addEffectsObjectData(L)}for(var V,D=w(p);!(V=D()).done;){var k=V.value;this.addEffectsObjectData(k)}for(var z,U=w(v);!(z=U()).done;){var B=z.value;this.addEffectsObjectData(B)}for(var G,j=w(b);!(G=j()).done;){var X=G.value;this.addEffectsObjectData(X)}for(var H=0;H<g.length;H++){var W=g[H],Y=t.bins[H];if(W.dataType===Ae.BinaryAsset)W.buffer=Y,W.id&&this.addEffectsObjectData(W);else{var Z=new Yf;Z.deserializeFromBinary(new Uint8Array(Y));for(var q,K=w(Z.exportObjectDatas);!(q=K()).done;){var Q=q.value;this.addEffectsObjectData(Q)}}}for(var J,$=w(n);!(J=$()).done;){var tt=J.value;this.addEffectsObjectData(tt)}},e.createVFXItems=function(t){var e=this;return E((function(){var i,r,n,a,s;return I(this,(function(o){for(i=t.jsonScene,r=w(i.items);!(n=r()).done;)a=n.value,"ECS"!==(s=a.type)&&"camera"!==s&&s!==Wt.sprite&&s!==Wt.particle&&s!==Wt.mesh&&s!==Wt.skybox&&s!==Wt.light&&s!==Wt.tree&&s!==Wt.interact&&s!==Wt.camera||e.database&&e.assetLoader.loadGUID(a);return[2]}))}))()},e.addTexture=function(t){this.destroyed||V(this.textures,t)},e.removeTexture=function(t){this.destroyed||D(this.textures,t)},e.addMaterial=function(t){this.destroyed||V(this.materials,t)},e.removeMaterial=function(t){this.destroyed||D(this.materials,t)},e.addGeometry=function(t){this.destroyed||V(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||D(this.geometries,t)},e.addMesh=function(t){this.destroyed||V(this.meshes,t)},e.removeMesh=function(t){this.destroyed||D(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||V(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||D(this.renderPasses,t)},e.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass "+this.renderPasses.length),this.meshes.length>0&&t.push("Mesh "+this.meshes.length),this.geometries.length>0&&t.push("Geom "+this.geometries.length),this.textures.length>0&&t.push("Tex "+this.textures.length),t.length>0&&vt.warn("Release GPU memory: "+t.join(", ")+"."),this.renderPasses.forEach((function(t){return t.dispose()})),this.meshes.forEach((function(t){return t.dispose()})),this.geometries.forEach((function(t){return t.dispose()})),this.materials.forEach((function(t){return t.dispose()})),this.textures.forEach((function(t){return t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},dr(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),qf=60,Kf=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=li(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=d.now();var e=x||function(t){return r.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(g||r.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=d.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var e=0,i=this.tickers.length;e<i;e++){var r=this.tickers[e];r(this.dt)}}}},e.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},dr(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();Nt("camera",no,gl),Nt("text",xc,gl),Nt("sprite",Ou,gl),Nt("particle",Ol,gl),Nt("cal",Ml,gl),Nt("interact",po,gl);var Qf;vt.info("Core version: 2.6.4.");var Jf,$f=((Qf={})[Mr.RGBA]=34842,Qf[Mr.RGB]=34843,Qf[Mr.ALPHA]=33325,Qf[Mr.RED]=33325,Qf[Mr.LUMINANCE_ALPHA]=33327,Qf[Mr.LUMINANCE]=33325,Qf),td=((Jf={})[Mr.RGBA]=34836,Jf[Mr.RGB]=34837,Jf[Mr.ALPHA]=33326,Jf[Mr.RED]=33326,Jf[Mr.LUMINANCE_ALPHA]=33328,Jf[Mr.LUMINANCE]=33326,Jf),ed=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},i.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,i=this.source,r=i.target,n=void 0===r?e.TEXTURE_2D:r,a=i.name;this.textureBuffer=e.createTexture(),sd(this.textureBuffer,a),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},i.clone=function(){var t=new e(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},i.release=function(){switch(this.source.sourceType){case Rr.image:delete this.source.image,delete this.source.cube;break;case Rr.data:delete this.source.data;break;case Rr.compressed:case Rr.mipmaps:delete this.source.mipmaps}},i.update=function(t){var e=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var i,r,n=this.target,a=this.source,s=this.pipelineContext.gl,o=this.engine.gpuCapability.detail,u=a.sourceType,h=a.data,l=a.cube,c=a.image,f=a.video,d=a.mipmaps,p=a.mipmaps,m=t.data,v=t.cube,y=t.generateMipmap,g=t.mipmaps,x=a.format,b=a.type,T=a.internalFormat,E=0,_=0;if(this.bind(u===Rr.video),b===Mr.HALF_FLOAT?((b=o.halfFloatTexture)||vt.error("Half float texture is not support."),Fr(s)&&T===x&&(x===Mr.LUMINANCE&&(x=Mr.RED),T=$f[x]),o.halfFloatLinear||(a.minFilter=a.magFilter=s.NEAREST,vt.warn("Half float linear not support, change to NEAREST."))):b===s.FLOAT&&((b=o.floatTexture)||vt.error("Float texture is not support."),Fr(s)&&T===x&&(x===Mr.LUMINANCE&&(x=Mr.RED),T=td[x]),o.floatLinear||(a.minFilter=s.NEAREST,a.magFilter=s.NEAREST,vt.warn("Float linear not support, change to NEAREST."))),void 0===a.premultiplyAlpha&&(a.premultiplyAlpha=!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),void 0===a.flipY&&(a.flipY=!1),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY),u===Rr.framebuffer)m&&(E=null!=(i=m.width)?i:0,_=null!=(r=m.height)?r:0,E&&_&&(this.width!==E||this.height!==_)&&s.texImage2D(n,0,T,E,_,0,x,b,null));else if(u===Rr.data){var w;if(n===s.TEXTURE_CUBE_MAP)v.forEach((function(t,i){var r=e.texImage2DData(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,x,b,t),n=r[0],a=r[1];E=Math.max(n,E),_=Math.max(a,_)}));else w=this.texImage2DData(s,n,0,T,x,b,h),E=w[0],_=w[1]}else if(u===Rr.image||u===Rr.video){if(n===s.TEXTURE_CUBE_MAP)l.forEach((function(t,i){var r=e.texImage2D(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,x,b,t),n=r[0],a=r[1];E=Math.max(n,E),_=Math.max(a,_)}));else if(n===s.TEXTURE_2D){var C,A=null!=c?c:f;C=this.texImage2D(s,n,0,T,x,b,A),E=C[0],_=C[1]}y&&(id(E)&&id(_)||Fr(s))&&s.generateMipmap(n)}else if(u===Rr.mipmaps){var S;n===s.TEXTURE_2D?d.forEach((function(t,i){var r;(S="data"in t?e.texImage2DData(s,n,i,T,x,b,t):e.texImage2D(s,n,i,T,x,b,t),0===i)&&(E=(r=S)[0],_=r[1])})):n===s.TEXTURE_CUBE_MAP&&p.forEach((function(t,i){t.forEach((function(t,r){var n;(S="data"in t?e.texImage2DData(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,T,x,b,t):e.texImage2D(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,T,x,b,t),0===i)&&(E=(n=S)[0],_=n[1])}))}))}else u===Rr.compressed&&g&&0!==g.length&&(E=g[0].width,_=g[0].height,g.forEach((function(t,e){s.compressedTexImage2D(n,e,T,t.width,t.height,0,t.data)})));this.width=E,this.height=_,this.setTextureFilters(s,n,a)},i.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=void 0===r?4:r,a=i.wrapS,s=void 0===a?t.CLAMP_TO_EDGE:a,o=i.wrapT,u=void 0===o?t.CLAMP_TO_EDGE:o,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var l=Fr(t)||id(this.width)&&id(this.height),c=i.magFilter?i.magFilter:t.NEAREST,f=i.minFilter?i.minFilter:t.NEAREST;l||f!==t.LINEAR_MIPMAP_LINEAR&&f!==t.LINEAR_MIPMAP_NEAREST&&f!==t.NEAREST_MIPMAP_LINEAR&&f!==t.NEAREST_MIPMAP_NEAREST||(f=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,f),t.texParameteri(e,t.TEXTURE_MAG_FILTER,c),t.texParameteri(e,t.TEXTURE_WRAP_S,l?s:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,l?u:t.CLAMP_TO_EDGE)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e,r=this.assembleOptions(i),n=r.sourceType,a=r.sourceFrom,s=r.name,o=void 0===s?"":s;this.source=r,this.sourceType=n,this.sourceFrom=a,this.name=o,this.guid=e.id},i.texImage2D=function(t,e,i,r,n,a,s){var o,u=this,h=this.source,l=h.sourceType,c=h.minFilter,f=h.magFilter,d=h.wrapS,p=h.wrapT,m=null!=(o=this.engine.gpuCapability.detail.maxTextureSize)?o:2048,v=s;if(l!==Rr.video){var y=c!==t.NEAREST||f!==t.NEAREST||d!==t.CLAMP_TO_EDGE||p!==t.CLAMP_TO_EDGE;(y=y||s.width>m||s.height>m)&&setTimeout((function(){v=u.resizeImage(s)}))}t.texImage2D(e,i,r,n,a,v);var g=[v.width,v.height];return l===Rr.video?[s.videoWidth,s.videoHeight]:g},i.texImage2DData=function(t,e,i,r,n,a,s){var o=s.data,u=s.width,h=s.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/o.BYTES_PER_ELEMENT):o;return t.texImage2D(e,i,r,u,h,0,n,a,l),[u,h]},i.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;if(Fr(this.pipelineContext.gl)&&t.width<n&&t.height<n)return t;var a=function(t,e,i,r){var n=t.width,a=t.height,s=Math.min(e,i||Ao(n)),o=Math.min(e,r||Ao(a));if(o!==a||s!==n){var u=fc.getCanvas(),h=u.getContext("2d");return u.width=s,u.height=o,null==h||h.drawImage(t,0,0,n,a,0,0,s,o),vt.warn("Image resize from "+n+"x"+a+" to "+s+"x"+o+"."),u}}(t,n,e,i);return a||t},i.reloadData=function(){var t=this;return E((function(){return I(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,Tn().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},i.offloadData=function(){if(this.initialized&&Tn().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},i.uploadCurrentVideoFrame=function(){var t=this;return E((function(){return I(this,(function(e){return t.source.sourceType===Rr.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},i.updateSource=function(t){this.source=this.assembleOptions(ri({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},i.restore=function(){},i.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){vt.error("This texture has been destroyed.")},this.initialize=Ct,void 0!==this.engine&&this.engine.removeTexture(this)},e}(fn);function id(t){return 0==(t&t-1)&&0!==t}var rd=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return Fr(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),sd(e,t),e},e.bindVertexArray=function(t){var e;Fr(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;Fr(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),nd=1,ad=function(){function t(t){this.engine=t,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var e={width:1,height:1,data:new Uint8Array([255])},i=t.getGLPipelineContext(),r=i.gl;this.gl=r,this.pipelineContext=i,this.emptyTexture2D=new ed(t,{data:e,sourceType:Rr.data,format:r.LUMINANCE,internalFormat:r.LUMINANCE,type:r.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new ed(t,{target:r.TEXTURE_CUBE_MAP,cube:[e,e,e,e,e,e],sourceType:Rr.data,format:r.LUMINANCE,internalFormat:r.LUMINANCE,type:r.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+nd,nd++}var e=t.prototype;return e.copy2=function(t,e){var i=this.gl;if(i){this.sourceFbo||(this.sourceFbo=i.createFramebuffer()),this.targetFbo||(this.targetFbo=i.createFramebuffer());var r=this.pipelineContext;r.bindFramebuffer(i.FRAMEBUFFER,this.sourceFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t.textureBuffer,0),r.bindFramebuffer(i.FRAMEBUFFER,this.targetFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.textureBuffer,0),r.bindFramebuffer(i.READ_FRAMEBUFFER,this.sourceFbo),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?i.NEAREST:i.LINEAR;i.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),i.COLOR_BUFFER_BIT,n),r.bindFramebuffer(i.FRAMEBUFFER,null),r.bindFramebuffer(i.READ_FRAMEBUFFER,null),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,null)}},e.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&V(this.renderbuffers,t),e},e.resize=function(t,e){var i=this.gl;(i&&i.drawingBufferWidth!==t||i.drawingBufferHeight!==e)&&(i.canvas.width=t,i.canvas.height=e,i.viewport(0,0,t,e),this.framebuffers.forEach((function(i){var r=i.viewport;i.isCustomViewport||i.resize(r[0],r[1],t*i.viewportScale,e*i.viewportScale)})))},e.drawGeometry=function(t,e,i){if(this.gl){var r=t,n=e.shaderVariant.program;if(n){var a=n.setupAttributes(r),s=this.gl,o=r.indicesBuffer,u=r.drawStart,h=r.drawCount,l=r.mode,c=r.subMeshes;if(c&&c.length){var f,d=c[i];if(h<0)return;if(u=d.offset,o)h=null!=(f=d.indexCount)?f:0;else h=d.vertexCount}o?s.drawElements(l,h,o.type,null!=u?u:0):s.drawArrays(l,u,h),null==a||a.unbind()}}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")},e.createGLFramebuffer=function(t,e){var i=this.gl.createFramebuffer();if(!i)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return V(this.framebuffers,t),sd(i,e,e),i},e.createVAO=function(t){return new rd(this.engine,t)},e.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),D(this.textures,t),delete t.textureBuffer)},e.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},e.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),D(this.framebuffers,t),delete t.fbo)},e.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),D(this.renderbuffers,t),delete t.buffer)},e.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.framebuffers.forEach((function(e){return t.deleteGLFramebuffer(e)})),this.framebuffers.length=0,this.renderbuffers.forEach((function(e){return t.deleteGLRenderbuffer(e)})),this.renderbuffers.length=0,this.textures.forEach((function(e){return t.deleteGLTexture(e)})),this.textures.length=0)},e.lost=function(t){vt.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},e.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},dr(t,[{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function sd(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var od,ud,hd=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var i=e.name,r=e.data,n=e.elementCount,a=e.target,s=void 0===a?Mr.ARRAY_BUFFER:a,o=e.type,u=void 0===o?Mr.FLOAT:o,h=e.usage,l=void 0===h?Mr.STATIC_DRAW:h,c=function(t){var e,i;return null!=(i=null==(e=ld[t])?void 0:e.BYTES_PER_ELEMENT)?i:0}(u);this.target=s,this.type=u,this.usage=l,this.glBuffer=this.createGLBuffer(i),this.bytesPerElement=c,r?this.bufferData(r):n&&this.bufferData(c*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return sd(e,t),e},e.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var i=this.pipelineContext.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var i=this.pipelineContext.gl,r=this.target,n=t*this.bytesPerElement,a=n+e.byteLength;i.bindBuffer(r,this.glBuffer),a>this.byteLength&&(this.byteLength=a,i.bufferData(r,a,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!Fr(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},dr(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),ld=((od={})[Mr.INT]=Int32Array,od[Mr.FLOAT]=Float32Array,od[Mr.SHORT]=Int16Array,od[Mr.BYTE]=Int8Array,od[Mr.UNSIGNED_BYTE]=Uint8Array,od[Mr.UNSIGNED_INT]=Uint32Array,od[Mr.UNSIGNED_SHORT]=Uint16Array,od);var cd=((ud={})[Uint8Array.BYTES_PER_ELEMENT]=Mr.UNSIGNED_BYTE,ud[Uint16Array.BYTES_PER_ELEMENT]=Mr.UNSIGNED_SHORT,ud[Uint32Array.BYTES_PER_ELEMENT]=Mr.UNSIGNED_INT,ud),fd=1,dd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}$t(e,t);var i=e.prototype;return i.getOptions=function(){return ri({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;ut(e),e.addGeometry(this);var i=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new hd(i,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(i,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,a=i.target;this.bufferProps[r]={data:e,usage:n,target:a,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&null!=r.data){var n=e,a=e+i.length;if(r.data.length<a){var s=new i.constructor(a);s.set(r.data),r.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var o=this.dirtyFlags[t];void 0!==o.start&&(o.start=Math.min(o.start,n)),void 0!==o.end&&(o.end=Math.max(o.end,a-1))}r.data.set(i,n),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(C(t,Uint8Array)||C(t,Uint16Array)||C(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t,n=t+e.length;if(this.indices.length<n){var a=new e.constructor(n);a.set(this.indices),this.indices=a,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var s=this.dirtyFlags.index;void 0!==s.start&&(s.start=Math.min(s.start,r)),void 0!==s.end&&(s.end=Math.max(s.end,n-1))}null==(i=this.indices)||i.set(e,r),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*Hn[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t,e){var i=cd[e.BYTES_PER_ELEMENT],r={data:e,target:Mr.ELEMENT_ARRAY_BUFFER,type:i,name:this.name+"##index"};return new hd(t,r)},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var a,s,o=t.dirtyFlags[n];if("index"==n)a=t.indicesBuffer,s=r;else{var u=e[n].dataSource;a=t.buffers[u],s=i[u].data}if((o.dirty||o.discard)&&a&&s){if(o.discard)a.bufferData(s);else if(void 0!==o.start&&void 0!==o.end){var h=o.start*s.BYTES_PER_ELEMENT+s.byteOffset,l=o.end-o.start+1,c=new s.constructor(s.buffer,h,l);a.bufferSubData(o.start,c)}o.start=Number.POSITIVE_INFINITY,o.end=0,o.dirty=o.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(r){var n=t.attributesReleasable[r],a=e[r].dataSource;i[a]&&n&&(i[a].data=void 0)})),this.indicesReleasable}},i.processProps=function(t){var e=t,i=e.drawStart,r=void 0===i?0:i,n=e.drawCount,a=e.mode,s=e.indices,o=e.name,u=void 0===o?"effectsGeometry:"+fd++:o,h=e.bufferUsage,l=void 0===h?Mr.STATIC_DRAW:h;this.name=u;var c={},f=[],d={},p={},m={},v=l;this.drawStart=r,void 0!==n&&(this.drawCount=n),this.mode=isNaN(a)?Mr.TRIANGLES:a,Object.keys(e.attributes).forEach((function(t){var i=e.attributes[t],r=i.size,n=i.stride,a=i.offset,s=i.normalize,o=i.type,u=void 0===o?Mr.FLOAT:o,h=i.releasable,l=i.data;if(!u||"dataSource"in i||l||(l=Yn(u)),l){var y=C(l,Float32Array)?Mr.FLOAT:Mr.INT;c[t]={data:l,usage:v,target:Mr.ARRAY_BUFFER,name:t},d[t]={size:r,stride:n,offset:a,type:null!=u?u:y,normalize:!!s,dataSource:t},m[t]=null!=h&&h,p[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var g=i.dataSource;g&&(d[t]={size:r,stride:n,offset:a,type:u,dataSource:g,normalize:!!s})}f.push(t)})),p.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==s?void 0:s.data,this.indicesReleasable=!0===(null==s?void 0:s.releasable),this.bufferProps=c,this.attributes=d,this.attributesName=f,this.attributesReleasable=m,this.dirtyFlags=p,this.options=e,this.initialized=!1},i.fromData=function(e){var i,r=this;if(t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes,e.buffer?i=new Uint8Array(function(t){for(var e=a(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);var n=i.buffer;return n}(e.buffer)):e.binaryData&&(i=e.binaryData),i){var n=e.vertexData.vertexCount;if(this.hasSemantic(e)){var s={mode:Mr.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach((function(t){var e,a=null!=(e=pd[t.semantic])?e:t.semantic,o=r.createVertexTypedArray(t,i,n);s.attributes[a]={type:Vr(t.format),size:t.dimension,data:o,normalize:t.normalize}})),e.indexFormat!==Re.None){var o=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset);s.indices={data:o},s.drawCount=o.length}else s.drawCount=n;this.processProps(s)}else{var u=e.vertexData.channels[0],h=e.vertexData.channels[1],l=e.vertexData.channels[2],c=this.createVertexTypedArray(u,i,n),f=this.createVertexTypedArray(h,i,n),d=this.createVertexTypedArray(l,i,n),p=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset),m={mode:Mr.TRIANGLES,attributes:{aPos:{type:Vr(u.format),size:3,data:c,normalize:u.normalize},aUV:{type:Vr(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:Vr(l.format),size:3,data:d,normalize:l.normalize}}};m.indices={data:p},m.drawCount=p.length,this.processProps(m)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},i.dispose=function(){var t,e=this;(this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized)&&(Object.keys(this.buffers).forEach((function(t){e.buffers[t].dispose()})),this.buffers={},null==(t=this.indicesBuffer)||t.dispose(),Object.keys(this.vaos).forEach((function(t){var i;null==(i=e.vaos[t])||i.dispose(),e.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0));this.destroyed=!0},i.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case Ie.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case Ie.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case Ie.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case Ie.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case Ie.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},i.createIndexTypedArray=function(t,e,i){var r=e.buffer;switch(t){case Re.UInt16:return new Uint16Array(r,e.byteOffset+i);case Re.UInt32:return new Uint32Array(r,e.byteOffset+i);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,e.byteOffset+i)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},dr(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(Wn),pd={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"};var md,vd,yd=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendColor[0]===e&&this.blendColor[1]===i&&this.blendColor[2]===r&&this.blendColor[3]===n||(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===r&&this.blendFunctionParameters[3]===n||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA,Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[Mr.FUNC_ADD,Mr.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=Mr.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=[Mr.ALWAYS,Mr.ALWAYS],this.stencilOpFail=[Mr.KEEP,Mr.KEEP],this.stencilOpZFail=[Mr.KEEP,Mr.KEEP],this.stencilOpZPass=[Mr.KEEP,Mr.KEEP],this.culling=!1,this.frontFace=Mr.CCW,this.cullFace=Mr.FRONT},e.apply=function(t){if(t.toggle(Mr.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(Mr.BLEND,this.blending),t.toggle(Mr.DEPTH_TEST,this.depthTest),t.toggle(Mr.STENCIL_TEST,this.stencilTest),t.toggle(Mr.CULL_FACE,this.culling),t.toggle(Mr.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(Mr.BACK,this.stencilMask[1]),t.stencilMaskSeparate(Mr.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(Mr.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(Mr.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(Mr.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(Mr.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,i=e.blendColor,r=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(i[0],i[1],i[2],i[3]),t.blendEquationSeparate(r[0],r[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),gd=gr,xd=_r,bd=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).floats={},r.ints={},r.vector2s={},r.vector3s={},r.vector4s={},r.colors={},r.quaternions={},r.matrices={},r.matrice3s={},r.textures={},r.floatArrays={},r.vector4Arrays={},r.matrixArrays={},r.samplers=[],r.uniforms=[],r.uniformDirty=!0,r.macrosDirty=!0,r.glMaterialState=new yd,i&&(r.shader=new Pn(e),r.shader.shaderData=ri({},i.shader,{id:At(),dataType:Ae.Shader})),r}$t(e,t);var i=e.prototype;return i.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},i.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},i.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},i.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach((function(e){var i=t.textures[e];bt(i.initialize)?i.initialize():vt.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},i.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},i.setupStates=function(t){this.glMaterialState.apply(t)},i.use=function(t,e){var i=t.engine.getGLPipelineContext(),r=this.shaderVariant;if(r.program){var n;if(r.program.bind(),this.setupStates(i),e){for(var a,s=w(e.uniforms);!(a=s()).done;)n=a.value,this.checkUniform(n);for(var o,u=w(e.samplers);!(o=u()).done;)n=o.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)r.setFloat(n,e.floats[n]);for(n in e.ints)r.setInt(n,e.ints[n]);for(n in e.vector4s)r.setVector4(n,e.vector4s[n]);for(n in e.vector3s)r.setVector3(n,e.vector3s[n]);for(n in e.matrices)r.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)r.setFloat(n,this.floats[n]);for(n in this.ints)r.setInt(n,this.ints[n]);for(n in this.floatArrays)r.setFloats(n,this.floatArrays[n]);for(n in this.textures)r.setTexture(n,this.textures[n]);for(n in this.vector2s)r.setVector2(n,this.vector2s[n]);for(n in this.vector3s)r.setVector3(n,this.vector3s[n]);for(n in this.vector4s)r.setVector4(n,this.vector4s[n]);for(n in this.colors)r.setColor(n,this.colors[n]);for(n in this.quaternions)r.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)r.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)r.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)r.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)r.setMatrixArray(n,this.matrixArrays[n])}else{var h;null==(h=this.engine)||h.renderErrors.add(new Error("Shader program is not initialized."))}},i.getFloat=function(t){return this.floats[t]},i.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},i.getInt=function(t){return this.ints[t]},i.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},i.getFloats=function(t){return this.floatArrays[t]},i.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},i.getVector2=function(t){return this.vector2s[t]},i.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},i.getVector3=function(t){return this.vector3s[t]},i.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},i.getVector4=function(t){return this.vector4s[t]},i.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},i.getColor=function(t){return this.colors[t]},i.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},i.getQuaternion=function(t){return this.quaternions[t]},i.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},i.getMatrix=function(t){return this.matrices[t]},i.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},i.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},i.getVector4Array=function(t){return this.vector4Arrays[t]},i.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=w(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},i.getMatrixArray=function(t){return this.matrixArrays[t]},i.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=w(e);!(i=r()).done;)for(var n=i.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},i.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},i.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},i.clone=function(t){var i=t||this.props,r=this.engine;ut(r);var n=new e(r,i);return n.glMaterialState=Object.assign(new yd,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},i.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i=ri({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===qt.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var r,n,a=e.stringTags.RenderFace;for(r in a===Kt.Front?(this.culling=!0,this.cullFace=Mr.BACK):a===Kt.Back?(this.culling=!0,this.cullFace=Mr.FRONT):this.culling=!1,i.floats)this.setFloat(r,i.floats[r]);for(r in i.ints)this.setInt(r,i.ints[r]);for(r in i.vector4s){var s=i.vector4s[r];this.setVector4(r,new gr(s.x,s.y,s.z,s.w))}for(r in i.colors){var o=i.colors[r];this.setColor(r,new Er(o.r,o.g,o.b,o.a))}for(r in i.textures){var u=i.textures[r],h=this.engine.findObject(u.texture);this.setTexture(r,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(r+"_ST",new gd(c.x,c.y,l.x,l.y))}if(e.shader){var f=this.engine.findObject(e.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(n=e.stringTags)?n:{},this.initialized=!1},i.toData=function(){var t=this.defination;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=Ae.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var a in this.textures){t.textures[a]||(t.textures[a]={texture:this.textures[a]});var s=t.textures[a],o=this.getVector4(a+"_ST");o&&(s.scale={x:o.x,y:o.y},s.offset={x:o.z,y:o.w},delete t.vector4s[a+"_ST"])}return t},i.cloneUniforms=function(t){var e,i=t;for(e in i.floats)this.setFloat(e,i.floats[e]);for(e in i.ints)this.setInt(e,i.ints[e]);for(e in i.floatArrays)this.setFloats(e,i.floatArrays[e]);for(e in i.textures)this.setTexture(e,i.textures[e]);for(e in i.vector2s)this.setVector2(e,i.vector2s[e]);for(e in i.vector3s)this.setVector3(e,i.vector3s[e]);for(e in i.vector4s)this.setVector4(e,i.vector4s[e]);for(e in i.colors)this.setColor(e,i.colors[e]);for(e in i.quaternions)this.setQuaternion(e,i.quaternions[e]);for(e in i.matrices)this.setMatrix(e,i.matrices[e]);for(e in i.vector4Arrays){for(var r=[],n=0;n<i.vector4Arrays[e].length;n+=4)r.push(new gd(i.vector4Arrays[e][n],i.vector4Arrays[e][n+1],i.vector4Arrays[e][n+2],i.vector4Arrays[e][n+3]));this.setVector4Array(e,r)}for(e in i.matrixArrays){for(var a=[],s=0;s<i.matrixArrays[e].length;s+=16){for(var o=xd.fromIdentity(),u=0;u<16;u++)o.elements[u]=i.matrixArrays[e][s+u];a.push(o)}this.setMatrixArray(e,a)}},i.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},i.dispose=function(t){var e,i=this;this.destroyed||(null==(e=this.shaderVariant)||e.dispose(),(null==t?void 0:t.textures)!==mt.keep&&Object.keys(this.textures).forEach((function(t){var e=i.textures[t];e!==i.engine.emptyTexture&&e.dispose()})),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=Ct,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},dr(e,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask[0]},set:function(t){this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(On),Td=function(){function t(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}var e=t.prototype;return e.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},e.copyTexture=function(t,e){this.renderer&&(t.initialize(),e.initialize(),e.updateSource({sourceType:Rr.framebuffer,data:{width:e.getWidth()||t.getWidth(),height:e.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,e):this.copy1(t,e))},e.copy2=function(t,e){var i=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(i)},e.copy1=function(t,e){var i=this.copyRenderPass;if(i){var r=this.renderer;if(r){var n=i.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),r.glRenderer.resetColorAttachments(n,[e]),i.meshes[0].material.setTexture("uTex",t),r.renderRenderPass(i)}}},e.createCopyRenderPass=function(){var t="mri-copy-mesh",e={texture:{format:Mr.RGBA}},i=this.renderer.engine,r=new dd(i,{name:t,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=i.gpuCapability.level,a=new bd(i,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===n?In.GLSL3:In.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var s=new ra(i,{name:t,geometry:r,material:a,priority:0});return new Ed(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:Ir.whatever},attachments:[e],meshes:[s]})},e.dispose=function(){var t;this.renderer&&(null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0)},t}(),Ed=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},i.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(la),_d=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],ut(t),this.gl=wr(t,e,i),this.contextLostListener=function(t){for(var e,i,n=w(r.lostHandlers);!(i=n()).done;){i.value.lost(t)}null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,n=w(r.restoreHandlers);!(i=n()).done;){i.value.restore()}null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),wd=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new Wa(e),i}$t(e,t);var i=e.prototype;return i.dispose=function(){this.destroyed||t.prototype.dispose.call(this)},i.getGLRenderer=function(){return this.renderer},i.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},i.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(Zf),Cd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}$t(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},i.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer,r=i.gl;i.pipelineContext.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):vt.error("Invalid render buffer size: "+t+"x"+e+".")}}else vt.error("Can't set size for uninitialized render buffer.")},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Ct},e}(Xa),Ad=1,Sd=function(t){function e(e,i){var r;(r=t.call(this)||this).attachmentTextures=[];var n,a=e.depthStencilAttachment,s=e.viewport,o=e.isCustomViewport,u=e.storeAction,h=e.viewportScale,l=void 0===h?1:h,c=e.name,f=void 0===c?"GLFramebuffer"+Ad++:c;return r.renderer=i,r.engine=i.engine,r.depthStencilStorageType=null!=(n=null==a?void 0:a.storageType)?n:Qn.none,r.viewport=s,r.isCustomViewport=!!o,r.viewportScale=l,r.name=f,r.storeAction=u,r.updateProps(e),r}$t(e,t);var i=e.prototype;return i.getDepthTexture=function(){return this.depthTexture},i.getStencilTexture=function(){return this.stencilTexture},i.getColorTextures=function(){return this.colorTextures},i.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(e){e.initialize(),V(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&V(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&V(this.attachmentTextures,this.depthTexture.textureBuffer)},i.updateProps=function(t){var e,i,r=this.renderer,n=this.engine.gpuCapability,a=null!=(i=t.depthStencilAttachment)?i:{storageType:Qn.none},s=t.attachments.length>0,o=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var u=null==(e=t.depthStencilAttachment)?void 0:e.texture,h=n.detail.readableDepthStencilTextures,l=a.storageType,c=a.storage;if(this.colorTextures=t.attachments.slice(),!s&&l!==Qn.none)throw new Error("Use depth stencil attachment without color attachments.");switch(s&&(this.fbo=r.glRenderer.createGLFramebuffer(this,this.name)),l){case Qn.depth_stencil_opaque:if(c){if(!C(c,Cd))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Cd({format:Mr.DEPTH_STENCIL,attachment:Mr.DEPTH_STENCIL_ATTACHMENT,storageType:l},r.glRenderer);o=!1;break;case Qn.depth_16_opaque:if(c){if(!C(c,Cd))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Cd({attachment:Mr.DEPTH_ATTACHMENT,format:Mr.DEPTH_COMPONENT16,storageType:l},r.glRenderer);break;case Qn.stencil_8_opaque:if(c){if(!C(c,Cd))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Cd({attachment:Mr.STENCIL_ATTACHMENT,format:Mr.STENCIL_INDEX8,storageType:l},r.glRenderer);break;case Qn.depth_16_texture:if(!h)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=u?u:new ed(this.engine,{sourceType:Rr.framebuffer,format:Mr.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:Mr.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case Qn.depth_24_stencil_8_texture:if(!h)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=u?u:new ed(this.engine,{sourceType:Rr.framebuffer,format:Mr.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),o=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,o),this.updateAttachmentTextures()},i.getStoreAttachments=function(t,e){var i=this.renderer.glRenderer.gl,r=this.colorTextures.length;if(t&&Fr(i)&&r>0){var n=[];if(t.depthAction===Jn.clear&&this.depthStorage&&V(n,e?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===Jn.clear&&this.stencilStorage&&V(n,e?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===Jn.clear)for(var a=0;a<r;a++)V(n,i["COLOR_ATTACHMENT"+a]);return n}},i.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;Fr(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},i.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,i=this.renderer.pipelineContext,r=this.viewport,n=r[0],a=r[1],s=r[2],o=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,a,s,o);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(i.textureUnitDict).forEach((function(e){var r=i.textureUnitDict[e];r&&r!==u&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)i.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var l=this,c=l.depthStencilRenderbuffer,f=l.depthTexture,d=l.stencilTexture;if(i.activeTexture(e.TEXTURE0),c)c.setSize(s,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,c.attachment,e.RENDERBUFFER,c.buffer);else if(f){f.source.data={width:s,height:o},f.update({data:{width:s,height:o,data:new Uint16Array(0)}});var p=f&&d?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,p,e.TEXTURE_2D,f.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var m=e.checkFramebufferStatus(e.FRAMEBUFFER);if(m!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+m+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+".");this.ready=!0}}},i.resetColorTextures=function(t){var e=t,i=this.renderer.glRenderer.gl,r=this.engine.gpuCapability,n=this.viewport,a=[];if(e){for(var s,o=w(e);!(s=o()).done;){s.value.initialize()}this.colorTextures=e.slice()}this.renderer.pipelineContext.activeTexture(i.TEXTURE0),this.colorTextures.forEach((function(t,e){var s={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:s}),r.framebufferTexture2D(i,i.FRAMEBUFFER,e,i.TEXTURE_2D,t.textureBuffer),a.push(!0)})),r.drawBuffers(i,a),this.updateAttachmentTextures()},i.resize=function(t,e,i,r){var n=this.viewport,a=n[0],s=n[1],o=n[2],u=n[3];a===t&&s===e&&o===i&&u===r||(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},i.dispose=function(t){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var e,i,r=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:oa.force;if(r===oa.force||r===oa.keepExternal&&!this.externalStorage)null==(e=this.depthStencilRenderbuffer)||e.dispose(),null==(i=this.depthTexture)||i.dispose();this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},dr(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==Qn.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==Qn.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(qa),Id=((md={})[Mr.FLOAT]=1,md[Mr.INT]=1,md[Mr.UNSIGNED_INT]=1,md[Mr.SHORT]=1,md[Mr.BOOL]=1,md[Mr.UNSIGNED_SHORT]=1,md[Mr.FLOAT_VEC2]=2,md[Mr.FLOAT_VEC3]=3,md[Mr.FLOAT_VEC4]=4,md[Mr.FLOAT_MAT2]=4,md[Mr.FLOAT_MAT3]=9,md[Mr.FLOAT_MAT4]=16,md[Mr.FLOAT_MAT2x3]=6,md[Mr.FLOAT_MAT2x4]=8,md[Mr.FLOAT_MAT4x3]=12,md[Mr.FLOAT_MAT4x2]=8,md[Mr.FLOAT_MAT3x4]=12,md[Mr.FLOAT_MAT3x2]=6,md[Mr.INT_VEC2]=2,md[Mr.INT_VEC3]=3,md[Mr.INT_VEC4]=4,md[Mr.UNSIGNED_INT_VEC2]=2,md[Mr.UNSIGNED_INT_VEC3]=3,md[Mr.UNSIGNED_INT_VEC4]=4,md[Mr.BOOL_VEC2]=2,md[Mr.BOOL_VEC3]=3,md[Mr.BOOL_VEC4]=4,md),Rd=Pd(Float32Array),Od=Pd(Int32Array),Md=Pd(Uint8Array);function Nd(t){return function(e,i,r,n){var a={start:i[1],dirty:!0};if(i[2]>1){var s=e;if(s.length){for(var o=n[1]||s.length,u=i[4]/t.BYTES_PER_ELEMENT,h=a.buffer=new t(o*u),l=n[0]||0,c=0;c<o;c++)h[c*u]=s[c+l];a.start+=l*u}}else a.buffer=new t([e]);return a}}function Pd(t){return function(e,i,r,n){for(var a=i[8],s=i[2],o=i[5],u=1===s?a:i[4],h=o?u/o:1,l=u/t.BYTES_PER_ELEMENT/h,c=a/t.BYTES_PER_ELEMENT/l,f=Id[i[0]],d=f/h,p=(n[0]||0)*f,m=n[1]?h*n[1]:c,v=new t(l*m),y={start:i[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=p;g<m;g++){for(var T=0;T<d;T++)v[x+T]=e[b+T];x+=l,b+=d}return y}}function Fd(t,e){for(var i=function(i){var a=t.getActiveUniformBlockName(e,i);ut(a);var s={index:t.getUniformBlockIndex(e,a),usedByVertexShader:t.getActiveUniformBlockParameter(e,i,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,i,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,i,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,i,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:a,id:""};s.used=s.usedByVertexShader||s.usedByFragmentShader,r[i]=s;for(var o=s.uniformIndices,u=[],h=0;h<o.length;h++){var l=t.getActiveUniform(e,o[h]).name.replace("[0]","");s.uniforms[l]=[0,0,0,0,0,0,0,h,0],u[h]=l,n.push(l)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach((function(i,r){t.getActiveUniforms(e,o,i).forEach((function(t,e){var i=u[e];s.uniforms[i][r]=+t}))}));for(var c=0;c<u.length;c++){var f=s.uniforms[u[c]],d=s.uniforms[u[c+1]],p=d?d[1]:s.size;f[8]=p-f[1]}s.id=function(t){var e=t.name,i=t.size,r=t.uniforms,n=t.uniformIndices,a=Object.keys(r).map((function(t){return t+"["+r[t].join(":")+"]"})).join("+");return Ld(e+"+",i+"+",n.length+"+",a)}(s)+""},r=[],n=[],a=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),s=0;s<a;++s)i(s);return{blockSpecs:r,blockUniformNames:n}}function Ld(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var a=e[n],s=0;s<a.length;s++)r=Math.imul(31,r)+a.charCodeAt(s)|0;return r}(vd={})[Mr.FLOAT]=Nd(Float32Array),vd[Mr.INT]=Nd(Int32Array),vd[Mr.UNSIGNED_INT]=Nd(Uint32Array),vd[Mr.SHORT]=Nd(Int16Array),vd[Mr.BOOL]=Nd(Uint8Array),vd[Mr.UNSIGNED_SHORT]=Nd(Uint16Array),vd[Mr.FLOAT_VEC2]=Rd,vd[Mr.FLOAT_VEC3]=Rd,vd[Mr.FLOAT_VEC4]=Rd,vd[Mr.FLOAT_MAT2]=Rd,vd[Mr.FLOAT_MAT3]=Rd,vd[Mr.FLOAT_MAT4]=Rd,vd[Mr.FLOAT_MAT2x3]=Rd,vd[Mr.FLOAT_MAT2x4]=Rd,vd[Mr.FLOAT_MAT4x3]=Rd,vd[Mr.FLOAT_MAT4x2]=Rd,vd[Mr.FLOAT_MAT3x4]=Rd,vd[Mr.FLOAT_MAT3x2]=Rd,vd[Mr.INT_VEC2]=Od,vd[Mr.INT_VEC3]=Od,vd[Mr.INT_VEC4]=Od,vd[Mr.UNSIGNED_INT_VEC2]=Od,vd[Mr.UNSIGNED_INT_VEC3]=Od,vd[Mr.UNSIGNED_INT_VEC4]=Od,vd[Mr.BOOL_VEC2]=Md,vd[Mr.BOOL_VEC3]=Md,vd[Mr.BOOL_VEC4]=Md;var Vd=function(){function t(t,e,i){var r=this;this.engine=t,this.program=e,this.id=i,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;(this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),Fr(n))&&Fd(n,e).blockSpecs.forEach((function(t){return r.uniformBlockMap[t.name]=t}));this.pipelineContext.useProgram(null)}var e=t.prototype;return e.bind=function(){this.pipelineContext.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,a=this.pipelineContext.gl;return t.vaos[n]?i=t.vaos[n]:((i=new rd(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var s=t.buffers[n.dataSource];if(!s)throw new Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");s.bind(),a.enableVertexAttribArray(i.loc),a.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var a=t.getActiveAttrib(e,n);if(a){var s=a.name,o=a.type,u=a.size,h=t.getAttribLocation(e,s);i[s]={type:o,name:s,size:u,loc:h}}}return i},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),Dd=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}$t(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i=e.slice();t=t.concat(i);for(var r,n=this.pipelineContext.getUniforms(this.program.program,t),a=0;a<t.length;a++)this.uniformLocations[t[a]]=n[a];for(r=0;r<i.length;r++){null==this.uniformLocations[i[r]]&&(i.splice(r,1),r--)}for(r=0;r<i.length;r++){var s=i[r];this.samplerChannels[s]=r}},i.toData=function(){var t=this.defination;t.dataType=Ae.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(Nn),kd=0,zd=function(){function t(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var e=t.prototype;return e.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=w(Object.keys(this.cachedShaders));!(i=n()).done;){var a=i.value;this.cachedShaders[a].initialized||r.push(a)}t?r.length?Promise.all(r.map((function(t){return new Promise((function(i){return e.compileShader(e.cachedShaders[t],i)}))}))).then(t).catch((function(){return 0})):t([]):r.map((function(t){return e.compileShader(e.cachedShaders[t])})),this.shaderAllDone=!0}},e.addShader=function(t,e){var i,r,n=[];t.macros&&(i=n).push.apply(i,[].concat(t.macros));e&&(r=n).push.apply(r,[].concat(e));var a=ri({},t,{vertex:Ra.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Ar.vertex,shader:t.vertex,macros:n}),fragment:Ra.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Ar.fragment,shader:t.fragment,macros:n})}),s=this.computeShaderCacheId(a);if(this.cachedShaders[s])return s;this.shaderAllDone=!1;var o=!1;return(a.shared||a.cacheId)&&(o=!0),this.cachedShaders[s]=new Dd(this.engine,ri({},a,{vertex:a.vertex,fragment:a.fragment,name:a.name||s,shared:o})),this.cachedShaders[s].id=s,s},e.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},e.compileShader=function(t,e){var i=this,r=t.source,n=r.shared,a=r.vertex,s=r.fragment,o=r.name,u=t.source.cacheId,h=!1;(n||u)&&(h=!0);var l=this.pipelineContext.gl,c={shared:h,status:Sn.compiling},f=this.createProgram(l,a,s,c),p=this.glAsyncCompileExt,m=d.now(),v=function(e){c.status=Sn.success,c.compileTime=d.now()-m,t.program=e,t.initialized=!0,t.pipelineContext=i.pipelineContext,void 0!==i.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),i.programMap[t.id]=e},y=function(){if(i.engine.isDestroyed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==e?void 0:e(c);if(t.initialized)return null==e?void 0:e(c);var r=(!e||!p||p&&1==l.getProgramParameter(c.program,p.COMPLETION_STATUS_KHR))&&f();if(r){if(c.status!==Sn.fail){sd(r,o);var n=new Vd(i.engine,r,t.id);if(l.validateProgram(r),l.getProgramParameter(r,l.VALIDATE_STATUS))v(n);else{var u=l.getProgramInfoLog(r);(null==u?void 0:u.includes("the same texture"))||(null==u?void 0:u.includes("Two textures of different types use the same sampler"))?v(n):(c.status=Sn.fail,c.error=u,console.error("compileProgramError: "+u,"\nvertex:\n",a,"\nfragment:\n",s),l.deleteProgram(r))}}null==e||e(c)}else e&&x(y)};t.compileResult=c,y()},e.computeShaderCacheId=function(t){var e=t.vertex,i=void 0===e?"":e,r=t.fragment,n=void 0===r?"":r,a=t.shared,s=t.cacheId;return a||s?s||"shared_"+Ld(i,n):"instanced_"+kd++},e.createProgram=function(t,e,i,r){var n=t.createProgram(),a=this.createGLShader(t,t.VERTEX_SHADER,e),s=this.createGLShader(t,t.FRAGMENT_SHADER,i);return n&&a&&s?(t.attachShader(n,a),t.attachShader(n,s),t.linkProgram(n),r.program=n,r.status=Sn.compiling,function(){if(r.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var o=t.getProgramInfoLog(n);console.error("Failed to link program: "+o+".");var u=Ud(t,a,"vertex",e),h=Ud(t,s,"fragment",i);return r.status=Sn.fail,u&&(r.error=u.error,r.status=u.status),h&&(r.error=h.error,r.status=h.status),n}return n}):(r.status=Sn.fail,function(){return null})},e.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Ld(null!=i?i:""),a=r.get(n);if(a)return a;var s=t.createShader(e);return s&&(t.shaderSource(s,i),t.compileShader(s),r.set(n,s)),s},e.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},e.restore=function(){},e.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach((function(e){t.programMap[e].dispose()})),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},t}();function Ud(t,e,i,r){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+i+" error: "+n,(null!=r?r:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:Sn.fail}}}var Bd=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new zd(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}var e=t.prototype;return e.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=Mr.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},e.toggle=function(t,e){e?this.enable(t):this.disable(t)},e.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},e.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},e.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},e.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},e.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.useProgram=function(t){this.set1("useProgram",t)},e.clear=function(t){this.gl.clear(t)},e.clearDepth=function(t){this.set1("clearDepth",t)},e.depthFunc=function(t){this.set1("depthFunc",t)},e.depthMask=function(t){this.set1("depthMask",t)},e.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},e.depthRange=function(t,e){this.set2("depthRange",t,e)},e.clearStencil=function(t){this.set1("clearStencil",t)},e.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},e.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},e.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},e.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},e.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},e.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},e.blendEquation=function(t){this.set1("blendEquation",t)},e.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},e.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},e.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},e.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},e.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},e.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},e.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),r.x===e&&r.y===i||this.gl[t](r.x=e,r.y=i)},e.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===i&&n.z===r||this.gl[t](n.x=e,n.y=i,n.z=r)},e.set4=function(t,e,i,r,n){var a=this.glCapabilityCache[t];a||(a=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),a.x===e&&a.y===i&&a.z===r&&a.w===n||this.gl[t](a.x=e,a.y=i,a.z=r,a.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},e.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},e.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},e.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},t}(),Gd=function(t){function e(e,i,r){var n;(n=t.call(this)||this).canvas=e,n.temporaryRTs={};var a=ri({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},r);n.context=new _d(e,i,a);var s=n.context.gl;return ut(s),n.engine=new wd(s),n.engine.renderer=Lu(n),n.pipelineContext=new Bd(n.engine,s),n.glRenderer=new ad(n.engine),n.extension=new Td(Lu(n)),n.renderingData={currentFrame:{}},n.framebuffer=new Sd({storeAction:{},viewport:[0,0,n.width,n.height],attachments:[new ed(n.engine,{sourceType:Rr.framebuffer,data:{width:n.width,height:n.height}})],depthStencilAttachment:{storageType:Qn.none}},Lu(n)),n}$t(e,t);var i=e.prototype;return i.renderRenderFrame=function(t){var e,i=t;i.resource&&i.resource.color_b.initialize(),i.emptyTexture.initialize(),i.transparentTexture.initialize();var r=i._renderPasses;if(this.isDestroyed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=i.renderer.getShaderLibrary())||e.compileAllShaders(),this.setFramebuffer(null),this.clear(i.clearAction);var n=i.camera;this.renderingData.currentFrame=i,this.renderingData.currentCamera=n,this.setGlobalMatrix("effects_MatrixInvV",n.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",n.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",n.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",n.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",n.position),nt(r);for(var a,s=w(r);!(a=s()).done;){var o=a.value,u=o.delegate;null==u.willBeginRenderPass||u.willBeginRenderPass.call(u,o,this.renderingData),this.renderRenderPass(o),null==u.didEndRenderPass||u.didEndRenderPass.call(u,o,this.renderingData)}for(var h,l=w(r);!(h=l()).done;){h.value.frameCleanup(this)}}},i.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},i.renderMeshes=function(t){for(var e,i=this.renderingData.currentPass.delegate,r=w(t);!(e=r()).done;){var n=e.value;null==i.willRenderMesh||i.willRenderMesh.call(i,n,this.renderingData),n.render(this),null==i.didRenderMesh||i.didRenderMesh.call(i,n,this.renderingData)}},i.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},i.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},i.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},i.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},i.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},i.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},i.drawGeometry=function(t,e,i){if(void 0===i&&(i=0),t&&e){e.initialize(),t.initialize(),t.flush();var r=this.renderingData;r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,e,i)}},i.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},i.getFramebuffer=function(){return this.framebuffer},i.getTemporaryRT=function(t,e,i,r,n,a){if(this.temporaryRTs[t])return this.temporaryRTs[t];var s,o,u=Qn.none;n===Ua.Linear?s=Mr.LINEAR:n===Ua.Nearest&&(s=Mr.NEAREST),a===Ba.RGBA32?o=Mr.UNSIGNED_BYTE:a===Ba.RGBAHalf&&(o=Mr.HALF_FLOAT),0===r?u=Qn.none:16===r?u=Qn.depth_16_opaque:24===r&&(u=Qn.depth_24_stencil_8_texture);var h=new ed(this.engine,{sourceType:Rr.framebuffer,minFilter:s,magFilter:s,internalFormat:Mr.RGBA,format:Mr.RGBA,type:o}),l=new Sd({name:t,storeAction:{},viewport:[0,0,e,i],viewportScale:1,isCustomViewport:!0,attachments:[h],depthStencilAttachment:{storageType:u}},this);return this.temporaryRTs[t]=l,l},i.setViewport=function(t,e,i,r){this.pipelineContext.viewport(t,e,i,r)},i.clear=function(t){var e=this.pipelineContext,i=0;if(t.colorAction===Ir.clear){var r=t.clearColor;r&&e.clearColor(r[0],r[1],r[2],r[3]),e.colorMask(!0,!0,!0,!0),i=Mr.COLOR_BUFFER_BIT}if(t.stencilAction===Ir.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),i|=Mr.STENCIL_BUFFER_BIT),t.depthAction===Ir.clear){var n=t.clearDepth;e.depthMask(!0),e.clearDepth(Number.isFinite(n)?n:1),i|=Mr.DEPTH_BUFFER_BIT}i&&e.clear(i)},i.addLostHandler=function(t){this.context.addLostHandler(t)},i.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},i.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},i.getWidth=function(){return this.width},i.getHeight=function(){return this.height},i.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},i.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},i.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context.");this.engine.gpuCapability=new Wa(t),this.engine.renderer=this,this.pipelineContext=new Bd(this.engine,t),this.glRenderer=new ad(this.engine),this.extension=new Td(this)},i.resize=function(t,e){var i=this.glRenderer;i&&(this.width===t&&this.height===e||i.resize(t,e))},i.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},dr(e,[{key:"isDestroyed",get:function(){var t=this.glRenderer;return!t||t.isDestroyed}},{key:"height",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.height)?e:0}},{key:"width",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.width)?e:0}}]),e}(Ka),jd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY",Xd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT",Hd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW",Wd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Yd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Zd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",qd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var Kd=new Map;function Qd(t){return Kd.has(t)}function Jd(t){return Kd.get(t)}function $d(){return Array.from(Kd.values())}var tp=!1,ep=1,ip=function(t){function e(e){var a;(a=t.call(this)||this).compositions=[],a.displayScale=1,a.resumePending=!1,a.disposed=!1,a.assetManagers=[],a.speed=1,a.baseCompositionIndex=0,a.useExternalCanvas=!1,a.lost=function(t){var e;null==(e=a.ticker)||e.pause(),a.compositions.forEach((function(e){return e.lost(t)})),a.renderer.lost(t),a.handleEmitEvent("webglcontextlost",t),np(Lu(a),!1)};var s=Lu(a);a.restore=E((function(){var t;return I(this,(function(e){switch(e.label){case 0:return s.renderer.restore(),[4,Promise.all(s.compositions.map(E((function(t){var e,i,r,n,a,o,u,h,l,c,f,d;return I(this,(function(p){switch(p.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.keepResource,a=t.reusable,o=t.renderOrder,u=t.transform,h=t.videoState,[4,s.loadScene(i)];case 1:(l=p.sent()).speed=r,l.reusable=a,l.keepResource=n,l.renderOrder=o,l.transform.setPosition(u.position.x,u.position.y,u.position.z),l.transform.setRotation(u.rotation.x,u.rotation.y,u.rotation.z),l.transform.setScale(u.scale.x,u.scale.y,u.scale.z),c=0,p.label=2;case 2:return c<h.length?h[c]?((f=l.textures[c].source.video).currentTime=null!=(d=h[c])?d:0,[4,f.play()]):[3,4]:[3,5];case 3:p.sent(),p.label=4;case 4:return c++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return s.compositions=e.sent(),s.emit("webglcontextrestored"),null==(t=s.ticker)||t.resume(),Z()&&s.canvas&&(s.canvas.style.display="none",r.setTimeout((function(){s.canvas.style.display=""}),0)),[2]}}))})),a.handleClick=function(t){var e=t.x,i=t.y,r=[];a.compositions.forEach((function(t){for(var n,s=w(t.hitTest(e,i));!(n=s()).done;){var o=n.value;r.push(ri({},o,{player:Lu(a),composition:t}))}}));for(var n=0;n<r.length;n++){var s=r[n],o=s.behavior||Ht.NOTIFY;o===Ht.NOTIFY?(a.emit("click",ri({},s,{compositionId:s.composition.id,compositionName:s.composition.name})),s.composition.emit("click",ri({},s,{compositionId:s.composition.id,compositionName:s.composition.name}))):o===Ht.RESUME_PLAYER&&a.resume()}};var o=e.container,u=e.canvas,h=e.fps,l=e.name,c=e.pixelRatio,f=e.manualRender,d=e.reportGPUTime,p=e.renderFramework,m=e.notifyTouch,v=e.onError,y=e.interactive,g=void 0!==y&&y,x=e.renderOptions,b=void 0===x?{}:x,T=e.env,_=void 0===T?"":T,C=b.willCaptureImage,A=b.premultipliedAlpha;if(a.onError=v,tp||"debug-disable"===p)return cc(a);var S,R=(S=/iPhone OS (\d+)_(\d+)/.exec(n.userAgent))&&("13"===S[1]||"16"===S[1]&&"5"===S[2])?"webgl":"webgl2";p&&(R="webgl"===p?"webgl":"webgl2"),a.reportGPUTime=d,a.pixelRatio=Number.isFinite(c)?c:H(),a.offscreenMode=!0,a.env=_,a.name=l||""+ep++;try{if(Or.length)throw new Error("Errors before player create: "+Or.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?(a.canvas=u,a.useExternalCanvas=!0):(ap(o),a.canvas=i.createElement("canvas"),o.appendChild(a.canvas)),a.container=a.canvas.parentElement,a.renderer=Ka.create(a.canvas,R,{preserveDrawingBuffer:C,premultipliedAlpha:A}),a.renderer.env=_,a.renderer.addLostHandler({lost:a.lost}),a.renderer.addRestoreHandler({restore:a.restore}),a.gpuCapability=a.renderer.engine.gpuCapability,a.assetService=new If(a.renderer.engine),f||(a.ticker=new Kf(h),a.ticker.add(a.tick.bind(Lu(a)))),a.event=new ho(a.canvas,!!m),a.event.bindListeners(),a.event.addEventListener(ao,a.handleClick),a.interactive=g,a.resize(),Il(a.gpuCapability.detail)}catch(t){a.canvas&&!a.useExternalCanvas&&a.canvas.remove(),a.handleThrowError(t)}return Kd.forEach((function(t){t.gpuCapability.type!==a.gpuCapability.type&&vt.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+a.gpuCapability.type+".\nsee "+qd+".")})),Kd.set(a.canvas,Lu(a)),function(){for(var t,e=[],i=w(Kd.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&vt.error("Current running player count: "+e.length+", see "+Zd+".",e)}(),np(Lu(a),!0),a}$t(e,t);var a=e.prototype;return a.setSpeed=function(t){isNaN(t)||(this.speed=t)},a.getSpeed=function(){return this.speed},a.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},a.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},a.getAssetManager=function(){return this.assetManagers},a.loadScene=function(t,e){var i=this;return E((function(){var r,n,a,s,o,u,h,l,c,f,p,m,v,y,g,x,b,T,_,C;return I(this,(function(A){switch(A.label){case 0:return ut(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),s=d.now(),o=[],u=[],l=null==(h=null==e?void 0:e.autoplay)||h,c=null==(n=i.renderer.engine.gpuCapability)||null==(r=n.detail)?void 0:r.asyncShaderCompile,f=i.baseCompositionIndex,xt(t)?(p=o).push.apply(p,[].concat(t)):o.push(t),i.baseCompositionIndex+=o.length,l&&(i.autoPlaying=!0),m=[],[4,Promise.all(o.map(E((function(t,r){var n,a,s,o,h,c,d,p;return I(this,(function(v){switch(v.label){case 0:return n=i.assetService.assembleSceneLoadOptions(t,ri({autoplay:l},e)),a=n.source,s=n.options,h=null!=(o=null==s?void 0:s.autoplay)?o:l,c=new Af(s),i.assetManagers.push(c),[4,c.loadScene(a,i.renderer,{env:i.env})];case 1:return d=v.sent(),i.disposed?(u.length=0,[2]):(i.assetService.prepareAssets(d,d.assets),i.assetService.updateTextVariables(d,c.options.variables),i.assetService.initializeTexture(d),d.pluginSystem.precompile(d.jsonScene.compositions,i.renderer),(p=i.createComposition(d,s)).setIndex(f+r),u[r]=p,m[r]=h,[2])}}))}))))];case 1:return A.sent(),v=d.now(),[4,new Promise((function(t){var e;null==(e=i.renderer.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:for(A.sent(),y=d.now()-v,g=0;g<u.length;g++)m[g]?u[g].play():u[g].pause(),i.compositions.push(u[g]);for(null==(a=i.ticker)||a.start(),u.some((function(t){return!t.getPaused()}))&&i.emit("play",{time:0}),x=u.map((function(t){return t.name})),b=d.now()-s,T=w(u);!(_=T()).done;)(C=_.value).statistic.compileTime=y,C.statistic.firstFrameTime=b;return vt.info("First frame ["+x+"]: "+b.toFixed(4)+"ms."),vt.info("Shader "+(c?"async":"sync")+" compile ["+x+"]: "+y.toFixed(4)+"ms."),[2,xt(t)?u:u[0]]}}))}))()},a.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=this.renderer,n=new yl(ri({},e,{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,handleItemMessage:function(t){i.emit("message",t)}}),t);return this.ticker&&e.renderLevel===kt.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==Xs&&this.assetService.createShaderVariant(),n},a.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.play()})),null==(t=this.ticker)||t.start(),this.emit("play",{time:0})},a.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.gotoAndPlay(t)})),this.ticker?this.ticker.start():this.doTick(0,!0),this.emit("play",{time:t})},a.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(e){e.gotoAndStop(t)})),this.ticker&&!(null==(e=this.ticker)?void 0:e.getPaused())||this.doTick(0,!0),this.emit("pause")},a.playSequence=function(t){for(var e,i=function(e){t[e].on("end",(function(){t[e+1].play()}))},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},a.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},a.resume=function(){var t=this;return E((function(){var e;return I(this,(function(i){switch(i.label){case 0:return t.resumePending?[2]:t.paused?(t.resumePending=!0,[4,Promise.all(t.compositions.map((function(t){return t.reloadTexture()})))]):[3,2];case 1:i.sent(),t.resumePending=!1,t.emit("resume"),i.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}}))}))()},a.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},a.doTick=function(t,e){var i,r=this,n=this.renderer.engine.renderErrors;n.size>0&&(this.handleEmitEvent("rendererror",n.values().next().value),null==(i=this.ticker)||i.pause());t=Math.min(t,33)*this.speed;var a=this.compositions,s=!1;a.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var o,u=[],h=0;h<a.length;h++){var l=a[h];l.textureOffloaded?(s=!0,vt.error("Composition "+l.name+" texture offloaded, skip render."),u.push(l)):(!l.isDestroyed&&l.renderer&&l.update(t),l.isDestroyed||u.push(l))}if(this.compositions=u,this.baseCompositionIndex=this.compositions.length,s)return this.handleEmitEvent("rendererror",new Error("Play when texture offloaded.")),null==(o=this.ticker)?void 0:o.pause();if(!this.paused||e){var c=this.gpuCapability.level,f=this.renderer.context.gl,d=2===c&&this.reportGPUTime?Cr(f):void 0;if(null==d||d.begin(),this.compositions.length||this.compositions.length<a.length||e){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:Ir.clear,clearStencil:0,depthAction:Ir.clear,clearDepth:1,colorAction:Ir.clear,clearColor:[0,0,0,0]});for(var p=0;p<a.length;p++)!a[p].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(a[p].renderFrame)}null==d||d.end(),null==d||d.getTime().then((function(t){return null==r.reportGPUTime?void 0:r.reportGPUTime.call(r,null!=t?t:0)})).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},a.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},a.resize=function(){var t,e,r,n,a=this.canvas.parentElement;if(a){var s=this.getTargetSize(a);t=s[0],e=s[1],r=s[2],n=s[3]}else t=r=this.canvas.width,e=n=this.canvas.height;var o=t/e;if(t&&e){var u,h=i.documentElement.clientWidth;r>2*h&&vt.error("DPI overflowed, width "+r+" is more than 2x document width "+h+", see "+Xd+".");var l=this.env?this.gpuCapability.detail.maxTextureSize:2048;(r>l||n>l)&&(vt.error("Container size overflowed "+r+"x"+n+", see "+jd+"."),o>1?(r=Math.round(l),n=Math.round(l/o)):(n=Math.round(l),r=Math.round(l*o))),this.renderer.resize(r,n),this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",vt.info("Resize player "+this.name+" ["+r+","+n+","+t+","+e+"]."),null==(u=this.compositions)||u.forEach((function(t){t.camera.aspect=o}))}},a.clearCanvas=function(t){t?this.renderer.clear({stencilAction:Ir.clear,clearStencil:0,depthAction:Ir.clear,clearDepth:1,colorAction:Ir.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},a.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},a.dispose=function(t){var e;if(vt.info("Call player destroyed: "+this.name+"."),!this.disposed){Kd.delete(this.canvas),this.pause(),null==(e=this.ticker)||e.stop(),this.assetManagers.forEach((function(t){return t.dispose()})),this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.renderer&&(this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.renderer.dispose(!t)),this.event&&this.event.dispose(),this.assetService.dispose(),np(this,!1),C(this.canvas,m)&&!t&&this.renderer.context&&(fc.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i="Never use destroyed player: "+this.name+" again, see "+Yd+".",r=function(){return function(t){throw new Error(t)}(i)},n=function(){return t=i,Promise.reject(t);var t};this.tick=r,this.resize=r,this.loadScene=n,this.play=n,this.gotoAndPlay=n,this.gotoAndStop=n,this.playSequence=r,this.destroyCurrentCompositions=r,this.resume=n,this.disposed=!0}},a.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},a.getTargetSize=function(t){ap(t);var e,i,n=this.displayAspect,a=null==r.getComputedStyle?void 0:r.getComputedStyle.call(r,t),s=0,o=0;(a?(s=parseInt(a.width,10),o=parseInt(a.height,10)):(s=t.clientWidth,o=t.clientHeight),n)?s/o>n?e=(i=o*this.displayScale)*n:i=(e=s*this.displayScale)/n:(e=s,i=o);var u=this.pixelRatio,h=e,l=i;if(e=Math.round(e*u),(i=Math.round(i*u))<1||i<1){if(!this.offscreenMode)throw new Error("Invalid container size "+e+"x"+i+", see "+Hd+".");e=i=h=l=1}return[h,l,e,i]},a.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},a.handleEmitEvent=function(t,e){this.onError?C(e,b)?this.onError(new Error(e.type,{cause:t}),e):C(e,Error)?this.onError(new Error(e.message,{cause:t}),e):this.onError(new Error("Unknown error.",{cause:t}),e):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,e))},dr(e,[{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),e}(fl);function rp(t){tp=!!t}function np(t,e){Object.keys(Rt).forEach((function(i){var r=Rt[i],n=e?r.onPlayerCreated:r.onPlayerDestroy;null==n||n(t)}))}function ap(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Wd+".")}S([function(t,e,i){var r=i.value;return i.value=E((function(){var e,i,n,a,s=arguments;return I(this,(function(o){switch(o.label){case 0:for(e=s.length,i=new Array(e),n=0;n<e;n++)i[n]=s[n];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.apply(this,i)];case 2:return[2,o.sent()];case 3:return a=o.sent(),t.handleThrowError.call(this,a),[3,4];case 4:return[2]}}))})),i}],ip.prototype,"loadScene",null),fn.create=function(t,e){return new ed(t,e)},fn.createWithData=function(t,e,i){void 0===e&&(e=it("#fff")),void 0===i&&(i={});var r=i.type,n=void 0===r?Mr.UNSIGNED_BYTE:r,a=i.format,s=void 0===a?Mr.RGBA:a,o=i.internalFormat,u=i.wrapS,h=void 0===u?Mr.MIRRORED_REPEAT:u,l=i.wrapT,c=void 0===l?Mr.MIRRORED_REPEAT:l,f=i.minFilter,d=void 0===f?Mr.NEAREST:f,p=i.magFilter,m=void 0===p?Mr.NEAREST:p,v=i.flipY,y=void 0!==v&&v;return new ed(t,{data:e,type:n,sourceType:Rr.data,format:s,internalFormat:o||s,wrapS:h,wrapT:c,minFilter:d,magFilter:m,flipY:y})},On.create=function(t,e){return new bd(t,e)},Wn.create=function(t,e){return new dd(t,e)},ra.create=function(t,e){return new ra(t,e)},Xa.create=function(t){return new Cd(t)},qa.create=function(t,e){return new Sd(t,e)},Ka.create=function(t,e,i){return new Gd(t,e,i)},Zf.create=function(t){return new wd(t)};var sp="2.6.4";vt.info("Player version: 2.6.4.");export{Qt as AbstractPlugin,zl as ActivationPlayable,Ul as ActivationPlayableAsset,Gh as ActivationTrack,Mi as AndNode,Oi as AndNodeData,pi as Animatable,Bl as AnimationClip,di as AnimationClipNode,ci as AnimationClipNodeData,ti as AnimationGraphAsset,vr as Animator,Si as ApplyAdditiveNode,Ai as ApplyAdditiveNodeData,bc as Asset,_c as AssetLoader,Af as AssetManager,If as AssetService,Hn as BYTES_TYPE_MAP,Js as BaseRenderComponent,mr as Behaviour,yu as BezierCurve,ru as BezierCurvePath,nu as BezierCurveQuat,Tc as BinaryAsset,Ri as BlendNode,Ii as BlendNodeData,$e as BoolValueNode,za as COMPRESSED_TEXTURE,Dn as COPY_FRAGMENT_SHADER,Ln as COPY_MESH_SHADER_ID,Vn as COPY_VERTEX_SHADER,Ml as CalculateLoader,Uu as Camera,io as CameraController,no as CameraVFXItemLoader,_u as ColorCurve,$h as ColorPropertyPlayableAsset,Jh as ColorPropertyTrack,pr as Component,Cl as ComponentTimePlayable,wl as ComponentTimePlayableAsset,_l as ComponentTimeTrack,yl as Composition,ll as CompositionComponent,zi as ConstBoolNode,ki as ConstBoolNodeData,Di as ConstFloatNode,Vi as ConstFloatNodeData,ji as ControlParameterBoolNode,Gi as ControlParameterBoolNodeData,Bi as ControlParameterFloatNode,Ui as ControlParameterFloatNodeData,Hi as ControlParameterTriggerNode,Xi as ControlParameterTriggerNodeData,mc as DEFAULT_FONTS,qf as DEFAULT_FPS,wc as Database,ft as Deferred,mt as DestroyOptions,jr as Downloader,Fn as EFFECTS_COPY_MESH_NAME,ao as EVENT_TYPE_CLICK,uo as EVENT_TYPE_TOUCH_END,oo as EVENT_TYPE_TOUCH_MOVE,so as EVENT_TYPE_TOUCH_START,br as EffectComponent,Be as EffectsObject,Yf as EffectsPackage,sc as Ellipse,Zf as Engine,Zi as EqualNodeData,fl as EventEmitter,ho as EventSystem,to as Fake3DAnimationMode,eo as Fake3DComponent,Ua as FilterMode,vo as Float16ArrayWrapper,Ji as FloatComparisonNode,Qi as FloatComparisonNodeData,tl as FloatPropertyPlayableAsset,Xh as FloatPropertyTrack,Je as FloatValueNode,qa as Framebuffer,wd as GLEngine,dd as GLGeometry,Gd as GLRenderer,In as GLSLVersion,Wa as GPUCapability,Wn as Geometry,ja as GlobalUniforms,tu as GradientValue,cr as GraphInstance,Ze as GraphNode,qe as GraphNodeData,lc as GraphicsPath,$i as GreaterNodeData,Hs as HELP_LINK,ro as HitTestType,Au as InteractComponent,po as InteractLoader,Cu as InteractMesh,Ye as InvalidIndex,cl as Item,yn as KTXTexture,Yi as LayerBlendNode,Wi as LayerBlendNodeData,tr as LessNodeData,eu as LineSegments,$o as LinearValue,Sr as MaskMode,Mn as MaskProcessor,On as Material,wn as MaterialDataBlock,_n as MaterialRenderType,Zh as MaterialTrack,ra as Mesh,Ru as MeshCollider,_i as NodeTransform,Li as NotNode,Fi as NotNodeData,il as ObjectBindingTrack,Pi as OrNode,Ni as OrNodeData,W as OrderType,Xs as PLAYER_OPTIONS_ENV_EDITOR,Yu as POST_PROCESS_SETTINGS,nh as ParticleBehaviourPlayable,ah as ParticleBehaviourPlayableAsset,Ol as ParticleLoader,oh as ParticleMesh,dh as ParticleSystem,fh as ParticleSystemRenderer,qh as ParticleTrack,jn as PassTextureCache,iu as PathSegments,ip as Player,Ft as PluginSystem,oc as PolyStar,tc as Polygon,wi as Pose,Ke as PoseNode,Tr as PostProcessVolume,jh as PropertyTrack,Fa as RENDER_PASS_NAME_PREFIX,Hu as RENDER_PREFER_LOOKUP_TEXTURE,Xu as RUNTIME_ENV,Ko as RandomSetValue,Qo as RandomValue,Jo as RandomVectorValue,Va as RenderFrame,la as RenderPass,Qn as RenderPassAttachmentStorageType,oa as RenderPassDestroyAttachmentType,aa as RenderPassPriorityNormal,sa as RenderPassPriorityPostprocess,na as RenderPassPriorityPrepare,ua as RenderTargetHandle,Ba as RenderTextureFormat,Xa as Renderbuffer,Ka as Renderer,yr as RendererComponent,Bh as RuntimeClip,Gs as SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0,js as SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0,Us as SEMANTIC_PRE_COLOR_ATTACHMENT_0,Bs as SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0,zs as SPRITE_VERTEX_STRIDE,xf as Scene,Xn as SemanticMap,Ec as SerializationHelper,Pn as Shader,Sn as ShaderCompileResultStatus,Ra as ShaderFactory,Ar as ShaderType,Nn as ShaderVariant,$s as ShapeComponent,hc as ShapePath,ar as SourceType,El as SpriteColorPlayableAsset,Hh as SpriteColorTrack,Al as SpriteComponent,Ou as SpriteLoader,ac as StarType,rr as StateMachineNode,er as StateMachineNodeData,sr as StateNode,nr as StateNodeData,qo as StaticValue,el as SubCompositionPlayableAsset,Wh as SubCompositionTrack,Wu as TEMPLATE_USE_OFFSCREEN_CANVAS,fu as TangentMode,yc as TextComponent,gc as TextComponentBase,dc as TextLayout,xc as TextLoader,pc as TextStyle,fn as Texture,bn as TextureFactory,Ir as TextureLoadAction,Rr as TextureSourceType,Jn as TextureStoreAction,Kf as Ticker,nl as TimelineAsset,zh as TimelineClip,al as TimelinePlayable,Uh as TrackAsset,sl as TrackSortWrapper,Ch as TrackType,ku as Transform,Dl as TransformAnimationPlayable,kl as TransformPlayableAsset,Yh as TransformTrack,hr as TransitionNode,or as TransitionNodeData,ir as TransitionState,gl as VFXItem,Zo as ValueGetter,Qe as ValueNode,vu as Vector2Curve,hl as Vector2PropertyPlayableAsset,Qh as Vector2PropertyTrack,mu as Vector3Curve,pu as Vector4Curve,ul as Vector4PropertyPlayableAsset,Kh as Vector4PropertyTrack,du as WeightedMode,at as addByOrder,V as addItem,k as addItemWithOrder,It as applyMixins,ut as assertExist,ht as asserts,St as base64ToFile,ca as blend,Zl as buildLine,To as calculateTranslation,Y as canUseBOM,fc as canvasPool,Xl as closePointEps,Ea as colorGradingFrag,G as colorStopsFromGradient,U as colorToArr,_f as combineImageTemplate,kn as createCopyShader,wr as createGLContext,hu as createKeyFrameMeta,fs as createShape,Eu as createValueGetter,Hl as curveEps,Ro as decimalEqual,Ot as defaultPlugins,on as deserializeMipmapTexture,rp as disableAllPlayer,Ls as earcut,ke as effectsClass,Ve as effectsClassStore,z as enlargeBuffer,Ac as ensureFixedNumber,Eo as ensureVec3,ka as findPreviousRenderPass,_a as gaussianDownFrag,wa as gaussianDownHFrag,Ca as gaussianDownVFrag,Aa as gaussianUpFrag,Yn as generateEmptyTypedArray,At as generateGUID,dn as generateHalfFloatTexture,vn as generateTransparentTexture,mn as generateWhiteTexture,$d as getActivePlayers,Ef as getBackgroundImage,De as getClass,B as getColorFromGradientStops,qu as getConfig,Tn as getDefaultTextureFactory,Zs as getGeometryByShape,Ys as getGeometryTriangles,gn as getKTXTextureOptions,uu as getKeyFrameMetaByRawValue,Ue as getMergedStore,He as getNodeDataClass,lh as getParticleMeshShader,H as getPixelRatio,Jd as getPlayerByCanvas,zr as getPreMultiAlpha,pf as getStandardComposition,df as getStandardImage,gf as getStandardItem,cf as getStandardJSON,Da as getTextureSize,Mr as glContext,Dr as glType2VertexFormatType,Cr as gpuTimer,it as imageDataFromColor,rt as imageDataFromGradient,Or as initErrors,Pr as initGLContext,da as integrate,j as interpolateColor,tt as isAlipayMiniApp,K as isAndroid,xt as isArray,_t as isCanvas,Qd as isCanvasUsedByPlayer,bt as isFunction,Z as isIOS,q as isIOSByUA,$ as isMiniProgram,Tt as isObject,Q as isOpenHarmony,Et as isPlainObject,J as isSimulatorCellPhone,gt as isString,Cn as isUniformStruct,An as isUniformStructArray,lt as isValidFontFamily,Fr as isWebGL2,et as isWechatMiniApp,ma as itemFrag,fa as itemFrameFrag,pa as itemVert,Zr as loadAVIFOptional,Jr as loadBinary,tn as loadBlob,Kr as loadImage,an as loadMedia,rn as loadVideo,Wr as loadWebPOptional,vt as logger,ea as math,Sl as maxSpriteMeshItemCount,ch as modifyMaxKeyframeShader,Ao as nearestPowerOfTwo,Xe as nodeDataClass,yt as noop,Pc as normalizeColor,Oo as numberToFix,xu as oldBezierKeyFramesToNew,X as parsePercent,va as particleFrag,Co as particleOriginTranslateMap,sh as particleUniformTypeMap,ya as particleVert,Tf as passRenderLevel,Rt as pluginLoaderMap,wt as randomInRange,Nt as registerPlugin,D as removeItem,qs as rotateVec2,Ta as screenMeshVert,ze as serialize,Ur as setBlendMode,Ku as setConfig,En as setDefaultTextureFactory,Gr as setMaskMode,Rl as setMaxSpriteMeshItemCount,So as setRayFromCamera,Br as setSideMode,Il as setSpriteMeshMaxItemCountByGPU,nt as sortByOrder,Pe as spec,Sa as thresholdFrag,Ct as throwDestroyedError,ga as trailVert,yo as translatePoint,Io as trianglesFromRect,Pt as unregisterPlugin,kr as valIfUndefined,xa as value,ba as valueDefine,_o as vecFill,wo as vecMulCombine,sp as version,Vr as vertexFormatType2GLType};
1
+ import{crypto as t,screen as e,document as i,window as r,navigator as n,atob as a,Blob as s,WebGL2RenderingContext as o,WebGLRenderingContext as u,XMLHttpRequest as h,HTMLImageElement as l,URL as c,Image as f,performance as d,HTMLVideoElement as p,HTMLCanvasElement as m,location as v,TextDecoder as y,cancelAnimationFrame as g,requestAnimationFrame as x,Event as b}from"@galacean/appx-adapter/weapp";function T(t,e,i,r,n,a,s){try{var o=t[a](s),u=o.value}catch(t){return void i(t)}o.done?e(u):Promise.resolve(u).then(r,n)}function E(t){return function(){var e=this,i=arguments;return new Promise((function(r,n){var a=t.apply(e,i);function s(t){T(a,r,n,s,o,"next",t)}function o(t){T(a,r,n,s,o,"throw",t)}s(void 0)}))}}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function w(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(i)return(i=i.call(t)).next.bind(i);if(Array.isArray(t)||(i=function(t,e){if(t){if("string"==typeof t)return _(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function C(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):C(t,e)}function A(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function S(t,e,i,r){var n,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(s=(a<3?n(s):a>3?n(e,i,s):n(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s}function I(t,e){var i,r,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=o(0),s.throw=o(1),s.return=o(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function o(o){return function(u){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;s&&(s=0,o[0]&&(a=0)),a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}var R;"function"==typeof SuppressedError&&SuppressedError;var O=new Uint8Array(16);function M(){if(!R&&!(R=void 0!==t&&t.getRandomValues&&t.getRandomValues.bind(t)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return R(O)}for(var N=[],P=0;P<256;++P)N.push((P+256).toString(16).slice(1));var F={randomUUID:void 0!==t&&t.randomUUID&&t.randomUUID.bind(t)};function L(t,e,i){if(F.randomUUID&&!e&&!t)return F.randomUUID();var r=(t=t||{}).random||(t.rng||M)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){i=i||0;for(var n=0;n<16;++n)e[i+n]=r[n];return e}return function(t,e){return void 0===e&&(e=0),N[t[e+0]]+N[t[e+1]]+N[t[e+2]]+N[t[e+3]]+"-"+N[t[e+4]]+N[t[e+5]]+"-"+N[t[e+6]]+N[t[e+7]]+"-"+N[t[e+8]]+N[t[e+9]]+"-"+N[t[e+10]]+N[t[e+11]]+N[t[e+12]]+N[t[e+13]]+N[t[e+14]]+N[t[e+15]]}(r)}function V(t,e){return t.includes(e)||t.push(e),t}function D(t,e){var i=t.indexOf(e);return i>-1&&t.splice(i,1),t}function k(t,e,i,r){if(void 0===r&&(r=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var a=t[n];if(r)for(;t[n-1][i]<a[i]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][i]>a[i]&&(t[n]=t[n-1],0!=--n););t[n]=a}}}function z(t,e,i,r){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);Number.isNaN(i)||(n=Math.min(n,i));var a=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),s=new t.constructor(a);return s.set(t),s}return t}function U(t,e){var i=[0,0,0,0];if(gt(t)){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else C(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var a=0;a<4;a++)i[a]/=255;return i}function B(t,e,i){if(t.length){for(var r,n=1;n<=t.length-1;n++){var a=t[n-1],s=t[n];if(a.stop<=e&&e<=s.stop){r=j(a.color,s.color,(e-a.stop)/(s.stop-a.stop));break}}return r||(r=t[t.length-1].color),i?r.map((function(t){return t/255})):r}return[0,0,0,0]}function G(t){var e=[];if(C(t,Array)?t.forEach((function(t){var i=t[0],r=t[1],n=t[2],a=t[3],s=t[4];e.push({stop:X(i),color:[r,n,a,s]})})):Object.keys(t).forEach((function(i){var r=U(t[i]);e.push({stop:X(i),color:r})})),(e=e.sort((function(t,e){return t.stop-e.stop}))).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var i=e[e.length-1];1!==i.stop&&e.push({stop:1,color:i.color.slice()})}return e}function j(t,e,i,r){var n=[],a=1-i;if(r)for(var s=0;s<4;s++)n[s]=t[s]*a+e[s]*i;else{for(var o=0;o<3;o++)n[o]=Math.round(Math.sqrt(t[o]*t[o]*a+e[o]*e[o]*i));n[3]=Math.round(t[3]*a+e[3]*i)}return n}function X(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function H(){if("object"==typeof e&&"object"==typeof i){var t=Math.max(i.documentElement.clientWidth,r.innerWidth||0),n=e.width/t;return Math.min(2*n,2)}return 1}var W,Y=void 0!==r;function Z(){return!!n.platform&&/iPad|iPhone|iPod/.test(n.platform)}function q(){var t=n.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0}function K(){return/\b[Aa]ndroid\b/.test(n.userAgent)}function Q(){return/\bOpenHarmony\b/.test(n.userAgent)}function J(){return K()||Q()||/\b(iPad|iPhone|iPod)\b/.test(n.userAgent)}function $(){return tt()||et()}function tt(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function et(){return"miniprogram"===r.__wxjs_environment}function it(t){gt(t)&&(t=U(t));for(var e=t,i={width:1,height:1,data:new Uint8Array(4)},r=i.data,n=0;n<4;n++)r[n]=e[n];return i}function rt(t){var e=128,i={width:e,height:1,data:new Uint8Array(512)},r=i.data,n=G(t);if(n.length){r.set(n[0].color,0);for(var a=1;a<127;a++){for(var s=a/e,o=void 0,u=void 0,h=0;h<n.length&&(o=n[h],u=n[h+1],!(o.stop<=s&&u.stop>s));h++);var l=j(o.color,u.color,(s-o.stop)/(u.stop-o.stop));r.set(l,4*a)}r.set(n[n.length-1].color,508)}return i}function nt(t,e){void 0===e&&(e=2);var i=t.length;if(i<=1||1===e)return t;if(i<=30){for(var r=1;r<i;r++)st(t,r,e);return t}return ot(t,e)}function at(t,e,i){return void 0===i&&(i=2),t.includes(e)?t:(t.push(e),1===t.length||1!==i&&st(t,t.length-1,i),t)}function st(t,e,i){var r=t[e];if(2!==i)for(;e>=1&&t[e-1].priority<r.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>r.priority&&(t[e]=t[e-1],0!=--e););t[e]=r}function ot(t,e,i,r){if(void 0===i&&(i=0),void 0===r&&(r=t.length-1),i>=r)return t;for(var n,a=t[i],s=i,o=r;s<o;){if(2===e){for(;t[o].priority>a.priority&&o>=s;)o--;for(;t[s].priority<=a.priority&&s<o;)s++}else{for(;t[o].priority<a.priority&&o>=s;)o--;for(;t[s].priority>=a.priority&&s<o;)s++}var u;u=[t[o],t[s]],t[s]=u[0],t[o]=u[1]}return n=[t[s],t[i]],t[i]=n[0],t[s]=n[1],ot(t,e,i,s-1),ot(t,e,o+1,r),t}function ut(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function ht(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)}function lt(t){return/^[^\d.][\w-]*$/.test(t)}!function(t){t[t.none=1]="none",t[t.ascending=2]="ascending",t[t.descending=3]="descending"}(W||(W={}));var ct,ft=function(){var t=this;this.promise=new Promise((function(e,i){t.resolve=e,t.reject=i}))},dt="[Galacean Effects]";function pt(t){return["%c"+dt,"color: #AA0100",""+t]}var mt,vt={error:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).error.apply(n,[].concat(pt(t),[i])),null==ct||ct("error",t,i)},info:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).debug.apply(n,[].concat(pt(t))),null==ct||ct("info",t,i)},warn:function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=console).warn.apply(n,[].concat(pt(t))),null==ct||ct("warn",t,i)},register:function(t){t&&bt(t)&&(ct=t)}};function yt(){}function gt(t){return"string"==typeof t}!function(t){t[t.destroy=0]="destroy",t[t.keep=1]="keep",t[t.force=0]="force"}(mt||(mt={}));var xt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function bt(t){return"[object Function]"===Object.prototype.toString.call(t)}function Tt(t){return"[object Object]"===Object.prototype.toString.call(t)}function Et(t){if(null===t||"object"!=typeof t)return!1;if("[object Object]"!==Object.prototype.toString.call(t))return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;var i=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return"function"==typeof i&&Function.prototype.toString.call(i)===Function.prototype.toString.call(Object)}function _t(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function wt(t,e){return t+Math.random()*(e-t)}function Ct(){throw new Error("Destroyed item cannot be used again.")}function At(){return L().replace(/-/g,"")}function St(t,e,i){void 0===e&&(e="base64File"),void 0===i&&(i="");for(var r=t.split(",")[1]||t,n=a(r),o=[],u=0;u<n.length;u+=512){for(var h=n.slice(u,u+512),l=new Array(h.length),c=0;c<h.length;c++)l[c]=h.charCodeAt(c);var f=new Uint8Array(l);o.push(f)}var d=new s(o,{type:i});return new File([d],e,{type:i})}function It(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(i){var r=Object.getOwnPropertyDescriptor(e.prototype,i);if(!r)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,i,r)}))}))}var Rt={},Ot=[],Mt={};function Nt(t,e,i){Mt[t]&&vt.error("Duplicate registration for plugin "+t+"."),Mt[t]=i,Rt[t]=e,V(Ot,t)}function Pt(t){delete Mt[t],delete Rt[t],D(Ot,t)}var Ft=function(){function t(t){var e={},i=[];Ot.forEach((function(t){var r=Rt[t];i.includes(r)||(i.push(r),e[t]=r)}));for(var r,n=w(t);!(r=n()).done;){var a=r.value;if(!Rt[a])throw new Error("The plugin '"+a+"' not found."+Vt(a))}this.plugins=Object.keys(e).map((function(t){var e=new(0,Rt[t]);return e.name=t,e})).sort((function(t,e){return t.order-e.order}))}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach((function(i){return i.onCompositionConstructed(t,e)}))},e.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},e.resetComposition=function(t,e){this.plugins.forEach((function(i){return i.onCompositionReset(t,e)}))},e.processRawJSON=function(t,e){var i=this;return E((function(){return I(this,(function(r){return[2,i.callStatic("processRawJSON",t,e)]}))}))()},e.processAssets=function(t,e){var i=this;return E((function(){return I(this,(function(r){return[2,i.callStatic("processAssets",t,e)]}))}))()},e.precompile=function(t,e){for(var i,r=w(this.plugins);!(i=r()).done;){i.value.precompile(t,e)}},e.loadResources=function(t,e){var i=this;return E((function(){return I(this,(function(r){return[2,i.callStatic("prepareResource",t,e)]}))}))()},e.callStatic=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n=this;return E((function(){var e,r,a,s,o,u,h;return I(this,(function(l){for(e=[],r=n.plugins,a=0;a<r.length;a++)s=r[a],o=Rt[s.name],t in o&&e.push(Promise.resolve(null==(h=o[t])?void 0:(u=h).call.apply(u,[].concat([o],i))));return[2,Promise.all(e)]}))}))()},t}(),Lt={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade",downgrade:"@galacean/effects-plugin-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",model:"@galacean/effects-plugin-model",video:"@galacean/effects-plugin-multimedia",audio:"@galacean/effects-plugin-multimedia","orientation-transformer":"@galacean/effects-plugin-orientation-transformer","rich-text":"@galacean/effects-plugin-rich-text",spine:"@galacean/effects-plugin-spine"};function Vt(t){var e=Lt[t];return e?"\n请按如下命令进行操作(Please follow the commands below to proceed):\n1、使用 npm 安装插件(Install Plugin):npm i "+e+"@latest --save\n2、导入插件(Import Plugin):import '"+e+"'":""}var Dt,kt,zt,Ut,Bt,Gt,jt,Xt,Ht,Wt,Yt,Zt,qt,Kt,Qt=function(){function t(){this.order=100,this.name=""}var e=t.prototype;return e.precompile=function(t,e){},e.onCompositionConstructed=function(t,e){},e.onCompositionItemLifeBegin=function(t,e){},e.onCompositionItemLifeEnd=function(t,e){},e.onCompositionItemRemoved=function(t,e){},e.onCompositionReset=function(t,e){},e.onCompositionWillReset=function(t,e){},e.onCompositionDestroyed=function(t){},e.onCompositionUpdate=function(t,e){},e.prepareRenderFrame=function(t,e){return!1},e.postProcessFrame=function(t,e){},t}();function Jt(t,e){return Jt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Jt(t,e)}function $t(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Jt(t,e)}!function(t){t["1_0"]="1.0",t["1_1"]="1.1",t["1_2"]="1.2",t["1_3"]="1.3",t["1_5"]="1.5",t["1_8"]="1.8",t["2_0"]="2.0",t["2_1"]="2.1",t["2_2"]="2.2",t["2_3"]="2.3",t["2_4"]="2.4",t["3_0"]="3.0",t["3_1"]="3.1",t["3_2"]="3.2",t["3_3"]="3.3",t["3_4"]="3.4",t.LATEST="3.4"}(Dt||(Dt={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(kt||(kt={})),function(t){t[t.ALPHA=0]="ALPHA",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.BRIGHTNESS=3]="BRIGHTNESS",t[t.SUBTRACTION=4]="SUBTRACTION",t[t.STRONG_LIGHT=5]="STRONG_LIGHT",t[t.WEAK_LIGHT=6]="WEAK_LIGHT",t[t.SUPERPOSITION=7]="SUPERPOSITION"}(zt||(zt={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(Ut||(Ut={})),function(t){t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Bt||(Bt={})),function(t){t[t.NONE=0]="NONE",t[t.SPHERE=1]="SPHERE",t[t.CONE=2]="CONE",t[t.HEMISPHERE=3]="HEMISPHERE",t[t.CIRCLE=4]="CIRCLE",t[t.DONUT=5]="DONUT",t[t.RECTANGLE=6]="RECTANGLE",t[t.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",t[t.EDGE=8]="EDGE",t[t.TEXTURE=9]="TEXTURE"}(Gt||(Gt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(jt||(jt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Xt||(Xt={})),function(t){t[t.NONE=0]="NONE",t[t.NOTIFY=1]="NOTIFY",t[t.RESUME_PLAYER=2]="RESUME_PLAYER",t[t.REMOVE=3]="REMOVE",t[t.PAUSE=4]="PAUSE"}(Ht||(Ht={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox",t.effect="effect",t.shape="shape",t.postProcessVolume="postProcessVolume",t.node="node",t.video="video",t.audio="audio",t.richtext="richtext"}(Wt||(Wt={})),function(t){t[t.BILLBOARD=0]="BILLBOARD",t[t.MESH=1]="MESH",t[t.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",t[t.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(Yt||(Yt={})),function(t){t[t.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",t[t.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",t[t.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",t[t.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",t[t.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",t[t.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",t[t.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",t[t.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",t[t.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(Zt||(Zt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(qt||(qt={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(Kt||(Kt={}));var te,ee,ie,re,ne,ae,se,oe,ue,he,le,ce,fe,de,pe,me,ve,ye=1,ge=3,xe=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(te||(te={})),function(t){t[t.CONSTANT=0]="CONSTANT",t[t.CONSTANT_VEC2=1]="CONSTANT_VEC2",t[t.CONSTANT_VEC3=2]="CONSTANT_VEC3",t[t.CONSTANT_VEC4=3]="CONSTANT_VEC4",t[t.RANDOM=4]="RANDOM",t[t.LINE=5]="LINE",t[t.CURVE=6]="CURVE",t[t.BEZIER_PATH=7]="BEZIER_PATH",t[t.RGBA_COLOR=8]="RGBA_COLOR",t[t.GRADIENT_COLOR=9]="GRADIENT_COLOR",t[t.SHAPE_POINTS=10]="SHAPE_POINTS",t[t.SHAPE_SPLITS=11]="SHAPE_SPLITS",t[t.LINEAR_PATH=12]="LINEAR_PATH",t[t.COLORS=13]="COLORS",t[t.BINARY=20]="BINARY",t[t.BEZIER_CURVE=21]="BEZIER_CURVE",t[t.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH",t[t.BEZIER_CURVE_QUAT=23]="BEZIER_CURVE_QUAT",t[t.COLOR_CURVE=24]="COLOR_CURVE",t[t.VECTOR4_CURVE=25]="VECTOR4_CURVE",t[t.VECTOR2_CURVE=26]="VECTOR2_CURVE",t[t.VECTOR3_CURVE=27]="VECTOR3_CURVE"}(ee||(ee={})),function(t){t[t.AUTO=0]="AUTO",t[t.EASE=1]="EASE",t[t.EASE_IN=2]="EASE_IN",t[t.EASE_OUT=3]="EASE_OUT",t[t.LINE=4]="LINE",t[t.HOLD=5]="HOLD",t[t.LINE_OUT=6]="LINE_OUT"}(ie||(ie={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(re||(re={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(ne||(ne={})),function(t){t[t.RANDOM=0]="RANDOM",t[t.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",t[t.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",t[t.UNIFORM_BURST=3]="UNIFORM_BURST"}(ae||(ae={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(se||(se={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(oe||(oe={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(ue||(ue={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(he||(he={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(le||(le={})),function(t){t.none="none",t.uv="uv",t.normal="normal",t.basecolor="basecolor",t.alpha="alpha",t.metallic="metallic",t.roughness="roughness",t.ao="ao",t.emissive="emissive",t.diffuse="diffuse"}(ce||(ce={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(fe||(fe={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(de||(de={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(pe||(pe={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(me||(me={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(ve||(ve={}));var be,Te,Ee,_e,we,Ce,Ae,Se,Ie,Re,Oe,Me={WhiteTexture:"whitetexture00000000000000000000",TransparentTexture:"transparenttexture00000000000000000000",PBRShader:"pbr00000000000000000000000000000",UnlitShader:"unlit000000000000000000000000000"};!function(t){t[t.Custom=0]="Custom",t[t.Rectangle=1]="Rectangle",t[t.Ellipse=2]="Ellipse",t[t.Polygon=3]="Polygon",t[t.Star=4]="Star"}(be||(be={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(Te||(Te={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(Ee||(Ee={})),function(t){t.AnimationClipNodeData="AnimationClipNodeData",t.BlendNodeData="BlendNodeData",t.ApplyAdditiveNodeData="ApplyAdditiveNodeData",t.LayerBlendNodeData="LayerBlendNodeData",t.StateMachineNodeData="StateMachineNodeData",t.TransitionNodeData="TransitionNodeData",t.StateNodeData="StateNodeData",t.ConstFloatNodeData="ConstFloatNodeData",t.ConstBoolNodeData="ConstBoolNodeData",t.ControlParameterBoolNodeData="ControlParameterBoolNodeData",t.ControlParameterFloatNodeData="ControlParameterFloatNodeData",t.ControlParameterTriggerNodeData="ControlParameterTriggerNodeData",t.NotNodeData="NotNodeData",t.AndNodeData="AndNodeData",t.OrNodeData="OrNodeData",t.EqualNodeData="EqualNodeData",t.GreaterNodeData="GreaterNodeData",t.LessNodeData="LessNodeData"}(_e||(_e={})),function(t){t.video="video",t.image="image"}(we||(we={})),function(t){t.video="video",t.audio="audio"}(Ce||(Ce={})),function(t){t.VFXItemData="VFXItemData",t.Material="Material",t.Shader="Shader",t.Geometry="Geometry",t.Texture="Texture",t.Image="Image",t.AnimationClip="AnimationClip",t.BinaryAsset="BinaryAsset",t.TrackAsset="TrackAsset",t.TimelineAsset="TimelineAsset",t.ObjectBindingTrack="ObjectBindingTrack",t.TransformTrack="TransformTrack",t.SpriteColorTrack="SpriteColorTrack",t.ActivationTrack="ActivationTrack",t.SubCompositionTrack="SubCompositionTrack",t.FloatPropertyTrack="FloatPropertyTrack",t.ColorPropertyTrack="ColorPropertyTrack",t.Vector2PropertyTrack="Vector2PropertyTrack",t.Vector4PropertyTrack="Vector4PropertyTrack",t.TransformPlayableAsset="TransformPlayableAsset",t.SpriteColorPlayableAsset="SpriteColorPlayableAsset",t.ActivationPlayableAsset="ActivationPlayableAsset",t.SubCompositionPlayableAsset="SubCompositionPlayableAsset",t.FloatPropertyPlayableAsset="FloatPropertyPlayableAsset",t.ColorPropertyPlayableAsset="ColorPropertyPlayableAsset",t.Vector2PropertyPlayableAsset="Vector2PropertyPlayableAsset",t.Vector4PropertyPlayableAsset="Vector4PropertyPlayableAsset",t.MeshComponent="MeshComponent",t.SkyboxComponent="SkyboxComponent",t.LightComponent="LightComponent",t.CameraComponent="CameraComponent",t.ModelPluginComponent="ModelPluginComponent",t.TreeComponent="TreeComponent",t.AnimationComponent="AnimationComponent",t.SpineComponent="SpineComponent",t.VideoComponent="VideoComponent",t.AudioComponent="AudioComponent",t.RichTextComponent="RichTextComponent",t.OrientationComponent="OrientationComponent",t.ShapeComponent="ShapeComponent",t.SpriteComponent="SpriteComponent",t.ParticleSystem="ParticleSystem",t.InteractComponent="InteractComponent",t.CameraController="CameraController",t.PostProcessVolume="PostProcessVolume",t.EffectComponent="EffectComponent",t.TextComponent="TextComponent",t.AnimationGraphAsset="AnimationGraphAsset",t.Animator="Animator",t.TimelineClip="TimelineClip"}(Ae||(Ae={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(Se||(Se={})),function(t){t[t.Float16=0]="Float16",t[t.Float32=1]="Float32",t[t.Int8=2]="Int8",t[t.Int16=3]="Int16",t[t.Int32=4]="Int32",t[t.UInt8=5]="UInt8",t[t.UInt16=6]="UInt16",t[t.UInt32=7]="UInt32"}(Ie||(Ie={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}(Re||(Re={})),function(t){t.Position="POSITION",t.Uv="TEXCOORD0",t.Uv2="TEXCOORD1",t.Normal="NORMAL",t.Tangent="TANGENT",t.Color="COLOR",t.Joints="JOINTS",t.Weights="WEIGHTS",t.PositionBS0="POSITION_BS0",t.PositionBS1="POSITION_BS1",t.PositionBS2="POSITION_BS2",t.PositionBS3="POSITION_BS3",t.PositionBS4="POSITION_BS4",t.PositionBS5="POSITION_BS5",t.PositionBS6="POSITION_BS6",t.PositionBS7="POSITION_BS7",t.NormalBS0="NORMAL_BS0",t.NormalBS1="NORMAL_BS1",t.NormalBS2="NORMAL_BS2",t.NormalBS3="NORMAL_BS3",t.TangentBS0="TANGENT_BS0",t.TangentBS1="TANGENT_BS1",t.TangentBS2="TANGENT_BS2",t.TangentBS3="TANGENT_BS3"}(Oe||(Oe={}));var Ne=Dt.LATEST,Pe=Object.freeze({__proto__:null,LATEST_VERSION:Ne,get RenderLevel(){return kt},get BlendingMode(){return zt},get SideMode(){return Ut},get ObscuredMode(){return Bt},get ParticleEmitterShapeType(){return Gt},get PluginType(){return jt},get InteractType(){return Xt},get InteractBehavior(){return Ht},get ItemType(){return Wt},get RenderMode(){return Yt},get ParticleOrigin(){return Zt},get RenderType(){return qt},get RenderFace(){return Kt},get CameraClipMode(){return te},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:ye,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:ge,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:xe,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return ee},get BezierKeyframeType(){return ie},get JSONSceneVersion(){return Dt},get EndBehavior(){return re},get ParticleInteractionBehavior(){return ne},get ShapeArcMode(){return ae},get LightType(){return se},get ModelBoundingType(){return oe},get CameraType(){return ue},get MaterialType(){return he},get MaterialBlending(){return le},get RenderMode3D(){return ce},get TextOverflow(){return fe},get TextBaseline(){return de},get TextAlignment(){return pe},get TextWeight(){return me},get FontStyle(){return ve},BuiltinObjectGUID:Me,get ShapePrimitiveType(){return be},get LineCap(){return Te},get LineJoin(){return Ee},get NodeDataType(){return _e},get BackgroundType(){return we},get MultimediaType(){return Ce},get DataType(){return Ae},get GeometryType(){return Se},get VertexFormatType(){return Ie},get IndexFormatType(){return Re},get VertexBufferSemantic(){return Oe}}),Fe=new Map,Le=new Map,Ve={};function De(t){return Ve[t]}function ke(t){return function(e,i){Ve[t]&&console.warn("Class "+t+" is already registered."),Ve[t]=e}}function ze(t,e){return function(t,e){return function(i,r){var n=function(t){var e=t.constructor;Fe.get(e)||Fe.set(e,{});return Fe.get(e)}(i);n&&(n[r]||(n[r]={type:t,sourceName:e}))}}(t,e)}function Ue(t){var e=t.constructor;if(Le.get(e))return Le.get(e);var i={};Le.set(e,i);for(var r=t,n=e;n;){var a=Fe.get(n);for(var s in a)i[s]=a[s];var o=Object.getPrototypeOf(r);if((n=Object.getPrototypeOf(o).constructor)===Object)break;r=o}return i}var Be=function(){function t(t){this.engine=t,this.guid=At(),this.defination={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){},e.dispose=function(){},t.is=function(e){return C(e,t)&&"guid"in e},t}(),Ge=function(){function t(){this.resources=[]}return t.prototype.getResource=function(t){return this.resources[t]},t}(),je={};function Xe(t){return function(e,i){je[t]&&console.warn("NodeData Class "+t+" is already registered."),je[t]=e}}function He(t){return je[t]}var We,Ye=-1,Ze=function(){function t(){this.initializationCount=0,this.lastUpdateID=-1}var e=t.prototype;return e.getNodeData=function(){return this.asset},e.isValid=function(){return!0},e.isInitialized=function(){return this.initializationCount>0},e.initialize=function(t){this.isInitialized()?this.initializationCount++:this.initializeInternal(t)},e.shutdown=function(t){if(!this.isInitialized())throw new Error("Node not initialized!");0==--this.initializationCount&&this.shutdownInternal(t)},e.isNodeActive=function(t){return this.lastUpdateID===t},e.isUpdated=function(t){return this.isNodeActive(t.updateID)},e.markNodeActive=function(t){this.lastUpdateID=t.updateID},e.initializeInternal=function(t){this.initializationCount++},e.shutdownInternal=function(t){if(this.isInitialized())throw new Error("Node still initialized!");this.lastUpdateID=-1},t}(),qe=function(){function t(){}var e=t.prototype;return e.load=function(t){this.index=t.index},e.createNode=function(t,e){var i=new t;return e.nodes[this.index]=i,i},t}(),Ke=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.previousTime=0,e.currentTime=0,e}$t(e,t);var i=e.prototype;return i.getCurrentTime=function(){return this.currentTime},i.getPreviousTime=function(){return this.previousTime},i.getDuration=function(){return this.duration},i.getDebugInfo=function(){return{duration:this.duration,currentTime:this.currentTime,previousTime:this.previousTime}},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.previousTime=0,this.currentTime=this.previousTime,this.duration=0},e}(Ze),Qe=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.setValue=function(t){},e}(Ze),Je=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qe),$e=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qe),ti=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).nodeDatas=[],e.graphDataSet=new Ge,e.controlParameterIDs=[],e.parameterLookupMap=new Map,e.rootNodeIndex=Ye,e}return $t(e,t),e.prototype.fromData=function(t){var i=t,r=i.nodeDatas;this.rootNodeIndex=i.rootNodeIndex,this.controlParameterIDs=i.controlParameterIDs;for(var n=i.controlParameterIDs.length,a=0;a<n;a++)this.parameterLookupMap.set(i.controlParameterIDs[a],a);this.nodeDatas=[];for(var s=0;s<r.length;s++)this.nodeDatas[s]=e.createNodeData(r[s].type),this.nodeDatas[s].load(r[s]);this.graphDataSet=new Ge,this.graphDataSet.resources=[];for(var o,u=w(i.graphDataSet.resources);!(o=u()).done;){var h=o.value,l=this.engine.findObject(h);this.graphDataSet.resources.push(l)}},e.createNodeData=function(t){var e=He(t);if(e)return new e;throw new Error("Unknown node type: "+t+".")},e}(Be);ti=S([ke("AnimationGraphAsset")],ti),function(t){t[t.Active=0]="Active",t[t.Inactive=1]="Inactive"}(We||(We={}));var ei=function(){function t(){this.deltaTime=0,this.updateID=0,this.branchState=0}return t.prototype.update=function(t){this.deltaTime=t,this.updateID++,this.branchState=0},t}(),ii=function(){function t(){this.nodeDatas=[],this.nodes=[]}return t.prototype.getNode=function(t){return this.nodes[t]?this.nodes[t]:this.nodeDatas[t]?(this.nodeDatas[t].instantiate(this),this.nodes[t].asset=this.nodeDatas[t],this.nodes[t]):null},t}();function ri(){return ri=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},ri.apply(this,arguments)}var ni=2*Math.PI,ai=Math.PI/180,si=180/Math.PI,oi=1e-6;function ui(t,e){return Math.abs(t-e)<oi||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var hi=function(t,e,i){return(1-i)*t+i*e};function li(t,e,i){var r=isNaN(e)?-1/0:e,n=isNaN(i)?1/0:i,a=Math.min(r,n),s=Math.max(r,n);return Math.min(Math.max(t,a),s)}var ci=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).playRate=1,e.loopAnimation=!0,e.dataSlotIndex=-1,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(di,t).animation=t.dataSet.getResource(this.dataSlotIndex)},i.load=function(e){t.prototype.load.call(this,e);var i=ri({playRate:1,loopAnimation:!0},e);this.dataSlotIndex=e.dataSlotIndex,this.playRate=i.playRate,this.loopAnimation=i.loopAnimation},e}(qe);ci=S([Xe(_e.AnimationClipNodeData)],ci);var fi,di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).animation=null,e.animatable=null,e}$t(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(!this.animatable)return e;this.markNodeActive(t);var i=this.getNodeData();this.previousTime=this.currentTime,this.currentTime=this.previousTime+t.deltaTime/this.duration*i.playRate,i.loopAnimation?this.currentTime>1&&(this.currentTime=this.currentTime%1):this.currentTime=li(this.currentTime,0,1);var r=this.currentTime*this.duration;return this.animatable.getPose(r,e.pose),e},i.initializeInternal=function(e){var i,r;t.prototype.initializeInternal.call(this,e),this.duration=null!=(r=null==(i=this.animation)?void 0:i.duration)?r:0,this.previousTime=this.currentTime=0,this.animation&&(this.animatable=new pi(e.skeleton,this.animation))},e}(Ke);!function(t){t[t.Position=0]="Position",t[t.Scale=1]="Scale",t[t.Rotation=2]="Rotation",t[t.Euler=3]="Euler"}(fi||(fi={}));var pi=function(){function t(t,e){this.skeleton=t,this.animationClip=e,this.transformCurveInfos=[],this.floatCurveInfos=[],this.colorCurveInfos=[];for(var i,r=w(e.positionCurves);!(i=r()).done;){var n=i.value;this.addTransformCurveInfo(n,0)}for(var a,s=w(e.scaleCurves);!(a=s()).done;){var o=a.value;this.addTransformCurveInfo(o,1)}for(var u,h=w(e.rotationCurves);!(u=h()).done;){var l=u.value;this.addTransformCurveInfo(l,2)}for(var c,f=w(e.eulerCurves);!(c=f()).done;){var d=c.value;this.addTransformCurveInfo(d,3)}for(var p,m=w(e.floatCurves);!(p=m()).done;){var v=p.value;this.addFloatCurveInfo(v)}for(var y,g=w(e.colorCurves);!(y=g()).done;){var x=y.value;this.addColorCurveInfo(x)}}var e=t.prototype;return e.getPose=function(t,e){for(var i,r=li(t,0,this.animationClip.duration),n=w(this.transformCurveInfos);!(i=n()).done;){var a=i.value,s=a.curve.keyFrames.getValue(r),o=e.parentSpaceTransforms[a.boneIndex];switch(a.type){case 0:o.position.copyFrom(s);break;case 1:o.scale.copyFrom(s);break;case 2:o.rotation.copyFrom(s);break;case 3:o.euler.copyFrom(s)}}for(var u,h=w(this.floatCurveInfos);!(u=h()).done;){var l=u.value,c=l.curve.keyFrames.getValue(r);e.floatPropertyValues[l.animatedObjectIndex]=c}for(var f,d=w(this.colorCurveInfos);!(f=d()).done;){var p=f.value,m=p.curve.keyFrames.getValue(r);e.colorPropertyValues[p.animatedObjectIndex]=m}},e.addTransformCurveInfo=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t.path);void 0!==i&&this.transformCurveInfos.push({curve:t,boneIndex:i,type:e})},e.addFloatCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.floatCurveInfos.push({curve:t,animatedObjectIndex:e})},e.addColorCurveInfo=function(t){var e=this.skeleton.pathToObjectIndex.get(t.path+t.className+t.property);void 0!==e&&this.colorCurveInfos.push({curve:t,animatedObjectIndex:e})},t}(),mi=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}var e=t.prototype;return e.set=function(t,e){return this.x=t,this.y=e,this},e.setZero=function(){return this.x=0,this.y=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this},e.setFromArray=function(t,e){var i,r;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},e.clone=function(){return new t(this.x,this.y)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):C(t,Array)?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):C(t,Array)?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):C(t,Array)?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):C(t,Array)?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},e.scale=function(t){return this.x*=t,this.y*=t,this},e.sum=function(){return this.x+this.y},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y},e.cross=function(t){return this.x*t.y-this.y*t.x},e.distance=function(t){var e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y;return e*e+i*i},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=oi,e=this.x,i=this.y;return Math.abs(e)<=t&&Math.abs(i)<=t},e.toArray=function(){return[this.x,this.y]},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();mi.ONE=new mi(1,1),mi.ZERO=new mi(0,0);var vi=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=i}var e=t.prototype;return e.set=function(t,e,i){return this.x=t,this.y=e,this.z=i,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},e.setFromArray=function(t,e){var i,r,n;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},e.clone=function(){return new t(this.x,this.y,this.z)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):C(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):C(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):C(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):C(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},e.sum=function(){return this.x+this.y+this.z},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.cross=function(t){return this.crossVectors(this,t)},e.crossVectors=function(t,e){var i=t.x,r=t.y,n=t.z,a=e.x,s=e.y,o=e.z;return this.x=r*o-n*s,this.y=n*a-i*o,this.z=i*s-r*a,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=oi,e=this,i=e.x,r=e.y,n=e.z;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new mi(this.x,this.y)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},e.applyEuler=function(t,e){return t.rotateVector3(this,e)},e.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},e.applyMatrix=function(t,e){return t.transformPoint(this,e)},e.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},e.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();vi.X=new vi(1,0,0),vi.Y=new vi(0,1,0),vi.Z=new vi(0,0,1),vi.ONE=new vi(1,1,1),vi.ZERO=new vi(0,0,0);var yi=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,i){var r=i/2,n=Math.sin(r),a=t.tempVec0;return a.copyFrom(e).normalize(),this.x=a.x*n,this.y=a.y*n,this.z=a.z*n,this.w=Math.cos(r),this},e.setFromVector4=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},e.setFromRotationMatrix=function(t){var e=t.elements,i=e[0],r=e[4],n=e[8],a=e[1],s=e[5],o=e[9],u=e[2],h=e[6],l=e[10],c=i+s+l;if(c>0){var f=.5/Math.sqrt(c+1);this.w=.25/f,this.x=(h-o)*f,this.y=(n-u)*f,this.z=(a-r)*f}else if(i>s&&i>l){var d=2*Math.sqrt(1+i-s-l);this.w=(h-o)/d,this.x=.25*d,this.y=(r+a)/d,this.z=(n+u)/d,this.negate()}else if(s>l){var p=2*Math.sqrt(1+s-i-l);this.w=(n-u)/p,this.x=(r+a)/p,this.y=.25*p,this.z=(o+h)/p,this.negate()}else{var m=2*Math.sqrt(1+l-i-s);this.w=(a-r)/m,this.x=(n+u)/m,this.y=(o+h)/m,this.z=.25*m,this.negate()}return this},e.setFromUnitVectors=function(t,e){var i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=i):(this.x=0,this.y=-t.z,this.z=t.y,this.w=i)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=i),this.normalize()},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.angleTo=function(t){return 2*Math.acos(Math.abs(li(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var i=this.angleTo(t);if(0===i)return this;var r=Math.min(1,e/i);return this.slerp(t,r),this},e.identity=function(){return this.set(0,0,0,1)},e.invert=function(){return this.conjugate()},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},e.multiply=function(t){return this.multiplyQuaternions(this,t)},e.premultiply=function(t){return this.multiplyQuaternions(t,this)},e.multiplyQuaternions=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,s=e.x,o=e.y,u=e.z,h=e.w;return this.x=i*h+a*s+r*u-n*o,this.y=r*h+a*o+n*s-i*u,this.z=n*h+a*u+i*o-r*s,this.w=a*h-i*s-r*o-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var i=this,r=i.x,n=i.y,a=i.z,s=i.w,o=s*t.w+r*t.x+n*t.y+a*t.z;if(o<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,o=-o):this.copyFrom(t),o>=1)return this.w=s,this.x=r,this.y=n,this.z=a,this;var u=1-o*o;if(u<=Number.EPSILON){var h=1-e;return this.w=h*s+e*this.w,this.x=h*r+e*this.x,this.y=h*n+e*this.y,this.z=h*a+e*this.z,this.normalize(),this}var l=Math.sqrt(u),c=Math.atan2(l,o),f=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this.w=s*f+this.w*d,this.x=r*f+this.x*d,this.y=n*f+this.y*d,this.z=a*f+this.z*d,this},e.slerpQuaternions=function(t,e,i){this.copyFrom(t).slerp(e,i)},e.rotateVector3=function(t,e){var i=this,r=i.x,n=i.y,a=i.z,s=i.w,o=t.x,u=t.y,h=t.z,l=s*o+n*h-a*u,c=s*u+a*o-r*h,f=s*h+r*u-n*o,d=-r*o-n*u-a*h,p=null!=e?e:t;return p.x=l*s+d*-r+c*-a-f*-n,p.y=c*s+d*-n+f*-r-l*-a,p.z=f*s+d*-a+l*-n-c*-r,p},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(vi.ZERO,this,vi.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,i){return(new t).setFromAxisAngle(e,i)},t.fromVector4=function(e){return(new t).setFromVector4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromRotationMatrix=function(e){return(new t).setFromRotationMatrix(e)},t.fromUnitVectors=function(e,i){return(new t).setFromUnitVectors(e,i)},t}();yi.tempVec0=new vi;var gi=new yi,xi=function(){},bi=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+(e.x-t.x)*i,r.y=t.y+(e.y-t.y)*i,r.z=t.z+(e.z-t.z)*i},i.blendQuaternion=function(t,e,i,r){r.copyFrom(t).slerp(e,i)},i.blendEuler=function(t,e,i,r){this.lerpEuler(t,e,i,r)},i.blendFloat=function(t,e,i){return t+(e-t)*i},i.blendColor=function(t,e,i,r){r.r=t.r+(e.r-t.r)*i,r.g=t.g+(e.g-t.g)*i,r.b=t.b+(e.b-t.b)*i,r.a=t.a+(e.a-t.a)*i},i.lerpEuler=function(t,e,i,r){r.x=this.lerpAngle(t.x,e.x,i),r.y=this.lerpAngle(t.y,e.y,i),r.z=this.lerpAngle(t.z,e.z,i)},i.normalizeAngle=function(t){return(t%360+360)%360},i.shortestAngleDiff=function(t,e){var i=this.normalizeAngle(e)-this.normalizeAngle(t);return i>180&&(i-=360),i<-180&&(i+=360),i},i.lerpAngle=function(t,e,i){var r=this.shortestAngleDiff(t,e);return this.normalizeAngle(t+r*i)},e}(xi),Ti=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.blendVector3=function(t,e,i,r){r.x=t.x+e.x*i,r.y=t.y+e.y*i,r.z=t.z+e.z*i},i.blendQuaternion=function(t,e,i,r){var n=gi.copyFrom(t).multiply(e);r.copyFrom(t).slerp(n,i)},i.blendEuler=function(t,e,i,r){this.blendVector3(t,e,i,r)},i.blendFloat=function(t,e,i){return t+e*i},i.blendColor=function(t,e,i,r){r.r=t.r+e.r*i,r.g=t.g+e.g*i,r.b=t.b+e.b*i,r.a=t.a+e.a*i},e}(xi),Ei=function(){function t(){}return t.localBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.normalBlendFunction)},t.additiveBlend=function(e,i,r,n){t.localBlendInternal(e,i,r,n,t.additiveBlendFunction)},t.localBlendInternal=function(t,e,i,r,n){for(var a=0;a<t.parentSpaceTransforms.length;a++){var s=t.parentSpaceTransforms[a],o=e.parentSpaceTransforms[a],u=r.parentSpaceTransforms[a],h=s.position,l=o.position,c=u.position;n.blendVector3(h,l,i,c);var f=s.rotation,d=o.rotation,p=u.rotation;n.blendQuaternion(f,d,i,p);var m=s.scale,v=o.scale,y=u.scale;n.blendVector3(m,v,i,y);var g=s.euler,x=o.euler,b=u.euler;n.blendEuler(g,x,i,b)}for(var T=0;T<t.floatPropertyValues.length;T++){var E=t.floatPropertyValues[T],_=e.floatPropertyValues[T];r.floatPropertyValues[T]=n.blendFloat(E,_,i)}for(var w=0;w<t.colorPropertyValues.length;w++){var C=t.colorPropertyValues[w],A=e.colorPropertyValues[w],S=r.colorPropertyValues[w];n.blendColor(C,A,i,S)}},t}();Ei.normalBlendFunction=new bi,Ei.additiveBlendFunction=new Ti;var _i=function(){function t(t){this.position=new vi,this.rotation=new yi,this.scale=new vi,this.euler=new vi,t&&(this.position.copyFrom(t.position),this.rotation.copyFrom(t.quat),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.rotation))}return t.prototype.copyFrom=function(t){return this.position.copyFrom(t.position),this.rotation.copyFrom(t.rotation),this.scale.copyFrom(t.scale),this.euler.copyFrom(t.euler),this},t}(),wi=function(){function t(t){this.skeleton=t,this.parentSpaceTransforms=[],this.floatPropertyValues=[],this.colorPropertyValues=[];for(var e,i=w(t.parentSpaceTransforms);!(e=i()).done;){var r=e.value;this.parentSpaceTransforms.push((new _i).copyFrom(r))}for(var n,a=w(t.defaultFloatPropertyValues);!(n=a()).done;){var s=n.value;this.floatPropertyValues.push(s)}for(var o,u=w(t.defaultColorPropertyValues);!(o=u()).done;){var h=o.value;this.colorPropertyValues.push(h)}}var e=t.prototype;return e.setPosition=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].position.copyFrom(e)},e.setRotation=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].rotation.copyFrom(e)},e.setEuler=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].euler.copyFrom(e)},e.setScale=function(t,e){var i=this.skeleton.pathToBoneIndex.get(t);void 0!==i&&this.parentSpaceTransforms[i].scale.copyFrom(e)},e.setFloat=function(t,e){var i=this.skeleton.pathToObjectIndex.get(t);void 0!==i&&(this.floatPropertyValues[i]=e)},e.copyFrom=function(t){for(var e=0;e<this.parentSpaceTransforms.length;e++)this.parentSpaceTransforms[e].copyFrom(t.parentSpaceTransforms[e]);for(var i=0;i<this.colorPropertyValues.length;i++)this.colorPropertyValues[i].copyFrom(t.colorPropertyValues[i]);for(var r=0;r<this.floatPropertyValues.length;r++)this.floatPropertyValues[r]=t.floatPropertyValues[r]},t}(),Ci=function(t){this.pose=new wi(t)},Ai=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Si,t);e.baseNode=t.getNode(this.baseNodeIndex),e.additiveNode=t.getNode(this.additiveNodeIndex),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.baseNodeIndex=e.baseNodeIndex,this.additiveNodeIndex=e.additiveNodeIndex,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(qe);Ai=S([Xe(_e.ApplyAdditiveNodeData)],Ai);var Si=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNode=null,e.additiveNode=null,e.inputParameterValueNode=null,e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.baseNodeResult=new Ci(e.skeleton),this.additiveNodeResult=new Ci(e.skeleton),null==(i=this.baseNode)||i.initialize(e),null==(r=this.additiveNode)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.baseNode)||i.shutdown(e),null==(r=this.additiveNode)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.baseNode&&!this.additiveNode?(this.baseNode.evaluate(t,this.baseNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)):this.baseNode&&this.additiveNode&&(this.baseNode.evaluate(t,this.baseNodeResult),this.additiveNode.evaluate(t,this.additiveNodeResult),this.applyAdditive(this.baseNodeResult.pose,this.additiveNodeResult.pose,i,e.pose)),e},i.applyAdditive=function(t,e,i,r){Ei.additiveBlend(t,e,i,r)},e}(Ke),Ii=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Ri,t);e.source0=t.getNode(this.sourceNodeIndex0),e.source1=t.getNode(this.sourceNodeIndex1),e.inputParameterValueNode=t.getNode(this.inputParameterValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.sourceNodeIndex0=e.sourceNodeIndex0,this.sourceNodeIndex1=e.sourceNodeIndex1,this.inputParameterValueNodeIndex=e.inputParameterValueNodeIndex},e}(qe);Ii=S([Xe(_e.BlendNodeData)],Ii);var Ri=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).source0=null,e.source1=null,e.inputParameterValueNode=null,e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i,r,n;t.prototype.initializeInternal.call(this,e),this.source0Result=new Ci(e.skeleton),this.source1Result=new Ci(e.skeleton),null==(i=this.source0)||i.initialize(e),null==(r=this.source1)||r.initialize(e),null==(n=this.inputParameterValueNode)||n.initialize(e)},i.shutdownInternal=function(e){var i,r,n;null==(i=this.source0)||i.shutdown(e),null==(r=this.source1)||r.shutdown(e),null==(n=this.inputParameterValueNode)||n.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){if(!this.inputParameterValueNode)return e;this.markNodeActive(t);var i=this.inputParameterValueNode.getValue(t);return this.source0&&!this.source1?(this.source0.evaluate(t,this.source0Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)):this.source0&&this.source1&&(this.source0.evaluate(t,this.source0Result),this.source1.evaluate(t,this.source1Result),this.localBlend(this.source0Result.pose,this.source1Result.pose,i,e.pose)),e},i.localBlend=function(t,e,i,r){Ei.localBlend(t,e,i,r)},e}(Ke),Oi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(Mi,t),r=w(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(qe);Oi=S([Xe(_e.AndNodeData)],Oi);var Mi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!0;for(var e,i=w(this.conditionNodes);!(e=i()).done;){if(!e.value.getValue(t)){this.result=!1;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=w(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=w(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}($e),Ni=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodeIndices=[],e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){for(var e,i=this.createNode(Pi,t),r=w(this.conditionNodeIndices);!(e=r()).done;){var n=e.value;i.conditionNodes.push(t.getNode(n))}},i.load=function(e){t.prototype.load.call(this,e),this.conditionNodeIndices=e.conditionNodeIndices},e}(qe);Ni=S([Xe(_e.OrNodeData)],Ni);var Pi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).conditionNodes=[],e.result=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){if(!this.isUpdated(t)){this.markNodeActive(t),this.result=!1;for(var e,i=w(this.conditionNodes);!(e=i()).done;){if(e.value.getValue(t)){this.result=!0;break}}}return this.result},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e);for(var i,r=w(this.conditionNodes);!(i=r()).done;){i.value.initialize(e)}this.result=!1},i.shutdownInternal=function(e){for(var i,r=w(this.conditionNodes);!(i=r()).done;){i.value.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},e}($e),Fi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Ye,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Li,t).inputValueNode=t.getNode(this.inputValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex},e}(qe);Fi=S([Xe(_e.NotNodeData)],Fi);var Li=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.result=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||(this.markNodeActive(t),this.inputValueNode&&(this.result=!this.inputValueNode.getValue(t))),this.result},i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),null==(i=this.inputValueNode)||i.initialize(e),this.result=!1},i.shutdownInternal=function(e){var i;null==(i=this.inputValueNode)||i.shutdown(e),t.prototype.shutdownInternal.call(this,e)},e}($e),Vi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Di,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(qe);Vi=S([Xe(_e.ConstFloatNodeData)],Vi);var Di=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}return $t(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}(Je),ki=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(zi,t).value=this.value},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(qe);ki=S([Xe(_e.ConstBoolNodeData)],ki);var zi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!0,e}return $t(e,t),e.prototype.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},e}($e),Ui=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Bi,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(qe);Ui=S([Xe(_e.ControlParameterFloatNodeData)],Ui);var Bi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=0,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}(Je),Gi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(ji,t).setValue(this.value)},i.load=function(e){t.prototype.load.call(this,e),this.value=e.value},e}(qe);Gi=S([Xe(_e.ControlParameterBoolNodeData)],Gi);var ji=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}($e),Xi=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(Hi,t)},i.load=function(e){t.prototype.load.call(this,e)},e}(qe);Xi=S([Xe(_e.ControlParameterTriggerNodeData)],Xi);var Hi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=!1,e}$t(e,t);var i=e.prototype;return i.getValue=function(t){return this.isUpdated(t)||this.markNodeActive(t),this.value},i.setValue=function(t){this.value=t},e}($e),Wi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseNodeIndex=Ye,e.layerDatas=[],e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Yi,t);e.baseLayerNode=t.getNode(this.baseNodeIndex);for(var i,r=w(this.layerDatas);!(i=r()).done;){var n=i.value;e.layers.push({inputNode:t.getNode(n.inputNodeIndex),weightValueNode:t.getNode(n.weightValueNodeIndex),weight:0})}},i.load=function(e){var i;if(t.prototype.load.call(this,e),this.baseNodeIndex=null!=(i=e.baseNodeIndex)?i:Ye,e.layerDatas)for(var r,n=w(e.layerDatas);!(r=n()).done;){var a=r.value;this.layerDatas.push(ri({inputNodeIndex:Ye,weightValueNodeIndex:Ye},a))}},e}(qe);Wi=S([Xe(_e.LayerBlendNodeData)],Wi);var Yi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).baseLayerNode=null,e.layers=[],e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){var i;t.prototype.initializeInternal.call(this,e),this.layerNodeResult=new Ci(e.skeleton),null==(i=this.baseLayerNode)||i.initialize(e);for(var r,n=w(this.layers);!(r=n()).done;){var a,s,o=r.value;null==(a=o.inputNode)||a.initialize(e),null==(s=o.weightValueNode)||s.initialize(e)}},i.shutdownInternal=function(e){var i;null==(i=this.baseLayerNode)||i.shutdown(e);for(var r,n=w(this.layers);!(r=n()).done;){var a,s,o=r.value;null==(a=o.inputNode)||a.shutdown(e),null==(s=o.weightValueNode)||s.shutdown(e)}t.prototype.shutdownInternal.call(this,e)},i.evaluate=function(t,e){return this.baseLayerNode&&this.baseLayerNode.isValid()?(this.markNodeActive(t),this.previousTime=this.baseLayerNode.getCurrentTime(),e=this.baseLayerNode.evaluate(t,e),this.currentTime=this.baseLayerNode.getCurrentTime(),this.duration=this.baseLayerNode.getDuration(),this.updateLayers(t,e),e):e},i.updateLayers=function(t,e){for(var i,r=w(this.layers);!(i=r()).done;){var n=i.value;if(n.inputNode&&n.weightValueNode){this.layerNodeResult.pose.copyFrom(e.pose),n.inputNode.evaluate(t,this.layerNodeResult);var a=n.weightValueNode.getValue(t);Ei.localBlend(e.pose,this.layerNodeResult.pose,a,e.pose)}}return e},e}(Ke),Zi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Ye,e.comparandValueNodeIndex=Ye,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(Ki,t);e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(qe);Zi=S([Xe(_e.EqualNodeData)],Zi);var qi,Ki=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.result=!1,e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);this.result=e===i}return this.result},e}($e),Qi=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNodeIndex=Ye,e.comparandValueNodeIndex=Ye,e}return $t(e,t),e.prototype.load=function(e){t.prototype.load.call(this,e),this.inputValueNodeIndex=e.inputValueNodeIndex,this.comparandValueNodeIndex=e.comparandValueNodeIndex},e}(qe);!function(t){t[t.GreaterThan=0]="GreaterThan",t[t.LessThan=1]="LessThan"}(qi||(qi={}));var Ji=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).inputValueNode=null,e.comparandValueNode=null,e.comparison=0,e.result=!1,e}$t(e,t);var i=e.prototype;return i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.inputValueNode&&this.inputValueNode.initialize(e),this.comparandValueNode&&this.comparandValueNode.initialize(e)},i.shutdownInternal=function(e){this.inputValueNode&&this.inputValueNode.shutdown(e),this.comparandValueNode&&this.comparandValueNode.shutdown(e),t.prototype.shutdownInternal.call(this,e)},i.getValue=function(t){if(!this.isUpdated(t)&&(this.markNodeActive(t),this.inputValueNode&&this.comparandValueNode)){var e=this.inputValueNode.getValue(t),i=this.comparandValueNode.getValue(t);switch(this.comparison){case 0:this.result=e>i;break;case 1:this.result=e<i}}return this.result},e}($e),$i=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.instantiate=function(t){var e=this.createNode(Ji,t);e.comparison=0,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(Qi);$i=S([Xe(_e.GreaterNodeData)],$i);var tr=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.instantiate=function(t){var e=this.createNode(Ji,t);e.comparison=1,e.inputValueNode=t.getNode(this.inputValueNodeIndex),e.comparandValueNode=t.getNode(this.comparandValueNodeIndex)},e}(Qi);tr=S([Xe(_e.LessNodeData)],tr);var er=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(rr,t);e.defaultStateIndex=this.defaultStateIndex;for(var i,r=w(this.stateDatas);!(i=r()).done;){var n=i.value,a={stateNode:t.getNode(n.stateNodeIndex),transitions:[]};e.states.push(a);for(var s,o=w(n.transitionDatas);!(s=o()).done;){var u=s.value,h={transitionNode:t.getNode(u.transitionNodeIndex),conditionNode:t.getNode(u.conditionNodeIndex),targetStateIndex:u.targetStateIndex};a.transitions.push(h)}}},i.load=function(e){t.prototype.load.call(this,e),this.stateDatas=e.stateDatas,this.defaultStateIndex=e.defaultStateIndex},e}(qe);er=S([Xe(_e.StateMachineNodeData)],er);var ir,rr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).states=[],e.defaultStateIndex=Ye,e.activeTransition=null,e.activeStateIndex=Ye,e}$t(e,t);var i=e.prototype;return i.evaluate=function(t,e){if(this.markNodeActive(t),null!==this.activeTransition&&this.activeTransition.isComplete(t)&&(this.activeTransition.shutdown(t),this.activeTransition=null),null===this.activeTransition){var i=this.states[this.activeStateIndex].stateNode;e=i.evaluate(t,e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime()}else e=this.activeTransition.evaluate(t,e),this.duration=this.activeTransition.getDuration(),this.previousTime=this.activeTransition.getPreviousTime(),this.currentTime=this.activeTransition.getCurrentTime();return t.branchState===We.Active&&this.evaluateTransitions(t,e),e},i.evaluateTransitions=function(t,e){for(var i=this.states[this.activeStateIndex],r=Ye,n=i.transitions.length,a=0;a<n;a++){var s=i.transitions[a];if(s.targetStateIndex===Ye)throw new Error("Invalid target state index.");if(!this.states[s.targetStateIndex].stateNode.isTransitioning()){var o=!1;if(s.transitionNode.hasExitTime){var u=i.stateNode;u.getElapsedTimeInState()/u.getDuration()>s.transitionNode.exitTime&&(o=!0)}else null!==s.conditionNode&&s.conditionNode.getValue(t)&&(o=!0);if(o){r=a;break}}}if(r!==Ye){var h=i.transitions[r];h.transitionNode.initialize(t),e=null!==this.activeTransition?h.transitionNode.startTransitionFromTransition(t,e,this.activeTransition,e):h.transitionNode.startTransitionFromState(t,e,this.states[this.activeStateIndex].stateNode,e),this.activeTransition=h.transitionNode,this.shutdownTransitionConditions(t),this.activeStateIndex=h.targetStateIndex,this.initializeTransitionConditions(t),this.duration=this.states[this.activeStateIndex].stateNode.getDuration(),this.previousTime=this.states[this.activeStateIndex].stateNode.getPreviousTime(),this.currentTime=this.states[this.activeStateIndex].stateNode.getCurrentTime()}},i.selectDefaultState=function(t){return this.defaultStateIndex},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.activeStateIndex=this.selectDefaultState(e);var i=this.states[this.activeStateIndex].stateNode;i.initialize(e),this.duration=i.getDuration(),this.previousTime=i.getPreviousTime(),this.currentTime=i.getCurrentTime(),this.initializeTransitionConditions(e)},i.shutdownInternal=function(e){null!==this.activeTransition&&this.activeTransition.shutdown(e),this.shutdownTransitionConditions(e),this.states[this.activeStateIndex].stateNode.shutdown(e),this.activeStateIndex=Ye,this.activeTransition=null,t.prototype.shutdownInternal.call(this,e)},i.initializeTransitionConditions=function(t){for(var e,i=w(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.initialize(t)}},i.shutdownTransitionConditions=function(t){for(var e,i=w(this.states[this.activeStateIndex].transitions);!(e=i()).done;){var r=e.value;null!==r.conditionNode&&r.conditionNode.shutdown(t)}},e}(Ke);!function(t){t[t.None=0]="None",t[t.TransitioningIn=1]="TransitioningIn",t[t.TransitioningOut=2]="TransitioningOut"}(ir||(ir={}));var nr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNodeIndex=Ye,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){this.createNode(sr,t).childNode=t.getNode(this.childNodeIndex)},i.load=function(e){t.prototype.load.call(this,e),this.childNodeIndex=e.childNodeIndex},e}(qe);nr=S([Xe(_e.StateNodeData)],nr);var ar,sr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).childNode=null,e.transitionState=0,e.elapsedTimeInState=0,e.isFirstStateUpdate=!1,e}$t(e,t);var i=e.prototype;return i.isTransitioning=function(){return 0!==this.transitionState},i.isTransitioningIn=function(){return 1===this.transitionState},i.isTransitioningOut=function(){return 2===this.transitionState},i.startTransitionIn=function(t){this.transitionState=1},i.startTransitionOut=function(t){this.transitionState=2},i.setTransitioningState=function(t){this.transitionState=t},i.getElapsedTimeInState=function(){return this.elapsedTimeInState},i.evaluate=function(t,e){return this.markNodeActive(t),null!==this.childNode&&this.childNode.isValid()&&(e=this.childNode.evaluate(t,e),this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime()),this.elapsedTimeInState+=t.deltaTime,this.isFirstStateUpdate=!1,e},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.transitionState=0,this.elapsedTimeInState=0,this.previousTime=this.currentTime=0,this.duration=0,null!==this.childNode&&(this.childNode.initialize(e),this.childNode.isValid()&&(this.duration=this.childNode.getDuration(),this.previousTime=this.childNode.getPreviousTime(),this.currentTime=this.childNode.getCurrentTime())),this.isFirstStateUpdate=!0},i.shutdownInternal=function(e){null!==this.childNode&&this.childNode.shutdown(e),this.transitionState=0,t.prototype.shutdownInternal.call(this,e)},e}(Ke);!function(t){t[t.State=0]="State",t[t.Transition=1]="Transition",t[t.CachedPose=2]="CachedPose"}(ar||(ar={}));var or=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.hasExitTime=!1,e.exitTime=.75,e.targetStateNodeIndex=Ye,e}$t(e,t);var i=e.prototype;return i.instantiate=function(t){var e=this.createNode(hr,t);e.targetNode=t.getNode(this.targetStateNodeIndex),e.hasExitTime=this.hasExitTime,e.exitTime=this.exitTime},i.load=function(e){t.prototype.load.call(this,e),this.duration=e.duration,this.hasExitTime=e.hasExitTime,this.exitTime=e.exitTime,this.targetStateNodeIndex=e.targetStateNodeIndex},e}(qe);or=S([Xe(_e.TransitionNodeData)],or);var ur,hr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).hasExitTime=!1,e.exitTime=.75,e.transitionLength=0,e.transitionProgress=0,e.blendWeight=0,e.sourceNode=null,e.sourceType=0,e.blendedDuration=0,e}$t(e,t);var i=e.prototype;return i.evaluate=function(t,e){ut(this.sourceNode),this.markNodeActive(t),this.isSourceATransition()&&this.getSourceTransitionNode().isComplete(t)&&this.endSourceTransition(t),this.transitionProgress=this.transitionProgress+t.deltaTime/this.transitionLength,this.transitionProgress=li(this.transitionProgress,0,1),this.calculateBlendWeight();var i=this.sourceNodeResult,r=t.branchState;t.branchState=We.Inactive,i=this.sourceNode.evaluate(t,i),t.branchState=r;var n=this.targetNode.evaluate(t,this.targetNodeResult),a=e;if(this.registerPoseTasksAndUpdateRootMotion(i,n,a),this.blendedDuration=hi(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.blendedDuration>0){var s=t.deltaTime/this.blendedDuration;this.previousTime=this.currentTime,this.currentTime=(this.currentTime+s)%1}else this.previousTime=this.currentTime=1;return this.duration=this.targetNode.getDuration(),a},i.isComplete=function(t){return this.transitionLength<=0||this.transitionProgress+t.deltaTime/this.transitionLength>=1},i.getProgressPercentage=function(){return this.transitionProgress},i.getSourceType=function(){return this.sourceType},i.isSourceATransition=function(){return 1===this.sourceType},i.isSourceAState=function(){return 0===this.sourceType},i.startTransitionFromState=function(t,e,i,r){return this.sourceNode=i,this.sourceType=0,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.startTransitionFromTransition=function(t,e,i,r){return this.sourceNode=i,this.sourceType=1,this.initializeTargetStateAndUpdateTransition(t,e,r)},i.getSourceStateNode=function(){return this.sourceNode},i.getSourceTransitionNode=function(){return this.sourceNode},i.notifyNewTransitionStarting=function(t,e){if(this.isSourceATransition()){var i=this.getSourceTransitionNode().targetNode;i===e&&(this.sourceType=2,i.shutdown(t),this.sourceNode=null)}else this.isSourceAState()&&this.sourceNode===e&&(this.sourceType=2,this.sourceNode.shutdown(t),this.sourceNode=null);this.isSourceATransition()&&this.getSourceTransitionNode().notifyNewTransitionStarting(t,e)},i.initializeInternal=function(e){t.prototype.initializeInternal.call(this,e),this.sourceNodeResult=new Ci(e.skeleton),this.targetNodeResult=new Ci(e.skeleton),this.transitionLength=this.getNodeData().duration,this.transitionProgress=0,this.blendWeight=0},i.shutdownInternal=function(e){this.targetNode.setTransitioningState(ir.None),this.currentTime=1,this.sourceNode&&(this.isSourceATransition()&&this.endSourceTransition(e),this.sourceNode.shutdown(e),this.sourceNode=null),t.prototype.shutdownInternal.call(this,e)},i.endSourceTransition=function(t){var e,i=this.getSourceTransitionNode().targetNode;null==(e=this.sourceNode)||e.shutdown(t),this.sourceNode=i,this.sourceType=0,this.getSourceStateNode().setTransitioningState(ir.TransitioningOut)},i.initializeTargetStateAndUpdateTransition=function(t,e,i){var r=this;this.markNodeActive(t);var n=this.targetNodeResult;return 0===r.sourceType&&r.getSourceStateNode().startTransitionOut(t),this.targetNode.initialize(t),this.targetNode.startTransitionIn(t),n=this.targetNode.evaluate(t,n),this.calculateBlendWeight(),this.registerPoseTasksAndUpdateRootMotion(e,n,i),this.previousTime=0,this.currentTime=0,this.blendedDuration=hi(this.sourceNode.getDuration(),this.targetNode.getDuration(),this.blendWeight),this.duration=this.targetNode.getDuration(),i},i.calculateBlendWeight=function(){0===this.transitionLength?this.blendWeight=1:(this.blendWeight=this.transitionProgress,this.blendWeight=li(this.blendWeight,0,1))},i.registerPoseTasksAndUpdateRootMotion=function(t,e,i){var r=this.blendWeight;Ei.localBlend(t.pose,e.pose,r,i.pose)},e}(Ke);!function(t){t[t.Float=0]="Float",t[t.Color=1]="Color"}(ur||(ur={}));var lr=function(){function t(t,e){this.rootBone=t,this.useEuler=!1,this.pathToObjectIndex=new Map,this.floatAnimatedObjects=[],this.defaultFloatPropertyValues=[],this.colorAnimatedObjects=[],this.defaultColorPropertyValues=[],this.animatedTransforms=[],this.parentSpaceTransforms=[],this.pathToBoneIndex=new Map;for(var i,r=w(e.position);!(i=r()).done;){var n=i.value;this.addReferenceTransform(n)}for(var a,s=w(e.rotation);!(a=s()).done;){var o=a.value;this.addReferenceTransform(o)}for(var u,h=w(e.scale);!(u=h()).done;){var l=u.value;this.addReferenceTransform(l)}for(var c,f=w(e.euler);!(c=f()).done;){var d=c.value;this.addReferenceTransform(d),this.useEuler=!0}for(var p=0;p<e.floats.length;p++){var m=e.floats[p];this.addRecordedProperty(m.path,m.className,m.property,0)}for(var v=0;v<e.colors.length;v++){var y=e.colors[v];this.addRecordedProperty(y.path,y.className,y.property,1)}}var e=t.prototype;return e.addReferenceTransform=function(t){if(!this.pathToBoneIndex.get(t)){var e=this.findTarget(t);e&&(this.parentSpaceTransforms.push(new _i(e.transform)),this.animatedTransforms.push(e.transform),this.pathToBoneIndex.set(t,this.parentSpaceTransforms.length-1))}},e.addRecordedProperty=function(t,e,i,r){var n=t+e+i;if(void 0===this.pathToObjectIndex.get(n)){var a=this.findTarget(t);if(a){var s;(s="VFXItem"===e?a:a.getComponent(De(e)))||console.error("The "+e+" Component was not found.");for(var o=i.split("."),u=o[o.length-1],h=s,l=0;l<o.length-1;l++){var c=h[o[l]];void 0===c&&console.error("The "+o[l]+" property of "+h+" was not found."),h=c}var f={target:h,property:u};switch(r){case 0:this.floatAnimatedObjects.push(f),this.defaultFloatPropertyValues.push(h[u]),this.pathToObjectIndex.set(n,this.floatAnimatedObjects.length-1);break;case 1:this.colorAnimatedObjects.push(f),this.defaultColorPropertyValues.push(h[u]),this.pathToObjectIndex.set(n,this.colorAnimatedObjects.length-1)}}}},e.findTarget=function(t){if(""===t)return this.rootBone;for(var e,i=t.split("/"),r=this.rootBone,n=w(i);!(e=n()).done;){var a=e.value,s=r.find(a);if(!s)return null;r=s}return r},t}(),cr=function(){function t(t,e){this.graphAsset=t,this.nodes=[],this.context=new ei;for(var i,r={position:[],scale:[],rotation:[],euler:[],floats:[],colors:[]},n=w(t.graphDataSet.resources);!(i=n()).done;){var a=i.value;if(a){for(var s,o=w(a.positionCurves);!(s=o()).done;){var u=s.value;r.position.push(u.path)}for(var h,l=w(a.rotationCurves);!(h=l()).done;){var c=h.value;r.rotation.push(c.path)}for(var f,d=w(a.scaleCurves);!(f=d()).done;){var p=f.value;r.scale.push(p.path)}for(var m,v=w(a.eulerCurves);!(m=v()).done;){var y=m.value;r.euler.push(y.path)}for(var g,x=w(a.floatCurves);!(g=x()).done;){var b=g.value;r.floats.push(b)}for(var T,E=w(a.colorCurves);!(T=E()).done;){var _=T.value;r.colors.push(_)}}}this.skeleton=new lr(e,r),this.result=new Ci(this.skeleton),this.context.skeleton=this.skeleton;var C=new ii;C.nodes=this.nodes,C.nodeDatas=t.nodeDatas,C.dataSet=t.graphDataSet;for(var A=0;A<t.nodeDatas.length;A++)C.nodes[A]||t.nodeDatas[A].instantiate(C);this.rootNode=this.nodes[t.rootNodeIndex]}var e=t.prototype;return e.evaluateGraph=function(t){this.context.update(t),this.rootNode.isInitialized()||this.resetGraphState(),this.rootNode&&(this.result=this.rootNode.evaluate(this.context,this.result));for(var e=0;e<this.getNumControlParameters();e++){var i=this.nodes[e];C(i,Hi)&&i.setValue(!1)}return this.result},e.isInitialized=function(){return this.rootNode&&this.rootNode.isInitialized()},e.isNodeActive=function(t){return this.isControlParameter(t)||this.nodes[t].isNodeActive(this.context.updateID)},e.resetGraphState=function(){this.rootNode.isInitialized()&&this.rootNode.shutdown(this.context),this.context.updateID++,this.rootNode.initialize(this.context)},e.getNumControlParameters=function(){return this.graphAsset.controlParameterIDs.length},e.getControlParameterIndex=function(t){var e=this.graphAsset.parameterLookupMap.get(t);return void 0!==e?e:(console.warn("Parameter '"+t+"' does not exist."),Ye)},e.getControlParameterID=function(t){return this.graphAsset.controlParameterIDs[t]},e.setBool=function(t,e){this.setControlParameterValue(t,e)},e.setFloat=function(t,e){this.setControlParameterValue(t,e)},e.setTrigger=function(t){this.setControlParameterValue(t,!0)},e.resetTrigger=function(t){this.setControlParameterValue(t,!1)},e.getPoseNodeDebugInfo=function(t){return this.nodes[t].getDebugInfo()},e.getRuntimeNodeDebugValue=function(t){return this.nodes[t].getValue(this.context)},e.getNodeDebugInstance=function(t){return this.nodes[t]},e.isControlParameter=function(t){return t<this.getNumControlParameters()},e.setControlParameterValue=function(t,e){var i=this.getControlParameterIndex(t);i!==Ye&&this.nodes[i].setValue(e)},t}();function fr(t,e){for(var i=0;i<e.length;i++){var r=e[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function dr(t,e,i){return e&&fr(t.prototype,e),i&&fr(t,i),t}var pr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).isAwakeCalled=!1,e.isStartCalled=!1,e.isEnableCalled=!1,e._enabled=!0,e}$t(e,t);var i=e.prototype;return i.onAwake=function(){},i.onEnable=function(){},i.onDisable=function(){},i.onStart=function(){},i.onUpdate=function(t){},i.onLateUpdate=function(t){},i.onDestroy=function(){},i.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},i.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},i.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&D(this.item.components,this)},i.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},dr(e,[{key:"transform",get:function(){return this.item.transform}},{key:"isActiveAndEnabled",get:function(){return this.item.isActive&&this.enabled}},{key:"enabled",get:function(){return this._enabled},set:function(t){this.enabled!==t&&(this._enabled=t,t?this.isActiveAndEnabled&&(this.enable(),this.isStartCalled||(this.onStart(),this.isStartCalled=!0)):this.isEnableCalled&&this.disable())}}]),e}(Be);S([ze()],pr.prototype,"item",void 0),S([ze()],pr.prototype,"_enabled",void 0);var mr=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},i.dispose=function(){t.prototype.dispose.call(this)},e}(pr),vr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).graph=null,e.graphAsset=null,e}$t(e,t);var i=e.prototype;return i.setBool=function(t,e){this.graph&&this.graph.setBool(t,e)},i.setFloat=function(t,e){this.graph&&this.graph.setFloat(t,e)},i.setTrigger=function(t){this.graph&&this.graph.setTrigger(t)},i.resetTrigger=function(t){this.graph&&this.graph.resetTrigger(t)},i.onStart=function(){this.graphAsset&&(this.graph=new cr(this.graphAsset,this.item))},i.onUpdate=function(t){if(this.graph){for(var e=this.graph.evaluateGraph(t/1e3),i=this.graph.skeleton.animatedTransforms,r=0;r<i.length;r++){var n=e.pose.parentSpaceTransforms[r].position,a=e.pose.parentSpaceTransforms[r].rotation,s=e.pose.parentSpaceTransforms[r].scale,o=e.pose.parentSpaceTransforms[r].euler;i[r].setPosition(n.x,n.y,n.z),i[r].setScale(s.x,s.y,s.z),this.graph.skeleton.useEuler?i[r].setRotation(o.x,o.y,o.z):i[r].setQuaternion(a.x,a.y,a.z,a.w)}for(var u=this.graph.skeleton.floatAnimatedObjects,h=0;h<u.length;h++){var l=u[h],c=l.property;l.target[c]=e.pose.floatPropertyValues[h]}for(var f=this.graph.skeleton.colorAnimatedObjects,d=0;d<f.length;d++){var p=f[d],m=p.property;p.target[m]=e.pose.colorPropertyValues[d]}}},i.fromData=function(t){this.graphAsset=this.engine.findObject(t.graphAsset)},e}(pr);vr=S([ke("Animator")],vr);var yr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e._priority=0,e}$t(e,t);var i=e.prototype;return i.render=function(t){},i.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},i.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},dr(e,[{key:"priority",get:function(){return this._priority},set:function(t){this._priority=t}},{key:"material",get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t}}]),e}(pr);S([ze()],yr.prototype,"materials",void 0),S([ze()],yr.prototype,"_priority",void 0);var gr=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=i,this.w=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this},e.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},e.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.x=null!=(i=t[e])?i:0,this.y=null!=(r=t[e+1])?r:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(a=t[e+3])?a:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):C(t,Array)?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},e.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},e.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},e.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):C(t,Array)?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},e.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},e.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):C(t,Array)?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},e.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},e.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):C(t,Array)?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},e.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},e.sum=function(){return this.x+this.y+this.z+this.w},e.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},e.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},e.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},e.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},e.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},e.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},e.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},e.normalize=function(){return this.divide(this.length()||1)},e.setLength=function(t){return this.normalize().multiply(t)},e.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},e.lerpVectors=function(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this},e.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.isZero=function(){var t=oi,e=this,i=e.x,r=e.y,n=e.z,a=e.w;return Math.abs(i)<=t&&Math.abs(r)<=t&&Math.abs(n)<=t&&Math.abs(a)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new vi(this.x,this.y,this.z)},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},e.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},e.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t}();gr.ONE=new gr(1,1,1,1),gr.ZERO=new gr(0,0,0,0);var xr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).meshCollider=new Ru,e.getHitTestParams=function(t){var i=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,i);var r=e.meshCollider.getBoundingBoxData();if(r)return{type:r.type,triangles:r.area}},e}$t(e,t);var i=e.prototype;return i.render=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++)t.drawGeometry(this.geometry,this.materials[e],e)},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(yr);S([ze()],xr.prototype,"geometry",void 0);var br=function(t){function e(e){var i;return(i=t.call(this,e)||this).time=0,i.name="EffectComponent",i}$t(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){var e,i=this.time,r=null!=(e=this.material.getVector4("_Time"))?e:new gr;this.material.setVector4("_Time",r.set(i/20,i,2*i,3*i)),this.time+=t/1e3},i.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(xr);br=S([ke(Ae.EffectComponent)],br);var Tr=function(t){function e(e){var i;return(i=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},i.vignette={intensity:0,smoothness:0,roundness:0,active:!1},i.tonemapping={active:!1},i.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},i}return $t(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(pr);S([ze()],Tr.prototype,"bloom",void 0),S([ze()],Tr.prototype,"vignette",void 0),S([ze()],Tr.prototype,"tonemapping",void 0),S([ze()],Tr.prototype,"colorAdjustments",void 0),Tr=S([ke(Ae.PostProcessVolume)],Tr);var Er=function(){function t(t,e,i,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),this.r=t,this.g=e,this.b=i,this.a=r}var e=t.prototype;return e.set=function(t,e,i,r){return this.r=t,this.g=e,this.b=i,this.a=r,this},e.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},e.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},e.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},e.setFromArray=function(t,e){var i,r,n,a;return void 0===e&&(e=0),this.r=null!=(i=t[e])?i:0,this.g=null!=(r=t[e+1])?r:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(a=t[e+3])?a:0,this},e.setFromHSV=function(t,e,i,r){void 0===r&&(r=1);var n=i*e,a=t/60,s=n*(1-Math.abs(a%2-1)),o=0,u=0,h=0;a>=0&&a<=1?(o=n,u=s):a>=1&&a<=2?(o=s,u=n):a>=2&&a<=3?(u=n,h=s):a>=3&&a<=4?(u=s,h=n):a>=4&&a<=5?(o=s,h=n):a>=5&&a<=6&&(o=n,h=s);var l=i-n;return this.set(o+l,u+l,h+l,r)},e.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,i=parseInt(t.substring(3,5),16)/255,r=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,i,r,n)},e.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},e.clone=function(){return new t(this.r,this.g,this.b,this.a)},e.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):C(t,Array)?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},e.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):C(t,Array)?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},e.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):C(t,Array)?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},e.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):C(t,Array)?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},e.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},e.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},e.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},e.clamp=function(t,e){return this.max(t).min(e)},e.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},e.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},e.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},e.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},e.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},e.toArray=function(){return[this.r,this.g,this.b,this.a]},e.toVector4=function(){return new gr(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,i=e.r,r=e.g,n=e.b,a=e.a,s=Math.max(i,r,n),o=Math.min(i,r,n),u=s-o,h=0,l=0;return 0!==s&&(l=u/s),s!=o&&(s==i?(h=(r-n)/u,r<n&&(h+=6)):s==r?h=(n-i)/u+2:s==n&&(h=(i-r)/u+4),h*=60),new t(h,l,s,a)},e.toHexString=function(e){void 0===e&&(e=!0);var i=t.ToHex(Math.round(255*this.r)),r=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),a=t.ToHex(Math.round(255*this.a));return e?"#"+i+r+n+a:"#"+i+r+n},e.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,i,r,n){return void 0===n&&(n=1),(new t).setFromHSV(e,i,r,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();Er.BLACK=new Er(0,0,0,1),Er.BLUE=new Er(0,0,1,1),Er.CLEAR=new Er(0,0,0,0),Er.CYAN=new Er(0,1,1,1),Er.GRAY=new Er(.5,.5,.5,1),Er.GREEN=new Er(0,1,0,1),Er.MAGENTA=new Er(1,0,1,1),Er.RED=new Er(1,0,0,1),Er.WHITE=new Er(1,1,1,1),Er.YELLOW=new Er(1,.92,.016,1);var _r=function(){function t(t,e,i,r,n,a,s,o,u,h,l,c,f,d,p,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=1),void 0===s&&(s=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===l&&(l=1),void 0===c&&(c=0),void 0===f&&(f=0),void 0===d&&(d=0),void 0===p&&(p=0),void 0===m&&(m=1),this.elements=[t,e,i,r,n,a,s,o,u,h,l,c,f,d,p,m]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,s,o,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=i,v[3]=r,v[4]=n,v[5]=a,v[6]=s,v[7]=o,v[8]=u,v[9]=h,v[10]=l,v[11]=c,v[12]=f,v[13]=d,v[14]=p,v[15]=m,this},e.setFromRowMajorData=function(t,e,i,r,n,a,s,o,u,h,l,c,f,d,p,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=i,v[12]=r,v[1]=n,v[5]=a,v[9]=s,v[13]=o,v[2]=u,v[6]=h,v[10]=l,v[14]=c,v[3]=f,v[7]=d,v[11]=p,v[15]=m,this},e.setFromColumnVectors=function(t,e,i,r){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,i.x,i.y,i.z,i.w,r.x,r.y,r.z,r.w)},e.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<16;i++)this.elements[i]=t[e+i];return this},e.setFromScale=function(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1)},e.setFromTranslation=function(t,e,i){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,i,1)},e.setFromRotationX=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,i,0,0,-i,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,0,-i,0,0,1,0,0,i,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),i=Math.sin(t);return this.set(e,i,0,0,-i,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,i){var r=t.tempVec0;r.copyFrom(e).normalize();var n=Math.cos(i),a=Math.sin(i),s=1-n,o=r.x,u=r.y,h=r.z,l=s*o,c=s*u;return this.set(l*o+n,l*u+a*h,l*h-a*u,0,l*u-a*h,c*u+n,c*h+a*o,0,l*h+a*u,c*h-a*o,s*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(vi.ZERO,t,vi.ONE)},e.setFromShear=function(t,e,i){return this.set(1,t,t,0,e,1,e,0,i,i,1,0,0,0,0,1)},e.setFromBasis=function(t,e,i){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,i.x,i.y,i.z,0,0,0,0,1)},e.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},e.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},e.lookAt=function(e,i,r){var n=t.tempVec0,a=t.tempVec1,s=t.tempVec2;s.subtractVectors(e,i),s.normalize(),n.crossVectors(r,s),n.normalize(),a.crossVectors(s,n);var o=this.elements;return o[0]=n.x,o[1]=a.x,o[2]=s.x,o[3]=0,o[4]=n.y,o[5]=a.y,o[6]=s.y,o[7]=0,o[8]=n.z,o[9]=a.z,o[10]=s.z,o[11]=0,o[12]=-n.dot(e),o[13]=-a.dot(e),o[14]=-s.dot(e),o[15]=1,this},e.addScaledMatrix=function(t,e){for(var i=this.elements,r=t.elements,n=0;n<16;n++)i[n]+=r[n]*e;return this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],s=i[4],o=i[8],u=i[12],h=i[1],l=i[5],c=i[9],f=i[13],d=i[2],p=i[6],m=i[10],v=i[14],y=i[3],g=i[7],x=i[11],b=i[15],T=r[0],E=r[4],_=r[8],w=r[12],C=r[1],A=r[5],S=r[9],I=r[13],R=r[2],O=r[6],M=r[10],N=r[14],P=r[3],F=r[7],L=r[11],V=r[15];return n[0]=a*T+s*C+o*R+u*P,n[4]=a*E+s*A+o*O+u*F,n[8]=a*_+s*S+o*M+u*L,n[12]=a*w+s*I+o*N+u*V,n[1]=h*T+l*C+c*R+f*P,n[5]=h*E+l*A+c*O+f*F,n[9]=h*_+l*S+c*M+f*L,n[13]=h*w+l*I+c*N+f*V,n[2]=d*T+p*C+m*R+v*P,n[6]=d*E+p*A+m*O+v*F,n[10]=d*_+p*S+m*M+v*L,n[14]=d*w+p*I+m*N+v*V,n[3]=y*T+g*C+x*R+b*P,n[7]=y*E+g*A+x*O+b*F,n[11]=y*_+g*S+x*M+b*L,n[15]=y*w+g*I+x*N+b*V,this},e.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[4],r=t[8],n=t[12],a=t[1],s=t[5],o=t[9],u=t[13],h=t[2],l=t[6],c=t[10],f=t[14];return t[3]*(+n*o*l-r*u*l-n*s*c+i*u*c+r*s*f-i*o*f)+t[7]*(+e*o*f-e*u*c+n*a*c-r*a*f+r*u*h-n*o*h)+t[11]*(+e*u*l-e*s*f-n*a*l+i*a*f+n*s*h-i*u*h)+t[15]*(-r*s*h-e*o*l+e*s*c+r*a*l-i*a*c+i*o*h)},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},e.invert=function(){var t=this.elements,e=t[0],i=t[1],r=t[2],n=t[3],a=t[4],s=t[5],o=t[6],u=t[7],h=t[8],l=t[9],c=t[10],f=t[11],d=t[12],p=t[13],m=t[14],v=t[15],y=l*m*u-p*c*u+p*o*f-s*m*f-l*o*v+s*c*v,g=d*c*u-h*m*u-d*o*f+a*m*f+h*o*v-a*c*v,x=h*p*u-d*l*u+d*s*f-a*p*f-h*s*v+a*l*v,b=d*l*o-h*p*o-d*s*c+a*p*c+h*s*m-a*l*m,T=e*y+i*g+r*x+n*b;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var E=1/T;return t[0]=y*E,t[1]=(p*c*n-l*m*n-p*r*f+i*m*f+l*r*v-i*c*v)*E,t[2]=(s*m*n-p*o*n+p*r*u-i*m*u-s*r*v+i*o*v)*E,t[3]=(l*o*n-s*c*n-l*r*u+i*c*u+s*r*f-i*o*f)*E,t[4]=g*E,t[5]=(h*m*n-d*c*n+d*r*f-e*m*f-h*r*v+e*c*v)*E,t[6]=(d*o*n-a*m*n-d*r*u+e*m*u+a*r*v-e*o*v)*E,t[7]=(a*c*n-h*o*n+h*r*u-e*c*u-a*r*f+e*o*f)*E,t[8]=x*E,t[9]=(d*l*n-h*p*n-d*i*f+e*p*f+h*i*v-e*l*v)*E,t[10]=(a*p*n-d*s*n+d*i*u-e*p*u-a*i*v+e*s*v)*E,t[11]=(h*s*n-a*l*n-h*i*u+e*l*u+a*i*f-e*s*f)*E,t[12]=b*E,t[13]=(h*p*r-d*l*r+d*i*c-e*p*c-h*i*m+e*l*m)*E,t[14]=(d*s*r-a*p*r-d*i*o+e*p*o+a*i*m-e*s*m)*E,t[15]=(a*l*r-h*s*r+h*i*o-e*l*o-a*i*c+e*s*c)*E,this},e.extractBasis=function(t,e,i){var r=this.elements;return t.set(r[0],r[1],r[2]),e.set(r[4],r[5],r[6]),i.set(r[8],r[9],r[10]),this},e.compose=function(t,e,i,r){void 0===r&&(r=vi.ZERO);var n=this.elements,a=e.x,s=e.y,o=e.z,u=e.w,h=-r.x,l=-r.y,c=-r.z,f=a+a,d=s+s,p=o+o,m=a*f,v=a*d,y=a*p,g=s*d,x=s*p,b=o*p,T=u*f,E=u*d,_=u*p,w=i.x,C=i.y,A=i.z;return n[0]=(1-(g+b))*w,n[1]=(v+_)*w,n[2]=(y-E)*w,n[3]=0,n[4]=(v-_)*C,n[5]=(1-(m+b))*C,n[6]=(x+T)*C,n[7]=0,n[8]=(y+E)*A,n[9]=(x-T)*A,n[10]=(1-(m+g))*A,n[11]=0,n[12]=h*n[0]+l*n[4]+c*n[8]-h+t.x,n[13]=h*n[1]+l*n[5]+c*n[9]-l+t.y,n[14]=h*n[2]+l*n[6]+c*n[10]-c+t.z,this},e.decompose=function(e,i,r){var n=t.tempVec0,a=this.elements,s=n.set(a[0],a[1],a[2]).length(),o=n.set(a[4],a[5],a[6]).length(),u=n.set(a[8],a[9],a[10]).length();this.determinant()<0&&(s=-s),e.x=a[12],e.y=a[13],e.z=a[14];var h=t.tempMat0;h.copyFrom(this);var l=1/s,c=1/o,f=1/u;return h.elements[0]*=l,h.elements[1]*=l,h.elements[2]*=l,h.elements[4]*=c,h.elements[5]*=c,h.elements[6]*=c,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,i.setFromRotationMatrix(h),r.x=s,r.y=o,r.z=u,this},e.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},e.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},e.getTransform=function(){var t=new vi,e=new yi,i=new vi;return this.decompose(t,e,i),{translation:t,rotation:e,scale:i}},e.orthographic=function(t,e,i,r,n,a){var s=1/(e-t),o=1/(i-r),u=1/(a-n),h=-(e+t)*s,l=-(i+r)*o,c=-(a+n)*u;s*=2,o*=2,u*=-2;var f=this.elements;return f[0]=s,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=o,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=l,f[14]=c,f[15]=1,this},e.perspective=function(t,e,i,r,n){var a=1/Math.tan(.5*t),s=1/(i-r),o=this.elements;return o[0]=n?a:a/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n?a*e:a,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(r+i)*s,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*r*i*s,o[15]=0,null!==r&&r!==1/0||(o[10]=-1,o[14]=-2*i),this},e.projectPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;s.x=a[0]*i+a[4]*r+a[8]*n+a[12],s.y=a[1]*i+a[5]*r+a[9]*n+a[13],s.z=a[2]*i+a[6]*r+a[10]*n+a[14];var o=a[3]*i+a[7]*r+a[11]*n+a[15];return s.multiply(1/o)},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n+a[12],s.y=a[1]*i+a[5]*r+a[9]*n+a[13],s.z=a[2]*i+a[6]*r+a[10]*n+a[14],s},e.transformNormal=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[4]*r+a[8]*n,s.y=a[1]*i+a[5]*r+a[9]*n,s.z=a[2]*i+a[6]*r+a[10]*n,s.normalize()},e.transformVector4=function(t,e){var i=t.x,r=t.y,n=t.z,a=t.w,s=this.elements,o=null!=e?e:t;return o.x=s[0]*i+s[4]*r+s[8]*n+s[12]*a,o.y=s[1]*i+s[5]*r+s[9]*n+s[13]*a,o.z=s[2]*i+s[6]*r+s[10]*n+s[14]*a,o.w=s[3]*i+s[7]*r+s[11]*n+s[15]*a,o},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<16;r++)if(!ui(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,i,r){return(new t).lookAt(e,i,r)},t.fromPerspective=function(e,i,r,n,a){return(new t).perspective(e,i,r,n,a)},t.fromColumnVectors=function(e,i,r,n){return(new t).setFromColumnVectors(e,i,r,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromScale=function(e,i,r){return(new t).setFromScale(e,i,r)},t.fromTranslation=function(e,i,r){return(new t).setFromTranslation(e,i,r)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,i){return(new t).setFromRotationAxis(e,i)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,i,r){return(new t).setFromShear(e,i,r)},t.fromBasis=function(e,i,r){return(new t).setFromBasis(e,i,r)},t.fromRowMajorData=function(e,i,r,n,a,s,o,u,h,l,c,f,d,p,m,v){return new t(e,a,h,d,i,s,l,p,r,o,c,m,n,u,f,v)},t}();function wr(t,e,i){var r;if(void 0===e&&(e="webgl"),"webgl2"===e&&((r=t.getContext("webgl2",i))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),r&&"webgl"!==e||(r=t.getContext("webgl",i)),!r)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return r}function Cr(t){var e=t.getExtension("EXT_disjoint_timer_query_webgl2");if(e){var i=t.createQuery(),n=E((function(){return I(this,(function(a){return[2,new Promise((function(a,s){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(e.GPU_DISJOINT_EXT);if(o&&!u){var h=t.getQueryParameter(i,t.QUERY_RESULT);a(h/1e3/1e3)}(o||u)&&(t.deleteQuery(i),i=null),null!==o&&i&&r.setTimeout((function(){n().then(a).catch}),1)}}))]}))}));if(!i)return;return{begin:function(){i&&t.beginQuery(e.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(e.TIME_ELAPSED_EXT)},getTime:n}}}_r.IDENTITY=new _r(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),_r.ZERO=new _r(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),_r.tempVec0=new vi,_r.tempVec1=new vi,_r.tempVec2=new vi,_r.tempMat0=new _r;var Ar,Sr,Ir,Rr,Or=[],Mr={},Nr="WebGL Constants not in global, please check your environment";function Pr(){"function"==typeof o?Lr(o):void 0!==u?(Lr(u),Lr(u.prototype)):Y?Or.push(Z()?"iOS16 lockdown mode, WebGL Constants not in global":Nr):Or.push(Nr),Or.length||"HALF_FLOAT"in Mr||(Mr.HALF_FLOAT=5131)}function Fr(t){return void 0!==o&&"WebGL2RenderingContext"===t.constructor.name}function Lr(t){for(var e in t)/^[A-Z_]/.test(e)&&(Mr[e]=t[e])}function Vr(t){switch(t){case Ie.Float32:return u.FLOAT;case Ie.Int16:return u.SHORT;case Ie.Int8:return u.BYTE;case Ie.UInt16:return u.UNSIGNED_SHORT;case Ie.UInt8:return u.UNSIGNED_BYTE;default:return u.FLOAT}}function Dr(t){switch(t){case u.FLOAT:return Ie.Float32;case u.SHORT:return Ie.Int16;case u.BYTE:return Ie.Int8;case u.UNSIGNED_SHORT:return Ie.UInt16;case u.UNSIGNED_BYTE:return Ie.UInt8;default:return Ie.Float32}}function kr(t,e){return null==t?e:t}function zr(t){switch(t){case zt.ALPHA:case zt.ADD:case zt.SUBTRACTION:case zt.STRONG_LIGHT:case zt.WEAK_LIGHT:return 1;case zt.SUPERPOSITION:return 2;case zt.BRIGHTNESS:return 3;case zt.MULTIPLY:return 0;default:return 1}}function Ur(t,e){switch(e){case void 0:case zt.ALPHA:t.blendFunction=[Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA,Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA];break;case zt.ADD:t.blendFunction=[Mr.ONE,Mr.ONE,Mr.ONE,Mr.ONE];break;case zt.SUBTRACTION:t.blendFunction=[Mr.ONE,Mr.ONE,Mr.ZERO,Mr.ONE],t.blendEquation=[Mr.FUNC_REVERSE_SUBTRACT,Mr.FUNC_REVERSE_SUBTRACT];break;case zt.SUPERPOSITION:t.blendFunction=[Mr.ONE,Mr.ONE,Mr.ONE,Mr.ONE];break;case zt.MULTIPLY:t.blendFunction=[Mr.DST_COLOR,Mr.ONE_MINUS_SRC_ALPHA,Mr.DST_COLOR,Mr.ONE_MINUS_SRC_ALPHA];break;case zt.BRIGHTNESS:t.blendFunction=[Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA,Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA];break;case zt.STRONG_LIGHT:t.blendFunction=[Mr.DST_COLOR,Mr.DST_ALPHA,Mr.ZERO,Mr.ONE];break;case zt.WEAK_LIGHT:t.blendFunction=[Mr.DST_COLOR,Mr.ZERO,Mr.ZERO,Mr.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Br(t,e){e===Ut.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=Mr.CW,t.cullFace=e===Ut.BACK?Mr.BACK:Mr.FRONT)}function Gr(t,e){switch(e){case void 0:t.stencilTest=!1;break;case Sr.MASK:t.stencilTest=!0,t.stencilFunc=[Mr.ALWAYS,Mr.ALWAYS],t.stencilOpZPass=[Mr.REPLACE,Mr.REPLACE];break;case Sr.OBSCURED:t.stencilTest=!0,t.stencilFunc=[Mr.EQUAL,Mr.EQUAL];break;case Sr.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[Mr.NOTEQUAL,Mr.NOTEQUAL];break;case Sr.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}Or.length||Pr(),function(t){t[t.vertex=0]="vertex",t[t.fragment=1]="fragment"}(Ar||(Ar={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Sr||(Sr={})),function(t){t[t.whatever=0]="whatever",t[t.clear=2]="clear"}(Ir||(Ir={})),function(t){t[t.none=0]="none",t[t.data=1]="data",t[t.image=2]="image",t[t.compressed=3]="compressed",t[t.video=4]="video",t[t.canvas=5]="canvas",t[t.framebuffer=6]="framebuffer",t[t.mipmaps=7]="mipmaps"}(Rr||(Rr={}));var jr=function(){function t(){this.callbacks={}}var e=t.prototype;return e.downloadJSON=function(t,e,i){this.download(t,"json",e,i)},e.downloadBinary=function(t,e,i){this.download(t,"arraybuffer",e,i)},e.downloadBlob=function(t,e,i){this.download(t,"blob",e,i)},e.download=function(t,e,i,r){var n=this;if(void 0===e&&(e="json"),!this.start(t,i,r)){var a=new h,s=function(){n.finish(t,a.status,a.response)};a.responseType=e,a.addEventListener("load",(function(){200==a.status?n.finish(t,200,a.response):s()})),a.addEventListener("error",s),a.open("GET",t,!0),a.send()}},e.start=function(t,e,i){var r=this.callbacks[t];try{if(r)return!0;this.callbacks[t]=r=[]}finally{r.push(e,i)}},e.finish=function(t,e,i){var r=this.callbacks[t];delete this.callbacks[t];for(var n=200==e?[i]:[e,i],a=n.length-1,s=r.length;a<s;a+=2)r[a].apply(null,n)},t}(),Xr=!1,Hr=!1;function Wr(t,e){return Yr.apply(this,arguments)}function Yr(){return(Yr=E((function(t,e){return I(this,(function(i){switch(i.label){case 0:return!Xr&&e?[3,2]:[4,Kr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,Kr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Xr=!0,[4,Kr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Zr(t,e){return qr.apply(this,arguments)}function qr(){return(qr=E((function(t,e){return I(this,(function(i){switch(i.label){case 0:return!Hr&&e?[3,2]:[4,Kr(t)];case 1:return[2,{image:i.sent(),url:t}];case 2:return i.trys.push([2,4,,6]),[4,Kr(e)];case 3:return[2,{image:i.sent(),url:e}];case 4:return i.sent(),Hr=!0,[4,Kr(t)];case 5:return[2,{image:i.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Kr(t){return Qr.apply(this,arguments)}function Qr(){return(Qr=E((function(t){var e,i;return I(this,(function(r){if(e="",C(t,l)){if(t.complete)return[2,t];e=t.src}else C(t,s)?(e=c.createObjectURL(t),i=!0):"string"==typeof t&&(e=t);if(!e)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,r){var n=new f;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,i&&c.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,i&&c.revokeObjectURL(e),r("Load image fail: "+e+", reason: "+JSON.stringify(t))},n.src=e}))]}))}))).apply(this,arguments)}function Jr(t){return $r.apply(this,arguments)}function $r(){return($r=E((function(t){return I(this,(function(e){return[2,new Promise((function(e,i){(new jr).downloadBinary(t,e,(function(e,r){i("Couldn't load bins "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function tn(t){return en.apply(this,arguments)}function en(){return(en=E((function(t){return I(this,(function(e){return[2,new Promise((function(e,i){(new jr).downloadBlob(t,e,(function(e,r){i("Couldn't load blob "+t+": status "+e+", "+r)}))}))]}))}))).apply(this,arguments)}function rn(t){return nn.apply(this,arguments)}function nn(){return(nn=E((function(t){var e;return I(this,(function(r){return e=i.createElement("video"),"string"==typeof t?e.src=t:e.srcObject=t,e.crossOrigin="anonymous",e.muted=!0,K()&&e.setAttribute("renderer","standard"),e.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,i){var r=e.play().catch((function(t){i(t)}));r?r.then((function(){return t(e)})):e.addEventListener("loadeddata",(function i(){t(e),e.removeEventListener("loadeddata",i)}),!0),e.addEventListener("error",(function(t){i("Load video fail.")}))}))]}))}))).apply(this,arguments)}function an(t,e){return sn.apply(this,arguments)}function sn(){return(sn=E((function(t,e){return I(this,(function(i){switch(i.label){case 0:if(!Array.isArray(t))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,5]),[4,e(t[0])];case 2:return[2,i.sent()];case 3:return i.sent(),[4,e(t[1])];case 4:return[2,i.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function on(t,e,i){return un.apply(this,arguments)}function un(){return(un=E((function(t,e,i,r){var n,a,s,o,u,h,l,c,f;return I(this,(function(d){switch(d.label){case 0:return void 0===r&&(r=[]),34067!==t.target?[3,2]:(n=t.mipmaps,a=t.target,s=n.map((function(t){return Promise.all(t.map((function(t){return t.id?i[t.id]:hn(t,e)})))})),[4,Promise.all(s)]);case 1:return o=d.sent(),[2,ri({keepImageSource:!1},t,{mipmaps:o,sourceFrom:{target:a,type:Rr.mipmaps}})];case 2:return u=t.mipmaps,h=t.target,l=u.map((function(t){return hn(t,e)})),[4,Promise.all(l)];case 3:return c=d.sent(),f=r[u[0][1][0]].url,[2,ri({keepImageSource:!1},t,{mipmaps:c,sourceType:Rr.mipmaps,sourceFrom:{target:h,bin:f,type:Rr.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function hn(t,e){return ln.apply(this,arguments)}function ln(){return ln=E((function(t,e){var i,r,n,a,o;return I(this,(function(u){if(i=t[1],r=i[0],n=i[1],a=i[2],!(o=e[r]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,Kr(new s([new Uint8Array(o,n,a)]))]}))})),ln.apply(this,arguments)}var cn=1,fn=function(t){function e(e){var i;return(i=t.call(this,e)||this).destroyed=!1,i.id="Tex"+cn++,i}$t(e,t);var i=e.prototype;return i.getWidth=function(){return this.width||0},i.getHeight=function(){return this.height||0},i.uploadCurrentVideoFrame=function(){},i.offloadData=function(){},i.reloadData=function(){},i.initialize=function(){},i.assembleOptions=function(t){var e=t.target,i=void 0===e?Mr.TEXTURE_2D:e,r=t.format,n=void 0===r?Mr.RGBA:r;return t.sourceType||(t.sourceType="image"in t?Rr.image:"data"in t?Rr.data:"video"in t?Rr.video:0),ri({minFilter:Mr.NEAREST,magFilter:Mr.NEAREST,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE,target:i,format:Mr.RGBA,internalFormat:n,type:Mr.UNSIGNED_BYTE},t)},e.fromImage=function(t,i,r){return E((function(){var n,a;return I(this,(function(s){switch(s.label){case 0:return[4,Kr(t)];case 1:return n=s.sent(),(a=e.create(i,ri({sourceType:Rr.image,image:n,target:Mr.TEXTURE_2D,id:At(),flipY:!0},r))).initialize(),[2,a]}}))}))()},e.fromVideo=function(t,i,r){return E((function(){var n,a;return I(this,(function(s){switch(s.label){case 0:return[4,rn(t)];case 1:return n=s.sent(),(a=e.create(i,ri({sourceType:Rr.video,video:n,id:At(),flipY:!0},r))).initialize(),[2,a]}}))}))()},dr(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Be);function dn(t,e,i,r){var n,a,s=e.length/i/r;return a=n=4===s||0===s?Mr.RGBA:3===s?Mr.RGB:2===s?Mr.LUMINANCE_ALPHA:Mr.LUMINANCE,fn.createWithData(t,{data:e,width:i,height:r},{type:Mr.HALF_FLOAT,format:n,internalFormat:a,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE})}var pn={type:Mr.UNSIGNED_BYTE,format:Mr.RGBA,internalFormat:Mr.RGBA,wrapS:Mr.MIRRORED_REPEAT,wrapT:Mr.MIRRORED_REPEAT,minFilter:Mr.NEAREST,magFilter:Mr.NEAREST};function mn(t){return fn.create(t,ri({id:Me.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:Rr.data},pn))}function vn(t){return fn.create(t,ri({id:Me.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:Rr.data},pn))}var yn=function(){function t(t,e,i){void 0===i&&(i=0),this.arrayBuffer=t,this.baseOffset=i;var r=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==r[0]||75!==r[1]||84!==r[2]||88!==r[3]||32!==r[4]||49!==r[5]||49!==r[6]||187!==r[7]||13!==r[8]||10!==r[9]||26!==r[10]||10!==r[11])throw new Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,a=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),s=67305985===a.getUint32(0,!0);this.glType=a.getUint32(1*n,s),this.glTypeSize=a.getUint32(2*n,s),this.glFormat=a.getUint32(3*n,s),this.glInternalFormat=a.getUint32(4*n,s),this.glBaseInternalFormat=a.getUint32(5*n,s),this.pixelWidth=a.getUint32(6*n,s),this.pixelHeight=a.getUint32(7*n,s),this.pixelDepth=a.getUint32(8*n,s),this.numberOfArrayElements=a.getUint32(9*n,s),this.numberOfFaces=a.getUint32(10*n,s),this.numberOfMipmapLevels=a.getUint32(11*n,s),this.bytesOfKeyValueData=a.getUint32(12*n,s),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:vt.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+"."):vt.warn("Texture arrays not currently supported."):vt.warn("Only 2D textures currently supported.")}return t.prototype.mipmaps=function(t){for(var e=[],i=64+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,a=t?this.numberOfMipmapLevels:1,s=0;s<a;s++){for(var o=new Int32Array(this.arrayBuffer,this.baseOffset+i,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+i+4,o);e.push({data:h,width:r,height:n}),i+=o+4,i+=3-(o+3)%4}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}return e},t}();function gn(t){var e=new yn(t,1),i=e.numberOfMipmapLevels,r=e.pixelWidth,n=e.pixelHeight,a=e.glType,s=e.numberOfFaces,o=e.glInternalFormat,u=e.glFormat,h=i>=Math.floor(Math.log2(Math.max(r,n))+1);return{sourceType:Rr.compressed,type:a,target:6===s?Mr.TEXTURE_CUBE_MAP:Mr.TEXTURE_2D,internalFormat:o,format:u,mipmaps:e.mipmaps(h)}}var xn,bn=function(){function t(){this.reloadPending={}}var e=t.prototype;return e.reload=function(t){var e=this;return E((function(){var i,r;return I(this,(function(n){switch(n.label){case 0:return i=t.id,e.reloadPending[i]?[2]:t.sourceFrom?(e.reloadPending[i]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return r=n.sent(),t.updateSource(r),e.reloadPending[i]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},e.canOffloadTexture=function(t){if(t){var e=t.type;if(e===Rr.compressed||e===Rr.image){var i=t.target,r=t.map,n=t.url;return i===Mr.TEXTURE_CUBE_MAP?"object"==typeof r&&!!r:gt(n)&&n.length>0}if(e===Rr.mipmaps){var a=t.bin,s=t.mipmaps,o=t.target,u=t.maps,h=t.urls;return a?s.length>0:o===Mr.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return gt(t)&&t.length>0}))}}return!1},e.loadSource=function(t,e){var i=this;return E((function(){var r,n,a,s,o,u,h,l,c,f,d,p,m,v,y,g,x;return I(this,(function(b){switch(b.label){case 0:return r=t.type,n=t.target,a=t.map,s=t.url,o=t.bin,u=t.mipmaps,h=t.urls,l=t.maps,n!==Mr.TEXTURE_CUBE_MAP||r===Rr.mipmaps?[3,2]:[4,i.loadCubeMap(a)];case 1:return c=b.sent(),[2,ri({},e,{cube:c,target:Mr.TEXTURE_CUBE_MAP,sourceType:Rr.image,sourceFrom:{type:Rr.image,map:ri({},a),target:Mr.TEXTURE_CUBE_MAP}})];case 2:return r!==Rr.image?[3,4]:[4,Kr(s)];case 3:return f=b.sent(),[2,ri({},e,{image:f,sourceType:Rr.image,sourceFrom:{type:r,url:s,target:Mr.TEXTURE_2D}})];case 4:return r!==Rr.video?[3,6]:[4,rn(s)];case 5:return d=b.sent(),[2,ri({},e,{video:d,sourceType:Rr.video})];case 6:return r!==Rr.compressed?[3,8]:[4,Jr(s)];case 7:return[2,ri({},gn(b.sent()),e,{sourceFrom:{url:s,type:Rr.compressed}})];case 8:return r!==Rr.mipmaps?[3,17]:o?[4,Jr(o)]:[3,13];case 9:return p=b.sent(),m=null!=n?n:Mr.TEXTURE_2D,v=m===Mr.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==Mr.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(u.map((function(t){return i.loadMipmapImages(t,p)})))];case 10:return y=b.sent(),[3,12];case 11:y=i.loadMipmapImages(u,p),b.label=12;case 12:return[2,ri({},e,{mipmaps:y,target:m,sourceType:Rr.mipmaps,sourceFrom:{bin:o,mipmaps:v,target:m,type:Rr.mipmaps}})];case 13:return n!==Mr.TEXTURE_2D&&n?[3,15]:[4,Promise.all(h.map((function(t){return Kr(t)})))];case 14:return g=b.sent(),[2,ri({},e,{mipmaps:g,target:Mr.TEXTURE_2D,sourceType:Rr.mipmaps,sourceFrom:{type:r,urls:h.slice(),target:Mr.TEXTURE_2D}})];case 15:return n!==Mr.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(l.map((function(t){return i.loadCubeMap(t)})))];case 16:return x=b.sent(),[2,ri({},e,{mipmaps:x,target:Mr.TEXTURE_CUBE_MAP,sourceType:Rr.mipmaps,sourceFrom:{type:r,maps:l.map((function(t){return ri({},t)})),target:Mr.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: "+r+".")}}))}))()},e.loadMipmapImages=function(t,e){return E((function(){return I(this,(function(i){return[2,Promise.all(t.map((function(t){return Kr(new s([new Uint8Array(e,t[0],t[1])]))})))]}))}))()},e.loadCubeMap=function(t){return E((function(){return I(this,(function(e){return[2,Promise.all(t.map((function(t){return Kr(t)})))]}))}))()},t}();function Tn(){return xn||(xn=new bn),xn}function En(t){xn=t}var _n,wn=function(){function t(t){this.destroyed=!1;var e=t.name,i=void 0===e?"defaultDataBlock":e;this.name=i}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(i){e.setUniformValue(i,t[i])}))},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,i){},t}();function Cn(t){return"object"==typeof t&&t&&void 0===t.length&&C(t,fn)}function An(t){return t&&void 0!==t.length&&Cn(t[0])}!function(t){t[t.normal=0]="normal",t[t.transformFeedback=1]="transformFeedback"}(_n||(_n={}));var Sn,In,Rn=1,On=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).stringTags={},r.enabledMacros={},r.destroyed=!1,r.initialized=!1,r.shaderDirty=!0,i){var n=i.name,a=void 0===n?"Material"+Rn++:n,s=i.renderType,o=void 0===s?0:s,u=i.shader,h=i.uniformSemantics;r.name=a,r.renderType=o,r.shaderSource=u,r.props=i,r.uniformSemantics=ri({},h)}else r.name="Material"+Rn++,r.renderType=0;return r}$t(e,t);var i=e.prototype;return i.initialize=function(){},i.createShaderVariant=function(){},i.use=function(t,e){},dr(e,[{key:"shader",get:function(){return this._shader},set:function(t){this._shader!==t&&(this._shader=t,this.shaderDirty=!0)}},{key:"mainTexture",get:function(){return this.getTexture("_MainTex")},set:function(t){this.setTexture("_MainTex",t)}},{key:"color",get:function(){return this.getColor("_Color")},set:function(t){this.setColor("_Color",t)}},{key:"blending",set:function(t){}},{key:"blendFunction",set:function(t){}},{key:"blendEquation",set:function(t){}},{key:"depthTest",set:function(t){}},{key:"depthMask",set:function(t){}},{key:"stencilTest",set:function(t){}},{key:"stencilRef",set:function(t){}},{key:"stencilFunc",set:function(t){}},{key:"stencilOpZPass",set:function(t){}},{key:"culling",set:function(t){}},{key:"frontFace",set:function(t){}},{key:"cullFace",set:function(t){}},{key:"blendColor",set:function(t){}},{key:"depthRange",set:function(t){}},{key:"depthFunc",set:function(t){}},{key:"polygonOffsetFill",set:function(t){}},{key:"polygonOffset",set:function(t){}},{key:"sampleAlphaToCoverage",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(Be),Mn=function(){function t(t){this.engine=t,this.alphaMaskEnabled=!1,this.maskMode=Sr.NONE,this.maskable=null,this.stencilClearAction={stencilAction:Ir.clear}}var e=t.prototype;return e.getRefValue=function(){return 1},e.setMaskOptions=function(t){var e=t.isMask,i=void 0!==e&&e,r=t.inverted,n=void 0!==r&&r,a=t.reference,s=t.alphaMaskEnabled,o=void 0!==s&&s;this.alphaMaskEnabled=o,i?this.maskMode=Sr.MASK:(this.maskMode=n?Sr.REVERSE_OBSCURED:Sr.OBSCURED,this.maskable=this.engine.findObject(a))},e.drawStencilMask=function(t){this.maskable&&(t.clear(this.stencilClearAction),this.maskable.drawStencilMask(t))},t}();!function(t){t[t.noShader=0]="noShader",t[t.success=1]="success",t[t.fail=2]="fail",t[t.compiling=3]="compiling"}(Sn||(Sn={})),function(t){t.GLSL1="100",t.GLSL3="300 es"}(In||(In={}));var Nn=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).source=i,r}return $t(e,t),e}(Be),Pn=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.createVariant=function(t){var e=[];if(t)for(var i,r=w(Object.keys(t));!(i=r()).done;){var n=i.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(Be);Pn=S([ke(Ae.Shader)],Pn);var Fn="effects-internal-copy",Ln="effects-internal-copy-mesh",Vn="\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",Dn="precision mediump float;\nvarying vec2 vTex;\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main(){\n #ifdef DEPTH_TEXTURE\n gl_FragDepthEXT = texture2D(uDepth,vTex).r;\n #endif\n}\n";function kn(t,e){return{name:Fn,vertex:Vn,fragment:Dn,glslVersion:2===t?In.GLSL3:In.GLSL1,macros:[["DEPTH_TEXTURE",!!e]],cacheId:Ln+ +e}}var zn,Un,Bn={format:Mr.RGBA,type:Mr.UNSIGNED_BYTE,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE},Gn=Symbol("dispose"),jn=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,i=t.width,r=t.height,n=t.name,a={sourceType:Rr.framebuffer,data:{width:i,height:r},name:n},s=[n];Object.getOwnPropertyNames(Bn).forEach((function(e){var i,r=null!=(i=t[e])?i:Bn[e];a[e]=r,s.push(e,r)}));var o=s.join(":"),u=this.textureCache[o];if(u)this.textureRef[o]++;else{var h=this.engine;ut(h),u=fn.create(h,a),this.textureCache[o]=u,this.textureRef[o]=1,u[Gn]=u.dispose,u.dispose=function(){return e.removeTexture(o)}}return u},e.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("Ref count < 0.");var i=this.textureCache[t];i&&(i[Gn](),i.dispose=i[Gn]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var i=t.textureCache[e];i[Gn](),i.dispose=i[Gn]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Xn=function(){function t(t){void 0===t&&(t={}),this.semantics=ri({},t)}var e=t.prototype;return e.toObject=function(){return ri({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var i=this.semantics[t];return bt(i)?i(e):i},e.hasSemanticValue=function(t){return t in this.semantics},e.dispose=function(){var t=this;Object.keys(this.semantics).forEach((function(e){delete t.semantics[e]}))},t}(),Hn=((zn={})[Mr.FLOAT]=Float32Array.BYTES_PER_ELEMENT,zn[Mr.INT]=Int32Array.BYTES_PER_ELEMENT,zn[Mr.SHORT]=Int16Array.BYTES_PER_ELEMENT,zn[Mr.BYTE]=Int8Array.BYTES_PER_ELEMENT,zn),Wn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}$t(e,t);var i=e.prototype;return i.initialize=function(){},i.flush=function(){},e}(Be);function Yn(t){return t===Mr.INT?new Int32Array(0):t===Mr.SHORT?new Int16Array(0):new Float32Array(0)}!function(t){t[t.XYZ=0]="XYZ",t[t.XZY=1]="XZY",t[t.YXZ=2]="YXZ",t[t.YZX=3]="YZX",t[t.ZXY=4]="ZXY",t[t.ZYX=5]="ZYX"}(Un||(Un={}));var Zn=function(){function t(e,i,r,n){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=i,this.z=r,this.order=n}var e=t.prototype;return e.set=function(t,e,i,r){return void 0===r&&(r=this.order),this.x=t,this.y=e,this.z=i,this.order=r,this},e.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},e.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var i=t.elements,r=i[0],n=i[4],a=i[8],s=i[1],o=i[5],u=i[9],h=i[2],l=i[6],c=i[10];switch(e){case Un.XYZ:this.y=Math.asin(li(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,c),this.z=Math.atan2(-n,r)):(this.x=Math.atan2(l,o),this.z=0);break;case Un.YXZ:this.x=Math.asin(-li(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(a,c),this.z=Math.atan2(s,o)):(this.y=Math.atan2(-h,r),this.z=0);break;case Un.ZXY:this.x=Math.asin(li(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-h,c),this.z=Math.atan2(-n,o)):(this.y=0,this.z=Math.atan2(s,r));break;case Un.ZYX:this.y=Math.asin(-li(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(l,c),this.z=Math.atan2(s,r)):(this.x=0,this.z=Math.atan2(-n,o));break;case Un.YZX:this.z=Math.asin(li(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,o),this.y=Math.atan2(-h,r)):(this.x=0,this.y=Math.atan2(a,c));break;case Un.XZY:this.z=Math.asin(-li(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(l,o),this.y=Math.atan2(a,r)):(this.x=Math.atan2(-u,c),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=si,this.y*=si,this.z*=si,this.order=e,this},e.setFromQuaternion=function(e,i){void 0===i&&(i=this.order);var r=t.tempMat0;return r.setFromQuaternion(e),this.setFromRotationMatrix4(r,i)},e.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},e.setFromArray=function(t,e,i){var r,n,a,s;return void 0===e&&(e=0),void 0===i&&(i=this.order),this.x=null!=(r=t[e])?r:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(a=t[e+2])?a:0,this.order=null!=(s=t[e+3])?s:i,this},e.clone=function(){return new t(this.x,this.y,this.z,this.order)},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},e.add=function(t){return this.order!=t.order?(console.error("add euler with different order"),this):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},e.addEulers=function(t,e){return t.order!=e.order?(console.error("add euler with different order"),this):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order,this)},e.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},e.reorder=function(t){var e=new yi;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,i){return t.tempQuat0.setFromEuler(this).rotateVector3(e,i)},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},e.toVector3=function(t){return t.set(this.x,this.y,this.z)},e.toArray=function(){return[this.x,this.y,this.z]},e.toQuaternion=function(t){var e=this,i=e.x,r=e.y,n=e.z,a=e.order,s=Math.cos(i*ai*.5),o=Math.cos(r*ai*.5),u=Math.cos(n*ai*.5),h=Math.sin(i*ai*.5),l=Math.sin(r*ai*.5),c=Math.sin(n*ai*.5);switch(a){case Un.XYZ:t.set(h*o*u+s*l*c,s*l*u-h*o*c,s*o*c+h*l*u,s*o*u-h*l*c);break;case Un.YXZ:t.set(h*o*u+s*l*c,s*l*u-h*o*c,s*o*c-h*l*u,s*o*u+h*l*c);break;case Un.ZXY:t.set(h*o*u-s*l*c,s*l*u+h*o*c,s*o*c+h*l*u,s*o*u-h*l*c);break;case Un.ZYX:t.set(h*o*u-s*l*c,s*l*u+h*o*c,s*o*c-h*l*u,s*o*u+h*l*c);break;case Un.YZX:t.set(h*o*u+s*l*c,s*l*u+h*o*c,s*o*c-h*l*u,s*o*u-h*l*c);break;case Un.XZY:t.set(h*o*u-s*l*c,s*l*u-h*o*c,s*o*c+h*l*u,s*o*u+h*l*c);break;default:console.error("unknown euler order: "+a)}return t},e.toMatrix4=function(t){var e=t.elements,i=this,r=i.x,n=i.y,a=i.z,s=i.order,o=Math.cos(r*ai),u=Math.sin(r*ai),h=Math.cos(n*ai),l=Math.sin(n*ai),c=Math.cos(a*ai),f=Math.sin(a*ai);if(s===Un.XYZ){var d=o*c,p=o*f,m=u*c,v=u*f;e[0]=h*c,e[4]=-h*f,e[8]=l,e[1]=p+m*l,e[5]=d-v*l,e[9]=-u*h,e[2]=v-d*l,e[6]=m+p*l,e[10]=o*h}else if(s===Un.YXZ){var y=h*c,g=h*f,x=l*c,b=l*f;e[0]=y+b*u,e[4]=x*u-g,e[8]=o*l,e[1]=o*f,e[5]=o*c,e[9]=-u,e[2]=g*u-x,e[6]=b+y*u,e[10]=o*h}else if(s===Un.ZXY){var T=h*c,E=h*f,_=l*c,w=l*f;e[0]=T-w*u,e[4]=-o*f,e[8]=_+E*u,e[1]=E+_*u,e[5]=o*c,e[9]=w-T*u,e[2]=-o*l,e[6]=u,e[10]=o*h}else if(s===Un.ZYX){var C=o*c,A=o*f,S=u*c,I=u*f;e[0]=h*c,e[4]=S*l-A,e[8]=C*l+I,e[1]=h*f,e[5]=I*l+C,e[9]=A*l-S,e[2]=-l,e[6]=u*h,e[10]=o*h}else if(s===Un.YZX){var R=o*h,O=o*l,M=u*h,N=u*l;e[0]=h*c,e[4]=N-R*f,e[8]=M*f+O,e[1]=f,e[5]=o*c,e[9]=-u*c,e[2]=-l*c,e[6]=O*f+M,e[10]=R-N*f}else if(s===Un.XZY){var P=o*h,F=o*l,L=u*h,V=u*l;e[0]=h*c,e[4]=-f,e[8]=l*c,e[1]=P*f+V,e[5]=o*c,e[9]=F*f-L,e[2]=L*f-F,e[6]=u*c,e[10]=V*f+P}else console.error("toMatrix4: Invalid order "+s);return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,t},t.fromRotationMatrix4=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,i)},t.fromQuaternion=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,i)},t.fromVector3=function(e,i){return void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromVector3(e,i)},t.fromArray=function(e,i,r){return void 0===i&&(i=0),void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromArray(e,i,r)},t}();Zn.DEFAULT_ORDER=Un.ZYX,Zn.tempQuat0=new yi,Zn.tempMat0=new _r;var qn=function(){function t(t,e,i,r,n,a,s,o,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===o&&(o=0),void 0===u&&(u=1),this.elements=[t,e,i,r,n,a,s,o,u]}var e=t.prototype;return e.set=function(t,e,i,r,n,a,s,o,u){var h=this.elements;return h[0]=t,h[3]=r,h[6]=s,h[1]=e,h[4]=n,h[7]=o,h[2]=i,h[5]=a,h[8]=u,this},e.setFromRowMajorData=function(t,e,i,r,n,a,s,o,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=i,h[1]=r,h[4]=n,h[7]=a,h[2]=s,h[5]=o,h[8]=u,this},e.setFromColumnVectors=function(t,e,i){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,i.x,i.y,i.z)},e.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},e.setFromArray=function(t,e){void 0===e&&(e=0);for(var i=0;i<9;i++)this.elements[i]=t[e+i];return this},e.setFromQuaternion=function(t){var e=t.x,i=t.y,r=t.z,n=t.w,a=e+e,s=i+i,o=r+r,u=e*a,h=e*s,l=e*o,c=i*s,f=i*o,d=r*o,p=n*a,m=n*s,v=n*o,y=this.elements;return y[0]=1-(c+d),y[1]=h+v,y[2]=l-m,y[3]=h-v,y[4]=1-(u+d),y[5]=f+p,y[6]=l+m,y[7]=f-p,y[8]=1-(u+c),this},e.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},e.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},e.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},e.copyFrom=function(t){return this.elements=[].concat(t.elements),this},e.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},e.scale=function(t,e){var i=this.elements;return i[0]*=t,i[3]*=t,i[6]*=t,i[1]*=e,i[4]*=e,i[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),i=Math.sin(t),r=this.elements,n=r[0],a=r[3],s=r[6],o=r[1],u=r[4],h=r[7];return r[0]=e*n+i*o,r[3]=e*a+i*u,r[6]=e*s+i*h,r[1]=-i*n+e*o,r[4]=-i*a+e*u,r[7]=-i*s+e*h,this},e.translate=function(t,e){var i=this.elements;return i[0]+=t*i[2],i[3]+=t*i[5],i[6]+=t*i[8],i[1]+=e*i[2],i[4]+=e*i[5],i[7]+=e*i[8],this},e.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},e.premultiply=function(t){return this.multiplyMatrices(t,this)},e.multiplyMatrices=function(t,e){var i=t.elements,r=e.elements,n=this.elements,a=i[0],s=i[3],o=i[6],u=i[1],h=i[4],l=i[7],c=i[2],f=i[5],d=i[8],p=r[0],m=r[3],v=r[6],y=r[1],g=r[4],x=r[7],b=r[2],T=r[5],E=r[8];return n[0]=a*p+s*y+o*b,n[3]=a*m+s*g+o*T,n[6]=a*v+s*x+o*E,n[1]=u*p+h*y+l*b,n[4]=u*m+h*g+l*T,n[7]=u*v+h*x+l*E,n[2]=c*p+f*y+d*b,n[5]=c*m+f*g+d*T,n[8]=c*v+f*x+d*E,this},e.determinant=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],s=t[7],o=t[2],u=t[5],h=t[8];return e*(a*h-u*s)+n*(u*r-i*h)+o*(i*s-a*r)},e.invert=function(){var t=this.elements,e=t[0],i=t[3],r=t[6],n=t[1],a=t[4],s=t[7],o=t[2],u=t[5],h=t[8],l=h*a-u*s,c=u*r-h*i,f=s*i-a*r,d=e*l+n*c+o*f;if(0===d)return this.set(0,0,0,0,0,0,0,0,0);var p=1/d;return t[0]=l*p,t[1]=(o*s-h*n)*p,t[2]=(u*n-o*a)*p,t[3]=c*p,t[4]=(h*e-o*r)*p,t[5]=(o*i-u*e)*p,t[6]=f*p,t[7]=(n*r-s*e)*p,t[8]=(a*e-n*i)*p,this},e.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},e.transformPoint=function(t,e){var i=t.x,r=t.y,n=t.z,a=this.elements,s=null!=e?e:t;return s.x=a[0]*i+a[3]*r+a[6]*n,s.y=a[1]*i+a[4]*r+a[7]*n,s.z=a[2]*i+a[5]*r+a[8]*n,s},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,i=t.elements,r=0;r<9;r++)if(!ui(e[r],i[r]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var i=this.elements;t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,i,r){return(new t).setFromColumnVectors(e,i,r)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,i){return void 0===i&&(i=0),(new t).setFromArray(e,i)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,i,r,n,a,s,o,u,h){return new t(e,n,o,i,a,u,r,s,h)},t}(),Kn=function(){function t(t,e){void 0===t&&(t=vi.ZERO),void 0===e&&(e=vi.X),this.origin=new vi,this.direction=new vi,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}var e=t.prototype;return e.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},e.clone=function(){return new t(this.origin,this.direction)},e.copyFrom=function(t){return this.set(t.origin,t.direction)},e.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},e.at=function(t,e){var i=e||new vi;return i.copyFrom(this.origin),i.addScaledVector(this.direction,t)},e.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},e.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},e.intersectBox=function(t,e){var i,r,n,a,s,o,u=this.origin,h=u.x,l=u.y,c=u.z,f=this.direction,d=f.x,p=f.y,m=f.z,v=t.min,y=v.x,g=v.y,x=v.z,b=t.max,T=b.x,E=b.y,_=b.z,w=1/d,C=1/p,A=1/m;if(w>=0?(i=(y-h)*w,r=(T-h)*w):(i=(T-h)*w,r=(y-h)*w),C>=0?(n=(g-l)*C,a=(E-l)*C):(n=(E-l)*C,a=(g-l)*C),!(i>a||n>r||((n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),(n>i||i!=i)&&(i=n),(a<r||r!=r)&&(r=a),A>=0?(s=(x-c)*A,o=(_-c)*A):(s=(_-c)*A,o=(x-c)*A),i>o||s>r||((s>i||i!=i)&&(i=s),(o<r||r!=r)&&(r=o),r<0))))return i>=0?this.at(i,e):this.at(r,e)},e.intersectPlane=function(t,e){var i=t.normal,r=t.distance,n=i.dot(this.direction);if(0===n)return 0===i.dot(this.origin)+r?(e||new vi).copyFrom(this.origin):void 0;var a=-(this.origin.dot(i)+r)/n;return a>=0?this.at(a,e):void 0},e.intersectSphere=function(e,i){var r=e.center,n=t.tempVec0.subtractVectors(r,this.origin),a=n.dot(this.direction),s=n.dot(n)-a*a,o=e.radius*e.radius;if(!(s>o)){var u=Math.sqrt(o-s),h=a-u,l=a+u;if(!(l<0))return h>=0?this.at(h,i):this.at(l,i)}},e.intersectTriangle=function(e,i,r){var n,a=e.p0,s=e.p1,o=e.p2,u=t.tempVec0.subtractVectors(s,a),h=t.tempVec1.subtractVectors(o,a),l=t.tempVec2.subtractVectors(this.origin,a),c=t.tempVec3.crossVectors(u,h),f=this.direction.dot(c);if(f>0){if(r)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(l,h);var d=n*this.direction.dot(h);if(!(d<0)){u.cross(l);var p=n*this.direction.dot(u);if(!(p<0||d+p>f)){var m=-n*l.dot(c);if(!(m<0))return this.at(m/f,i)}}},t}();Kn.tempVec0=new vi,Kn.tempVec1=new vi,Kn.tempVec2=new vi,Kn.tempVec3=new vi;var Qn,Jn,$n=function(){function t(t,e){void 0===t&&(t=new vi(1/0,1/0,1/0)),void 0===e&&(e=new vi(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}var e=t.prototype;return e.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},e.setFromArray=function(t){for(var e=Number(1/0),i=Number(1/0),r=Number(1/0),n=-1/0,a=-1/0,s=-1/0,o=0,u=t.length;o<u;o+=3){var h=t[o],l=t[o+1],c=t[o+2];h<e&&(e=h),l<i&&(i=l),c<r&&(r=c),h>n&&(n=h),l>a&&(a=l),c>s&&(s=c)}return this.min.set(e,i,r),this.max.set(n,a,s),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var i=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(i),this.max.copyFrom(t).add(i),this},e.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},e.clone=function(){return(new t).copyFrom(this)},e.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},e.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},e.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},e.getCenter=function(t){return void 0===t&&(t=new vi),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},e.getSize=function(t){return void 0===t&&(t=new vi),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},e.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},e.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},e.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},e.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var i=e.geometry;if(void 0!==i){null===i.boundingBox&&i.computeBoundingBox();var r=new t;r.copyFrom(i.boundingBox),r.applyMatrix4(e.matrixWorld),this.union(r)}for(var n=e.children,a=0,s=n.length;a<s;a++)this.expandByObject(n[a]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new vi),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},e.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},e.intersectsSphere=function(t){var e=new vi;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},e.clampPoint=function(t,e){return void 0===e&&(e=new vi),e.copyFrom(t).clamp(this.min,this.max)},e.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},e.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},e.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},e.applyMatrix4=function(t,e){if(void 0===e&&(e=new vi),this.isEmpty())return this;var i=this.getOBBPoints(t,e);return this.setFromPoints(i),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new vi),this.isEmpty())return[];var i=[];return i[0]=new vi(this.min.x,this.min.y,this.min.z),i[1]=new vi(this.min.x,this.min.y,this.max.z),i[2]=new vi(this.min.x,this.max.y,this.min.z),i[3]=new vi(this.min.x,this.max.y,this.max.z),i[4]=new vi(this.max.x,this.min.y,this.min.z),i[5]=new vi(this.max.x,this.min.y,this.max.z),i[6]=new vi(this.max.x,this.max.y,this.min.z),i[7]=new vi(this.max.x,this.max.y,this.max.z),i.forEach((function(i){i.subtract(e),i.applyMatrix(t),i.add(e)})),i},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new vi;return t.radius=.5*this.getSize(e).length(),t},e.translate=function(t){return this.min.add(t),this.max.add(t),this},e.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),ta=function(){function t(t,e){void 0===t&&(t=vi.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}var e=t.prototype;return e.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},e.setFromPoints=function(t,e){var i=this.center;if(void 0!==e){i.copyFrom(e);for(var r=0,n=0;n<t.length;n++)r=Math.max(r,i.distanceSquared(t[n]));this.radius=Math.sqrt(r)}else{var a=(new $n).setFromPoints(t);a.getCenter(i),this.radius=a.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var i=this.center.distanceSquared(t);return void 0===e&&(e=new vi),e.copyFrom(t),i>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},e.getBoundingBox=function(t){return void 0===t&&(t=new $n),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){var e=t.elements,i=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],a=Math.sqrt(Math.max(i,r,n));return this.center.applyMatrix(t),this.radius=this.radius*a,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new vi).subtractVectors(t,this.center),i=e.lengthSquared();if(i>this.radius*this.radius){var r=Math.sqrt(i),n=.5*(r-this.radius);this.center.add(e.multiply(n/r)),this.radius+=n}return this},e.union=function(t){var e=new vi,i=new vi;return i.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(i)),this.expandByPoint(e.copyFrom(t.center).subtract(i)),this},e.intersect=function(t){var e=(new vi).subtractVectors(this.center,t.center),i=e.length();return i>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(i/2)),this.radius=this.radius+t.radius-i,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new t).copyFrom(this)},t}(),ea=Object.freeze({__proto__:null,get EulerOrder(){return Un},Euler:Zn,Quaternion:yi,Vector2:mi,Vector3:vi,Vector4:gr,Matrix3:qn,Matrix4:_r,Ray:Kn,PI2:ni,DEG2RAD:ai,RAD2DEG:si,NumberEpsilon:oi,isZero:function(t){return isNaN(t)||Math.abs(t)<oi},isEqual:ui,damp:function(t,e,i,r){return hi(t,e,1-Math.exp(-i*r))},lerp:hi,degToRad:function(t){return t*ai},radToDeg:function(t){return t*si},clamp:li,Color:Er,Box3:$n,Sphere:ta}),ia=1,ra=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).destroyed=!1,r.visible=!0,i){var n=i.material,a=i.geometry,s=i.name,o=void 0===s?"<unnamed>":s,u=i.priority,h=void 0===u?0:u,l=i.worldMatrix,c=void 0===l?_r.fromIdentity():l;r.id="Mesh"+ia++,r.name=o,r.geometry=a,r.material=n,r.priority=h,r.worldMatrix=c}else r.id="Mesh"+ia++,r.name="<unnamed>",r.worldMatrix=_r.fromIdentity(),r._priority=0;return r}$t(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.render=function(t){this.isDestroyed||this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},i.firstGeometry=function(){return this.geometry},i.setMaterial=function(t,e){e!==mt.keep&&this.material.dispose(e),this.material=t},i.restore=function(){},i.dispose=function(t){if(!this.destroyed){(null==t?void 0:t.geometries)!==mt.keep&&this.geometry.dispose();var e=null==t?void 0:t.material;e!==mt.keep&&this.material.dispose(e),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},dr(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(yr),na=0,aa=1e3,sa=3e3;!function(t){t[t.none=0]="none",t[t.color=1]="color",t[t.stencil_8_opaque=2]="stencil_8_opaque",t[t.depth_16_opaque=3]="depth_16_opaque",t[t.depth_stencil_opaque=4]="depth_stencil_opaque",t[t.depth_16_texture=5]="depth_16_texture",t[t.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture"}(Qn||(Qn={})),function(t){t[t.store=0]="store",t[t.clear=2]="clear"}(Jn||(Jn={}));var oa,ua=function(){function t(t,e){if(this.destroyed=!1,e){var i=e.texture,r=e.size;if(C(i,fn))this.texture=i,this.externalTexture=!0;else if(i){var n=i.wrapT,a=i.wrapS,s=i.minFilter,o=i.magFilter,u=i.internalFormat,h=i.format,l=void 0===h?Mr.RGBA:h,c=i.type,f=void 0===c?Mr.UNSIGNED_BYTE:c;this.externalTexture=!1,this.textureOptions={size:r,format:l,type:f,internalFormat:u||l,wrapT:n,wrapS:a,minFilter:s,magFilter:o,name:e.name},this.texture=fn.create(t,ri({},this.textureOptions,{sourceType:Rr.framebuffer,data:{width:r[0],height:r[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},dr(t,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),t}();!function(t){t[t.force=0]="force",t[t.keep=1]="keep",t[t.keepExternal=2]="keepExternal",t[t.destroy=0]="destroy"}(oa||(oa={}));var ha=1,la=function(){function t(t,e){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=e.name,r=void 0===i?"RenderPass_"+ha++:i,n=e.clearAction,a=e.semantics,s=e.depthStencilAttachment,o=e.storeAction,u=e.priority,h=void 0===u?0:u,l=e.meshOrder,c=void 0===l?W.ascending:l,f=e.meshes,d=void 0===f?[]:f,p=e.delegate,m=void 0===p?{}:p;this.name=r,this.renderer=t,this.priority=h,this.meshOrder=c,this.meshes=nt(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||0,this.clearAction=ri({},n),this.storeAction=ri({colorAction:0,depthAction:0,stencilAction:0},o),this.semantics=new Xn(a),this.options=e,this.delegate=m,this.setViewportOptions(e)}var e=t.prototype;return e.addMesh=function(t){at(this.meshes,t,this.meshOrder)},e.removeMesh=function(t){D(this.meshes,t)},e.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),nt(this.meshes,this.meshOrder),this.meshes},e.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.configure=function(t){if(this.framebuffer)t.setFramebuffer(this.framebuffer);else{var e=this.getViewport(),i=e[0],r=e[1],n=e[2],a=e[3];t.setViewport(i,r,n,a)}},e.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.frameCleanup=function(t){},e.resetColorAttachments=function(t){var e=this;if(t.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=t.map((function(t){return t.updateSource({sourceType:Rr.framebuffer}),new ua(e.renderer.engine,{texture:t})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=i,this.framebuffer&&(this.framebuffer.bind(),this.framebuffer.resetColorTextures(t.map((function(t){return t}))))}else this.resetAttachments({attachments:t.map((function(t){return{texture:t}}))})},e.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.framebuffer){var e=this.customViewport;this.framebuffer.isCustomViewport=!1,this.framebuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.framebuffer&&(this.framebuffer.isCustomViewport=!0,this.framebuffer.viewportScale=this.viewportScale)},e._resetAttachments=function(){var t,e,i=this,r=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var a=this.viewportScale,s=this.isCustomViewport?this.customViewport:[0,0,r.getWidth()*a,r.getHeight()*a],o=[s[2],s[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map((function(t,e){var r;return new ua(i.renderer.engine,ri({size:o,name:(null==(r=t.texture)?void 0:r.name)||u+"##color_"+e},t))}));this.attachments=h;var l=qa.create({storeAction:this.storeAction,name:u,viewport:s,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},r);l.bind(),l.unbind(),this.framebuffer=l}else this.attachments.length=0},e.getViewport=function(){var t,e=(null==(t=this.framebuffer)?void 0:t.viewport)||this.customViewport;if(e)return e;var i=this.renderer,r=this.viewportScale;return i?[0,0,i.getWidth()*r,i.getHeight()*r]:[0,0,0,0]},e.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:i}}},e.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),i=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:i}}},e.getDepthTexture=function(t,e){if(!this.depthTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.getStencilTexture=function(t,e){if(!this.stencilTexture){var i,r=null==(i=this.options.depthStencilAttachment)?void 0:i.texture,n=t===r?r:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.dispose=function(t){if(!this.destroyed){var e=(null==t?void 0:t.meshes)||void 0;e!==mt.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0;var i=(null==t?void 0:t.colorAttachment)?t.colorAttachment:0;this.attachments.forEach((function(t){t.externalTexture&&2===i||1===i||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==mt.keep&&this.semantics.dispose(),this.destroyed=!0;var r,n,a=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:0,s=this.framebuffer;if(s)if(s.dispose({depthStencilAttachment:a}),!(s.externalStorage&&2===a||1===a))null==(r=this.stencilTexture)||r.dispose(),null==(n=this.depthTexture)||n.dispose();this.options=this.renderer=null,this.initialize=Ct}},dr(t,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewport",get:function(){return this.getViewport()}},{key:"stencilAttachment",get:function(){return this.getStencilAttachment()}},{key:"depthAttachment",get:function(){return this.getDepthAttachment()}}]),t}(),ca="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",fa="#version 100\nprecision highp float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}varying vec4 vColor;varying vec4 vTexCoord;varying highp vec2 vParams;uniform vec3 uFrameColor;void main(){gl_FragColor=vec4(uFrameColor.xyz,1.0);}",da="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.;}",pa="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;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid 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);}\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",ma="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D _MainTex;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}void main(){vec4 color=vec4(0.);\n#ifdef TRANSPARENT_VIDEO\nfloat halfX=vTexCoord.x*0.5;vec2 uv_rgb=vec2(halfX,vTexCoord.y);vec2 uv_alpha=vec2(halfX+0.5,vTexCoord.y);vec3 rgb=texture2D(_MainTex,uv_rgb).rgb;float alpha=max(texture2D(_MainTex,uv_alpha).r,1e-5);vec4 texColor=vec4(rgb/alpha,alpha);\n#else\nvec4 texColor=texture2D(_MainTex,vTexCoord.xy);\n#endif\ncolor=blendColor(texColor,vColor,floor(0.5+vParams.y));\n#ifdef ALPHA_CLIP\nif(color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",va="#version 100\nprecision mediump float;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\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\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",ya="#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;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvoid main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nmat3 aRotation=mat3(aRotation0,aRotation1,aRotation2);vec3 point=aRotation*(aDirX*size.x+aDirY*size.y);vec3 _pos=aPos+aTranslation;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n_pos.xyz+=aLinearMove;\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}}",ga="#version 100\nprecision mediump float;\n#define SHADER_VERTEX 1\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}attribute vec4 aPos;attribute vec3 aDir;attribute vec3 aInfo;attribute vec4 aColor;attribute float aTime;\n#ifdef ATTR_TRAIL_START\nattribute float aTrailStart;\n#else\nuniform float uTrailStart[64];attribute float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nvarying float vLife;varying vec2 vTexCoord;varying vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",xa="#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.;}",ba="#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",Ta="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",Ea="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;uniform vec3 _VignetteColor;uniform vec2 _VignetteCenter;uniform float _VignetteIntensity;uniform float _VignetteSmoothness;uniform float _VignetteRoundness;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}vec3 ApplyVignette(vec3 inputColor,vec2 uv,vec2 center,float intensity,float roundness,float smoothness,vec3 color){vec2 dist=abs(uv-center)*intensity;dist.x*=roundness;float vfactor=pow(clamp((1.0-dot(dist,dist)),0.0,1.0),smoothness);return inputColor*mix(color,vec3(1.0),vfactor);}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}if(_VignetteIntensity>0.0){finalColor=ApplyVignette(finalColor,uv,_VignetteCenter,_VignetteIntensity,_VignetteRoundness,_VignetteSmoothness,_VignetteColor);}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=max(vec3(0.0),ACESToneMapping(finalColor));}float alpha=min(hdrColor.a,1.0);gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),alpha);}",_a="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",wa="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);}",Ca="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);}",Aa="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);}",Sa="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);}",Ia={},Ra=function(){function t(){}return t.registerInclude=function(t,e){Ia[t]&&vt.warn('The "'+t+'" shader include already exist.'),Ia[t]=e},t.unRegisterInclude=function(t){delete Ia[t]},t.unRegisterAllIncludes=function(){Object.keys(Ia).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var i=e.level,r=e.shaderType,n=e.shader,a=e.macros,s=e.removeVersion,o=t.genMacroString(i,a),u=t.genShaderVersion(i),h=t.parseIncludes(n),l=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==i||l||(h=t.convertTo300(h,r===Ar.fragment)),s?o+h:u+o+h},t.convertTo300=function(e,i){if(e=(e=(e=e.replace(/\bvarying\b/g,i?"in":"out")).replace(/\btexture(2D|Cube)\b/g,"texture")).replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,""),i){if(e=(e=(e=e.replace(/\btexture(2D|Cube)LodEXT\b/g,"textureLod")).replace(/\btexture(2D|Cube)GradEXT\b/g,"textureGrad")).replace(/\bgl_FragDepthEXT\b/g,"gl_FragDepth"),!t.has300Output(e))if(/\bgl_FragData\[.+?\]/g.test(e)){var r=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);r&&(e=t.replaceMRTShader(e,r))}else e=(e=e.replace(/void\s+?main\s*\(/g,"out vec4 glFragColor;\nvoid main(")).replace(/\bgl_FragColor\b/g,"glFragColor")}else e=e.replace(/\battribute\b/g,"in");return e},t.parseIncludes=function(t,e){var i;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(i=e.exec(t));){var r=i[1],n=Ia[r];if(void 0===n)throw new Error("Can't find include shader name "+r);t=t.replace(i[0],n)}return t},t.genMacroString=function(t,e,i){void 0===i&&(i=!0);var r=[],n="WEBGL"+t;return r.push("#ifndef "+n),r.push("#define "+n),r.push("#endif"),i&&r.push("#define GE_RUNTIME"),e&&e.length&&e.forEach((function(t){var e=t[0],i=t[1];!0===i?r.push("#define "+e):Number.isFinite(i)&&r.push("#define "+e+" "+i)})),r.length?r.join("\n")+"\n":""},t.genShaderVersion=function(t){return 1===t?"#version 100\n":"#version 300 es\n"},t.isVersion300=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return(e?e[0]:"").includes("300")},t.removeWebGLVersion=function(t){var e=t.match(/#version\s+\b\d{3}\b\s*(es)?/);return e?t.replace(e[0],""):t},t.has300Output=function(t){return/\bout\s+(?:\w+\s+)?(?:vec4)\s+(?:\w+)\s*;/.test(t)},t.replaceMRTShader=function(t,e){for(var i=new Set,r="",n=0;n<e.length;n++){var a=e[n].match(/\bgl_FragData\[(.+?)\]/);a&&i.add(a[1])}return i.forEach((function(t){r+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),r+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,r)},t}(),Oa=function(t){function e(e,i){var r,n=(r=t.call(this,e,i)||this).renderer.engine,a=Wn.create(n,{mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=On.create(n,{shader:{vertex:Ta,fragment:Sa,glslVersion:In.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,r.screenMesh=ra.create(n,{geometry:a,material:s,priority:0}),r.priority=5e3,r}$t(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},i.execute=function(t){var e,i,r;t.clear({colorAction:Jn.clear,depthAction:Jn.clear,stencilAction:Jn.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var n=null!=(r=null==(i=t.renderingData.currentFrame.globalVolume)||null==(e=i.bloom)?void 0:e.threshold)?r:1;this.screenMesh.material.setFloat("_Threshold",n),t.renderMeshes([this.screenMesh])},e}(la),Ma=function(t){function e(e,i,r){var n;(n=t.call(this,e,r)||this).type=i;var a=n.renderer.engine,s="PostProcess",o=Wn.create(a,{name:s,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u={vertex:Ta,fragment:"H"===i?wa:Ca,glslVersion:In.GLSL1},h=On.create(a,{name:s,shader:u});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=ra.create(a,{name:s,geometry:o,material:h,priority:0}),n.priority=5e3,n}$t(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.execute=function(t){t.clear({colorAction:Jn.clear,depthAction:Jn.clear,stencilAction:Jn.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",Da(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFramebuffer().getColorTextures()[0])},e}(la),Na=function(t){function e(e,i){var r,n="PostProcess",a=(r=t.call(this,e,i)||this).renderer.engine,s=Wn.create(a,{name:n,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o={vertex:Ta,fragment:Aa},u=On.create(a,{name:n,shader:o});return u.blending=!1,u.depthTest=!1,u.culling=!1,r.screenMesh=ra.create(a,{name:n,geometry:s,material:u,priority:0}),r.priority=5e3,r}$t(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},i.execute=function(t){t.clear({colorAction:Jn.clear,depthAction:Jn.clear,stencilAction:Jn.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",Da(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},e}(la),Pa=function(t){function e(e,i){var r,n="PostProcess",a=(r=t.call(this,e,{})||this).renderer.engine;r.sceneTextureHandle=i||new ua(a);var s=Wn.create(a,{name:n,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=On.create(a,{name:n,shader:{vertex:Ta,fragment:Ea,glslVersion:In.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,r.screenMesh=ra.create(a,{name:n,geometry:s,material:o,priority:0}),r.priority=5e3,r}$t(e,t);var i=e.prototype;return i.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},i.execute=function(t){t.clear({colorAction:Jn.clear,depthAction:Jn.clear,stencilAction:Jn.clear});var e=t.renderingData.currentFrame.globalVolume,i=ri({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),r=ri({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=ri({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),a=ri({active:!1},null==e?void 0:e.tonemapping);this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",Math.pow(2,n.brightness)),this.screenMesh.material.setFloat("_Saturation",.01*n.saturation+1),this.screenMesh.material.setFloat("_Contrast",.01*n.contrast+1),this.screenMesh.material.setInt("_UseBloom",Number(i.active)),i.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i.intensity)),r.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",r.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",r.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",r.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new mi(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new vi(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(a.active)),t.renderMeshes([this.screenMesh])},e}(la),Fa="_effects_default_",La=1,Va=function(){function t(t){var e;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=t.camera,r=t.keepColorBuffer,n=t.renderer,a=t.editorTransform,s=void 0===a?[1,1,0,0]:a,o=t.globalVolume,u=t.postProcessingEnabled,h=void 0!==u&&u,l=t.clearAction,c=void 0===l?{colorAction:Ir.whatever,stencilAction:Ir.clear,depthAction:Ir.whatever}:l,f=n.engine;o&&(this.globalVolume=o),this.globalUniforms=new ja;var d,p=[],m={};if(this.renderer=n,h){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");var v=Mr.HALF_FLOAT;p=[{texture:{format:Mr.RGBA,type:v,magFilter:Mr.LINEAR,minFilter:Mr.LINEAR}}],d={storageType:Qn.depth_stencil_opaque},m={colorAction:Ir.clear,stencilAction:Ir.clear,depthAction:Ir.clear}}this.drawObjectPass=new la(n,{name:Fa,priority:aa,meshOrder:W.ascending,depthStencilAttachment:d,attachments:p,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),h){var g=new ua(f),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=new Array(7),T=Mr.HALF_FLOAT,E=new Oa(n,{name:"BloomThresholdPass",attachments:[{texture:{format:Mr.RGBA,type:T,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new ua(f);var w=new Ma(n,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:Mr.RGBA,type:T,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR}}]}),C=new Ma(n,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:Mr.RGBA,type:T,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR}}]});C.gaussianResult=b[_],this.addRenderPass(w),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var A=0;A<6;A++){var S=new Na(n,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:Mr.RGBA,type:T,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR}}]});S.gaussianDownSampleResult=b[5-A],this.addRenderPass(S),x[2]*=2,x[3]*=2}var I=new Pa(n,g);this.addRenderPass(I)}this.semantics=new Xn(t.semantics),this.clearAction=c,this.name="RenderFrame"+La++;var R=y[0];this.emptyTexture=mn(f),this.transparentTexture=vn(f),this.camera=i,this.keepColorBuffer=r,this.renderPassInfoMap.set(R,{listStart:0,listEnd:0,renderPass:R,intermedia:!1}),this.editorTransform=gr.fromArray(s),t.clearAction||this.resetClearActions(),this.passTextureCache=new jn(f);var O=f.gpuCapability,M=O.detail,N=kn(O.level,M.readableDepthStencilTextures&&M.writableFragDepth);null==(e=this.renderer.getShaderLibrary())||e.addShader(N)}var e=t.prototype;return e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){(null==t?void 0:t.semantics)!==mt.keep&&this.semantics.dispose();var e,i,r=(null==t?void 0:t.passes)?t.passes:void 0;(r!==mt.keep&&this._renderPasses.forEach((function(t){t.dispose(r)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource)&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(i=this.resource.depthStencil)||null==(e=i.texture)||e.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null);this.destroyed=!0},e.resetRenderPassDefaultAttachment=function(t,e){for(var i,r=this.resource,n=r.color_a,a=r.color_b,s=e;s<t.length;s++){var o,u,h=t[s],l=null==(o=h.attachments[0])?void 0:o.texture;if(l&&i===l){var c=l===n?a:n;h.resetColorAttachments([c])}(l=null==(u=h.attachments[0])?void 0:u.texture)&&(i=l)}},e.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(i,r){return!i.name.startsWith(Fa)||!i.meshes.includes(t)||(e=r,!1)})),e},e.addToRenderPass=function(t,e){var i=this.renderPassInfoMap.get(t),r=e.priority;i&&(0===t.meshes.length?i.listStart=i.listEnd=r:r<i.listStart?i.listStart=r:r>i.listEnd&&(i.listEnd=r),t.addMesh(e))},e.getRPAttachments=function(t,e){if(1===(null==t?void 0:t.length)){var i,r=t[0],n=r.texture,a=r.persistent,s=n.format,o=null!=(i=null==e?void 0:e.getInitAttachments())?i:[];if(s===Mr.RGBA&&!a){var u=this.resource.color_a;return 0===o.length?[{texture:u}]:[{texture:o[0].texture===u?this.resource.color_b:u}]}}return t},e.resetClearActions=function(){var t=this.renderPasses.length>1?Ir.clear:Ir.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=Ir.whatever)},e.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.createResource=function(){var t=this.renderer.engine;if(!this.resource){var e,i=t.gpuCapability,r=i.detail,n=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),o=2===n?Mr.LINEAR:Mr.NEAREST,u=fn.create(t,{sourceType:Rr.framebuffer,format:Mr.RGBA,name:"frame_a",minFilter:o,magFilter:o}),h=fn.create(t,{sourceType:Rr.framebuffer,format:Mr.RGBA,data:{width:a,height:s},minFilter:o,magFilter:o,name:"frame_b"}),l=r.readableDepthStencilTextures&&r.writableFragDepth?Qn.depth_24_stencil_8_texture:Qn.depth_stencil_opaque,c=new la(this.renderer,{depthStencilAttachment:{storageType:l},attachments:[{texture:u}]}).initialize(this.renderer),f=new Ga(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:Ir.clear,stencilAction:Ir.clear,colorAction:Ir.clear},meshOrder:W.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(e=c.getDepthAttachment())?void 0:e.texture})]});this.resource={color_a:c.attachments[0].texture,color_b:h,finalCopyRP:f,depthStencil:c.depthAttachment,resRP:c}}},e.createCopyMesh=function(t){var e,i=Fn,r=this.renderer.engine,n=Wn.create(r,{name:i,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=kn(r.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(a);var s=On.create(r,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:i,shader:a});return s.blending=!1,s.depthTest=!1,s.culling=!1,(null==t?void 0:t.blend)&&(s.blending=!0,s.blendFunction=[Mr.SRC_ALPHA,Mr.ONE_MINUS_SRC_ALPHA,Mr.SRC_ALPHA,Mr.ONE_MINUS_SRC_ALPHA]),ra.create(r,{name:i,geometry:n,material:s,priority:0})},e.removeRenderPass=function(t){D(this._renderPasses,t)},dr(t,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function Da(t){return t?new mi(t.getWidth(),t.getHeight()):new mi}function ka(t,e){var i=t.indexOf(e);return t[i-1]}var za,Ua,Ba,Ga=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},i.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Da(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(la),ja=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Xa=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,i=t.format,r=t.attachment;this.storageType=e,this.format=i,this.attachment=r}return dr(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Ha="function"==typeof o,Wa=function(){function t(t){this.setupCapability(t)}var e=t.prototype;return e.setupCapability=function(t){var e,i=Ha&&C(t,o)?2:1,r=2===i,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),a=t.getExtension("WEBGL_depth_texture"),s=!!t.getExtension("OES_texture_half_float_linear"),u=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=r?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),a&&(this.UNSIGNED_INT_24_8=a.UNSIGNED_INT_24_8_WEBGL),r&&!s&&(s=Ya(t,t.HALF_FLOAT)),r&&!u&&(u=Ya(t,t.FLOAT)),this.internalFormatDepth16=r?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=r?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var h=r||t.getExtension("OES_texture_float")?t.FLOAT:0,l=r?o.HALF_FLOAT:(null==(e=t.getExtension("OES_texture_half_float"))?void 0:e.HALF_FLOAT_OES)||0,c={floatTexture:h,halfFloatTexture:l,maxSample:r?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):h>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:r?!!t.getExtension("EXT_color_buffer_float"):l>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:Za(t),halfFloatLinear:s,floatLinear:u,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:r||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:r||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:r||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:r||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:r||!!a,writableFragDepth:r||!!t.getExtension("EXT_frag_depth")};this.detail=c,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.framebufferTexture2D=function(t,e,i,r,n){var a=this.drawBufferExtension;if(1===this.level&&!a&&i>0)throw new Error("Draw multiple color buffers not available.");var s=a?a["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i];s?t.framebufferTexture2D(e,s,r,n,0):console.error("Invalid color attachment index: "+i+".")},e.drawBuffers=function(t,e){var i=this.drawBufferExtension;if(1!==this.level||i){var r=e.map((function(e,r){return e?i?i["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r]:t.NONE}));i?i.drawBuffersWEBGL(r):t.drawBuffers(r)}else if(e.length>1)throw new Error("Draw buffers not available.")},e.setTextureAnisotropic=function(t,e,i){var r=this.detail.maxTextureAnisotropy;r&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(r,i||4))},t}();function Ya(t,e){var i=t.createTexture(),r=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(r=!0),t.deleteTexture(i),r}function Za(t){return t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0}!function(t){t[t.NONE=0]="NONE",t[t.PVRTC=1]="PVRTC",t[t.ASTC=2]="ASTC"}(za||(za={})),function(t){t[t.Nearest=0]="Nearest",t[t.Linear=1]="Linear"}(Ua||(Ua={})),function(t){t[t.RGBA32=0]="RGBA32",t[t.RGBAHalf=1]="RGBAHalf"}(Ba||(Ba={}));var qa=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,i,r){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},dr(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),Ka=function(){function t(){}var e=t.prototype;return e.setGlobalFloat=function(t,e){},e.setGlobalInt=function(t,e){},e.setGlobalVector4=function(t,e){},e.setGlobalVector3=function(t,e){},e.setGlobalMatrix=function(t,e){},e.getFramebuffer=function(){return null},e.setFramebuffer=function(t){},e.setViewport=function(t,e,i,r){},e.resize=function(t,e){},e.clear=function(t){},e.getWidth=function(){return 0},e.getHeight=function(){return 0},e.addLostHandler=function(t){},e.addRestoreHandler=function(t){},e.lost=function(t){},e.restore=function(){},e.getShaderLibrary=function(){},e.renderRenderFrame=function(t){},e.renderMeshes=function(t){},e.drawGeometry=function(t,e,i){},e.getTemporaryRT=function(t,e,i,r,n,a){return null},e.dispose=function(t){},t}(),Qa=function(){function t(t){var e=this;Object.keys(t).forEach((function(i){e[i]=t[i]}))}return t.prototype.generate=function(t){var e=Ja(this.arc,this.arcMode,t)*ai,i=Math.cos(e)*this.radius,r=Math.sin(e)*this.radius,n=new vi(i,r,0),a=Math.tan(this.angle*ai),s=n.clone().multiply(a);return s.z+=1,{position:n.multiply(wt(0,1)),direction:s.normalize()}},t}();function Ja(t,e,i){if(e===ae.RANDOM)t=wt(0,t);else if(e===ae.UNIDIRECTIONAL_CYCLE){var r=i.index%(i.total+1);t=t/i.total*r}else if(e===ae.BIDIRECTIONAL_CYCLE){var n=i.index/(i.total+1),a=n-Math.floor(n);t*=Math.floor(n)%2?1-a:a}else e===ae.UNIFORM_BURST&&(t=t*i.burstIndex/i.burstCount);return t}var $a,ts=function(){function t(t){var e=this;Object.keys(t).forEach((function(i){e[i]=t[i]}))}return t.prototype.generate=function(t){var e=Ja(this.arc,this.arcMode,t)*ai,i=new vi(Math.cos(e),Math.sin(e),0),r=this.radius;return{direction:i,position:i.clone().multiply(r)}},t}(),es=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=wt(-this._d,this._d),i=wt(-this._h,this._h);return{direction:new vi(0,0,1),position:new vi(e,i,0)}},t}(),is=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=Ja(this.arc,this.arcMode,t)*ai,i=new vi(Math.cos(e),Math.sin(e),0),r=this._d,n=this._h,a=Math.atan2(n,r),s=Math.tan(e),o=new vi;return e<a?o.set(r,r*s,0):e>=a&&e<Math.PI-a?o.set(n/s,n,0):e<Math.PI+a?o.set(-r,-r*s,0):e<2*Math.PI-a?o.set(-n/s,-n,0):o.set(r,r*s,0),{direction:i,position:o}},t}(),rs=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===ae.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):wt(0,1);return{direction:new vi(0,1,0),position:new vi(this._d*(e-.5),0,0)}},t}(),ns=new _r,as=function(){function t(t){var e=this;Object.keys(t).forEach((function(i){e[i]=t[i]}))}return t.prototype.generate=function(t){var e=this.donutRadius,i=this.radius-e,r=wt(0,2*Math.PI),n=Ja(this.arc,this.arcMode,t)*ai,a=ns.setFromRotationZ(n),s=new vi(Math.cos(r),Math.sin(r),0),o=new vi(i+Math.cos(r)*e,0,Math.sin(r)*e);return{direction:a.transformNormal(s),position:a.transformPoint(o)}},t}(),ss=new _r,os=function(){function t(t){var e=this;Object.keys(t).forEach((function(i){e[i]=t[i]}))}var e=t.prototype;return e.getHorizontalAngle=function(){return wt(-90,90)},e.generate=function(t){var e=Ja(this.arc,this.arcMode,t)*ai,i=this.getHorizontalAngle()*ai,r=this.radius,n=new vi(Math.cos(i),0,Math.sin(i)),a=ss.setFromRotationZ(e).transformNormal(n);return{position:a.clone().multiply(r),direction:a}},t}(),us=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.getHorizontalAngle=function(){return wt(0,90)},e}(os),hs=function(){function t(t){var e=t.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(e.anchors),this.width=t.width||1,this.height=t.height||1,this.block=e.block,this.arcMode=t.arcMode,this.random=li(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,i=e.length/2-1,r=Math.floor(Ja(i,this.arcMode,t)),n=(e[2*r]+this.block[0]*this.random*Math.random())%1-.5,a=(e[2*r+1]+this.block[1]*this.random*Math.random())%1-.5,s=new vi(n,a,0);return{position:new vi(n*this.width,a*this.height,0),direction:s.normalize()}},t}(),ls=function(){function t(){}return t.prototype.generate=function(){return{position:new vi,direction:new vi}},t}(),cs=(($a={})[Gt.NONE]=ls,$a[Gt.CONE]=Qa,$a[Gt.SPHERE]=os,$a[Gt.HEMISPHERE]=us,$a[Gt.CIRCLE]=ts,$a[Gt.DONUT]=as,$a[Gt.RECTANGLE]=es,$a[Gt.EDGE]=rs,$a[Gt.RECTANGLE_EDGE]=is,$a[Gt.TEXTURE]=hs,$a);function fs(t){if(!t)return new ls;var e=ri({radius:1,arc:360,angle:0,arcMode:ae.RANDOM},t),i=t.type,r=cs[i];if(!r)throw new Error("Invalid shape: "+i+".");var n=new r(e);if(i!==Gt.NONE){var a=t.alignSpeedDirection,s=t.upDirection,o=void 0===s?[0,0,1]:s;n.alignSpeedDirection=a,n.upDirection=vi.fromArray(o).normalize()}return n}function ds(t,e,i,r,n){var a,s;if(n===function(t,e,i,r){for(var n=0,a=e,s=i-r;a<i;a+=r)n+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return n}(t,e,i,r)>0)for(a=e;a<i;a+=r)s=Ms(a,t[a],t[a+1],s);else for(a=i-r;a>=e;a-=r)s=Ms(a,t[a],t[a+1],s);return s&&Cs(s,s.next)&&(Ns(s),s=s.next),s}function ps(t,e){if(!t)return t;e||(e=t);var i,r=t;do{if(i=!1,r.steiner||!Cs(r,r.next)&&0!==ws(r.prev,r,r.next))r=r.next;else{if(Ns(r),(r=e=r.prev)===r.next)break;i=!0}}while(i||r!==e);return e}function ms(t){var e=t.prev,i=t,r=t.next;if(ws(e,i,r)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(Es(e.x,e.y,i.x,i.y,r.x,r.y,n.x,n.y)&&ws(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function vs(t,e,i,r){var n=t.prev,a=t,s=t.next;if(ws(n,a,s)>=0)return!1;for(var o=n.x<a.x?n.x<s.x?n.x:s.x:a.x<s.x?a.x:s.x,u=n.y<a.y?n.y<s.y?n.y:s.y:a.y<s.y?a.y:s.y,h=n.x>a.x?n.x>s.x?n.x:s.x:a.x>s.x?a.x:s.x,l=n.y>a.y?n.y>s.y?n.y:s.y:a.y>s.y?a.y:s.y,c=bs(o,u,e,i,r),f=bs(h,l,e,i,r),d=t.prevZ,p=t.nextZ;d&&d.z>=c&&p&&p.z<=f;){if(d!==t.prev&&d!==t.next&&Es(n.x,n.y,a.x,a.y,s.x,s.y,d.x,d.y)&&ws(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,p!==t.prev&&p!==t.next&&Es(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&ws(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&Es(n.x,n.y,a.x,a.y,s.x,s.y,d.x,d.y)&&ws(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&Es(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&ws(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function ys(t,e){return t.x-e.x}function gs(t,e){if(e=function(t,e){var i,r=e,n=t.x,a=t.y,s=-1/0;do{if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){var o=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=n&&o>s){if(s=o,o===n){if(a===r.y)return r;if(a===r.next.y)return r.next}i=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!i)return null;if(n===s)return i;var u,h=i,l=i.x,c=i.y,f=1/0;r=i;do{n>=r.x&&r.x>=l&&n!==r.x&&Es(a<c?n:s,a,l,c,a<c?s:n,a,r.x,r.y)&&(u=Math.abs(a-r.y)/(n-r.x),Rs(r,t)&&(u<f||u===f&&(r.x>i.x||r.x===i.x&&xs(i,r)))&&(i=r,f=u)),r=r.next}while(r!==h);return i}(t,e),e){var i=Os(e,t);ps(e,e.next),ps(i,i.next)}}function xs(t,e){return ws(t.prev,t,e.prev)<0&&ws(e.next,t,t.next)<0}function bs(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ts(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Es(t,e,i,r,n,a,s,o){return(n-s)*(e-o)-(t-s)*(a-o)>=0&&(t-s)*(r-o)-(i-s)*(e-o)>=0&&(i-s)*(a-o)-(n-s)*(r-o)>=0}function _s(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&As(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Rs(t,e)&&Rs(e,t)&&function(t,e){var i=t,r=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{i.y>a!=i.next.y>a&&i.next.y!==i.y&&n<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(r=!r),i=i.next}while(i!==t);return r}(t,e)&&(ws(t.prev,t,e.prev)||ws(t,e.prev,e))||Cs(t,e)&&ws(t.prev,t,t.next)>0&&ws(e.prev,e,e.next)>0)}function ws(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Cs(t,e){return t.x===e.x&&t.y===e.y}function As(t,e,i,r){var n=Is(ws(t,e,i)),a=Is(ws(t,e,r)),s=Is(ws(i,r,t)),o=Is(ws(i,r,e));return n!==a&&s!==o||(!(0!==n||!Ss(t,i,e))||(!(0!==a||!Ss(t,r,e))||(!(0!==s||!Ss(i,t,r))||!(0!==o||!Ss(i,e,r)))))}function Ss(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Is(t){return t>0?1:t<0?-1:0}function Rs(t,e){return ws(t.prev,t,t.next)<0?ws(t,e,t.next)>=0&&ws(t,t.prev,e)>=0:ws(t,e,t.prev)<0||ws(t,t.next,e)<0}function Os(t,e){var i=new Ps(t.i,t.x,t.y),r=new Ps(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,a.next=r,r.prev=a,r}function Ms(t,e,i,r){var n=new Ps(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function Ns(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ps(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Fs=0;function Ls(t,e,i,r){i=i||2,Fs=r||0;var n,a,s,o,u,h,l,c=e&&e.length,f=c?e[0]*i:t.length,d=ds(t,0,f,i,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(t,e,i,r){var n,a,s,o=[];for(n=0,a=e.length;n<a;n++)(s=ds(t,e[n]*r,n<a-1?e[n+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),o.push(Ts(s));for(o.sort(ys),n=0;n<o.length;n++)gs(o[n],i),i=ps(i,i.next);return i}(t,e,d,i)),t.length>80*i){n=s=t[0],a=o=t[1];for(var m=i;m<f;m+=i)(u=t[m])<n&&(n=u),(h=t[m+1])<a&&(a=h),u>s&&(s=u),h>o&&(o=h);l=0!==(l=Math.max(s-n,o-a))?1/l:0}return Vs(d,p,i,n,a,l),p}function Vs(t,e,i,r,n,a,s){if(t){!s&&a&&function(t,e,i,r){var n=t;do{null===n.z&&(n.z=bs(n.x,n.y,e,i,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,i,r,n,a,s,o,u,h=1;do{for(i=t,t=null,a=null,s=0;i;){for(s++,r=i,o=0,e=0;e<h&&(o++,r=r.nextZ);e++);for(u=h;o>0||u>0&&r;)0!==o&&(0===u||!r||i.z<=r.z)?(n=i,i=i.nextZ,o--):(n=r,r=r.nextZ,u--),a?a.nextZ=n:t=n,n.prevZ=a,a=n;i=r}a.nextZ=null,h*=2}while(s>1)}(n)}(t,r,n,a);for(var o,u,h=t;t.prev!==t.next;)if(o=t.prev,u=t.next,a?vs(t,r,n,a):ms(t))e.push(o.i/i+Fs),e.push(t.i/i+Fs),e.push(u.i/i+Fs),Ns(t),t=u.next,h=u.next;else if((t=u)===h){s?1===s?Vs(t=Ds(ps(t),e,i),e,i,r,n,a,2):2===s&&ks(t,e,i,r,n,a):Vs(ps(t),e,i,r,n,a,1);break}}}function Ds(t,e,i){var r=t;do{var n=r.prev,a=r.next.next;!Cs(n,a)&&As(n,r,r.next,a)&&Rs(n,a)&&Rs(a,n)&&(e.push(n.i/i+Fs),e.push(r.i/i+Fs),e.push(a.i/i+Fs),Ns(r),Ns(r.next),r=t=a),r=r.next}while(r!==t);return ps(r)}function ks(t,e,i,r,n,a){var s=t;do{for(var o=s.next.next;o!==s.prev;){if(s.i!==o.i&&_s(s,o)){var u=Os(s,o);return s=ps(s,s.next),u=ps(u,u.next),Vs(s,e,i,r,n,a),void Vs(u,e,i,r,n,a)}o=o.next}s=s.next}while(s!==t)}var zs=6,Us="PRE_COLOR_0",Bs="PRE_COLOR_SIZE_0",Gs="PRE_MAIN_COLOR_0",js="PRE_MAIN_COLOR_SIZE_0",Xs="editor",Hs={"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"},Ws=2;function Ys(t,e){for(var i=t.s,r=t.p,n=i[1],a=r[1],s=0,o=0;o<n.length;o++){s+=n[o].length-1}var u,h=new Float32Array(s*zs),l=e.indexBase,c=void 0===l?0:l,f=e.uvTransform,d=0,p=0,m=0,v=1,y=1;f&&(p=f[0],m=f[1],u=f[4],v=u?f[3]:f[2],y=u?f[2]:f[3]);for(var g=[0,0],x=0===u?0:-Math.PI/2,b=0;b<n.length;b++)for(var T=n[b],E=a[b],_=a[b+1]||a[0],w=T,C=[0,0],A=0;A<w.length-1;A++){Ks(C,w[A],E,_,E[4],E[5],_[2],_[3]),I(C[0],C[1])}var S=Ls(Array.from(h),null,zs,c);return{aPoint:h,index:new Uint16Array(S)};function I(t,e){h[d++]=t/2,h[d++]=e/2,f?(g[0]=t,g[1]=e,qs(g,g,x),h[d++]=p+(g[0]+1)/2*v,h[d++]=m+(g[1]+1)/2*y):(h[d++]=(t+1)/2,h[d++]=(e+1)/2),d+=Ws}}function Zs(t,e){for(var i=[],r=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[ee.SHAPE_POINTS,t.p],s:[ee.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[ee.SHAPE_POINTS,t.g.p],s:[ee.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,a=0,s=0,o=0;o<r.length;o++){var u=Ys(r[o],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,i.push(u),a+=u.aPoint.length,s+=u.index.length}if(1===i.length)return i[0];for(var h=new Float32Array(a),l=new Uint16Array(s),c=0,f=0,d=0;c<i[c];c++){var p=i[c];h.set(p.aPoint,f),f+=p.aPoint.length,l.set(p.index,d),d+=p.index.length}return{aPoint:h,index:l}}function qs(t,e,i){var r=Math.cos(i),n=Math.sin(i),a=e[0],s=e[1];return t[0]=r*a+n*s,t[1]=-n*a+r*s,t}function Ks(t,e,i,r,n,a,s,o){var u=1-e,h=u*u*u,l=3*e*u*u,c=3*e*e*u,f=e*e*e;return t[0]=h*i[0]+l*n+c*s+f*r[0],t[1]=h*i[1]+l*a+c*o+f*r[1],t}var Qs=[[0,0,1,1,0]],Js=function(t){function e(e){var i;(i=t.call(this,e)||this).visible=!0,i.splits=Qs,i.meshCollider=new Ru,i._color=new Er(1,1,1,1),i.getHitTestParams=function(t){var e=_r.fromScale(i.transform.size.x,i.transform.size.y,1).premultiply(i.transform.getWorldMatrix()),r=i.interaction;if(t||r){i.meshCollider.setGeometry(i.geometry,e);var n,a=i.meshCollider.getBoundingBoxData();if(a)return{behavior:(null==(n=i.interaction)?void 0:n.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===Ut.FRONT}}},i.renderer={renderMode:Yt.MESH,blending:zt.ALPHA,texture:i.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:Ut.DOUBLE,mask:0},i.defaultGeometry=Wn.create(i.engine,{attributes:{aPos:{type:Mr.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:Mr.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:Mr.TRIANGLES,drawCount:6}),i.geometry=i.defaultGeometry;var r=On.create(i.engine,{shader:{fragment:ma,vertex:pa,shared:!0}});return i.material=r,i.material.setColor("_Color",new Er(1,1,1,1)),i.maskManager=new Mn(e),i}$t(e,t);var i=e.prototype;return i.setVisible=function(t){this.visible=t},i.getVisible=function(){return this.visible},i.setColor=function(t){C(t,Er)?this._color.copyFrom(t):this._color.setFromArray(t),this.material.setColor("_Color",this._color)},i.setTexture=function(t){var e=this;return E((function(){var i;return I(this,(function(r){switch(r.label){case 0:return"string"!=typeof t?[3,2]:[4,fn.fromImage(t,e.item.engine)];case 1:return i=r.sent(),[3,3];case 2:i=t,r.label=3;case 3:return e.renderer.texture=i,e.material.setTexture("_MainTex",i),[2]}}))}))()},i.render=function(t){this.getVisible()&&(this.maskManager.drawStencilMask(t),this.draw(t))},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){var e=this.material.colorMask;this.material.colorMask=!1,this.draw(t),this.material.colorMask=e}},i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},i.getItemGeometryData=function(t){var e=this.splits,i=this.textureSheetAnimation,r=this.defaultGeometry;if(t.shape){for(var n=t.shape,a=n.index,s=void 0===a?[]:a,o=n.aPoint,u=void 0===o?[]:o,h=new Float32Array(u),l=[],c=[],f=0;f<h.length;f+=6)h[f]*=1,h[f+1]*=1,c.push(u[f+2],u[f+3]),l.push(h[f],h[f+1],0);return r.setAttributeData("aPos",new Float32Array(l)),{index:s,aUV:c}}var d=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],p=[],m=[],v=[];if(1===e.length){var y=i?[0,0,1,1,e[0][4]]:e[0],g=y[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],x=y[0],b=y[1],T=y[4]?y[3]:y[2],E=y[4]?y[2]:y[3];p.push(g[0]*T+x,g[1]*E+b,g[2]*T+x,g[3]*E+b,g[4]*T+x,g[5]*E+b,g[6]*T+x,g[7]*E+b),v.push(d[0],d[1],0,d[2],d[3],0,d[4],d[5],0,d[6],d[7],0),m.push(0,1,2,2,1,3)}else for(var _=0;_<2;_++)for(var w=0;w<2;w++){var C=4*(2*w+_),A=i?[0,0,1,1,e[0][4]]:e[2*w+_],S=A[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],I=((_+_+1)/2-1)/2,R=((w+w+1)/2-1)/2,O=A[0],M=A[1],N=A[4]?A[3]:A[2],P=A[4]?A[2]:A[3],F=[d[0]/2+I,d[1]/2+R,d[2]/2+I,d[3]/2+R,d[4]/2+I,d[5]/2+R,d[6]/2+I,d[7]/2+R];p.push(S[0]*N+O,S[1]*P+M,S[2]*N+O,S[3]*P+M,S[4]*N+O,S[5]*P+M,S[6]*N+O,S[7]*P+M),v.push(1*F[0],1*F[1],0,1*F[2],1*F[3],0,1*F[4],1*F[5],0,1*F[6],1*F[7],0),m.push(C,1+C,2+C,2+C,1+C,3+C)}return r.setAttributeData("aPos",new Float32Array(v)),{index:m,aUV:p}},i.configureDefaultGeometry=function(t){var e=this.getItemGeometryData(t),i=e.index,r=e.aUV,n=this.defaultGeometry;return n.setIndexData(new Uint16Array(i)),n.setAttributeData("aUV",new Float32Array(r)),n.setDrawCount(i.length),n},i.configureMaterial=function(t){var e=t.side,i=t.occlusion,r=t.blending,n=t.mask,a=t.texture,s=this.maskManager.maskMode,o=this.material;o.blending=!0,o.depthTest=!0,o.depthMask=i,o.stencilRef=void 0!==n?[n,n]:void 0,Ur(o,r),Gr(o,s),Br(o,e),o.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',o.setVector4("_TexOffset",new gr(0,0,1,1)),o.setTexture("_MainTex",a);var u=zr(r),h=new gr;return h.x=t.occlusion?+t.transparentOcclusion:1,h.y=u,h.z=t.renderMode,h.w=s,o.setVector4("_TexParams",h),0===h.x||this.maskManager.alphaMaskEnabled?o.enableMacro("ALPHA_CLIP"):o.disableMacro("ALPHA_CLIP"),o},i.draw=function(t){t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix());for(var e=0;e<this.materials.length;e++){var i=this.materials[e];i.setVector2("_Size",this.transform.size),this.renderer.renderMode!==Yt.BILLBOARD&&this.renderer.renderMode!==Yt.VERTICAL_BILLBOARD&&this.renderer.renderMode!==Yt.HORIZONTAL_BILLBOARD||i.setVector3("_Scale",this.transform.scale),t.drawGeometry(this.geometry,i,e)}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i,r=e,n=null!=(i=r.renderer)?i:{},a=r.splits,s=r.textureSheetAnimation,o=r.mask;o&&this.maskManager.setMaskOptions(o);var u,h,l,c=n.shape,f=a&&!s?a[0]:void 0,d=void 0;if(null==c||"aPoint"in c&&"index"in c||(d=Zs(c,f)),this.splits=a||Qs,this.textureSheetAnimation=s,this.renderer={renderMode:null!=(u=n.renderMode)?u:Yt.MESH,blending:null!=(h=n.blending)?h:zt.ALPHA,texture:n.texture?this.engine.findObject(n.texture):this.engine.emptyTexture,occlusion:!!n.occlusion,transparentOcclusion:!!n.transparentOcclusion||this.maskManager.maskMode===Sr.MASK,side:null!=(l=n.side)?l:Ut.DOUBLE,mask:this.maskManager.getRefValue(),shape:d},this.configureMaterial(this.renderer),r.geometry){var p=this.engine.findObject(r.geometry),m=r.splits&&!r.textureSheetAnimation?r.splits[0]:Qs[0],v=m[0],y=m[1],g=Boolean(m[4]),x=g?m[3]:m[2],b=g?m[2]:m[3],T=g?-Math.PI/2:0,E=p.getAttributeData("aUV"),_=p.getAttributeData("aPos"),C=p.getIndexData(),A=[0,0];if(E&&_&&C){for(var S=E.length/2,I=0;I<S;I++){var R=3*I,O=2*I,M=_[R],N=_[R+1];A[0]=M,A[1]=N,qs(A,A,T),E[O]=(A[0]+.5)*x+v,E[O+1]=(A[1]+.5)*b+y}this.geometry.setAttributeData("aPos",_.slice()),this.geometry.setAttributeData("aUV",E.slice()),this.geometry.setIndexData(C.slice()),this.geometry.setDrawCount(C.length)}this.geometry.subMeshes.length=0;for(var P,F=w(p.subMeshes);!(P=F()).done;){var L=P.value;this.geometry.subMeshes.push({offset:L.offset,indexCount:L.indexCount,vertexCount:L.vertexCount})}}else this.geometry=this.defaultGeometry,this.configureDefaultGeometry(this.renderer)},dr(e,[{key:"color",get:function(){return this._color},set:function(t){this.setColor(t)}}]),e}(yr),$s=function(t){function e(e){var i;(i=t.call(this,e)||this).hasStroke=!1,i.hasFill=!1,i.shapeDirty=!0,i.graphicsPath=new lc,i.vert="\nprecision highp float;\n\nattribute vec3 aPos;//x y\n\nuniform mat4 effects_MatrixVP;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_ObjectToWorld;\n\nvoid main() {\n vec4 pos = vec4(aPos.xyz, 1.0);\n gl_Position = effects_MatrixVP * effects_ObjectToWorld * pos;\n}\n",i.frag="\nprecision highp float;\n\nuniform vec4 _Color;\n\nvoid main() {\n vec4 color = _Color;\n color.rgb *= color.a;\n gl_FragColor = color;\n}\n",i.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0});var r={shader:{vertex:i.vert,fragment:i.frag,glslVersion:In.GLSL1}},n=On.create(e,r),a=On.create(e,r);return n.color=new Er(1,1,1,1),n.depthMask=!1,n.depthTest=!0,n.blending=!0,i.material=n,a.color=new Er(.25,.25,.25,1),a.depthMask=!1,a.depthTest=!0,a.blending=!0,i.materials[1]=a,i.strokeAttributes={width:1,alignment:.5,cap:Te.Butt,join:Ee.Miter,miterLimit:10,color:new Er(1,1,1,1)},i.fillAttribute={color:new Er(1,1,1,1)},i.shapeAttribute={type:be.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},i}$t(e,t);var i=e.prototype;return i.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},i.onUpdate=function(t){this.material.color=this.fillAttribute.color,this.materials[1].color=this.strokeAttributes.color,this.shapeDirty&&(this.buildPath(this.shapeAttribute),this.buildGeometryFromPath(this.graphicsPath.shapePath),this.shapeDirty=!1)},i.buildGeometryFromPath=function(t){var e=t.shapePrimitives,i=[],r=[];if(this.hasFill)for(var n,a=w(e);!(n=a()).done;){var s=n.value.shape,o=[],u=r.length,h=i.length/2;s.build(o),s.triangulate(o,i,h,r,u)}var l=r.length;if(this.hasStroke)for(var c,f=w(e);!(c=f()).done;){var d=c.value.shape,p=[],m=i.length/2,v=this.strokeAttributes,y=!0;this.shapeAttribute.type===be.Custom&&(y=d.closePath),d.build(p),Zl(p,v,!1,y,i,2,m,r)}var g=r.length-l,x=i.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<r.length)&&(E=new Uint16Array(r.length));for(var _=0;_<x;_++){var C=3*_,A=2*_,S=2*_;b[C]=i[A],b[C+1]=i[A+1],b[C+2]=0,T[S]=b[C],T[S+1]=b[C+1]}E.set(r),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(r.length);var I=this.geometry.subMeshes[0],R=this.geometry.subMeshes[1];I.indexCount=l,R.offset=2*l,R.indexCount=g},i.buildPath=function(t){switch(this.graphicsPath.clear(),t.type){case be.Custom:for(var e,i=this.shapeAttribute,r=i.points,n=i.easingIns,a=i.easingOuts,s=w(i.shapes);!(e=s()).done;){var o=e.value,u=o.indexes,h=r[u[0].point];this.graphicsPath.moveTo(h.x,h.y);for(var l=1;l<u.length;l++){var c=u[l],f=u[l-1],d=r[c.point],p=r[f.point],m=a[f.easingOut],v=n[c.easingIn];this.graphicsPath.bezierCurveTo(m.x+p.x,m.y+p.y,v.x+d.x,v.y+d.y,d.x,d.y,1)}if(o.close){var y=u[0],g=u[u.length-1],x=r[y.point],b=r[g.point],T=a[g.easingOut],E=n[y.easingIn];this.graphicsPath.bezierCurveTo(T.x+b.x,T.y+b.y,E.x+x.x,E.y+x.y,x.x,x.y,1),this.graphicsPath.closePath()}}break;case be.Ellipse:var _=t;this.graphicsPath.ellipse(0,0,_.xRadius,_.yRadius);break;case be.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case be.Star:var A=t;this.graphicsPath.polyStar(A.pointCount,A.outerRadius,A.innerRadius,A.outerRoundness,A.innerRoundness,ac.Star);break;case be.Polygon:var S=t;this.graphicsPath.polyStar(S.pointCount,S.radius,S.radius,S.roundness,S.roundness,ac.Polygon)}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.shapeDirty=!0;var i=e.stroke;i&&(this.hasStroke=!0,this.strokeAttributes.width=i.width,this.strokeAttributes.color.copyFrom(i.color),this.strokeAttributes.cap=i.cap,this.strokeAttributes.join=i.join);var r=e.fill;switch(r&&(this.hasFill=!0,this.fillAttribute.color.copyFrom(r.color)),e.type){case be.Custom:for(var n,a=e,s={type:be.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:a.fill},o=w(a.points);!(n=o()).done;){var u=n.value;s.points.push(new mi(u.x,u.y))}for(var h,l=w(a.easingIns);!(h=l()).done;){var c=h.value;s.easingIns.push(new mi(c.x,c.y))}for(var f,d=w(a.easingOuts);!(f=d()).done;){var p=f.value;s.easingOuts.push(new mi(p.x,p.y))}s.shapes=a.shapes,this.shapeAttribute=s;break;case be.Ellipse:var m=e,v={type:be.Ellipse,xRadius:m.xRadius,yRadius:m.yRadius,fill:m.fill};this.shapeAttribute=v;break;case be.Rectangle:var y=e,g={type:be.Rectangle,width:y.width,height:y.height,roundness:y.roundness,fill:y.fill};this.shapeAttribute=g;break;case be.Star:var x=e,b={type:be.Star,pointCount:x.pointCount,innerRadius:x.innerRadius,outerRadius:x.outerRadius,innerRoundness:x.innerRoundness,outerRoundness:x.outerRoundness,fill:x.fill};this.shapeAttribute=b;break;case be.Polygon:var T=e,E={type:be.Polygon,pointCount:T.pointCount,radius:T.radius,roundness:T.roundness,fill:T.fill};this.shapeAttribute=E}e.mask&&this.maskManager.setMaskOptions(e.mask);var _=this.maskManager.getRefValue();this.material.stencilRef=void 0!==_?[_,_]:void 0,Gr(this.material,this.maskManager.maskMode)},dr(e,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),e}(Js);$s=S([ke("ShapeComponent")],$s);var to,eo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).loop=!1,e.amountOfMotion=1,e.animationLength=2,e.mode=1,e.startPositionX=0,e.startPositionY=0,e.startPositionZ=0,e.endPositionX=0,e.endPositionY=0,e.endPositionZ=0,e.amplitudeX=0,e.amplitudeY=0,e.amplitudeZ=0,e.phaseX=0,e.phaseY=0,e.phaseZ=0,e}$t(e,t);var i=e.prototype;return i.onStart=function(){this.effectComponent=this.item.getComponent(br)},i.onUpdate=function(t){this.updateFake3D()},i.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,i=0,r=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,i=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,r=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var a=t;this.loop&&(a>.5&&(a=1-a),a*=2),e=this.startPositionX*(1-a)+a*this.endPositionX,i=this.startPositionY*(1-a)+a*this.endPositionY,r=this.startPositionZ*(1-a)+a*this.endPositionZ}var s=this.effectComponent.material;s.setFloat("_PosX",e*this.amountOfMotion),s.setFloat("_PosY",i*this.amountOfMotion),s.setFloat("_PosZ",r*this.amountOfMotion)}},e}(pr);S([ze()],eo.prototype,"loop",void 0),S([ze()],eo.prototype,"amountOfMotion",void 0),S([ze()],eo.prototype,"animationLength",void 0),S([ze()],eo.prototype,"mode",void 0),S([ze()],eo.prototype,"startPositionX",void 0),S([ze()],eo.prototype,"startPositionY",void 0),S([ze()],eo.prototype,"startPositionZ",void 0),S([ze()],eo.prototype,"endPositionX",void 0),S([ze()],eo.prototype,"endPositionY",void 0),S([ze()],eo.prototype,"endPositionZ",void 0),S([ze()],eo.prototype,"amplitudeX",void 0),S([ze()],eo.prototype,"amplitudeY",void 0),S([ze()],eo.prototype,"amplitudeZ",void 0),S([ze()],eo.prototype,"phaseX",void 0),S([ze()],eo.prototype,"phaseY",void 0),S([ze()],eo.prototype,"phaseZ",void 0),eo=S([ke("Fake3DComponent")],eo),function(t){t[t.Circular=0]="Circular",t[t.Linear=1]="Linear"}(to||(to={}));var io=function(t){function e(e,i){var r;return r=t.call(this,e)||this,i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.onUpdate=function(){if(this.item.composition&&this.item.transform.getValid()){var t=this.item.composition.camera;t.near=this.options.near,t.far=this.options.far,t.fov=this.options.fov,t.clipMode=this.options.clipMode,t.transform.parentTransform=this.transform.parentTransform,t.position=this.transform.position,t.setQuat(this.transform.getQuaternion().clone().conjugate())}},i.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(pr);io=S([ke(Ae.CameraController)],io);var ro,no=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt);!function(t){t[t.triangle=1]="triangle",t[t.box=2]="box",t[t.sphere=3]="sphere",t[t.custom=4]="custom"}(ro||(ro={}));var ao="click",so="touchstart",oo="touchmove",uo="touchend",ho=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var e=t.prototype;return e.bindListeners=function(){var t,e,i,r,n,a=this;n=function(t){return t};var s,o="mousedown",u="mousemove",h="mouseup",l="mouseleave",c=function(t,e,i,n,s){void 0===n&&(n=0),void 0===s&&(s=0);var o=0,u=0,h=d.now();if(!a.target)return vt.warn("Trigger TouchEvent after EventSystem is disposed."),{x:e,y:i,vx:0,vy:u,dx:n,dy:s,ts:h,width:0,height:0,origin:t};var l=a.target,c=l.width,f=l.height;if(r){var p=h-r.ts;o=(n-r.dx)/p||0,u=(s-r.dy)/p||0,r={dx:n,dy:s,ts:h}}return{x:e,y:i,vx:o,vy:u,dx:n,dy:s,ts:h,width:c,height:f,origin:t}};J()&&(n=function(t){var e=t.touches,i=t.changedTouches;return e[0]||i[0]},o="touchstart",u="touchmove",h="touchend",l="touchcancel"),this.nativeHandlers=((s={})[o]=function(s){if(a.enabled){var o=n(s),u=lo(o);t=u.x,e=u.y,r=i={clientX:o.clientX,clientY:o.clientY,ts:d.now(),x:t,y:e},a.dispatchEvent(so,c(s,t,e))}},s[u]=function(r){if(i&&a.enabled){var s=lo(n(r));t=s.x,e=s.y,a.dispatchEvent(oo,c(r,t,e,t-i.x,e-i.y))}},s[h]=function(r){if(i&&a.enabled){!a.allowPropagation&&r.cancelable&&(r.preventDefault(),r.stopPropagation());var s=n(r),o=lo(s),u=Math.abs(i.clientX-s.clientX)+Math.abs(i.clientY-s.clientY);t=o.x,e=o.y,u<4&&a.dispatchEvent(ao,c(r,t,e)),a.dispatchEvent(uo,c(r,t,e,t-i.x,e-i.y))}i=0},s),this.nativeHandlers[l]=this.nativeHandlers[h],Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.nativeHandlers[t])}))},e.dispatchEvent=function(t,e){var i=this.handlers[t];null==i||i.forEach((function(t){return t(e)}))},e.addEventListener=function(t,e){var i=this.handlers[t];return i||(i=this.handlers[t]=[]),V(i,e),function(){D(i,e)}},e.removeEventListener=function(t,e){var i=this.handlers[t];i&&D(i,e)},e.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var i;null==(i=t.target)||i.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function lo(t){var e=t.target,i=t.clientX,r=t.clientY,n=e.getBoundingClientRect(),a=n.left,s=n.top;return{x:(i-a)/n.width*2-1,y:1-(r-s)/n.height*2}}var co,fo,po=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt),mo=(co=new Float32Array(1),fo=new Int32Array(co.buffer),function(t){co[0]=t;var e=fo[0],i=e>>16&32768,r=e>>12&2047,n=e>>23&255;return n<103?i:n>142?(i|=31744,i|=(255==n?0:1)&&8388607&e):n<113?i|=((r|=2048)>>114-n)+(r>>113-n&1):(i|=n-112<<10|r>>1,i+=1&r)}),vo=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),i=0;i<e.length;i++)e[i]=mo(t[i])}return t.prototype.set=function(t,e){for(var i=0;i<t.length;i++)this.data[i+e]=mo(t[i])},t}();function yo(t,e){for(var i=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],r=0;r<8;r+=2)i[r]+=t,i[r+1]+=e;return i}var go,xo=new Zn,bo=new _r;function To(t,e,i,r,n,a,s){var o=t,u=r/n,h=r,l=e.speedOverLifetime;l&&(h=l.getIntegrateValue(0,r,n));var c=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,r):0;o.copyFrom(a),o.addScaledVector(s,h),o.addScaledVector(i,c);var f=e.linearVelOverLifetime||{},d=e.orbitalVelOverLifetime||{};if(d.enabled){var p=new vi;d.center&&p.setFromArray(d.center);var m=o.clone().subtract(p),v=d.asRotation,y=["x","y","z"].map((function(t){var e=d[t];return e?v?e.getValue(u):e.getIntegrateValue(0,r,n):0}));xo.setFromArray(y).negate(),bo.setFromEuler(xo);var g=bo.transformPoint(m);o.addVectors(p,g)}if(f.enabled){var x=f.asMovement,b=f.x,T=f.y,E=f.z;if(b){var _=x?b.getValue(u):b.getIntegrateValue(0,r,n);o.x=o.x+_}if(T){var w=x?T.getValue(u):T.getIntegrateValue(0,r,n);o.y=o.y+w}if(E){var C=x?E.getValue(u):E.getIntegrateValue(0,r,n);o.z=o.z+C}}return o}function Eo(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function _o(t,e){for(var i=0,r=t.length;i<r;i++)t[i]=e;return t}function wo(t,e,i){if(e&&i)for(var r=0,n=e.length;r<n;r++)t[r]=e[r]*i[r];else if(e){if(t!==e)for(var a=0;a<e.length;a++)t[a]=e[a]}else if(i&&t!==i)for(var s=0;s<i.length;s++)t[s]=i[s];return t}var Co=((go={})[Zt.PARTICLE_ORIGIN_CENTER]=[0,0],go[Zt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],go[Zt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],go[Zt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],go[Zt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],go[Zt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],go[Zt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],go[Zt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],go[Zt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],go);function Ao(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function So(t,e,i){var r=i.position,n=new vi(t,e,0),a=new vi;return i.getInverseViewProjectionMatrix().projectPoint(n,a),a.subtract(r),new Kn(r,a)}function Io(t,e,i){var r=t.x,n=t.y,a=t.z,s=new vi(r-e,n+i,a),o=new vi(r-e,n-i,a),u=new vi(r+e,n-i,a),h=new vi(r+e,n+i,a);return[{p0:s,p1:o,p2:u},{p0:s.clone(),p1:u.clone(),p2:h}]}function Ro(t,e,i){return void 0===i&&(i=1e-6),Math.abs(t-e)<i}function Oo(t,e){void 0===e&&(e=2);var i=Math.pow(10,e);return Math.floor(t*i)/i}var Mo={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],i=this.getPointIndexInCurve(t,this.pointIndexCache),r=i.xIndex,n=i.yIndex,a=e[r],s=e[n];return new mi(a,s)},getPointIndexInCurve:function(t,e){var i=t[0],r=t[2],n=i===ie.LINE||i===ie.EASE_OUT?0:i===ie.EASE_IN||i===ie.EASE||i===ie.HOLD&&r===ie.EASE_IN?2:0;return e?(e.xIndex=n,e.yIndex=n+1,e):{xIndex:n,yIndex:n+1}},isLeftSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==ie.HOLD||!this.isKeyframeTypeLeftSideEase(i))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var i=t[2];return!(e!==ie.HOLD||!this.isKeyframeTypeRightSideEase(i))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[ie.EASE,ie.EASE_IN,ie.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[ie.EASE,ie.EASE_OUT,ie.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===ie.HOLD&&[ie.HOLD,ie.LINE_OUT,ie.EASE_OUT].includes(i)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var i=t[2];return e===ie.HOLD&&[ie.HOLD,ie.LINE,ie.EASE_IN].includes(i)}},No=function(t,e){this.points=t,this.totalLength=e},Po={},Fo={},Lo=.1;function Vo(t,e){return 1-3*e+3*t}function Do(t,e){return 3*e-6*t}function ko(t){return 3*t}function zo(t,e,i){return((Vo(e,i)*t+Do(e,i))*t+ko(e))*t}function Uo(t,e,i){return 3*Vo(e,i)*t*t+2*Do(e,i)*t+ko(e)}var Bo=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,i,r){var n=Oo(e.x-t.x,3)+"_"+Oo(e.y-t.y,3)+"_"+Oo(e.z-t.z,3)+"&"+Oo(i.x-t.x,3)+"_"+Oo(i.y-t.y,3)+"_"+Oo(i.z-t.z,3)+"&"+Oo(r.x-t.x,3)+"_"+Oo(r.y-t.y,3)+"_"+Oo(r.z-t.z,3);if(Fo[n])return{data:Fo[n],interval:t};for(var a=[],s=null,o=0,u=0,h=0;h<300;h+=1){var l=new vi,c=h/299;u=0,l.x=3*Math.pow(1-c,2)*c*(i.x-t.x)+3*(1-c)*Math.pow(c,2)*(r.x-t.x)+Math.pow(c,3)*(e.x-t.x),l.y=3*Math.pow(1-c,2)*c*(i.y-t.y)+3*(1-c)*Math.pow(c,2)*(r.y-t.y)+Math.pow(c,3)*(e.y-t.y),l.z=3*Math.pow(1-c,2)*c*(i.z-t.z)+3*(1-c)*Math.pow(c,2)*(r.z-t.z)+Math.pow(c,3)*(e.z-t.z),null!==s&&(u+=Math.pow(l.x-s.x,2),u+=Math.pow(l.y-s.y,2),u+=Math.pow(l.z-s.z,2)),s=l,o+=u=Math.sqrt(u),a[h]={partialLength:u,point:l}}var f=new No(a,o);return Fo[n]=f,{data:f,interval:new vi(t.x,t.y,t.z)}}(t,e,i,r),a=n.data,s=n.interval;this.lengthData=a,this.interval=s,this.totalLength=a.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(Ro(1-t,0))return e.points[299].point.clone().add(this.interval);if(Ro(e.totalLength,0))return this.p1.clone();var i=new vi,r=Oo(e.totalLength*t,4),n=this.catching.lastAddedLength,a=this.catching.lastPoint;if(Ro(n,r))return e.points[a].point.clone().add(this.interval);var s=!0,o=1;for(r<n&&(o=-1);s;){if(r>=n){if(299===a){i.x=e.points[a].point.x,i.y=e.points[a].point.y,i.z=e.points[a].point.z;break}if(r<n+e.points[a+1].partialLength){var u=(r-n)/e.points[a+1].partialLength;i.x=e.points[a].point.x+(e.points[a+1].point.x-e.points[a].point.x)*u,i.y=e.points[a].point.y+(e.points[a+1].point.y-e.points[a].point.y)*u,i.z=e.points[a].point.z+(e.points[a+1].point.z-e.points[a].point.z)*u;break}}o>0&&a<299?(a+=o,n+=Oo(e.points[a].partialLength,5)):o<0&&a>0?(n-=Oo(e.points[a].partialLength,5),a+=o):s=!1}return this.catching.lastPoint=a,this.catching.lastAddedLength=n,i.add(this.interval),i},t}(),Go=function(){function t(t,e,i,r){this.p1=t,this.p2=e,this.p3=i,this.p4=r,this.temp=new yi,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):Ro(1-t,0)?this.temp.copyFrom(this.p2):(Wo.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),jo=function(){function t(t,e,i,r){this.precomputed=!1,this.control1=new mi,this.control2=new mi,this.weighted=!1,this.isConstant=!1,this.mSampleValues=new Array(11),void 0!==t&&void 0!==e&&void 0!==i&&void 0!==r?(this.control1.x=t,this.control1.y=e,this.control2.x=i,this.control2.y=r,this.weighted=!0):void 0!==t&&void 0!==e?(this.control1.x=1/3,this.control1.y=t,this.control2.x=2/3,this.control2.y=e):this.isConstant=!0}var e=t.prototype;return e.getValue=function(t){return this.isConstant?0:this.control1.x===this.control1.y&&this.control2.x===this.control2.y||0===t||1===t?t:this.weighted?(this.precomputed||this.precompute(),zo(this.getTForX(t),this.control1.y,this.control2.y)):this.bezierInterpolate(0,this.control1.y,this.control2.y,1,t)},e.bezierInterpolate=function(t,e,i,r,n){var a=1-n,s=a*a,o=n*n;return t*(s*a)+e*s*n*3+i*a*o*3+r*(o*n)},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=zo(t*Lo,this.control1.x,this.control2.x)},e.getTForX=function(t){for(var e=this.mSampleValues,i=0,r=1;10!==r&&e[r]<=t;++r)i+=Lo;var n=i+(t-e[--r])/(e[r+1]-e[r])*Lo,a=Uo(n,this.control1.x,this.control2.x);return a>=.001?function(t,e,i,r){for(var n=0;n<4;++n){var a=Uo(e,i,r);if(0===a)return e;e-=(zo(e,i,r)-t)/a}return e}(t,n,this.control1.x,this.control2.x):0===a?n:function(t,e,i,r,n){var a,s,o=0;do{(a=zo(s=e+(i-e)/2,r,n)-t)>0?i=s:e=s}while(Math.abs(a)>1e-7&&++o<10);return s}(t,i,i+Lo,this.control1.x,this.control2.x)},e.precompute=function(){this.precomputed=!0,this.control1.x===this.control1.y&&this.control2.x===this.control2.y||this.calcSampleValues()},t}();function Xo(t,e){var i=Ho(t,e,!0),r=i.p0,n=i.p1,a=i.p2,s=i.p3;ut(a),ut(s);var o,u,h=s.x-r.x,l=s.y-r.y,c=Oo((n.x-r.x)/h,5),f=Oo((a.x-r.x)/h,5);Ro(l,0)?o=u=NaN:(o=Oo((n.y-r.y)/l,5),u=Oo((a.y-r.y)/l,5)),c<0&&(console.error("Invalid bezier points, x1 < 0",r,n,a,s),c=0),f<0&&(console.error("Invalid bezier points, x2 < 0",r,n,a,s),f=0),c>1&&(console.error("Invalid bezier points, x1 >= 1",r,n,a,s),c=1),f>1&&(console.error("Invalid bezier points, x2 >= 1",r,n,a,s),f=1);var d,p=("bez_"+c+"_"+o+"_"+f+"_"+u).replace(/\./g,"p");return Po[p]?d=Po[p]:(d=Ro(l,0)?new jo:new jo(c,o,f,u),Po[p]=d),{points:[r,n,a,s],timeInterval:h,valueInterval:l,curve:d}}function Ho(t,e,i){var r=t[1],n=Mo.isHoldOutKeyframe(t),a=Mo.isHoldInKeyframe(e),s=!a&&Mo.isRightSideEase(t),o=!n&&Mo.isLeftSideEase(e);if(s&&!o&&!a){var u=new mi(r[r.length-4],r[r.length-3]),h=new mi(r[r.length-2],r[r.length-1]),l=Mo.getPointInCurve(e),c=new mi(l.x,l.y);return{type:"ease",p0:u,p1:h,p2:new mi(c.x-(c.x-u.x)/10,c.y),p3:c}}if(!s&&o&&!n){var f=e[1],d=Mo.getPointInCurve(t),p=new mi(d.x,d.y),m=new mi(f[0],f[1]),v=new mi(f[2],f[3]);return{type:"ease",p0:p,p1:new mi(p.x+(v.x-p.x)/10,p.y),p2:m,p3:v}}if(s&&o){var y=e[1];return{type:"ease",p0:new mi(r[r.length-4],r[r.length-3]),p1:new mi(r[r.length-2],r[r.length-1]),p2:new mi(y[0],y[1]),p3:new mi(y[2],y[3])}}var g=Mo.getPointInCurve(t),x=Mo.getPointInCurve(e);return n?x.y=g.y:a&&(g.y=x.y),i?{type:"ease",p0:g,p1:new mi((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new mi((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}:{type:"line",p0:g,p1:x,isHold:n||a,leftHoldLine:n,rightHoldLine:a}}var Wo=function(){function t(){}return t.slerpFlat=function(t,e,i,r){var n=e.x,a=e.y,s=e.z,o=e.w,u=i.x,h=i.y,l=i.z,c=i.w;if(0===r)return t.x=n,t.y=a,t.z=s,void(t.w=o);if(1===r)return t.x=u,t.y=h,t.z=l,void(t.w=c);if(o!==c||n!==u||a!==h||s!==l){var f=1-r,d=n*u+a*h+s*l+o*c,p=d>=0?1:-1,m=1-d*d;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,d*p);f=Math.sin(f*y)/v,r=Math.sin(r*y)/v}var g=r*p;if(n=n*f+u*g,a=a*f+h*g,s=s*f+l*g,o=o*f+c*g,f===1-r){var x=1/Math.sqrt(n*n+a*a+s*s+o*o);n*=x,a*=x,s*=x,o*=x}}t.x=n,t.y=a,t.z=s,t.w=o},t}(),Yo="not_implement",Zo=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(Yo)},e.getIntegrateValue=function(t,e,i){throw new Error(Yo)},e.getIntegrateByTime=function(t,e){throw new Error(Yo)},e.getValue=function(t){throw new Error(Yo)},e.getMaxTime=function(){throw new Error(Yo)},e.toUniform=function(t){throw new Error(Yo)},e.map=function(t){throw new Error(Yo)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(Yo)},t.getAllData=function(t,e){for(var i=new(e?vo:Float32Array)(4*t.index),r=0,n=0,a=t.curves;r<a.length;r++){var s=a[r].toData();i.set(s,n),n+=s.length}return e?i.data:i},t}(),qo=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.value=t},i.getIntegrateValue=function(t,e,i){return this.value*(e-t)},i.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},i.getValue=function(t){return this.value},i.toUniform=function(){return new Float32Array([0,this.value,0,0])},i.map=function(t){var e=this.value;return this.value=t(e),this},i.getMaxTime=function(){return 0},e}(Zo),Ko=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.items=t},i.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},i.map=function(t){return this.items=this.items.map(t),this},e}(Zo),Qo=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t,e){var i=null!=e?e:Math.random();return this.min+i*(this.max-this.min)},i.getIntegrateValue=function(t,e,i){var r=null!=i?i:1;return(this.min+r*(this.max-this.min))*(e-t)},i.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(Zo),Jo=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1]},i.getValue=function(t){for(var e=this.min,i=this.max,r=[],n=0;n<e.length;n++){var a=Math.random();r[n]=e[n]*(1-a)+i[n]*a}return r},i.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(Zo),$o=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},i.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},i.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=this.min,n=this.max,a=this.xCoord*i;return((r+e/a*(n-r)+r)*e-(r+t/a*(n-r)+r)*t)/2},i.getIntegrateByTime=function(t,e){return su(e,0,this.xCoord,this.min,this.max)-su(t,0,this.xCoord,this.min,this.max)},i.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},i.scaleXCoord=function(t){return this.xCoord=t,this},e}(Zo),tu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.stops=G(t)},i.getStops=function(){return this.stops},i.getValue=function(t){for(var e=this.stops,i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1];if(n.stop<=t&&a.stop>t){var s=(t-n.stop)/(a.stop-n.stop);return j(n.color,a.color,s,!0)}}return e[i].color.slice()},e}(Zo),eu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var i=this.keys[0];i[0]>0&&this.keys.unshift([0,i[1]]),this.isLineSeg=!0},i.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var i=e.length-1,r=0;r<i;r++){var n=e[r],a=e[r+1],s=n[0],o=a[0];if(t>=s&&t<=o){var u=(t-s)/(o-s),h=n[1];return h+u*(a[1]-h)}}return e[i][1]},i.getIntegrateValue=function(t,e,i){return void 0===i&&(i=1),(this.integrate(e,!1)-this.integrate(t,!1))*i},i.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},i.integrate=function(t,e){var i=this.keys;if(t<=i[0][0])return 0;for(var r=0,n=i.length-1,a=e?su:au,s=0;s<n;s++){var o=i[s],u=i[s+1],h=o[0],l=u[0];if(t>h&&t<=l)return r+a(t,h,l,o[1],u[1]);r+=a(l,h,l,o[1],u[1])}return r},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),i=0,r=0;i<t.length;i++,r+=2)e.set(t[i],r);return e.set(t[t.length-1],e.length-2),e},i.toUniform=function(t){var e=t.index,i=this.keys,r=Math.ceil(i.length/2);return t.lineSegCount+=r,t.curves.push(this),t.index+=r,t.max=Math.max(t.max,r),new Float32Array([3,e,r,0])},i.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},i.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(Zo),iu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.keys=t[0],this.values=t[1]},i.getValue=function(t){for(var e=this.keys,i=this.values,r=0;r<e.length-1;r++){var n=e[r],a=e[r+1];if(n[0]<=t&&a[0]>=t){var s=a[1]-n[1],o=void 0;if(0===s)o=(t-n[0])/(a[0]-n[0]);else o=(ou(t,n,a)-n[1])/s;return this.calculateVec(r,o)}}return t<=e[0][0]?i[0].slice():i[i.length-1].slice()},i.calculateVec=function(t,e){for(var i=this.values[t],r=this.values[t+1],n=[0,0,0],a=0;a<i.length;a++)n[a]=i[a]*(1-e)+r[a]*e;return n},e}(Zo),ru=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length){for(var n=0;n<e.length-1;n++){var a=e[n],s=e[n+1],o=new vi(i[n][0],i[n][1],i[n][2]),u=new vi(i[n+1][0],i[n+1][1],i[n+1][2]),h=new vi(r[2*n][0],r[2*n][1],r[2*n][2]),l=new vi(r[2*n+1][0],r[2*n+1][1],r[2*n+1][2]),c=Xo(a,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Bo(o,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},i.getValue=function(t){var e=Oo(t,5),i=0,r=new vi,n=this.keyTimeData;if(!n.length)return r;var a=this.curveSegments[n[0]].timeStart,s=this.curveSegments[n[n.length-1]].timeEnd;if(e<=a)return r=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=s)return r=this.curveSegments[n[n.length-1]].pathCurve.getPointInPercent(1);for(var o=0;o<n.length;o++){var u=this.curveSegments[n[o]].timeStart,h=this.curveSegments[n[o]].timeEnd;if(e>=Number(u)&&e<Number(h)){var l=this.curveSegments[n[o]].pathCurve;i=this.getPercValue(n[o],e),r=l.getPointInPercent(i)}}return r},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=Oo((e-r.x)/n,4);return li(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Zo),nu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){var e=t[0],i=t[1],r=t[2];if(this.curveSegments={},r.length)for(var n=0;n<e.length-1;n++){var a=e[n],s=e[n+1],o=yi.fromArray(i[n]),u=yi.fromArray(i[n+1]),h=yi.fromArray(r[2*n]),l=yi.fromArray(r[2*n+1]),c=Xo(a,s),f=c.points,d=c.curve,p=c.timeInterval,m=c.valueInterval,v=f[0],y=f[f.length-1],g=new Go(o,u,h,l);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:p,valueInterval:m,easingCurve:d,pathCurve:g}}},i.getValue=function(t){var e=0,i=Oo(t,5),r=Object.keys(this.curveSegments),n=Number(r[0].split("&")[0]),a=Number(r[r.length-1].split("&")[1]);if(i<=n)return this.curveSegments[r[0]].pathCurve.getPointInPercent(0);if(i>=a)return this.curveSegments[r[r.length-1]].pathCurve.getPointInPercent(1);for(var s=0;s<r.length;s++){var o=r[s].split("&"),u=o[0],h=o[1];if(i>=Number(u)&&i<Number(h)){var l=this.curveSegments[r[s]].pathCurve;return e=this.getPercValue(r[s],i),l.getPointInPercent(e)}}return this.curveSegments[r[0]].pathCurve.getPointInPercent(0)},i.getPercValue=function(t,e){var i=this.curveSegments[t],r=i.points[0],n=i.timeInterval,a=Oo((e-r.x)/n,4);return li(i.easingCurve.getValue(a),0,1)},i.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Zo);function au(t,e,i,r,n){var a=t-e;return(r+r+(n-r)*a/(i-e))*a/2}function su(t,e,i,r,n){var a=t*t,s=e*e;return(2*(a*t)*(r-n)+3*a*(e*n-i*r)-s*e*(2*r+n)+3*s*i*r)/(6*(e-i))}function ou(t,e,i){var r=i[0]-e[0],n=e[3]*r,a=i[2]*r,s=(t-e[0])/r,o=s*s,u=o*s,h=u-2*o+s,l=u-o,c=-2*u+3*o;return(2*u-3*o+1)*e[1]+h*n+l*a+c*i[1]}function uu(t,e){if(e){var i=e[0],r=e[1];if(i===ee.CURVE){t.curves.push(r);var n=r.length;r[0][0]>0&&n++,r[r.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(i===ee.LINE){var a=r.length;if(2===a&&0===r[0][0]&&1===r[1][0])return;r[0][0]>0&&a++,r[r.length-1][0]<1&&a++;var s=Math.ceil(a/2);t.lineSegCount+=s,t.curves.push(r),t.index+=s,t.max=Math.max(t.max,s)}else if(i===ee.BEZIER_CURVE){var o=r.length-1;t.index+=2*o,t.curves.push(r),t.max=Math.max(t.max,2*o),t.curveCount+=2*o}}}function hu(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function lu(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(lu=function(){return!!t})()}function cu(t,e,i){return cu=lu()?Reflect.construct:function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&Jt(n,i.prototype),n},cu.apply(null,arguments)}var fu,du,pu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new gr,e}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=Eu(t[0]),this.yCurve=Eu(t[1]),this.zCurve=Eu(t[2]),this.wCurve=Eu(t[3])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime(),this.wCurve.getMaxTime())},e}(Zo),mu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new vi,e}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=Eu(t[0]),this.yCurve=Eu(t[1]),this.zCurve=Eu(t[2])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t),r=this.zCurve.getValue(t);return this.value.set(e,i,r),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime(),this.zCurve.getMaxTime())},e}(Zo),vu=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new mi,e}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.xCurve=Eu(t[0]),this.yCurve=Eu(t[1])},i.getValue=function(t){var e=this.xCurve.getValue(t),i=this.yCurve.getValue(t);return this.value.set(e,i),this.value},i.getMaxTime=function(){return Math.max(this.xCurve.getMaxTime(),this.yCurve.getMaxTime())},e}(Zo);!function(t){t[t.Cubic=0]="Cubic",t[t.Linear=1]="Linear",t[t.Constant=2]="Constant"}(fu||(fu={})),function(t){t[t.None=0]="None",t[t.In=1]="In",t[t.Out=2]="Out",t[t.Both=3]="Both"}(du||(du={}));var yu=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.keyFrames=t;var e=this.keyFrames;this.curveMap={},this.keys=[],this.curveInfos=[];for(var i=0;i<e.length-1;i++){var r=gu(e[i],e[i+1]),n=r.points,a=r.curve,s=r.timeInterval,o=r.valueInterval,u=n[0],h=n[n.length-1];this.keys.push([].concat(u.toArray(),n[1].toArray())),this.keys.push([].concat(h.toArray(),n[2].toArray()));var l={points:n,timeInterval:s,valueInterval:o,curve:a,timeStart:Number(u.x),timeEnd:Number(h.x)};this.curveMap[u.x+"&"+h.x]=l,this.curveInfos.push(l)}},i.getValue=function(t){var e=0,i=this.keyFrames.length;if(t<=this.keyFrames[0].time)e=this.keyFrames[0].value;else if(t<this.keyFrames[i-1].time)for(var r=0;r<this.keyFrames.length-1;r++){var n=this.keyFrames[r].time,a=this.keyFrames[r+1].time;if(t>=n&&t<a){var s=this.curveInfos[r],o=s.points[0],u=s.timeInterval,h=s.valueInterval,l=(t-o.x)/u,c=s.curve.getValue(l);e=o.y+h*c;break}}else t>=this.keyFrames[i-1].time&&(e=this.keyFrames[i-1].value);return e},i.getIntegrateValue=function(t,e,i){void 0===i&&(i=1);var r=(e-t)/i,n=0,a=Object.keys(this.curveMap);if(r<=this.curveMap[a[0]].timeStart)return 0;for(var s=0;s<a.length;s++){var o=this.curveMap[a[s]].timeStart,u=this.curveMap[a[s]].timeEnd;if(r>=Number(u)&&(n+=i*this.getCurveIntegrateValue(a[s],Number(u))),r>=Number(o)&&r<Number(u)){n+=i*this.getCurveIntegrateValue(a[s],r);break}}return n},i.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},i.getCurveIntegrateValue=function(t,e){for(var i=this.curveMap[t],r=i.points[0],n=i.timeInterval,a=i.valueInterval,s=0,o=(e-r.x)/20,u=0;u<=20;u++){var h=u*o/n,l=r.y+a*i.curve.getValue(h);s+=0===u||20===u?l:u%2==1?4*l:2*l}return s*=o/3},i.toUniform=function(t){var e=t.index,i=this.keys.length;return t.curves.push(this),t.index=e+i,t.max=Math.max(t.max,i),t.curveCount+=i,new Float32Array([5,e+1/i,e,i])},i.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),i=0,r=0;i<t.length;i++,r+=4)e.set(t[i],r);return e},i.getMaxTime=function(){return this.keyFrames[this.keyFrames.length-1].time},e}(Zo);function gu(t,e){var i=new mi(t.time,t.value),r=new mi,n=new mi,a=new mi,s=2===t.weightedMode||3===t.weightedMode||1===e.weightedMode||3===e.weightedMode,o=2===t.tangentMode,u=(s?t.outWeight:1)*(e.time-t.time)/3;r.x=t.time+u,r.y=t.value+u*(o?0:t.outSlope);var h=(s?e.inWeight:1)*(e.time-t.time)/3;n.x=e.time-h,n.y=e.value-h*(o?0:e.inSlope),a.x=e.time,a.y=o?t.value:e.value,ut(n),ut(a);var l,c,f=a.x-i.x,d=a.y-i.y,p=Oo((r.x-i.x)/f,5),m=Oo((n.x-i.x)/f,5);Ro(d,0)?l=c=NaN:(l=Oo((r.y-i.y)/d,5),c=Oo((n.y-i.y)/d,5)),p<0&&(console.error("Invalid bezier points, x1 < 0",i,r,n,a),p=0),m<0&&(console.error("Invalid bezier points, x2 < 0",i,r,n,a),m=0),p>1&&(console.error("Invalid bezier points, x1 >= 1",i,r,n,a),p=1),m>1&&(console.error("Invalid bezier points, x2 >= 1",i,r,n,a),m=1);var v,y=("bez_"+p+"_"+l+"_"+m+"_"+c).replace(/\./g,"p");return Po[y]?v=Po[y]:(v=Ro(d,0)?new jo:s?new jo(p,l,m,c):new jo(l,c),Po[y]=v),{points:[i,r,n,a],timeInterval:f,valueInterval:d,curve:v}}function xu(t){for(var e=t,i=[],r=[],n={x:0,y:0},a=0;a<e.length-1;a++){var s=e[a],o=e[a+1],u=Ho(s,o,!0),h=u.p0,l=u.p1,c=u.p2,f=u.p3;ut(c),ut(f);var d={leftControl:n,value:h,rightControl:l,tangentMode:0};if(s[0]===ie.HOLD&&(d.tangentMode=2),r.push(d),n=c,a===e.length-2){var p=Ho(o,o,!0);ut(p.p3),r.push({leftControl:c,value:p.p3,rightControl:{x:0,y:0},tangentMode:o[0]===ie.HOLD?2:0})}}for(var m=function(t,e){return(e.y-t.y)/(e.x-t.x+oi)},v=0;v<r.length;v++){var y=r[v].leftControl,g=r[v].value,x=r[v].rightControl,b=m(g,x),T=m(y,g),E={time:g.x,value:g.y,inSlope:T,outSlope:b,inWeight:0,outWeight:0,tangentMode:r[v].tangentMode,weightedMode:3};i.push(E),v>0&&(E.inWeight=(g.x-y.x)/((g.x-r[v-1].value.x)/3)),v+1<r.length&&(E.outWeight=(x.x-g.x)/((r[v+1].value.x-g.x)/3))}return i}var bu,Tu=((bu={})[ee.RANDOM]=function(t){return C(t[0],Array)?new Jo(t):new Qo(t)},bu[ee.CONSTANT]=function(t){return new qo(t)},bu[ee.CONSTANT_VEC2]=function(t){return new qo(t)},bu[ee.CONSTANT_VEC3]=function(t){return new qo(t)},bu[ee.CONSTANT_VEC4]=function(t){return new qo(t)},bu[ee.RGBA_COLOR]=function(t){return new qo(t)},bu[ee.COLORS]=function(t){return new Ko(t.map((function(t){return U(t,!1)})))},bu[ee.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new $o([t[0][1],t[1][1]]):new eu(t)},bu[ee.GRADIENT_COLOR]=function(t){return new tu(t)},bu[ee.LINEAR_PATH]=function(t){return new iu(t)},bu[ee.BEZIER_CURVE]=function(t){return 1===t.length?new qo(t[0][1][1]):new yu(xu(t))},bu[ee.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new qo(cu(vi,[].concat(t[1][0]))):new ru(t)},bu[ee.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new qo(cu(yi,[].concat(t[1][0]))):new nu(t)},bu[ee.COLOR_CURVE]=function(t){return new _u(t)},bu[ee.VECTOR4_CURVE]=function(t){return new pu(t)},bu[ee.VECTOR2_CURVE]=function(t){return new vu(t)},bu[27]=function(t){return new mu(t)},bu);function Eu(t){if(!t||!isNaN(+t))return new qo(t||0);if(C(t,Zo))return t;if(bt(Tu[t[0]]))return Tu[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Hs["ValueType: 21/22 is not supported"]+".")}var _u=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Er,e}$t(e,t);var i=e.prototype;return i.onCreate=function(t){this.rCurve=Eu(t[0]),this.gCurve=Eu(t[1]),this.bCurve=Eu(t[2]),this.aCurve=Eu(t[3])},i.getValue=function(t){var e=this.rCurve.getValue(t),i=this.gCurve.getValue(t),r=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,i,r,n),this.value},i.getMaxTime=function(){return Math.max(this.rCurve.getMaxTime(),this.gCurve.getMaxTime(),this.bCurve.getMaxTime(),this.aCurve.getMaxTime())},e}(Zo),wu=1,Cu=function(){function t(t,e,i,r){this.transform=i,this.engine=r,this.color=t.options.previewColor;var n=this.createMaterial(e),a=this.createGeometry();this.mesh=this.createMesh(a,n),this.updateMesh()}var e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),i=t.getVector4("uPos").clone(),r=new vi,n=new yi,a=this.transform.scale.clone();this.transform.assignWorldTRS(r,n,a),e.x=a.x,e.y=a.y,i.x=r.x,i.y=r.y,i.z=r.z,t.setVector2("uSize",e),t.setVector4("uPos",i),t.setQuaternion("uQuat",n)},e.createMaterial=function(t){var e,i=[["ENV_EDITOR",(null==(e=this.engine.renderer)?void 0:e.env)===Xs]],r=Eu(this.color).getValue(0),n={shader:{vertex:"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",fragment:"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor*vColor.a;\n}\n",glslVersion:In.GLSL1,cacheId:t.cachePrefix+"_effects_interact",macros:i},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=On.create(this.engine,n);return a.blending=!0,a.depthTest=!1,a.setVector4("uPos",new gr(0,0,0,0)),a.setVector2("uSize",new mi(1,1)),a.setVector4("uColor",new gr(r[0]/255,r[1]/255,r[2]/255,r[3])),a.setQuaternion("uQuat",new yi(0,0,0,0)),a},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return Wn.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:Mr.LINES,maxVertex:4})},e.createMesh=function(t,e){return ra.create(this.engine,{name:"Interact_preview"+wu++,priority:0,worldMatrix:_r.fromIdentity(),geometry:t,material:e})},t}(),Au=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.speed=25,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.invalidBorderRange=0,e.invalidByBorderRange=!1,e.duringPlay=!1,e._interactive=!0,e.lastTime=-1,e.getHitTestParams=function(t){if(e.clickable){var i=e.item.props.content.options.behavior,r=e.getBoundingBox();return r?{type:r.type,triangles:r.area,behavior:i}:void 0}},e}$t(e,t);var i=e.prototype;return i.getDragRangeX=function(){return this.dragRange.dxRange},i.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},i.getDragRangeY=function(){return this.dragRange.dyRange},i.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},i.onStart=function(){var t=this.item.engine.renderer.env,e=this.item.composition,i=this.interactData.options,r=i.type,n=i.showPreview;if(r===Xt.CLICK&&(this.clickable=!0,n&&t===Xs)){var a=null==e?void 0:e.getRendererOptions();void 0!==a&&(this.previewContent=new Cu(this.item.props.content,a,this.transform,this.engine))}this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},i.onDisable=function(){t.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&this.item.composition.getSpeed()>0&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},i.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,i=this.item.engine.renderer.env;if(e===Xt.CLICK)this.clickable=!0;else if(e===Xt.DRAG){var r=this.interactData.options,n=r.enableInEditor;if(i!==Xs||n){var a,s=(null!=(a=this.item.composition)?a:{}).event;s&&this.beginDragTarget(r,s)}}},i.onUpdate=function(t){var e;if(this.duringPlay=!0,this.lastTime<=this.item.time){if(this.item.time>=0&&this.lastTime<0){var i,r=this.item.props.content.options;null==(i=this.item.composition)||i.addInteractiveItem(this.item,r.type)}}else if(this.item.time>=0&&t>0){var n,a=this.item.props.content.options;null==(n=this.item.composition)||n.addInteractiveItem(this.item,a.type)}this.lastTime=this.item.time,null==(e=this.previewContent)||e.updateMesh(),this.dragEvent&&this.bouncingArg&&(this.bouncingArg.vx*=this.downgrade,this.bouncingArg.vy*=this.downgrade,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,Su(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},i.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},i.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},i.endDragTarget=function(){},i.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var i,r,n=t.cameraParam,a=n.position,s=n.fov,o=e.dy,u=e.dx*e.width/e.height,h=a[2],l=Math.tan(s*Math.PI/180/2)*Math.abs(h),c=o*l,f=u*l,d=this.dragRange,p=d.dxRange,m=d.dyRange,v=a[0]-this.dragRatio[0]*f,y=a[1]-this.dragRatio[1]*c,g=p[0],x=p[1],b=m[0],T=m[1];if(v=li(v,g,x),y=li(y,b,T),v!==g&&v!==x&&g!==x)null==(i=e.origin)||i.preventDefault();if(y!==b&&y!==T&&b!==T)null==(r=e.origin)||r.preventDefault();this.item.composition.camera.position=new vi(v,y,h)}},i.beginDragTarget=function(t,i){var r=this;if("camera"===t.target){var n,a={touchstart:function(t){var e;if(r.canInteract()&&(r.invalidByBorderRange=r.checkInvalidBorderRange({x:t.x,y:t.y}),!r.invalidByBorderRange)){r.dragEvent=null,r.bouncingArg=null;var i=null==(e=r.item.composition)?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==i?void 0:i.position.toArray())||[0,0,8],fov:(null==i?void 0:i.fov)||60}}}},touchmove:function(t){r.invalidByBorderRange||(r.handleDragMove(n,t),r.bouncingArg=t)},touchend:function(t){if(r.canInteract()){var e=r.bouncingArg;!Su(e,3)&&e&&(e.vx*=r.speed,e.vy*=r.speed,r.dragEvent=ri({},n)),n=null}}};Object.keys(a).forEach((function(t){i.addEventListener(t,a[t])})),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(a).forEach((function(t){i.removeEventListener(t,a[t])}))}}},i.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=Io(vi.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:ro.triangle,area:e}},i.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===Xt.DRAG){var i=e.options;i.dxRange&&(this.dragRange.dxRange=i.dxRange),i.dyRange&&(this.dragRange.dyRange=i.dyRange)}},i.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},i.checkInvalidBorderRange=function(t){var e=this.invalidBorderRange;if(e){var i=0,r=0,n=0,a=0;if("number"==typeof e)i=e,r=e,n=e,a=e;else if(xt(e)){var s,o,u,h,l;i=void 0===(o=(s=e)[0])?0:o,r=void 0===(u=s[1])?0:u,n=void 0===(h=s[2])?0:h,a=void 0===(l=s[3])?0:l}if(t.x<a-1||t.x>1-r||t.y<i-1||t.y>1-n)return!0}return!1},dr(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(yr);function Su(t,e){var i=1e-5*(e||1);return t&&Math.abs(t.vx||0)<i&&Math.abs(t.vy||0)<i}Au=S([ke(Ae.InteractComponent)],Au);var Iu,Ru=function(){function t(){this.triangles=[],this.worldMatrix=new _r,this.assemblyTriangles=function(t,e,i,r,n){for(var a=i;a<r;a+=3){var s=3*e[a],o=3*e[a+1],u=3*e[a+2],h={x:t[s],y:t[s+1],z:t[s+2]},l={x:t[o],y:t[o+1],z:t[o+2]},c={x:t[u],y:t[u+1],z:t[u+2]};n.push({p0:h,p1:l,p2:c})}}}var e=t.prototype;return e.getBoundingBoxData=function(){return this.applyWorldMatrix(this.boundingBoxData.area),this.boundingBoxData},e.getBoundingBox=function(){for(var t,e=-Number.MAX_VALUE,i=-Number.MAX_VALUE,r=Number.MAX_VALUE,n=Number.MAX_VALUE,a=w(this.boundingBoxData.area);!(t=a()).done;){var s=t.value;e=Math.max(s.p0.x,s.p1.x,s.p2.x,e),i=Math.max(s.p0.y,s.p1.y,s.p2.y,i),r=Math.min(s.p0.x,s.p1.x,s.p2.x,r),n=Math.min(s.p0.y,s.p1.y,s.p2.y,n)}var o=[],u=new vi(r,i,0),h=new vi(e,i,0),l=new vi(e,n,0),c=new vi(r,n,0);return o.push({p0:u,p1:h,p2:l}),o.push({p0:u,p1:l,p2:c}),this.applyWorldMatrix(o),{type:ro.triangle,area:o}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t);for(var i,r=[],n=w(this.triangles);!(i=n()).done;){var a=i.value;r.push({p0:a.p0,p1:a.p1,p2:a.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxData={type:ro.triangle,area:r}},e.geometryToTriangles=function(t){var e=t.getIndexData(),i=t.getAttributeData("aPos"),r=[];if(!e||!i)return r;if(0===t.subMeshes.length)this.assemblyTriangles(i,e,0,e.length,r);else for(var n,a=w(t.subMeshes);!(n=a()).done;){var s=n.value;if(void 0!==s.indexCount){var o=e.BYTES_PER_ELEMENT,u=s.offset/o,h=u+s.indexCount;this.assemblyTriangles(i,e,u,h,r)}}return r},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new vi),t.p1=e.worldMatrix.transformPoint(t.p1,new vi),t.p2=e.worldMatrix.transformPoint(t.p2,new vi)})),t},t}(),Ou=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return $t(e,t),e}(Qt),Mu=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,i=w(this.playableOutputs);!(e=i()).done;){e.value.context.deltaTime=t}for(var r,n=w(this.playableOutputs);!(r=n()).done;){var a=r.value;this.prepareFrameWithRoot(a)}for(var s,o=w(this.playableOutputs);!(s=o()).done;){var u=s.value;this.processFrameWithRoot(u)}},e.addOutput=function(t){this.playableOutputs.push(t)},e.addPlayable=function(t){this.playables.push(t)},e.processFrameWithRoot=function(t){t.sourcePlayable.processFrame(t.context),t.processFrame()},e.prepareFrameWithRoot=function(t){t.prepareFrame(),t.sourcePlayable.prepareFrame(t.context)},e.updatePlayableTime=function(t,e){0===t.getPlayState()&&t.setTime(t.getTime()+e)},t}(),Nu=function(){function t(t,e){this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1,this.duration=0,this.destroyed=!1,this.playState=0,this.time=0,t.addPlayable(this)}var e=t.prototype;return e.play=function(){switch(this.playState){case 0:break;case 1:this.playState=0,this.onPlayablePlayFlag=!0,this.onPlayablePauseFlag=!1}},e.pause=function(){if(0===this.playState)this.playState=1,this.onPlayablePauseFlag=!0,this.onPlayablePlayFlag=!1},e.setTime=function(t){this.time=t},e.getTime=function(){return this.time},e.setDuration=function(t){this.duration=t},e.getDuration=function(){return this.duration},e.getPlayState=function(){return this.playState},e.prepareFrame=function(t){},e.processFrame=function(t){},e.onPlayableDestroy=function(){},e.dispose=function(){this.destroyed||(this.onPlayableDestroy(),this.destroyed=!0)},t}(),Pu=function(){function t(){this.context={deltaTime:0,output:this}}var e=t.prototype;return e.setSourcePlayable=function(t){this.sourcePlayable=t},e.setUserData=function(t){this.userData=t},e.getUserData=function(){return this.userData},e.prepareFrame=function(){},e.processFrame=function(){},t}(),Fu=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Be);function Lu(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}!function(t){t[t.Playing=0]="Playing",t[t.Paused=1]="Paused"}(Iu||(Iu={}));var Vu=new yi,Du=1,ku=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new vi(0,0,0),this.quat=new yi(0,0,0,1),this.rotation=new Zn(0,0,0),this.scale=new vi(1,1,1),this.anchor=new vi(0,0,0),this.size=new mi(1,1),this.children=[],this.worldMatrix=_r.fromIdentity(),this.localMatrix=_r.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new vi(0,0,0),quat:new yi(0,0,0,1),scale:new vi(1,1,1)},this.name="transform_"+Du++,t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}var e=t.prototype;return e.setPosition=function(t,e,i){this.position.x===t&&this.position.y===e&&this.position.z===i||(this.position.x=t,this.position.y=e,this.position.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,i){0===t&&0===e&&0===i||(this.position.x+=t,this.position.y+=e,this.position.z+=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,i){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===i||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=i,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,i,r){this.quat.x===t&&this.quat.y===e&&this.quat.z===i&&this.quat.w===r||(this.quat.x=t,this.quat.y=e,this.quat.z=i,this.quat.w=r,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,i){this.scale.x===t&&this.scale.y===e&&this.scale.z===i||(this.scale.x=t,this.scale.y=e,this.scale.z=i,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setSize=function(t,e){this.size.x===t&&this.size.y===e||(this.size.x=t,this.size.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.scaleBy=function(t,e,i){this.scale.x*=t,this.scale.y*=e,this.scale.z*=i,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setAnchor=function(t,e){this.anchor.x===t&&this.anchor.y===e||(this.anchor.x=t,this.anchor.y=e,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setTransform=function(t,e){var i=t.position,r=t.rotation,n=t.scale,a=t.size,s=t.quat,o=t.name,u=t.anchor;if(o&&(this.name=o),i&&(C(i,vi)?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),s)C(s,yi)?this.setQuaternion(s.x,s.y,s.z,s.w):this.setQuaternion(s[0],s[1],s[2],s[3]);else if(r){var h=e?-1:1;C(r,Zn)?this.setRotation(r.x*h,r.y*h,r.z*h):this.setRotation(r[0]*h,r[1]*h,r[2]*h)}n&&(C(n,vi)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),a&&this.setSize(a.x,a.y),u&&(C(u,mi)?this.setAnchor(u.x,u.y):this.setAnchor(u[0],u[1]))},e.addChild=function(t){V(this.children,t)},e.removeChild=function(t){D(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Zn)},e.getQuaternion=function(){return this.quat},e.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},e.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.getWorldScale=function(){var t=this.worldTRSCache;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return this.worldTRSCache.scale.clone()},e.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},e.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new Zn)},e.assignWorldTRS=function(t,e,i){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),i&&i.copyFrom(this.worldTRSCache.scale)},e.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),this.rotation.setFromQuaternion(this.quat.clone().conjugate()),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.getValid=function(){return this.valid},e.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.eulerHint={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},e.fromData=function(t){var e={};e.position=(new vi).copyFrom(t.position),t.quat?e.quat=new yi(t.quat.x,t.quat.y,t.quat.z,t.quat.w):e.rotation=new Zn(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),e.scale=(new vi).copyFrom(t.scale),t.size&&(e.size=(new mi).copyFrom(t.size)),t.anchor&&(e.anchor=(new mi).copyFrom(t.anchor)),this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var i=Vu.copyFrom(t);return i.conjugate(),e.setFromQuaternion(i)},dr(t,[{key:"parentTransform",get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)}},{key:"parentMatrixDirty",get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())}}]),t}(),zu=new vi(1,1,1),Uu=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new ku,this.viewportMatrix=_r.fromIdentity(),this.viewMatrix=_r.fromIdentity(),this.projectionMatrix=_r.fromIdentity(),this.viewProjectionMatrix=_r.fromIdentity(),this.inverseViewMatrix=_r.fromIdentity(),this.dirty=!0;var i=e.near,r=void 0===i?.1:i,n=e.far,a=void 0===n?20:n,s=e.fov,o=void 0===s?60:s,u=e.aspect,h=void 0===u?1:u,l=e.clipMode,c=void 0===l?te.portrait:l,f=e.position,d=void 0===f?[0,0,8]:f,p=e.rotation,m=void 0===p?[0,0,0]:p,v=new Zn(m[0],m[1],m[2]),y=(new yi).setFromEuler(v);this.options={near:r,far:a,fov:o,aspect:h,clipMode:c},this.transform.setPosition(d[0],d[1],d[2]),this.transform.setQuaternion(y.x,y.y,y.z,y.w),this.dirty=!0,this.updateMatrix()}var e=t.prototype;return e.setTransform=function(t){this.transform.parentTransform=t.parentTransform,this.transform.cloneFromMatrix(t.getMatrix()),this.dirty=!0},e.setViewportMatrix=function(t){this.viewportMatrix=t.clone(),this.dirty=!0},e.getViewportMatrix=function(){return this.viewportMatrix},e.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},e.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},e.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},e.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null==(t=this.inverseProjectionMatrix)?void 0:t.clone()},e.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},e.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},e.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},e.getInverseVPRatio=function(t){var e=new vi(this.position.x,this.position.y,t),i=this.getViewProjectionMatrix(),r=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();r.premultiply(n),i.multiply(n.invert())}var a=i.projectPoint(e).z,s=r.projectPoint(new vi(1,1,a)),o=s.x,u=s.y,h=r.projectPoint(new vi(-1,-1,a)),l=h.x,c=h.y;return new vi((o-l)/2,(u-c)/2,0)},e.setQuat=function(t){this.transform.getQuaternion().equals(t)||(this.transform.setQuaternion(t.x,t.y,t.z,t.w),this.dirty=!0)},e.getQuat=function(){return this.transform.quat.clone()},e.getOptions=function(){return ri({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,i=t.far,r=t.fov,n=t.clipMode,a=t.aspect,s=t.position,o=t.rotation;this.near=e,this.far=i,this.fov=r,this.clipMode=n,this.aspect=a,this.position=s,this.rotation=o,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,i=e.fov,r=e.aspect,n=e.near,a=e.far,s=e.clipMode;this.projectionMatrix.perspective(i*ai,r,n,a,s===te.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),zu),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:_r.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},dr(t,[{key:"near",get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)}},{key:"far",get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)}},{key:"fov",get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)}},{key:"aspect",get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)}},{key:"clipMode",get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)}},{key:"position",get:function(){return this.transform.position.clone()},set:function(t){this.transform.position.equals(t)||(this.transform.setPosition(t.x,t.y,t.z),this.dirty=!0)}},{key:"worldPosition",get:function(){return this.transform.getWorldPosition()}},{key:"rotation",get:function(){return this.transform.rotation.clone()},set:function(t){this.transform.rotation.equals(t)||(this.transform.setRotation(t.x,t.y,t.z),this.dirty=!0)}}]),t}(),Bu=function(){function t(t){var e=t.time,i=t.interval,r=t.count,n=t.cycles,a=t.probability;this.time=+e||0,this.interval=+i||1,this.count=C(r,Zo)?r:Eu(r),this.cycles=+n||1/0,this.probability=isNaN(a)?1:+a,this.reset()}var e=t.prototype;return e.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},e.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.clone=function(){return new t({time:this.time,interval:this.interval,count:this.count,cycles:this.cycles,probability:this.probability})},t}(),Gu=function(t){this.content=t},ju=function(){function t(t){this.sort=t,this.length=0}var e=t.prototype;return e.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},e.insertNode=function(t,e){var i=t.next;t.next=e,e.pre=t,e.next=i,i&&(i.pre=e)},e.shiftNode=function(t){var e=new Gu(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var i=this.first;i;){if(!(this.sort(i.content,e.content)<=0))return i.pre?this.insertNode(i.pre,e):(this.first=e,e.next=i,i.pre=e),e;if(!i.next)return this.insertNode(i,e),this.last=e;i=i.next}},e.pushNode=function(t){var e=new Gu(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var i=this.last;i;){if(!(this.sort(e.content,i.content)<=0))return this.insertNode(i,e),i===this.last&&(this.last=e),e;if(this.first===i)return i.pre=e,e.next=i,this.first=e;i=i.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var i=this.first=e.next;i&&(i.pre=null)}else if((e=this.last)===t){var r=this.last=e.pre;r&&(r.next=null)}else if(t){var n=t.pre,a=t.next;n.next=a,a&&(a.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var i=this.first,r=0;if(i)do{t.call(e||this,i.content,r++)}while(i=i.next)},e.forEachReverse=function(t,e){var i=this.last,r=this.length-1;if(i)do{t.call(e||this,i.content,r--)}while(i=i.pre)},e.getNodeByIndex=function(t){var e=0,i=this.first;if(!i||t>=this.length||t<0)return null;for(;e<t;)i=i.next,e++;return i},t}(),Xu="runtime_env",Hu="lookup_texture",Wu="offscreen_canvas",Yu="post_process_settings",Zu={};function qu(t){return Zu[t]}function Ku(t,e){return Zu[t]=e}var Qu=new vi,Ju=new vi,$u=function(){function t(t,e){this.pointStart=[];var i,r=e.colorOverLifetime,n=e.colorOverTrail,a=e.maxTrailCount,s=e.opacityOverLifetime,o=void 0===s?Eu(1):s,u=e.widthOverTrail,h=e.name,l=e.occlusion,c=e.blending,f=e.maskMode,d=e.mask,p=e.textureMap,m=void 0===p?[0,0,1,1]:p,v=e.texture,y=e.transparentOcclusion,g=e.minimumVertexDistance,x=e.lifetime,b=e.matrix,T=t.gpuCapability,E=T.detail,_=T.level,w=Math.max(e.pointCountPerTrail,2),A={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},S=E.maxVertexTextures>0,I=(null!=(i=t.renderer)?i:{}).env,R={},O=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",I===Xs]],M=a>64,N=0;r&&(O.push(["COLOR_OVER_LIFETIME",!0]),N|=1,R.uColorOverLifetime=fn.createWithData(t,rt(r))),n&&(O.push(["COLOR_OVER_TRAIL",!0]),N|=4,R.uColorOverTrail=fn.createWithData(t,rt(n))),M?(O.push(["ATTR_TRAIL_START",1]),N|=8):R.uTrailStart=new Float32Array(a),R.uOpacityOverLifetimeValue=o.toUniform(A);var P=u.toUniform(A);O.push(["VERT_CURVE_VALUE_COUNT",A.index],["VERT_MAX_KEY_FRAME_COUNT",A.max]),R.uVCurveValues=Zo.getAllData(A);var F={shader:{vertex:ga,fragment:va,macros:O,glslVersion:1===_?In.GLSL1:In.GLSL3,shared:!0,name:"trail#"+h,cacheId:"-t:+"+N+"+"+A.index+"+"+A.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},L=w*a*2,V=(w-1)*a,D=Float32Array.BYTES_PER_ELEMENT,k=12*D,z={attributes:{aColor:{size:4,stride:k,data:new Float32Array(12*L)},aSeed:{size:1,stride:k,offset:4*D,dataSource:"aColor"},aInfo:{size:3,stride:k,offset:5*D,dataSource:"aColor"},aPos:{size:4,stride:k,offset:8*D,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(L)},aDir:{size:3,data:new Float32Array(3*L)}},indices:{data:new Uint16Array(6*L)},drawCount:6*V,name:"trail#"+h,bufferUsage:Mr.DYNAMIC_DRAW};if(M)z.attributes.aTrailStart={size:1,data:new Float32Array(L)};else{var U=new Float32Array(L);z.attributes.aTrailStartIndex={size:1,data:U};for(var B=0;B<a;B++)for(var G=2*w,j=B*G,X=0;X<G;X++)U[j+X]=B}var H=zr(c),W=On.create(t,F);W.blending=!0,W.depthMask=l,W.depthTest=!0,W.stencilRef=d?[d,d]:void 0,Gr(W,f),Ur(W,c);var Y=this.mesh=ra.create(t,{name:"MTrail_"+h,material:W,geometry:Wn.create(t,z)}),Z=null!=v?v:fn.createWithData(t);Object.keys(R).map((function(t){var e=R[t];if(C(e,fn))W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var i=[],r=0;r<e.length;r+=4){var n=new gr(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}W.setVector4Array(t,i)}else W.setVector4(t,gr.fromArray(e))})),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",gr.fromArray(P)),W.setVector2("uTexOffset",new mi(0,0)),W.setVector4("uTextureMap",gr.fromArray(m)),W.setVector4("uParams",new gr(0,w-1,0,0)),W.setTexture("uMaskTex",Z),W.setVector4("uColorParams",new gr(v?1:0,+H,0,+(l&&!y))),this.maxTrailCount=a,this.pointCountPerTrail=w,this.checkVertexDistance=g>0,this.minimumVertexDistance=Math.pow(g||.001,2),this.useAttributeTrailStart=M,this.lifetime=x,b&&(this.mesh.worldMatrix=b),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(a)}var e=t.prototype;return e.addPoint=function(t,e,i){i=i||{};var r=this.trailCursors[t],n=this.pointCountPerTrail,a=this.geometry,s=n-1,o=r%n,u=(r-1)%n,h=(r-2)%n,l=this.getTrailPosition(t,u,Qu);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var c=t*n+o,f=rh(l,e),d=i.time||this.time,p=[Math.random(),i.lifetime||this.lifetime,r],m=i.size||1,v=6*c,y=new Float32Array(6);y.set(f,0),y.set(f,3),a.setAttributeSubData("aDir",v,y),a.setAttributeSubData("aTime",2*c,new Float32Array([d,d]));var g=i.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(p,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(p,16),x[19]=1,x.set(b,20),x[23]=-.5*m,a.setAttributeSubData("aColor",24*c,x),u>=0){var T=this.getTrailPosition(t,h,Ju),E=new Float32Array(rh(T,l,e)),_=6*(t*n+u);a.setAttributeSubData("aDir",_,E),a.setAttributeSubData("aDir",_+3,E);var w=t*n*2,C=new Uint16Array([2*u+w,2*u+1+w,2*o+w,2*o+w,2*u+1+w,2*o+1+w]),A=6*(t*s+(r-1)%s);a.setIndexSubData(A,C)}r=++this.trailCursors[t];var S=this.mesh.material,I=S.getVector4("uParams"),R=p[2];if(this.useAttributeTrailStart){for(var O=2*n,M=new Float32Array(O),N=0;N<O;N++)M[N]=R;a.setAttributeSubData("aTrailStart",t*M.length,M)}else{var P=S.getFloats("uTrailStart");null!=P&&(P[t]=R,S.setFloats("uTrailStart",P))}I&&(I.y=Math.max(I.y,r-1)-Math.max(0,r-n),S.setVector4("uParams",I))}},e.getTrailPosition=function(t,e,i){var r=this.pointCountPerTrail;if(e>=0&&e<r){var n=24*(t*r+e)+8,a=this.geometry.getAttributeData("aColor");return ut(a),i.x=a[n],i.y=a[1+n],i.z=a[2+n],i}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();ut(t),this.trailCursors=new Uint16Array(this.trailCursors.length),this.geometry.setIndexData(new Uint16Array(t.length))},e.minusTime=function(t){var e=this.geometry.getAttributeData("aTime");ut(e);for(var i=0;i<e.length;i++)e[i]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),i=this.geometry.getIndexData();ut(i),i.set(new Uint16Array(e),t*e),this.geometry.setIndexData(i),this.trailCursors[t]=0}},e.getPointStartPos=function(t){return this.pointStart[t]},e.setPointStartPos=function(t,e){this.pointStart[t]=e},e.onUpdate=function(t){},dr(t,[{key:"time",get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)}}]),t}(),th=new vi,eh=new vi,ih=new vi;function rh(t,e,i){var r=th;return t||i?(t?i?(eh.subtractVectors(e,t).normalize(),eh.subtractVectors(i,e),ih.copyFrom(eh).normalize(),r.addVectors(eh,ih)):r.subtractVectors(e,t):r.subtractVectors(i,e),r.normalize().toArray()):[0,0,0]}var nh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).lastTime=0,e}$t(e,t);var i=e.prototype;return i.start=function(t){var e=t.output.getUserData();!this.particleSystem&&C(e,gl)&&(this.particleSystem=e.getComponent(dh),this.particleSystem&&(this.particleSystem.name=e.name))},i.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;e&&(this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),e.update(this.time-e.time)),this.lastTime=this.time},e}(Nu),ah=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){return new nh(t)},e}(Fu),sh={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"},oh=function(){function t(t,e){var i;this.particleCount=0,this.cachedRotationVector3=new vi,this.cachedRotationMatrix=new qn,this.cachedLinearMove=new vi,this.tempMatrix3=new qn,this.VERT_MAX_KEY_FRAME_COUNT=0;var r,n,a=(null!=(i=t.renderer)?i:{}).env,s=e.speedOverLifetime,o=e.colorOverLifetime,u=e.linearVelOverLifetime,h=e.orbitalVelOverLifetime,l=e.sizeOverLifetime,c=e.rotationOverLifetime,f=e.sprite,d=e.gravityModifier,p=e.maxCount,m=e.textureFlip,v=e.useSprite,y=e.name,g=e.gravity,x=e.forceTarget,b=e.side,T=e.occlusion,E=e.anchor,_=e.blending,w=e.maskMode,A=e.mask,S=e.transparentOcclusion,I=e.meshSlots,R=e.renderMode,O=void 0===R?0:R,M=e.diffuse,N=void 0===M?fn.createWithData(t):M,P=t.gpuCapability.detail,F=P.halfFloatTexture,L=P.maxVertexUniforms,V=[["RENDER_MODE",+O],["ENV_EDITOR",a===Xs]],D=t.gpuCapability.level,k={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},z={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},U=L>0,B={},G=0,j=0;(this.useSprite=v,U&&V.push(["ENABLE_VERTEX_TEXTURE",!0]),s&&(V.push(["SPEED_OVER_LIFETIME",!0]),j|=2,B.uSpeedLifetimeValue=s.toUniform(k)),(null==f?void 0:f.animate)&&(V.push(["USE_SPRITE",!0]),j|=4,B.uFSprite=B.uSprite=new Float32Array([f.col,f.row,f.total,f.blend?1:0]),this.useSprite=!0),(null==o?void 0:o.color)&&(V.push(["COLOR_OVER_LIFETIME",!0]),j|=16,B.uColorOverLifetime=C(o.color,fn)?o.color:fn.createWithData(t,rt(o.color))),(null==o?void 0:o.opacity)?B.uOpacityOverLifetimeValue=o.opacity.toUniform(k):B.uOpacityOverLifetimeValue=Eu(1).toUniform(k),["x","y","z"].forEach((function(t,e){var i=0,n=0;(null==u?void 0:u[t])&&(B["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=u[t].toUniform(k),i=1,j|=1<<7+e,u.enabled=!0),V.push(["LINEAR_VEL_"+t.toUpperCase(),i]),(null==h?void 0:h[t])&&(B["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(k),n=1,j|=1<<10+e,r=!0,h.enabled=!0),V.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==u?void 0:u.asMovement)&&(V.push(["AS_LINEAR_MOVEMENT",!0]),j|=32),r&&((null==h?void 0:h.asRotation)&&(V.push(["AS_ORBITAL_MOVEMENT",!0]),j|=64),B.uOrbCenter=new Float32Array((null==h?void 0:h.center)||[0,0,0])),B.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(k),null==l?void 0:l.separateAxes)&&(V.push(["SIZE_Y_BY_LIFE",1]),j|=16384,B.uSizeYByLifetimeValue=null==l||null==(n=l.y)?void 0:n.toUniform(k));(null==c?void 0:c.z)&&(B.uRZByLifeTimeValue=c.z.toUniform(k),j|=32768,V.push(["ROT_Z_LIFETIME",1])),(null==c?void 0:c.x)&&(B.uRXByLifeTimeValue=c.x.toUniform(k),j|=65536,V.push(["ROT_X_LIFETIME",1])),(null==c?void 0:c.y)&&(B.uRYByLifeTimeValue=c.y.toUniform(k),j|=1<<17,V.push(["ROT_Y_LIFETIME",1])),(null==c?void 0:c.asRotation)&&(V.push(["ROT_LIFETIME_AS_MOVEMENT",1]),j|=1<<18),B.uGravityModifierValue=d.toUniform(k),x&&(V.push(["FINAL_TARGET",!0]),j|=1<<19,B.uFinalTarget=new Float32Array(x.target||[0,0,0]),B.uForceCurve=x.curve.toUniform(k)),F&&z.max?(j|=1<<20,B.uFCurveValueTexture=dn(t,Zo.getAllData(z,!0),z.index,1)):B.uFCurveValues=Zo.getAllData(z);var X=k.max+k.curves.length-32>L;if(2===D&&(k.max=-1,k.index=I?I[0]:hh(k.index),z.index>0&&(z.max=-1,z.index=I?I[1]:hh(z.index))),X&&F&&U){var H=dn(t,Zo.getAllData(k,!0),k.index,1);B.uVCurveValueTexture=H,G=1}else B.uVCurveValues=Zo.getAllData(k);var W=["-p:",O,j,k.index,k.max,z.index,z.max].join("+");V.push(["VERT_CURVE_VALUE_COUNT",k.index],["FRAG_CURVE_VALUE_COUNT",z.index],["VERT_MAX_KEY_FRAME_COUNT",k.max],["FRAG_MAX_KEY_FRAME_COUNT",z.max]),this.VERT_MAX_KEY_FRAME_COUNT=k.max;var Y={shader:{fragment:va,vertex:"#define LOOKUP_TEXTURE_CURVE "+G+"\n"+ya,glslVersion:1===D?In.GLSL1:In.GLSL3,shared:!0,cacheId:W,macros:V,name:"particle#"+y},uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},Z=zr(_);B.uTexOffset=new Float32Array(N?[1/N.getWidth(),1/N.getHeight()]:[0,0]),B.uMaskTex=N,B.uColorParams=new Float32Array([N?1:0,+Z,0,+(!!T&&!S)]),B.uParams=[0,0,0,0],B.uAcceleration=[(null==g?void 0:g[0])||0,(null==g?void 0:g[1])||0,(null==g?void 0:g[2])||0,0];var q=On.create(t,Y);q.blending=!0,q.depthTest=!0,q.depthMask=!!T,q.stencilRef=A?[A,A]:void 0,Gr(q,w),Ur(q,_),Br(q,b),Object.keys(B).map((function(t){var e=B[t];if(C(e,fn))q.setTexture(t,e);else{var i=[];switch(sh[t]){case"vec4":q.setVector4(t,gr.fromArray(e));break;case"vec3":q.setVector3(t,vi.fromArray(e));break;case"vec2":q.setVector2(t,mi.fromArray(e));break;case"vec4Array":for(var r=0;r<e.length;r+=4){var n=new gr(e[r],e[r+1],e[r+2],e[r+3]);i.push(n)}q.setVector4Array(t,i),i.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),q.setVector3("emissionColor",new vi(0,0,0)),q.setFloat("emissionIntensity",0);var K=Wn.create(t,function(t,e,i){var r=Float32Array.BYTES_PER_ELEMENT,n=12*r,a={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*r,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*r,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*r,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*r,data:new Float32Array(0)},aSeed:{size:1,offset:3*r,stride:8*r,dataSource:"aRot"},aColor:{size:4,offset:4*r,stride:8*r,dataSource:"aRot"},aOffset:{size:4,stride:4*r,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*r,data:new Float32Array(0)},aRotation1:{size:3,offset:3*r,stride:9*r,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*r,stride:9*r,dataSource:"aRotation0"}};e&&(a.aSprite={size:3,stride:3*r,data:new Float32Array(0)});return{attributes:a,indices:{data:new Uint16Array(0)},name:i,maxVertex:t}}(4*p,this.useSprite,"particle#"+y)),Q=ra.create(t,{name:"MParticle_"+y,material:q,geometry:K});this.anchor=E,this.mesh=Q,this.geometry=Q.firstGeometry(),this.forceTarget=x,this.sizeOverLifetime=l,this.speedOverLifetime=s,this.linearVelOverLifetime=u,this.orbitalVelOverLifetime=h,this.orbitalVelOverLifetime=h,this.gravityModifier=d,this.rotationOverLifetime=c,this.maxCount=p,this.textureOffsets=m?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var e=t.prototype;return e.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),i=32*t+4;return ut(e),[e[i],e[i+1],e[i+2],e[i+3]]},e.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.resetGeometryData=function(t){for(var e=t.getAttributeNames(),i=t.getIndexData(),r=0;r<e.length;r++){var n=e[r],a=t.getAttributeData(n);a&&t.setAttributeData(n,new a.constructor(0))}t.setIndexData(new i.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),i=Math.ceil(e.length/12);this.applyTranslation(i,t),this.applyRotation(i,t),this.applyLinearMove(i,t)},e.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),i=0;i<e.length;i+=4)e[i+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var i=this.maxCount;if(t<i){var r=t+1,n=4*r,a=this.geometry,s=r>this.maxParticleBufferCount,o=1;this.particleCount>300?o=(this.particleCount+100)/this.particleCount:this.particleCount>100?o=1.4:this.particleCount>0&&(o=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16),aTranslation:new Float32Array(12),aLinearMove:new Float32Array(12),aRotation0:new Float32Array(36)},h=this.useSprite;h&&(u.aSprite=new Float32Array(12));var l=new vi,c=new yi,f=new vi(1,1,1);e.transform.assignWorldTRS(l,c,f);var d,p=ku.getRotation(c,new Zn),m=l.toArray(),v=p.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],x=[0,0,1,1],b=e.vel,T=e.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random();h&&(d=e.sprite);for(var w=0;w<4;w++){var C=2*w,A=3*w,S=4*w,I=12*w,R=8*w;u.aPos.set(m,I),b.fill(u.aPos,I+3),u.aRot.set(v,R),u.aRot[R+3]=_,u.aRot.set(T,R+4),h&&u.aSprite.set(d,A);var O=e.uv||x;if(O){var M=h?1-y[C+1]:y[C+1];g[0]=O[0]+y[C]*O[2],g[1]=O[1]+M*O[3]}u.aOffset.set(g,S);for(var N=w+w,P=(E[N]-this.anchor.x)*f.x,F=(E[N+1]-this.anchor.y)*f.y,L=0;L<3;L++)u.aPos[I+6+L]=e.dirX.getElement(L)*P,u.aPos[I+9+L]=e.dirY.getElement(L)*F}var V=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(s){var D=z(a.getIndexData(),6*r,6*i,o);D.set(V,6*t),a.setIndexData(D),this.maxParticleBufferCount=D.length/6}else a.setIndexSubData(6*t,V);Object.keys(u).forEach((function(e){var r=u[e],h=a.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(s){var l=a.getAttributeData(e);ut(l);var c=z(l,n*h,4*i*h,o);c.set(r,r.length*t),a.setAttributeData(e,c)}else a.setAttributeSubData(e,r.length*t,r)})),this.particleCount=Math.max(r,this.particleCount),a.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var i=this.time,r=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),a=this.geometry.getAttributeData("aOffset");r.length<3*t&&(r=this.expandArray(r,3*t));for(var s=0,o=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),l=this.mesh.material.getVector4("uGravityModifierValue"),c=0;c<t;c+=4){var f=12*c+3;s=n[f],o=n[f+1],u=n[f+2];var d=i-a[4*c+2],p=a[4*c+3];if(h&&l){var m=this.gravityModifier.getIntegrateValue(0,d,p),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(d/p);s=s*x+v,o=o*x+y,u=u*x+g}else s+=v,o+=y,u+=g}var b=3*c;if(a[4*c+2]<i){var T=s*(e/1e3),E=o*(e/1e3),_=u*(e/1e3);r[b]+=T,r[b+1]+=E,r[b+2]+=_,r[b+3]+=T,r[b+4]+=E,r[b+5]+=_,r[b+6]+=T,r[b+7]+=E,r[b+8]+=_,r[b+9]+=T,r[b+10]+=E,r[b+11]+=_}}this.geometry.setAttributeData("aTranslation",r)},e.applyRotation=function(t,e){var i=this.geometry.getAttributeData("aRotation0"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),a=this.geometry.getAttributeData("aSeed"),s=this.time,o=this.cachedRotationMatrix;i.length<9*t&&(i=this.expandArray(i,9*t));for(var u=0;u<t;u+=4){var h=li((s-r[4*u+2])/r[4*u+3],0,1),l=8*u,c=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),f=a[8*u+3],d=c;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(C(this.rotationOverLifetime.x,Qo)?d.x+=this.rotationOverLifetime.x.getValue(h,f):d.x+=this.rotationOverLifetime.x.getValue(h)),this.rotationOverLifetime.y&&(C(this.rotationOverLifetime.y,Qo)?d.y+=this.rotationOverLifetime.y.getValue(h,f):d.y+=this.rotationOverLifetime.y.getValue(h)),this.rotationOverLifetime.z&&(C(this.rotationOverLifetime.z,Qo)?d.z+=this.rotationOverLifetime.z.getValue(h,f):d.z+=this.rotationOverLifetime.z.getValue(h))):o.setZero(),0===d.dot(d)&&o.identity();var p=Math.PI/180,m=d.x*p,v=d.y*p,y=d.z*p,g=Math.sin(m),x=Math.sin(v),b=Math.sin(y),T=Math.cos(m),E=Math.cos(v),_=Math.cos(y);o.set(_,-b,0,b,_,0,0,0,1),o.multiply(this.tempMatrix3.set(E,0,x,0,1,0,-x,0,E)),o.multiply(this.tempMatrix3.set(1,0,0,0,T,-g,0,g,T));var w=9*u,A=o.elements;i.set(A,w),u+4<=t&&(i.set(A,w+9),i.set(A,w+18),i.set(A,w+27))}this.geometry.setAttributeData("aRotation0",i)},e.applyLinearMove=function(t,e){var i=this.geometry.getAttributeData("aLinearMove"),r=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),a=this.time;i.length<3*t&&(i=this.expandArray(i,3*t));var s=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var o=0;o<t;o+=4){var u=a-r[4*o+2],h=r[4*o+3],l=u/h,c=n[8*o+3];s.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(C(this.linearVelOverLifetime.x,Qo)?s.x=this.linearVelOverLifetime.x.getValue(l,c):s.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(C(this.linearVelOverLifetime.y,Qo)?s.y=this.linearVelOverLifetime.y.getValue(l,c):s.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(C(this.linearVelOverLifetime.z,Qo)?s.z=this.linearVelOverLifetime.z.getValue(l,c):s.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(C(this.linearVelOverLifetime.x,Qo)?s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,c):s.x=this.linearVelOverLifetime.x.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.y&&(C(this.linearVelOverLifetime.y,Qo)?s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,c):s.y=this.linearVelOverLifetime.y.getIntegrateValue(0,u,h)),this.linearVelOverLifetime.z&&(C(this.linearVelOverLifetime.z,Qo)?s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,c):s.z=this.linearVelOverLifetime.z.getIntegrateValue(0,u,h)));var f=3*o;i[f]=s.x,i[f+1]=s.y,i[f+2]=s.z,i[f+3]=s.x,i[f+4]=s.y,i[f+5]=s.z,i[f+6]=s.x,i[f+7]=s.y,i[f+8]=s.z,i[f+9]=s.x,i[f+10]=s.y,i[f+11]=s.z}this.geometry.setAttributeData("aLinearMove",i)},e.expandArray=function(t,e){var i=new Float32Array(e);return i.set(t),i},t}(),uh=[10,32,64,160];function hh(t){for(var e=0;e<uh.length;e++){var i=uh[e];if(i>t)return i}return t||uh[0]}function lh(t,e,i){var r;void 0===i&&(i="");var n,a=t.content,s=+((null==(r=a.renderer)?void 0:r.renderMode)||0),o=[["RENDER_MODE",s],["ENV_EDITOR",i===Xs]],u=e.level,h=e.detail,l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=h.maxVertexUniforms>0,d=(null!=(n=a.positionOverLifetime)?n:{}).speedOverLifetime,p=0,m=0;f&&o.push(["ENABLE_VERTEX_TEXTURE",!0]),d&&(o.push(["SPEED_OVER_LIFETIME",!0]),m|=2,uu(l,d));var v=a.textureSheetAnimation;v&&v.animate&&(o.push(["USE_SPRITE",!0]),m|=4);var y=a.colorOverLifetime;y&&y.color&&(o.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&uu(l,g);var x,b=a.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var i=0,r="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[r])&&(uu(l,b[r]),i=1,m|=1<<7+e),o.push(["LINEAR_VEL_"+t.toUpperCase(),i]);var a=0;(null==b?void 0:b[n])&&(uu(l,b[n]),a=1,m|=1<<10+e,x=!0),o.push(["ORB_VEL_"+t.toUpperCase(),a])})),(null==b?void 0:b.asMovement)&&(o.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),x&&(null==b?void 0:b.asRotation)&&(o.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64),a.sizeOverLifetime){var T=a.sizeOverLifetime;T.separateAxes?(uu(l,T.x),o.push(["SIZE_Y_BY_LIFE",1]),m|=16384,uu(l,T.y)):uu(l,T.size)}if(a.rotationOverLifetime){var E=a.rotationOverLifetime;E.z&&(uu(l,null==E?void 0:E.z),m|=32768,o.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(uu(l,E.x),m|=65536,o.push(["ROT_X_LIFETIME",1])),E.y&&(uu(l,E.y),m|=1<<17,o.push(["ROT_Y_LIFETIME",1]))),(null==E?void 0:E.asRotation)&&(o.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=1<<18)}uu(l,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(o.push(["FINAL_TARGET",!0]),m|=1<<19,uu(l,b.forceCurve));var _=h.halfFloatTexture;_&&c.max&&(m|=1<<20);var w=h.maxVertexUniforms,C=l.max+l.curves.length-32>w;qu(Hu)&&(C=!0),2===u&&(l.max=-1,c.index>0&&(c.max=-1)),C&&_&&f&&(p=1);var A=["-p:",s,m,l.index,l.max,c.index,c.max].join("+"),S={fragment:va,vertex:"#define LOOKUP_TEXTURE_CURVE "+p+"\n"+ya,shared:!0,cacheId:A,macros:o,name:"particle#"+t.name};return o.push(["VERT_CURVE_VALUE_COUNT",l.index],["FRAG_CURVE_VALUE_COUNT",c.index],["VERT_MAX_KEY_FRAME_COUNT",l.max],["FRAG_MAX_KEY_FRAME_COUNT",c.max]),{shader:S,vertex:l.index,fragment:c.index}}function ch(t,e,i){var r,n=null==(r=t.cacheId)?void 0:r.split("+");if(n[3]=e,n[5]=i,t.cacheId=n.join("+"),t.macros)for(var a=0;a<t.macros.length;a++){var s=t.macros[a];if("VERT_CURVE_VALUE_COUNT"===s[0])s[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===s[0]){s[1]=i;break}}}var fh=function(t){function e(e,i,r){var n;(n=t.call(this,e)||this).name="ParticleSystemRenderer",i&&(n.particleMesh=new oh(e,i)),r&&(n.trailMesh=new $u(e,r));var a=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(a.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=a,n}$t(e,t);var i=e.prototype;return i.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=w(this.meshes);!(t=e()).done;){t.value.onStart()}},i.onUpdate=function(t){var e,i=this.particleMesh.time,r=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new gr;this.particleMesh.mesh.material.setVector4("uParams",r.set(i,this.item.duration,0,0))},i.render=function(t){this.maskManager.drawStencilMask(t);for(var e,i=w(this.meshes);!(e=i()).done;){e.value.render(t)}},i.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},i.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},i.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},i.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},i.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},i.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach((function(i){t.push(e[i])})),this.trailMesh){var i=this.trailMesh.mesh.material.textures;Object.keys(i).forEach((function(e){t.push(i[e])}))}return t},i.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},i.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},i.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},i.hasTrail=function(){return void 0!==this.trailMesh},i.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},i.addTrailPoint=function(t,e,i){var r;null==(r=this.trailMesh)||r.addPoint(t,e,i)},i.setTrailStartPosition=function(t,e){var i;null==(i=this.trailMesh)||i.setPointStartPos(t,e)},i.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(yr),dh=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).destroyed=!1,r.getHitTestParams=function(t){var e=r.interaction;if(t||e)return{type:ro.custom,collect:function(t){return r.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===ne.removeParticle,ray:t})}}},r.maskManager=new Mn(e),i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.isFrozen=function(){return this.frozen},i.isEnded=function(){return this.ended},i.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),i=this.item.transform.rotation.clone(),r=this.props.emitterTransform&&this.props.emitterTransform.path;r&&(r[0]===ee.CONSTANT_VEC3?e.add(r[1]):t=Eu(r)),this.basicTransform={position:e,rotation:i,path:t};var n=e.clone();if(t&&n.add(t.getValue(0)),this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},i.updateEmitterTransform=function(t){var e=this.basicTransform,i=e.path,r=e.position.clone();if(i){var n=this.item.duration;r.add(i.getValue(t/n))}if(this.transform.setPosition(r.x,r.y,r.z),this.options.particleFollowParent){var a=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},i.addParticle=function(t,e){var i,r=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(r.length<e)i=n[1]=r.length;else{var a=r.first;r.removeNode(a),i=n[1]=a.content[1]}r.pushNode(n),this.renderer.setParticlePoint(i,t),this.clearPointTrail(i),this.transform.parentTransform&&this.renderer.setTrailStartPosition(i,this.transform.parentTransform.position.clone())},i.setVisible=function(t){this.renderer.setVisible(t)},i.getTextures=function(){return this.renderer.getTextures()},i.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},i.stop=function(){this.ended=!0,this.started=!1},i.reset=function(){this.renderer.reset(),this.time=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new ju((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1,this.ended=!1,this.destroyed=!1},i.onStart=function(){this.startEmit(),this.initEmitterTransform()},i.onUpdate=function(t){this.update(t)},i.update=function(t){var e=this;if(this.started&&!this.frozen){var i=this.time+t/1e3,r=this.options,n=this.loopStartTime,a=this.emission;this.time=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var s=this.particleLink,o=(i-n)/this.item.duration,u=this.timePassed,h=!1,l=function(){e.trails&&!h&&(h=!0,s.forEach((function(t){var i=t[0],r=t[1],n=t[2],a=t[3];i<u?e.clearPointTrail(r):u>n&&e.updatePointTrail(r,o,a,n)})))};if(this.ended){if(this.item.endBehavior!==re.restart&&re.destroy===this.item.endBehavior){var c=s.last;c&&c.content[0]<this.time&&(this.destroyed=!0)}}else{var f=this.item.duration,d=this.lifetime;if(u<f){var p=1/a.rateOverTime.getValue(d),m=Math.floor((u-this.lastEmitTime)/p),v=m,y=p/m,g=i,x=r.maxCount;this.updateEmitterTransform(u);for(var b=function(){var t=s.first;return e.emissionStopped||s.length===x&&t&&t.content[0]-n>u},T=0;T<v&&T<x&&!b();T++){var E=this.createPoint(d);E.delay+=g+T*y,this.addParticle(E,x),this.lastEmitTime=u}for(var _=a.bursts,w=(null==_?void 0:_.length)-1,C=0;w>=0&&C<x&&!b();w--){var A=_[w],S=!A.disabled&&A.getGeneratorOptions(u,d);if(S){var I=a.burstOffsets[w],R=I&&I[S.cycleIndex]||[0,0,0];A.once&&this.removeBurst(w);for(var O=0;O<S.count&&C<x;O++){var M;if(b())break;var N=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:O,burstCount:S.count}));N.delay+=g,C++,(M=N.transform).translate.apply(M,[].concat(R)),this.addParticle(N,x)}}}}else if(this.item.endBehavior===re.restart)l(),this.loopStartTime=i-f,this.lastEmitTime-=f,this.time-=f,a.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=f,t[2]-=f,t[3].delay-=f})),this.renderer.minusTimeForLoop(f);else{this.ended=!0,this.item.endBehavior===re.freeze&&(this.frozen=!0)}}l()}},i.drawStencilMask=function(t){if(this.isActiveAndEnabled){for(var e=[],i=0;i<this.renderer.meshes.length;i++){var r=this.renderer.meshes[i].material;e.push(r.colorMask),r.colorMask=!1}for(var n,a=w(this.renderer.meshes);!(n=a()).done;){n.value.render(t)}for(var s=0;s<this.renderer.meshes.length;s++){this.renderer.meshes[s].material.colorMask=e[s]}}},i.onDestroy=function(){this.item&&this.item.composition&&this.meshes.forEach((function(t){return t.dispose({material:{textures:mt.keep}})}))},i.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,i=[],r=this.particleCount,n=0;if(!t||!e)return i;for(var a=t.last,s=!1;!s;){var o=a.content[0],u=a.content[3];if(o>this.timePassed){var h=this.getPointPosition(u);i.push({center:h,size:u.transform.scale}),a.pre?a=a.pre:s=!0}++n>r&&(s=!0)}return i},i.raycast=function(t){var e=this.particleLink,i=this.renderer;if(e&&i){var r=e.last,n=[],a=new vi,s=!1;if(r&&r.content)do{var o=r.content,u=o[0],h=o[1];o[2];var l=o[3];if(u>this.timePassed){var c=this.getPointPosition(l),f=t.ray,d=!1;f&&(d=!!f.intersectSphere({center:c,radius:t.radius},a)),d&&(t.removeParticle&&(i.removeParticlePoint(h),this.clearPointTrail(h),r.content=[0]),n.push(c),t.multiple||(s=!0))}}while((r=r.pre)&&!s);return n}},i.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},i.updatePointTrail=function(t,e,i,r){var n=this.renderer;if(n.hasTrail()){var a=this.trails,s=this.getPointPosition(i),o=a.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=i.transform.getWorldScale().toArray(),h=1,l=a.lifetime.getValue(e);if(a.sizeAffectsWidth&&(h*=u[0]),a.sizeAffectsLifetime&&(l*=u[0]),a.parentAffectsPosition&&this.transform.parentTransform){s.add(this.transform.parentTransform.position);var c=n.getTrailStartPosition(t);c&&s.subtract(c)}n.addTrailPoint(t,s,{color:o,lifetime:l,size:h,time:r})}},i.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},i.getPointPosition=function(t){var e=t.transform,i=t.vel,r=t.lifetime,n=t.delay,a=t.gravity,s=void 0===a?[]:a,o=this.options.forceTarget,u=this.time-n,h=new vi,l=vi.fromArray(s);e.assignWorldTRS(h);var c=To(new vi,this.options,l,u,r,h,i);if(o){var f=o.target||[0,0,0],d=o.curve.getValue(u/r),p=1-d;c.x=c.x*p+f[0]*d,c.y=c.y*p+f[1]*d,c.z=c.z*p+f[2]*d}return c},i.initPoint=function(t){var e=this.options,i=this.lifetime,r=this.shape,n=e.startSpeed.getValue(i),a=e.particleFollowParent?_r.IDENTITY:this.transform.getWorldMatrix(),s=t.position,o=a.transformPoint(s,new vi),u=new ku({position:o,valid:!0}),h=t.direction;if(h=a.transformNormal(h,ph).normalize(),e.startTurbulence&&e.turbulence){for(var l=0;l<3;l++)xh.setElement(l,e.turbulence[l].getValue(i));bh.setFromVector3(xh.negate()),Eh.setFromEuler(bh).transformNormal(h).normalize()}var c,f=yh,d=gh;r.alignSpeedDirection?(d.copyFrom(h),this.upDirectionWorld||(r.upDirection?this.upDirectionWorld=r.upDirection.clone():this.upDirectionWorld=vi.Z.clone(),a.transformNormal(this.upDirectionWorld)),f.crossVectors(d,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),d.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((c=Th)[0]=p.animationDelay.getValue(i),c[1]=p.animationDuration.getValue(i),c[2]=p.cycles.getValue(i));var m=vh;e.start3DRotation?m.set(e.startRotationX.getValue(i),e.startRotationY.getValue(i),e.startRotationZ.getValue(i)):e.startRotation?m.set(0,0,e.startRotation.getValue(i)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(i);3===v.length&&(v[3]=1);var y=mh;if(e.start3DSize)y.x=e.startSizeX.getValue(i),y.y=e.startSizeY.getValue(i);else{var g=e.startSize.getValue(i),x=e.sizeAspect.getValue(i);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new vi;this.transform.assignWorldTRS(void 0,void 0,T),y.x*=T.x,y.y*=T.y}return u.setScale(y.x,y.y,1),{size:y,vel:b,color:v,delay:e.startDelay.getValue(i),lifetime:e.startLifetime.getValue(i),uv:wh(this.uvs,!0),gravity:e.gravity,sprite:c,dirY:d,dirX:f,transform:u}},i.addBurst=function(t,e){var i=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),i=!0),i&&C(e,Array)){var r=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[r]=e,r}return-1},i.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},i.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},i.stopParticleEmission=function(){this.emissionStopped=!0},i.resumeParticleEmission=function(){this.emissionStopped=!1},i.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:ro.sphere,area:t}},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e;this.props=i,this.destroyed=!1;var r,n,a,s,o,u=i.options,h=i.positionOverLifetime,l=void 0===h?{}:h,c=i.shape,f=null==l?void 0:l.gravityOverLifetime,d=Eo(null==l?void 0:l.gravity),p=i.textureSheetAnimation,m=p?{animationDelay:Eu(p.animationDelay||0),animationDuration:Eu(p.animationDuration||1),cycles:Eu(p.cycles||1),animate:p.animate,col:p.col,row:p.row,total:p.total||p.col*p.row}:void 0,v=!!(c&&c.turbulenceX||(null==c?void 0:c.turbulenceY)||(null==c?void 0:c.turbulenceZ));v&&(r=[Eu(null!=(n=c.turbulenceX)?n:0),Eu(null!=(a=c.turbulenceY)?a:0),Eu(null!=(s=c.turbulenceZ)?s:0)]);this.name="ParticleSystem",this.shape=fs(c),this.emission={rateOverTime:Eu(i.emission.rateOverTime),burstOffsets:_h(null!=(o=i.emission.burstOffsets)?o:[]),bursts:(i.emission.bursts||[]).map((function(t){return new Bu(t)}))},this.textureSheetAnimation=m;var y,g,x=i.renderer||{},b=i.rotationOverLifetime;b&&((y={}).asRotation=!!b.asRotation,y.z=b.z?Eu(b.z):Eu(0),b.separateAxes&&(y.x=b.x&&Eu(b.x),y.y=b.y&&Eu(b.y))),(null==l?void 0:l.forceTarget)&&(g={target:l.target||[0,0,0],curve:Eu(l.forceCurve||[ee.LINE,[[0,0],[1,1]]])});var T={x:l.linearX&&Eu(l.linearX||0),y:l.linearY&&Eu(l.linearY||0),z:l.linearZ&&Eu(l.linearZ||0),asMovement:l.asMovement},E={x:l.orbitalX&&Eu(l.orbitalX),y:l.orbitalY&&Eu(l.orbitalY),z:l.orbitalZ&&Eu(l.orbitalZ),center:l.orbCenter,asRotation:l.asRotation},_=i.sizeOverLifetime||{},w=i.colorOverLifetime,A=(null==_?void 0:_.separateAxes)?{separateAxes:!0,x:Eu(_.x),y:Eu(_.y)}:{separateAxes:!1,x:Eu(("size"in _?_.size:_.x)||1)};x.anchor=x.anchor||[0,0];var S,I=mi.fromArray(x.anchor);this.options={particleFollowParent:!!u.particleFollowParent,startLifetime:Eu(u.startLifetime),startDelay:Eu(u.startDelay||0),startSpeed:Eu(l.startSpeed||0),startColor:Eu(u.startColor),looping:!1,maxCount:null!=(S=u.maxCount)?S:0,gravityModifier:Eu(f||0),gravity:d,start3DSize:!!u.start3DSize,startTurbulence:v,turbulence:r,speedOverLifetime:l.speedOverLifetime&&Eu(l.speedOverLifetime),linearVelOverLifetime:T,orbitalVelOverLifetime:E,forceTarget:g},u.startRotationZ&&(this.options.startRotation=Eu(u.startRotationZ||0)),(u.startRotationX||u.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=Eu(u.startRotationX||0),this.options.startRotationY=Eu(u.startRotationY||0),this.options.startRotationZ=Eu(u.startRotationZ||0)),u.start3DSize?(this.options.startSizeX=Eu(u.startSizeX),this.options.startSizeY=Eu(u.startSizeY)):(this.options.startSize=Eu(u.startSize),this.options.sizeAspect=Eu(u.sizeAspect||1)),i.mask&&this.maskManager.setMaskOptions(i.mask);var R={meshSlots:u.meshSlots,name:this.name,matrix:_r.IDENTITY,shaderCachePrefix:"",renderMode:x.renderMode||Yt.BILLBOARD,side:x.side||Ut.DOUBLE,gravity:d,blending:x.blending||zt.ALPHA,rotationOverLifetime:y,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:m,occlusion:!!x.occlusion,transparentOcclusion:!!x.transparentOcclusion,maxCount:u.maxCount,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode,forceTarget:g,diffuse:x.texture?this.engine.findObject(x.texture):void 0,sizeOverLifetime:A,anchor:I};if(w){var O=w.color,M=w.opacity;R.colorOverLifetime={},M&&(R.colorOverLifetime.opacity=Eu(w.opacity)),O&&(O[0]===ee.GRADIENT_COLOR?R.colorOverLifetime.color=w.color[1]:O[0]===ee.RGBA_COLOR?R.colorOverLifetime.color=fn.createWithData(this.engine,{data:new Uint8Array(O[1]),width:1,height:1}):C(O,fn)&&(R.colorOverLifetime.color=O))}var N,P=[],F=[0,0,1,1];if(i.splits){var L=i.splits[0];F=(N=L[4])?[L[0],L[1],L[3],L[2]]:[L[0],L[1],L[2],L[3]]}if(m&&!m.animate)for(var V=N?m.row:m.col,D=N?m.col:m.row,k=m.total||V*D,z=0,U=0;U<V;U++)for(var B=0;B<D&&z<k;B++,z++)P.push([U*F[2]/V+F[0],B*F[3]/D+F[1],F[2]/V,F[3]/D]);else P.push(F);this.uvs=P,R.textureFlip=N;var G,j=i.trails;j&&(this.trails={lifetime:Eu(j.lifetime),dieWithParticles:!1!==j.dieWithParticles,sizeAffectsWidth:!!j.sizeAffectsWidth,sizeAffectsLifetime:!!j.sizeAffectsLifetime,inheritParticleColor:!!j.inheritParticleColor,parentAffectsPosition:!!j.parentAffectsPosition},j.mask&&this.maskManager.setMaskOptions(j.mask),G={name:"Trail",matrix:_r.IDENTITY,minimumVertexDistance:j.minimumVertexDistance||.02,maxTrailCount:u.maxCount,pointCountPerTrail:Math.round(j.maxPointPerTrail)||32,blending:j.blending,texture:j.texture?this.engine.findObject(j.texture):void 0,opacityOverLifetime:Eu(j.opacityOverLifetime||1),widthOverTrail:Eu(j.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!j.occlusion,transparentOcclusion:!!j.transparentOcclusion,textureMap:j.textureMap,mask:this.maskManager.getRefValue(),maskMode:this.maskManager.maskMode},j.colorOverLifetime&&j.colorOverLifetime[0]===ee.GRADIENT_COLOR&&(G.colorOverLifetime=j.colorOverLifetime[1]),j.colorOverTrail&&j.colorOverTrail[0]===ee.GRADIENT_COLOR&&(G.colorOverTrail=j.colorOverTrail[1])),this.renderer=new fh(this.engine,R,G),this.renderer.item=this.item,this.renderer.maskManager=this.maskManager,this.meshes=this.renderer.meshes;var X,H=i.interaction;H&&(this.interaction={multiple:H.multiple,radius:null!=(X=H.radius)?X:.4,behavior:H.behavior});this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},dr(e,[{key:"timePassed",get:function(){return this.time-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{key:"maxParticles",get:function(){return this.options.maxCount},set:function(t){var e;this.options.maxCount=t,(null==(e=this.renderer)?void 0:e.particleMesh)&&(this.renderer.particleMesh.maxCount=t)}}]),e}(pr);dh=S([ke(Ae.ParticleSystem)],dh);var ph=new vi,mh=new mi,vh=new Zn,yh=new vi,gh=new vi,xh=new vi,bh=new Zn,Th=[0,0,0],Eh=new _r;function _h(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var i=C(t,Array),r=i?t[0]:t.index,n=e[r];n||(n=e[r]=[]),i?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function wh(t,e){var i=Math.floor(Math.random()*t.length),r=t[i];return e||t.splice(i,1),r}var Ch,Ah=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}$t(e,t);var i=e.prototype;return i.processFrame=function(t){for(var e,i=w(this.clipPlayables);!(e=i()).done;){e.value.processFrame(t)}this.evaluate(t)},i.setClipWeight=function(t,e){if(C(t,Nu)){for(var i=0;i<this.clipPlayables.length;i++)if(this.clipPlayables[i]===t)return void(this.clipWeights[i]=e)}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},i.getClipWeight=function(t){return this.clipWeights[t]},i.getClipPlayable=function(t){return this.clipPlayables[t]},i.evaluate=function(t){},e}(Nu),Sh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(C(e,gl)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?(i.transform.setValid(!0),i.setActive(!0)):(i.transform.setValid(!1),i.setActive(!1))}},e}(Ah),Ih=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.processFrame=function(t){this.value=this.curve.getValue(this.time/this.getDuration())},e}(Nu),Rh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyName="",e}return $t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(e){var i=!1;if(this.propertyValue=e[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var r=0;r<this.clipPlayables.length;r++){var n=this.getClipWeight(r);if(n>0){var a=this.getClipPlayable(r);if(!C(a,Ih)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var s=a.value;this.addWeightedValue(s,n),i=!0}}i&&(e[this.propertyName]=this.propertyValue)}}},e}(Ah),Oh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.setZero()},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.r+=t.r*e,i.g+=t.g*e,i.b+=t.b*e,i.a+=t.a*e},e}(Rh),Mh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue=0},i.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(Rh),Nh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){},e}(Ah),Ph=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){},e}(Ah),Fh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();C(e,ll)&&(e.time=this.getTime())},e}(Nu),Lh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(C(e,ll)){for(var i=e,r=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){r=!0;break}r?i.item.setActive(!0):i.item.setActive(!1)}},e}(Ah),Vh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.evaluate=function(t){},e}(Ah),Dh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e,i.z+=t.z*e,i.w+=t.w*e},e}(Rh),kh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},i.addWeightedValue=function(t,e){var i=this.propertyValue;i.x+=t.x*e,i.y+=t.y*e},e}(Rh),zh=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,i=this.duration;return e-i>0&&(this.endBehavior===re.restart?e%=i:this.endBehavior===re.freeze&&(e=Math.min(i,e))),e},t}(),Uh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}$t(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},i.createTrackMixer=function(t){return new Ah(t)},i.createOutput=function(){return new Pu},i.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},i.createMixerPlayableGraph=function(t,e){for(var i,r=[],n=w(this.clips);!(i=n()).done;){var a=i.value;r.push(a)}return this.compileClips(t,r,e)},i.compileClips=function(t,e,i){for(var r,n=this.createTrackMixer(t),a=w(e);!(r=a()).done;){var s=r.value,o=this.createClipPlayable(t,s);o.setDuration(s.duration);var u=new Bh(s,o,n,this);i.push(u),n.clipPlayables.push(o),n.setClipWeight(o,0)}return n},i.createPlayable=function(t){return new Nu(t)},i.getChildTracks=function(){return this.children},i.addChild=function(t){this.children.push(t),t.parent=this},i.createClip=function(t,e){var i=new zh;return i.asset=new t(this.engine),i.name=e||"TimelineClip"+i.id,this.addClip(i),i},i.getClips=function(){return this.clips},i.findClip=function(t){for(var e,i=w(this.clips);!(e=i()).done;){var r=e.value;if(r.name===t)return r}},i.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},i.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},i.fromData=function(e){t.prototype.fromData.call(this,e);for(var i,r=w(this.children);!(i=r()).done;){i.value.parent=this}},e}(Fu);S([ze(zh)],Uh.prototype,"clips",void 0),S([ze()],Uh.prototype,"children",void 0),Uh=S([ke(Ae.TrackAsset)],Uh),function(t){t[t.MasterTrack=0]="MasterTrack",t[t.ObjectTrack=1]="ObjectTrack"}(Ch||(Ch={}));var Bh=function(){function t(t,e,i,r){this.clip=t,this.playable=e,this.parentMixer=i,this.track=r,C(this.track.boundObject,gl)&&(this.particleSystem=this.track.boundObject.getComponent(dh))}return t.prototype.evaluateAt=function(t){var e=this.clip,i=1,r=!1,n=!1,a=this.track.boundObject;t>=e.start+e.duration&&e.endBehavior===re.destroy?C(a,gl)&&gl.isParticle(a)&&this.particleSystem&&!this.particleSystem.destroyed?i=1:(i=0,r=!0):t-this.clip.start>=0?(i=1,n=!0):t<e.start&&(i=0),n&&this.playable.getPlayState()!==Iu.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,i);var s=e.toLocalTime(t);this.playable.setTime(s),r&&this.playable.getPlayState()===Iu.Playing&&this.playable.pause()},dr(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}(),Gh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Sh(t)},e}(Uh);Gh=S([ke(Ae.ActivationTrack)],Gh);var jh=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}$t(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=this.path.split(".");this.propertyNames=i},e}(Uh);S([ze()],jh.prototype,"path",void 0);var Xh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.createTrackMixer=function(t){var e=new Mh(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},i.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,i=0;i<t.length-1;i++){var r=e[t[i]];void 0===r&&console.error("The "+t[i]+" property of "+e+" was not found"),e=r}this.boundObject=e},e}(jh);Xh=S([ke(Ae.FloatPropertyTrack)],Xh);var Hh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Ph(t)},e}(Uh);Hh=S([ke(Ae.SpriteColorTrack)],Hh);var Wh=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){if(!this.parent||!C(this.parent.boundObject,gl))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(ll)},i.createTrackMixer=function(t){return new Lh(t)},e}(Uh);Wh=S([ke(Ae.SubCompositionTrack)],Wh);var Yh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Vh(t)},e}(Uh);Yh=S([ke(Ae.TransformTrack)],Yh);var Zh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.updateAnimatedObject=function(){C(this.parent.boundObject,yr)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(Uh);S([ze()],Zh.prototype,"index",void 0),Zh=S([ke("MaterialTrack")],Zh);var qh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Nh(t)},e}(Uh),Kh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){var e=new Dh(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(jh);Kh=S([ke(Ae.Vector4PropertyTrack)],Kh);var Qh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){var e=new kh(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(jh);Qh=S([ke("Vector2PropertyTrack")],Qh);var Jh=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){var e=new Oh(t),i=this.propertyNames;if(i.length>0){var r=i[i.length-1];e.propertyName=r}return e},e}(jh);Jh=S([ke(Ae.ColorPropertyTrack)],Jh);var $h=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){var e=new Ih(t);return e.curve=Eu(this.curveData),e.value=e.curve.getValue(0),e},e}(Fu);S([ze()],$h.prototype,"curveData",void 0),$h=S([ke(Ae.ColorPropertyPlayableAsset)],$h);var tl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){var e=new Ih(t);return e.curve=Eu(this.curveData),e.value=e.curve.getValue(0),e},e}(Fu);S([ze()],tl.prototype,"curveData",void 0),tl=S([ke(Ae.FloatPropertyPlayableAsset)],tl);var el=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){return new Fh(t)},e}(Fu);el=S([ke(Ae.SubCompositionPlayableAsset)],el);var il=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.updateAnimatedObject=function(){},i.create=function(t){if(C(this.boundObject,gl)){for(var e,i=this.boundObject,r=!1,n=w(this.getChildTracks());!(e=n()).done;){if(C(e.value,Gh)){r=!0;break}}if(r){if(i.getComponent(dh)){var a=t.createTrack(qh,this,"ParticleTrack");a.boundObject=this.boundObject;var s=a.createClip(ah);s.start=i.start,s.duration=i.duration,s.endBehavior=i.endBehavior}if(i.getComponent(Al)){var o=t.createTrack(_l,this,"ComponentTimeTrack");o.boundObject=this.boundObject.getComponent(Al);var u=o.createClip(wl);u.start=i.start,u.duration=i.duration,u.endBehavior=i.endBehavior}if(i.getComponent(br)){var h=t.createTrack(_l,this,"ComponentTimeTrack");h.boundObject=this.boundObject.getComponent(br);var l=h.createClip(wl);l.start=i.start,l.duration=i.duration,l.endBehavior=i.endBehavior}}}},e}(Uh);il=S([ke(Ae.ObjectBindingTrack)],il);var rl=function(){function t(t,e,i){this.children=[],this.trackAsset=t,this.mixer=e,this.output=i}return t.prototype.addChild=function(t){this.children.push(t)},t}(),nl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}$t(e,t);var i=e.prototype;return i.createPlayable=function(t){for(var e,i=new al(t),r=w(this.tracks);!(e=r()).done;){var n=e.value;C(n,il)&&n.create(this)}return this.sortTracks(this.tracks),i.compileTracks(t,this.flattenedTracks),i},i.createTrack=function(t,e,i){var r=new t(this.engine);return r.name=i||t.name,e.addChild(r),this.invalidate(),r},i.invalidate=function(){this.cacheFlattenedTracks=null},i.addSubTracksRecursive=function(t,e){for(var i,r=w(t.getChildTracks());!(i=r()).done;){var n=i.value;e.push(n)}for(var a,s=w(t.getChildTracks());!(a=s()).done;){var o=a.value;this.addSubTracksRecursive(o,e)}},i.sortTracks=function(t){for(var e=[],i=0;i<t.length;i++)e.push(new sl(t[i],i));e.sort(ol),t.length=0;for(var r,n=w(e);!(r=n()).done;){var a=r.value;t.push(a.track)}},i.fromData=function(t){},dr(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=w(this.tracks);!(t=e()).done;){var i=t.value;this.cacheFlattenedTracks.push(i),this.addSubTracksRecursive(i,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(Fu);S([ze()],nl.prototype,"tracks",void 0),nl=S([ke(Ae.TimelineAsset)],nl);var al=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clips=[],e.masterTrackInstances=[],e}$t(e,t);var i=e.prototype;return i.prepareFrame=function(t){},i.evaluate=function(){for(var t,e=this.getTime(),i=w(this.clips);!(t=i()).done;){t.value.evaluateAt(e)}},i.compileTracks=function(t,e){for(var i,r=e,n={},a=w(r);!(i=a()).done;){var s=i.value,o=s.createPlayableGraph(t,this.clips),u=s.createOutput();u.setUserData(s.boundObject),t.addOutput(u),u.setSourcePlayable(o);var h=new rl(s,o,u);n[s.getInstanceId()]=h,s.parent||this.masterTrackInstances.push(h)}for(var l,c=w(r);!(l=c()).done;)for(var f,d=l.value,p=n[d.getInstanceId()],m=w(d.getChildTracks());!(f=m()).done;){var v=n[f.value.getInstanceId()];p.addChild(v)}},e}(Nu),sl=function(t,e){this.track=t,this.originalIndex=e};function ol(t,e){var i=t.track.boundObject,r=e.track.boundObject;return C(i,gl)&&C(r,gl)?gl.isAncestor(i,r)?-1:gl.isAncestor(r,i)?1:t.originalIndex-e.originalIndex:t.originalIndex-e.originalIndex}var ul=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){var e=new Ih(t);return e.curve=Eu(this.curveData),e.value=e.curve.getValue(0),e},e}(Fu);S([ze()],ul.prototype,"curveData",void 0),ul=S([ke(Ae.Vector4PropertyPlayableAsset)],ul);var hl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){var e=new Ih(t);return e.curve=Eu(this.curveData),e.value=e.curve.getValue(0),e},e}(Fu);S([ze()],hl.prototype,"curveData",void 0),hl=S([ke(Ae.Vector2PropertyPlayableAsset)],hl);var ll=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).time=0,e.items=[],e.state=Iu.Playing,e.reusable=!1,e.sceneBindings=[],e.graph=new Mu,e}$t(e,t);var i=e.prototype;return i.onStart=function(){var t;this.timelineAsset||(this.timelineAsset=new nl(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==re.destroy&&this.setReusable(!0),null==(t=this.item.composition)||t.refContent.push(this.item)},i.setReusable=function(t){for(var i,r=w(this.timelineAsset.tracks);!(i=r()).done;){var n=i.value.boundObject;if(C(n,gl)){var a=n.getComponent(e);a&&a.setReusable(t)}}},i.getReusable=function(){return this.reusable},i.pause=function(){this.state=Iu.Paused},i.resume=function(){this.state=Iu.Playing},i.onUpdate=function(t){if(this.state!==Iu.Paused){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.timelinePlayable.evaluate(),this.graph.evaluate(t)}},i.onEnable=function(){for(var t,e=w(this.items);!(t=e()).done;){t.value.setActive(!0)}},i.onDisable=function(){for(var t,e=w(this.items);!(t=e()).done;){t.value.setActive(!1)}},i.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},i.hitTest=function(t,e,i,r,n,a){for(var s,o=function(a){var o=s.items[a];if(o.isActive&&o.transform.getValid()&&!gl.isComposition(o)&&!l(o)){var c=o.getHitTestParams(n);if(c){var f=!1,d=new vi;if(c.type===ro.triangle)for(var p=c.triangles,m=c.backfaceCulling,v=0;v<p.length;v++){var y=p[v];if(t.intersectTriangle(y,d,m)){f=!0,u.push(d);break}}else if(c.type===ro.box){var g=c.center,x=c.size,b=g.clone().addScaledVector(x,.5),T=g.clone().addScaledVector(x,-.5);t.intersectBox({min:b,max:T},d)&&(f=!0,u.push(d))}else if(c.type===ro.sphere){var E=c.center,_=c.radius;t.intersectSphere({center:E,radius:_},d)&&(f=!0,u.push(d))}else if(c.type===ro.custom){var w=c.collect(t,new mi(e,i));w&&w.length>0&&(w.forEach((function(t){u.push(t)})),f=!0)}if(f){var C={compContent:s.item,id:o.id,name:o.name,position:u[u.length-1],parentId:o.parentId,hitPositions:u,behavior:c.behavior};if(o.emit("click",C),r.push(C),h(C))return{v:r}}}}},u=[],h=(null==a?void 0:a.stop)||yt,l=(null==a?void 0:a.skip)||yt,c=(null==a?void 0:a.maxCount)||this.items.length,f=0;f<this.items.length&&r.length<c;f++){var d=(s=this,o(f));if("object"===A(d))return d.v}return r},i.setChildrenRenderOrder=function(t){for(var i,r=w(this.items);!(i=r()).done;){var n=i.value;n.renderOrder=t++;var a=n.getComponent(e);a&&(t=a.setChildrenRenderOrder(t))}return t},i.fromData=function(e){t.prototype.fromData.call(this,e)},i.resolveBindings=function(){for(var t,e=w(this.sceneBindings);!(t=e()).done;){var i=t.value;i.key.boundObject=i.value}for(var r,n=w(this.timelineAsset.tracks);!(r=n()).done;){var a=r.value;this.updateTrackAnimatedObject(a)}},i.updateTrackAnimatedObject=function(t){for(var e,i=w(t.getChildTracks());!(e=i()).done;){var r=e.value;r.updateAnimatedObject(),this.updateTrackAnimatedObject(r)}},e}(pr);S([ze()],ll.prototype,"items",void 0),S([ze()],ll.prototype,"sceneBindings",void 0),S([ze()],ll.prototype,"timelineAsset",void 0),ll=S([ke("CompositionComponent")],ll);var cl,fl=function(){var t=this,e=this;this.listeners={},this.off=function(e,i){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter((function(t){return t.listener!==i})))},this.on=function(e,i,r){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:i,options:r}),function(){return t.off(e,i)}},this.once=function(e,i){t.on(e,i,{once:!0})},this.emit=function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),n=1;n<i;n++)r[n-1]=arguments[n];var a;null==(a=e.listeners[t])||a.forEach((function(i){var n=i.listener,a=i.options;n.apply(void 0,[].concat(r)),(null==a?void 0:a.once)&&e.off(t,n)}))},this.getListeners=function(e){var i;return(null==(i=t.listeners[e])?void 0:i.map((function(t){return t.listener})))||[]}},dl=function(){function t(){this.update=new ml,this.lateUpdate=new vl}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==pr.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==pr.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==pr.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==pr.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),pl=function(){function t(){this.components=[],this.ticks=[]}var e=t.prototype;return e.tick=function(t){this.tickComponents(this.components,t);for(var e=0;e<this.ticks.length;e++)this.ticks[e](t)},e.tickComponents=function(t,e){},e.addComponent=function(t){this.components.includes(t)||this.components.push(t)},e.removeComponent=function(t){var e=this.components.indexOf(t);e>-1&&this.components.splice(e,1)},e.addTick=function(t,e){var i=t.bind(e);this.ticks.includes(i)||this.ticks.push(i)},e.clear=function(){this.components=[]},t}(),ml=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=w(t);!(i=r()).done;){i.value.onUpdate(e)}},e}(pl),vl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.tickComponents=function(t,e){for(var i,r=w(t);!(i=r()).done;){i.value.onLateUpdate(e)}},e}(pl),yl=function(t){function e(i,r){var n,a;(n=t.call(this)||this).sceneTicking=new dl,n.speed=1,n.isEnded=!1,n.loaderData={},n.refContent=[],n.startTime=0,n.postProcessingEnabled=!1,n.destroyed=!1,n.postLoaders=[],n.paused=!1,n.isEndCalled=!1,n._textures=[],n.videos=[];var s,o=i.reusable,u=void 0!==o&&o,h=i.speed,l=void 0===h?1:h,c=i.baseRenderOrder,f=void 0===c?0:c,d=i.renderer,m=i.event,v=i.width,y=i.height,g=i.handleItemMessage;n.renderer=d,n._textures=r.textures;for(var x,b=w(Object.keys(r.assets));!(x=b()).done;){var T=x.value,E=r.assets[T];C(E,p)&&n.videos.push(E)}n.postProcessingEnabled=null!=(s=null==(a=r.jsonScene.renderSettings)?void 0:a.postProcessingEnabled)&&s,n.getEngine().renderLevel=r.renderLevel,u&&(n.keepResource=!0,r.consumed=!0);for(var _,A=r.jsonScene.compositions[0],S=w(r.jsonScene.compositions);!(_=S()).done;){var I=_.value;I.id===r.jsonScene.compositionId&&(A=I)}ut(A),n.rootItem=new gl(n.getEngine()),n.rootItem.name="rootItem",n.rootItem.duration=A.duration,n.rootItem.endBehavior=A.endBehavior,n.rootItem.composition=Lu(n);for(var R,O,M,N,P=w(A.components);!(R=P()).done;){var F=R.value,L=n.getEngine().findObject(F);n.rootItem.components.push(L),L.item=n.rootItem}return n.rootComposition=n.rootItem.getComponent(ll),n.width=v,n.height=y,n.renderOrder=f,n.id=A.id,n.startTime=null!=(O=A.startTime)?O:0,n.renderer=d,n.event=m,n.statistic={loadStart:null!=(M=r.startTime)?M:0,loadTime:null!=(N=r.totalTime)?N:0,compileTime:0,firstFrameTime:0},n.reusable=u,n.speed=l,n.name=A.name,n.pluginSystem=r.pluginSystem,n.pluginSystem.initializeComposition(Lu(n),r),n.camera=new Uu(n.name,ri({},null==A?void 0:A.camera,{aspect:v/y})),n.url=r.url,n.interactive=!0,n.handleItemMessage=g,n.createRenderFrame(),n.rendererOptions=null,e.buildItemTree(n.rootItem),n.rootComposition.setChildrenRenderOrder(0),n.pluginSystem.resetComposition(Lu(n),n.renderFrame),n}$t(e,t);var i=e.prototype;return i.getDuration=function(){return this.rootItem.duration},i.restart=function(){this.reset(),this.forwardTime(this.startTime)},i.setIndex=function(t){this.renderOrder=t},i.getIndex=function(){return this.renderOrder},i.setSpeed=function(t){this.speed=t},i.setVisible=function(t){this.rootItem.setVisible(t)},i.getSpeed=function(){return this.speed},i.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},i.pause=function(){this.paused=!0,this.emit("pause")},i.getPaused=function(){return this.paused},i.resume=function(){this.paused=!1},i.gotoAndPlay=function(t){this.setTime(t),this.resume(),this.emit("play",{time:t})},i.gotoAndStop=function(t){this.setTime(t),this.pause()},i.createRenderFrame=function(){this.renderFrame=new Va({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},i.setTime=function(t){var e=this.speed,i=this.getPaused();i&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),i&&(this.paused=!0),this.emit("goto",{time:t})},i.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},i.getComponent=function(t){return this.rootItem.getComponent(t)},i.forwardTime=function(t){for(var e=1e3*t-1e3*this.time,i=e<0,r=Math.abs(e),n=i?-15:15;r>15;r-=15)this.update(n);this.update(i?-r:r)},i.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},i.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(i){i.prepareRenderFrame(t,e)&&t.postLoaders.push(i)})),this.postLoaders.forEach((function(i){return i.postProcessFrame(t,e)}))},i.update=function(t){if(!this.getPaused()){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=this.time;this.updateCompositionTime(t*this.speed/1e3);var i=1e3*(this.time-e);this.updatePluginLoaders(i),this.sceneTicking.update.tick(i),this.sceneTicking.lateUpdate.tick(i),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},i.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===re.destroy&&!this.reusable},i.callAwake=function(t){for(var e,i=w(t.components);!(e=i()).done;){var r=e.value;r.isAwakeCalled||(r.onAwake(),r.isAwakeCalled=!0)}for(var n,a=w(t.children);!(n=a()).done;){var s=n.value;this.callAwake(s)}},i.updateCamera=function(){this.camera.updateMatrix()},i.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(i){return i.onCompositionUpdate(e,t)}))},i.updateCompositionTime=function(t){if(this.rootComposition.state!==Iu.Paused&&this.rootComposition.isActiveAndEnabled){var e=this.time+t-this.startTime;t<0&&e<0&&(e=0);var i=this.rootItem.duration,r=this.rootItem.endBehavior,n=!1;if(e-i>.001)switch(n=!0,r){case re.restart:e%=i,this.restart();break;case re.freeze:e=Math.min(i,e);case re.forward:case re.destroy:}this.rootComposition.time=e+this.startTime,this.isEnded!==n&&(n?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},i.getItemByName=function(t){return this.rootItem.find(t)},i.getHitTestRay=function(t,e){var i=this.renderFrame.editorTransform,r=i.x,n=i.y;return So((t-i.z)/r,(e-i.w)/n,this.camera)},i.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},i.hitTest=function(t,e,i,r){if(this.isDestroyed||!this.interactive)return[];var n=[],a=this.getHitTestRay(t,e);return this.refContent.forEach((function(s){var o;null==(o=s.getComponent(ll))||o.hitTest(a,t,e,n,i,r)})),n},i.addInteractiveItem=function(t,e){if(e===Xt.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},i.removeInteractiveItem=function(t,e){e===Xt.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},i.destroyItem=function(t){var e=this;t.type==Wt.composition?t.endBehavior!==re.freeze&&t.getComponent(ll).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(i){return i.onCompositionItemRemoved(e,t)}))})):(D(this.items,t),this.pluginSystem.plugins.forEach((function(i){return i.onCompositionItemRemoved(e,t)})))},i.lost=function(t){this.videoState=this.textures.map((function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime})),this.textures.map((function(t){return t.dispose()})),this.dispose()},i.dispose=function(){var t,e,i=this;if(!this.destroyed){this.destroyed=!0;var r={},n=this.textures;n&&this.keepResource&&n.forEach((function(t){(null==t?void 0:t.dispose)&&(r[t.id]=t.dispose,t.dispose=yt)}));for(var a,s=w(this.videos);!(a=s()).done;){var o=a.value;o.pause(),o.removeAttribute("src"),o.load()}this.videos=[],this.rootItem.dispose(),this.renderFrame.dispose(),null==(t=this.rendererOptions)||t.emptyTexture.dispose(),null==(e=this.pluginSystem)||e.destroyComposition(this),this.update=function(){vt.error("Update disposed composition: "+i.name+".")},this.dispose=yt,n&&this.keepResource&&n.forEach((function(t){t.dispose=r[t.id],t.dispose()})),this.renderer.env!==Xs&&this.renderer.clear({stencilAction:Ir.clear,clearStencil:0,depthAction:Ir.clear,clearDepth:1,colorAction:Ir.clear,clearColor:[0,0,0,0]})}},i.setEditorTransform=function(t,e,i){this.renderFrame.editorTransform.set(t,t,e,i)},i.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},i.translate=function(t,e,i){this.rootItem.translate(t,e,i)},i.setPosition=function(t,e,i){this.rootItem.setPosition(t,e,i)},i.rotate=function(t,e,i){this.rootItem.rotate(t,e,i)},i.setRotation=function(t,e,i){this.rootItem.setRotation(t,e,i)},i.scale=function(t,e,i){this.rootItem.scale(t,e,i)},i.setScale=function(t,e,i){this.rootItem.setScale(t,e,i)},i.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},i.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},i.reloadTexture=function(){var t=this;return E((function(){return I(this,(function(e){switch(e.label){case 0:return t.textureOffloaded?[4,Promise.all(t.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))()},e.buildItemTree=function(t){for(var e,i=new Map,r=t.getComponent(ll).items,n=w(r);!(e=n()).done;){var a=e.value;i.set(a.id,a)}for(var s,o=w(r);!(s=o()).done;){var u=s.value;if(void 0===u.parentId)u.setParent(t);else{var h=i.get(u.parentId);if(!h)throw new Error("The element references a non-existent element, please check the data.");u.setParent(h)}}},dr(e,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this._textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"time",get:function(){return this.rootComposition.time}},{key:"isDestroyed",get:function(){return this.destroyed}},{key:"viewportMatrix",get:function(){return this.camera.getViewportMatrix()},set:function(t){this.camera.setViewportMatrix(t)}}]),e}(fl),gl=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).children=[],r.transform=new ku,r.time=-1,r.duration=0,r.start=0,r.endBehavior=re.forward,r.type=Wt.base,r.components=[],r.isDuringPlay=!1,r.active=!0,r.visible=!0,r.speed=1,r.listIndex=0,r.isEnabled=!1,r.eventProcessor=new fl,r.name="VFXItem",r.transform.name=r.name,r.transform.engine=e,i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.on=function(t,e,i){this.eventProcessor.on(t,e,i)},i.off=function(t,e){this.eventProcessor.off(t,e)},i.once=function(t,e){this.eventProcessor.once(t,e)},i.emit=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],i))},i.getListeners=function(t){return this.eventProcessor.getListeners(t)},i.setSpeed=function(t){this.speed=t},i.getSpeed=function(){return this.speed},i.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},i.getComponent=function(t){for(var e,i,r=w(this.components);!(i=r()).done;){var n=i.value;if(C(n,t)){e=n;break}}return e},i.getComponents=function(t){for(var e,i=[],r=w(this.components);!(e=r()).done;){var n=e.value;C(n,t)&&i.push(n)}return i},i.setParent=function(t){(t!==this||t)&&(this.parent&&D(this.parent.children,this),this.parent=t,this.transform.parentTransform=t.transform,t.children.push(this),!this.composition&&t.composition&&(this.composition=t.composition),!this.isDuringPlay&&t.isDuringPlay&&this.beginPlay())},i.setColor=function(t,e,i,r){},i.setOpacity=function(t){},i.setActive=function(t){this.active!==!!t&&(this.active=!!t,this.onActiveChanged())},i.setVisible=function(t){for(var e,i=w(this.components);!(e=i()).done;){e.value.enabled=t}this.visible=t},i.getVisible=function(){return this.visible},i.getWorldTransform=function(t){var e=null!=t?t:new ku({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},i.translate=function(t,e,i){this.transform.translate(t,e,i)},i.rotate=function(t,e,i){var r=new Zn(t,e,i),n=yi.fromEuler(r);n.conjugate(),this.transform.rotateByQuat(n)},i.scale=function(t,e,i){this.transform.scaleBy(t,e,i)},i.setPositionByPixel=function(t,e){if(this.composition){var i=this.transform.getWorldPosition().z,r=this.composition.camera.getInverseVPRatio(i),n=r.x,a=r.y,s=this.composition.renderer.getWidth()/2,o=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/s-1)*n,(1-2*e/o)*a,i)}},i.setPosition=function(t,e,i){this.transform.setPosition(t,e,i)},i.setRotation=function(t,e,i){this.transform.setRotation(t,e,i)},i.setScale=function(t,e,i){this.transform.setScale(t,e,i)},i.getBoundingBox=function(){},i.getHitTestParams=function(t){},i.getCurrentPosition=function(){var t=new vi;return this.transform.assignWorldTRS(t),t},i.find=function(t){var e;if(this.name===t)return this;var i=[];(e=i).push.apply(e,[].concat(this.children));for(var r=0;r<i.length;){var n,a=i[r];if(r++,a.name===t)return a;(n=i).push.apply(n,[].concat(a.children))}},i.duplicate=function(){var t=new Map;this.gatherPreviousObjectID(t),this.resetGUID();var e=this.engine.findObject({id:this.defination.id});return e.resetGUID(),this.resetGUID(t),this.composition&&e.setParent(this.composition.rootItem),e},i.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=w(this.children);!(t=e()).done;){var i=t.value;i.isDuringPlay||i.beginPlay()}},i.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},i.onEnable=function(){this.isEnabled=!0;for(var t,e=w(this.components);!(t=e()).done;){var i=t.value;i.enabled&&!i.isStartCalled&&(i.onStart(),i.isStartCalled=!0)}for(var r,n=w(this.components);!(r=n()).done;){var a=r.value;a.enabled&&!a.isEnableCalled&&a.enable()}},i.onDisable=function(){this.isEnabled=!1;for(var t,e=w(this.components);!(t=e()).done;){var i=t.value;i.enabled&&i.isEnableCalled&&i.disable()}},i.fromData=function(i){t.prototype.fromData.call(this,i);var r=i.id,n=i.name,a=i.delay,s=i.parentId,o=i.endBehavior,u=i.transform,h=i.duration,l=void 0===h?0:h;if(this.props=i,this.type=i.type,this.id=r.toString(),this.name=n,this.start=a||this.start,u&&this.transform.fromData(u),this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=s,this.duration=l,this.endBehavior=o,i.content||(i.content={options:{}}),l<0)throw new Error("Item duration can't be less than 0, see "+Hs["Item duration can't be less than 0"]+".");if(i.components){this.components.length=0;for(var c,f=w(i.components);!(c=f()).done;){var d=c.value,p=this.engine.findObject(d);this.components.push(p),C(p,dh)&&(this.components.includes(p.renderer)||this.components.push(p.renderer))}}e.isComposition(this)&&this.instantiatePreComposition()},i.toData=function(){var t,e;(this.defination.id=this.guid,this.defination.transform=this.transform.toData(),this.defination.dataType=Ae.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.defination.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.defination.components){this.defination.components=[];for(var i,r=w(this.components);!(i=r()).done;){var n=i.value;C(n,br)&&this.defination.components.push(n)}}this.defination.content={}},i.translateByPixel=function(t,e){if(this.composition){var i=this.composition.renderer.canvas.getBoundingClientRect(),r=i.width,n=i.height,a=this.transform.getWorldPosition().z,s=this.composition.camera.getInverseVPRatio(a),o=s.x,u=s.y;this.transform.translate(2*t*o/r,-2*e*u/n,0)}},i.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=w(this.components.slice());!(t=e()).done;){t.value.dispose()}this.components=[],this._content=void 0,this._composition=null,this.transform.setValid(!1)}},i.resetChildrenParent=function(){for(var t,e=w(this.children);!(t=e()).done;){var i=t.value;this.parent&&i.setParent(this.parent)}var r;this.parent&&D(null==(r=this.parent)?void 0:r.children,this)},i.instantiatePreComposition=function(){var t=this.props.content.options.refId,e=this.engine.findEffectsObjectData(t);if(!e)throw new Error("Referenced precomposition with Id: "+t+" does not exist.");for(var i,r=w(e.components);!(i=r()).done;){var n=i.value,a=this.engine.findObject(n);if(a.item=this,this.components.push(a),a.setInstanceId(At()),C(a,ll))for(var s,o=w(a.items);!(s=o()).done;){var u=s.value;u.setInstanceId(At());for(var h,l=w(u.components);!(h=l()).done;){h.value.setInstanceId(At())}}}yl.buildItemTree(this)},i.resetGUID=function(t){var e,i=null!=(e=null==t?void 0:t.get(this))?e:At();this.setInstanceId(i);for(var r,n=w(this.components);!(r=n()).done;){var a,s=r.value,o=null!=(a=null==t?void 0:t.get(s))?a:At();s.setInstanceId(o)}for(var u,h=w(this.children);!(u=h()).done;){u.value.resetGUID(t)}},i.gatherPreviousObjectID=function(t){t.set(this,this.getInstanceId());for(var e,i=w(this.components);!(e=i()).done;){var r=e.value;t.set(r,r.getInstanceId())}for(var n,a=w(this.children);!(n=a()).done;){n.value.gatherPreviousObjectID(t)}},e.isComposition=function(t){return t.type===Wt.composition},e.isSprite=function(t){return t.type===Wt.sprite},e.isParticle=function(t){return t.type===Wt.particle},e.isNull=function(t){return t.type===Wt.null},e.isTree=function(t){return t.type===Wt.tree},e.isCamera=function(t){return t.type===Wt.camera},e.isAncestor=function(t,e){for(var i=e.parent;i;){if(i===t)return!0;i=i.parent}return!1},dr(e,[{key:"content",get:function(){return this._content}},{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,i=w(this.children);!(e=i()).done;){var r=e.value;r.composition||(r.composition=t)}}},{key:"compositionReusable",get:function(){var t,e;return null!=(e=null==(t=this.composition)?void 0:t.reusable)&&e}},{key:"renderOrder",get:function(){return this.listIndex},set:function(t){if(this.listIndex!==t){this.listIndex=t;for(var e,i=w(this.components);!(e=i()).done;){var r=e.value;C(r,yr)&&(r.priority=t)}}}},{key:"isActive",get:function(){return this.active},set:function(t){this.setActive(t)}},{key:"isVisible",get:function(){return this.visible}}]),e}(Be);gl=S([ke(Ae.VFXItemData)],gl),function(t){t.is=function(t,e){return t.type===e},t.isComposition=function(t){return t.type===Wt.composition},t.isParticle=function(t){return t.type===Wt.particle},t.isNull=function(t){return t.type===Wt.null}}(cl||(cl={}));var xl=[1,1,1,1],bl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}$t(e,t);var i=e.prototype;return i.processFrame=function(t){var e=t.output.getUserData();if(C(e,gl)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(e)),!this.activeMaterial){var i,r;this.activeMaterial=null==(i=this.activeComponent)?void 0:i.material;var n=null==(r=this.activeMaterial)?void 0:r.getColor("_Color");n&&(this.startColor=n.toArray())}var a,s,o,u=_o(xl,1),h=this.time/e.duration,l=this.opacityOverLifetime,c=this.colorOverLifetime;if(c&&(u=B(c,h,!0),a=!0),l&&(u[3]*=l.getValue(h),a=!0),a)wo(this.renderColor,u,this.startColor),null==(o=this.activeMaterial)||null==(s=o.getColor("_Color"))||s.setFromArray(this.renderColor)}},i.create=function(t){this.clipData=t;var e,i=t.colorOverLifetime;i&&(this.opacityOverLifetime=Eu(null!=(e=i.opacity)?e:1),i.color&&i.color[0]===ee.GRADIENT_COLOR&&(this.colorOverLifetime=G(i.color[1])));return this},i.getActiveComponent=function(t){return t.getComponent(Js)},e}(Nu),Tl=0,El=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new bl(t);return e.create(this.data),e},i.fromData=function(t){this.data=t},e}(Fu);El=S([ke(Ae.SpriteColorPlayableAsset)],El);var _l=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createTrackMixer=function(t){return new Ah(t)},e}(Uh),wl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){return new Cl(t)},e}(Fu),Cl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();"time"in e&&(e.time=this.time)},e}(Nu),Al=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).time=0,r.duration=0,r.frameAnimationLoop=!0,r.name="MSprite"+Tl++,i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.onUpdate=function(t){var e=this,i=this.time,r=this.duration;i>r&&this.frameAnimationLoop&&(i%=r);var n=Math.min(Math.max(i/r,0),1),a=this.textureSheetAnimation,s=this.renderer.texture.source.video;if(s&&(0===i?s.pause():s.play().catch((function(t){e.engine.renderErrors.add(t)})),this.renderer.texture.uploadCurrentVideoFrame()),a){var o,u,h,l,c,f=a.total||a.row*a.col,d=0,p=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],d=y[0],p=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/a.row*m,l=1/a.col*v):(h=1/a.col*m,l=1/a.row*v),a.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/a.col),b=g-x*a.col;c=u?[h*x,l*(a.col-b)]:[h*b,l*(1+x)]}else c=[0,l];null==(o=this.material.getVector4("_TexOffset"))||o.setFromArray([d+c[0],v+p-c[1],h,l])}this.time=i+t/1e3},i.onDisable=function(){t.prototype.onDisable.call(this),this.time=0},i.onDestroy=function(){var t=this.renderer.texture.source;t.sourceType===Rr.video&&(null==t?void 0:t.video)&&(t.video.pause(),t.video.src="",t.video.load())},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i;var n,a=r.startColor||[1,1,1,1];this.material.setColor("_Color",(new Er).setFromArray(a)),this.duration=null!=(n=e.duration)?n:this.item.duration},e}(Js);Al=S([ke(Ae.SpriteComponent)],Al);var Sl=8;function Il(t){return t.maxVertexUniforms>=256?Sl=32:t.maxVertexUniforms>=128?Sl=16:void 0}function Rl(t){Sl=t}var Ol=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt),Ml=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt),Nl=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,i){return this.findCurveValue(t,e)?this.curveValues[t+e].value=i:this.curveValues[t+e]={componentType:t,propertyName:e,value:i},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},t}(),Pl=function(t){function e(e){var i;return(i=t.call(this,e)||this).animationStream=new Nl(Lu(i)),i}return $t(e,t),e}(Nu),Fl=new Zn,Ll=new vi(1,1,1),Vl=new vi,Dl=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new vi(e.x,e.y,e.x)};var i,r=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,a=this.data.sizeOverLifetime;if(r&&0!==Object.keys(r).length){this.positionOverLifetime=r,r.path&&(this.originalTransform.path=Eu(r.path));var s=r.linearX||r.linearY||r.linearZ;s&&(this.linearVelOverLifetime={x:r.linearX&&Eu(r.linearX),y:r.linearY&&Eu(r.linearY),z:r.linearZ&&Eu(r.linearZ),asMovement:r.asMovement,enabled:!!s});var o=r.orbitalX||r.orbitalY||r.orbitalZ;o&&(this.orbitalVelOverLifetime={x:r.orbitalX&&Eu(r.orbitalX),y:r.orbitalY&&Eu(r.orbitalY),z:r.orbitalZ&&Eu(r.orbitalZ),center:Eo(r.orbCenter),asRotation:r.asRotation,enabled:!!o}),this.speedOverLifetime=r.speedOverLifetime&&Eu(r.speedOverLifetime)}if(a&&(a.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Eu(a.x||1),this.sizeYOverLifetime=Eu(a.y||1),this.sizeZOverLifetime=Eu(a.z||1)):this.sizeXOverLifetime=Eu(a.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:Eu(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=Eu(n.x||0),u.y=Eu(n.y||0)}this.gravity=vi.fromArray((null==r?void 0:r.gravity)||[]),this.gravityModifier=Eu(null!=(i=null==r?void 0:r.gravityOverLifetime)?i:0),this.direction=(null==r?void 0:r.direction)?vi.fromArray(r.direction).normalize():new vi,this.startSpeed=(null==r?void 0:r.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},i.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();C(e,gl)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},i.sampleAnimation=function(){var t=this,e=this.boundObject,i=e.duration,r=this.time/i;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){Ll.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(Ll.y=this.sizeYOverLifetime.getValue(r),Ll.z=this.sizeZOverLifetime.getValue(r)):Ll.z=Ll.y=Ll.x;var n=this.originalTransform.scale;e.transform.setScale(Ll.x*n.x,Ll.y*n.y,Ll.z*n.z)}if(this.rotationOverLifetime){var a=function(e){return t.rotationOverLifetime.asRotation?e.getValue(r):e.getIntegrateValue(0,r,i)},s=a(this.rotationOverLifetime.z),o=this.rotationOverLifetime.separateAxes;Fl.x=o?a(this.rotationOverLifetime.x):0,Fl.y=o?a(this.rotationOverLifetime.y):0,Fl.z=s;var u=Fl.addEulers(this.originalTransform.rotation,Fl);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Vl;To(h,this,this.gravity,this.time,i,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(r)),e.transform.setPosition(h.x,h.y,h.z)}},e}(Pl),kl=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.createPlayable=function(t){var e=new Dl(t);return e.data=this.transformAnimationData,e},i.fromData=function(t){this.transformAnimationData=t},e}(Fu);kl=S([ke(Ae.TransformPlayableAsset)],kl);var zl=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();C(e,gl)&&(e.time=this.time)},e}(Nu),Ul=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e.prototype.createPlayable=function(t){return new zl(t)},e}(Fu);Ul=S([ke(Ae.ActivationPlayableAsset)],Ul);var Bl=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.eulerCurves=[],e.scaleCurves=[],e.floatCurves=[],e.colorCurves=[],e}$t(e,t);var i=e.prototype;return i.sampleAnimation=function(t,e){for(var i,r=li(e,0,this.duration),n=w(this.positionCurves);!(i=n()).done;){var a=i.value,s=a.keyFrames.getValue(r),o=this.findTarget(t,a.path);null==o||o.transform.setPosition(s.x,s.y,s.z)}for(var u,h=w(this.rotationCurves);!(u=h()).done;){var l=u.value,c=l.keyFrames.getValue(r),f=this.findTarget(t,l.path);null==f||f.transform.setQuaternion(c.x,c.y,c.z,c.w)}for(var d,p=w(this.eulerCurves);!(d=p()).done;){var m=d.value,v=m.keyFrames.getValue(r),y=this.findTarget(t,m.path);null==y||y.transform.setRotation(v.x,v.y,v.z)}for(var g,x=w(this.scaleCurves);!(g=x()).done;){var b=g.value,T=b.keyFrames.getValue(r),E=this.findTarget(t,b.path);null==E||E.transform.setScale(T.x,T.y,T.z)}},i.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.rotationCurves.length=0,this.eulerCurves.length=0,this.floatCurves.length=0,this.colorCurves.length=0;var e=0;if(t.positionCurves)for(var i,r=w(t.positionCurves);!(i=r()).done;){var n=i.value,a={path:n.path,keyFrames:Eu(n.keyFrames)};e=Math.max(e,a.keyFrames.getMaxTime()),this.positionCurves.push(a)}if(t.rotationCurves)for(var s,o=w(t.rotationCurves);!(s=o()).done;){var u=s.value,h={path:u.path,keyFrames:Eu(u.keyFrames)};e=Math.max(e,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}if(t.eulerCurves)for(var l,c=w(t.eulerCurves);!(l=c()).done;){var f=l.value,d={path:f.path,keyFrames:Eu(f.keyFrames)};e=Math.max(e,d.keyFrames.getMaxTime()),this.eulerCurves.push(d)}if(t.scaleCurves)for(var p,m=w(t.scaleCurves);!(p=m()).done;){var v=p.value,y={path:v.path,keyFrames:Eu(v.keyFrames)};e=Math.max(e,y.keyFrames.getMaxTime()),this.scaleCurves.push(y)}if(t.floatCurves)for(var g,x=w(t.floatCurves);!(g=x()).done;){var b=g.value,T={path:b.path,keyFrames:Eu(b.keyFrames),property:b.property,className:b.className};e=Math.max(e,T.keyFrames.getMaxTime()),this.floatCurves.push(T)}if(t.colorCurves)for(var E,_=w(t.colorCurves);!(E=_()).done;){var C=E.value,A={path:C.path,keyFrames:Eu(C.keyFrames),property:C.property,className:C.className};e=Math.max(e,A.keyFrames.getMaxTime()),this.colorCurves.push(A)}void 0!==t.duration?this.duration=t.duration:this.duration=e},i.findTarget=function(t,e){for(var i,r=t,n=w(e.split("."));!(i=n()).done;){for(var a,s=i.value,o=!1,u=w(r.children);!(a=u()).done;){var h=a.value;if(h.name===s){r=h,o=!0;break}}if(!o)return}return r},e}(Be);Bl=S([ke(Ae.AnimationClip)],Bl);var Gl=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=0,this.y=0,this.x=t,this.y=e}var e=t.prototype;return e.clone=function(){return new t(this.x,this.y)},e.copyFrom=function(t){return this.set(t.x,t.y),this},e.copyTo=function(t){return t.set(this.x,this.y),t},e.equals=function(t){return t.x===this.x&&t.y===this.y},e.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x=t,this.y=e,this},dr(t,null,[{key:"shared",get:function(){return jl.x=0,jl.y=0,jl}}]),t}(),jl=new Gl,Xl=1e-4,Hl=1e-4;function Wl(t,e,i,r,n,a,s,o){var u,h;s?(u=r,h=-i):(u=-r,h=i);var l=t-i*n+u,c=e-r*n+h,f=t+i*a+u,d=e+r*a+h;return o.push(l,c),o.push(f,d),2}function Yl(t,e,i,r,n,a,s,o){var u=i-t,h=r-e,l=Math.atan2(u,h),c=Math.atan2(n-t,a-e);o&&l<c?l+=2*Math.PI:!o&&l>c&&(c+=2*Math.PI);var f=l,d=c-l,p=Math.abs(d),m=Math.sqrt(u*u+h*h),v=1+(15*p*Math.sqrt(m)/Math.PI>>0),y=d/v;if(f+=y,o){s.push(t,e),s.push(i,r);for(var g=1,x=f;g<v;g++,x+=y)s.push(t,e),s.push(t+Math.sin(x)*m,e+Math.cos(x)*m);s.push(t,e),s.push(n,a)}else{s.push(i,r),s.push(t,e);for(var b=1,T=f;b<v;b++,T+=y)s.push(t+Math.sin(T)*m,e+Math.cos(T)*m),s.push(t,e);s.push(n,a),s.push(t,e)}return 2*v}function Zl(t,e,i,r,n,a,s,o,u){var h=Xl;if(0!==t.length){var l=e,c=l.alignment;if(.5!==e.alignment){var f=function(t){var e=t.length;if(e<6)return 1;for(var i=0,r=0,n=t[e-2],a=t[e-1];r<e;r+=2){var s=t[r],o=t[r+1];i+=(s-n)*(o+a),n=s,a=o}return i<0?-1:1}(t);i&&(f*=-1),c=(c-.5)*f+.5}var d=new Gl(t[0],t[1]),p=new Gl(t[t.length-2],t[t.length-1]),m=r,v=Math.abs(d.x-p.x)<h&&Math.abs(d.y-p.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),p.set(t[t.length-2],t[t.length-1]));var y=.5*(d.x+p.x),g=.5*(p.y+d.y);t.unshift(y,g),t.push(y,g)}var x=n,b=t.length/2,T=t.length,E=x.length/2,_=l.width/2,w=_*_,C=l.miterLimit*l.miterLimit,A=t[0],S=t[1],I=t[2],R=t[3],O=0,M=0,N=-(S-R),P=A-I,F=0,L=0,V=Math.sqrt(N*N+P*P)+oi;N/=V,P/=V,N*=_,P*=_;var D=2*(1-c),k=2*c;m||(l.cap===Te.Round?T+=Yl(A-N*(D-k)*.5,S-P*(D-k)*.5,A-N*D,S-P*D,A+N*k,S+P*k,x,!0)+2:l.cap===Te.Square&&(T+=Wl(A,S,N,P,D,k,!0,x))),x.push(A-N*D,S-P*D),x.push(A+N*k,S+P*k);for(var z=1;z<b-1;++z){A=t[2*(z-1)],S=t[2*(z-1)+1],I=t[2*z],R=t[2*z+1],O=t[2*(z+1)],M=t[2*(z+1)+1],N=-(S-R),P=A-I,N/=V=Math.sqrt(N*N+P*P)+oi,P/=V,N*=_,P*=_,F=-(R-M),L=I-O,F/=V=Math.sqrt(F*F+L*L)+oi,L/=V,F*=_,L*=_;var U=I-A,B=S-R,G=I-O,j=M-R,X=U*G+B*j,H=B*G-j*U,W=H<0;if(Math.abs(H)<.001*Math.abs(X))x.push(I-N*D,R-P*D),x.push(I+N*k,R+P*k),X>=0&&(l.join===Ee.Round?T+=Yl(I,R,I-N*D,R-P*D,I-F*D,R-L*D,x,!1)+4:T+=2,x.push(I-F*k,R-L*k),x.push(I+F*D,R+L*D));else{var Y=(-N+A)*(-P+R)-(-N+I)*(-P+S),Z=(-F+O)*(-L+R)-(-F+I)*(-L+M),q=(U*Z-G*Y)/H,K=(j*Y-B*Z)/H,Q=(q-I)*(q-I)+(K-R)*(K-R),J=I+(q-I)*D,$=R+(K-R)*D,tt=I-(q-I)*k,et=R-(K-R)*k,it=W?D:k;Q<=Math.min(U*U+B*B,G*G+j*j)+it*it*w?l.join===Ee.Bevel||Q/w>C?(W?(x.push(J,$),x.push(I+N*k,R+P*k),x.push(J,$),x.push(I+F*k,R+L*k)):(x.push(I-N*D,R-P*D),x.push(tt,et),x.push(I-F*D,R-L*D),x.push(tt,et)),T+=2):l.join===Ee.Round?W?(x.push(J,$),x.push(I+N*k,R+P*k),T+=Yl(I,R,I+N*k,R+P*k,I+F*k,R+L*k,x,!0)+4,x.push(J,$),x.push(I+F*k,R+L*k)):(x.push(I-N*D,R-P*D),x.push(tt,et),T+=Yl(I,R,I-N*D,R-P*D,I-F*D,R-L*D,x,!1)+4,x.push(I-F*D,R-L*D),x.push(tt,et)):(x.push(J,$),x.push(tt,et)):(x.push(I-N*D,R-P*D),x.push(I+N*k,R+P*k),l.join===Ee.Round?T+=W?Yl(I,R,I+N*k,R+P*k,I+F*k,R+L*k,x,!0)+2:Yl(I,R,I-N*D,R-P*D,I-F*D,R-L*D,x,!1)+2:l.join===Ee.Miter&&Q/w<=C&&(W?(x.push(tt,et),x.push(tt,et)):(x.push(J,$),x.push(J,$)),T+=2),x.push(I-F*D,R-L*D),x.push(I+F*k,R+L*k),T+=2)}}A=t[2*(b-2)],S=t[2*(b-2)+1],I=t[2*(b-1)],N=-(S-(R=t[2*(b-1)+1])),P=A-I,N/=V=Math.sqrt(N*N+P*P)+oi,P/=V,N*=_,P*=_,x.push(I-N*D,R-P*D),x.push(I+N*k,R+P*k),m||(l.cap===Te.Round?T+=Yl(I-N*(D-k)*.5,R-P*(D-k)*.5,I-N*D,R-P*D,I+N*k,R+P*k,x,!1)+2:l.cap===Te.Square&&(T+=Wl(I,R,N,P,D,k,!1,x)));for(var rt=Hl*Hl,nt=E;nt<T+E-2;++nt)A=x[2*nt],S=x[2*nt+1],I=x[2*(nt+1)],R=x[2*(nt+1)+1],O=x[2*(nt+2)],M=x[2*(nt+2)+1],Math.abs(A*(R-M)+I*(M-S)+O*(S-R))<rt||o.push(nt,nt+1,nt+2)}}var ql=function(){},Kl="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ql={exports:{}};!function(t){var e;function i(t,e){return t.b===e.b&&t.a===e.a}function r(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?r<n?e.a-t.a+r/(r+n)*(t.a-i.a):e.a-i.a+n/(r+n)*(i.a-t.a):0}function a(t,e,i){var r=e.b-t.b,n=i.b-e.b;return 0<r+n?(e.a-i.a)*r+(e.a-t.a)*n:0}function s(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?r<n?e.b-t.b+r/(r+n)*(t.b-i.b):e.b-i.b+n/(r+n)*(i.b-t.b):0}function u(t,e,i){var r=e.a-t.a,n=i.a-e.a;return 0<r+n?(e.b-i.b)*r+(e.b-t.b)*n:0}function h(t){return r(t.b.a,t.a)}function l(t){return r(t.a,t.b.a)}function c(t,e,i,r){return(t=0>t?0:t)<=(i=0>i?0:i)?0===i?(e+r)/2:e+t/(t+i)*(r-e):r+i/(t+i)*(e-r)}function f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function d(t,e){var i=!1,r=!1;t!==e&&(e.a!==t.a&&(r=!0,E(e.a,t.a)),e.d!==t.d&&(i=!0,_(e.d,t.d)),g(e,t),r||(x(e,t.a),t.a.c=t),i||(b(e,t.d),t.d.a=t))}function p(t){var e=t.b,i=!1;t.d!==t.b.d&&(i=!0,_(t.d,t.b.d)),t.c===t?E(t.a,null):(t.b.d.a=$(t),t.a.c=t.c,g(t,$(t)),i||b(t,t.d)),e.c===e?(E(e.a,null),_(e.d,null)):(t.d.a=$(e),e.a.c=e.c,g(e,$(e))),T(t)}function m(t){var e=y(t),i=e.b;return g(e,t.e),e.a=t.b.a,x(i,e.a),e.d=i.d=t.d,e=e.b,g(t.b,$(t.b)),g(t.b,e),t.b.a=e.a,e.b.a.c=e.b,e.b.d=t.b.d,e.f=t.f,e.b.f=t.b.f,e}function v(t,e){var i=!1,r=y(t),n=r.b;return e.d!==t.d&&(i=!0,_(e.d,t.d)),g(r,t.e),g(n,e),r.a=t.b.a,n.a=e.a,r.d=n.d=t.d,t.d.a=n,i||b(r,t.d),r}function y(t){var e=new J,i=new J,r=t.b.h;return i.h=r,r.b.h=e,e.h=t,t.b.h=i,e.b=i,e.c=e,e.e=i,i.b=e,i.c=i,i.e=e}function g(t,e){var i=t.c,r=e.c;i.b.e=e,r.b.e=t,t.c=r,e.c=i}function x(t,e){var i=e.f,r=new et(e,i);i.e=r,e.f=r,i=r.c=t;do{i.a=r,i=i.c}while(i!==t)}function b(t,e){var i=e.d,r=new Q(e,i);i.b=r,e.d=r,r.a=t,r.c=e.c,i=t;do{i.d=r,i=i.e}while(i!==t)}function T(t){var e=t.h;t=t.b.h,e.b.h=t,t.b.h=e}function E(t,e){var i=t.c,r=i;do{r.a=e,r=r.c}while(r!==i);i=t.f,(r=t.e).f=i,i.e=r}function _(t,e){var i=t.a,r=i;do{r.d=e,r=r.e}while(r!==i);i=t.d,(r=t.b).d=i,i.b=r}function w(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e}var C=4e150;function A(t,e){t.f+=e.f,t.b.f+=e.b.f}function S(t,e,i){return t=t.a,e=e.a,i=i.a,e.b.a===t?i.b.a===t?r(e.a,i.a)?0>=a(i.b.a,e.a,i.a):0<=a(e.b.a,i.a,e.a):0>=a(i.b.a,t,i.a):i.b.a===t?0<=a(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(i.b.a,t,i.a))}function I(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function R(t,e){p(t.a),t.c=!1,t.a=e,e.i=t}function O(t){var e=t.a.a;do{t=dt(t)}while(t.a.a===e);return t.c&&(R(t,e=v(ft(t).a.b,t.a.e)),t=dt(t)),t}function M(t,e,i){var r=new ct;return r.a=i,r.e=H(t.f,e.e,r),i.i=r}function N(t,e){switch(t.s){case 100130:return 0!=(1&e);case 100131:return 0!==e;case 100132:return 0<e;case 100133:return 0>e;case 100134:return 2<=e||-2>=e}return!1}function P(t){var e=t.a,i=e.d;i.c=t.d,i.a=e,I(t)}function F(t,e,i){for(t=e,e=e.a;t!==i;){t.c=!1;var r=ft(t),n=r.a;if(n.a!==e.a){if(!r.c){P(t);break}R(r,n=v(e.c.b,n.b))}e.c!==n&&(d($(n),n),d(e,n)),P(t),e=r.a,t=r}return e}function L(t,e,i,r,n,a){var s=!0;do{M(t,e,i.b),i=i.c}while(i!==r);for(null===n&&(n=ft(e).a.b.c);(i=(r=ft(e)).a.b).a===n.a;)i.c!==n&&(d($(i),i),d($(n),i)),r.f=e.f-i.f,r.d=N(t,r.f),e.b=!0,!s&&z(t,e)&&(A(i,n),I(e),p(n)),s=!1,e=r,n=i;e.b=!0,a&&B(t,e)}function V(t,e,i,r,n){var a=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(a,i,r,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=i[0])}function D(t,e,i){var r=[null,null,null,null];r[0]=e.a.d,r[1]=i.a.d,V(t,e.a,r,[.5,.5,0,0],!1),d(e,i)}function k(t,e,i,r,n){var a=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),s=Math.abs(i.b-t.b)+Math.abs(i.a-t.a),o=n+1;r[n]=.5*s/(a+s),r[o]=.5*a/(a+s),t.g[0]+=r[n]*e.g[0]+r[o]*i.g[0],t.g[1]+=r[n]*e.g[1]+r[o]*i.g[1],t.g[2]+=r[n]*e.g[2]+r[o]*i.g[2]}function z(t,e){var n=ft(e),s=e.a,o=n.a;if(r(s.a,o.a)){if(0<a(o.b.a,s.a,o.a))return!1;if(i(s.a,o.a)){if(s.a!==o.a){n=t.e;var u=s.a.h;if(0<=u){var h=(n=n.b).d,l=n.e,c=n.c,f=c[u];h[f]=h[n.a],c[h[f]]=f,f<=--n.a&&(1>=f||r(l[h[f>>1]],l[h[f]])?ht(n,f):lt(n,f)),l[u]=null,c[u]=n.b,n.b=u}else for(n.c[-(u+1)]=null;0<n.a&&null===n.c[n.d[n.a-1]];)--n.a;D(t,$(o),s)}}else m(o.b),d(s,$(o)),e.b=n.b=!0}else{if(0>a(s.b.a,o.a,s.a))return!1;dt(e).b=e.b=!0,m(s.b),d($(o),s)}return!0}function U(t,e){var h=ft(e),l=e.a,f=h.a,p=l.a,v=f.a,y=l.b.a,g=f.b.a,x=new et;if(a(y,t.a,p),a(g,t.a,v),p===v||Math.min(p.a,y.a)>Math.max(v.a,g.a))return!1;if(r(p,v)){if(0<a(g,p,v))return!1}else if(0>a(y,v,p))return!1;var b,T,E=y,_=p,w=g,C=v;if(r(E,_)||(b=E,E=_,_=b),r(w,C)||(b=w,w=C,C=b),r(E,w)||(b=E,E=w,w=b,b=_,_=C,C=b),r(w,_)?r(_,C)?(0>(b=n(E,w,_))+(T=n(w,_,C))&&(b=-b,T=-T),x.b=c(b,w.b,T,_.b)):(0>(b=a(E,w,_))+(T=-a(E,C,_))&&(b=-b,T=-T),x.b=c(b,w.b,T,C.b)):x.b=(w.b+_.b)/2,s(E,_)||(b=E,E=_,_=b),s(w,C)||(b=w,w=C,C=b),s(E,w)||(b=E,E=w,w=b,b=_,_=C,C=b),s(w,_)?s(_,C)?(0>(b=o(E,w,_))+(T=o(w,_,C))&&(b=-b,T=-T),x.a=c(b,w.a,T,_.a)):(0>(b=u(E,w,_))+(T=-u(E,C,_))&&(b=-b,T=-T),x.a=c(b,w.a,T,C.a)):x.a=(w.a+_.a)/2,r(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=r(p,v)?p:v,r(E,x)&&(x.b=E.b,x.a=E.a),i(x,p)||i(x,v))return z(t,e),!1;if(!i(y,t.a)&&0<=a(y,t.a,x)||!i(g,t.a)&&0>=a(g,t.a,x)){if(g===t.a)return m(l.b),d(f.b,l),l=ft(e=O(e)).a,F(t,ft(e),h),L(t,e,$(l),l,l,!0),!0;if(y===t.a){m(f.b),d(l.e,$(f)),v=(p=h=e).a.b.a;do{p=dt(p)}while(p.a.b.a===v);return p=ft(e=p).a.b.c,h.a=$(f),L(t,e,(f=F(t,h,null)).c,l.b.c,p,!0),!0}return 0<=a(y,t.a,x)&&(dt(e).b=e.b=!0,m(l.b),l.a.b=t.a.b,l.a.a=t.a.a),0>=a(g,t.a,x)&&(e.b=h.b=!0,m(f.b),f.a.b=t.a.b,f.a.a=t.a.a),!1}return m(l.b),m(f.b),d($(f),l),l.a.b=x.b,l.a.a=x.a,l.a.h=rt(t.e,l.a),l=l.a,f=[0,0,0,0],x=[p.d,y.d,v.d,g.d],l.g[0]=l.g[1]=l.g[2]=0,k(l,p,y,f,0),k(l,v,g,f,2),V(t,l,x,f,!0),dt(e).b=e.b=h.b=!0,!1}function B(t,e){for(var i=ft(e);;){for(;i.b;)e=i,i=ft(i);if(!e.b&&(i=e,null===(e=dt(e))||!e.b))break;e.b=!1;var n,s=e.a,o=i.a;if(n=s.b.a!==o.b.a)t:{var u=ft(n=e),h=n.a,l=u.a,c=void 0;if(r(h.b.a,l.b.a)){if(0>a(h.b.a,l.b.a,h.a)){n=!1;break t}dt(n).b=n.b=!0,c=m(h),d(l.b,c),c.d.c=n.d}else{if(0<a(l.b.a,h.b.a,l.a)){n=!1;break t}n.b=u.b=!0,c=m(l),d(h.e,l.b),c.b.d.c=n.d}n=!0}if(n&&(i.c?(I(i),p(o),o=(i=ft(e)).a):e.c&&(I(e),p(s),s=(e=dt(i)).a)),s.a!==o.a)if(s.b.a===o.b.a||e.c||i.c||s.b.a!==t.a&&o.b.a!==t.a)z(t,e);else if(U(t,e))break;s.a===o.a&&s.b.a===o.b.a&&(A(o,s),I(e),p(s),e=dt(i))}}function G(t,e){t.a=e;for(var n=e.c;null===n.i;)if((n=n.c)===e.c){n=t;var s=e;(h=new ct).a=s.c.b;var o=(c=n.f).a;do{o=o.a}while(null!==o.b&&!c.c(c.b,h,o.b));var u=ft(c=o.b),h=c.a;o=u.a;if(0===a(h.b.a,s,h.a))i((h=c.a).a,s)||i(h.b.a,s)||(m(h.b),c.c&&(p(h.c),c.c=!1),d(s.c,h),G(n,s));else{var l=r(o.b.a,h.b.a)?c:u;u=void 0;c.d||l.c?(u=l===c?v(s.c.b,h.e):v(o.b.c.b,s.c).b,l.c?R(l,u):(h=n,(c=M(n,c,u)).f=dt(c).f+c.a.f,c.d=N(h,c.f)),G(n,s)):L(n,c,s.c,s.c,null,!0)}return}if(c=(h=ft(n=O(n.i))).a,(h=F(t,h,null)).c===c){h=(c=h).c,o=ft(n),u=n.a,l=o.a;var c,f=!1;u.b.a!==l.b.a&&U(t,n),i(u.a,t.a)&&(d($(h),u),h=ft(n=O(n)).a,F(t,ft(n),o),f=!0),i(l.a,t.a)&&(d(c,$(l)),c=F(t,o,null),f=!0),f?L(t,n,c.c,h,h,!0):(s=r(l.a,u.a)?$(l):u,L(t,n,s=v(c.c.b,s),s.c,s.c,!1),s.b.i.c=!0,B(t,n))}else L(t,n,h.c,c,c,!0)}function j(t,e){var i=new ct,r=f(t.b);r.a.b=C,r.a.a=e,r.b.a.b=-C,r.b.a.a=e,t.a=r.b.a,i.a=r,i.f=0,i.d=!1,i.c=!1,i.h=!0,i.b=!1,r=H(r=t.f,r.a,i),i.e=r}function X(t){this.a=new W,this.b=t,this.c=S}function H(t,e,i){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,i));return t=new W(i,e.a,e),e.a.c=t,e.a=t}function W(t,e,i){this.b=t||null,this.a=e||this,this.c=i||this}function Y(){this.d=Z,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var Z=0;function q(t,e){if(t.d!==e)for(;t.d!==e;)if(t.d<e)switch(t.d){case Z:K(t,100151),t.u(null);break;case 1:K(t,100152),t.t()}else switch(t.d){case 2:K(t,100154),t.v();break;case 1:K(t,100153),t.w()}}function K(t,e){t.p&&t.p(e,t.c)}function Q(t,e){this.b=t||this,this.d=e||this,this.a=null,this.c=!1}function J(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function $(t){return t.b.e}function tt(){this.c=new et,this.a=new Q,this.b=new J,this.d=new J,this.b.b=this.d,this.d.b=this.b}function et(t,e){this.e=t||this,this.f=e||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function it(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new at}function rt(t,e){if(t.e){var i,r=t.b,n=++r.a;return 2*n>r.f&&(r.f*=2,r.c=st(r.c,r.f+1)),0===r.b?i=n:(i=r.b,r.b=r.c[r.b]),r.e[i]=e,r.c[i]=n,r.d[n]=i,r.h&&lt(r,n),i}return r=t.a++,t.c[r]=e,-(r+1)}function nt(t){if(0===t.a)return ut(t.b);var e=t.c[t.d[t.a-1]];if(0!==t.b.a&&r(ot(t.b),e))return ut(t.b);do{--t.a}while(0<t.a&&null===t.c[t.d[t.a-1]]);return e}function at(){this.d=st([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function st(t,e){for(var i=Array(e),r=0;r<t.length;r++)i[r]=t[r];for(;r<e;r++)i[r]=0;return i}function ot(t){return t.e[t.d[1]]}function ut(t){var e=t.d,i=t.e,r=t.c,n=e[1],a=i[n];return 0<t.a&&(e[1]=e[t.a],r[e[1]]=1,i[n]=null,r[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),a}function ht(t,e){for(var i=t.d,n=t.e,a=t.c,s=e,o=i[s];;){var u=s<<1;u<t.a&&r(n[i[u+1]],n[i[u]])&&(u+=1);var h=i[u];if(u>t.a||r(n[o],n[h])){i[s]=o,a[o]=s;break}i[s]=h,a[h]=s,s=u}}function lt(t,e){for(var i=t.d,n=t.e,a=t.c,s=e,o=i[s];;){var u=s>>1,h=i[u];if(0===u||r(n[h],n[o])){i[s]=o,a[o]=s;break}i[s]=h,a[h]=s,s=u}}function ct(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function ft(t){return t.e.c.b}function dt(t){return t.e.a.b}(e=Y.prototype).x=function(){q(this,Z)},e.B=function(t,e){switch(t){case 100142:return;case 100140:switch(e){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=e)}break;case 100141:return void(this.m=!!e);default:return void K(this,100900)}K(this,100901)},e.y=function(t){switch(t){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:K(this,100900)}return!1},e.A=function(t,e,i){this.j[0]=t,this.j[1]=e,this.j[2]=i},e.z=function(t,e){var i=e||null;switch(t){case 100100:case 100106:this.h=i;break;case 100104:case 100110:this.l=i;break;case 100101:case 100107:this.k=i;break;case 100102:case 100108:this.i=i;break;case 100103:case 100109:this.p=i;break;case 100105:case 100111:this.o=i;break;case 100112:this.r=i;break;default:K(this,100900)}},e.C=function(t,e){var i=!1,r=[0,0,0];q(this,2);for(var n=0;3>n;++n){var a=t[n];-1e150>a&&(a=-1e150,i=!0),1e150<a&&(a=1e150,i=!0),r[n]=a}i&&K(this,100155),null===(i=this.q)?d(i=f(this.b),i.b):(m(i),i=i.e),i.a.d=e,i.a.g[0]=r[0],i.a.g[1]=r[1],i.a.g[2]=r[2],i.f=1,i.b.f=-1,this.q=i},e.u=function(t){q(this,Z),this.d=1,this.b=new tt,this.c=t},e.t=function(){q(this,1),this.d=2,this.q=null},e.v=function(){q(this,2),this.d=1},e.w=function(){q(this,1),this.d=Z;var t=!1,e=[c=this.j[0],n=this.j[1],o=this.j[2]];if(0===c&&0===n&&0===o){for(var n=[-2e150,-2e150,-2e150],s=[2e150,2e150,2e150],o=[],u=[],c=(t=this.b.c).e;c!==t;c=c.e)for(var f=0;3>f;++f){var d=c.g[f];d<s[f]&&(s[f]=d,u[f]=c),d>n[f]&&(n[f]=d,o[f]=c)}if(c=0,n[1]-s[1]>n[0]-s[0]&&(c=1),n[2]-s[2]>n[c]-s[c]&&(c=2),s[c]>=n[c])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,s=u[c],o=o[c],u=[0,0,0],s=[s.g[0]-o.g[0],s.g[1]-o.g[1],s.g[2]-o.g[2]],f=[0,0,0],c=t.e;c!==t;c=c.e)f[0]=c.g[0]-o.g[0],f[1]=c.g[1]-o.g[1],f[2]=c.g[2]-o.g[2],u[0]=s[1]*f[2]-s[2]*f[1],u[1]=s[2]*f[0]-s[0]*f[2],u[2]=s[0]*f[1]-s[1]*f[0],(d=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=d,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[w(s)]=1)}t=!0}for(u=w(e),c=this.b.c,n=(u+1)%3,o=(u+2)%3,u=0<e[u]?1:-1,e=c.e;e!==c;e=e.e)e.b=e.g[n],e.a=u*e.g[o];if(t){for(e=0,c=(t=this.b.a).b;c!==t;c=c.b)if(!(0>=(n=c.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==c.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,c=(e=this.b.b).h;c!==e;c=t)t=c.h,n=c.e,i(c.a,c.b.a)&&c.e.e!==c&&(D(this,n,c),p(c),n=(c=n).e),n.e===c&&(n!==c&&(n!==t&&n!==t.b||(t=t.h),p(n)),c!==t&&c!==t.b||(t=t.h),p(c));for(this.e=e=new it,c=(t=this.b.c).e;c!==t;c=c.e)c.h=rt(e,c);for(function(t){t.d=[];for(var e=0;e<t.a;e++)t.d[e]=e;t.d.sort(function(t){return function(e,i){return r(t[e],t[i])?1:-1}}(t.c)),t.e=!0,function(t){for(var e=t.a;1<=e;--e)ht(t,e);t.h=!0}(t.b)}(e),this.f=new X(this),j(this,-C),j(this,C);null!==(e=nt(this.e));){for(;;){t:if(c=this.e,0===c.a)t=ot(c.b);else if(t=c.c[c.d[c.a-1]],0!==c.b.a&&(c=ot(c.b),r(c,t))){t=c;break t}if(null===t||!i(t,e))break;t=nt(this.e),D(this,e.c,t.c)}G(this,e)}for(this.a=this.f.a.a.b.a.a,e=0;null!==(t=this.f.a.a.b);)t.h||++e,I(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,c=(e=this.b).a.b;c!==e.a;c=t)t=c.b,(c=c.a).e.e===c&&(A(c.c,c),p(c));if(!this.n){if(e=this.b,this.m)for(c=e.b.h;c!==e.b;c=t)t=c.h,c.b.d.c!==c.d.c?c.f=c.d.c?1:-1:p(c);else for(c=e.a.b;c!==e.a;c=t)if(t=c.b,c.c){for(c=c.a;r(c.b.a,c.a);c=c.c.b);for(;r(c.a,c.b.a);c=c.e);for(n=c.c.b,o=void 0;c.e!==n;)if(r(c.b.a,n.a)){for(;n.e!==c&&(h(n.e)||0>=a(n.a,n.b.a,n.e.b.a));)n=(o=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==c&&(l(c.c.b)||0<=a(c.b.a,c.a,c.c.b.a));)c=(o=v(c,c.c.b)).b;c=c.e}for(;n.e.e!==c;)n=(o=v(n.e,n)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(t=(e=this.b).a.b;t!==e.a;t=t.b)if(t.c){this.h&&this.h(2,this.c),c=t.a;do{this.k&&this.k(c.a.d,this.c),c=c.e}while(c!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,c=!1,n=-1,o=e.a.d;o!==e.a;o=o.d)if(o.c){c||(this.h&&this.h(4,this.c),c=!0),u=o.a;do{t&&(n!==(s=u.b.d.c?0:1)&&(n=s,this.l&&this.l(!!n,this.c))),this.k&&this.k(u.a.d,this.c),u=u.e}while(u!==o.a)}c&&this.i&&this.i(this.c)}if(this.r){for(c=(e=this.b).a.b;c!==e.a;c=t)if(t=c.b,!c.c){o=(n=c.a).e,u=void 0;do{o=(u=o).e,u.d=null,null===u.b.d&&(u.c===u?E(u.a,null):(u.a.c=u.c,g(u,$(u))),(s=u.b).c===s?E(s.a,null):(s.a.c=s.c,g(s,$(s))),T(u))}while(u!==n);n=c.d,(c=c.b).d=n,n.b=c}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Kl.libtess={GluTesselator:Y,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},Y.prototype.gluDeleteTess=Y.prototype.x,Y.prototype.gluTessProperty=Y.prototype.B,Y.prototype.gluGetTessProperty=Y.prototype.y,Y.prototype.gluTessNormal=Y.prototype.A,Y.prototype.gluTessCallback=Y.prototype.z,Y.prototype.gluTessVertex=Y.prototype.C,Y.prototype.gluTessBeginPolygon=Y.prototype.u,Y.prototype.gluTessBeginContour=Y.prototype.t,Y.prototype.gluTessEndContour=Y.prototype.v,Y.prototype.gluTessEndPolygon=Y.prototype.w,t.exports=Kl.libtess}(Ql);var Jl=function(){var t=new Ql.exports.GluTesselator;return t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==Ql.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,i){return[t[0],t[1],t[2]]})),t.gluTessCallback(Ql.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function $l(t){Jl.gluTessNormal(0,0,1);var e=[];Jl.gluTessBeginPolygon(e);for(var i=0;i<t.length;i++){Jl.gluTessBeginContour();for(var r=t[i],n=0;n<r.length;n+=2){var a=[r[n],r[n+1],0];Jl.gluTessVertex(a,a)}Jl.gluTessEndContour()}return Jl.gluTessEndPolygon(),e}var tc=function(t){function e(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var a=Array.isArray(i[0])?i[0]:i;if("number"!=typeof a[0]){for(var s=[],o=0,u=a.length;o<u;o++)s.push(a[o].x,a[o].y);a=s}return n.points=a,n.closePath=!0,n}$t(e,t);var i=e.prototype;return i.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},i.contains=function(t,e){for(var i=!1,r=this.points.length/2,n=0,a=r-1;n<r;a=n++){var s=this.points[2*n],o=this.points[2*n+1],u=this.points[2*a],h=this.points[2*a+1];o>e!=h>e&&t<(e-o)/(h-o)*(u-s)+s&&(i=!i)}return i},i.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.points[this.points.length-2]},i.getY=function(){return this.points[this.points.length-1]},i.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},i.triangulate=function(t,e,i,r,n){var a=$l([t]),s=e.length/2;0===a.length&&this.getLineEndPointsTriangle(t,a);for(var o=0;o<a.length;o++)e[2*i+o]=a[o];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=s+h},i.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw new Error("Invalid points array");if(2!==t.length){var i=t[2]-t[0],r=t[3]-t[1],n=t[0],a=t[1],s=t[0],o=t[1];if(Math.abs(i)>=Math.abs(r))for(var u=0;u<t.length;u+=2){var h=t[u],l=t[u+1];h<n&&(n=h,a=l),h>s&&(s=h,o=l)}else for(var c=0;c<t.length;c+=2){var f=t[c],d=t[c+1];d<a&&(n=f,a=d),d>o&&(s=f,o=d)}e.push(n,a,s,o,s,o)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},dr(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(ql),ec=8,ic=1.1920929e-7;function rc(t,e,i,r,n,a,s,o,u,h){var l=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function(t,e,i,r,n,a,s,o,u,h){nc(t,e,i,r,n,a,s,o,u,h,0),u.push(s,o)}(e,i,r,n,a,s,o,u,t,l*=l),t}function nc(t,e,i,r,n,a,s,o,u,h,l){if(!(l>ec)){var c=(t+i)/2,f=(e+r)/2,d=(i+n)/2,p=(r+a)/2,m=(n+s)/2,v=(a+o)/2,y=(c+d)/2,g=(f+p)/2,x=(d+m)/2,b=(p+v)/2,T=(y+x)/2,E=(g+b)/2;if(l>0){var _=s-t,w=o-e,C=Math.abs((i-s)*w-(r-o)*_),A=Math.abs((n-s)*w-(a-o)*_);if(C>ic&&A>ic){if((C+A)*(C+A)<=h*(_*_+w*w))return void u.push(T,E)}else if(C>ic){if(C*C<=h*(_*_+w*w))return void u.push(T,E)}else if(A>ic){if(A*A<=h*(_*_+w*w))return void u.push(T,E)}else if((_=T-(t+s)/2)*_+(w=E-(e+o)/2)*w<=h)return void u.push(T,E)}nc(t,e,c,f,y,g,T,E,u,h,l+1),nc(T,E,x,b,m,v,s,o,u,h,l+1)}}var ac,sc=function(t){function e(e,i,r,n){var a;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),(a=t.call(this)||this).type="ellipse",a.x=e,a.y=i,a.halfWidth=r,a.halfHeight=n,a}$t(e,t);var i=e.prototype;return i.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},i.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var i=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return(i*=i)+(r*=r)<=1},i.strokeContains=function(t,e,i){var r=this.halfWidth,n=this.halfHeight;if(r<=0||n<=0)return!1;var a=i/2,s=r-a,o=n-a,u=r+a,h=n+a,l=t-this.x,c=e-this.y;return l*l/(s*s)+c*c/(o*o)>1&&l*l/(u*u)+c*c/(h*h)<=1},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},i.copyTo=function(t){return t.copyFrom(this),t},i.getX=function(){return this.x},i.getY=function(){return this.y},i.build=function(t){var e=this.x,i=this.y,r=this.halfWidth,n=this.halfHeight;if(!(r>=0&&n>=0))return t;var a=Math.ceil(5*Math.sqrt(r+n)),s=8*a+0+0;if(0===s)return t;if(0===a)return t[0]=t[6]=e+0,t[1]=t[3]=i+0,t[2]=t[4]=e-0,t[5]=t[7]=i-0,t;var o=0,u=4*a+0+2,h=u,l=s,c=0+r,f=0,d=e+c,p=e-c,m=i+f;t[o++]=d,t[o++]=m,t[--u]=m,t[--u]=p;for(var v=1;v<a;v++){var y=Math.PI/2*(v/a),g=0+Math.cos(y)*r,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=i+x,_=i-x;t[o++]=b,t[o++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--l]=_,t[--l]=b}d=e+(c=0),p=e-c,m=i+(f=0+n);var w=i-f;return t[o++]=d,t[o++]=m,t[--l]=w,t[--l]=d,t},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=s;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(ql);!function(t){t[t.Star=0]="Star",t[t.Polygon=1]="Polygon"}(ac||(ac={}));var oc=function(t){function e(e,i,r,n,a,s){var o;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=0),(o=t.call(this)||this).pointCount=e,o.outerRadius=i,o.innerRadius=r,o.outerRoundness=n,o.innerRoundness=a,o.starType=s,o.v=[],o.in=[],o.out=[],o}$t(e,t);var i=e.prototype;return i.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},i.copyFrom=function(t){this.pointCount=t.pointCount,this.outerRadius=t.outerRadius,this.innerRadius=t.innerRadius,this.outerRoundness=t.outerRoundness,this.innerRoundness=t.innerRoundness,this.starType=t.starType},i.copyTo=function(t){t.copyFrom(this)},i.build=function(t){switch(this.starType){case 0:this.buildStarPath();break;case 1:this.buildPolygonPath()}for(var e=0;e<this.v.length-2;e+=2)rc(t,this.v[e],this.v[e+1],this.out[e],this.out[e+1],this.in[e+2],this.in[e+3],this.v[e+2],this.v[e+3],1);var i=this.v.length-1;rc(t,this.v[i-1],this.v[i],this.out[i-1],this.out[i],this.in[0],this.in[1],this.v[0],this.v[1],1)},i.triangulate=function(t,e,i,r,n){for(var a=$l([t]),s=e.length/2,o=0;o<a.length;o++)e[2*i+o]=a[o];for(var u=a.length/2,h=0;h<u;h++)r[n+h]=s+h},i.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,i,r,n=2*Math.floor(this.pointCount),a=2*Math.PI/n,s=!0,o=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,l=this.innerRoundness/100,c=2*Math.PI*o/(2*n),f=2*Math.PI*u/(2*n),d=-Math.PI/2;for(t=0;t<n;t++){i=s?h:l,r=s?c:f;var p=(e=s?o:u)*Math.cos(d),m=e*Math.sin(d),v=0===p&&0===m?0:m/Math.sqrt(p*p+m*m),y=0===p&&0===m?0:-p/Math.sqrt(p*p+m*m),g=2*t;this.v[g]=p,this.v[g+1]=m,this.in[g]=p+v*r*i*1,this.in[g+1]=m+y*r*i*1,this.out[g]=p-v*r*i*1,this.out[g+1]=m-y*r*i*1,s=!s,d+=1*a}},i.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),i=2*Math.PI/e,r=this.outerRadius,n=this.outerRoundness/100,a=2*Math.PI*r/(4*e),s=.5*-Math.PI;for(t=0;t<e;t++){var o=r*Math.cos(s),u=r*Math.sin(s),h=0===o&&0===u?0:u/Math.sqrt(o*o+u*u),l=0===o&&0===u?0:-o/Math.sqrt(o*o+u*u),c=2*t;this.v[c]=o,this.v[c+1]=u,this.in[c]=o+h*a*n*1,this.in[c+1]=u+l*a*n*1,this.out[c]=o-h*a*n*1,this.out[c+1]=u-l*a*n*1,s+=1*i}},e}(ql),uc=function(t){function e(e,i,r,n,a){var s;return void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=20),(s=t.call(this)||this).x=e,s.y=i,s.width=r,s.height=n,s.roundness=a,s}$t(e,t);var i=e.prototype;return i.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},i.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},i.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.roundness=t.roundness,this},i.copyTo=function(t){return t.copyFrom(this),t},i.build=function(t){var e,i=this.width/2,r=this.height/2,n=this.x+i,a=this.y+r,s=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(i,r)),o=i-s,u=r-e;if(s>=0&&e>=0&&o>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(s+e)),l=8*h+(o?4:0)+(u?4:0);if(0!==l){if(0===h)return t[0]=t[6]=n+o,t[1]=t[3]=a+u,t[2]=t[4]=n-o,void(t[5]=t[7]=a-u);var c=0,f=4*h+(o?2:0)+2,d=f,p=l,m=o+s,v=u,y=n+m,g=n-m,x=a+v;if(t[c++]=y,t[c++]=x,t[--f]=x,t[--f]=g,u){var b=a-v;t[d++]=g,t[d++]=b,t[--p]=b,t[--p]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),_=o+Math.cos(E)*s,w=u+Math.sin(E)*e,C=n+_,A=n-_,S=a+w,I=a-w;t[c++]=C,t[c++]=S,t[--f]=S,t[--f]=A,t[d++]=A,t[d++]=I,t[--p]=I,t[--p]=C}y=n+(m=o),g=n-m,x=a+(v=u+e);var R=a-v;t[c++]=y,t[c++]=x,t[--p]=R,t[--p]=y,o&&(t[c++]=g,t[c++]=x,t[--p]=R,t[--p]=g)}}},i.triangulate=function(t,e,i,r,n){if(0!==t.length){for(var a=0,s=0,o=0;o<t.length;o+=2)a+=t[o],s+=t[o+1];a/=t.length/2,s/=t.length/2;var u=i;e[2*u]=a,e[2*u+1]=s;for(var h=u++,l=0;l<t.length;l+=2)e[2*u]=t[l],e[2*u+1]=t[l+1],l>0&&(r[n++]=u,r[n++]=h,r[n++]=u-1),u++;r[n++]=h+1,r[n++]=h,r[n++]=u-1}},e}(ql),hc=function(){function t(t){this.graphicsPath=t,this.currentPoly=null,this.shapePrimitives=[]}var e=t.prototype;return e.buildPath=function(){this.currentPoly=null,this.shapePrimitives.length=0;for(var t,e=w(this.graphicsPath.instructions);!(t=e()).done;){var i=t.value,r=i.action,n=i.data;switch(r){case"bezierCurveTo":this.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"moveTo":this.moveTo(n[0],n[1]);break;case"ellipse":this.ellipse(n[0],n[1],n[2],n[3],n[4]);break;case"polyStar":this.polyStar(n[0],n[1],n[2],n[3],n[4],n[5],n[6]);break;case"rect":this.rect(n[0],n[1],n[2],n[3],n[4]);break;case"closePath":this.closePath()}}this.endPoly()},e.bezierCurveTo=function(t,e,i,r,n,a,s){this.ensurePoly();var o=this.currentPoly;return rc(o.points,o.lastX,o.lastY,t,e,i,r,n,a,s),this},e.moveTo=function(t,e){return this.startPoly(t,e),this},e.closePath=function(){return this.endPoly(!0),this},e.ellipse=function(t,e,i,r,n){return this.drawShape(new sc(t,e,i,r),n),this},e.polyStar=function(t,e,i,r,n,a,s){return this.drawShape(new oc(t,e,i,r,n,a),s),this},e.rect=function(t,e,i,r,n,a){return this.drawShape(new uc(t,e,i,r,n),a),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var i=this.currentPoly;return i&&this.endPoly(),(i=new tc).points.push(t,e),this.currentPoly=i,this},e.endPoly=function(t){void 0===t&&(t=!1);var e=this.currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this.currentPoly=null,this},e.ensurePoly=function(t){this.currentPoly||(this.currentPoly=new tc,this.currentPoly.points.push(0,0))},t}(),lc=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,i,r,n,a,s){return this.instructions.push({action:"bezierCurveTo",data:[t,e,i,r,n,a,s]}),this.dirty=!0,this},e.moveTo=function(t,e){return this.instructions.push({action:"moveTo",data:[t,e]}),this.dirty=!0,this},e.closePath=function(){return this.instructions.push({action:"closePath",data:[]}),this.dirty=!0,this},e.ellipse=function(t,e,i,r,n){return this.instructions.push({action:"ellipse",data:[t,e,i,r,n]}),this.dirty=!0,this},e.rect=function(t,e,i,r,n,a){return this.instructions.push({action:"rect",data:[t,e,i,r,n,a]}),this.dirty=!0,this},e.polyStar=function(t,e,i,r,n,a,s){return this.instructions.push({action:"polyStar",data:[t,e,i,r,n,a,s]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},dr(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new hc(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}();function cc(t,e){return!e||"object"!==A(e)&&"function"!=typeof e?Lu(t):e}var fc=new(function(){function t(){this.elements=[]}var e=t.prototype;return e.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},e.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return ut(t),t}if(qu(Wu))return r._createOffscreenCanvas(10,10);var e=i.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?V(this.elements,t):t.remove()},t}()),dc=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,i=void 0===e?100:e,r=t.textWidth,n=void 0===r?100:r,a=t.textOverflow,s=void 0===a?fe.clip:a,o=t.textBaseline,u=void 0===o?de.top:o,h=t.textAlign,l=void 0===h?pe.left:h,c=t.text,f=void 0===c?" ":c,d=t.letterSpace,p=void 0===d?0:d,m=t.autoWidth,v=void 0!==m&&m,y=t.fontSize,g=t.lineHeight,x=void 0===g?y:g,b=y+p;this.autoWidth=v,this.maxTextWidth=f.length*b,this.width=n,this.height=i,this.letterSpace=p,this.overflow=s,this.textBaseline=u,this.textAlign=l,this.lineHeight=x}var e=t.prototype;return e.getOffsetY=function(t,e,i,r){var n=t.outlineWidth,a=t.fontScale,s=(i-r)/3,o=r+n*a,u=i*(e-1),h=0;switch(this.textBaseline){case de.top:h=o+s;break;case de.middle:h=(this.height*a-u+o)/2;break;case de.bottom:h=this.height*a-u-s}return h},e.getOffsetX=function(t,e){var i=0;switch(this.textAlign){case pe.left:i=t.outlineWidth*t.fontScale;break;case pe.middle:i=(this.width*t.fontScale-e)/2;break;case pe.right:i=this.width*t.fontScale-e}return i},e.setSize=function(t,e){this.width=t,this.height=e},t}(),pc=function(t){this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var e,i,r,n,a,s,o=t.textColor,u=void 0===o?[1,1,1,1]:o,h=t.fontSize,l=void 0===h?40:h,c=t.outline,f=t.shadow,d=t.fontWeight,p=void 0===d?"normal":d,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,g=void 0===y?"sans-serif":y;(this.textColor=u,this.textWeight=p,this.fontStyle=v,this.fontFamily=g,this.fontSize=l,c)&&(this.isOutlined=!0,this.outlineColor=null!=(e=c.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(i=c.outlineWidth)?i:1,this.fontOffset+=this.outlineWidth);f&&(this.hasShadow=!0,this.shadowBlur=null!=(r=f.shadowBlur)?r:2,this.shadowColor=null!=(n=f.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(a=f.shadowOffsetX)?a:0,this.shadowOffsetY=null!=(s=f.shadowOffsetY)?s:0);this.fontStyle!==ve.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},mc=["serif","sans-serif","monospace","courier"],vc=0,yc=function(t){function e(e,i){var r;if((r=t.call(this,e)||this).isDirty=!0,r.lineCount=0,r.maxLineWidth=0,r.SCALE_FACTOR=.1,r.ALPHA_FIX_VALUE=1/255,r.name="MText"+vc++,i&&r.fromData(i),r.canvas=fc.getCanvas(),fc.saveCanvas(r.canvas),r.context=r.canvas.getContext("2d",{willReadFrequently:!0}),!i)return cc(r);var n=i.options;return r.updateWithOptions(n),r.updateTexture(),r}$t(e,t);var i=e.prototype;return i.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e.interaction,r=e.options;this.interaction=i,this.updateWithOptions(r),this.renderText(r),this.material.setColor("_Color",new Er(1,1,1,1))},i.updateWithOptions=function(t){},i.updateTexture=function(t){},e}(Js);yc=S([ke(Ae.TextComponent)],yc);var gc=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new pc(t),this.textLayout=new dc(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var i=this.context,r=this.textLayout,n=r.letterSpace,a=r.overflow,s=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,o=this.textLayout.width+this.textStyle.fontOffset,u=1,h=0,l=0;l<t.length;l++){var c,f,d=t[l],p=(null!=(f=null==i||null==(c=i.measureText(d))?void 0:c.width)?f:0)*s;h+=n,a===fe.display?"\n"===d?(u++,h=0):(h+=p,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+p>o&&l>0||"\n"===d)&&(u++,this.maxLineWidth=Math.max(this.maxLineWidth,h),h=0),"\n"!==d&&(h+=p))}return u},e.setFontSize=function(t){if(this.textStyle.fontSize!==t){var e=this.textStyle.fontSize-t;this.textLayout.lineHeight+=e,this.textStyle.fontSize=t,this.isDirty=!0}},e.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.setText=function(t){this.text!==t&&(this.text=t.toString(),this.lineCount=this.getLineCount(t,!1),this.isDirty=!0)},e.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.setFontFamily=function(t){this.textStyle.fontFamily!==t||lt(t)?(this.textStyle.fontFamily=t,this.isDirty=!0):console.warn("The font is either the current font or an risky font family.")},e.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.setOverflow=function(t){this.textLayout.overflow=t,this.isDirty=!0},e.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.setAutoWidth=function(t){this.textLayout.autoWidth!==t&&(this.textLayout.autoWidth=t,this.isDirty=!0)},e.updateTexture=function(t){if(void 0===t&&(t=!0),this.isDirty&&this.context&&this.canvas){var e=this.context,i=this.textStyle,r=this.textLayout,n=i.fontScale,a=(r.width+i.fontOffset)*n,s=r.lineHeight*this.lineCount,o=i.fontSize*n,u=r.lineHeight*n;i.fontDesc=this.getFontDesc(o),this.char=(this.text||"").split(""),this.canvas.width=a,r.autoWidth?(this.canvas.height=s*n,this.item.transform.size.set(1,s/r.height)):this.canvas.height=r.height*n;var h=this.canvas.height;e.fillStyle="rgba(255, 255, 255, 0.0039)",t||(e.translate(0,h),e.scale(1,-1)),this.maxLineWidth>a&&r.overflow===fe.display?e.font=this.getFontDesc(o*a/this.maxLineWidth):e.font=i.fontDesc,e.clearRect(0,0,a,h),i.hasShadow&&this.setupShadow(),i.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+i.textColor[0]+", "+i.textColor[1]+", "+i.textColor[2]+", "+i.textColor[3]+")";for(var l=[],c=0,f=r.getOffsetY(i,this.lineCount,u,o),d=[],p=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((c+=r.letterSpace*n)+y.width>a&&m>0||"\n"===v)&&(l.push({y:f,width:c,chars:d,charOffsetX:p}),c=0,f+=u,d=[],p=[]),"\n"!==v&&(d.push(v),p.push(c),c+=y.width)}l.push({y:f,width:c,chars:d,charOffsetX:p}),l.forEach((function(t){var n=r.getOffsetX(i,t.width);t.chars.forEach((function(r,a){i.isOutlined&&e.strokeText(r,n+t.charOffsetX[a],t.y),e.fillText(r,n+t.charOffsetX[a],t.y)}))})),i.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=fn.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:Mr.LINEAR,minFilter:Mr.LINEAR,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE});this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.getFontDesc=function(t){var e=this.textStyle,i=e.fontSize,r=e.fontScale,n=e.fontFamily,a=e.textWeight,s=e.fontStyle,o=(t||i*r).toString()+"px ";return mc.includes(n)?o+=n:o+='"'+n+'"',a!==me.normal&&(o=a+" "+o),s!==ve.normal&&(o=s+" "+o),o},e.setupOutline=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.outlineWidth,n=i[0],a=i[1],s=i[2],o=i[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*a+", "+255*s+", "+o+")",t.lineWidth=2*r)},e.setupShadow=function(){var t=this.context,e=this.textStyle,i=e.outlineColor,r=e.shadowBlur,n=e.shadowOffsetX,a=e.shadowOffsetY,s=i[0],o=i[1],u=i[2],h=i[3];t&&(t.shadowColor="rgba("+255*s+", "+255*o+", "+255*u+", "+h+")",t.shadowBlur=r,t.shadowOffsetX=n,t.shadowOffsetY=-a)},t}();It(yc,[gc]);var xc=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Qt),bc=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Be),Tc=function(t){function e(){return t.apply(this,arguments)}return $t(e,t),e}(Be);S([ze()],Tc.prototype,"buffer",void 0),Tc=S([ke(Ae.BinaryAsset)],Tc);var Ec=function(){function t(){}return t.serialize=function(e,i){e.toData(),i||(i={});var r=Ue(e);if(r)for(var n,a=w(Object.keys(r));!(n=a()).done;){var s=n.value,o=e[s];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(o)?i[s]=o:xt(o)?(i[s]||(i[s]=[]),t.serializeArrayProperty(o,i[s],0)):Be.is(o)?i[s]={id:o.getInstanceId()}:Tt(o)&&(i[s]||(i[s]={}),t.serializeObjectProperty(o,i[s],0))}for(var u,h=w(Object.keys(e.defination));!(u=h()).done;){var l=u.value,c=e.defination[l];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(c)?i[l]=c:xt(c)?(i[l]||(i[l]=[]),t.serializeArrayProperty(c,i[l],0)):Be.is(c)?i[l]={id:c.getInstanceId()}:Tt(c)&&(i[l]||(i[l]={}),t.serializeObjectProperty(c,i[l],0))}return i},t.deserialize=function(e,i){i.defination=e;var r=Ue(i),n=i.engine;if(r)for(var a,s=w(Object.keys(r));!(a=s()).done;){var o=a.value,u=e[o];if(void 0!==u){var h=r[o].type;i[o]=t.deserializeProperty(u,n,0,h)}}i.fromData(i.defination)},t.checkTypedArray=function(t){return C(t,Int8Array)||C(t,Uint8Array)||C(t,Uint8ClampedArray)||C(t,Int16Array)||C(t,Uint16Array)||C(t,Int32Array)||C(t,Uint32Array)||C(t,Float32Array)||C(t,Float64Array)||C(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(Tt(t)&&1===Object.keys(t).length&&"id"in t&&gt(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return Tt(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return _t(t)||C(t,l)},t.deserializeProperty=function(e,i,r,n,a){if(void 0===a&&(a=!0),!(r>14)){if(xt(e)){for(var s,o=[],u=w(e);!(s=u()).done;){var h=s.value;o.push(t.deserializeProperty(h,i,r+1,n,a))}return o}if(t.checkDataPath(e)){var l=i.findObject(e);return a?l:e}if(Et(e)){var c;c=n?new n:{};for(var f,d=w(Object.keys(e));!(f=d()).done;){var p=f.value;c[p]=t.deserializeProperty(e[p],i,r+1,void 0,a)}return c}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.serializeObjectProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i={});for(var n,a=w(Object.keys(e));!(n=a()).done;){var s=n.value,o=e[s];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?i[s]=o:xt(o)?(i[s]||(i[s]=[]),t.serializeArrayProperty(o,i[s],r+1)):Be.is(o)?i[s]={id:o.getInstanceId()}:Tt(o)&&(i[s]||(i[s]={}),t.serializeObjectProperty(o,i[s],r+1))}}},t.serializeArrayProperty=function(e,i,r){if(r>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{i||(i=[]);for(var n=0;n<e.length;n++){var a=e[n];"number"==typeof a||"string"==typeof a||"boolean"==typeof a||t.checkTypedArray(e)?i[n]=a:xt(a)?(i[n]||(i[n]=[]),t.serializeArrayProperty(a,i[n],r+1)):Be.is(a)?i[n]={id:a.getInstanceId()}:Tt(a)&&(i[n]||(i[n]={}),t.serializeObjectProperty(a,i[n],r+1))}}},t}(),_c=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(t){if(!t)return null;var e,i=t.id,r=this.findData(i);if(r){switch(r.dataType){case Ae.Material:e=On.create(this.engine);break;case Ae.Geometry:e=Wn.create(this.engine);break;case Ae.Texture:e=fn.create(this.engine);break;default:var n=De(r.dataType);n&&(e=new n(this.engine))}if(e)return e.setInstanceId(r.id),this.engine.addInstance(e),Ec.deserialize(r,e),e;console.error("Constructor for DataType: "+r.dataType+" not found.")}else console.error("Object data with uuid: "+i+" not found.")},e.findData=function(t){return this.engine.jsonSceneData[t]},t}(),wc=function(){function t(){}return t.prototype.loadGUID=function(t){return E((function(){return I(this,(function(t){return[2,void 0]}))}))()},t}();function Cc(t,e){if(!t.includes(e))return t.push(e),!0}function Ac(t){if(Number.isFinite(t))return[ee.CONSTANT,t];if(t){var e=t[0],i=t[1];if(Array.isArray(e))return;if("static"===e||e===ee.CONSTANT)return[ee.CONSTANT,t[1]];if("lines"===e)return[ee.LINE,t[1]];if(e===ee.LINE){var r=i.map((function(t){return[ie.LINE,t]}));return[ee.BEZIER_CURVE,r]}return"curve"===e||e===ee.CURVE?[ee.BEZIER_CURVE,Yc(i)]:t}}function Sc(t,e){return Array.isArray(t)&&"random"===t[0]?[ee.CONSTANT,t[1][e]]:Ac(t)}function Ic(t){return t&&"color"===t[0]?Nc(t[1],!0):[1,1,1,1]}function Rc(t,e){if(t)return"colors"===t[0]?[ee.COLORS,t[1].map((function(t){return Nc(t,e)}))]:"gradient"===t[0]?Mc(t[1],e):"color"===t[0]?[ee.RGBA_COLOR,Nc(t[1],e)]:t}function Oc(t){return t&&"random"===t[0]?[ee.RANDOM,t[1]]:Ac(t)}function Mc(t,e){if(t){var i=[];return Object.getOwnPropertyNames(t).forEach((function(r){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(r),a=Nc(t[r],e);i.push([n,a[0],a[1],a[2],a[3]])})),i=i.sort((function(t,e){return t[0]-e[0]})),[ee.GRADIENT_COLOR,i]}}function Nc(t,e){var i;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var r=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(r){var n=+r[4];i=[+r[1],+r[2],+r[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?i=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(i=[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),255])}else C(t,Array)&&(i=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(i=Pc(i)),i}function Pc(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Fc(t,e){return Array.isArray(t)?t[0]===ee.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Mc(t[1],e):Mc(t,e)}function Lc(t){if(t){if(3===t.length)return[ee.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===ee.BEZIER_PATH||e===ee.LINEAR_PATH){var i=t[1],r=i[0],n=i[1],a=i[2],s=Yc(r);if(!a){a=[];for(var o=0;o<n.length;o++){var u=n[o].slice();0===o?a.push(u):o<n.length-1?(a.push(u),a.push(u)):a.push(u)}}return[ee.BEZIER_CURVE_PATH,[s,n,a]]}return t}}function Vc(t){for(var e,i=w(Object.keys(t));!(e=i()).done;){var r=e.value;t[r]=Number(t[r])}return t}function Dc(t){for(var e,i=w(Object.keys(t));!(e=i()).done;){var r=e.value;void 0===t[r]&&delete t[r]}return t}var kc,zc=Math.cos,Uc=Math.sin,Bc=Math.PI/180,Gc=180/Math.PI;function jc(t,e){return t?[t[0]-.5,.5-t[1]]:e?Hc[e]:[0,0]}var Xc,Hc=((kc={})[Zt.PARTICLE_ORIGIN_CENTER]=[0,0],kc[Zt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],kc[Zt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],kc[Zt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],kc[Zt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],kc[Zt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],kc[Zt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],kc[Zt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],kc[Zt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],kc);function Wc(t,e,i,r){var n=i[0],a=i[1],s=r[0],o=s-n;return[[n+(s-n)/3,a+(t*=o)/3],[s-(s-n)/3,r[1]-(e*=o)/3]]}function Yc(t){for(var e=-1e6,i=1e6,r=0;r<t.length;r++)e=Math.max(e,t[r][1]),i=Math.min(i,t[r][1]);for(var n=[[t[0][0],t[0][1]]],a=0;a<t.length-1;a++){var s=t[a][3]*(e-i),o=t[a+1][2]*(e-i),u=[t[a][0],t[a][1]],h=[t[a+1][0],t[a+1][1]];if(u[0]!=h[0]){var l=Wc(s,o,u,h),c=l[0],f=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([f[0],f[1],h[0],h[1]])}else n[n.length-1].push(h[0]),n[n.length-1].push(h[1])}return n.map((function(t,e){return 0===e?[ie.EASE_OUT,t]:e===n.length-1?[ie.EASE_IN,t]:[ie.EASE,t]}))}function Zc(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===Wt.null&&t.endBehavior===re.destroy&&(t.endBehavior=re.freeze)}))})),t.version=Dt["2_1"],t}var qc=new Map,Kc=new Map;function Qc(t){for(var e,i=w(t.components);!(e=i()).done;){var r=e.value;if(r.dataType===Ae.ShapeComponent){var n=r;if(n.type===be.Custom){var a,s=n;(null==(a=s.shapes)?void 0:a.length)>0&&s.shapes[0].fill&&(s.fill=s.shapes[0].fill);for(var o,u=new Array(s.easingIns.length),h=new Array(s.easingOuts.length).fill(!1),l=w(s.shapes);!(o=l()).done;)for(var c,f=w(o.value.indexes);!(c=f()).done;){var d=c.value,p=s.points[d.point],m=s.easingIns[d.easingIn],v=s.easingOuts[d.easingOut];u[d.easingIn]||(m.x-=p.x,m.y-=p.y,u[d.easingIn]=!0),h[d.easingOut]||(v.x-=p.x,v.y-=p.y,h[d.easingOut]=!0)}}}}return t.version=Dt["3_2"],t}function Jc(t){qc.clear(),Kc.clear();for(var e,i=t.compositions,r=t.items,n=w(t.components);!(e=n()).done;){var a=e.value;qc.set(a.id,a)}for(var s,o=w(r);!(s=o()).done;){var u=s.value;Kc.set(u.id,u)}for(var h,l=w(i);!(h=l()).done;){tf(h.value)}return t.version=Dt["3_3"],t}function $c(t){var e;null==(e=t.plugins)||e.forEach((function(e,i){"richtext"===e&&(t.plugins[i]="rich-text")}));for(var i,r=w(t.items);!(i=r()).done;){var n=i.value;if(n.type===Wt.sprite){var a=qc.get(n.components[0].id);if(a){var s=a.renderer.shape,o=void 0;o=Number.isInteger(s)?t.shapes[s]:s,a.renderer.shape=o}}}for(var u,h=t.compositionId,l={},c=w(t.compositions);!(u=c()).done;){var f=u.value,d=At();l[f.id]=d,f.id===h&&(t.compositionId=d),f.id=d;var p={id:At(),dataType:"CompositionComponent",items:f.items,timelineAsset:f.timelineAsset,sceneBindings:f.sceneBindings};f.timelineAsset=void 0,f.sceneBindings=void 0,f.components=[{id:p.id}],t.components.push(p)}for(var m,v=w(t.items);!(m=v()).done;){var y=m.value;if(y.content){var g=y.content.options;g&&void 0!==g.refId&&(g.refId=l[g.refId])}}return t.version=Dt["3_4"],t}function tf(t){for(var e,i=w(t.items);!(e=i()).done;){var r=e.value,n=Kc.get(r.id);if(!n)return;if(n.type===Wt.sprite||n.type===Wt.particle||n.type===Wt.spine||n.type===Wt.text||n.type===Wt.richtext||n.type===Wt.video||n.type===Wt.shape){var a=qc.get(n.components[0].id);a&&ef(a)}}}function ef(t){var e=t.renderer,i=null==e?void 0:e.maskMode;i&&i!==Sr.NONE&&(i===Sr.MASK?(t.mask={isMask:!0},Xc=t.id):i!==Bt.OBSCURED&&i!==Bt.REVERSE_OBSCURED||(t.mask={inverted:i===Bt.REVERSE_OBSCURED,reference:{id:Xc}}))}function rf(t){for(var e,i,r,n=function(){var t=u.value;t.endBehavior!==ge&&t.endBehavior!==ye||(t.endBehavior=re.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===Wt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,i=w(t.items);!(e=i()).done;){var r=e.value;h[r.id]=At(),r.oldId=r.id,r.id=h[r.id],l[r.id]=r}t.items.forEach((function(e,i){if(e.parentId)if(e.parentId.includes("^")){var r=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=h[r]+"^"+n}else e.parentId=h[e.parentId];a.items.push(e),t.items[i]={id:e.id}}));var n=ri({},t,{timelineAsset:{id:""},sceneBindings:[]});a.compositions.push(n),function(t,e,i){for(var r,n=[],a=[],s=[],o={tracks:[],id:At(),dataType:"TimelineAsset"},u=w(t.items);!(r=u()).done;){var h=e[r.value.id],l=[],c={id:At(),dataType:"ActivationPlayableAsset"};s.push(c);var f={id:At(),dataType:"ActivationTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:c.id}}]};if(l.push({id:f.id}),a.push(f),h.type!==Wt.particle){var d={id:At(),dataType:"TransformPlayableAsset",sizeOverLifetime:h.content.sizeOverLifetime,rotationOverLifetime:h.content.rotationOverLifetime,positionOverLifetime:h.content.positionOverLifetime};s.push(d);var p={id:At(),dataType:"TransformTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:d.id}}]};l.push({id:p.id}),a.push(p)}if(h.type===Wt.sprite||h.type===Wt.text){var m={id:At(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:h.content.colorOverLifetime};s.push(m);var v={id:At(),dataType:"SpriteColorTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:m.id}}]};l.push({id:v.id}),a.push(v)}if(h.type===Wt.composition){var y={id:At(),dataType:"SubCompositionPlayableAsset"};s.push(y);var g={id:At(),dataType:"SubCompositionTrack",children:[],clips:[{start:h.delay,duration:h.duration,endBehavior:h.endBehavior,asset:{id:y.id}}]};l.push({id:g.id}),a.push(g)}var x={id:At(),dataType:"ObjectBindingTrack",children:l,clips:[]};a.push(x),o.tracks.push({id:x.id}),n.push({key:{id:x.id},value:{id:h.id}})}for(var b,T=[],E=w(a);!(b=E()).done;){var _=b.value;T.push({id:_.id})}t.timelineAsset={id:o.id},t.sceneBindings=n,i.miscs.push(o);for(var C,A=w(a);!(C=A()).done;){var S=C.value;i.miscs.push(S)}for(var I,R=w(s);!(I=R()).done;){var O=I.value;i.miscs.push(O)}}(n,l,a)},a=ri({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),s=w(a.images);!(i=s()).done;){i.value.id=At()}if(null!=(e=a).textures||(e.textures=[]),a.textures.forEach((function(t){var e;t.id=At(),t.dataType=Ae.Texture,t.source={id:null==(e=a.images[t.source])?void 0:e.id}})),a.textures.length<a.images.length)for(var o=a.textures.length;o<a.images.length;o++)a.textures.push({id:At(),dataType:Ae.Texture,source:{id:a.images[o].id},flipY:!0});t.bins&&(r=t.bins,a.bins=r.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:At()}})));for(var u,h={},l={},c=w(t.compositions);!(u=c()).done;)n();for(var f,d=w(a.items);!(f=d()).done;){var p=f.value;if(p.content){if(p.content.renderer&&void 0!==p.content.renderer.texture){var m=p.content.renderer.texture;p.content.renderer.texture={id:a.textures[m].id}}if(p.content.trails&&void 0!==p.content.trails.texture){var v=p.content.trails.texture;p.content.trails.texture={id:a.textures[v].id}}}if(p.transform){var y,g,x,b=[].concat(null!=(y=p.transform.position)?y:[0,0,0]),T=[].concat(null!=(g=p.transform.rotation)?g:[0,0,0]),E=[].concat(null!=(x=p.transform.scale)?x:[1,1,1]);if(Object.assign(p,{transform:{position:{x:b[0],y:b[1],z:b[2]},eulerHint:{x:T[0],y:T[1],z:T[2]},scale:{x:E[0],y:E[1],z:E[0]}}}),p.type===Wt.sprite&&(p.transform.size={x:E[0],y:E[1]},p.transform.scale={x:1,y:1,z:1}),p.type===Wt.sprite){var _=p.content;_.renderer||(_.renderer={});var C,A,S,I,R=_.renderer,O=jc(R.anchor,R.particleOrigin),M=p.transform.size;if(!R.anchor&&void 0!==R.particleOrigin)p.transform.position.x+=-O[0]*(null!=(C=null==M?void 0:M.x)?C:1),p.transform.position.y+=-O[1]*(null!=(A=null==M?void 0:M.y)?A:1);p.transform.anchor={x:O[0]*(null!=(S=null==M?void 0:M.x)?S:1),y:O[1]*(null!=(I=null==M?void 0:M.y)?I:1)}}}if(p.type===Wt.particle){var N=p.content;N.renderer||(N.renderer={});var P=N.renderer;N.renderer.anchor=jc(P.anchor,P.particleOrigin)}if(p.type===Wt.camera&&p.content.positionOverLifetime&&0!==Object.keys(p.content.positionOverLifetime).length&&(p.content.positionOverLifetime.asMovement=!0),void 0!==p.pn){var F=p.pn,L=t.plugins,V=void 0===L?[]:L;void 0!==F&&Number.isInteger(F)&&(p.pluginName=V[F])}switch("editor-gizmo"===p.pluginName&&(p.type="editor-gizmo"),"orientation-transformer"===p.pluginName&&(p.type="orientation-transformer"),p.content.options.target&&"editor-gizmo"===p.pluginName&&(p.content.options.target=h[p.content.options.target]),p.type===Wt.spine&&t.spines&&0!==t.spines.length&&af(t.spines[p.content.options.spine],p.content,a),p.type!==Wt.sprite&&p.type!==Wt.particle&&p.type!==Wt.mesh&&p.type!==Wt.skybox&&p.type!==Wt.light&&"camera"!==p.type&&p.type!==Wt.tree&&p.type!==Wt.interact&&p.type!==Wt.camera&&p.type!==Wt.text&&p.type!==Wt.spine&&"editor-gizmo"!==p.type&&"orientation-transformer"!==p.type||(p.components=[],a.components.push(p.content),p.content.id=At(),p.content.item={id:p.id},p.dataType=Ae.VFXItemData,p.components.push({id:p.content.id})),p.type!==Wt.null&&p.type!==Wt.composition||(p.components=[],p.dataType=Ae.VFXItemData),p.type){case Wt.sprite:p.content.dataType=Ae.SpriteComponent;break;case Wt.particle:p.content.dataType=Ae.ParticleSystem;break;case Wt.mesh:p.content.dataType=Ae.MeshComponent;break;case Wt.skybox:p.content.dataType=Ae.SkyboxComponent;break;case Wt.light:p.content.dataType=Ae.LightComponent;break;case"camera":p.content.dataType=Ae.CameraComponent;break;case"editor-gizmo":p.content.dataType="GizmoComponent";break;case"orientation-transformer":p.content.dataType="OrientationComponent";break;case Wt.tree:p.content.dataType=Ae.TreeComponent;break;case Wt.interact:p.content.dataType=Ae.InteractComponent;break;case Wt.camera:p.content.dataType=Ae.CameraController;break;case Wt.text:p.content.dataType=Ae.TextComponent;break;case Wt.spine:p.content.dataType=Ae.SpineComponent}}return a.version=Dt["3_0"],a}function nf(t){if(t)for(var e,i=w(Object.keys(t));!(e=i()).done;){var r=e.value,n=t[r],a=Array.isArray(n);a&&2===n.length&&Array.isArray(n[1])?t[r]="path"===r?Lc(n):Ac(n):a||"object"!=typeof n||nf(n)}}function af(t,e,i){e.resource={atlas:{bins:{id:i.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:i.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map((function(t){return{id:i.textures[t].id}}))}}function sf(t,e){var i,r=t.options,n=t.velocityOverLifetime||{},a={path:Lc(null==(i=t.transform)?void 0:i.path),gravity:r.gravity,gravityOverLifetime:Ac(r.gravityModifier),direction:r.direction,startSpeed:r.startSpeed,asMovement:n.asMovement,linearX:Ac(n.linearX),linearY:Ac(n.linearY),linearZ:Ac(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Ac(n.orbitalX),orbitalY:Ac(n.orbitalY),orbitalZ:Ac(n.orbitalZ),speedOverLifetime:Ac(n.speedOverLifetime)};Dc(a);var s={options:{startColor:Ic(r.startColor)},positionOverLifetime:a};r.startSize&&(e.scale=[r.startSize,r.startSize/(r.sizeAspect||1),1]),r.startRotation&&(e.rotation?e.rotation[2]+=r.startRotation:e.rotation=[0,0,r.startRotation]);var o=t.rotationOverLifetime;if(o){var u=s.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=Ac(o.x),u.y=Ac(o.y),u.z=Ac(o.z)):u.z=Ac(o.angularVelocity)}var h=t.colorOverLifetime;if(h){var l=s.colorOverLifetime={opacity:Ac(h.opacity)};h.color&&(l.color=Fc(h.color))}var c=t.sizeOverLifetime;return c&&(s.sizeOverLifetime={separateAxes:c.separateAxes,size:Ac(c.size),x:Ac(c.x),y:Ac(c.y),z:Ac(c.z)}),s}var of="2.6.5",uf=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,hf=/^(\d+)\.(\d+)$/,lf=!1;function cf(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e,i;(function(t){var e=t.playerVersion||{},i=e.web,r=void 0===i?"":i;if(r){var n,a,s=null!=(n=uf.exec(r))?n:[],o=null!=(a=uf.exec(of))?a:[],u=s[1],h=s[2],l=o[1],c=o[2];return Number(l)<Number(u)||Number(l)===Number(u)&&Number(c)<Number(h)}return!1})(t)&&console.warn("The JSON need higher than "+(null==(e=t.playerVersion)?void 0:e.web)+" runtime version(current: "+of+"). Some features may not work as expected.");if(function(t){var e,i=null==(e=t.version)?void 0:e.split(".");!i||Number(i[0])>2||2===Number(i[0])&&Number(i[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==Wt.mesh&&t.type!==Wt.light||(t.endBehavior=1===t.endBehavior?re.destroy:t.endBehavior)}))}))}(t),uf.test(t.version))return lf="0"===(null==(i=/^(\d+)/.exec(t.version))?void 0:i[0]),$c(Jc(Qc(rf(Zc(function(t){var e;ff=Dt["1_0"];var i=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(ff=Dt["1_3"]);var r,n=(t.requires||[]).slice(),a=t.images.map((function(e,i){return df(e,i,t.imageTags||[])})),s=t.textures||a.map((function(t,e){return{source:e,flipY:!0}})),o={plugins:i,shapes:t.shapes||[],type:"ge",version:ff,playerVersion:null!=(r=t.playerVersion)?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return pf(t,{plugins:i,requires:n})})),images:a,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:s,bins:(t.bins||[]).slice()};t._textures&&(o._textures=t._textures);return o}(t))))));lf=!1;var r=hf.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]);if(n)return(n<2||2===n&&a<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,i=w(t.items);!(e=i()).done;)nf(e.value.content)})),t}(t)),n<3&&(t=rf(Zc(t))),r=hf.exec(t.version)||[],n=Number(r[1]),a=Number(r[2]),n<4&&(a<2&&(t=Qc(t)),a<3&&(t=Jc(t)),a<4&&(t=$c(t))),t;throw new Error("Invalid JSON version: "+t.version+".")}var ff=Dt["1_0"];function df(t,e,i){var r=i[e];if("string"==typeof t)return{id:At(),renderLevel:r,url:t};if(t.template)return{id:At(),url:t.url,template:t.template,webp:t.webp,renderLevel:r};if(t.compressed)return{id:At(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:r};if(t.url)return{id:At(),url:t.url,webp:t.webp,renderLevel:r};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function pf(t,e){var i;void 0===e&&(e={});var r={id:t.id+"",camera:ri({clipMode:xe},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return gf(t,e)})),name:t.name},n=t.startTime||t.st;n&&(r.startTime=n);var a=null==(i=t.meta)?void 0:i.previewSize;return a&&a[0]===a[1]&&0===a[0]&&(a=void 0),a&&(r.previewSize=a),r}var mf,vf=[0,0,0,1],yf=.5;function gf(t,e){var i;void 0===e&&(e={});var r,n,a,s,o,u,h=Wt.base,l=t.endBehavior,c=NaN;if(t.content?(h=t.type||Wt.plugin,u=t.pn,o=t.pluginName,a=t.content,n=t.content,isNaN(u)&&!o&&(o=a.options.type),t.duration&&(c=t.duration),r=t.transform||y(n.transform)):t.particle?(h=Wt.particle,r=y((n=t.particle).transform,lf,!0),a=function(t){var e=t.options,i=t.transform,r={type:Gt.NONE};if(t.shape){var n,a=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(r=ri({},t.shape,{type:Gt[a]}),t.shape.upDirection){var s=t.shape.upDirection,o=s[0],u=s[1],h=s[2];0===o&&0===u&&0===h&&delete r.upDirection}}e.startTurbulence&&(r.turbulenceX=Oc(e.turbulenceX),r.turbulenceY=Oc(e.turbulenceY),r.turbulenceZ=Oc(e.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return Vc(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return Vc(t)}))),l.rateOverTime&&(l.rateOverTime=Oc(l.rateOverTime));var c={renderer:t.renderer,shape:r,splits:t.splits,emission:l,options:{startLifetime:Oc(e.startLifetime),start3DSize:!!e.start3DSize,startSize:Oc(e.startSize),startSizeX:Oc(e.startSizeX),startSizeY:Oc(e.startSizeY),sizeAspect:Oc(e.sizeAspect),maxCount:e.maxCount,startDelay:Oc(e.startDelay),startColor:Rc(e.startColor,!0),startRotationZ:Oc(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(c.options.startRotationX=Oc(e.startRotationX),c.options.startRotationY=Oc(e.startRotationY)),i&&i.path&&(c.emitterTransform={path:Lc(i.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?c.sizeOverLifetime={separateAxes:!0,x:Oc(f.x),y:Oc(f.y)}:c.sizeOverLifetime={size:Oc(f.size)});var d=t.velocityOverLifetime||{},p=d.speedOverLifetime;p=p?Ac(p):void 0,c.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:Ac(e.gravityModifier),startSpeed:Oc(e.startSpeed),speedOverLifetime:p,asMovement:d.asMovement,linearX:Oc(d.linearX),linearY:Oc(d.linearY),linearZ:Oc(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Oc(d.orbitalX),orbitalY:Oc(d.orbitalY),orbitalZ:Oc(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Ac(d.forceCurve)},Dc(c.positionOverLifetime);var m=t.rotationOverLifetime;m&&(c.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:Oc(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(c.rotationOverLifetime.y=Ac(m.y),c.rotationOverLifetime.x=Ac(m.x)));var v=t.colorOverLifetime;if(v){var y=c.colorOverLifetime={opacity:Ac(v.opacity)};v.color&&(y.color=Fc(v.color))}var g=t.textureSheetAnimation;g&&(c.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:Ac(g.cycles),animationDelay:Sc(g.animationDelay,0),animationDuration:Sc(g.animationDuration,0)});var x=t.trails;x&&(c.trails={lifetime:Oc(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:Ac(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Fc(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Fc(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:Oc(x.opacityOverLifetime)}),c.trails&&Dc(c.trails);var b=t.interaction;return b&&(c.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),c}(n)):t.sprite?(h=Wt.sprite,a=function(t,e){var i=sf(t,e),r=t.textureSheetAnimation;return r&&(i.textureSheetAnimation={row:r.row,col:r.col,total:r.total||void 0,animate:r.animate}),i.renderer=t.renderer,t.splits&&(i.splits=t.splits),t.interaction&&(i.interaction=t.interaction),i}(n=t.sprite,r=y(n.transform,!1,!0))):t.cal?(h=Wt.null,a=sf(n=t.cal,r=y(n.transform,!1,!0))):t.ui?(h=Wt.interact,r=y((n=t.ui).transform),a=function(t){var e,i=t.options;switch(i.type){case"click":e={type:Xt.CLICK,showPreview:i.showPreview,previewColor:i.previewColor&&Ic(i.previewColor),behavior:i.behavior||Ht.NOTIFY};break;case"drag":e={type:Xt.DRAG,enableInEditor:!!i.enableInEditor,dxRange:i.dxRange,dyRange:i.dyRange,target:i.target};break;case"message":e={type:Xt.MESSAGE}}return{options:e}}(n),r.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=Wt.camera,r=y(n.transform),a=function(t){var e,i=t.options,r={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var a,s={path:Lc(null==(a=t.transform)?void 0:a.path),linearX:Ac(null==n?void 0:n.translateX),linearY:Ac(null==n?void 0:n.translateY),linearZ:Ac(null==n?void 0:n.translateZ)};Dc(s),r.positionOverLifetime=s}var o=t.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:Ac(null==o?void 0:o.rotateX),y:Ac(null==o?void 0:o.rotateY),z:o.separateAxes?Ac(null==o?void 0:o.rotateZ):Ac(o.rotation)};Dc(u),r.rotationOverLifetime=u}return r}(n))),null==(i=a.renderer)?void 0:i.anchor){var f=new Float32Array(a.renderer.anchor);f[0]==yf&&f[1]==yf?delete a.renderer.anchor:e.requires&&Cc(e.requires,"anchor")}if(n){var d,p,m=null==(d=n.options)?void 0:d.looping;if(m)l=Array.isArray(m)?m[1]?re.restart:re.destroy:re.restart;else l=l||(null==n||null==(p=n.options)?void 0:p.endBehavior)||re.destroy;n.options.renderLevel&&(s=n.options.renderLevel),isNaN(c)&&(c=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:c,id:t.id+"",transform:r,endBehavior:l,renderLevel:s,content:a};return o?e.plugins?(Cc(e.plugins,o),v.pn=e.plugins.indexOf(o)):v.pluginName=o:Number.isInteger(u)&&(v.pn=u),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,i){if(t){var r={},n=t.rotation;if(n&&(r.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],i)){var a=(s=vf,o=r.rotation[0],u=r.rotation[1],h=r.rotation[2],l=zc(o*Bc/2),c=zc(u*Bc/2),f=zc(h*Bc/2),d=Uc(o*Bc/2),p=Uc(u*Bc/2),m=Uc(h*Bc/2),s[0]=d*c*f+l*p*m,s[1]=l*p*f-d*c*m,s[2]=l*c*m+d*p*f,s[3]=l*c*f-d*p*m,s);r.rotation=function(t,e){var i,r,n,a=e[0],s=e[1],o=e[2],u=e[3],h=a+a,l=s+s,c=o+o,f=a*h,d=s*h,p=s*l,m=o*c,v=u*c,y=1-p-m,g=d-v,x=d+v,b=1-f-m,T=o*h-u*l,E=o*l+u*h,_=1-f-p;return t[1]=Math.asin((r=-1,(i=-T)>(n=1)?n:i<r?r:i))*Gc,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Gc,t[2]=Math.atan2(x,y)*Gc):(t[0]=0,t[2]=Math.atan2(-g,b)*Gc),t}([],a)}return t.position&&(r.position=t.position),Array.isArray(t.scale)&&(r.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),r}var s,o,u,h,l,c,f,d,p,m;return{}}}var xf,bf=((mf={})[kt.S]=[kt.S,kt.BPlus,kt.APlus],mf[kt.A]=[kt.A,kt.BPlus,kt.APlus],mf[kt.B]=[kt.B,kt.BPlus],mf);function Tf(t,e){if(!t||!e)return!0;var i=bf[e];return!!i&&i.includes(t)}function Ef(t,e){var i,r,n=null!=(r=null==t?void 0:t.background)?r:{},a=n.name,s=n.url;return a&&(e&&e[a]?i=e[a]:s&&(i=s)),i}function _f(t,e,i){return wf.apply(this,arguments)}function wf(){return(wf=E((function(t,e,i){var r,n;return I(this,(function(a){switch(a.label){case 0:return"string"!=typeof t?[3,2]:[4,Kr(t)];case 1:return r=a.sent(),[3,3];case 2:r=t,a.label=3;case 3:if(!r)throw new Error("Image not provided.");if(!e)return[2,r];if(n=Ef(e,i)){if(gt(n)&&n!==r.src)return[2,Kr(n)];if(C(n,l))return[2,n]}return[2,r]}}))}))).apply(this,arguments)}!function(t){t.isJSONObject=function(t){return Tt(t)&&"jsonScene"in t},t.isURL=function(t){return Tt(t)&&"url"in t},t.isWithOptions=function(t){return Tt(t)&&"options"in t}}(xf||(xf={}));var Cf=1,Af=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new jr),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=Cf++,this.timers=[],this.updateOptions(t)}var e=t.prototype;return e.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,i=void 0===e?10:e;this.timeout=i},e.loadScene=function(t,e,i){var n=this;return E((function(){var a,s,o,u,h,l,f,p,m,y,g,x,b;return I(this,(function(T){return s=gt(t)?t:n.id,o=d.now(),u=[],h=null==e?void 0:e.engine.gpuCapability,f=null!=(l=null==h?void 0:h.detail.compressedTexture)?l:za.NONE,p={},y=!1,g=new Promise((function(t,e){m=r.setTimeout((function(){y=!0,n.removeTimer(m);var t=d.now()-o;e(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+u.join(" ")+", url: "+s+"."))}),1e3*n.timeout),n.timers.push(m)})),x=E((function(t,e){var i,r,n,a;return I(this,(function(s){switch(s.label){case 0:if(y)return[3,4];i=d.now(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e()];case 2:return r=s.sent(),n=d.now()-i,u.push("["+t+": "+n.toFixed(2)+"]"),p[t]=n,[2,r];case 3:throw a=s.sent(),new Error("Load error in "+t+", "+a+".");case 4:throw new Error("Load canceled.")}}))})),b=E((function(){var e,h,l,y,g,b,T,E,_,w,C,A,S,R;return I(this,(function(I){switch(I.label){case 0:return gt(t)?(h=new c(t,v.href).href,n.baseUrl=h,[4,x("loadJSON",(function(){return n.loadJSON(h)}))]):[3,2];case 1:return gt(a=I.sent())&&(a=JSON.parse(a)),[3,3];case 2:a=t,n.baseUrl=v.href,I.label=3;case 3:return xf.isJSONObject(a)?(e=ri({},a),[3,9]):[3,4];case 4:return[4,x("processJSON",(function(){return n.processJSON(a)}))];case 5:return l=I.sent(),y=l.jsonScene,g=l.pluginSystem,b=y.bins,T=void 0===b?[]:b,E=y.images,_=y.fonts,[4,Promise.all([x("processBins",(function(){return n.processBins(T)})),x("processImages",(function(){return n.processImages(E,f)})),x("plugin:processAssets",(function(){return n.processPluginAssets(y,g,i)})),x("processFontURL",(function(){return n.processFontURL(_)}))])];case 6:return w=I.sent(),C=w[0],A=w[1],[4,x("processTextures",(function(){return n.processTextures(A,C,y)}))];case 7:return S=I.sent(),e={timeInfos:p,url:t,renderLevel:n.options.renderLevel,storage:{},pluginSystem:g,jsonScene:y,bins:C,textureOptions:S,textures:[],images:A,assets:n.assets},[4,x("plugin:prepareResource",(function(){return g.loadResources(e,n.options)}))];case 8:I.sent(),I.label=9;case 9:return R=d.now()-o,vt.info("Load asset: totalTime: "+R.toFixed(4)+"ms "+u.join(" ")+", url: "+s+"."),r.clearTimeout(m),n.removeTimer(m),e.totalTime=R,e.startTime=o,e.timeInfos=p,[2,e]}}))})),[2,Promise.race([g,b()])]}))}))()},e.getAssets=function(){return this.assets},e.processJSON=function(t){var e=this;return E((function(){var i,r,n;return I(this,(function(a){switch(a.label){case 0:return i=cf(t),r=i.plugins,[4,(n=new Ft(void 0===r?[]:r)).processRawJSON(i,e.options)];case 1:return a.sent(),[2,{jsonScene:i,pluginSystem:n}]}}))}))()},e.processBins=function(t){var e=this;return E((function(){var i,r,n;return I(this,(function(a){return i=e.options.renderLevel,r=e.baseUrl,n=t.map((function(n){if(C(n,ArrayBuffer))return n;if(Tf(n.renderLevel,i))return e.loadBins(new c(n.url,r).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(n)]}))}))()},e.processFontURL=function(e){var r=this;return E((function(){var n;return I(this,(function(a){return e?(n=e.map(E((function(e){var n,a,s;return I(this,(function(o){switch(o.label){case 0:if(!e.fontURL||t.fontCache.has(e.fontFamily))return[3,4];lt(e.fontFamily)||console.warn("Risky font family: "+e.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),n=new c(e.fontURL,r.baseUrl).href,[4,(s=new FontFace(null!=(a=e.fontFamily)?a:"","url("+n+")")).load()];case 2:return o.sent(),i.fonts.add(s),t.fontCache.add(e.fontFamily),[3,4];case 3:return o.sent(),vt.warn("Invalid font family or font source: "+JSON.stringify(e.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(n)]):[2]}))}))()},e.processImages=function(t,e){void 0===e&&(e=0);var i=this;return E((function(){var r,n,a,s,o,u,h,f;return I(this,(function(d){switch(d.label){case 0:return r=i.options,n=r.useCompressedTexture,a=r.variables,s=r.disableWebP,o=r.disableAVIF,u=i.baseUrl,h=t.map(E((function(t,r){var h,f,d,v,y,g,x,b,T,E,_,w,A,S,R,O,M,N,P,F,L;return I(this,(function(r){switch(r.label){case 0:if(h=t.url,f=t.webp,d=t.avif,v=new c(h,u).href,y=!s&&f?new c(f,u).href:void 0,g=!o&&d?new c(d,u).href:void 0,x=t.id,!("template"in t))return[3,8];if(b=t.template,!(T=b.background))return[3,7];E=Ef(b,a),_=T.type===we.video,w=T&&_?rn:Kr,r.label=1;case 1:return r.trys.push([1,6,,7]),[4,an(E,w)];case 2:return C(A=r.sent(),p)?(i.sourceFrom[x]={url:A.src,type:Rr.video},[2,A]):[3,3];case 3:return T&&Array.isArray(E)&&a&&(a[T.name]=A.src),i.sourceFrom[x]={url:A.src,type:Rr.image},[4,_f(A,b,a)];case 4:return[2,r.sent()];case 5:return[3,7];case 6:throw S=r.sent(),new Error("Failed to load. Check the template or if the URL is "+(_?"video":"image")+" type, URL: "+E+", Error: "+(S.message||S)+".");case 7:return[3,9];case 8:if("compressed"in t&&n&&e){if(R=t.compressed,e===za.ASTC?O=R.astc:e===za.PVRTC&&(O=R.pvrtc),O)return M=new c(O,u).href,i.sourceFrom[x]={url:M,type:Rr.compressed},[2,i.loadBins(M)]}else if(C(t,l)||C(t,m)||C(t,p)||C(t,fn))return[2,t];r.label=9;case 9:return g?[4,Zr(v,g)]:[3,11];case 10:return L=r.sent(),[3,13];case 11:return[4,Wr(v,y)];case 12:L=r.sent(),r.label=13;case 13:return P=(N=L).url,F=N.image,i.sourceFrom[x]={url:P,type:Rr.image},[2,F]}}))}))),[4,Promise.all(h)];case 1:return f=d.sent(),i.assignImagesToAssets(t,f),[2,f]}}))}))()},e.processPluginAssets=function(t,e,i){var r=this;return E((function(){var n,a,s,o,u;return I(this,(function(h){switch(h.label){case 0:return[4,e.processAssets(t,i)];case 1:for(n=h.sent(),a=n.reduce((function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t}),{assets:[],loadedAssets:[]}),s=a.assets,o=a.loadedAssets,u=0;u<s.length;u++)r.assets[s[u].id]=o[u];return[2]}}))}))()},e.processTextures=function(t,e,i){var r=this;return E((function(){var n,a,s;return I(this,(function(o){return a=null!=(n=i.textures)?n:t.map((function(t,e){return{source:e}})),s=a.map(E((function(t,n){var a,s,o,u,h,c;return I(this,(function(f){switch(f.label){case 0:if(C(t,fn))return[2,t];if(!("mipmaps"in t))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,on(t,e,r.assets,i.bins)];case 2:return[2,f.sent()];case 3:throw a=f.sent(),new Error("Load texture "+n+" fails, error message: "+a+".");case 4:return s=t.source,o=t.id,h="",Tt(s)?(u=r.assets[s.id],h=s.id,[3,7]):[3,5];case 5:return"string"!=typeof s?[3,7]:[4,Kr(St(s))];case 6:u=f.sent(),f.label=7;case 7:if(u)return c=function(t,e,i){var r={id:i,dataType:Ae.Texture};if(C(t,fn))return ri({},t.source,r);if(C(t,l)||_t(t))return ri({image:t,sourceType:Rr.image,sourceFrom:e,keepImageSource:!0,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR},r);if(C(t,p))return ri({sourceType:Rr.video,video:t,minFilter:Mr.LINEAR,magFilter:Mr.LINEAR},r);if(C(t,ArrayBuffer))return ri({},gn(t),{sourceFrom:e},r);if("width"in t&&"height"in t&&"data"in t)return ri({sourceType:Rr.data,data:t,wrapS:Mr.CLAMP_TO_EDGE,wrapT:Mr.CLAMP_TO_EDGE,minFilter:Mr.NEAREST,magFilter:Mr.NEAREST},r);throw new Error("Invalid texture options.")}(u,r.sourceFrom[h],o),[2,c.sourceType===Rr.compressed?c:ri({},c,t)];throw new Error("Invalid texture source: "+s+".")}}))}))),[2,Promise.all(s)]}))}))()},e.loadJSON=function(t){var e=this;return E((function(){return I(this,(function(i){return[2,new Promise((function(i,r){e.downloader.downloadJSON(t,i,(function(e,i){r("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+i)}))}))]}))}))()},e.loadBins=function(t){var e=this;return E((function(){return I(this,(function(i){return[2,new Promise((function(i,r){e.downloader.downloadBinary(t,i,(function(e,i){r("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+i)}))}))]}))}))()},e.assignImagesToAssets=function(t,e){for(var i=0;i<t.length;i++)this.assets[t[i].id]=e[i]},e.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},e.dispose=function(){this.timers.length&&this.timers.map((function(t){return r.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t}();Af.fontCache=new Set;var Sf,If=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(mn(t))}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var i=t;return xf.isURL(t)&&(xf.isJSONObject(t)||(i=t.url),xf.isWithOptions(t)&&(e=ri({},e,t.options))),{source:i,options:e}},e.updateTextVariables=function(t,e){var i=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===Wt.text||t.type===Wt.richtext){var r=e[t.name];if(!r)return;t.components.forEach((function(t){var e=t.id,n=i.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==Ae.TextComponent&&(null==n?void 0:n.dataType)!==Ae.RichTextComponent||(n.options.text=r)}))}}))},e.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++)t.textures[e]=this.engine.findObject({id:t.textureOptions[e].id}),t.textures[e].initialize()},e.prepareAssets=function(t,e){this.engine.clearResources();for(var i,r=w(Object.keys(e));!(i=r()).done;){var n=i.value,a=e[n],s=new bc(this.engine);s.data=a,s.setInstanceId(n)}this.engine.addPackageDatas(t);for(var o,u=w(this.builtinObjects);!(o=u()).done;){var h=o.value;this.engine.addInstance(h)}},e.createShaderVariant=function(){for(var t,e=w(Object.keys(this.engine.objectInstance));!(t=e()).done;){var i=t.value,r=this.engine.objectInstance[i];C(r,On)&&r.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=w(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),Rf=new Int32Array(2),Of=new Float32Array(Rf.buffer),Mf=new Float64Array(Rf.buffer),Nf=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0];!function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"}(Sf||(Sf={}));var Pf=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new y}var e=t.prototype;return e.clear=function(){this.position_=0},e.bytes=function(){return this.bytes_},e.position=function(){return this.position_},e.setPosition=function(t){this.position_=t},e.capacity=function(){return this.bytes_.length},e.readInt8=function(t){return this.readUint8(t)<<24>>24},e.readUint8=function(t){return this.bytes_[t]},e.readInt16=function(t){return this.readUint16(t)<<16>>16},e.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},e.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},e.readUint32=function(t){return this.readInt32(t)>>>0},e.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},e.readFloat32=function(t){return Rf[0]=this.readInt32(t),Of[0]},e.readFloat64=function(t){return Rf[Nf?0:1]=this.readInt32(t),Rf[Nf?1:0]=this.readInt32(t+4),Mf[0]},e.writeInt8=function(t,e){this.bytes_[t]=e},e.writeUint8=function(t,e){this.bytes_[t]=e},e.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},e.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},e.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},e.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},e.writeFloat32=function(t,e){Of[0]=e,this.writeInt32(t,Rf[0])},e.writeFloat64=function(t,e){Mf[0]=e,this.writeInt32(t,Rf[Nf?0:1]),this.writeInt32(t+4,Rf[Nf?1:0])},e.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t},e.__offset=function(t,e){var i=t-this.readInt32(t);return e<this.readInt16(i)?this.readInt16(i+e):0},e.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},e.__string=function(t,e){t+=this.readInt32(t);var i=this.readInt32(t);t+=4;var r=this.bytes_.subarray(t,t+i);return e===Sf.UTF8_BYTES?r:this.text_decoder_.decode(r)},e.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},e.__indirect=function(t){return t+this.readInt32(t)},e.__vector=function(t){return t+this.readInt32(t)+4},e.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},e.__has_identifier=function(t){if(4!=t.length)throw new Error("FlatBuffers: file identifier must be length 4");for(var e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0},e.createScalarList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n)}return i},e.createObjList=function(t,e){for(var i=[],r=0;r<e;++r){var n=t(r);null!==n&&i.push(n.unpack())}return i},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),Ff=function(){function t(t){var e;this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder,e=t||1024,this.bb=Pf.allocate(e),this.space=e}var e=t.prototype;return e.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null},e.forceDefaults=function(t){this.force_defaults=t},e.dataBuffer=function(){return this.bb},e.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},e.prep=function(e,i){e>this.minalign&&(this.minalign=e);for(var r=1+~(this.bb.capacity()-this.space+i)&e-1;this.space<r+e+i;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(r)},e.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},e.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},e.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},e.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},e.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},e.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},e.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},e.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},e.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},e.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},e.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},e.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},e.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},e.addFieldInt8=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,i){(this.force_defaults||e!==i)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,i){(this.force_defaults||e!=i)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,i){(this.force_defaults||e!=i)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,i){e!=i&&(this.nested(e),this.slot(t))},e.nested=function(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")},e.notNested=function(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")},e.slot=function(t){null!==this.vtable&&(this.vtable[t]=this.offset())},e.offset=function(){return this.bb.capacity()-this.space},e.addOffset=function(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)},e.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},e.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var i=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var r=2*(i+2);this.addInt16(r);var n=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){var s=this.bb.capacity()-this.vtables[e];if(r==this.bb.readInt16(s)){for(var o=2;o<r;o+=2)if(this.bb.readInt16(a+o)!=this.bb.readInt16(s+o))continue t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},e.finish=function(t,e,i){var r=i?4:0;if(e){var n=e;if(this.prep(this.minalign,8+r),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var a=3;a>=0;a--)this.writeInt8(n.charCodeAt(a))}this.prep(this.minalign,4+r),this.addOffset(t),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)},e.finishSizePrefixed=function(t,e){this.finish(t,e,!0)},e.requiredField=function(t,e){var i=this.bb.capacity()-t,r=i-this.bb.readInt32(i);if(!(e<this.bb.readInt16(r)&&0!=this.bb.readInt16(r+e)))throw new TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,i){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(i,t*e)},e.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},e.createSharedString=function(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);var e=this.createString(t);return this.string_maps.set(t,e),e},e.createString=function(t){return null==t?0:(e=C(t,Uint8Array)?t:this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector());var e},e.createByteVector=function(t){return null==t?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())},e.createObjectOffset=function(t){return null===t?0:"string"==typeof t?this.createString(t):t.pack(this)},e.createObjectOffsetList=function(t){for(var e=[],i=0;i<t.length;++i){var r=t[i];if(null===r)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(r))}return e},e.createStructOffsetList=function(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()},t.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var i=e<<1,r=Pf.allocate(i);return r.setPosition(i-e),r.bytes().set(t.bytes(),i-e),r},t}(),Lf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.dataType=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.data=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.dataLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.dataArray=function(){var t=this.bb.__offset(this.bb_pos,6);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new Vf(this.dataType(),this.bb.createScalarList(this.data.bind(this),this.dataLength()))},e.unpackTo=function(t){t.dataType=this.dataType(),t.data=this.bb.createScalarList(this.data.bind(this),this.dataLength())},t.getRootAsFBEffectsObjectData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsObjectData=function(t){t.startObject(2)},t.addDataType=function(t,e){t.addFieldOffset(0,e,0)},t.addData=function(t,e){t.addFieldOffset(1,e,0)},t.createDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,i,r){return t.startFBEffectsObjectData(e),t.addDataType(e,i),t.addData(e,r),t.endFBEffectsObjectData(e)},t}(),Vf=function(){function t(t,e){void 0===t&&(t=null),void 0===e&&(e=[]),this.dataType=t,this.data=e}return t.prototype.pack=function(t){var e=null!==this.dataType?t.createString(this.dataType):0,i=Lf.createDataVector(t,this.data);return Lf.createFBEffectsObjectData(t,e,i)},t}(),Df=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.exportObjects=function(t,e){var i=this.bb.__offset(this.bb_pos,4);return i?(e||new Lf).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.exportObjectsLength=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new kf(this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength()))},e.unpackTo=function(t){t.exportObjects=this.bb.createObjList(this.exportObjects.bind(this),this.exportObjectsLength())},t.getRootAsFBEffectsPackageData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBEffectsPackageData=function(t){t.startObject(1)},t.addExportObjects=function(t,e){t.addFieldOffset(0,e,0)},t.createExportObjectsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startExportObjectsVector=function(t,e){t.startVector(4,e,4)},t.endFBEffectsPackageData=function(t){return t.endObject()},t.finishFBEffectsPackageDataBuffer=function(t,e){t.finish(e)},t.finishSizePrefixedFBEffectsPackageDataBuffer=function(t,e){t.finish(e,void 0,!0)},t.createFBEffectsPackageData=function(e,i){return t.startFBEffectsPackageData(e),t.addExportObjects(e,i),t.endFBEffectsPackageData(e)},t}(),kf=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=Df.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Df.createFBEffectsPackageData(t,e)},t}(),zf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.offset=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexCount=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.unpack=function(){return new Uf(this.offset(),this.indexCount(),this.vertexCount())},e.unpackTo=function(t){t.offset=this.offset(),t.indexCount=this.indexCount(),t.vertexCount=this.vertexCount()},t.getRootAsFBSubMesh=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBSubMesh=function(t){t.startObject(3)},t.addOffset=function(t,e){t.addFieldInt32(0,e,0)},t.addIndexCount=function(t,e){t.addFieldInt32(1,e,0)},t.addVertexCount=function(t,e){t.addFieldInt32(2,e,0)},t.endFBSubMesh=function(t){return t.endObject()},t.createFBSubMesh=function(e,i,r,n){return t.startFBSubMesh(e),t.addOffset(e,i),t.addIndexCount(e,r),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),Uf=function(){function t(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.offset=t,this.indexCount=e,this.vertexCount=i}return t.prototype.pack=function(t){return zf.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),Bf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.semantic=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.offset=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0},e.format=function(){var t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):0},e.dimension=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.normalize=function(){var t=this.bb.__offset(this.bb_pos,12);return!!t&&!!this.bb.readInt8(this.bb_pos+t)},e.unpack=function(){return new Gf(this.semantic(),this.offset(),this.format(),this.dimension(),this.normalize())},e.unpackTo=function(t){t.semantic=this.semantic(),t.offset=this.offset(),t.format=this.format(),t.dimension=this.dimension(),t.normalize=this.normalize()},t.getRootAsFBVertexChannel=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexChannel=function(t){t.startObject(5)},t.addSemantic=function(t,e){t.addFieldOffset(0,e,0)},t.addOffset=function(t,e){t.addFieldInt32(1,e,0)},t.addFormat=function(t,e){t.addFieldInt32(2,e,0)},t.addDimension=function(t,e){t.addFieldInt32(3,e,0)},t.addNormalize=function(t,e){t.addFieldInt8(4,+e,0)},t.endFBVertexChannel=function(t){return t.endObject()},t.createFBVertexChannel=function(e,i,r,n,a,s){return t.startFBVertexChannel(e),t.addSemantic(e,i),t.addOffset(e,r),t.addFormat(e,n),t.addDimension(e,a),t.addNormalize(e,s),t.endFBVertexChannel(e)},t}(),Gf=function(){function t(t,e,i,r,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=i,this.dimension=r,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return Bf.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),jf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.vertexCount=function(){var t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0},e.channels=function(t,e){var i=this.bb.__offset(this.bb_pos,6);return i?(e||new Bf).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.channelsLength=function(){var t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0},e.unpack=function(){return new Xf(this.vertexCount(),this.bb.createObjList(this.channels.bind(this),this.channelsLength()))},e.unpackTo=function(t){t.vertexCount=this.vertexCount(),t.channels=this.bb.createObjList(this.channels.bind(this),this.channelsLength())},t.getRootAsFBVertexData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBVertexData=function(t){t.startObject(2)},t.addVertexCount=function(t,e){t.addFieldInt32(0,e,0)},t.addChannels=function(t,e){t.addFieldOffset(1,e,0)},t.createChannelsVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,i,r){return t.startFBVertexData(e),t.addVertexCount(e,i),t.addChannels(e,r),t.endFBVertexData(e)},t}(),Xf=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=[]),this.vertexCount=t,this.channels=e}return t.prototype.pack=function(t){var e=jf.createChannelsVector(t,t.createObjectOffsetList(this.channels));return jf.createFBVertexData(t,this.vertexCount,e)},t}(),Hf=function(){function t(){this.bb=null,this.bb_pos=0}var e=t.prototype;return e.__init=function(t,e){return this.bb_pos=t,this.bb=e,this},e.id=function(t){var e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null},e.name=function(t){var e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null},e.vertexData=function(t){var e=this.bb.__offset(this.bb_pos,8);return e?(t||new jf).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null},e.indexFormat=function(){var t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt32(this.bb_pos+t):0},e.indexOffset=function(){var t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt32(this.bb_pos+t):0},e.subMeshes=function(t,e){var i=this.bb.__offset(this.bb_pos,14);return i?(e||new zf).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*t),this.bb):null},e.subMeshesLength=function(){var t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0},e.mode=function(){var t=this.bb.__offset(this.bb_pos,16);return t?this.bb.readInt32(this.bb_pos+t):0},e.buffer=function(t){var e=this.bb.__offset(this.bb_pos,18);return e?this.bb.__string(this.bb_pos+e,t):null},e.binaryData=function(t){var e=this.bb.__offset(this.bb_pos,20);return e?this.bb.readUint8(this.bb.__vector(this.bb_pos+e)+t):0},e.binaryDataLength=function(){var t=this.bb.__offset(this.bb_pos,20);return t?this.bb.__vector_len(this.bb_pos+t):0},e.binaryDataArray=function(){var t=this.bb.__offset(this.bb_pos,20);return t?new Uint8Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.boneNames=function(t,e){var i=this.bb.__offset(this.bb_pos,22);return i?this.bb.__string(this.bb.__vector(this.bb_pos+i)+4*t,e):null},e.boneNamesLength=function(){var t=this.bb.__offset(this.bb_pos,22);return t?this.bb.__vector_len(this.bb_pos+t):0},e.rootBoneName=function(t){var e=this.bb.__offset(this.bb_pos,24);return e?this.bb.__string(this.bb_pos+e,t):null},e.inverseBindMatrices=function(t){var e=this.bb.__offset(this.bb_pos,26);return e?this.bb.readFloat32(this.bb.__vector(this.bb_pos+e)+4*t):0},e.inverseBindMatricesLength=function(){var t=this.bb.__offset(this.bb_pos,26);return t?this.bb.__vector_len(this.bb_pos+t):0},e.inverseBindMatricesArray=function(){var t=this.bb.__offset(this.bb_pos,26);return t?new Float32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null},e.unpack=function(){return new Wf(this.id(),this.name(),null!==this.vertexData()?this.vertexData().unpack():null,this.indexFormat(),this.indexOffset(),this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),this.mode(),this.buffer(),this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),this.rootBoneName(),this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength()))},e.unpackTo=function(t){t.id=this.id(),t.name=this.name(),t.vertexData=null!==this.vertexData()?this.vertexData().unpack():null,t.indexFormat=this.indexFormat(),t.indexOffset=this.indexOffset(),t.subMeshes=this.bb.createObjList(this.subMeshes.bind(this),this.subMeshesLength()),t.mode=this.mode(),t.buffer=this.buffer(),t.binaryData=this.bb.createScalarList(this.binaryData.bind(this),this.binaryDataLength()),t.boneNames=this.bb.createScalarList(this.boneNames.bind(this),this.boneNamesLength()),t.rootBoneName=this.rootBoneName(),t.inverseBindMatrices=this.bb.createScalarList(this.inverseBindMatrices.bind(this),this.inverseBindMatricesLength())},t.getRootAsFBGeometryData=function(e,i){return(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,i){return e.setPosition(e.position()+4),(i||new t).__init(e.readInt32(e.position())+e.position(),e)},t.startFBGeometryData=function(t){t.startObject(12)},t.addId=function(t,e){t.addFieldOffset(0,e,0)},t.addName=function(t,e){t.addFieldOffset(1,e,0)},t.addVertexData=function(t,e){t.addFieldOffset(2,e,0)},t.addIndexFormat=function(t,e){t.addFieldInt32(3,e,0)},t.addIndexOffset=function(t,e){t.addFieldInt32(4,e,0)},t.addSubMeshes=function(t,e){t.addFieldOffset(5,e,0)},t.createSubMeshesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startSubMeshesVector=function(t,e){t.startVector(4,e,4)},t.addMode=function(t,e){t.addFieldInt32(6,e,0)},t.addBuffer=function(t,e){t.addFieldOffset(7,e,0)},t.addBinaryData=function(t,e){t.addFieldOffset(8,e,0)},t.createBinaryDataVector=function(t,e){t.startVector(1,e.length,1);for(var i=e.length-1;i>=0;i--)t.addInt8(e[i]);return t.endVector()},t.startBinaryDataVector=function(t,e){t.startVector(1,e,1)},t.addBoneNames=function(t,e){t.addFieldOffset(9,e,0)},t.createBoneNamesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addOffset(e[i]);return t.endVector()},t.startBoneNamesVector=function(t,e){t.startVector(4,e,4)},t.addRootBoneName=function(t,e){t.addFieldOffset(10,e,0)},t.addInverseBindMatrices=function(t,e){t.addFieldOffset(11,e,0)},t.createInverseBindMatricesVector=function(t,e){t.startVector(4,e.length,4);for(var i=e.length-1;i>=0;i--)t.addFloat32(e[i]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),Wf=function(){function t(t,e,i,r,n,a,s,o,u,h,l,c){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=[]),void 0===s&&(s=0),void 0===o&&(o=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===l&&(l=null),void 0===c&&(c=[]),this.id=t,this.name=e,this.vertexData=i,this.indexFormat=r,this.indexOffset=n,this.subMeshes=a,this.mode=s,this.buffer=o,this.binaryData=u,this.boneNames=h,this.rootBoneName=l,this.inverseBindMatrices=c}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,i=null!==this.name?t.createString(this.name):0,r=null!==this.vertexData?this.vertexData.pack(t):0,n=Hf.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),a=null!==this.buffer?t.createString(this.buffer):0,s=Hf.createBinaryDataVector(t,this.binaryData),o=Hf.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=Hf.createInverseBindMatricesVector(t,this.inverseBindMatrices);return Hf.startFBGeometryData(t),Hf.addId(t,e),Hf.addName(t,i),Hf.addVertexData(t,r),Hf.addIndexFormat(t,this.indexFormat),Hf.addIndexOffset(t,this.indexOffset),Hf.addSubMeshes(t,n),Hf.addMode(t,this.mode),Hf.addBuffer(t,a),Hf.addBinaryData(t,s),Hf.addBoneNames(t,o),Hf.addRootBoneName(t,u),Hf.addInverseBindMatrices(t,h),Hf.endFBGeometryData(t)},t}(),Yf=function(){function t(){this.exportObjectDatas=[]}var e=t.prototype;return e.addData=function(t){this.exportObjectDatas.push(t)},e.serializeToBinary=function(){for(var t,e=new Ff(1),i=new kf,r=[],n=w(this.exportObjectDatas);!(t=n()).done;){var a=t.value,s=void 0;a.dataType===Ae.Geometry&&(s=new Vf("Geometry",this.geometryDataToBinary(a))),s&&r.push(s)}return i.exportObjects=r,Df.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new Pf(t),i=Df.getRootAsFBEffectsPackageData(e),r=0;r<i.exportObjectsLength();r++){var n=i.exportObjects(r);if(n){var a=n.dataArray(),s=n.dataType();if(a){var o=void 0;s===Ae.Geometry&&(o=this.binaryToGeometryData(a)),o&&this.exportObjectDatas.push(o)}}}},e.geometryDataToBinary=function(t){var e=new Ff(1),i=new Wf,r=t.indexFormat,n=t.indexOffset,a=t.mode,s=t.id,o=t.vertexData,u=t.boneNames,h=void 0===u?[]:u,l=t.rootBoneName,c=void 0===l?"":l,f=t.inverseBindMatrices,d=void 0===f?[]:f,p=t.binaryData,m=void 0===p?[]:p;i.indexFormat=r,i.indexOffset=n,i.mode=a,i.id=s,i.boneNames=h,i.rootBoneName=c,i.inverseBindMatrices=d,i.binaryData=m;var v=new Xf;v.vertexCount=o.vertexCount,v.channels=[];for(var y,g=w(o.channels);!(y=g()).done;){var x=y.value,b=x.semantic,T=x.offset,E=x.format,_=x.dimension,C=x.normalize,A=new Gf(b,T,E,_,C);v.channels.push(A)}i.vertexData=v;for(var S,I=[],R=w(t.subMeshes);!(S=R()).done;){var O=S.value,M=O.offset,N=O.indexCount,P=O.vertexCount,F=new Uf(M,N,P);I.push(F)}return i.subMeshes=I,Df.finishFBEffectsPackageDataBuffer(e,i.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new Pf(t),i=Hf.getRootAsFBGeometryData(e),r={vertexCount:0,channels:[]},n=i.vertexData();if(n){r.vertexCount=n.vertexCount();for(var a=0;a<n.channelsLength();a++){var s=n.channels(a);if(s){var o,u={semantic:null!=(o=s.semantic())?o:"",offset:s.offset(),format:s.format(),dimension:s.dimension(),normalize:s.normalize()};r.channels.push(u)}}}for(var h=[],l=0;l<i.subMeshesLength();l++){var c=i.subMeshes(l);if(c){var f={offset:c.offset(),vertexCount:c.vertexCount(),indexCount:c.indexCount()};h.push(f)}}for(var d=[],p=0;p<i.boneNamesLength();p++){var m=i.boneNames(p);d.push(m)}var v,y,g,x,b=i.inverseBindMatricesArray();return{vertexData:r,indexFormat:i.indexFormat(),indexOffset:i.indexOffset(),subMeshes:h,mode:i.mode(),buffer:null!=(v=i.buffer())?v:"",boneNames:d,rootBoneName:null!=(y=i.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=i.binaryDataArray())?g:void 0,id:null!=(x=i.id())?x:"",dataType:Ae.Geometry}},t}(),Zf=function(){function t(){this.renderErrors=new Set,this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new _c(this),this.emptyTexture=mn(this),this.transparentTexture=vn(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.findObject=function(t){return Et(t)?this.objectInstance[t.id]?this.objectInstance[t.id]:this.assetLoader.loadGUID(t):t},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,i=t.jsonScene,r=t.textureOptions,n=void 0===r?[]:r,a=i.items,s=void 0===a?[]:a,o=i.materials,u=void 0===o?[]:o,h=i.shaders,l=void 0===h?[]:h,c=i.geometries,f=void 0===c?[]:c,d=i.components,p=void 0===d?[]:d,m=i.animations,v=void 0===m?[]:m,y=i.bins,g=void 0===y?[]:y,x=i.miscs,b=void 0===x?[]:x,T=w(i.compositions);!(e=T()).done;){var E=e.value;this.addEffectsObjectData(E)}for(var _,C=w(s);!(_=C()).done;){var A=_.value;Tf(A.renderLevel,t.renderLevel)||(A.components=[],A.type=Wt.null),this.addEffectsObjectData(A)}for(var S,I=w(u);!(S=I()).done;){var R=S.value;this.addEffectsObjectData(R)}for(var O,M=w(l);!(O=M()).done;){var N=O.value;this.addEffectsObjectData(N)}for(var P,F=w(f);!(P=F()).done;){var L=P.value;this.addEffectsObjectData(L)}for(var V,D=w(p);!(V=D()).done;){var k=V.value;this.addEffectsObjectData(k)}for(var z,U=w(v);!(z=U()).done;){var B=z.value;this.addEffectsObjectData(B)}for(var G,j=w(b);!(G=j()).done;){var X=G.value;this.addEffectsObjectData(X)}for(var H=0;H<g.length;H++){var W=g[H],Y=t.bins[H];if(W.dataType===Ae.BinaryAsset)W.buffer=Y,W.id&&this.addEffectsObjectData(W);else{var Z=new Yf;Z.deserializeFromBinary(new Uint8Array(Y));for(var q,K=w(Z.exportObjectDatas);!(q=K()).done;){var Q=q.value;this.addEffectsObjectData(Q)}}}for(var J,$=w(n);!(J=$()).done;){var tt=J.value;this.addEffectsObjectData(tt)}},e.createVFXItems=function(t){var e=this;return E((function(){var i,r,n,a,s;return I(this,(function(o){for(i=t.jsonScene,r=w(i.items);!(n=r()).done;)a=n.value,"ECS"!==(s=a.type)&&"camera"!==s&&s!==Wt.sprite&&s!==Wt.particle&&s!==Wt.mesh&&s!==Wt.skybox&&s!==Wt.light&&s!==Wt.tree&&s!==Wt.interact&&s!==Wt.camera||e.database&&e.assetLoader.loadGUID(a);return[2]}))}))()},e.addTexture=function(t){this.destroyed||V(this.textures,t)},e.removeTexture=function(t){this.destroyed||D(this.textures,t)},e.addMaterial=function(t){this.destroyed||V(this.materials,t)},e.removeMaterial=function(t){this.destroyed||D(this.materials,t)},e.addGeometry=function(t){this.destroyed||V(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||D(this.geometries,t)},e.addMesh=function(t){this.destroyed||V(this.meshes,t)},e.removeMesh=function(t){this.destroyed||D(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||V(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||D(this.renderPasses,t)},e.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass "+this.renderPasses.length),this.meshes.length>0&&t.push("Mesh "+this.meshes.length),this.geometries.length>0&&t.push("Geom "+this.geometries.length),this.textures.length>0&&t.push("Tex "+this.textures.length),t.length>0&&vt.warn("Release GPU memory: "+t.join(", ")+"."),this.renderPasses.forEach((function(t){return t.dispose()})),this.meshes.forEach((function(t){return t.dispose()})),this.geometries.forEach((function(t){return t.dispose()})),this.materials.forEach((function(t){return t.dispose()})),this.textures.forEach((function(t){return t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},dr(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),qf=60,Kf=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var e=t.prototype;return e.getFPS=function(){return this.targetFPS},e.setFPS=function(t){this.targetFPS=li(t,1,120),this.interval=Math.floor(1e3/t)-2},e.getPaused=function(){return this.paused},e.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=d.now();var e=x||function(t){return r.setTimeout(t,16.7)},i=function(){t.intervalId=e(i),t.paused||t.tick()};i()}},e.stop=function(){(g||r.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},e.pause=function(){this.paused=!0,this.dt=0},e.resume=function(){this.paused=!1,this.dt=0},e.tick=function(){if(!this.paused){var t=d.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var e=0,i=this.tickers.length;e<i;e++){var r=this.tickers[e];r(this.dt)}}}},e.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},dr(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();Nt("camera",no,gl),Nt("text",xc,gl),Nt("sprite",Ou,gl),Nt("particle",Ol,gl),Nt("cal",Ml,gl),Nt("interact",po,gl);var Qf;vt.info("Core version: 2.6.5.");var Jf,$f=((Qf={})[Mr.RGBA]=34842,Qf[Mr.RGB]=34843,Qf[Mr.ALPHA]=33325,Qf[Mr.RED]=33325,Qf[Mr.LUMINANCE_ALPHA]=33327,Qf[Mr.LUMINANCE]=33325,Qf),td=((Jf={})[Mr.RGBA]=34836,Jf[Mr.RGB]=34837,Jf[Mr.ALPHA]=33326,Jf[Mr.RED]=33326,Jf[Mr.LUMINANCE_ALPHA]=33328,Jf[Mr.LUMINANCE]=33326,Jf),ed=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,i&&r.fromData(i),r}$t(e,t);var i=e.prototype;return i.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},i.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,i=this.source,r=i.target,n=void 0===r?e.TEXTURE_2D:r,a=i.name;this.textureBuffer=e.createTexture(),sd(this.textureBuffer,a),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},i.clone=function(){var t=new e(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},i.release=function(){switch(this.source.sourceType){case Rr.image:delete this.source.image,delete this.source.cube;break;case Rr.data:delete this.source.data;break;case Rr.compressed:case Rr.mipmaps:delete this.source.mipmaps}},i.update=function(t){var e=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var i,r,n=this.target,a=this.source,s=this.pipelineContext.gl,o=this.engine.gpuCapability.detail,u=a.sourceType,h=a.data,l=a.cube,c=a.image,f=a.video,d=a.mipmaps,p=a.mipmaps,m=t.data,v=t.cube,y=t.generateMipmap,g=t.mipmaps,x=a.format,b=a.type,T=a.internalFormat,E=0,_=0;if(this.bind(u===Rr.video),b===Mr.HALF_FLOAT?((b=o.halfFloatTexture)||vt.error("Half float texture is not support."),Fr(s)&&T===x&&(x===Mr.LUMINANCE&&(x=Mr.RED),T=$f[x]),o.halfFloatLinear||(a.minFilter=a.magFilter=s.NEAREST,vt.warn("Half float linear not support, change to NEAREST."))):b===s.FLOAT&&((b=o.floatTexture)||vt.error("Float texture is not support."),Fr(s)&&T===x&&(x===Mr.LUMINANCE&&(x=Mr.RED),T=td[x]),o.floatLinear||(a.minFilter=s.NEAREST,a.magFilter=s.NEAREST,vt.warn("Float linear not support, change to NEAREST."))),void 0===a.premultiplyAlpha&&(a.premultiplyAlpha=!1),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),void 0===a.flipY&&(a.flipY=!1),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,a.flipY),u===Rr.framebuffer)m&&(E=null!=(i=m.width)?i:0,_=null!=(r=m.height)?r:0,E&&_&&(this.width!==E||this.height!==_)&&s.texImage2D(n,0,T,E,_,0,x,b,null));else if(u===Rr.data){var w;if(n===s.TEXTURE_CUBE_MAP)v.forEach((function(t,i){var r=e.texImage2DData(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,x,b,t),n=r[0],a=r[1];E=Math.max(n,E),_=Math.max(a,_)}));else w=this.texImage2DData(s,n,0,T,x,b,h),E=w[0],_=w[1]}else if(u===Rr.image||u===Rr.video){if(n===s.TEXTURE_CUBE_MAP)l.forEach((function(t,i){var r=e.texImage2D(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,T,x,b,t),n=r[0],a=r[1];E=Math.max(n,E),_=Math.max(a,_)}));else if(n===s.TEXTURE_2D){var C,A=null!=c?c:f;C=this.texImage2D(s,n,0,T,x,b,A),E=C[0],_=C[1]}y&&(id(E)&&id(_)||Fr(s))&&s.generateMipmap(n)}else if(u===Rr.mipmaps){var S;n===s.TEXTURE_2D?d.forEach((function(t,i){var r;(S="data"in t?e.texImage2DData(s,n,i,T,x,b,t):e.texImage2D(s,n,i,T,x,b,t),0===i)&&(E=(r=S)[0],_=r[1])})):n===s.TEXTURE_CUBE_MAP&&p.forEach((function(t,i){t.forEach((function(t,r){var n;(S="data"in t?e.texImage2DData(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,T,x,b,t):e.texImage2D(s,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,i,T,x,b,t),0===i)&&(E=(n=S)[0],_=n[1])}))}))}else u===Rr.compressed&&g&&0!==g.length&&(E=g[0].width,_=g[0].height,g.forEach((function(t,e){s.compressedTexImage2D(n,e,T,t.width,t.height,0,t.data)})));this.width=E,this.height=_,this.setTextureFilters(s,n,a)},i.setTextureFilters=function(t,e,i){var r=i.anisotropic,n=void 0===r?4:r,a=i.wrapS,s=void 0===a?t.CLAMP_TO_EDGE:a,o=i.wrapT,u=void 0===o?t.CLAMP_TO_EDGE:o,h=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&h.setTextureAnisotropic(t,this.target,n);var l=Fr(t)||id(this.width)&&id(this.height),c=i.magFilter?i.magFilter:t.NEAREST,f=i.minFilter?i.minFilter:t.NEAREST;l||f!==t.LINEAR_MIPMAP_LINEAR&&f!==t.LINEAR_MIPMAP_NEAREST&&f!==t.NEAREST_MIPMAP_LINEAR&&f!==t.NEAREST_MIPMAP_NEAREST||(f=t.LINEAR),t.texParameteri(e,t.TEXTURE_MIN_FILTER,f),t.texParameteri(e,t.TEXTURE_MAG_FILTER,c),t.texParameteri(e,t.TEXTURE_WRAP_S,l?s:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,l?u:t.CLAMP_TO_EDGE)},i.fromData=function(e){t.prototype.fromData.call(this,e);var i=e,r=this.assembleOptions(i),n=r.sourceType,a=r.sourceFrom,s=r.name,o=void 0===s?"":s;this.source=r,this.sourceType=n,this.sourceFrom=a,this.name=o,this.guid=e.id},i.texImage2D=function(t,e,i,r,n,a,s){var o,u=this,h=this.source,l=h.sourceType,c=h.minFilter,f=h.magFilter,d=h.wrapS,p=h.wrapT,m=null!=(o=this.engine.gpuCapability.detail.maxTextureSize)?o:2048,v=s;if(l!==Rr.video){var y=c!==t.NEAREST||f!==t.NEAREST||d!==t.CLAMP_TO_EDGE||p!==t.CLAMP_TO_EDGE;(y=y||s.width>m||s.height>m)&&setTimeout((function(){v=u.resizeImage(s)}))}t.texImage2D(e,i,r,n,a,v);var g=[v.width,v.height];return l===Rr.video?[s.videoWidth,s.videoHeight]:g},i.texImage2DData=function(t,e,i,r,n,a,s){var o=s.data,u=s.width,h=s.height,l=n===t.UNSIGNED_BYTE?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/o.BYTES_PER_ELEMENT):o;return t.texImage2D(e,i,r,u,h,0,n,a,l),[u,h]},i.resizeImage=function(t,e,i){var r,n=null!=(r=this.engine.gpuCapability.detail.maxTextureSize)?r:2048;if(Fr(this.pipelineContext.gl)&&t.width<n&&t.height<n)return t;var a=function(t,e,i,r){var n=t.width,a=t.height,s=Math.min(e,i||Ao(n)),o=Math.min(e,r||Ao(a));if(o!==a||s!==n){var u=fc.getCanvas(),h=u.getContext("2d");return u.width=s,u.height=o,null==h||h.drawImage(t,0,0,n,a,0,0,s,o),vt.warn("Image resize from "+n+"x"+a+" to "+s+"x"+o+"."),u}}(t,n,e,i);return a||t},i.reloadData=function(){var t=this;return E((function(){return I(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,Tn().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},i.offloadData=function(){if(this.initialized&&Tn().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var i=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);else if(t===e.TEXTURE_CUBE_MAP)for(var r=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<r.length;n++)e.texImage2D(r[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,i);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},i.uploadCurrentVideoFrame=function(){var t=this;return E((function(){return I(this,(function(e){return t.source.sourceType===Rr.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},i.updateSource=function(t){this.source=this.assembleOptions(ri({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},i.restore=function(){},i.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){vt.error("This texture has been destroyed.")},this.initialize=Ct,void 0!==this.engine&&this.engine.removeTexture(this)},e}(fn);function id(t){return 0==(t&t-1)&&0!==t}var rd=function(){function t(t,e){this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}var e=t.prototype;return e.bind=function(){this.bindVertexArray(this.vao)},e.unbind=function(){this.bindVertexArray(null)},e.createVertexArray=function(t){var e=null;return Fr(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),sd(e,t),e},e.bindVertexArray=function(t){var e;Fr(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;Fr(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),nd=1,ad=function(){function t(t){this.engine=t,this.textures=[],this.renderbuffers=[],this.framebuffers=[],this.destroyed=!1;var e={width:1,height:1,data:new Uint8Array([255])},i=t.getGLPipelineContext(),r=i.gl;this.gl=r,this.pipelineContext=i,this.emptyTexture2D=new ed(t,{data:e,sourceType:Rr.data,format:r.LUMINANCE,internalFormat:r.LUMINANCE,type:r.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new ed(t,{target:r.TEXTURE_CUBE_MAP,cube:[e,e,e,e,e,e],sourceType:Rr.data,format:r.LUMINANCE,internalFormat:r.LUMINANCE,type:r.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+nd,nd++}var e=t.prototype;return e.copy2=function(t,e){var i=this.gl;if(i){this.sourceFbo||(this.sourceFbo=i.createFramebuffer()),this.targetFbo||(this.targetFbo=i.createFramebuffer());var r=this.pipelineContext;r.bindFramebuffer(i.FRAMEBUFFER,this.sourceFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t.textureBuffer,0),r.bindFramebuffer(i.FRAMEBUFFER,this.targetFbo),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e.textureBuffer,0),r.bindFramebuffer(i.READ_FRAMEBUFFER,this.sourceFbo),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?i.NEAREST:i.LINEAR;i.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),i.COLOR_BUFFER_BIT,n),r.bindFramebuffer(i.FRAMEBUFFER,null),r.bindFramebuffer(i.READ_FRAMEBUFFER,null),r.bindFramebuffer(i.DRAW_FRAMEBUFFER,null)}},e.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&V(this.renderbuffers,t),e},e.resize=function(t,e){var i=this.gl;(i&&i.drawingBufferWidth!==t||i.drawingBufferHeight!==e)&&(i.canvas.width=t,i.canvas.height=e,i.viewport(0,0,t,e),this.framebuffers.forEach((function(i){var r=i.viewport;i.isCustomViewport||i.resize(r[0],r[1],t*i.viewportScale,e*i.viewportScale)})))},e.drawGeometry=function(t,e,i){if(this.gl){var r=t,n=e.shaderVariant.program;if(n){var a=n.setupAttributes(r),s=this.gl,o=r.indicesBuffer,u=r.drawStart,h=r.drawCount,l=r.mode,c=r.subMeshes;if(c&&c.length){var f,d=c[i];if(h<0)return;if(u=d.offset,o)h=null!=(f=d.indexCount)?f:0;else h=d.vertexCount}o?s.drawElements(l,h,o.type,null!=u?u:0):s.drawArrays(l,u,h),null==a||a.unbind()}}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")},e.createGLFramebuffer=function(t,e){var i=this.gl.createFramebuffer();if(!i)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return V(this.framebuffers,t),sd(i,e,e),i},e.createVAO=function(t){return new rd(this.engine,t)},e.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),D(this.textures,t),delete t.textureBuffer)},e.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},e.deleteGLFramebuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),D(this.framebuffers,t),delete t.fbo)},e.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),D(this.renderbuffers,t),delete t.buffer)},e.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.framebuffers.forEach((function(e){return t.deleteGLFramebuffer(e)})),this.framebuffers.length=0,this.renderbuffers.forEach((function(e){return t.deleteGLRenderbuffer(e)})),this.renderbuffers.length=0,this.textures.forEach((function(e){return t.deleteGLTexture(e)})),this.textures.length=0)},e.lost=function(t){vt.error("WebGL context lost, destroying glRenderer by default to prevent memory leaks. Event target: "+t.target+"."),this.deleteResource()},e.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},dr(t,[{key:"height",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferHeight}},{key:"width",get:function(){var t;return null==(t=this.gl)?void 0:t.drawingBufferWidth}},{key:"canvas",get:function(){return this.gl.canvas}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function sd(t,e,i){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,i&&(t.__SPECTOR_Object_TAG.id=i)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var od,ud,hd=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var i=e.name,r=e.data,n=e.elementCount,a=e.target,s=void 0===a?Mr.ARRAY_BUFFER:a,o=e.type,u=void 0===o?Mr.FLOAT:o,h=e.usage,l=void 0===h?Mr.STATIC_DRAW:h,c=function(t){var e,i;return null!=(i=null==(e=ld[t])?void 0:e.BYTES_PER_ELEMENT)?i:0}(u);this.target=s,this.type=u,this.usage=l,this.glBuffer=this.createGLBuffer(i),this.bytesPerElement=c,r?this.bufferData(r):n&&this.bufferData(c*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return sd(e,t),e},e.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var i=this.pipelineContext.gl,r=this.target;i.bindBuffer(r,this.glBuffer),0===e?i.bufferData(r,1,this.usage):(i.bufferData(r,e,this.usage),"number"!=typeof t&&i.bufferSubData(r,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var i=this.pipelineContext.gl,r=this.target,n=t*this.bytesPerElement,a=n+e.byteLength;i.bindBuffer(r,this.glBuffer),a>this.byteLength&&(this.byteLength=a,i.bufferData(r,a,this.usage)),i.bufferSubData(r,n,e)}else this.byteLength=0},e.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.readSubData=function(t,e){return!!Fr(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},dr(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),ld=((od={})[Mr.INT]=Int32Array,od[Mr.FLOAT]=Float32Array,od[Mr.SHORT]=Int16Array,od[Mr.BYTE]=Int8Array,od[Mr.UNSIGNED_BYTE]=Uint8Array,od[Mr.UNSIGNED_INT]=Uint32Array,od[Mr.UNSIGNED_SHORT]=Uint16Array,od);var cd=((ud={})[Uint8Array.BYTES_PER_ELEMENT]=Mr.UNSIGNED_BYTE,ud[Uint16Array.BYTES_PER_ELEMENT]=Mr.UNSIGNED_SHORT,ud[Uint32Array.BYTES_PER_ELEMENT]=Mr.UNSIGNED_INT,ud),fd=1,dd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).drawCount=0,r.buffers={},r.vaos={},r.skin={},r.initialized=!1,r.indicesReleasable=!1,r.attributesName=[],r.destroyed=!1,i&&r.processProps(i),r}$t(e,t);var i=e.prototype;return i.getOptions=function(){return ri({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;ut(e),e.addGeometry(this);var i=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new hd(i,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(i,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},i.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},i.setAttributeData=function(t,e){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t),r=this.attributes[t].dataSource;if(i){var n=i.usage,a=i.target;this.bufferProps[r]={data:e,usage:n,target:a,elementCount:e.length},this.dirtyFlags[r].discard=!0,this.dirtyFlags[r].dirty=!0}}},i.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},i.setAttributeSubData=function(t,e,i){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t);if(r&&null!=r.data){var n=e,a=e+i.length;if(r.data.length<a){var s=new i.constructor(a);s.set(r.data),r.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var o=this.dirtyFlags[t];void 0!==o.start&&(o.start=Math.min(o.start,n)),void 0!==o.end&&(o.end=Math.max(o.end,a-1))}r.data.set(i,n),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(C(t,Uint8Array)||C(t,Uint16Array)||C(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var i,r=t,n=t+e.length;if(this.indices.length<n){var a=new e.constructor(n);a.set(this.indices),this.indices=a,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var s=this.dirtyFlags.index;void 0!==s.start&&(s.start=Math.min(s.start,r)),void 0!==s.end&&(s.end=Math.max(s.end,n-1))}null==(i=this.indices)||i.set(e,r),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],i=e.stride,r=e.size,n=e.type;return i||r*Hn[n]},i.getAttributeNames=function(){return this.attributesName},i.setDrawStart=function(t){this.drawStart=t},i.getDrawStart=function(){return this.drawStart},i.setDrawCount=function(t){this.drawCount=t},i.getDrawCount=function(){return this.drawCount},i.getSkinProps=function(){return this.skin},i.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},i.createIndicesBuffer=function(t,e){var i=cd[e.BYTES_PER_ELEMENT],r={data:e,target:Mr.ELEMENT_ARRAY_BUFFER,type:i,name:this.name+"##index"};return new hd(t,r)},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,i=this.bufferProps,r=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var a,s,o=t.dirtyFlags[n];if("index"==n)a=t.indicesBuffer,s=r;else{var u=e[n].dataSource;a=t.buffers[u],s=i[u].data}if((o.dirty||o.discard)&&a&&s){if(o.discard)a.bufferData(s);else if(void 0!==o.start&&void 0!==o.end){var h=o.start*s.BYTES_PER_ELEMENT+s.byteOffset,l=o.end-o.start+1,c=new s.constructor(s.buffer,h,l);a.bufferSubData(o.start,c)}o.start=Number.POSITIVE_INFINITY,o.end=0,o.dirty=o.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(r){var n=t.attributesReleasable[r],a=e[r].dataSource;i[a]&&n&&(i[a].data=void 0)})),this.indicesReleasable}},i.processProps=function(t){var e=t,i=e.drawStart,r=void 0===i?0:i,n=e.drawCount,a=e.mode,s=e.indices,o=e.name,u=void 0===o?"effectsGeometry:"+fd++:o,h=e.bufferUsage,l=void 0===h?Mr.STATIC_DRAW:h;this.name=u;var c={},f=[],d={},p={},m={},v=l;this.drawStart=r,void 0!==n&&(this.drawCount=n),this.mode=isNaN(a)?Mr.TRIANGLES:a,Object.keys(e.attributes).forEach((function(t){var i=e.attributes[t],r=i.size,n=i.stride,a=i.offset,s=i.normalize,o=i.type,u=void 0===o?Mr.FLOAT:o,h=i.releasable,l=i.data;if(!u||"dataSource"in i||l||(l=Yn(u)),l){var y=C(l,Float32Array)?Mr.FLOAT:Mr.INT;c[t]={data:l,usage:v,target:Mr.ARRAY_BUFFER,name:t},d[t]={size:r,stride:n,offset:a,type:null!=u?u:y,normalize:!!s,dataSource:t},m[t]=null!=h&&h,p[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var g=i.dataSource;g&&(d[t]={size:r,stride:n,offset:a,type:u,dataSource:g,normalize:!!s})}f.push(t)})),p.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==s?void 0:s.data,this.indicesReleasable=!0===(null==s?void 0:s.releasable),this.bufferProps=c,this.attributes=d,this.attributesName=f,this.attributesReleasable=m,this.dirtyFlags=p,this.options=e,this.initialized=!1},i.fromData=function(e){var i,r=this;if(t.prototype.fromData.call(this,e),this.subMeshes=e.subMeshes,e.buffer?i=new Uint8Array(function(t){for(var e=a(t),i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);var n=i.buffer;return n}(e.buffer)):e.binaryData&&(i=e.binaryData),i){var n=e.vertexData.vertexCount;if(this.hasSemantic(e)){var s={mode:Mr.TRIANGLES,attributes:{}};if(e.vertexData.channels.forEach((function(t){var e,a=null!=(e=pd[t.semantic])?e:t.semantic,o=r.createVertexTypedArray(t,i,n);s.attributes[a]={type:Vr(t.format),size:t.dimension,data:o,normalize:t.normalize}})),e.indexFormat!==Re.None){var o=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset);s.indices={data:o},s.drawCount=o.length}else s.drawCount=n;this.processProps(s)}else{var u=e.vertexData.channels[0],h=e.vertexData.channels[1],l=e.vertexData.channels[2],c=this.createVertexTypedArray(u,i,n),f=this.createVertexTypedArray(h,i,n),d=this.createVertexTypedArray(l,i,n),p=this.createIndexTypedArray(e.indexFormat,i,e.indexOffset),m={mode:Mr.TRIANGLES,attributes:{aPos:{type:Vr(u.format),size:3,data:c,normalize:u.normalize},aUV:{type:Vr(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:Vr(l.format),size:3,data:d,normalize:l.normalize}}};m.indices={data:p},m.drawCount=p.length,this.processProps(m)}this.skin={boneNames:e.boneNames,rootBoneName:e.rootBoneName,inverseBindMatrices:e.inverseBindMatrices}}},i.dispose=function(){var t,e=this;(this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized)&&(Object.keys(this.buffers).forEach((function(t){e.buffers[t].dispose()})),this.buffers={},null==(t=this.indicesBuffer)||t.dispose(),Object.keys(this.vaos).forEach((function(t){var i;null==(i=e.vaos[t])||i.dispose(),e.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0));this.destroyed=!0},i.createVertexTypedArray=function(t,e,i){var r=e.buffer;switch(t.format){case Ie.Float32:return new Float32Array(r,e.byteOffset+t.offset,t.dimension*i);case Ie.Int16:return new Int16Array(r,e.byteOffset+t.offset,t.dimension*i);case Ie.Int8:return new Int8Array(r,e.byteOffset+t.offset,t.dimension*i);case Ie.UInt16:return new Uint16Array(r,e.byteOffset+t.offset,t.dimension*i);case Ie.UInt8:return new Uint8Array(r,e.byteOffset+t.offset,t.dimension*i);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(r,e.byteOffset+t.offset,t.dimension*i)}},i.createIndexTypedArray=function(t,e,i){var r=e.buffer;switch(t){case Re.UInt16:return new Uint16Array(r,e.byteOffset+i);case Re.UInt32:return new Uint32Array(r,e.byteOffset+i);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(r,e.byteOffset+i)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},dr(e,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),e}(Wn),pd={POSITION:"aPos",TEXCOORD0:"aUV",TEXCOORD_0:"aUV",TEXCOORD1:"aUV2",NORMAL:"aNormal",TANGENT:"aTangent",COLOR:"aColor",JOINTS:"aJoints",JOINTS_0:"aJoints",WEIGHTS:"aWeights",WEIGHTS_0:"aWeights",POSITION_BS0:"aTargetPosition0",POSITION_BS1:"aTargetPosition1",POSITION_BS2:"aTargetPosition2",POSITION_BS3:"aTargetPosition3",POSITION_BS4:"aTargetPosition4",POSITION_BS5:"aTargetPosition5",POSITION_BS6:"aTargetPosition6",POSITION_BS7:"aTargetPosition7",NORMAL_BS0:"aTargetNormal0",NORMAL_BS1:"aTargetNormal1",NORMAL_BS2:"aTargetNormal2",NORMAL_BS3:"aTargetNormal3",TANGENT_BS0:"aTargetTangent0",TANGENT_BS1:"aTargetTangent1",TANGENT_BS2:"aTargetTangent2",TANGENT_BS3:"aTargetTangent3"};var md,vd,yd=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendColor[0]===e&&this.blendColor[1]===i&&this.blendColor[2]===r&&this.blendColor[3]===n||(this.blendColor[0]=e,this.blendColor[1]=i,this.blendColor[2]=r,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],i=t[1],r=t[2],n=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===r&&this.blendFunctionParameters[3]===n||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=r,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],i=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=i)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){this.colorMask[0]=t,this.colorMask[1]=t,this.colorMask[2]=t,this.colorMask[3]=t},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA,Mr.ONE,Mr.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[Mr.FUNC_ADD,Mr.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=Mr.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=[Mr.ALWAYS,Mr.ALWAYS],this.stencilOpFail=[Mr.KEEP,Mr.KEEP],this.stencilOpZFail=[Mr.KEEP,Mr.KEEP],this.stencilOpZPass=[Mr.KEEP,Mr.KEEP],this.culling=!1,this.frontFace=Mr.CCW,this.cullFace=Mr.FRONT},e.apply=function(t){if(t.toggle(Mr.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(Mr.BLEND,this.blending),t.toggle(Mr.DEPTH_TEST,this.depthTest),t.toggle(Mr.STENCIL_TEST,this.stencilTest),t.toggle(Mr.CULL_FACE,this.culling),t.toggle(Mr.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(Mr.BACK,this.stencilMask[1]),t.stencilMaskSeparate(Mr.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(Mr.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(Mr.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(Mr.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(Mr.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,i=e.blendColor,r=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(i[0],i[1],i[2],i[3]),t.blendEquationSeparate(r[0],r[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),gd=gr,xd=_r,bd=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).floats={},r.ints={},r.vector2s={},r.vector3s={},r.vector4s={},r.colors={},r.quaternions={},r.matrices={},r.matrice3s={},r.textures={},r.floatArrays={},r.vector4Arrays={},r.matrixArrays={},r.samplers=[],r.uniforms=[],r.uniformDirty=!0,r.macrosDirty=!0,r.glMaterialState=new yd,i&&(r.shader=new Pn(e),r.shader.shaderData=ri({},i.shader,{id:At(),dataType:Ae.Shader})),r}$t(e,t);var i=e.prototype;return i.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},i.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},i.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},i.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach((function(e){var i=t.textures[e];bt(i.initialize)?i.initialize():vt.error("Failed to initialize texture: "+JSON.stringify(i)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},i.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},i.setupStates=function(t){this.glMaterialState.apply(t)},i.use=function(t,e){var i=t.engine.getGLPipelineContext(),r=this.shaderVariant;if(r.program){var n;if(r.program.bind(),this.setupStates(i),e){for(var a,s=w(e.uniforms);!(a=s()).done;)n=a.value,this.checkUniform(n);for(var o,u=w(e.samplers);!(o=u()).done;)n=o.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(r.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)r.setFloat(n,e.floats[n]);for(n in e.ints)r.setInt(n,e.ints[n]);for(n in e.vector4s)r.setVector4(n,e.vector4s[n]);for(n in e.vector3s)r.setVector3(n,e.vector3s[n]);for(n in e.matrices)r.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)r.setFloat(n,this.floats[n]);for(n in this.ints)r.setInt(n,this.ints[n]);for(n in this.floatArrays)r.setFloats(n,this.floatArrays[n]);for(n in this.textures)r.setTexture(n,this.textures[n]);for(n in this.vector2s)r.setVector2(n,this.vector2s[n]);for(n in this.vector3s)r.setVector3(n,this.vector3s[n]);for(n in this.vector4s)r.setVector4(n,this.vector4s[n]);for(n in this.colors)r.setColor(n,this.colors[n]);for(n in this.quaternions)r.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)r.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)r.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)r.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)r.setMatrixArray(n,this.matrixArrays[n])}else{var h;null==(h=this.engine)||h.renderErrors.add(new Error("Shader program is not initialized."))}},i.getFloat=function(t){return this.floats[t]},i.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},i.getInt=function(t){return this.ints[t]},i.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},i.getFloats=function(t){return this.floatArrays[t]},i.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},i.getVector2=function(t){return this.vector2s[t]},i.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},i.getVector3=function(t){return this.vector3s[t]},i.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},i.getVector4=function(t){return this.vector4s[t]},i.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},i.getColor=function(t){return this.colors[t]},i.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},i.getQuaternion=function(t){return this.quaternions[t]},i.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},i.getMatrix=function(t){return this.matrices[t]},i.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},i.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},i.getVector4Array=function(t){return this.vector4Arrays[t]},i.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var i,r=w(e);!(i=r()).done;){var n=i.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},i.getMatrixArray=function(t){return this.matrixArrays[t]},i.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var i,r=w(e);!(i=r()).done;)for(var n=i.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},i.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},i.getTexture=function(t){return this.textures[t]},i.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},i.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},i.clone=function(t){var i=t||this.props,r=this.engine;ut(r);var n=new e(r,i);return n.glMaterialState=Object.assign(new yd,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.colors=this.colors,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirty=!0,n},i.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var i=ri({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===qt.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var r,n,a=e.stringTags.RenderFace;for(r in a===Kt.Front?(this.culling=!0,this.cullFace=Mr.BACK):a===Kt.Back?(this.culling=!0,this.cullFace=Mr.FRONT):this.culling=!1,i.floats)this.setFloat(r,i.floats[r]);for(r in i.ints)this.setInt(r,i.ints[r]);for(r in i.vector4s){var s=i.vector4s[r];this.setVector4(r,new gr(s.x,s.y,s.z,s.w))}for(r in i.colors){var o=i.colors[r];this.setColor(r,new Er(o.r,o.g,o.b,o.a))}for(r in i.textures){var u=i.textures[r],h=this.engine.findObject(u.texture);this.setTexture(r,h);var l=u.offset,c=u.scale;l&&c&&this.setVector4(r+"_ST",new gd(c.x,c.y,l.x,l.y))}if(e.shader){var f=this.engine.findObject(e.shader);f&&(this.shader=f,this.shaderSource=f.shaderData)}this.stringTags=null!=(n=e.stringTags)?n:{},this.initialized=!1},i.toData=function(){var t=this.defination;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=Ae.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var i in this.ints)t.ints[i]=this.ints[i];for(var r in this.vector4s)t.vector4s[r]=this.vector4s[r];for(var n in this.colors)t.colors[n]=this.colors[n];for(var a in this.textures){t.textures[a]||(t.textures[a]={texture:this.textures[a]});var s=t.textures[a],o=this.getVector4(a+"_ST");o&&(s.scale={x:o.x,y:o.y},s.offset={x:o.z,y:o.w},delete t.vector4s[a+"_ST"])}return t},i.cloneUniforms=function(t){var e,i=t;for(e in i.floats)this.setFloat(e,i.floats[e]);for(e in i.ints)this.setInt(e,i.ints[e]);for(e in i.floatArrays)this.setFloats(e,i.floatArrays[e]);for(e in i.textures)this.setTexture(e,i.textures[e]);for(e in i.vector2s)this.setVector2(e,i.vector2s[e]);for(e in i.vector3s)this.setVector3(e,i.vector3s[e]);for(e in i.vector4s)this.setVector4(e,i.vector4s[e]);for(e in i.colors)this.setColor(e,i.colors[e]);for(e in i.quaternions)this.setQuaternion(e,i.quaternions[e]);for(e in i.matrices)this.setMatrix(e,i.matrices[e]);for(e in i.vector4Arrays){for(var r=[],n=0;n<i.vector4Arrays[e].length;n+=4)r.push(new gd(i.vector4Arrays[e][n],i.vector4Arrays[e][n+1],i.vector4Arrays[e][n+2],i.vector4Arrays[e][n+3]));this.setVector4Array(e,r)}for(e in i.matrixArrays){for(var a=[],s=0;s<i.matrixArrays[e].length;s+=16){for(var o=xd.fromIdentity(),u=0;u<16;u++)o.elements[u]=i.matrixArrays[e][s+u];a.push(o)}this.setMatrixArray(e,a)}},i.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},i.dispose=function(t){var e,i=this;this.destroyed||(null==(e=this.shaderVariant)||e.dispose(),(null==t?void 0:t.textures)!==mt.keep&&Object.keys(this.textures).forEach((function(t){var e=i.textures[t];e!==i.engine.emptyTexture&&e.dispose()})),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=Ct,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},dr(e,[{key:"blending",get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)}},{key:"blendColor",get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)}},{key:"blendFunction",get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)}},{key:"blendEquation",get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)}},{key:"depthTest",get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)}},{key:"depthMask",get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)}},{key:"depthRange",get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)}},{key:"depthFunc",get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)}},{key:"polygonOffsetFill",get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)}},{key:"polygonOffset",get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)}},{key:"sampleAlphaToCoverage",get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)}},{key:"colorMask",get:function(){return this.glMaterialState.colorMask[0]},set:function(t){this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(On),Td=function(){function t(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}var e=t.prototype;return e.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},e.copyTexture=function(t,e){this.renderer&&(t.initialize(),e.initialize(),e.updateSource({sourceType:Rr.framebuffer,data:{width:e.getWidth()||t.getWidth(),height:e.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,e):this.copy1(t,e))},e.copy2=function(t,e){var i=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(i)},e.copy1=function(t,e){var i=this.copyRenderPass;if(i){var r=this.renderer;if(r){var n=i.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),r.glRenderer.resetColorAttachments(n,[e]),i.meshes[0].material.setTexture("uTex",t),r.renderRenderPass(i)}}},e.createCopyRenderPass=function(){var t="mri-copy-mesh",e={texture:{format:Mr.RGBA}},i=this.renderer.engine,r=new dd(i,{name:t,mode:Mr.TRIANGLE_STRIP,attributes:{aPos:{type:Mr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=i.gpuCapability.level,a=new bd(i,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===n?In.GLSL3:In.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var s=new ra(i,{name:t,geometry:r,material:a,priority:0});return new Ed(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:Ir.whatever},attachments:[e],meshes:[s]})},e.dispose=function(){var t;this.renderer&&(null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0)},t}(),Ed=function(t){function e(){return t.apply(this,arguments)}$t(e,t);var i=e.prototype;return i.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},i.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(la),_d=function(){function t(t,e,i){var r=this;void 0===e&&(e="webgl"),void 0===i&&(i={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],ut(t),this.gl=wr(t,e,i),this.contextLostListener=function(t){for(var e,i,n=w(r.lostHandlers);!(i=n()).done;){i.value.lost(t)}null==(e=r.canvas)||e.removeEventListener("webglcontextlost",r.contextLostListener)},this.contextRestoredListener=function(t){for(var e,i,n=w(r.restoreHandlers);!(i=n()).done;){i.value.restore()}null==(e=r.canvas)||e.addEventListener("webglcontextlost",r.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}var e=t.prototype;return e.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},e.addLostHandler=function(t){this.lostHandlers.push(t)},e.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},e.addRestoreHandler=function(t){this.restoreHandlers.push(t)},e.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),wd=function(t){function e(e){var i;return(i=t.call(this)||this).gpuCapability=new Wa(e),i}$t(e,t);var i=e.prototype;return i.dispose=function(){this.destroyed||t.prototype.dispose.call(this)},i.getGLRenderer=function(){return this.renderer},i.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},i.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(Zf),Cd=function(t){function e(e,i){var r;return(r=t.call(this,e)||this).initialized=!1,void 0!==i&&r.initialize(i),r}$t(e,t);var i=e.prototype;return i.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},i.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var i=this.renderer,r=i.gl;i.pipelineContext.bindRenderbuffer(r.RENDERBUFFER,this.buffer),t&&e?r.renderbufferStorage(r.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):vt.error("Invalid render buffer size: "+t+"x"+e+".")}}else vt.error("Can't set size for uninitialized render buffer.")},i.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Ct},e}(Xa),Ad=1,Sd=function(t){function e(e,i){var r;(r=t.call(this)||this).attachmentTextures=[];var n,a=e.depthStencilAttachment,s=e.viewport,o=e.isCustomViewport,u=e.storeAction,h=e.viewportScale,l=void 0===h?1:h,c=e.name,f=void 0===c?"GLFramebuffer"+Ad++:c;return r.renderer=i,r.engine=i.engine,r.depthStencilStorageType=null!=(n=null==a?void 0:a.storageType)?n:Qn.none,r.viewport=s,r.isCustomViewport=!!o,r.viewportScale=l,r.name=f,r.storeAction=u,r.updateProps(e),r}$t(e,t);var i=e.prototype;return i.getDepthTexture=function(){return this.depthTexture},i.getStencilTexture=function(){return this.stencilTexture},i.getColorTextures=function(){return this.colorTextures},i.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(e){e.initialize(),V(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&V(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&V(this.attachmentTextures,this.depthTexture.textureBuffer)},i.updateProps=function(t){var e,i,r=this.renderer,n=this.engine.gpuCapability,a=null!=(i=t.depthStencilAttachment)?i:{storageType:Qn.none},s=t.attachments.length>0,o=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var u=null==(e=t.depthStencilAttachment)?void 0:e.texture,h=n.detail.readableDepthStencilTextures,l=a.storageType,c=a.storage;if(this.colorTextures=t.attachments.slice(),!s&&l!==Qn.none)throw new Error("Use depth stencil attachment without color attachments.");switch(s&&(this.fbo=r.glRenderer.createGLFramebuffer(this,this.name)),l){case Qn.depth_stencil_opaque:if(c){if(!C(c,Cd))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Cd({format:Mr.DEPTH_STENCIL,attachment:Mr.DEPTH_STENCIL_ATTACHMENT,storageType:l},r.glRenderer);o=!1;break;case Qn.depth_16_opaque:if(c){if(!C(c,Cd))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Cd({attachment:Mr.DEPTH_ATTACHMENT,format:Mr.DEPTH_COMPONENT16,storageType:l},r.glRenderer);break;case Qn.stencil_8_opaque:if(c){if(!C(c,Cd))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=c,this.externalStorage=!0}else this.depthStencilRenderbuffer=new Cd({attachment:Mr.STENCIL_ATTACHMENT,format:Mr.STENCIL_INDEX8,storageType:l},r.glRenderer);break;case Qn.depth_16_texture:if(!h)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=u?u:new ed(this.engine,{sourceType:Rr.framebuffer,format:Mr.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:Mr.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case Qn.depth_24_stencil_8_texture:if(!h)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=u?u:new ed(this.engine,{sourceType:Rr.framebuffer,format:Mr.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),o=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,o),this.updateAttachmentTextures()},i.getStoreAttachments=function(t,e){var i=this.renderer.glRenderer.gl,r=this.colorTextures.length;if(t&&Fr(i)&&r>0){var n=[];if(t.depthAction===Jn.clear&&this.depthStorage&&V(n,e?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===Jn.clear&&this.stencilStorage&&V(n,e?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===Jn.clear)for(var a=0;a<r;a++)V(n,i["COLOR_ATTACHMENT"+a]);return n}},i.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;Fr(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},i.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,i=this.renderer.pipelineContext,r=this.viewport,n=r[0],a=r[1],s=r[2],o=r[3];i.bindFramebuffer(e.FRAMEBUFFER,this.fbo),i.viewport(n,a,s,o);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(i.textureUnitDict).forEach((function(e){var r=i.textureUnitDict[e];r&&r!==u&&t.attachmentTextures.includes(r)&&(i.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)i.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var l=this,c=l.depthStencilRenderbuffer,f=l.depthTexture,d=l.stencilTexture;if(i.activeTexture(e.TEXTURE0),c)c.setSize(s,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,c.attachment,e.RENDERBUFFER,c.buffer);else if(f){f.source.data={width:s,height:o},f.update({data:{width:s,height:o,data:new Uint16Array(0)}});var p=f&&d?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,p,e.TEXTURE_2D,f.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var m=e.checkFramebufferStatus(e.FRAMEBUFFER);if(m!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed. gl status="+m+", gl error="+e.getError()+", gl isContextLost="+e.isContextLost()+".");this.ready=!0}}},i.resetColorTextures=function(t){var e=t,i=this.renderer.glRenderer.gl,r=this.engine.gpuCapability,n=this.viewport,a=[];if(e){for(var s,o=w(e);!(s=o()).done;){s.value.initialize()}this.colorTextures=e.slice()}this.renderer.pipelineContext.activeTexture(i.TEXTURE0),this.colorTextures.forEach((function(t,e){var s={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:s}),r.framebufferTexture2D(i,i.FRAMEBUFFER,e,i.TEXTURE_2D,t.textureBuffer),a.push(!0)})),r.drawBuffers(i,a),this.updateAttachmentTextures()},i.resize=function(t,e,i,r){var n=this.viewport,a=n[0],s=n[1],o=n[2],u=n[3];a===t&&s===e&&o===i&&u===r||(this.viewport=[t,e,i,r],this.ready=!1,this.bind())},i.dispose=function(t){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var e,i,r=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:oa.force;if(r===oa.force||r===oa.keepExternal&&!this.externalStorage)null==(e=this.depthStencilRenderbuffer)||e.dispose(),null==(i=this.depthTexture)||i.dispose();this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},dr(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==Qn.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==Qn.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(qa),Id=((md={})[Mr.FLOAT]=1,md[Mr.INT]=1,md[Mr.UNSIGNED_INT]=1,md[Mr.SHORT]=1,md[Mr.BOOL]=1,md[Mr.UNSIGNED_SHORT]=1,md[Mr.FLOAT_VEC2]=2,md[Mr.FLOAT_VEC3]=3,md[Mr.FLOAT_VEC4]=4,md[Mr.FLOAT_MAT2]=4,md[Mr.FLOAT_MAT3]=9,md[Mr.FLOAT_MAT4]=16,md[Mr.FLOAT_MAT2x3]=6,md[Mr.FLOAT_MAT2x4]=8,md[Mr.FLOAT_MAT4x3]=12,md[Mr.FLOAT_MAT4x2]=8,md[Mr.FLOAT_MAT3x4]=12,md[Mr.FLOAT_MAT3x2]=6,md[Mr.INT_VEC2]=2,md[Mr.INT_VEC3]=3,md[Mr.INT_VEC4]=4,md[Mr.UNSIGNED_INT_VEC2]=2,md[Mr.UNSIGNED_INT_VEC3]=3,md[Mr.UNSIGNED_INT_VEC4]=4,md[Mr.BOOL_VEC2]=2,md[Mr.BOOL_VEC3]=3,md[Mr.BOOL_VEC4]=4,md),Rd=Pd(Float32Array),Od=Pd(Int32Array),Md=Pd(Uint8Array);function Nd(t){return function(e,i,r,n){var a={start:i[1],dirty:!0};if(i[2]>1){var s=e;if(s.length){for(var o=n[1]||s.length,u=i[4]/t.BYTES_PER_ELEMENT,h=a.buffer=new t(o*u),l=n[0]||0,c=0;c<o;c++)h[c*u]=s[c+l];a.start+=l*u}}else a.buffer=new t([e]);return a}}function Pd(t){return function(e,i,r,n){for(var a=i[8],s=i[2],o=i[5],u=1===s?a:i[4],h=o?u/o:1,l=u/t.BYTES_PER_ELEMENT/h,c=a/t.BYTES_PER_ELEMENT/l,f=Id[i[0]],d=f/h,p=(n[0]||0)*f,m=n[1]?h*n[1]:c,v=new t(l*m),y={start:i[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=p;g<m;g++){for(var T=0;T<d;T++)v[x+T]=e[b+T];x+=l,b+=d}return y}}function Fd(t,e){for(var i=function(i){var a=t.getActiveUniformBlockName(e,i);ut(a);var s={index:t.getUniformBlockIndex(e,a),usedByVertexShader:t.getActiveUniformBlockParameter(e,i,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,i,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,i,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,i,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:a,id:""};s.used=s.usedByVertexShader||s.usedByFragmentShader,r[i]=s;for(var o=s.uniformIndices,u=[],h=0;h<o.length;h++){var l=t.getActiveUniform(e,o[h]).name.replace("[0]","");s.uniforms[l]=[0,0,0,0,0,0,0,h,0],u[h]=l,n.push(l)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach((function(i,r){t.getActiveUniforms(e,o,i).forEach((function(t,e){var i=u[e];s.uniforms[i][r]=+t}))}));for(var c=0;c<u.length;c++){var f=s.uniforms[u[c]],d=s.uniforms[u[c+1]],p=d?d[1]:s.size;f[8]=p-f[1]}s.id=function(t){var e=t.name,i=t.size,r=t.uniforms,n=t.uniformIndices,a=Object.keys(r).map((function(t){return t+"["+r[t].join(":")+"]"})).join("+");return Ld(e+"+",i+"+",n.length+"+",a)}(s)+""},r=[],n=[],a=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),s=0;s<a;++s)i(s);return{blockSpecs:r,blockUniformNames:n}}function Ld(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];for(var r=0,n=0;n<arguments.length;n++)for(var a=e[n],s=0;s<a.length;s++)r=Math.imul(31,r)+a.charCodeAt(s)|0;return r}(vd={})[Mr.FLOAT]=Nd(Float32Array),vd[Mr.INT]=Nd(Int32Array),vd[Mr.UNSIGNED_INT]=Nd(Uint32Array),vd[Mr.SHORT]=Nd(Int16Array),vd[Mr.BOOL]=Nd(Uint8Array),vd[Mr.UNSIGNED_SHORT]=Nd(Uint16Array),vd[Mr.FLOAT_VEC2]=Rd,vd[Mr.FLOAT_VEC3]=Rd,vd[Mr.FLOAT_VEC4]=Rd,vd[Mr.FLOAT_MAT2]=Rd,vd[Mr.FLOAT_MAT3]=Rd,vd[Mr.FLOAT_MAT4]=Rd,vd[Mr.FLOAT_MAT2x3]=Rd,vd[Mr.FLOAT_MAT2x4]=Rd,vd[Mr.FLOAT_MAT4x3]=Rd,vd[Mr.FLOAT_MAT4x2]=Rd,vd[Mr.FLOAT_MAT3x4]=Rd,vd[Mr.FLOAT_MAT3x2]=Rd,vd[Mr.INT_VEC2]=Od,vd[Mr.INT_VEC3]=Od,vd[Mr.INT_VEC4]=Od,vd[Mr.UNSIGNED_INT_VEC2]=Od,vd[Mr.UNSIGNED_INT_VEC3]=Od,vd[Mr.UNSIGNED_INT_VEC4]=Od,vd[Mr.BOOL_VEC2]=Md,vd[Mr.BOOL_VEC3]=Md,vd[Mr.BOOL_VEC4]=Md;var Vd=function(){function t(t,e,i){var r=this;this.engine=t,this.program=e,this.id=i,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;(this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),Fr(n))&&Fd(n,e).blockSpecs.forEach((function(t){return r.uniformBlockMap[t.name]=t}));this.pipelineContext.useProgram(null)}var e=t.prototype;return e.bind=function(){this.pipelineContext.useProgram(this.program)},e.setupAttributes=function(t){var e,i,r=this,n=this.id,a=this.pipelineContext.gl;return t.vaos[n]?i=t.vaos[n]:((i=new rd(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),t.vaos[n]=i),i&&i.vao&&(i.bind(),i.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var i=r.attribInfoMap[e],n=t.attributes[e];if(n){var s=t.buffers[n.dataSource];if(!s)throw new Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");s.bind(),a.enableVertexAttribArray(i.loc),a.vertexAttribPointer(i.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null==(e=t.indicesBuffer)||e.bind(),i&&(i.ready=!0)),i},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,i={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<r;n++){var a=t.getActiveAttrib(e,n);if(a){var s=a.name,o=a.type,u=a.size,h=t.getAttribLocation(e,s);i[s]={type:o,name:s,size:u,loc:h}}}return i},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),Dd=function(t){function e(e,i){var r;return(r=t.call(this,e,i)||this).initialized=!1,r.uniformLocations={},r.samplerChannels={},r}$t(e,t);var i=e.prototype;return i.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},i.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.fillShaderInformation=function(t,e){var i=e.slice();t=t.concat(i);for(var r,n=this.pipelineContext.getUniforms(this.program.program,t),a=0;a<t.length;a++)this.uniformLocations[t[a]]=n[a];for(r=0;r<i.length;r++){null==this.uniformLocations[i[r]]&&(i.splice(r,1),r--)}for(r=0;r<i.length;r++){var s=i[r];this.samplerChannels[s]=r}},i.toData=function(){var t=this.defination;t.dataType=Ae.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},i.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(Nn),kd=0,zd=function(){function t(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}var e=t.prototype;return e.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var i,r=[],n=w(Object.keys(this.cachedShaders));!(i=n()).done;){var a=i.value;this.cachedShaders[a].initialized||r.push(a)}t?r.length?Promise.all(r.map((function(t){return new Promise((function(i){return e.compileShader(e.cachedShaders[t],i)}))}))).then(t).catch((function(){return 0})):t([]):r.map((function(t){return e.compileShader(e.cachedShaders[t])})),this.shaderAllDone=!0}},e.addShader=function(t,e){var i,r,n=[];t.macros&&(i=n).push.apply(i,[].concat(t.macros));e&&(r=n).push.apply(r,[].concat(e));var a=ri({},t,{vertex:Ra.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Ar.vertex,shader:t.vertex,macros:n}),fragment:Ra.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:Ar.fragment,shader:t.fragment,macros:n})}),s=this.computeShaderCacheId(a);if(this.cachedShaders[s])return s;this.shaderAllDone=!1;var o=!1;return(a.shared||a.cacheId)&&(o=!0),this.cachedShaders[s]=new Dd(this.engine,ri({},a,{vertex:a.vertex,fragment:a.fragment,name:a.name||s,shared:o})),this.cachedShaders[s].id=s,s},e.createShader=function(t,e){var i=this.addShader(t,e);return this.cachedShaders[i]},e.compileShader=function(t,e){var i=this,r=t.source,n=r.shared,a=r.vertex,s=r.fragment,o=r.name,u=t.source.cacheId,h=!1;(n||u)&&(h=!0);var l=this.pipelineContext.gl,c={shared:h,status:Sn.compiling},f=this.createProgram(l,a,s,c),p=this.glAsyncCompileExt,m=d.now(),v=function(e){c.status=Sn.success,c.compileTime=d.now()-m,t.program=e,t.initialized=!0,t.pipelineContext=i.pipelineContext,void 0!==i.programMap[t.id]&&console.warn("Find duplicated shader id: "+t.id+"."),i.programMap[t.id]=e},y=function(){if(i.engine.isDestroyed)return console.warn("The player is destroyed during the loadScene process. Please check the timing of calling loadScene and dispose. A common situation is that when calling loadScene, await is not added. This will cause dispose to be called before loadScene is completed."),null==e?void 0:e(c);if(t.initialized)return null==e?void 0:e(c);var r=(!e||!p||p&&1==l.getProgramParameter(c.program,p.COMPLETION_STATUS_KHR))&&f();if(r){if(c.status!==Sn.fail){sd(r,o);var n=new Vd(i.engine,r,t.id);if(l.validateProgram(r),l.getProgramParameter(r,l.VALIDATE_STATUS))v(n);else{var u=l.getProgramInfoLog(r);(null==u?void 0:u.includes("the same texture"))||(null==u?void 0:u.includes("Two textures of different types use the same sampler"))?v(n):(c.status=Sn.fail,c.error=u,console.error("compileProgramError: "+u,"\nvertex:\n",a,"\nfragment:\n",s),l.deleteProgram(r))}}null==e||e(c)}else e&&x(y)};t.compileResult=c,y()},e.computeShaderCacheId=function(t){var e=t.vertex,i=void 0===e?"":e,r=t.fragment,n=void 0===r?"":r,a=t.shared,s=t.cacheId;return a||s?s||"shared_"+Ld(i,n):"instanced_"+kd++},e.createProgram=function(t,e,i,r){var n=t.createProgram(),a=this.createGLShader(t,t.VERTEX_SHADER,e),s=this.createGLShader(t,t.FRAGMENT_SHADER,i);return n&&a&&s?(t.attachShader(n,a),t.attachShader(n,s),t.linkProgram(n),r.program=n,r.status=Sn.compiling,function(){if(r.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var o=t.getProgramInfoLog(n);console.error("Failed to link program: "+o+".");var u=Ud(t,a,"vertex",e),h=Ud(t,s,"fragment",i);return r.status=Sn.fail,u&&(r.error=u.error,r.status=u.status),h&&(r.error=h.error,r.status=h.status),n}return n}):(r.status=Sn.fail,function(){return null})},e.createGLShader=function(t,e,i){var r=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Ld(null!=i?i:""),a=r.get(n);if(a)return a;var s=t.createShader(e);return s&&(t.shaderSource(s,i),t.compileShader(s),r.set(n,s)),s},e.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},e.restore=function(){},e.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach((function(e){t.programMap[e].dispose()})),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},t}();function Ud(t,e,i,r){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+i+" error: "+n,(null!=r?r:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:Sn.fail}}}var Bd=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new zd(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}var e=t.prototype;return e.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=Mr.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderbuffer={}},e.toggle=function(t,e){e?this.enable(t):this.disable(t)},e.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},e.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},e.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},e.bindRenderbuffer=function(t,e){this.currentRenderbuffer[t]!==e&&(this.currentRenderbuffer[t]=e,this.gl.bindRenderbuffer(t,e))},e.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.useProgram=function(t){this.set1("useProgram",t)},e.clear=function(t){this.gl.clear(t)},e.clearDepth=function(t){this.set1("clearDepth",t)},e.depthFunc=function(t){this.set1("depthFunc",t)},e.depthMask=function(t){this.set1("depthMask",t)},e.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},e.depthRange=function(t,e){this.set2("depthRange",t,e)},e.clearStencil=function(t){this.set1("clearStencil",t)},e.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},e.stencilFunc=function(t,e,i){this.stencilFuncSeparate(this.gl.FRONT,t,e,i),this.stencilFuncSeparate(this.gl.BACK,t,e,i)},e.stencilFuncSeparate=function(t,e,i,r){this.set4("stencilFuncSeparate",t,e,i,r)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,i){this.stencilOpSeparate(this.gl.FRONT,t,e,i),this.stencilOpSeparate(this.gl.BACK,t,e,i)},e.stencilOpSeparate=function(t,e,i,r){this.set4("stencilOpSeparate",t,e,i,r)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,i,r){this.set4("clearColor",t,e,i,r)},e.colorMask=function(t,e,i,r){this.set4("colorMask",t,e,i,r)},e.blendColor=function(t,e,i,r){this.set4("blendColor",t,e,i,r)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,i,r){this.set4("blendFuncSeparate",t,e,i,r)},e.blendEquation=function(t){this.set1("blendEquation",t)},e.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},e.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},e.viewport=function(t,e,i,r){this.set4("viewport",t,e,i,r)},e.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},e.bindTexture=function(t,e,i){(this.currentTextureBinding!==e||i)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},e.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},e.set2=function(t,e,i){var r=this.glCapabilityCache[t];r||(r=this.glCapabilityCache[t]={x:NaN,y:NaN}),r.x===e&&r.y===i||this.gl[t](r.x=e,r.y=i)},e.set3=function(t,e,i,r){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===i&&n.z===r||this.gl[t](n.x=e,n.y=i,n.z=r)},e.set4=function(t,e,i,r,n){var a=this.glCapabilityCache[t];a||(a=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),a.x===e&&a.y===i&&a.z===r&&a.w===n||this.gl[t](a.x=e,a.y=i,a.z=r,a.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,i){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var r=i.target;this.gl.bindTexture(r,i.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var i=[],r=0;r<e.length;r++)i.push(this.gl.getUniformLocation(t,e[r]));return i},e.setFloat4=function(t,e,i,r,n){t&&this.gl.uniform4f(t,e,i,r,n)},e.setFloat3=function(t,e,i,r){t&&this.gl.uniform3f(t,e,i,r)},e.setFloat2=function(t,e,i){t&&this.gl.uniform2f(t,e,i)},t}(),Gd=function(t){function e(e,i,r){var n;(n=t.call(this)||this).canvas=e,n.temporaryRTs={};var a=ri({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},r);n.context=new _d(e,i,a);var s=n.context.gl;return ut(s),n.engine=new wd(s),n.engine.renderer=Lu(n),n.pipelineContext=new Bd(n.engine,s),n.glRenderer=new ad(n.engine),n.extension=new Td(Lu(n)),n.renderingData={currentFrame:{}},n.framebuffer=new Sd({storeAction:{},viewport:[0,0,n.width,n.height],attachments:[new ed(n.engine,{sourceType:Rr.framebuffer,data:{width:n.width,height:n.height}})],depthStencilAttachment:{storageType:Qn.none}},Lu(n)),n}$t(e,t);var i=e.prototype;return i.renderRenderFrame=function(t){var e,i=t;i.resource&&i.resource.color_b.initialize(),i.emptyTexture.initialize(),i.transparentTexture.initialize();var r=i._renderPasses;if(this.isDestroyed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=i.renderer.getShaderLibrary())||e.compileAllShaders(),this.setFramebuffer(null),this.clear(i.clearAction);var n=i.camera;this.renderingData.currentFrame=i,this.renderingData.currentCamera=n,this.setGlobalMatrix("effects_MatrixInvV",n.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",n.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",n.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",n.getProjectionMatrix()),this.setGlobalVector3("effects_WorldSpaceCameraPos",n.position),nt(r);for(var a,s=w(r);!(a=s()).done;){var o=a.value,u=o.delegate;null==u.willBeginRenderPass||u.willBeginRenderPass.call(u,o,this.renderingData),this.renderRenderPass(o),null==u.didEndRenderPass||u.didEndRenderPass.call(u,o,this.renderingData)}for(var h,l=w(r);!(h=l()).done;){h.value.frameCleanup(this)}}},i.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},i.renderMeshes=function(t){for(var e,i=this.renderingData.currentPass.delegate,r=w(t);!(e=r()).done;){var n=e.value;null==i.willRenderMesh||i.willRenderMesh.call(i,n,this.renderingData),n.render(this),null==i.didRenderMesh||i.didRenderMesh.call(i,n,this.renderingData)}},i.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},i.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},i.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},i.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},i.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},i.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},i.drawGeometry=function(t,e,i){if(void 0===i&&(i=0),t&&e){e.initialize(),t.initialize(),t.flush();var r=this.renderingData;r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,e,i)}},i.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},i.getFramebuffer=function(){return this.framebuffer},i.getTemporaryRT=function(t,e,i,r,n,a){if(this.temporaryRTs[t])return this.temporaryRTs[t];var s,o,u=Qn.none;n===Ua.Linear?s=Mr.LINEAR:n===Ua.Nearest&&(s=Mr.NEAREST),a===Ba.RGBA32?o=Mr.UNSIGNED_BYTE:a===Ba.RGBAHalf&&(o=Mr.HALF_FLOAT),0===r?u=Qn.none:16===r?u=Qn.depth_16_opaque:24===r&&(u=Qn.depth_24_stencil_8_texture);var h=new ed(this.engine,{sourceType:Rr.framebuffer,minFilter:s,magFilter:s,internalFormat:Mr.RGBA,format:Mr.RGBA,type:o}),l=new Sd({name:t,storeAction:{},viewport:[0,0,e,i],viewportScale:1,isCustomViewport:!0,attachments:[h],depthStencilAttachment:{storageType:u}},this);return this.temporaryRTs[t]=l,l},i.setViewport=function(t,e,i,r){this.pipelineContext.viewport(t,e,i,r)},i.clear=function(t){var e=this.pipelineContext,i=0;if(t.colorAction===Ir.clear){var r=t.clearColor;r&&e.clearColor(r[0],r[1],r[2],r[3]),e.colorMask(!0,!0,!0,!0),i=Mr.COLOR_BUFFER_BIT}if(t.stencilAction===Ir.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),i|=Mr.STENCIL_BUFFER_BIT),t.depthAction===Ir.clear){var n=t.clearDepth;e.depthMask(!0),e.clearDepth(Number.isFinite(n)?n:1),i|=Mr.DEPTH_BUFFER_BIT}i&&e.clear(i)},i.addLostHandler=function(t){this.context.addLostHandler(t)},i.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},i.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},i.getWidth=function(){return this.width},i.getHeight=function(){return this.height},i.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},i.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},i.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context.");this.engine.gpuCapability=new Wa(t),this.engine.renderer=this,this.pipelineContext=new Bd(this.engine,t),this.glRenderer=new ad(this.engine),this.extension=new Td(this)},i.resize=function(t,e){var i=this.glRenderer;i&&(this.width===t&&this.height===e||i.resize(t,e))},i.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},dr(e,[{key:"isDestroyed",get:function(){var t=this.glRenderer;return!t||t.isDestroyed}},{key:"height",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.height)?e:0}},{key:"width",get:function(){var t,e;return null!=(e=null==(t=this.glRenderer)?void 0:t.width)?e:0}}]),e}(Ka),jd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY",Xd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT",Hd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW",Wd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Yd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Zd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",qd="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var Kd=new Map;function Qd(t){return Kd.has(t)}function Jd(t){return Kd.get(t)}function $d(){return Array.from(Kd.values())}var tp=!1,ep=1,ip=function(t){function e(e){var a;(a=t.call(this)||this).compositions=[],a.displayScale=1,a.resumePending=!1,a.disposed=!1,a.assetManagers=[],a.speed=1,a.baseCompositionIndex=0,a.useExternalCanvas=!1,a.lost=function(t){var e;null==(e=a.ticker)||e.pause(),a.compositions.forEach((function(e){return e.lost(t)})),a.renderer.lost(t),a.handleEmitEvent("webglcontextlost",t),np(Lu(a),!1)};var s=Lu(a);a.restore=E((function(){var t;return I(this,(function(e){switch(e.label){case 0:return s.renderer.restore(),[4,Promise.all(s.compositions.map(E((function(t){var e,i,r,n,a,o,u,h,l,c,f,d;return I(this,(function(p){switch(p.label){case 0:return e=t.time,i=t.url,r=t.speed,n=t.keepResource,a=t.reusable,o=t.renderOrder,u=t.transform,h=t.videoState,[4,s.loadScene(i)];case 1:(l=p.sent()).speed=r,l.reusable=a,l.keepResource=n,l.renderOrder=o,l.transform.setPosition(u.position.x,u.position.y,u.position.z),l.transform.setRotation(u.rotation.x,u.rotation.y,u.rotation.z),l.transform.setScale(u.scale.x,u.scale.y,u.scale.z),c=0,p.label=2;case 2:return c<h.length?h[c]?((f=l.textures[c].source.video).currentTime=null!=(d=h[c])?d:0,[4,f.play()]):[3,4]:[3,5];case 3:p.sent(),p.label=4;case 4:return c++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return s.compositions=e.sent(),s.emit("webglcontextrestored"),null==(t=s.ticker)||t.resume(),Z()&&s.canvas&&(s.canvas.style.display="none",r.setTimeout((function(){s.canvas.style.display=""}),0)),[2]}}))})),a.handleClick=function(t){var e=t.x,i=t.y,r=[];a.compositions.forEach((function(t){for(var n,s=w(t.hitTest(e,i));!(n=s()).done;){var o=n.value;r.push(ri({},o,{player:Lu(a),composition:t}))}}));for(var n=0;n<r.length;n++){var s=r[n],o=s.behavior||Ht.NOTIFY;o===Ht.NOTIFY?(a.emit("click",ri({},s,{compositionId:s.composition.id,compositionName:s.composition.name})),s.composition.emit("click",ri({},s,{compositionId:s.composition.id,compositionName:s.composition.name}))):o===Ht.RESUME_PLAYER&&a.resume()}};var o=e.container,u=e.canvas,h=e.fps,l=e.name,c=e.pixelRatio,f=e.manualRender,d=e.reportGPUTime,p=e.renderFramework,m=e.notifyTouch,v=e.onError,y=e.interactive,g=void 0!==y&&y,x=e.renderOptions,b=void 0===x?{}:x,T=e.env,_=void 0===T?"":T,C=b.willCaptureImage,A=b.premultipliedAlpha;if(a.onError=v,tp||"debug-disable"===p)return cc(a);var S,R=(S=/iPhone OS (\d+)_(\d+)/.exec(n.userAgent))&&("13"===S[1]||"16"===S[1]&&"5"===S[2])?"webgl":"webgl2";p&&(R="webgl"===p?"webgl":"webgl2"),a.reportGPUTime=d,a.pixelRatio=Number.isFinite(c)?c:H(),a.offscreenMode=!0,a.env=_,a.name=l||""+ep++;try{if(Or.length)throw new Error("Errors before player create: "+Or.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?(a.canvas=u,a.useExternalCanvas=!0):(ap(o),a.canvas=i.createElement("canvas"),o.appendChild(a.canvas)),a.container=a.canvas.parentElement,a.renderer=Ka.create(a.canvas,R,{preserveDrawingBuffer:C,premultipliedAlpha:A}),a.renderer.env=_,a.renderer.addLostHandler({lost:a.lost}),a.renderer.addRestoreHandler({restore:a.restore}),a.gpuCapability=a.renderer.engine.gpuCapability,a.assetService=new If(a.renderer.engine),f||(a.ticker=new Kf(h),a.ticker.add(a.tick.bind(Lu(a)))),a.event=new ho(a.canvas,!!m),a.event.bindListeners(),a.event.addEventListener(ao,a.handleClick),a.interactive=g,a.resize(),Il(a.gpuCapability.detail)}catch(t){a.canvas&&!a.useExternalCanvas&&a.canvas.remove(),a.handleThrowError(t)}return Kd.forEach((function(t){t.gpuCapability.type!==a.gpuCapability.type&&vt.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+a.gpuCapability.type+".\nsee "+qd+".")})),Kd.set(a.canvas,Lu(a)),function(){for(var t,e=[],i=w(Kd.values());!(t=i()).done;){var r=t.value;r.paused||e.push(r)}e.length>1&&vt.error("Current running player count: "+e.length+", see "+Zd+".",e)}(),np(Lu(a),!0),a}$t(e,t);var a=e.prototype;return a.setSpeed=function(t){isNaN(t)||(this.speed=t)},a.getSpeed=function(){return this.speed},a.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},a.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},a.getAssetManager=function(){return this.assetManagers},a.loadScene=function(t,e){var i=this;return E((function(){var r,n,a,s,o,u,h,l,c,f,p,m,v,y,g,x,b,T,_,C;return I(this,(function(A){switch(A.label){case 0:return ut(i.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),s=d.now(),o=[],u=[],l=null==(h=null==e?void 0:e.autoplay)||h,c=null==(n=i.renderer.engine.gpuCapability)||null==(r=n.detail)?void 0:r.asyncShaderCompile,f=i.baseCompositionIndex,xt(t)?(p=o).push.apply(p,[].concat(t)):o.push(t),i.baseCompositionIndex+=o.length,l&&(i.autoPlaying=!0),m=[],[4,Promise.all(o.map(E((function(t,r){var n,a,s,o,h,c,d,p;return I(this,(function(v){switch(v.label){case 0:return n=i.assetService.assembleSceneLoadOptions(t,ri({autoplay:l},e)),a=n.source,s=n.options,h=null!=(o=null==s?void 0:s.autoplay)?o:l,c=new Af(s),i.assetManagers.push(c),[4,c.loadScene(a,i.renderer,{env:i.env})];case 1:return d=v.sent(),i.disposed?(u.length=0,[2]):(i.assetService.prepareAssets(d,d.assets),i.assetService.updateTextVariables(d,c.options.variables),i.assetService.initializeTexture(d),d.pluginSystem.precompile(d.jsonScene.compositions,i.renderer),(p=i.createComposition(d,s)).setIndex(f+r),u[r]=p,m[r]=h,[2])}}))}))))];case 1:return A.sent(),v=d.now(),[4,new Promise((function(t){var e;null==(e=i.renderer.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:for(A.sent(),y=d.now()-v,g=0;g<u.length;g++)m[g]?u[g].play():u[g].pause(),i.compositions.push(u[g]);for(null==(a=i.ticker)||a.start(),u.some((function(t){return!t.getPaused()}))&&i.emit("play",{time:0}),x=u.map((function(t){return t.name})),b=d.now()-s,T=w(u);!(_=T()).done;)(C=_.value).statistic.compileTime=y,C.statistic.firstFrameTime=b;return vt.info("First frame ["+x+"]: "+b.toFixed(4)+"ms."),vt.info("Shader "+(c?"async":"sync")+" compile ["+x+"]: "+y.toFixed(4)+"ms."),[2,xt(t)?u:u[0]]}}))}))()},a.createComposition=function(t,e){var i=this;void 0===e&&(e={});var r=this.renderer,n=new yl(ri({},e,{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,handleItemMessage:function(t){i.emit("message",t)}}),t);return this.ticker&&e.renderLevel===kt.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==Xs&&this.assetService.createShaderVariant(),n},a.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.play()})),null==(t=this.ticker)||t.start(),this.emit("play",{time:0})},a.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.gotoAndPlay(t)})),this.ticker?this.ticker.start():this.doTick(0,!0),this.emit("play",{time:t})},a.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(e){e.gotoAndStop(t)})),this.ticker&&!(null==(e=this.ticker)?void 0:e.getPaused())||this.doTick(0,!0),this.emit("pause")},a.playSequence=function(t){for(var e,i=function(e){t[e].on("end",(function(){t[e+1].play()}))},r=0;r<t.length-1;r++)i(r);t[0].play(),null==(e=this.ticker)||e.start()},a.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},a.resume=function(){var t=this;return E((function(){var e;return I(this,(function(i){switch(i.label){case 0:return t.resumePending?[2]:t.paused?(t.resumePending=!0,[4,Promise.all(t.compositions.map((function(t){return t.reloadTexture()})))]):[3,2];case 1:i.sent(),t.resumePending=!1,t.emit("resume"),i.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}}))}))()},a.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},a.doTick=function(t,e){var i,r=this,n=this.renderer.engine.renderErrors;n.size>0&&(this.handleEmitEvent("rendererror",n.values().next().value),null==(i=this.ticker)||i.pause());t=Math.min(t,33)*this.speed;var a=this.compositions,s=!1;a.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var o,u=[],h=0;h<a.length;h++){var l=a[h];l.textureOffloaded?(s=!0,vt.error("Composition "+l.name+" texture offloaded, skip render."),u.push(l)):(!l.isDestroyed&&l.renderer&&l.update(t),l.isDestroyed||u.push(l))}if(this.compositions=u,this.baseCompositionIndex=this.compositions.length,s)return this.handleEmitEvent("rendererror",new Error("Play when texture offloaded.")),null==(o=this.ticker)?void 0:o.pause();if(!this.paused||e){var c=this.gpuCapability.level,f=this.renderer.context.gl,d=2===c&&this.reportGPUTime?Cr(f):void 0;if(null==d||d.begin(),this.compositions.length||this.compositions.length<a.length||e){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:Ir.clear,clearStencil:0,depthAction:Ir.clear,clearDepth:1,colorAction:Ir.clear,clearColor:[0,0,0,0]});for(var p=0;p<a.length;p++)!a[p].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(a[p].renderFrame)}null==d||d.end(),null==d||d.getTime().then((function(t){return null==r.reportGPUTime?void 0:r.reportGPUTime.call(r,null!=t?t:0)})).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},a.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},a.resize=function(){var t,e,r,n,a=this.canvas.parentElement;if(a){var s=this.getTargetSize(a);t=s[0],e=s[1],r=s[2],n=s[3]}else t=r=this.canvas.width,e=n=this.canvas.height;var o=t/e;if(t&&e){var u,h=i.documentElement.clientWidth;r>2*h&&vt.error("DPI overflowed, width "+r+" is more than 2x document width "+h+", see "+Xd+".");var l=this.env?this.gpuCapability.detail.maxTextureSize:2048;(r>l||n>l)&&(vt.error("Container size overflowed "+r+"x"+n+", see "+jd+"."),o>1?(r=Math.round(l),n=Math.round(l/o)):(n=Math.round(l),r=Math.round(l*o))),this.renderer.resize(r,n),this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",vt.info("Resize player "+this.name+" ["+r+","+n+","+t+","+e+"]."),null==(u=this.compositions)||u.forEach((function(t){t.camera.aspect=o}))}},a.clearCanvas=function(t){t?this.renderer.clear({stencilAction:Ir.clear,clearStencil:0,depthAction:Ir.clear,clearDepth:1,colorAction:Ir.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},a.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},a.dispose=function(t){var e;if(vt.info("Call player destroyed: "+this.name+"."),!this.disposed){Kd.delete(this.canvas),this.pause(),null==(e=this.ticker)||e.stop(),this.assetManagers.forEach((function(t){return t.dispose()})),this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.renderer&&(this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.renderer.dispose(!t)),this.event&&this.event.dispose(),this.assetService.dispose(),np(this,!1),C(this.canvas,m)&&!t&&this.renderer.context&&(fc.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i="Never use destroyed player: "+this.name+" again, see "+Yd+".",r=function(){return function(t){throw new Error(t)}(i)},n=function(){return t=i,Promise.reject(t);var t};this.tick=r,this.resize=r,this.loadScene=n,this.play=n,this.gotoAndPlay=n,this.gotoAndStop=n,this.playSequence=r,this.destroyCurrentCompositions=r,this.resume=n,this.disposed=!0}},a.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},a.getTargetSize=function(t){ap(t);var e,i,n=this.displayAspect,a=null==r.getComputedStyle?void 0:r.getComputedStyle.call(r,t),s=0,o=0;(a?(s=parseInt(a.width,10),o=parseInt(a.height,10)):(s=t.clientWidth,o=t.clientHeight),n)?s/o>n?e=(i=o*this.displayScale)*n:i=(e=s*this.displayScale)/n:(e=s,i=o);var u=this.pixelRatio,h=e,l=i;if(e=Math.round(e*u),(i=Math.round(i*u))<1||i<1){if(!this.offscreenMode)throw new Error("Invalid container size "+e+"x"+i+", see "+Hd+".");e=i=h=l=1}return[h,l,e,i]},a.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},a.handleEmitEvent=function(t,e){this.onError?C(e,b)?this.onError(new Error(e.type,{cause:t}),e):C(e,Error)?this.onError(new Error(e.message,{cause:t}),e):this.onError(new Error("Unknown error.",{cause:t}),e):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,e))},dr(e,[{key:"compositionCount",get:function(){return this.compositions.length}},{key:"hasPlayable",get:function(){return this.compositions.length>0}},{key:"paused",get:function(){var t;return null==(t=this.ticker)?void 0:t.getPaused()}},{key:"interactive",get:function(){return this.event.enabled},set:function(t){this.event.enabled=t}}]),e}(fl);function rp(t){tp=!!t}function np(t,e){Object.keys(Rt).forEach((function(i){var r=Rt[i],n=e?r.onPlayerCreated:r.onPlayerDestroy;null==n||n(t)}))}function ap(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Wd+".")}S([function(t,e,i){var r=i.value;return i.value=E((function(){var e,i,n,a,s=arguments;return I(this,(function(o){switch(o.label){case 0:for(e=s.length,i=new Array(e),n=0;n<e;n++)i[n]=s[n];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r.apply(this,i)];case 2:return[2,o.sent()];case 3:return a=o.sent(),t.handleThrowError.call(this,a),[3,4];case 4:return[2]}}))})),i}],ip.prototype,"loadScene",null),fn.create=function(t,e){return new ed(t,e)},fn.createWithData=function(t,e,i){void 0===e&&(e=it("#fff")),void 0===i&&(i={});var r=i.type,n=void 0===r?Mr.UNSIGNED_BYTE:r,a=i.format,s=void 0===a?Mr.RGBA:a,o=i.internalFormat,u=i.wrapS,h=void 0===u?Mr.MIRRORED_REPEAT:u,l=i.wrapT,c=void 0===l?Mr.MIRRORED_REPEAT:l,f=i.minFilter,d=void 0===f?Mr.NEAREST:f,p=i.magFilter,m=void 0===p?Mr.NEAREST:p,v=i.flipY,y=void 0!==v&&v;return new ed(t,{data:e,type:n,sourceType:Rr.data,format:s,internalFormat:o||s,wrapS:h,wrapT:c,minFilter:d,magFilter:m,flipY:y})},On.create=function(t,e){return new bd(t,e)},Wn.create=function(t,e){return new dd(t,e)},ra.create=function(t,e){return new ra(t,e)},Xa.create=function(t){return new Cd(t)},qa.create=function(t,e){return new Sd(t,e)},Ka.create=function(t,e,i){return new Gd(t,e,i)},Zf.create=function(t){return new wd(t)};var sp="2.6.5";vt.info("Player version: 2.6.5.");export{Qt as AbstractPlugin,zl as ActivationPlayable,Ul as ActivationPlayableAsset,Gh as ActivationTrack,Mi as AndNode,Oi as AndNodeData,pi as Animatable,Bl as AnimationClip,di as AnimationClipNode,ci as AnimationClipNodeData,ti as AnimationGraphAsset,vr as Animator,Si as ApplyAdditiveNode,Ai as ApplyAdditiveNodeData,bc as Asset,_c as AssetLoader,Af as AssetManager,If as AssetService,Hn as BYTES_TYPE_MAP,Js as BaseRenderComponent,mr as Behaviour,yu as BezierCurve,ru as BezierCurvePath,nu as BezierCurveQuat,Tc as BinaryAsset,Ri as BlendNode,Ii as BlendNodeData,$e as BoolValueNode,za as COMPRESSED_TEXTURE,Dn as COPY_FRAGMENT_SHADER,Ln as COPY_MESH_SHADER_ID,Vn as COPY_VERTEX_SHADER,Ml as CalculateLoader,Uu as Camera,io as CameraController,no as CameraVFXItemLoader,_u as ColorCurve,$h as ColorPropertyPlayableAsset,Jh as ColorPropertyTrack,pr as Component,Cl as ComponentTimePlayable,wl as ComponentTimePlayableAsset,_l as ComponentTimeTrack,yl as Composition,ll as CompositionComponent,zi as ConstBoolNode,ki as ConstBoolNodeData,Di as ConstFloatNode,Vi as ConstFloatNodeData,ji as ControlParameterBoolNode,Gi as ControlParameterBoolNodeData,Bi as ControlParameterFloatNode,Ui as ControlParameterFloatNodeData,Hi as ControlParameterTriggerNode,Xi as ControlParameterTriggerNodeData,mc as DEFAULT_FONTS,qf as DEFAULT_FPS,wc as Database,ft as Deferred,mt as DestroyOptions,jr as Downloader,Fn as EFFECTS_COPY_MESH_NAME,ao as EVENT_TYPE_CLICK,uo as EVENT_TYPE_TOUCH_END,oo as EVENT_TYPE_TOUCH_MOVE,so as EVENT_TYPE_TOUCH_START,br as EffectComponent,Be as EffectsObject,Yf as EffectsPackage,sc as Ellipse,Zf as Engine,Zi as EqualNodeData,fl as EventEmitter,ho as EventSystem,to as Fake3DAnimationMode,eo as Fake3DComponent,Ua as FilterMode,vo as Float16ArrayWrapper,Ji as FloatComparisonNode,Qi as FloatComparisonNodeData,tl as FloatPropertyPlayableAsset,Xh as FloatPropertyTrack,Je as FloatValueNode,qa as Framebuffer,wd as GLEngine,dd as GLGeometry,Gd as GLRenderer,In as GLSLVersion,Wa as GPUCapability,Wn as Geometry,ja as GlobalUniforms,tu as GradientValue,cr as GraphInstance,Ze as GraphNode,qe as GraphNodeData,lc as GraphicsPath,$i as GreaterNodeData,Hs as HELP_LINK,ro as HitTestType,Au as InteractComponent,po as InteractLoader,Cu as InteractMesh,Ye as InvalidIndex,cl as Item,yn as KTXTexture,Yi as LayerBlendNode,Wi as LayerBlendNodeData,tr as LessNodeData,eu as LineSegments,$o as LinearValue,Sr as MaskMode,Mn as MaskProcessor,On as Material,wn as MaterialDataBlock,_n as MaterialRenderType,Zh as MaterialTrack,ra as Mesh,Ru as MeshCollider,_i as NodeTransform,Li as NotNode,Fi as NotNodeData,il as ObjectBindingTrack,Pi as OrNode,Ni as OrNodeData,W as OrderType,Xs as PLAYER_OPTIONS_ENV_EDITOR,Yu as POST_PROCESS_SETTINGS,nh as ParticleBehaviourPlayable,ah as ParticleBehaviourPlayableAsset,Ol as ParticleLoader,oh as ParticleMesh,dh as ParticleSystem,fh as ParticleSystemRenderer,qh as ParticleTrack,jn as PassTextureCache,iu as PathSegments,ip as Player,Ft as PluginSystem,oc as PolyStar,tc as Polygon,wi as Pose,Ke as PoseNode,Tr as PostProcessVolume,jh as PropertyTrack,Fa as RENDER_PASS_NAME_PREFIX,Hu as RENDER_PREFER_LOOKUP_TEXTURE,Xu as RUNTIME_ENV,Ko as RandomSetValue,Qo as RandomValue,Jo as RandomVectorValue,Va as RenderFrame,la as RenderPass,Qn as RenderPassAttachmentStorageType,oa as RenderPassDestroyAttachmentType,aa as RenderPassPriorityNormal,sa as RenderPassPriorityPostprocess,na as RenderPassPriorityPrepare,ua as RenderTargetHandle,Ba as RenderTextureFormat,Xa as Renderbuffer,Ka as Renderer,yr as RendererComponent,Bh as RuntimeClip,Gs as SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0,js as SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0,Us as SEMANTIC_PRE_COLOR_ATTACHMENT_0,Bs as SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0,zs as SPRITE_VERTEX_STRIDE,xf as Scene,Xn as SemanticMap,Ec as SerializationHelper,Pn as Shader,Sn as ShaderCompileResultStatus,Ra as ShaderFactory,Ar as ShaderType,Nn as ShaderVariant,$s as ShapeComponent,hc as ShapePath,ar as SourceType,El as SpriteColorPlayableAsset,Hh as SpriteColorTrack,Al as SpriteComponent,Ou as SpriteLoader,ac as StarType,rr as StateMachineNode,er as StateMachineNodeData,sr as StateNode,nr as StateNodeData,qo as StaticValue,el as SubCompositionPlayableAsset,Wh as SubCompositionTrack,Wu as TEMPLATE_USE_OFFSCREEN_CANVAS,fu as TangentMode,yc as TextComponent,gc as TextComponentBase,dc as TextLayout,xc as TextLoader,pc as TextStyle,fn as Texture,bn as TextureFactory,Ir as TextureLoadAction,Rr as TextureSourceType,Jn as TextureStoreAction,Kf as Ticker,nl as TimelineAsset,zh as TimelineClip,al as TimelinePlayable,Uh as TrackAsset,sl as TrackSortWrapper,Ch as TrackType,ku as Transform,Dl as TransformAnimationPlayable,kl as TransformPlayableAsset,Yh as TransformTrack,hr as TransitionNode,or as TransitionNodeData,ir as TransitionState,gl as VFXItem,Zo as ValueGetter,Qe as ValueNode,vu as Vector2Curve,hl as Vector2PropertyPlayableAsset,Qh as Vector2PropertyTrack,mu as Vector3Curve,pu as Vector4Curve,ul as Vector4PropertyPlayableAsset,Kh as Vector4PropertyTrack,du as WeightedMode,at as addByOrder,V as addItem,k as addItemWithOrder,It as applyMixins,ut as assertExist,ht as asserts,St as base64ToFile,ca as blend,Zl as buildLine,To as calculateTranslation,Y as canUseBOM,fc as canvasPool,Xl as closePointEps,Ea as colorGradingFrag,G as colorStopsFromGradient,U as colorToArr,_f as combineImageTemplate,kn as createCopyShader,wr as createGLContext,hu as createKeyFrameMeta,fs as createShape,Eu as createValueGetter,Hl as curveEps,Ro as decimalEqual,Ot as defaultPlugins,on as deserializeMipmapTexture,rp as disableAllPlayer,Ls as earcut,ke as effectsClass,Ve as effectsClassStore,z as enlargeBuffer,Ac as ensureFixedNumber,Eo as ensureVec3,ka as findPreviousRenderPass,_a as gaussianDownFrag,wa as gaussianDownHFrag,Ca as gaussianDownVFrag,Aa as gaussianUpFrag,Yn as generateEmptyTypedArray,At as generateGUID,dn as generateHalfFloatTexture,vn as generateTransparentTexture,mn as generateWhiteTexture,$d as getActivePlayers,Ef as getBackgroundImage,De as getClass,B as getColorFromGradientStops,qu as getConfig,Tn as getDefaultTextureFactory,Zs as getGeometryByShape,Ys as getGeometryTriangles,gn as getKTXTextureOptions,uu as getKeyFrameMetaByRawValue,Ue as getMergedStore,He as getNodeDataClass,lh as getParticleMeshShader,H as getPixelRatio,Jd as getPlayerByCanvas,zr as getPreMultiAlpha,pf as getStandardComposition,df as getStandardImage,gf as getStandardItem,cf as getStandardJSON,Da as getTextureSize,Mr as glContext,Dr as glType2VertexFormatType,Cr as gpuTimer,it as imageDataFromColor,rt as imageDataFromGradient,Or as initErrors,Pr as initGLContext,da as integrate,j as interpolateColor,tt as isAlipayMiniApp,K as isAndroid,xt as isArray,_t as isCanvas,Qd as isCanvasUsedByPlayer,bt as isFunction,Z as isIOS,q as isIOSByUA,$ as isMiniProgram,Tt as isObject,Q as isOpenHarmony,Et as isPlainObject,J as isSimulatorCellPhone,gt as isString,Cn as isUniformStruct,An as isUniformStructArray,lt as isValidFontFamily,Fr as isWebGL2,et as isWechatMiniApp,ma as itemFrag,fa as itemFrameFrag,pa as itemVert,Zr as loadAVIFOptional,Jr as loadBinary,tn as loadBlob,Kr as loadImage,an as loadMedia,rn as loadVideo,Wr as loadWebPOptional,vt as logger,ea as math,Sl as maxSpriteMeshItemCount,ch as modifyMaxKeyframeShader,Ao as nearestPowerOfTwo,Xe as nodeDataClass,yt as noop,Pc as normalizeColor,Oo as numberToFix,xu as oldBezierKeyFramesToNew,X as parsePercent,va as particleFrag,Co as particleOriginTranslateMap,sh as particleUniformTypeMap,ya as particleVert,Tf as passRenderLevel,Rt as pluginLoaderMap,wt as randomInRange,Nt as registerPlugin,D as removeItem,qs as rotateVec2,Ta as screenMeshVert,ze as serialize,Ur as setBlendMode,Ku as setConfig,En as setDefaultTextureFactory,Gr as setMaskMode,Rl as setMaxSpriteMeshItemCount,So as setRayFromCamera,Br as setSideMode,Il as setSpriteMeshMaxItemCountByGPU,nt as sortByOrder,Pe as spec,Sa as thresholdFrag,Ct as throwDestroyedError,ga as trailVert,yo as translatePoint,Io as trianglesFromRect,Pt as unregisterPlugin,kr as valIfUndefined,xa as value,ba as valueDefine,_o as vecFill,wo as vecMulCombine,sp as version,Vr as vertexFormatType2GLType};
2
2
  //# sourceMappingURL=weapp.mjs.map